Log message #4209721

# At Username Text
# Oct 21st, 07:37 admad @alexdd55976 you will most likely be able to start with Cake 4 then :slightly_smiling_face:
# Oct 21st, 07:15 alexdd55976 2 month until the new big project starts with cake :tada:
# Oct 21st, 07:12 javier.villanueva morning
# Oct 21st, 07:00 alexdd55976 morning dudes and duderinas
# Oct 21st, 05:49 Fastidius off for the day but back in 16 hours for another wrestle
# Oct 21st, 05:49 Fastidius probably safe to say im a bit lost here so if someone can send me a link to an example of a select from a Collection with a few values would be great.
# Oct 21st, 05:45 Fastidius and why are map and combine telling me Call to undefined method App\View\AppView::map()
# Oct 21st, 05:19 Fastidius but i cant really see an example for how to do it
# Oct 21st, 05:19 Fastidius Using collections to build options seems to be the part im looking for in https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-select-checkbox-and-radio-controls
# Oct 21st, 04:59 Fastidius 'options' => $client->client_name gives me Undefined property: Cake\ORM\ResultSet::$client_name so i assume im doing it wrong
# Oct 21st, 04:57 Fastidius looking for some guidance
# Oct 21st, 04:57 Fastidius which has the array items in there but i need to setup the pairings for view vs value and im finding no documentation refering to dropdown on cake php....
# Oct 21st, 04:57 Fastidius now i have <?php echo $this->Form->control('Client_ID', ['options' => $client, 'class' => 'ml10 form-control select-2', 'label' => 'Client', 'onchange' => 'viewClient()', 'empty' => 'Select a client']); ?>
# Oct 21st, 04:56 Fastidius i wish to add a dropdown selector that allows me to type the first few letters of a Name and on selecting the item out of the list then sends me to the View of that ID.
# Oct 21st, 04:56 Fastidius I have a index which is showing all the information i want
# Oct 21st, 04:55 Fastidius hi all. any wisemen available to guide a newbie.
# Oct 20th, 09:35 dereuromark Sandbox.dereuromark.de might have some examples
# Oct 20th, 07:04 francis.nadal hi guys. how do you implement datepicker in cake?
# Oct 20th, 01:30 tlmarker i am trying to build a login in routine that will work foir my android app. the backend in done in cakephp I need a way to use the Default Password Hasher in the routine called from android. but i am having troubles getting it to work.
# Oct 20th, 00:18 challgren @mrfeedback you really shouldn’t be checking the authorization in the model, thats best being done on the controller side. But as other said use muffin/footprint to gain visibility into the authorization in your model
# Oct 19th, 20:58 mrfeedback and how do I check authorization within a model? doesnt seem like the middleware is loaded initially in a model too (at least not when I use unit tests)
# Oct 19th, 20:55 mrfeedback ok thanks
# Oct 19th, 20:53 admad that or use muffin/footprint
# Oct 19th, 20:52 mrfeedback and how can I add the users id when saving a record? do I really have to pass it from the controller?
# Oct 19th, 20:35 mrfeedback is it a bad idea to use authoriztion within models?
# Oct 19th, 15:12 ndm No problem.
# Oct 19th, 15:09 kailas thanks so much for the help!
# Oct 19th, 15:09 kailas @ndm ooh! figured it out! I forgot to change my associated array in my patch entity. once I changed it to ShipmentHandlingUnits.OrderLines everything works!
# Oct 19th, 15:07 kailas @ndm https://gist.github.com/kailasnarendran/ef7b2694d63243a8c47104aae9adf192 is what i’m posting
# Oct 19th, 15:06 kailas @ndm following the format of the add() action. creating new entity then patching. i changed to passing primary key as you suggested and that seems to work. see https://gist.github.com/kailasnarendran/df11c8ca5d97f542882c14ae82c66d50 . now it’s creating the shipment handling unit with the order_line flagged as dirty, but it doesn’t create the OrderLinesShipmentHandlingUnits entity in the _joinData field
# Oct 19th, 15:02 kailas @nds
# Oct 19th, 15:00 kailas @ndm sorry for stepping away. creating a new shipment
# Oct 19th, 14:32 slackebot1 https://book.cakephp.org/3.0/en/orm/saving-data.html#patching-hasmany-and-belongstomany
# Oct 19th, 14:32 ndm Generally if you want to associate existing records, you'd pass the primary key property of that existing record, not the foreign key in the join table, ie `shipment_handling_units[0].order_lines[$i].id` instead of `shipment_handling_units[0].order_lines[$i]._joinData.order_line_id` And if you'd wanted to update a record, you'd usually patch an entity obtained from the database that includes the associated records.
# Oct 19th, 14:21 ndm Are you creating a new shipment, or updating an existing one?
# Oct 19th, 14:19 kailas @ndm ah, yeah, the debugs of the pre-save and the patch arrays was key. part of the problem was the [$i]. should have been .$i. in my form input. now the problem is that it’s trying to create new order lines, rahter than associate with the existing ones
# Oct 19th, 14:13 kailas k
# Oct 19th, 14:13 ndm Well, that might be (part of) your problem. Debug the entity after patching to check what it looks like, and make sure that your `save()` call uses the correct `associated` option too.
# Oct 19th, 14:12 kailas to be clear, i’m patching a newEntity that is empty
# Oct 19th, 14:12 kailas ugh. didn’t work. not sure how to debug this further (since it does save the shipmehandling unit and there are no errors)
# Oct 19th, 14:11 kailas @ndm ok, cool, will try it!