Hi, when I am trying to give a relationship to user->group I get an error here is my code
<?php
class User extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('username', 'string', 255, array('unique' => 'true'));
$this->hasColumn('password', 'string', 255);
$this->hasColumn('email', 'string', 255, array('unique' => 'true'));
$this->hasColumn('group_id', 'integer', 20);
}
public function setUp() {
$this->setTableName('users');
$this->actAs('Timestampable');
$this->hasMutator('password', '_encrypt_password');
$this->hasOne('Group', array(
'local' => 'group_id',
'foreign' => 'id'
));
}
protected function _encrypt_password($value) {
$salt = '#*seCrEt!@-*%';
$this->_set('password', md5($salt . $value));
}
}
?>
Can someone please explain why I'm getting errors?
here is my group code:
<?php
class Group extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
$this->setTableName('groups');
}
}
?>
I'm running on Code Igniter 1.7.2 and Doctrine 1.2.2
Thank you!