protected function initialize() { parent::initialize(); $this->_fields += array('name' => array('type' => 'string'), 'username' => array('type' => 'string'), 'password' => array('type' => 'string'), 'email' => array('type' => 'email'), 'created' => array('type' => 'date'), 'updated' => array('type' => 'date'), 'last_login' => array('type' => 'date'), 'logins' => array('type' => 'integer'), 'roles_ids' => array('type' => 'array')); $this->_relations += array('roles' => array('model' => 'Role', 'type' => 'many_to_many', 'field' => 'roles_ids', 'foreignKey' => 'users'), 'tokens' => array('model' => 'User_Token', 'type' => 'one_to_many', 'foreignKey' => 'users')); /*$this->_rules += array( 'username' => array( array('not_empty'), array('max_length', array(':value', 32)), array(array(":model", 'unique'), array('username', ':value')), ), 'email' => array( array('not_empty'), array('email'), array(array(':model', 'unique'), array('email', ':value')), ), );*/ }
public function initialize() { parent::initialize(); $this->_fields += array('extension' => array('type' => 'string'), 'title' => array('type' => 'string'), 'description' => array('type' => 'string'), 'width' => array('type' => 'integer'), 'height' => array('type' => 'integer'), 'presentations' => array('type' => 'array')); }
protected function initialize() { parent::initialize(); $this->_fields += array('name' => array('type' => 'string'), 'description' => array('type' => 'string')); $this->_relations += array('users' => array('model' => 'User', 'type' => 'many_to_many', 'store' => false, 'foreignKey' => 'roles')); }
public function initialize() { parent::initialize(); $this->_fields += array('user_id' => array('type' => 'string'), 'token' => array('type' => 'string'), 'created' => array('type' => 'date'), 'expires' => array('type' => 'date'), 'user_agent' => array('type' => 'string')); $this->_relations += array('user' => array('model' => 'User', 'type' => 'many_to_one', 'field' => 'user_id', 'foreignKey' => 'tokens')); }