TAG | Behaviours
6
Taking snapshots – manipulating Doctrine collections
1 Comment · Posted by Christian in The right tool
Ok, when would you ever want to manipulate a doctrine collection you may wonder.
Well for example if it contains records that don’t really belong there. So you iterate over them and throw them out, right?
Only halfway there because doctrine collections have a memory and have secretly taken snapshots!
3
How to customise doctrine behaviours the right way!
3 Comments · Posted by Christian in The real job
All of you who work with doctrine will know about the behaviours feature. If you don’t go and dig the documentation!
Sometimes you might be tired to use the same behaviour on all your models with all the same options littering your schema.yml.
This is where I started and this is what I found.
2
How to extend the condition on a left join with doctrine
8 Comments · Posted by Christian in The real job
Just a small post today as I’ve been fighting with the internals of doctrine the whole day..
If you ever wanted to limit your left joins not only by matching keys but with another condition, this will probably help you.
17
Easy page composition with symfony, doctrine and the gjPositionsPlugin is now BETA!
1 Comment · Posted by Christian in The real job
For quite some time now I keep blogging about page composition in symfony. Even when I blogged about LooseCoupling I was actully talking about a by-product of gjPositionsPlugin.
Today I am happy to announce that this plugin is now available in its first beta version!
Not only I managed to implement the basic idea of composing design and content elements on a canvas; by now the plugin became completely independent from your models and database structure!
(more…)
admin generator · admin-theme · Behaviours · Doctrine · gjPositionsPlugin · LooseCoupling · Plugin · plugins · Separation of Concerns · symfony
25
Doctrine behaviour LooseCoupling now collects garbage with a new deletion cascade
2 Comments · Posted by Christian in The right tool
When you loosely couple your doctrine models with the doctrine behaviour LooseCoupling there is a chance that on the active side (the one holding the relation information) you will get a lot of orphaned entries over the times for each deleted item on the passive side.
Well, this is no longer the case now.
Many of you will have played around with Doctrine behaviours before. I certainly did and one of my latest experiments is the LooseCoupling behaviour that allows you to work with loose relations without leading to high amounts of database queries.
Today I found a bug in this behaviour that was the result of my apparent misunderstanding.
15
Define delegate methods for your table object in a Doctrine behaviour using TableProxy
2 Comments · Posted by Christian in The real job
Recently I wrote about extending Doctrine_Query to define convenient methods with speaking names that wrap query parts that you use quite often.
I got criticised for defining methods there that did not return a Doctrine_Query instance but an actual result set. And while I was buying the argumentation I could not change it as my Query class belonged to a Doctrine behaviour and therefore I didn’t have control about the table in question.
Only then I learned by another commenter about delegate methods for tables.
13
How to achieve modularity within symfony/doctrine projects
4 Comments · Posted by Christian in Outside the box
Yesterday I wrote about two approaches on code reusability clearly favouring modularity as a solution.
Today I want to give a brief overview on the possible ways how to achieve this within symfony/doctrine (1.4/1.2) projects.
architecture · Behaviours · Doctrine · DRY · Events · Modularity · Open Source · PHP · plugins · Separation of Concerns · symfony · YAGNI
6
Extending Doctrine_Query with convenient query filter methods
13 Comments · Posted by Christian in The real job
I just recently wrote a Doctrine behaviour which formed the base of a symfony plugin. The behaviour provided a defined list of columns to the models and the plugin performed some operations based on these columns.
Now with behaviours you can easily write delegate methods which you can define on the record template but call directly on the model. But what if you need some methods on the models table class that you can call from your plugin code?
2
Decoupling functionality with Doctrine behaviours
1 Comment · Posted by Christian in The right tool
Decoupling classes is all the rage right now and for a good reason as it helps you separating your concerns putting a concerns code in one dedicated place and reducing the risk of ripple effects.
However in theory it often seems very abstract and might not be that intuitive. So today I will introduce how you can use Doctrine behaviours to achieve decoupling of functionalities.


