# |
Jul 2nd 2018, 14:06 |
itmpls |
it happens to all of us :slightly_smiling_face: np |
# |
Jul 2nd 2018, 14:06 |
rrd564 |
:slightly_smiling_face: |
# |
Jul 2nd 2018, 14:06 |
rrd564 |
eh what a silly mistake |
# |
Jul 2nd 2018, 14:05 |
rrd564 |
@itmpls thanks, that was it! |
# |
Jul 2nd 2018, 14:04 |
itmpls |
try ^ |
# |
Jul 2nd 2018, 14:04 |
rrd564 |
I used Datalist.php |
# |
Jul 2nd 2018, 14:04 |
itmpls |
does it need to be DatalistWidget.php ? |
# |
Jul 2nd 2018, 14:04 |
itmpls |
filename? |
# |
Jul 2nd 2018, 14:04 |
rrd564 |
and the first parameter of format |
# |
Jul 2nd 2018, 14:03 |
rrd564 |
Except the classname |
# |
Jul 2nd 2018, 14:03 |
rrd564 |
https://book.cakephp.org/3.0/en/views/helpers/form.html#building-a-widget-class |
# |
Jul 2nd 2018, 14:03 |
rrd564 |
So now it is exactly the same what we have in the cookbook |
# |
Jul 2nd 2018, 14:03 |
itmpls |
oh ok |
# |
Jul 2nd 2018, 14:03 |
rrd564 |
I just started to rorking on ti |
# |
Jul 2nd 2018, 14:03 |
itmpls |
pastebin* |
# |
Jul 2nd 2018, 14:02 |
itmpls |
can you paste the class definition? |
# |
Jul 2nd 2018, 14:02 |
rrd564 |
in Datalist.php `namespace App\View\Widget;` |
# |
Jul 2nd 2018, 14:02 |
itmpls |
does it have the right namespace? |
# |
Jul 2nd 2018, 14:01 |
rrd564 |
In my `AppView.php` file I have this: `$this->loadHelper('Form', [ 'templates' => 'form-templates', 'widgets' => [ 'datalist' => ['Datalist'] ] ]);` |
# |
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; } ``` |