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

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

All you need to do is make it as one that you define as a service and parameters .iml can pass the value from what you want to be resolved by This listener should listen on your postRemove event

Your services.yml :.

  Services: SERVICE_NAME: Category: Acme \ Your \ ListenerClass Logic: [% your_parameter_from_yml%] Tags: - {name: doctrine.event_listener, event: postRemove}  

Your ListenerClass:

  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

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -