Log message #3941267

# At Username Text
# Oct 1st 2016, 16:09 rsadza true, the only thing I'm afraid of is that somebody will change an input from cents to euros or vice-versa, and forget to change the marshaller ;)
# Oct 1st 2016, 16:08 rsadza the Money class keeps the information (Money::EUR(500) = 5.00 euro), but you still need to know if you should multiply by 100
# Oct 1st 2016, 16:07 hmic if it's not. you know when to apply it: when marshalling data to the entity. you have a marshaller for the money class anyways, put the code there so it's all in one place and not duplicated whatsoever
# Oct 1st 2016, 16:06 hmic rsadza: isn't it the money class to take care of all of that details?
# Oct 1st 2016, 15:59 rsadza Is there some way to do this in a nice way? I think that the best place to define if the value will need to be converted is in the Form helper, so that if we switch the input from euros to eurocents, we don't need to change code elsewhere.
# Oct 1st 2016, 15:57 slackebot convert it to Money(), we need to parse the input data (e.g. replace comma by dot) and multiply by 100 if its not in cents. If we would do this in the Entity, the Entity would have knowledge of the input type, but we also don' t want to clutter our controller.
# Oct 1st 2016, 15:57 rsadza I have a question regarding converting request data to an Entity. In our application we are using the moneyphp/money object to represent currencies, to prevent bugs due to multicurrency (e.g. accidentally adding euros to dollars). We are unsure where we should convert the request data to the money object. It would make sense to use the beforeMarshall / setter methods. However: in some cases users can enter money in cents, in some cases in euro
# Oct 1st 2016, 15:51 rsadza Hi guys!
# Oct 1st 2016, 14:44 ndm Most probably the better choice in that case.
# Oct 1st 2016, 14:41 thinkingmedia ``` $routes->connect('/follow',[ 'prefix'=>'Api/Boards', 'controller'=>'Follow', 'action'=>'edit', '_method'=>'PUT' ]); ```
# Oct 1st 2016, 14:41 thinkingmedia I ended up doing my own connect. I think later it's easier to read and see what I was intending.
# Oct 1st 2016, 14:40 ndm @thinkingmedia Have to correct myself, while the default path value is `:id` in the default resource map configuration, when overwriting/creating a resource action, the default path value is the name of the resource, ie `update` and `delete` in this case. Anyhow, passing an empty path is what does the trick.
# Oct 1st 2016, 14:24 thinkingmedia ah for sure, I get it. thanks :slightly_smiling_face:
# Oct 1st 2016, 14:04 ndm The path is being appended to the `$url` argument when connecting the route
# Oct 1st 2016, 14:04 ndm Because that's what does the trick, the default path is `:id`
# Oct 1st 2016, 14:03 thinkingmedia @ndm thanks! Why did you set path to an empty string?
# Oct 1st 2016, 14:02 ndm @thinkingmedia By creating the routes completely on your own, or by modifying the default resource map for `RouteBuilder::resources()` so that the path doesn't contain any ID route elements, like https://gist.github.com/ndm2/30c59b00326c4d5fd71a5237b9d73527
# Oct 1st 2016, 13:48 sandeep_ Hi
# Oct 1st 2016, 13:29 thinkingmedia How can I create a REST resource that can `update` and `delete` without an `ID`?
# Oct 1st 2016, 13:12 prophet 'foreignKey' => 'user_id' that is wrong. It has to be 'association_id'. That fixed it. Thanks hmic.
# Oct 1st 2016, 13:11 prophet Oh wait.
# Oct 1st 2016, 13:10 prophet yes, that is what I did
# Oct 1st 2016, 13:08 hmic in the belongstomany one
# Oct 1st 2016, 13:08 prophet You mean: 'foreignKey' => 'user_id' ? Nothing changed
# Oct 1st 2016, 13:06 hmic so you need to add the corect association keys
# Oct 1st 2016, 13:03 prophet Column not found: 1054 Unknown column 'UserAssociation.member_id' in 'field list'
# Oct 1st 2016, 13:03 prophet Yes, it does. I called 'ManyUsers' 'Members'. I get a Database Error.
# Oct 1st 2016, 12:59 hmic makes sense, does it?
# Oct 1st 2016, 12:59 hmic and you do need to contain both, if you want both, so contain => ['Users', 'ManyUsers']
# Oct 1st 2016, 12:59 hmic so : belongsTo('Users'), belongsToMany('ManyUsers')
# Oct 1st 2016, 12:58 hmic first you even need to call the associations differently
# Oct 1st 2016, 12:58 hmic prophet, you need to add a propertyName key to the belongsTo(Many) definitions(s)
# Oct 1st 2016, 12:48 prophet My AssociationsTable is linked to Users via belongsTo and belongsToMany. But only the belongsToMany relation is loaded when I get the association with 'contain' => ['Users']. http://pastebin.com/7QPkKRiQ What should I check to get it working?
# Oct 1st 2016, 12:30 cakephp861 Friends help
# Oct 1st 2016, 12:24 cakephp861 I mean what kind of table association i have to use: 1) course and student or 2)course and users
# Oct 1st 2016, 12:23 cakephp861 Hi, I need help in setup Many to many relation. I have two kind of users(admin, student), Student can opt for courses. So for Many to many relation we should courses_students or courses_users. As using auth we can get user_id easyly
# Oct 1st 2016, 12:14 hmic welcome
# Oct 1st 2016, 12:11 maikh dumbass
# Oct 1st 2016, 12:11 maikh it needed the plurals 'S'
# Oct 1st 2016, 12:11 maikh it was a naming problem. :slightly_smiling_face:
# Oct 1st 2016, 12:11 maikh oh... now it works.