I am prototyping my application in Symfony 1.4 using Doctrine. I have two models, encounters and photos. One encounter can have many photos and the correct one-to-many relationship is set up in schema.yml.
I have generated a backend using ./symfony generate:app backend. Everything is working fine but I now want to add a count field to my encounters list which I think I should be able to do in generator.yml. In my Encounters.class.php I have the following method:
public function getPhotoCount() {
return count($this->CcPhotos);
}
My questions is how can I add a new field in generator.yml which runs this method. I tried %%photo_count%% but I think this is intended for string substitution.
generator:
class: sfDoctrineGenerator
param:
model_class: CcEncounters
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: cc_encounters
with_doctrine_route: true
actions_base_class: sfActions
config:
actions: ~
fields: ~
list: ~
filter: ~
form: ~
edit: ~
new:
display: [_camera_id, longitude, latitude, elevation, New Photos]