# |
May 15th 2019, 12:08 |
dereuromark |
that one contains the RoutingMiddleware, but I am not sure how to invoke this fake Application.php class in TestApp/App namespace |
# |
May 15th 2019, 12:08 |
admad |
@spriz i would definitely open an issue in that case |
# |
May 15th 2019, 12:08 |
dereuromark |
Application in test_files is also not loaded right now. |
# |
May 15th 2019, 12:07 |
spriz |
Ah, so not in terms of how do you make the integration test cases pick up the routes @dereuromark? :P |
# |
May 15th 2019, 12:06 |
spriz |
not only in dry-run :) |
# |
May 15th 2019, 12:06 |
spriz |
@admad it actually does apply the change: https://gist.github.com/Spriz/93f0a79c9d1c5257713c2a783f1a0f1f |
# |
May 15th 2019, 12:05 |
dereuromark |
as entity->toArray() does recursive afaik |
# |
May 15th 2019, 12:05 |
dereuromark |
manually foreach ($features as $key => $feature) { $features[$key] = $feature->toArray(); } for all keys works for now |
# |
May 15th 2019, 12:03 |
spriz |
@dereuromark using middleware? |
# |
May 15th 2019, 12:02 |
dereuromark |
How can one get routes to work in plugin tests? I tried Router::reload(), doesnt seem to load my routes config file either. |
# |
May 15th 2019, 12:02 |
spriz |
I'll try and let it do it's thing |
# |
May 15th 2019, 12:02 |
spriz |
I only did `--dry-run` |
# |
May 15th 2019, 12:01 |
admad |
So is it actually changing calls to static methods or you just assumed it will do so? |
# |
May 15th 2019, 12:00 |
spriz |
Yeah I just saw that it should only do that for things thart are not static |
# |
May 15th 2019, 12:00 |
spriz |
Yeah it is https://github.com/rectorphp/rector/blob/master/packages/Php/src/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php |
# |
May 15th 2019, 11:59 |
admad |
It shouldn't make changes for method which are declared as static |
# |
May 15th 2019, 11:59 |
admad |
@spriz this seems to be the rector in question https://github.com/rectorphp/rector/blob/master/docs/AllRectorsOverview.md#staticcallonnonstatictoinstancecallrector But the example shown is fine because the method isn't declared static. |
# |
May 15th 2019, 11:54 |
admad |
maybe it has a config to prevent such change? |
# |
May 15th 2019, 11:53 |
admad |
i would open an issue with rector to stop messing up the code for no reason |
# |
May 15th 2019, 11:52 |
spriz |
they change all `Foo::bar` to `(new Foo)->bar` |
# |
May 15th 2019, 11:52 |
admad |
that's silly |
# |
May 15th 2019, 11:52 |
spriz |
Yeah, but my concern is that the rector tool with php70, php71, php72 and php73 levels are changing that piece of code for some reason |
# |
May 15th 2019, 11:50 |
admad |
you shouldn't be doing `(new Text())->uuid()` infact, it's a static method |
# |
May 15th 2019, 11:49 |
admad |
@spriz static for utility functions are just fine |
# |
May 15th 2019, 11:49 |
Mikeynl |
ok, anyone can point me out where to get some help on my question ? |
# |
May 15th 2019, 11:47 |
dereuromark |
@neothermic I kind of hoped to get a more toArrayRecursive() kind of thing here somehow. |
# |
May 15th 2019, 11:44 |
spriz |
Those 2 appear the same to me, just with a different syntax with harder-to-read use of parentheses |
# |
May 15th 2019, 11:43 |
spriz |
rather than just having `$newFileName = Text::uuid() . '.' . $extension;` |
# |
May 15th 2019, 11:42 |
spriz |
but I am still not really following the hate on all static calls to be honest :) `$newFileName = (new Text())->uuid() . '.' . $extension;` seems weird to be |
# |
May 15th 2019, 11:40 |
spriz |
makes sense :slightly_smiling_face: |
# |
May 15th 2019, 11:40 |
spriz |
Ah now we're talking - I did not see that trait mentioned before. |
# |
May 15th 2019, 11:40 |
admad |
then do `$this->getTableLocator()->get()` |
# |
May 15th 2019, 11:39 |
admad |
instead your class should use the `LocatorAwareTrait` |
# |
May 15th 2019, 11:39 |
admad |
@spriz IMO using `TableRegistry::getTableLocator()->get()` instead of `TableRegistry::get()` is no improvement. You are still using the table registry and static call. |
# |
May 15th 2019, 11:36 |
spriz |
Aha :thinking_face: From what I see in the book they still use `TableRegistry::getTableLocator()->get()` in there :cold_sweat: |
# |
May 15th 2019, 11:21 |
neon1024 |
There is a very long issue, if I recall with discussion around the topic |
# |
May 15th 2019, 11:20 |
neon1024 |
@spriz I *think* this is due to the core team renaming the TableRegistry essentially, so it’s been deprecated |
# |
May 15th 2019, 11:19 |
Mikeynl |
feeling it doesnt touch the CakePdf view at all |
# |
May 15th 2019, 11:18 |
spriz |
I mean, when there is no side effects, why the big hate? :) |
# |
May 15th 2019, 11:16 |
spriz |
rector is really not happy about static classes eh :thinking_face: ``` - $config = TableRegistry::getTableLocator()->exists('Users') ? [] : ['className' => UsersTable::class]; + $config = (new TableRegistry())->getTableLocator()->exists('Users') ? [] : ['className' => UsersTable::class]; ``` |
# |
May 15th 2019, 11:16 |
Mikeynl |
but doesnt render at all |