# |
Jul 2nd 2018, 14:01 |
itmpls |
how are you loading it? |
# |
Jul 2nd 2018, 14:00 |
rrd564 |
Hi, I am building a custom widget fot html datalist input, but I am missing something as I get `"Unable to locate widget class"` Any guess why? I have created my class at `/src/View/Widget/Datalist.php file` |
# |
Jul 2nd 2018, 13:58 |
itmpls |
brazil v mexico soon, who does everyone have!?!? |
# |
Jul 2nd 2018, 13:58 |
itmpls |
yup sorry i'm useless :S |
# |
Jul 2nd 2018, 13:54 |
joshualuckers |
will try to do so later, thanks for now! :) |
# |
Jul 2nd 2018, 13:53 |
itmpls |
i would guess its new Collection($diff) or the map |
# |
Jul 2nd 2018, 13:52 |
itmpls |
in that function.. |
# |
Jul 2nd 2018, 13:52 |
itmpls |
can you profile which one of those is slow? |
# |
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 |