9 Einträge in dieser Kategorie
Another Doctrine2 Post. This time we're taking a look on Event Listeners/Subscribers. Event Listeners are a real powerful thing in Doctrine2. Besides LifeCycleCallbacks they can be used if you'll want to scan through your Entity i.e. for specialized standard field. Also implementing a global Versionable behaviour (since that is no longer a native Doctrine behaviour) ist very easy to do inside Event Listeners.
My motivation for this quick blog post is just to give people a gist how to use EventListeners because the documentation is -again- a pain in the ass.
Im just using onFlush() here, since preUpdate() is somehow not called by SonataDoctrineORMAdminBundle which i'm using to mainly manage my Entities.
Lets start by creating a EventListener in My/Bundle/Listener/MyEventListener.php
Now all that is left to do is to attach the Event Listener to DI. If you're using Symfony2 you'll just need to update your app/config/config.yml
For further information feel free to take a look at the beautiful Doctrine2 Documentation, which I obviously love so much.
Since the Doctrine 2.0 Documentation for this seems to be kinda fucked up at the moment, here is a working exampe of a
One-To-Many, Unidirectional with Join-Table Association Mapping
Use Many-To-Many to encode it properly.
Im using Annotations with the ORM-Namespace since its embedded in Symfony2. Note that One-To-Many is coded throughout Many-To-Many but the unique Index is set for the join table.
In my POV thats kinda confusing since there is a @One-To-Many relationship, but whatever!
This is just a quick tip i stumbled upon this weekend. Let's say you are working on a git branch with a unfinished amount of changes. Now you want to switch branches i.e. to lookup some older/newer value, but you do not want to commit your unfinished piece of work. The solution? git stash.
continue reading „Using git stash to cache your pending changes“
Working with HTML5 Audio Components, i realized Internet Explorer 9, Google Chrome and Mobile Safari, do not send Domain Cookies when requesting a playable File, which required the necessity to import the sessionid before initalize session management.
I created my own SessionStorage class and adjusted the corresponding routes to have an session_id parameter.
Whereas sessionid is the routing parameter.
I needed a Server-Based mobile switch for my symfony-project. The solutions I found all used a workaround with setting the sf_format parameter to a specific mobile version. But what if you are using sf_format already for different view-types?
My Solution will use the Extension, so you can have multiple view-templates like:
I hope this is useful for somebdody! You might want to specify more parameters or make this a filter.
FPSAmish! http://t.co/Vzk9cRn9 6 days ago
@TheFPShow Ever seen Amish PPL Shooting? FPSAmish: http://t.co/Vzk9cRn9 6 days ago