-
-
Notifications
You must be signed in to change notification settings - Fork 623
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
phpzlc v2 #1444
phpzlc v2 #1444
Conversation
CJayHe
commented
Oct 19, 2022
Q | A |
---|---|
License | MIT |
Packagist |
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. phpzlc/admin-business1.0 vs 2.0phpzlc/phpzlc1.0 vs 2.0diff --git a/phpzlc/phpzlc/1.0/manifest.json b/phpzlc/phpzlc/2.0/manifest.json
index 6063d6a2..d83b1037 100644
--- a/phpzlc/phpzlc/1.0/manifest.json
+++ b/phpzlc/phpzlc/2.0/manifest.json
@@ -4,6 +4,7 @@
},
"copy-from-package": {
"Doctrine/ORM/Rewrite/Templates/Repository.tpl.php": "vendor/symfony/maker-bundle/src/Resources/skeleton/doctrine/Repository.tpl.php",
+ "Doctrine/ORM/Rewrite/Hydration/AbstractHydrator.php": "vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php",
"Doctrine/ORM/Rewrite/Hydration/ObjectHydrator.php": "vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php",
"Doctrine/ORM/Rewrite/MakeEntityRegenerate/ClassSourceManipulator.php": "vendor/symfony/maker-bundle/src/Util/ClassSourceManipulator.php",
"Doctrine/ORM/Rewrite/MakeEntityRegenerate/EntityRegenerator.php": "vendor/symfony/maker-bundle/src/Doctrine/EntityRegenerator.php", 2.0 vs 2.32.3 vs 2.4phpzlc/upload-business1.0 vs 2.0 |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
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 have a hard figuring out what you're trying to do here.
A recipe is mainly helpful when we want to add some configuration files.
We tend to avoid adding PHP classes as this is more for maker bundle.
"Repository/": "src/Repository/", | ||
"templates/": "templates/", | ||
"DataFixtures/": "src/DataFixtures/" | ||
} |
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.
None of these directories exist, so the whole file can be removed.
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.
The purpose of copying here is to copy some written business code to the corresponding location of the project. These codes can be easily reused and adjusted according to the current project.
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.
Oh sorry, I read too fast, that's a copy from package, not recipe.
I think that's something that will work long-term.
Just one example. Your entities are probably using annotations or attributes. Depending on what the user has configured, it will work or not.
So, instead, you should probably have a command that copies/generates/customizes those files. This command to be run can be advertized in a post install message (that's a recommendation I've made in the last few weeks in many similar PRs here).
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 know what you mean, and I've thought about it too, but I think it will make the installation more complicated and inconvenient.
- Almost all of my packages need to do this, which means I have to execute extra commands every time.
- Executing copy is the same thing as symfony-flex, which means I have developed symfony-flex repeatedly.
- symfony-flex is great in my opinion. It was also intended to be easy to install.
- These configurations of mine have to work, there is no alternative.
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.
Then, I fear that your packages are not a good fit for recipes :(
We want recipes that work for all use cases, not just one specific one.
To generate files, we have maker bundle, that's probably what you want to extend here.
Recipes are a way to configure things.
Another issue with copying PHP files that need to be heavily changed by the user: when one wants to update their recipes, they will get plenty of conflicts.
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.
Thank you for your guidance.
But for now in my scenario, using symfy-flex is the best solution.
- If you change the method, you need to write a component like symfy-flex. The functionality written is not as good as the Symfony-Flex experience, which as a symfony user I don't think is cool.
- Secondly, I think even if the method is changed, the problem will not be reduced, because the principle and purpose of the two are the same, so the situation is similar.
"Repository/": "src/Repository/", | ||
"DataFixtures/": "src/DataFixtures/" | ||
} | ||
} |
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.
Same here
"PHPZlc\\PHPZlc\\Bundle\\PHPZlcBundle": ["all"] | ||
}, | ||
"copy-from-package": { | ||
"Doctrine/ORM/Rewrite/Templates/Repository.tpl.php": "vendor/symfony/maker-bundle/src/Resources/skeleton/doctrine/Repository.tpl.php", |
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.
What if Marker bundle is not installed?
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.
composer package phpzlc/phpzlc
will decide who to rely on
"Repository/": "src/Repository/", | ||
"templates/": "templates/", | ||
"DataFixtures/": "src/DataFixtures/" | ||
} |
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.
Oh sorry, I read too fast, that's a copy from package, not recipe.
I think that's something that will work long-term.
Just one example. Your entities are probably using annotations or attributes. Depending on what the user has configured, it will work or not.
So, instead, you should probably have a command that copies/generates/customizes those files. This command to be run can be advertized in a post install message (that's a recommendation I've made in the last few weeks in many similar PRs here).