Log message #4055541

# At Username Text
# Jul 21st 2017, 15:41 gutts if I do ->select(['id', 'title']) it wipes out 'comments' I think
# Jul 21st 2017, 15:41 gutts , neon1024
# Jul 21st 2017, 15:41 gutts i want 'id' and 'title' from Posts/$this, but i still want 'comments' => [ ['author' => 'blah' ] ]
# Jul 21st 2017, 15:41 neon1024 Just trying to track down why my find() on the instance returns NULL really
# Jul 21st 2017, 15:40 neon1024 I’m not entirely happy with lines 13 and 14 anyway, I think I might store the instance in a better way, or pass it around
# Jul 21st 2017, 15:39 gutts basically
# Jul 21st 2017, 15:39 gutts so do the select first
# Jul 21st 2017, 15:39 neon1024 Yep
# Jul 21st 2017, 15:39 neon1024 @gutts Yes, like `$this->Examples->find()->select([‘id’, ‘name’])->contain([‘Foo’ => function ($q) { return $q->select([‘Foo.id’, ‘Foo.name’]); }]);
# Jul 21st 2017, 15:39 gutts where I want the latter part of that to be Posts.id/Posts.title
# Jul 21st 2017, 15:39 gutts like if my current model is Posts and I do $this->find()->contain(['COmments' => function($q) { return $q->select(['author']) }])->select(['id', 'title'])
# Jul 21st 2017, 15:38 jay I'd prefer line 12 to be the only line in the try {}
# Jul 21st 2017, 15:37 neon1024 Ah yeah, I am to a degree, but it doesn’t check for Cake\ORM\Table
# Jul 21st 2017, 15:37 gutts neon1024: you mean specify the "current" model selects in contain?
# Jul 21st 2017, 15:36 neon1024 Ahh, perhaps I am!
# Jul 21st 2017, 15:36 jeremyharris @neon1024 looks like you’re rewriting the ModelAwareTrait?
# Jul 21st 2017, 15:36 neon1024 You have to put a `->select()` into your contain :slightly_smiling_face:
# Jul 21st 2017, 15:36 gutts if I do something like $this->find()->contain()->select(['id' => 'id']) the relational fields go away. tried to specify them to no avail
# Jul 21st 2017, 15:35 gutts i'm selecting specific fields in my $this->find()->contains(['Table' => function($q) { } ]) expressions, but I also want my main model to selectively select certain fields. how can I "retain" my relational selects?
# Jul 21st 2017, 15:35 neon1024 @inoas I’m sure we talked about this before and you had something right?
# Jul 21st 2017, 15:35 neon1024 Does anyone have anything more elegant than this? https://pastebin.com/PEtq3zTT
# Jul 21st 2017, 15:11 jeremyharris next cakefest for sure. keep having things come up that interrupt them
# Jul 21st 2017, 15:10 neon1024 Will have to get you a beer at Cakefest :beer:
# Jul 21st 2017, 15:10 jeremyharris no problem :slightly_smiling_face:
# Jul 21st 2017, 15:10 neon1024 Thanks for all the help @jeremyharris I appreciate it :slightly_smiling_face:
# Jul 21st 2017, 15:08 jeremyharris @neon1024 yes
# Jul 21st 2017, 15:08 bernat I'll do a PR and see what comments I get.
# Jul 21st 2017, 15:08 jeremyharris or, perhaps, remove the post data example (marshaling) from the one in the saving entities section, and remove the entity example from the other one
# Jul 21st 2017, 15:08 bernat yes, I'll do now that I have some kind of confirmation. thanks!
# Jul 21st 2017, 15:07 neon1024 So the first record is id 1?
# Jul 21st 2017, 15:07 neon1024 So am I right in assuming this is auto increment?
# Jul 21st 2017, 15:07 neon1024 https://github.com/cakephp/cakephp/blob/master/tests/Fixture/ArticlesFixture.php#L45
# Jul 21st 2017, 15:07 jeremyharris yeah it looks pretty duplicated. perhaps you can edit the doc?
# Jul 21st 2017, 15:06 bernat probably the section in my link should be removed because it seems to be already documented in your link
# Jul 21st 2017, 15:06 bernat doesn't it seem like there's something duplicated and outdated there?
# Jul 21st 2017, 15:05 jeremyharris yes, I think that might be wrong
# Jul 21st 2017, 15:05 jeremyharris sorry I got confused by all the examples, didn’t know which one you were looking at
# Jul 21st 2017, 15:05 jeremyharris I see
# Jul 21st 2017, 15:05 bernat that's the example I was referring to, sorry
# Jul 21st 2017, 15:05 bernat jeremyharris, please see the second code block in my link
# Jul 21st 2017, 15:04 bernat I'm not sure. To me the Tags example is wrong because it doesn assign the result of the newEntity call. There's no save in it, it's like the other example.