# |
May 16th 2018, 09:44 |
david |
File uploaded https://cakesf.slack.com/files/UAPU3DV3J/FARHH470W/captura.png / https://slack-files.com/T053DPNCM-FARHH470W-4ef3741ad7 |
# |
May 16th 2018, 09:43 |
saeideng |
thanks to confirm the 3.6.3 |
# |
May 16th 2018, 09:42 |
david |
@saeideng that's it... |
# |
May 16th 2018, 09:42 |
david |
and it works |
# |
May 16th 2018, 09:42 |
david |
forget this... I have just updated via composer update to 3.6.3 |
# |
May 16th 2018, 09:42 |
saeideng |
cake 3.6.2 or 3.6.3? |
# |
May 16th 2018, 09:40 |
saeideng |
i mean was `debug($this->request->getUri()->getPath())` |
# |
May 16th 2018, 09:39 |
neon1024 |
@david Just had a thought. You might want to check your middleware, just in case the request is being modified somewhere |
# |
May 16th 2018, 09:39 |
david |
result is null |
# |
May 16th 2018, 09:39 |
david |
@saeideng if I use this in my controller: debug($this->request->getAttribute("here")); |
# |
May 16th 2018, 09:38 |
saeideng |
``` debug($this->getUri()->getPath()) debug($this->request->getAttribute("here")) ``` |
# |
May 16th 2018, 09:38 |
david |
I saw the deprecation in debugkit tab |
# |
May 16th 2018, 09:38 |
neon1024 |
I’m on 3.6.2 |
# |
May 16th 2018, 09:38 |
neon1024 |
I recently updated my project to use that code and it’s worked okay for me |
# |
May 16th 2018, 09:38 |
david |
thank you neon1024 |
# |
May 16th 2018, 09:38 |
neon1024 |
@david I’m not too sure then. I would check the Request tab in DebugKit to see what’s in the request |
# |
May 16th 2018, 09:37 |
neon1024 |
Whereas the template one hasn’t been deprecated yet |
# |
May 16th 2018, 09:37 |
neon1024 |
@saeideng Yeah, just checking as it could be a deprecated `->request` in a controller still |
# |
May 16th 2018, 09:37 |
saeideng |
@neon1024 unrelated to `$this->getRequest()` ;P |
# |
May 16th 2018, 09:36 |
david |
it's 3.6 |
# |
May 16th 2018, 09:36 |
neon1024 |
@david..and you’re running a 3.6.x build of CakePHP? |
# |
May 16th 2018, 09:35 |
saeideng |
use your relation type instead of `belongsToMany` |
# |
May 16th 2018, 09:35 |
neon1024 |
Or do this :point_up: |
# |
May 16th 2018, 09:35 |
saeideng |
``` $this->belongsToMany('Categories', [ 'foreignKey' => 'cat', .... ``` |
# |
May 16th 2018, 09:35 |
neon1024 |
@nitishkumardiwakar If you are going to update your database schema, it should be `category_id` have a look here -> https://book.cakephp.org/3.0/en/intro/conventions.html#database-conventions |
# |
May 16th 2018, 09:35 |
david |
(same result) |
# |
May 16th 2018, 09:35 |
david |
Yes, neon1024, it's in a template, but I also tried it in a controller |
# |
May 16th 2018, 09:34 |
nitishkumardiwakar |
@neon1024 Should I change 'cat' ( in products table) to 'category_id' or 'categories_id'? |
# |
May 16th 2018, 09:34 |
neon1024 |
@david What is `$this` in your code you pasted? Is that in a template? |
# |
May 16th 2018, 09:33 |
neon1024 |
I would recommend fixing your association configuration instead. Just set the correct foreign key in the association |
# |
May 16th 2018, 09:33 |
david |
No, I didn't |
# |
May 16th 2018, 09:33 |
nitishkumardiwakar |
Yes, I am using that. I mean I've to change 'cat' to 'category_id' |
# |
May 16th 2018, 09:32 |
neon1024 |
Woah, that sounds scary. Changing the insert query? Are you not using `save()` ? |
# |
May 16th 2018, 09:32 |
nitishkumardiwakar |
yes |
# |
May 16th 2018, 09:32 |
saeideng |
is `cat` foreign key? |
# |
May 16th 2018, 09:31 |
nitishkumardiwakar |
But now I've to change in product insert update query too. Is there some thing manually used without changing 'cat' in products? |
# |
May 16th 2018, 09:30 |
nitishkumardiwakar |
Ok thanks for pointing it out @neon1024. I am going to fix these |
# |
May 16th 2018, 09:29 |
neon1024 |
However you’ve not followed the foreign key conventions, so you must tell CakePHP about that |
# |
May 16th 2018, 09:29 |
nitishkumardiwakar |
I've tried my best to use cakephp database convention. I've used plural names |
# |
May 16th 2018, 09:29 |
neon1024 |
This could be a route of your issue |
# |
May 16th 2018, 09:29 |
neon1024 |
@nitishkumardiwakar Have you reflected that in your association configuration? As you’re not using the Cake conventions in your database, you will have to configure that |