# |
Jul 10th 2019, 22:06 |
noel |
Hi guys. Any chance of an updated Sublime Text package for CakePHP? |
# |
Jul 10th 2019, 17:26 |
dereuromark |
I opened some docs issues on the missing data. If only I had a bit more time then I would do it myself. |
# |
Jul 10th 2019, 17:16 |
dereuromark |
bibel23 |
# |
Jul 10th 2019, 15:28 |
neon1024 |
So this matches an expiry or null |
# |
Jul 10th 2019, 15:27 |
neon1024 |
So I used `notMatching()` and then looked for the condition |
# |
Jul 10th 2019, 15:27 |
neon1024 |
I ended up with this |
# |
Jul 10th 2019, 15:27 |
slackebot |
<neon1024> |
# |
Jul 10th 2019, 15:26 |
neon1024 |
It’s like saying I want this Article, but I want none or many associations, and using matching removes the parent record, right? |
# |
Jul 10th 2019, 15:26 |
neon1024 |
I didn’t, but I have it in a project |
# |
Jul 10th 2019, 15:25 |
neon1024 |
Let me check |
# |
Jul 10th 2019, 15:25 |
neon1024 |
I think I blogged it |
# |
Jul 10th 2019, 15:25 |
neon1024 |
I had to use an inverse not matching |
# |
Jul 10th 2019, 15:25 |
neon1024 |
Oh so you want to optionally get associations? |
# |
Jul 10th 2019, 15:24 |
waspinator |
right but I'm filtering articles based on associations, not just excluding associated data. I think I need to look at `leftJoinWith` |
# |
Jul 10th 2019, 15:24 |
neon1024 |
That’s the approach I use anyway. If I’ve understood your use-case correctly that is 8) |
# |
Jul 10th 2019, 15:23 |
slackebot |
<neon1024> |
# |
Jul 10th 2019, 15:22 |
neon1024 |
Or better yet, use a custom finder on the table |
# |
Jul 10th 2019, 15:22 |
neon1024 |
If you wanted to stipulate ‘new’ you’d use a callback in the contain to add a where condition |
# |
Jul 10th 2019, 15:22 |
neon1024 |
Using contain will get you all associations |
# |
Jul 10th 2019, 15:21 |
neon1024 |
It’s my understanding that that’s literally it’s job |
# |
Jul 10th 2019, 15:21 |
neon1024 |
Yeah, you’re using inner join |
# |
Jul 10th 2019, 15:20 |
waspinator |
when I have both the `innerJoinWith` the article has to have a new `comment` AND a new `tag` to be included in the results |
# |
Jul 10th 2019, 15:19 |
waspinator |
well if an article only has a new comment I still want it |
# |
Jul 10th 2019, 15:19 |
neon1024 |
$this->Articles->find()->contain([‘Comments’, ‘Tags’])` |
# |
Jul 10th 2019, 15:19 |
neon1024 |
Like, logically they’d be equal right? |
# |
Jul 10th 2019, 15:19 |
neon1024 |
Wouldn’t that be an and? |
# |
Jul 10th 2019, 15:09 |
waspinator |
can you have two `->innerJoinWith`s do an `or` instead of an `and`? for example find all `articles` with new `comments` or new `tags` |
# |
Jul 10th 2019, 15:03 |
neon1024 |
Was just making sure it would work, but it seems everything works ;) |
# |
Jul 10th 2019, 15:03 |
neon1024 |
https://3v4l.org/59sPo |
# |
Jul 10th 2019, 15:03 |
neon1024 |
I’ll `use ($myTableInstance)` in my closure I guess |
# |
Jul 10th 2019, 15:02 |
neon1024 |
Thanks for the tips @ndm |
# |
Jul 10th 2019, 15:02 |
neon1024 |
Figured a transaction would be the way |
# |
Jul 10th 2019, 15:02 |
neon1024 |
..and change a field |
# |
Jul 10th 2019, 15:02 |
neon1024 |
Oh right, I want to duplicate 5-6 records |
# |
Jul 10th 2019, 15:00 |
ndm |
@neon1024 The callback receives a connection instance, not a query instance, there will be no query. And yes, you can use the ORM inside of a transaction, just make sure to set the `atomic` option to `false` when saving/deleting in case required (ie if you don't want to use nested transactions). |
# |
Jul 10th 2019, 14:55 |
inoas |
good evening guys |
# |
Jul 10th 2019, 14:55 |
inoas |
I really hope the next one is somewhere I can get to with a train even if it takes 30h |
# |
Jul 10th 2019, 14:54 |
inoas |
I need to go to some cake fest |
# |
Jul 10th 2019, 14:54 |
lorenzo |
no problem! |
# |
Jul 10th 2019, 14:54 |
inoas |
lorenzo thanks again for helping out, that saved me tons of time, I am certain an exists solution had worked too but it would have been clunky at best |
# |
Jul 10th 2019, 14:53 |
neon1024 |
I presume the callback would take a query instance? |