# |
Jun 27th 2018, 08:39 |
neon1024 |
etc |
# |
Jun 27th 2018, 08:39 |
neon1024 |
`$this->Contents->Parent->find()` |
# |
Jun 27th 2018, 08:39 |
neon1024 |
`$this->Parent->find()` `$this->Children->find()` `$this->Contents->find()` |
# |
Jun 27th 2018, 08:38 |
neon1024 |
So these are all now valid |
# |
Jun 27th 2018, 08:37 |
neon1024 |
https://ghostbin.com/paste/ob7fs |
# |
Jun 27th 2018, 08:36 |
neon1024 |
All defined in the ContentsTable |
# |
Jun 27th 2018, 08:36 |
neon1024 |
Where Parent and Children are aliases of Contents |
# |
Jun 27th 2018, 08:36 |
neon1024 |
Where Contents belongsTo Parent, and Content hasMany Children |
# |
Jun 27th 2018, 08:36 |
neon1024 |
$this->Contents->find()->contain([‘Parent’, ‘Children’]); |
# |
Jun 27th 2018, 08:35 |
neon1024 |
If you’ve aliased `SomeModel2` as `Parent` then use `Parent` |
# |
Jun 27th 2018, 08:35 |
magiq_ |
*it doesn't know |
# |
Jun 27th 2018, 08:35 |
magiq_ |
but my query not working since it not know what the fck it SomeModel2.Parent |
# |
Jun 27th 2018, 08:35 |
magiq_ |
SomeModel belongsTo SomeModel2 and SomeModel2 belongsTo SomeModel2 and has alias Parent |
# |
Jun 27th 2018, 08:34 |
neon1024 |
But I will try |
# |
Jun 27th 2018, 08:34 |
neon1024 |
Not sure I have the energy this early in the morning to write your code for you |
# |
Jun 27th 2018, 08:34 |
magiq_ |
can you write example |
# |
Jun 27th 2018, 08:33 |
neon1024 |
Just query them using the alias, as you would a regular model |
# |
Jun 27th 2018, 08:33 |
magiq_ |
I already define association, but I cant to query to relation of related models |
# |
Jun 27th 2018, 08:33 |
neon1024 |
The same way you would if you were creating a thread in a single model |
# |
Jun 27th 2018, 08:32 |
neon1024 |
Well you’d alias the models |
# |
Jun 27th 2018, 08:32 |
neon1024 |
Also, I would suggest that in fact it’s not related to itsself, as the association is in the parent. If I understand you correctly |
# |
Jun 27th 2018, 08:32 |
magiq_ |
how to $query->where(['SomeModel2.Parent.Type' => 1']) |
# |
Jun 27th 2018, 08:32 |
slackebot4 |
!ruleone |
# |
Jun 27th 2018, 08:32 |
slackebot4 |
Command sent from Slack by neon1024: |
# |
Jun 27th 2018, 08:31 |
magiq_ |
$query = $this->SomeModel() ... This model has relation to another model for example SomeModel2, and SomeModel2 has relation to itself through parent |
# |
Jun 27th 2018, 08:30 |
magiq_ |
I got $this->SomeModel |
# |
Jun 27th 2018, 08:30 |
neon1024 |
Morning all |
# |
Jun 27th 2018, 08:20 |
hmic |
you can create the jointable as a regular table too with belongsTo both other tables and query this table directly ;) |
# |
Jun 27th 2018, 08:20 |
hmic |
chrisshick: use through association |
# |
Jun 27th 2018, 07:15 |
chrisshick |
using the association? |
# |
Jun 27th 2018, 07:15 |
chrisshick |
Is there a way to query on data in middle table of a belongs to many? |
# |
Jun 27th 2018, 05:12 |
narendravaghela |
morning all |
# |
Jun 26th 2018, 21:09 |
chrispecoraro |
Is there some camel-case magic going on here? |
# |
Jun 26th 2018, 21:09 |
chrispecoraro |
If I name a controller `EmployerApiController.php`, it looks for `ApiController` |
# |
Jun 26th 2018, 21:06 |
chrispecoraro |
figured it out.. ROOT was set one level below my app name... |
# |
Jun 26th 2018, 21:03 |
jurrieb |
thanks! |
# |
Jun 26th 2018, 21:03 |
itmpls |
er - who had a subdomain setup with cake and middleware here? |
# |
Jun 26th 2018, 20:56 |
saeideng |
$request->withParam |
# |
Jun 26th 2018, 20:52 |
jurrieb |
Hello can some one tell me if i can set a request parameter? |
# |
Jun 26th 2018, 20:44 |
chrispecoraro |
I get "Controller class ApiController could not be found." I guess there is some magic going on somewhere... |
# |
Jun 26th 2018, 20:44 |
chrispecoraro |
So I can then have `Controller/api/v1/EmployeeApiController.php`? |