# |
Jul 2nd 2018, 13:52 |
joshualuckers |
https://github.com/cakephp/cakephp/blob/07457ed8351daf212a7d9ae4b86fba3daf5f5ffd/src/Datasource/EntityTrait.php#L899 |
# |
Jul 2nd 2018, 13:51 |
joshualuckers |
https://github.com/cakephp/cakephp/blob/d99756209299cd3c076ad418c795659420e448e0/src/ORM/Table.php#L1905 |
# |
Jul 2nd 2018, 13:50 |
itmpls |
what function calls that? within validation? |
# |
Jul 2nd 2018, 13:49 |
joshualuckers |
EntityTrait |
# |
Jul 2nd 2018, 13:49 |
itmpls |
where is that in? |
# |
Jul 2nd 2018, 13:49 |
slackebot4 |
}) ->filter() ->toArray(); ``` |
# |
Jul 2nd 2018, 13:49 |
joshualuckers |
This part seems slow, didnt check it with xdebug (no time atm). WIll check for that later. ``` $diff = array_diff_key($this->_properties, $this->_errors); return $this->_errors + (new Collection($diff)) ->filter(function ($value) { return is_array($value) || $value instanceof EntityInterface; }) ->map(function ($value) { return $this->_readError($value); |
# |
Jul 2nd 2018, 13:49 |
joshualuckers |
This part seems slow, didnt check it with xdebug (no time atm). WIll check for that later. ``` |
# |
Jul 2nd 2018, 13:48 |
itmpls |
with xdebug for example |
# |
Jul 2nd 2018, 13:47 |
itmpls |
can you try profiling and see which part of the validation is slow? |
# |
Jul 2nd 2018, 13:47 |
joshualuckers |
i tried, without luck |
# |
Jul 2nd 2018, 13:47 |
itmpls |
bypassing it rather |
# |
Jul 2nd 2018, 13:47 |
itmpls |
oh, because of the validation? |
# |
Jul 2nd 2018, 13:47 |
joshualuckers |
Uncommenting this in the Table class solves the slowness: ``` if ($entity->getErrors()) { return false; } ``` |
# |
Jul 2nd 2018, 13:47 |
itmpls |
i haven't had to deal with that many at once |
# |
Jul 2nd 2018, 13:47 |
itmpls |
you might need a custom query - i'm not sure |
# |
Jul 2nd 2018, 13:46 |
joshualuckers |
Parent/child and some of them have many to many. When all entities are new its "fast". When they exists and there is data modified (for all those records data is changed in this case) it takes a while.. |
# |
Jul 2nd 2018, 13:45 |
itmpls |
are most of those from 1-2 associations? saveStrategy of replace? |
# |
Jul 2nd 2018, 13:44 |
itmpls |
lol |
# |
Jul 2nd 2018, 13:44 |
joshualuckers |
records with those, haha |
# |
Jul 2nd 2018, 13:44 |
itmpls |
or records within those? |
# |
Jul 2nd 2018, 13:44 |
itmpls |
4000 associations?? |
# |
Jul 2nd 2018, 13:44 |
itmpls |
uh. what? |
# |
Jul 2nd 2018, 13:43 |
johnwayne |
@lorenzo thank you, I have make another association in Model. |
# |
Jul 2nd 2018, 13:43 |
joshualuckers |
4000, long as in 30+ minutes. All of them changed |
# |
Jul 2nd 2018, 13:41 |
itmpls |
iirc, you don't have to specify everything/all associations if your'e not modifying some of them |
# |
Jul 2nd 2018, 13:41 |
itmpls |
are all of them being changed? |
# |
Jul 2nd 2018, 13:41 |
itmpls |
how many associations? |
# |
Jul 2nd 2018, 13:41 |
itmpls |
define a 'long while' ? |
# |
Jul 2nd 2018, 13:40 |
joshualuckers |
I'm having an entity with a lot of associations. When I save the entity it takes a long while because of ```if ($entity->getErrors()) { return false; }``` in ORM/Table.php. Is it possible to skip getErrors()? |
# |
Jul 2nd 2018, 12:51 |
lorenzo |
if you want automatic fields selection, you can use `contain()` |
# |
Jul 2nd 2018, 12:51 |
lorenzo |
that’s why |
# |
Jul 2nd 2018, 12:50 |
lorenzo |
it will not select the fields for a join unless you tell it to |
# |
Jul 2nd 2018, 12:48 |
johnwayne |
Items are related with addresses (inner join), but I need only in one case left join so I can make another relation in model with another alias (for left join) but I am wondering why this doesnt work or why RAW statement is correct and execution in cakephp is wrong |
# |
Jul 2nd 2018, 12:47 |
johnwayne |
But it is interesting if I use ->select(columns) then it is working |
# |
Jul 2nd 2018, 12:43 |
lorenzo |
if `Items` is associated to `Addresses` it is better if you just use `leftJoinWith` instead of a plain `join` |
# |
Jul 2nd 2018, 12:42 |
lorenzo |
the result will be in `$item->get('Addresses')` |
# |
Jul 2nd 2018, 12:37 |
johnwayne |
I have problem with left join query..... here is the query https://paste.ofcode.org/wPHtRrybdw5B6ERfTarW55 If I execute RAW SQL statement directly in DB (from cakephp query) I am getting left join (relevant addresses if there is address_id by items), but in cakephp as final result there is no data from Addresses (left join is always empty) |
# |
Jul 2nd 2018, 12:30 |
josbeir |
nm '-v' does the trick |
# |
Jul 2nd 2018, 12:30 |
josbeir |
is there an argument for phpunit to list skipped/incomplete tests? |
# |
Jul 2nd 2018, 12:03 |
Martin` |
now I've imported 800 new stores, and page does not load anymore. not a surprise |