# |
May 15th 2019, 12:29 |
spriz |
Besides that, last time we had issues with routes and plugins we had missed something when doing https://book.cakephp.org/3.0/en/development/application.html#adding-the-new-http-stack-to-an-existing-application, and moved some things around between `webroot/index.php`, `config/bootstrap.php` and `src/Application` so maybe double check that list @dereuromark:slightly_smiling_face: |
# |
May 15th 2019, 12:29 |
waspinator |
it works fine otherwise. just not when two items have the same ids |
# |
May 15th 2019, 12:28 |
waspinator |
I have a through model, not sure what I need to configure for this specific case though. |
# |
May 15th 2019, 12:28 |
admad |
@waspinator have you configured the `through` model? |
# |
May 15th 2019, 12:24 |
waspinator |
how would I make `patchEntity` take `_joinData` into considerations when processing `belongsToMany` data? I want to add two relationships with the same `foreignKey` and `targetForeignKey`, but with different `_joinData`. In `beforeMarshal` I can see both items, but in `beforeSave` only the first one is there. |
# |
May 15th 2019, 12:21 |
spriz |
We resolved some issue with no routes in our test, but I see now that we solved it by moving to Routes middleware :S |
# |
May 15th 2019, 12:15 |
admad |
I have subscribed to that issue :( |
# |
May 15th 2019, 12:14 |
spriz |
and `<phpunit colors="true" bootstrap="./tests/bootstrap.php">` in your `phpunit.xml`? |
# |
May 15th 2019, 12:14 |
spriz |
You do have a `require $root . '/config/bootstrap.php';` in your `plugins/PluginName/tests/bootstrap.php` @dereuromark? |
# |
May 15th 2019, 12:13 |
spriz |
Done :slightly_smiling_face: https://github.com/rectorphp/rector/issues/1431 |
# |
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. |