New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] SyliusResourceBundle Reloaded #2255
[WIP] SyliusResourceBundle Reloaded #2255
Conversation
ViewHandlerInterface $viewHandler, | ||
RedirectHandler $redirectHandler | ||
) { | ||
$this->configuration = $configuration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that :)
I followed your Finally 5.4. I like it. |
I just wrote some comments, I like it ! definitely 👍 for PHP 5.4! |
It looks really interesting 👍 . Maybe the bundle you were looking for is this one https://github.com/ProgrammingAreHard/ResourceBundle ! It seems quite close in the spirit. |
@jjanvier yes you're true I found the original tweet : https://twitter.com/dadamssg/status/487048677127491584 |
Yes, that's the one I was talking about. :) |
@pjedrzejewski we need that #1927 too, it is a bit boring to declare each time the resource forms. As I said there (#1921) we should rework the configuration too. |
Looks really good on the whole! |
@pjedrzejewski Correct me if I'm wrong, but with this changes, every 'save' performs a flush, right? |
@gonzalovilaseca Currently yes, but I plan to introduce optional second parameter to avoid that. |
@pjedrzejewski So it seems that people like it! What do you plan for that PR? |
Will try to merge few big thing before doing this, release v0.13.0 and finish this. :) |
6adb5fe
to
c92b762
Compare
In overall looks really similar to my changes, just a bit more decopuled. From what I see there are few missing things, or parts I'm not convinced:
That's all for now I think. |
Great! 👍 |
e588c7d
to
0395ce7
Compare
@@ -112,11 +112,11 @@ Feature: Countries and provinces | |||
And I am on the country index page | |||
When I click "Enable" near "Poland" | |||
Then I should see enabled country with name "Poland" in the list | |||
And I should see "Country has been successfully enabled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old scenario was better. :)
I can't comment inline because this PR is too big! but referring to this:
It's good that you fixed the bug on the third parameter being However the second parameter also has significant performance implications although it is very contextual. In most cases, you do want this to be true, but when running a query on any large tables without joins or one-to-one associations (such as To illustrate the point, here's the query times taken to display the main Customers backend page for just under 1,000,000 customers on an i7 macbook pro:
I'm not particularly happy about 2 seconds for this simple query but 12 seconds isn't going to work. This is all down to the I think you need to allow the setting of this second parameter and I guess the only way is to support it is by passing into this method:
It's a bit ugly for the other Adapter types to keep a consistent interface - having said that, most people are going to use MySQL here and this is a big roadblock for anyone with a big database. How we can then allow queries to take advantage of this is another question, which can probably be answered after merge. |
@peteward Yes, I think I will reflect that in the interface... It is not perfect, but needed. Generally, we need to look for solutions with big amounts of data in backend. When Grids are merged, I was thinking we could add elastic search driver for them and use it for some of resources. It should be pretty simple to implement actually. |
Great, thanks. Don't worry, there will be plenty more examples of big data coming your way, with a million orders to be migrated next month... |
@peteward Yes, I already started thinking about possible solution for the cart + order issue... They can't live in a single table with 1M+ orders. ;) |
@pjedrzejewski We have a caching layer in redis for carts, so this shouldn't be a problem (hopefully!). |
so.... how are you getting on with this @pjedrzejewski? Do you need any more community help? |
@peteward Being away does not help, but this is my priority right now and I will rebase this PR with master this weekend and see if anyone can help with getting this green. Specs are passing and I think there are 2-3 suites to fix. |
@pjedrzejewski You're doing a great job it's very appreciated. What is the status of this PR? Is there anything we can do? Almost everything depends on this. |
1ad455b
to
f680622
Compare
Closing this as all of this stuff has been implemented. Yay! |
Do NOT review the code! It is a quick POC.
Hey folks!
These changes are partially inspired by another bundle (inspired by Sylius resource, lol), but I could not find it on github/packagist... Can be that it is gone, I have looked at it long time ago and it inspired me to work on this.
I wanted to do it for a long time and seems like it is a last moment to introduce a BC break of this size in Sylius fundamentals. It is an alternative approach to @stloyd's #1764 DomainManagers and effectively decouples Sylius components from the Doctrine Persistence interfaces, while staying very close to them, so that any Symfony developer will be used to the same API. Overview of my proposed changes:
Every resource gets it's own dedicated resource manager. Additionally, it has this EvenfulResourceManager, which dispatches our beloved events.
Also, I have made it a bit smarter, and it has only save() and delete() methods. Save will know if it is a new or existing resource and dispatch an appropriate event. (update or create)
Do not look at the resource controller yet, it needs some work and better flashes handling and so on. I will move them to a listener and generally, the controller will have all the previous functionality.
IMPORTANT NOTE
This change requires us to move to PHP 5.4 (ResourceInterface::getId). With recent decisions about PHP version for Symfony 3.0, I'm more than convinced to move to 5.4, especially, that we could do a good use of traits in many places. (in few we could hide design flaws too... by making our anemic models smaller in terms of LOC... joke)
Let me know what do you think.