phpsword / sword-bundle

Modern WordPress development with Symfony
https://getsword.com
MIT License
124 stars 4 forks source link

Question: Create entity #4

Closed Romaixn closed 1 year ago

Romaixn commented 1 year ago

Hello ! Is it possible to create entities on the Symfony side and then use them in WordPress?

Thank you for your answer and for this very useful tool!

williarin commented 1 year ago

Yes it's possible. I just released 1.0.0 version which fixes a make:migration problem.

Once you've created your entity, you can either inject your repositories in your WordpressService classes, or use \Sword\SwordBundle\Helper\get_symfony_service in your template to grab a public service.

Take a look here to see an example on how to create a public service. But in most cases you should be able to use a WordpressService class with standard Symfony DI.

Romaixn commented 1 year ago

Awesome, thanks for this new version ! 🚀