# |
Sep 12th 2019, 15:48 |
jh |
like so https://gist.github.com/inoas/1226835ee066cf54c3bf1f30b1ec028d |
# |
Sep 12th 2019, 15:46 |
jh |
@admad yay it works... custom AppErrorMiddleware |
# |
Sep 12th 2019, 15:45 |
jh |
I would be explicit about it. |
# |
Sep 12th 2019, 15:45 |
jh |
a references b references a |
# |
Sep 12th 2019, 15:45 |
jh |
@ricksaccous if you setup a recursive function, yes, but do not forget that there can be loops so you need to stop the looping |
# |
Sep 12th 2019, 15:43 |
this.impetus |
:slightly_smiling_face: |
# |
Sep 12th 2019, 15:43 |
ricksaccous |
oh well, good luck |
# |
Sep 12th 2019, 15:43 |
ricksaccous |
lolll |
# |
Sep 12th 2019, 15:43 |
ricksaccous |
70 page CV, would anyone even read that |
# |
Sep 12th 2019, 15:43 |
this.impetus |
He has a 70 page CV. Guy is a luminary. Haha, but in any case, failing to have found a magic bullet, I'll just do it by hand. thanks, as usual |
# |
Sep 12th 2019, 15:42 |
ricksaccous |
but it also sounds like if it's just a single CV how bad could the query actually be anyway |
# |
Sep 12th 2019, 15:42 |
ricksaccous |
welp, good luck sounds like you could adjust the associations based on request data though |
# |
Sep 12th 2019, 15:41 |
this.impetus |
lol I need all the fields, haha. I'm building a digital CV for an academic who wants it utterly modular so a visitor could assemble a PDF based on which lines they want, it's a crazy amount of work to just print out what is essentially a document |
# |
Sep 12th 2019, 15:40 |
ricksaccous |
i know it's tedious but sometimes it's worth it |
# |
Sep 12th 2019, 15:40 |
ricksaccous |
you might want to specify fields in the contain array if you could |
# |
Sep 12th 2019, 15:40 |
ricksaccous |
really really really slow |
# |
Sep 12th 2019, 15:39 |
ricksaccous |
that query might be really really really slow |
# |
Sep 12th 2019, 15:39 |
this.impetus |
recursive retrieval is indeed what I'm after here. I can just write this out as an array, it's just tedious |
# |
Sep 12th 2019, 15:39 |
ricksaccous |
not just all associations on the main table |
# |
Sep 12th 2019, 15:39 |
ricksaccous |
it seems he wants child associations of child associations |
# |
Sep 12th 2019, 15:38 |
this.impetus |
@jh I'll give that a shot, thanks |
# |
Sep 12th 2019, 15:38 |
ricksaccous |
@jh would that work recursively though? |
# |
Sep 12th 2019, 15:38 |
jh |
try get_class_methods($this->Articles) should have some getAssociations() or so class |
# |
Sep 12th 2019, 15:37 |
this.impetus |
@ricksaccous yeah I figured. I just *actually* have a context where it is required—the relationships go several assocations deep and I actually need them all |
# |
Sep 12th 2019, 15:37 |
jh |
but it is bad practise |
# |
Sep 12th 2019, 15:37 |
ricksaccous |
so i listened |
# |
Sep 12th 2019, 15:37 |
jh |
you can do that by getting a list of all assocaitions from the table class |
# |
Sep 12th 2019, 15:37 |
ricksaccous |
then @dereuromark told me don't be a lazy boi |
# |
Sep 12th 2019, 15:37 |
ricksaccous |
I once wanted to contain all the associations like you |
# |
Sep 12th 2019, 15:37 |
ricksaccous |
so $this->find() will be sufficient |
# |
Sep 12th 2019, 15:36 |
ricksaccous |
and that's the default actually |
# |
Sep 12th 2019, 15:36 |
ricksaccous |
but find('all') is still a thing |
# |
Sep 12th 2019, 15:36 |
ricksaccous |
@this.impetus not really you should specify contain |
# |
Sep 12th 2019, 15:36 |
jotpe |
hm; I'll dig a bit, thanks @ricksaccous @inoas |
# |
Sep 12th 2019, 15:35 |
this.impetus |
Hey guys, is there an equivalent to this ```$this->Model->find('all')->contain('all')```? |
# |
Sep 12th 2019, 15:34 |
ricksaccous |
@jotpe likely an association is set up using the wrong fk/binding key |
# |
Sep 12th 2019, 15:33 |
admad |
@jh no, use your own table locator if you want that |
# |
Sep 12th 2019, 15:30 |
jotpe |
Doesn't set the fk |
# |
Sep 12th 2019, 15:30 |
jotpe |
Error: SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value |
# |
Sep 12th 2019, 15:30 |
jotpe |
but didn't seem to work neither o.O |
# |
Sep 12th 2019, 15:30 |
ricksaccous |
cool, glad you got it figured out |