setTableName('user'); $this->hasColumn('id', 'integer', 11, array('primary' => true, 'autoincrement' => true)); $this->hasColumn('username', 'string', 255); $this->hasColumn('hair_color', 'string', 255); $this->hasColumn('contact_id', 'integer', 11); $this->index('name_x', array('fields' => array('username' => array( 'sorting' => 'ASC', 'length' => '11', 'primary' => true, ), ), 'type' => 'unique')); } public function setUp() { $this->hasOne('Contact', array('local' => 'contact_id', 'foreign' => 'id')); $this->hasMany('Car as Cars', array('refClass' => 'UserCar', 'local' => 'user_id', 'foreign' => 'car_id')); $this->hasMany('Group as Groups', array('refClass' => 'UserGroup', 'local' => 'user_id', 'foreign' => 'group_id')); $this->hasOne('Dog', array('local' => 'id', 'foreign' => 'user_id')); $this->hasMany('SelfReference as SelfReference1', array('local' => 'id', 'foreign' => 'user_id1')); $this->hasMany('SelfReference as SelfReference2', array('local' => 'id', 'foreign' => 'user_id2')); } }