So doctrine allows for the ability to flag a table schema in schema.yml as a package using the following notation:

Table:
  tableName:
  package:
  package_custom_path:

For some reason Symfony does not allow this type of behavior via the /config/doctrine/schema.yml file. When you try to package your model files you get a “Cannot use package parameter in symfony Doctrine schema files.” error message. You may be asking “Why do I care if I can package model files?”, read on. By default, all the model files get stuffed in /lib/model/doctrine/…

Table1Object.class.php
Table2Object.class.php
Table3Object.class.php
base
  BaseTable1Object.class.php
  BaseTable2Object.class.php
  BaseTable3Object.class.php
sfDoctrineGuardPlugin
  sfGuardFiles
  ...
  base
    BasesfGuardFiles
    ...

Notice that TableXObject files are kind of free floating at the root of /lib/model/doctrine/ whereas the sfGuard files are tucked neatly within their own directory. Now this may seem like a nit-picky sort of situation, but it does make a big diff when you start adding more tables and more plug-ins. IMO it’s much easier if you can package your files accordingly (inside of /lib/model/doctrine/):

<package_name>
  Table1Object.class.php
  Table2Object.class.php
  Table3Object.class.php
  base
    BaseTable1Object.class.php
    BaseTable2Object.class.php
    BaseTable3Object.class.php
sfDoctrineGuardPlugin
  sfGuardFiles
  ...
  base
    BasesfGuardFiles
    ...

Much easier to see follow the logic behind the grouping of files. If you view the source code for sfDoctrineBuildModelTask::_checkForPackageParameter() which controls this behavior, you will see the comments:

/**
 * Check for package parameter in main schema files.
 * sfDoctrinePlugin uses the package feature of Doctrine
 * for plugins and cannot be used by the user
 *
 * @param string $path
 * @return void
 */

Why not? Why just for plug-ins? so I simply edited the method:

Before

protected function _checkForPackageParameter($path)
 {
 $files = sfFinder::type('file')->name('*.yml')->in($path);
 foreach ($files as $file)
 {
 $array = sfYaml::load($file);
 if (is_array($array) AND !empty($array))

After

protected function _checkForPackageParameter($path)
 {
  return true;
 $files = sfFinder::type('file')->name('*.yml')->in($path);
 foreach ($files as $file)
 {
 $array = sfYaml::load($file);
 if (is_array($array) AND !empty($array))

This will allow you to now edit your schema.yml file to group your files as described above. For example:

Before

Table1:
  tableName:
  columns:
    ...

After

Table1:
  tableName:
  package:
  columns:
    ...

When I rebuilt model, all my files were correctly stored as expected… I’m not sure why Symfony devs would restrict this behavior for doctrine whereas propel allows it, and it’s available to vanilla Doctrine.