# |
Mar 15th 2019, 16:06 |
lorro |
Hi, I'm trying to setup a custom association that converts a hasMany association into a hasOne association. I would like to have a custom association that fetches the last created record of an associated model. I was following this subquery suggestion as mentioned on stackoverflow: https://stackoverflow.com/questions/30241975/how-to-limit-contained-associations-per-record-group but to no avail. ```php $this->hasOne('LatestClosedReports', [ |
# |
Mar 15th 2019, 16:02 |
gareth.ellis |
php 7.2 |
# |
Mar 15th 2019, 16:02 |
gareth.ellis |
php 7.1 |
# |
Mar 15th 2019, 15:39 |
neon1024 |
No idea then, all i can think is that the problem is not where you think it is, but that it’s a result which has bubbled up from elsewhere |
# |
Mar 15th 2019, 15:38 |
gareth.ellis |
operation operation is one of the following: LOCK_SH to acquire a shared lock (reader). LOCK_EX to acquire an exclusive lock (writer). LOCK_UN to release a lock (shared or exclusive). LOCK_NB to not block while locking. |
# |
Mar 15th 2019, 15:38 |
gareth.ellis |
LOCK_EX is the arg passed to SplFileObject::flock() |
# |
Mar 15th 2019, 15:38 |
gareth.ellis |
_File is an SplFileObject |
# |
Mar 15th 2019, 15:37 |
gareth.ellis |
no LOCK_EX is an int |
# |
Mar 15th 2019, 15:34 |
neon1024 |
I presume that’s not a stream resource then? |
# |
Mar 15th 2019, 15:34 |
neon1024 |
So LOCK_EX is an instance of SplFileObject |
# |
Mar 15th 2019, 15:30 |
gareth.ellis |
both are using `SplFileObject` under the hood |
# |
Mar 15th 2019, 15:30 |
gareth.ellis |
the implementation of `FileEngine` looks very similar between 3.x and 2.x tbh |
# |
Mar 15th 2019, 15:27 |
admad |
Sorry I now see you are using 2.x, my response was in reference to 3.x |
# |
Mar 15th 2019, 15:26 |
gareth.ellis |
:) |
# |
Mar 15th 2019, 15:26 |
gareth.ellis |
so |
# |
Mar 15th 2019, 15:26 |
gareth.ellis |
but it has been for about 3 years |
# |
Mar 15th 2019, 15:26 |
gareth.ellis |
migrating to linux is on our roadmap |
# |
Mar 15th 2019, 15:26 |
gareth.ellis |
our prod servers run on windows too at the moment |
# |
Mar 15th 2019, 15:26 |
gareth.ellis |
that would be nice |
# |
Mar 15th 2019, 15:26 |
admad |
Start using a better dev environment :slightly_smiling_face: |
# |
Mar 15th 2019, 15:26 |
gareth.ellis |
:) |
# |
Mar 15th 2019, 15:26 |
gareth.ellis |
the venn diagram overlap of people who might be experiencing this is getting smaller |
# |
Mar 15th 2019, 15:25 |
admad |
@gareth.ellis might be a windows specific issue. I haven't encountered issue with file cache on 7.2 on linux |
# |
Mar 15th 2019, 15:20 |
gareth.ellis |
just wondered if anyone else had seen the same thing with cake |
# |
Mar 15th 2019, 15:20 |
gareth.ellis |
i've read through the php bug list |
# |
Mar 15th 2019, 15:20 |
gareth.ellis |
I can't see any changes in php 7.2 to do with streams/file system |
# |
Mar 15th 2019, 15:20 |
gareth.ellis |
doesn't happen in php 7.1 |
# |
Mar 15th 2019, 15:20 |
gareth.ellis |
then a bunch of errors that happen in php shutdown |
# |
Mar 15th 2019, 15:20 |
gareth.ellis |
so I get green tests |
# |
Mar 15th 2019, 15:19 |
gareth.ellis |
initiated by `Mysql::__destruct` |
# |
Mar 15th 2019, 15:19 |
gareth.ellis |
and then in the shutdown sequence |
# |
Mar 15th 2019, 15:19 |
gareth.ellis |
read/write both get called twice, once setting up cakephp core cache as part of testsuite bootstrap |
# |
Mar 15th 2019, 15:19 |
gareth.ellis |
no i'm using xdebug |
# |
Mar 15th 2019, 15:18 |
neon1024 |
Since swapped to using `Log::debug()` more often now |
# |
Mar 15th 2019, 15:18 |
neon1024 |
Are you certain that it’s not called more than once and you’ve used `var_dump();exit;` so only seeing the first executions passed params? I do that all the time |
# |
Mar 15th 2019, 15:17 |
gareth.ellis |
yes that's a php constant |
# |
Mar 15th 2019, 15:17 |
gareth.ellis |
i've step-debugged it and it creates the `_File` property as an `SplFileObject` in `FileEngine::read()` |
# |
Mar 15th 2019, 15:17 |
neon1024 |
I presume the constant `LOCK_EX` is defined? |
# |
Mar 15th 2019, 15:16 |
gareth.ellis |
this is in `FileEngine::write()` |
# |
Mar 15th 2019, 15:16 |
gareth.ellis |
the middle line there is line 138 |
# |
Mar 15th 2019, 15:16 |
gareth.ellis |
` if ($this->settings['lock']) { $this->_File->flock(LOCK_EX); }` |