Search code examples
phpsymfony1symfony-1.4

Symfony 1.4 - Doctrine - Custom Plugin - How do I get plugin model files to reside in plugin directory?


I am creating a custom plugin, and am trying to keep all related model files contained within the plugin directory structure. However, when I build the model, some files get dropped into lib/model/doctrine/... and others in plugins/userPlugin/lib/model/... . According to Doctrine docs I can add a "package" option to the schema.yml file, and generated model files will be created in the location as defined by my dot-notation entry, for example:

# plugins/userPlugin/config/doctrine/schema.yml

connection: store-rw-user

options:
  # Fully expect resulting model files to be dropped in this directory (vs the main model dir)
  package: userPlugin.lib.model.doctrine

....

As mentioned, this config setup still results in model files being dropped into the main lib/model/doctrine directory. I even tried this, to no avail:

# plugins/userPlugin/config/doctrine/schema.yml

connection: store-rw-user

options:
  package: userPlugin
  package_custom_path: /tmp/userPlugin

....

Just wanted to see if the files were dropped in the /tmp directory, but they were not.

Before I start tearing apart the source code, I figured I would ask first, to see if there is something I am missing.


Solution

  • It's perfectly normal to get model files in your project directory after building. The purpose of this is to let you customize the plugin model on per-project basis, because the classes inside these files inherit from the classes defined in the plugin's files. I use plugins too, and most of the time, all the code I write resides in the plugin's model files.