# |
Jun 12th 2018, 15:59 |
neon1024 |
Ah you can pass an instance, just as admad said |
# |
Jun 12th 2018, 15:58 |
neon1024 |
Perhaps with 2 minutes to go till the end of the day, I should bail and return when my brain is at full operating temperature! |
# |
Jun 12th 2018, 15:58 |
neon1024 |
`PHP Deprecated: Non-static method Muffin\Webservice\Model\EndpointLocator::get() should not be called statically in /Users/david/Sites/MuffinWebservice/vendor/cakephp/cakephp/src/Datasource/FactoryLocator.php on line 36` |
# |
Jun 12th 2018, 15:58 |
neon1024 |
`\Cake\Datasource\FactoryLocator::add('Endpoint', [Muffin\Webservice\Model\EndpointLocator::class, 'get']);` |
# |
Jun 12th 2018, 15:58 |
neon1024 |
But if I change it |
# |
Jun 12th 2018, 15:56 |
jeremyharris |
you could implement it as a anonymous function if you really wanted to, but it’s a lot of code just for that |
# |
Jun 12th 2018, 15:56 |
jeremyharris |
x) |
# |
Jun 12th 2018, 15:55 |
neon1024 |
yeah, phpstan will hate that |
# |
Jun 12th 2018, 15:55 |
josbeir |
#type_hinting_ftw |
# |
Jun 12th 2018, 15:55 |
neon1024 |
I should send a pr to update that then too |
# |
Jun 12th 2018, 15:55 |
jeremyharris |
could be a string, actual anon func, or array |
# |
Jun 12th 2018, 15:55 |
jeremyharris |
#php |
# |
Jun 12th 2018, 15:54 |
neon1024 |
Argh, stupid magic! |
# |
Jun 12th 2018, 15:54 |
jeremyharris |
call_user_func |
# |
Jun 12th 2018, 15:54 |
jeremyharris |
yeah so the array is a callable in this case |
# |
Jun 12th 2018, 15:54 |
neon1024 |
As modelFactory takes `callable` |
# |
Jun 12th 2018, 15:54 |
jeremyharris |
see L127 @neon1024 |
# |
Jun 12th 2018, 15:53 |
josbeir |
tnx @jeremyharris |
# |
Jun 12th 2018, 15:53 |
neon1024 |
Guess i’ll need to knock up a quick example app and pop in the plugin |
# |
Jun 12th 2018, 15:53 |
jeremyharris |
model factory is what is used by loadModel |
# |
Jun 12th 2018, 15:53 |
neon1024 |
But I’m unsure, I can’t see a way for that to work in the code |
# |
Jun 12th 2018, 15:53 |
jeremyharris |
@josbeir perhaps https://github.com/cakephp/cakephp/issues/12219 and https://github.com/cakephp/cakephp/issues/7532 |
# |
Jun 12th 2018, 15:53 |
neon1024 |
Also admad suggested using `$this->modelFactory('Endpoint', [new EndpointLocator(), 'get']);` |
# |
Jun 12th 2018, 15:53 |
josbeir |
i'll check the ES form context |
# |
Jun 12th 2018, 15:52 |
neon1024 |
@jeremyharris I ask because of this line -> https://github.com/UseMuffin/Webservice/blob/dev/config/bootstrap.php which uses the deprecated endpoint registry. |
# |
Jun 12th 2018, 15:52 |
josbeir |
(elasticsearch, basically the same...) |
# |
Jun 12th 2018, 15:52 |
jeremyharris |
should be fine for entity contexts though |
# |
Jun 12th 2018, 15:52 |
jeremyharris |
@josbeir there’s a known issue for modelless forms if that’s what you’re using |
# |
Jun 12th 2018, 15:51 |
jeremyharris |
unless it bails early at 103 |
# |
Jun 12th 2018, 15:51 |
josbeir |
hmm, is the formhelper incompatible with nested validation rules? |
# |
Jun 12th 2018, 15:50 |
jeremyharris |
it is possible? how so? shouldn’t you get PHP errors when it tries to use it as an array key on L106? |
# |
Jun 12th 2018, 15:48 |
neon1024 |
Can anyone explain to me how it is possible to pass an array as `$modelType` here, but it’s not type hinted as such? https://github.com/cakephp/cakephp/blob/de7ebdb88e11c4283185ba33c827151f02352b4b/src/Datasource/ModelAwareTrait.php#L87 |
# |
Jun 12th 2018, 15:23 |
LubosR |
yep, that was it! thanks for your help josbeir! |
# |
Jun 12th 2018, 15:21 |
LubosR |
but looks like there is typo, i see header X-CSRFToken without - ... let me test |
# |
Jun 12th 2018, 15:21 |
LubosR |
josbeir from the CsfrComponent and using latest cake 3.6 :) |
# |
Jun 12th 2018, 15:15 |
jeremyharris |
morning! :coffee: |
# |
Jun 12th 2018, 15:15 |
neon1024 |
Morning @jeremyharris |
# |
Jun 12th 2018, 14:58 |
loginews |
thanks will read the docs |
# |
Jun 12th 2018, 14:57 |
jeremyharris |
see: https://book.cakephp.org/3.0/en/development/routing.html#generating-urls |
# |
Jun 12th 2018, 14:57 |
loginews |
okay! so dark and yet so clear ! |
# |
Jun 12th 2018, 14:56 |
jeremyharris |
you likely want [‘action’ => ‘index’, ‘?’ => [‘q’ => ‘NNNNNN’]] |