0
當我想給一個關係到用戶自>組我在這裏得到一個錯誤是我的代碼學說:hasOne給出錯誤
<?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 = '#*[email protected]*%';
$this->_set('password', md5($salt . $value));
}
}
?>
是否有人可以解釋爲什麼我收到錯誤?
這裏是我的組碼:
<?php
class Group extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
$this->setTableName('groups');
}
}
?>
我的代碼點火器1.7.2和1.2.2學說運行
你究竟得到什麼錯誤? – Crozin 2010-03-31 09:12:34