ORM Designer and CakePHP
From ORM Designer version 1.3.2, CakePHP is fully supported. If you have any feature request or issue report, please contact us on the forum or send us a mail to support@orm-designer.com. Thank you for helping us making ORM Designer better.
Follow this tutorial to start using ORM Designer.
Database modeling
With ORM Designer you start with modeling and defining CakePHP model objects in the same way you are used to define database tables and relationships. This way you have only one place you have to make changes to the database structure and you can be sure the visual model is always up to date with the real application.
Complete model definitions
Before ORM Designer you had to write database model definitions by hand which meant you did everything to avoid writing the full database table definition. ORM Designer helps you by guiding you through the whole definition process. Once you define tables and relationships you can add ORM specific attributes (e.g. behaviours, extended relationship definitions, cache etc.). ORM Designer exports the definitions into PHP code stored in a Base class which you extend instead of AppModel class. This way you can add methods or ovewrite base definitions without the risc of ORM Designer losing all your work.
Example of BaseAddress and Address class generated with ORM designer.
Base class example
<?php
/**
* BaseAddress
* This class has been auto-generated by ORM Designer
*/
class BaseAddress extends AppModel
{
public $name = 'Address';
public $primaryKey = 'ID';
public $actAs =
array (
'Translate' =>
array ( 'City','State'
),
'ACL' =>
array (
'type' => 'requester'
)
);
public $tablePrefix = 'db_';
public $logTransactions = 'true';
public $_schema =
array (
'ID' =>
array (
'type' => 'integer',
'length' => 4,
'null' => false
),
'Contact_ID' =>
array (
'type' => 'integer',
'null' => false
),
'StreetNumber' =>
array (
'type' => 'integer',
'length' => 5,
'null' => false
)
);
public $belongsTo =
array (
'Address' =>
array (
'className' => 'Address',
'foreignKey' => 'Contact_ID',
'counterCache' => 'true'
)
);
}
?>
Derived class example
<?php
require_once 'base/base_address.php';
class Address extends BaseAddress
{
}
Be more effective
When we were working on ORM Designer we asked ourselves what are our everydays tasks and we did our best to make these tasks easy and fast. We are proud of the searching and model navigation features. We hope you will enjoy "Summary window" which provides full text search through columns, tables, relations or indexes. Or a fully searchable "Project tree" which is another helpful visualization of your CakePHP project.
External tools
ORM Designer enables you to set an external tool. Each external tool is defined by its executable-path, arguments and by default path. It is also possible to use pre-defined constants that are evaluated before tool is executed. These constants can be substituted with current project name, project path, ORM or MVC framework.
Download ORM Designer for CakePHP
If you are interested in ORM Designer application, here you can download a free 14 days trial version.
Appendix: Supported CakePHP features
- Generate PHP code with definition of models
- Generate base model class
- One time generation of empty derived model class
- Automatic generation of association code to base model class
- hasOne
- hasMany
- belongsTo
- hasAndBelongsToMany (HABTM)
- Support for editing all model attributes via ORM Designer
- tablePrefix
- recursive
- order
- ...
- Support for editing all association attributes via ORM Designer
- condition
- counterCache
- dependent
- exclusive
- ...
- Support for CakePHP model behaviours
- ACL
- Containable
- Translate
- Tree
- Automatic filled model attributes in base model class
- primaryKey (automatic filled)
- _schema (automatic generated array of columns)
- Support for CakePHP data types
- Support for CakePHP directory structure




