# |
Oct 6th 2018, 23:15 |
rightscoreanalysis |
can I get the parent/main table fields by default without having to list them all? |
# |
Oct 6th 2018, 23:14 |
rightscoreanalysis |
that performs the join but I literally just see the joined model id |
# |
Oct 6th 2018, 23:14 |
slackebot |
<rightscoreanalysis> |
# |
Oct 6th 2018, 23:14 |
rightscoreanalysis |
Ok I am getting closer |
# |
Oct 6th 2018, 23:09 |
dereuromark |
try join and selecting the fields you need |
# |
Oct 6th 2018, 23:08 |
rightscoreanalysis |
so should I persist with Contain or Join in this case? |
# |
Oct 6th 2018, 23:08 |
dereuromark |
I see. yeah, the joins here are wrong then |
# |
Oct 6th 2018, 23:04 |
rightscoreanalysis |
Column not found: 1054 Unknown column 'Rooms.id' in 'where clause' |
# |
Oct 6th 2018, 23:04 |
rightscoreanalysis |
the error I got which lead me to believe contain would not work for me in this case is: |
# |
Oct 6th 2018, 23:04 |
rightscoreanalysis |
https://gist.github.com/spacebiscuit/13497a100c2f6c453c4f3d097dd78498 |
# |
Oct 6th 2018, 23:04 |
rightscoreanalysis |
this is what I was attempting with contains: |
# |
Oct 6th 2018, 22:59 |
rightscoreanalysis |
Ok let me post my previous contains to see if I can expalin the issue I had |
# |
Oct 6th 2018, 22:56 |
dereuromark |
the join probably doesnt without select() field naming. another reason to use relations and contain :slightly_smiling_face: I guess |
# |
Oct 6th 2018, 22:55 |
rightscoreanalysis |
but when I debug $result->first() I do not see the model I have joined on |
# |
Oct 6th 2018, 22:53 |
rightscoreanalysis |
ok so moving the 'first()' to the end of the query fixes the error I was seeing |
# |
Oct 6th 2018, 22:52 |
dereuromark |
find() and count(), all() are closing ones. after that you get a collection, not a query |
# |
Oct 6th 2018, 22:52 |
dereuromark |
you need to understand how the orm works. |
# |
Oct 6th 2018, 22:51 |
rightscoreanalysis |
ok so find() should be the last thing |
# |
Oct 6th 2018, 22:51 |
dereuromark |
you cannot close a query though and then continue doing things on the resulting entity. |
# |
Oct 6th 2018, 22:51 |
rightscoreanalysis |
Or Properties / properties |
# |
Oct 6th 2018, 22:51 |
rightscoreanalysis |
should it be singlur Property with table named 'properties' |
# |
Oct 6th 2018, 22:50 |
rightscoreanalysis |
I am modelling Properties |
# |
Oct 6th 2018, 22:50 |
dereuromark |
the error message tells you that (entity vs table/query) |
# |
Oct 6th 2018, 22:50 |
rightscoreanalysis |
I think there maybe some confusion with my model names |
# |
Oct 6th 2018, 22:50 |
dereuromark |
where()->leftJoin()->first() |
# |
Oct 6th 2018, 22:50 |
rightscoreanalysis |
Ok I'll take a few steps back |
# |
Oct 6th 2018, 22:50 |
dereuromark |
also, first() closes a query, why are you doing leftJoin after a first()? |
# |
Oct 6th 2018, 22:49 |
dereuromark |
using ->belongsTo(), ->has...() etc |
# |
Oct 6th 2018, 22:49 |
dereuromark |
still, you could set up all the relations |
# |
Oct 6th 2018, 22:48 |
rightscoreanalysis |
it's because I need to do some deep filtering |
# |
Oct 6th 2018, 22:47 |
dereuromark |
why are you doing manual joins? I always set up my relations in the table classes and then can just use contain() |
# |
Oct 6th 2018, 22:47 |
rightscoreanalysis |
similarly I am also getting: Call to undefined method App\Model\Entity\Property::innerJoinWith() |
# |
Oct 6th 2018, 22:44 |
rightscoreanalysis |
I am unable to do any joins it seems |
# |
Oct 6th 2018, 22:38 |
rightscoreanalysis |
leftJoin - sorry typo |
# |
Oct 6th 2018, 22:38 |
slackebot |
<rightscoreanalysis> |
# |
Oct 6th 2018, 22:30 |
dereuromark |
lef or left? |
# |
Oct 6th 2018, 22:28 |
rightscoreanalysis |
why is that? |
# |
Oct 6th 2018, 22:28 |
rightscoreanalysis |
I tried another approach and now I see: Call to undefined method App\Model\Entity\Property::lefJoin() |
# |
Oct 6th 2018, 22:18 |
rightscoreanalysis |
do I need to specify the fields in order to see the join, I seems to remember something similar in cake2 |
# |
Oct 6th 2018, 22:18 |
rightscoreanalysis |
hi guys, I'm doing a simple join on my query - when I debug the result it is empty |
# |
Oct 6th 2018, 21:28 |
murat |
I haven't used that before. Thanks. |