symfony - SF2 - Sonata: How to get parameter from parameter.yml in entity -
I used Sonata Admin Bundle. How can I add parameters either directly or through the service ....
I need some cleaning work in Postremove, path, access data and more disclosures I need here . This I will not write on Hardy Entitiy, but picking parameters.yml from
Timo
All you need to do is make it as one that you define as a service and Your Your ListenerClass: entity class business logic There is not a place for As far as I know that you can not define the unit as a service parameters .iml can pass the value from what you want to be resolved by This listener should listen on your postRemove event services.yml :.
Services: SERVICE_NAME: Category: Acme \ Your \ ListenerClass Logic: [% your_parameter_from_yml%] Tags: - {name: doctrine.event_listener, event: postRemove}
Category ListenerClass {Public Function __construct ($ your_param_from_parameters) {$ this- & gt; Ultimate = $ your_param_from_parameters} / ** * @param LifecycleEventArgs $ args * / Public Function postRemove (LifecycleEventArgs $ args) {$ unit = $ args- & gt; GetEntity (); If ($ unit example yourEntity) {// Do magic !! }}}
Comments
Post a Comment