Skipper - The ORM Designer Blog
  • Skipper - The ORM Designer
  • VsBuilds - Parallel building
  • Pulpo - Free Skipper CLI

Prefixes for Doctrine ORM entities (useful for Doctrine and Zend Framework)

Today I want to show you a new feature of ORM Desigener for Doctrine ORM. It is an ability to define prefix for a whole module by which ORM Designer exports every entity with a name composed of this prefix and stand-alone name. In the past we received several requests from Zend Framework users for this feature, so here it is ;-).

This feature is the most useful for Zend Framework users, but might be used by every Doctrine ORM user. When using Doctrine ORM with Zend Framework you have to create the names of your entities with prefixes as Default_Model_Entity_Name or Forum_Model_Entity_Name (more about this topic is described in the article Doctrine1 Integration with Zend Framework).

And how does it work? Here is a screenshot of an example model:

In this model we’re using simple and nice entity names like “parent” or “child”. To “entity_prefix” attribute of each module we enter common prefix for all entities. After that when we export the model to the YAML file, we get a following result:

APPLICATION_child:
  columns:
    id:
      primary: true
    parent_id:
  relations:
    APPLICATION_parent:
      foreign: id
      local: parent_id
APPLICATION_parent:
  columns:
    id:
      primary: true
MODULE_derived:
  columns:
    id:
      primary: true
  inheritance:
    extends: MODULE_external
    type: simple
MODULE_external:
  columns:
    child_id:
    id:
      primary: true
  relations:
    APPLICATION_child:
      foreign: id
      local: child_id

I hope this function will help you a bit more with you everyday work ;-)

08 Sep 2010

Posted by: Ludek Vodicka

Skipper features #doctrine #tips #zend