-
-
Notifications
You must be signed in to change notification settings - Fork 436
new Maker for api-platform data persisters #697
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
new Maker for api-platform data persisters #697
Conversation
Updating my fork repository
2c406ab
to
70552e0
Compare
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 would absolutely LOVE to have a whole series of API Platform generates. So big 💯 from me.
I've added some notes to take the make:api:data-persister
to the next level :). And let's make just 1 PR per command so that we can merge each as soon as its done and stay focused.
Thanks!
$input->getArgument('name'), | ||
'DataPersister\\', | ||
'DataPersister' | ||
); |
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.
It might make sense to allow the user to interactively specify what class the data persister will persist for - e.g. App\Entity\CheeseListing
. It would be even cooler if this read the API Platform metadata to list all the API Platform resource classes :). This would help us generate a better supports()
method. Or, they could leave this blank and we would generate the supports()
method like they have now.
And, to go further, if the resource class they choose is an entity, we could ask them something like this:
Would you like your persister to call the core Doctrine persister? This would allow you to
add custom logic without needing to worry about the save logic.
If they said yes, we would inject the core Doctrine ORM persister like done here - https://symfonycasts.com/screencast/api-platform-extending/decoration-deep-dive
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.
yes, great ideas, I'm gonna Try to add this, and make Seperate PRs for the other Makers :)
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.
@weaverryan the Maker is now working with the update of services and with the different cases.
I would love to see your feedback if there are somethings to refactor in the code.
aed83a5
to
4e8cf2a
Compare
update fork
198b2ff
to
9b2f919
Compare
09facc0
to
b270583
Compare
b270583
to
424b749
Compare
Hey @zairigimad! I just talked with @dunglas and he was also thinking we should have these maker commands (and so I pointed him to your PR!). But we think it makes most sense for these to live inside of API Platform itself, so that once you install API Platform, you have the commands. Would you be willing to re-make this PR to API Platform? I'm not sure if it would just "drop in" or if some extra work would be needed - I'd be happy to help. Thank you! |
Ah, @dunglas just told me that a Maker has been started already on API Platform! api-platform/core#3850 That is probably the PR we should use - it's clearly a good idea, as multiple people are proposing it (and I also think it's a good idea). So, unfortunately @zairigimad even though this is aa very good PR, I'm going to close it in favor of the other one on API Platform. I hope you could review that one over there and propose any improvements from your PR. Thanks! |
Hey @weaverryan , Sure, no problem, I will check the PR in Api-Platform, and maybe will add other Makers :) |
New Command to generate API DataPersister
I Like Symfony and API Platform, I would like to leverage the power of Maker Bundle to generate code for API Platform.
Makers for API Platform:
In this PR:
Next:
DataProvider
DataTransformer
This PR is for DataPersister Maker.
generated code :
ArticleDataPersister.php