# |
Jun 25th 2019, 09:51 |
vossen.steven |
@madbbb np I stopped using the ->orwhere + ->andwhere a while ago since it would, in my opinion, do some unexpected stuff and I fell like the way I currently do it is cleaner as well |
# |
Jun 25th 2019, 09:49 |
vossen.steven |
I feel retarded but can someone plz tell me how you're supposed to read/write cookies with the removal of the component? I guess reading is request->getCookie() and for writing I now have to create a cookie object and attach that object to a cookiecollection or something? |
# |
Jun 25th 2019, 09:47 |
madbbb |
thank you! both of your queries are working |
# |
Jun 25th 2019, 09:43 |
conehead |
``` $query->where([ 'OR' => [ ['Trackings.order_id' => $entity->order_id, 'Trackings.ata IS' => null], ['Trackings.order_id' => $entity->order_id, 'Trackings.ata IS NOT' => null, 'Trackings.finish' => true] ] ]) ``` |
# |
Jun 25th 2019, 09:42 |
vossen.steven |
try ``` $query = $this->find() ->where([ 'Trackings.order_id' => $entity->order_id, 'OR' => [ [ 'Trackings.ata IS' => null, ], [ 'Trackings.ata IS NOT' => null, 'Trackings.finish' => true, ], ], ]); ``` |
# |
Jun 25th 2019, 09:41 |
conehead |
madbbb all your OR statements belong into a query |
# |
Jun 25th 2019, 09:38 |
madbbb |
I tried to change it to ``` ->where([ 'OR' => ['Trackings.order_id' => $entity->order_id, 'Trackings.ata IS' => null], ['Trackings.order_id' => $entity->order_id, 'Trackings.ata IS NOT' => null, 'Trackings.finish' => true] ]) ``` but it produced not expected query. |
# |
Jun 25th 2019, 09:36 |
madbbb |
but now I have another problem with orWhere depreciation. can you please help me to rewrite this query to make it 3.7 ready ``` $query = $this->find() ->where(['Trackings.order_id' => $entity->order_id, 'Trackings.ata IS' => null]) ->orWhere(['Trackings.order_id' => $entity->order_id, 'Trackings.ata IS NOT' => null, 'Trackings.finish' => true]); ``` |
# |
Jun 25th 2019, 09:34 |
madbbb |
nothing extraordinary - just glanced through 20 models and seek for forgotten field by myself. |
# |
Jun 25th 2019, 09:30 |
imonsei |
yes please |
# |
Jun 25th 2019, 09:29 |
np |
@madbbb share with us |
# |
Jun 25th 2019, 09:24 |
madbbb |
found the problem |
# |
Jun 25th 2019, 09:11 |
madbbb |
SQL log will help |
# |
Jun 25th 2019, 09:05 |
madbbb |
I'm almost done with updating my tests to 3.7 version of Cake and stuck with this error. There are some integer fields which I converted to UUID and forgot to change schema field type. The problem is that I can't find specific field - I have many models. Is there any possibility to get more verbosity on the error? |
# |
Jun 25th 2019, 08:55 |
ra7bi |
any suggestions what should i do how do i know what is the problem ?. |
# |
Jun 25th 2019, 08:55 |
ra7bi |
the data in post request looks fine but data not stored in `UserPhotos` |
# |
Jun 25th 2019, 08:54 |
ra7bi |
Hello , i've `Report` and `Users` and `UserPhotos` tables , Users belong to `Reports` and `Userphotos` belong To `Users` now i want to insert a data into all table from Users/add |
# |
Jun 25th 2019, 08:45 |
neon1024 |
Morning everyone |
# |
Jun 25th 2019, 08:00 |
madbbb |
@steinkel I got it. This happens on tests where I have more than one $this->post or $this->get method. The configuration is kept somehow in new version that is why my tests fail. |
# |
Jun 25th 2019, 08:00 |
imonsei |
i really appreciate it |
# |
Jun 25th 2019, 08:00 |
imonsei |
thanks for your help so far |
# |
Jun 25th 2019, 08:00 |
admad |
gtg |
# |
Jun 25th 2019, 07:59 |
admad |
that's where the `actions` var comes from https://github.com/cakephp/bake/blob/master/src/Shell/Task/ControllerTask.php#L144 |
# |
Jun 25th 2019, 07:57 |
imonsei |
i'm not at all home in the twig language. and i couldn't figure out where the actual strings for the variables that go into action were being pulled from |
# |
Jun 25th 2019, 07:55 |
madbbb |
@steinkel Thank you. Problem solved |
# |
Jun 25th 2019, 07:55 |
admad |
* `actions` var |
# |
Jun 25th 2019, 07:54 |
imonsei |
oh shit. i was looking a long time at that file yesterday too. |
# |
Jun 25th 2019, 07:54 |
admad |
if you want to use a separate element as you are trying then you have to modify the `action` var to include your method name. For which you will need custom task |
# |
Jun 25th 2019, 07:53 |
admad |
now you could just stick your isAuthorised in there.. |
# |
Jun 25th 2019, 07:53 |
admad |
this is the primary template for controller generation |
# |
Jun 25th 2019, 07:53 |
admad |
https://github.com/cakephp/bake/blob/master/src/Template/Bake/Controller/controller.twig |
# |
Jun 25th 2019, 07:52 |
admad |
wishful thinking doesn't help :slightly_smiling_face: |
# |
Jun 25th 2019, 07:51 |
admad |
what makes you think it should work like that? |
# |
Jun 25th 2019, 07:51 |
imonsei |
but i placed a isauthorized.twig in "plugins\MyBakeTemplate\src\Template\Bake\Element\Controller". but when i bake a controller, the isauthorized function i defined in the twig file is not appearing in the controller |
# |
Jun 25th 2019, 07:51 |
admad |
so either way first get a custom theme working.. then if needed create a custom task |
# |
Jun 25th 2019, 07:50 |
admad |
if the contents of your `isAuthorized() {}` method are going to be "static" then all you need is a new theme |
# |
Jun 25th 2019, 07:49 |
imonsei |
well i initially thought it was just a new theme |
# |
Jun 25th 2019, 07:48 |
admad |
*is deciding |
# |
Jun 25th 2019, 07:48 |
admad |
imonsei: 1st step if deciding whether you actually need a new bake task or just a new theme |
# |
Jun 25th 2019, 07:48 |
imonsei |
i'm pretty sure i'm thinking about it in the wrong way |
# |
Jun 25th 2019, 07:47 |
imonsei |
admad, that's the exact page i'm reading through to try and understand. i'm stuck on how to get the cake bake command to list the foo example. and i feel kinda dense because i spent all day yesterday reading and testing and getting a bit frustrated |