Logs for #cakephp

Page 1 of 36,352, showing 100 records out of 3,635,183 total, starting on record 1, ending on 100

# At Username Text
# Today, 08:29 joechua *info?
# Today, 08:29 joechua anybody here who can give me some onfo?
# Today, 08:01 neon1024 Hey @jotpe
# Today, 07:58 jotpe morning!
# Today, 07:55 joechua im trying to access this url: appic.localhost:8888/api/customers
# Today, 07:47 joechua 'Crud.Index',
# Today, 07:47 joechua these is the content of my appController file
# Today, 07:47 joechua use Cake\Controller\Controller;
# Today, 07:47 joechua does anyone have an idea of what I'm doing wrong?
# Today, 07:46 joechua => 'index']);
# Today, 07:46 joechua Router::prefix('api', function ($routes) {
# Today, 07:46 joechua my routes.php file is:
# Today, 07:46 joechua "errors": [
# Today, 07:46 joechua i always get this error
# Today, 07:46 joechua i am using the crud-json-api package
# Today, 07:45 joechua hello
# Today, 07:37 alexdd55976 lot of changes to 3.6
# Today, 07:37 alexdd55976 i already did my authentication against AD with 4.x :slightly_smiling_face:
# Today, 07:37 admad @alexdd55976 you will most likely be able to start with Cake 4 then :slightly_smiling_face:
# Today, 07:15 alexdd55976 2 month until the new big project starts with cake :tada:
# Today, 07:12 javier.villanueva morning
# Today, 07:00 alexdd55976 morning dudes and duderinas
# Today, 05:49 Fastidius off for the day but back in 16 hours for another wrestle
# Today, 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.
# Today, 05:45 Fastidius and why are map and combine telling me Call to undefined method App\View\AppView::map()
# Today, 05:19 Fastidius but i cant really see an example for how to do it
# Today, 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
# Today, 04:59 Fastidius 'options' => $client->client_name gives me Undefined property: Cake\ORM\ResultSet::$client_name so i assume im doing it wrong
# Today, 04:57 Fastidius looking for some guidance
# Today, 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....
# Today, 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']); ?>
# Today, 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.
# Today, 04:56 Fastidius I have a index which is showing all the information i want
# Today, 04:55 Fastidius hi all. any wisemen available to guide a newbie.
# Yesterday, 09:35 dereuromark Sandbox.dereuromark.de might have some examples
# Yesterday, 07:04 francis.nadal hi guys. how do you implement datepicker in cake?
# Yesterday, 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.
# Yesterday, 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!
# Oct 19th, 14:10 ndm Generally that looks OK I think. Not sure if you actually need to put the foreign key in the form if the entity that you're patching contains all the associated entities.
# Oct 19th, 14:06 kailas @ndm the form inputs are inside a foreach that’s iterating through all the lines I can add
# Oct 19th, 14:04 kailas @ndm so, to put it all in one place, https://gist.github.com/kailasnarendran/ef0bb5536cb9d13a97e5ac3ad4d82252 . does that look right?
# Oct 19th, 14:01 ndm No, if there is no such association and it's just BTM, then this shouldn't be in the `associated` option (there are edge cases where you want to do something like that), and it should just be `ShipmentHandlingUnits.OrderLines`, in that case your original property path would be correct.
# Oct 19th, 13:59 kailas so ShipmentHandlingUnits belongsTo OrderLinesShipmentHandlingUnits (need to add this), so then I can create those entities that will link ShipmentHandlingUnits to OrderLines (via the BTM relationship)
# Oct 19th, 13:57 kailas Do I need to define that explicitly as well?
# Oct 19th, 13:57 kailas yeah, i don’t have an explicit association between ShipmentHandlingUnits and OrderLinesShipmentHandlingUnits (it’s just implied with the BTM between ShipmentHandlingUnits and OrderLines
# Oct 19th, 13:56 ndm No, I just cut of the rest because the problem is the missing association, assuming that the `associated` option is telling the truth.
# Oct 19th, 13:55 kailas oh, i see, so I don’t actually set the value of _joinData, i need to set those fields in .orderlines_shipment_handling_units[] explicitly? so shipment_handling_units[0].orderlines_shipment_handling_units[0].order_line_id=1, shipment_handling_units[0].orderlines_shipment_handling_units[0].qty=3, etc…
# Oct 19th, 13:53 ndm Your path is only two levels deep, but your association is three levels deep. It should be something like `shipment_handling_units[index].orderlines_shipment_handling_units[index].order_lines[index]...`
# Oct 19th, 13:49 kailas @ndm is that the @this->Shipments->patchEntity ?
# Oct 19th, 13:48 kailas @ndm hrm.. i’m sorry, i don’t understand what you mean by “your path is missing the property”
# Oct 19th, 13:47 ndm No no... sorry, I just need to wake up first, it needs and index too. But your path is missing the property for `OrderLinesShipmentHandlingUnits`.
# Oct 19th, 13:46 kailas @ndm shipment_handling_units[0].order_lines[]._joinData.order_line_id = … ?
# Oct 19th, 13:45 kailas @ndm oh, i see, so i should get rid of the $i?
# Oct 19th, 13:45 ndm *c
# Oct 19th, 13:45 ndm Wait, all keys except x
# Oct 19th, 13:45 kailas @ndm so my patch is : $this->Shipments->patchEntity($shipment, $this->request->getData(),[‘associated’=>[‘ShipmentHandlingUnits.OrderLinesShipmentHandlingUnits.OrderLines’]]); my individual lines are (iterating through the order lines) : <?=$this->Form->input(“shipment_handling_units[0].order_lines[$i]._joinData.order_line_id”,[‘type’=>‘hidden’,‘value’=>$orderLine->id]); ?>
# Oct 19th, 13:43 ndm The path is still wrong, all keys need an index ;) Anyways, by default only first level associations are patched and saved, for deeper associations you need to explicitly allow them using the `associated` option for patching and saving, maybe that's your problem.
# Oct 19th, 13:35 kailas I’m trying to create an entity A and B (and existing C) where : A has many B and B BelongsToMany C. in my patch entity array i include the a.b[0].c._joinData.stuff values. On my save, A and B are created, but the join table entities between B and C are not created (from the _joinData data). is that even possible?
# Oct 19th, 12:54 admad When I am faced with such a situation I usually just keep mum :slightly_smiling_face:
# Oct 19th, 12:39 alexdd55976 I would, but I have no experience with all that :,)
# Oct 19th, 12:33 admad In case anyone wants to weight in on this your thoughts are welcome https://github.com/cakephp/cakephp/pull/13766
# Oct 19th, 12:18 loginews @alex. thanks. something else must be wrong. I will investigate.
# Oct 19th, 11:28 alexdd55976 @loginews no, there is no cache. You can see the entries instantly in the database.
# Oct 19th, 09:54 arif.h how to use form element in cake
# Oct 19th, 09:26 loginews Is there then a cache which I have to flush somewhere ?
# Oct 19th, 09:25 loginews My use of cakephp is more or less limited to crud screens generated by the bake utility.
# Oct 19th, 09:24 loginews I had this situation a couple of times. When I tried to look into the problem, the latter disappeared.
# Oct 19th, 09:23 loginews Part of my application is written in pure php.
# Oct 19th, 09:21 loginews as for me, I used cakephp to input data, but it seems that pure php does not see the entries immediately. Is there a cache in cakephp that I should flush somewhere ?
# Oct 19th, 07:42 MaTTze I read in the docs I have to load the TwigView Plugin with boostrap and tried to add it in my Application.php but that didn't help.
# Oct 19th, 07:41 MaTTze Hi guys, maybe someone of you can help me. I started with a fresh cakephp-app-skeleton project and wanted to use bake. But I get an error 'Unknown "as_array" filter'.
# Oct 19th, 02:42 night_wulfe I realize it's a broad question, but any tips would help.
# Oct 19th, 02:39 night_wulfe I have a legacy CakePHP 2.x app that I'm maintaining and have an opportunity to refactor some code. Migrating to 3.x is on the road map, but not something I can do right now due to the size of the application. One of the things that seems wrong to me is the controllers all use find() and save() directly. There are no custom find/save methods and as a result a lot of duplicate code and logic in the controllers. Should all this be moved
# Oct 19th, 02:39 slackebot1 to custom finders and save methods? How do you avoid making the custom find methods extremely complex trying to deal with all the possible options (conditions, fields, count, order, etc) that a user can pass in? Likewise, I feel like the model will end up with dozens of saveBySomeThing() methods to deal with all the variances in how something could be saved. Are there any guidelines available? The book seems to say how to do all this, but not
# Oct 19th, 02:39 slackebot1 necessarily when to do it or what should go where.
# Oct 18th, 20:59 ricksaccous etc etc
# Oct 18th, 20:59 ricksaccous Are you sure you're using the right .ctp file
# Oct 18th, 20:59 ricksaccous @ron.rattie are you displaying the fetched content in the layout? are you sure your plugin is using the regular layout? Are you spitting out things in the actual .ctp file?
# Oct 18th, 20:21 ron.rattie Nothing, the opposite of something. Well the layout pieces I’m the default show but that’s it. I know I’m missing something basic here, but I just back to working in this today