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

Tag: #tips

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

Tip: How to setup associations in Doctrine2 project for correct export

In this tip I want to show you how to correctly setup associations in ORM Designer Doctrine2 project. Because Doctrine2 supports one-way or bidirectional associations, there is a need to tell ORM Designer how to export it. This is proceeded by Association alias. When you create association between two entities, you have to enter how you would like to access from one entity to another. Currently there are three ways how to do it:

Setup alias in association wizard

When you are creating a new association by using association wizard, you have to enter alias for direction you want to use. Below the alias edit boxes is a “Direction” item which shows you a type of created association.

Setup alias in association editor

Another option is to setup association alias in association editor (executed by “Edit object” menu item or simply double click on the association). In this window there are simmilar edit boxes as in the association wizard. Depending on values you entered into edit boxes the association is exported to your Doctrine2 schema files.

Enter alias using Property Editor

The third option how to setup association alias is in Property editor. Simply select the association you want to setup and in Property editor enter Owning alias or Property alias value.

Conclusion

I hope that this tip will help you to understand a way how ORM Designer proceeds associations export. Because Doctrine2 supports multi-direction associations, it is required this “Alias-enter” step. Please, leave us your comment about this feature if you have any opinion.

28 Aug 2010

Posted by: Ludek Vodicka

Skipper tips #features #doctrine #tips