2

I have a symfony project (1.2). What I would like to do is ensure that when symfony build happens, instead of creating tables that extend doctrine_table they extend custom_table .

This way I can make ALL the tables I use have additional functionality without having to modify doctrine_table.

John Carter
  • 53,924
  • 26
  • 111
  • 144
Anfurny
  • 134
  • 13

1 Answers1

0

Yes you can, as follows (in Symfony 1.4 at least, I assume the same is true for 1.2):

// config/ProjectConfiguration.class.php

class ProjectConfiguration extends sfProjectConfiguration
{
  public function configureDoctrine(Doctrine_Manager $manager)
  {
    $manager->setAttribute(Doctrine_Core::ATTR_TABLE_CLASS, 'yourDoctrineTable');
  }
}

And then define class yourDoctrineTable to extend Doctrine_Table.

All newly generated *Table classes will now extend yourDoctrineTable instead of Doctrine_Table.

See: http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/configuration.html#configure-table-class

John Carter
  • 53,924
  • 26
  • 111
  • 144
  • Thanks, but ' Class 'Doctrine_Core' not found ' I will keep looking – Anfurny Apr 26 '13 at 00:34
  • @Anfurny Ah, looks like a Symfony 1.2 vs 1.4 issue. For what it's worth it's at lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php in Symfony 1.4 – John Carter Apr 26 '13 at 01:19
  • It looks like I can upgrade doctrine enough within this version of symfony to the point where it has doctrine core (at least according to this http://www.doctrine-project.org/jira/browse/DC-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel). So I'm marking that answer correct. Thanks a million. – Anfurny Apr 26 '13 at 18:46