I'd like to create a few custom annotations for an Entity class, i've come across this article on Doctrine2 however i'm unsure as to how to integrate this into my Symfony bundle, can anybody shed some light on this?
class User implements UserInterface
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*
* @myCustomVar(remember="true")
*/
protected $id;
Thanks
Symfony is a feature-rich back-end framework that is used to build complex applications. Many developers still prefer the lightweight Silex micro-framework or the Symfony MicroKernel, and Symfony is a widely used application framework among open-source developers.
Symfony is an open-source PHP web application framework, designed for developers who need a simple and elegant toolkit to create full-featured web applications. Symfony is sponsored by SensioLabs. It was developed by Fabien Potencier in 2005.
Both PHP Laravel and Symfony PHP are developed on MVC architecture, but in terms of component reusability and code modularity, Symfony has the edge over Laravel on this one.
Fabien Potencier Being a developer by passion, he immediately started to build websites with Perl. But with the release of PHP 5, he decided to switch focus to PHP, and created the symfony framework project in 2004 to help his company leverage the power of PHP for its customers.
Inspire you to the doctrine extension:
The DoctrineExtensions library contains some annotation classes. But as this annotations does not mean anything for the Doctrine core, it's also this extension that is responsible of interpreting them. To do that, it uses some listeners that must be registered into the Doctrine's event dispatcher.
In Symfony you can declare services with the doctrine.event_listener
(or doctrine.event_subscriber
for event subscribers) so the Doctrine bundle will find them and register them for you. The StofDoctrineExtensionsBundle primarily aims to automate this part of event listeners registration.
Anyway, when you think about extending Doctrine, as it can be used without Symfony, prefer to divide your work in two parts: one is the doctrine extension, the other is the glue between this extension and Symfony and is called bundle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With