예제 #1
0
 /**
  * Initialize method
  *
  * @param array $config The configuration for the Table.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->table('usertokens');
     $this->displayField('id');
     $this->primaryKey('id');
     $this->addBehavior('Timestamp');
     $this->belongsTo('Users', ['foreignKey' => 'user_id', 'className' => 'User.Users', 'joinType' => 'INNER']);
 }
예제 #2
0
 /**
  * Initialize method
  *
  * @param array $config The configuration for the Table.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->table('genders');
     $this->displayField('name');
     $this->primaryKey('id');
     $this->addBehavior('Timestamp');
     $this->hasMany('Personalinformations', ['className' => 'User.Personalinformations', 'foreignKey' => 'gender_id']);
 }
예제 #3
0
 /**
  * Initialize method
  *
  * @param array $config The configuration for the Table.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->table('userjuridicaltypes');
     $this->displayField('name');
     $this->primaryKey('id');
     $this->addBehavior('Timestamp');
     $this->hasMany('Usertypes', ['className' => 'User.Usertypes', 'foreignKey' => 'userjuridicaltype_id']);
 }
예제 #4
0
파일: UsersTable.php 프로젝트: oxenti/user
 /**
  * Initialize method
  *
  * @param array $config The configuration for the Table.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->table('users');
     $this->displayField('id');
     $this->primaryKey('id');
     $this->addBehavior('Timestamp');
     $now = strtotime("now");
     $this->addBehavior('Utils.Uploadable', ['avatar_path' => ['field' => 'avatar_path', 'entityReplacements' => ['{primaryKey}' => 'id'], 'path' => '{ROOT}{DS}{WEBROOT}{DS}uploads{DS}{model}{DS}avatar{DS}{primaryKey}{DS}', 'fileName' => '{primaryKey}_avatar_' . $now . '.{extension}', 'accept_type' => 'image']]);
     $this->belongsTo('Usertypes', ['foreignKey' => 'usertype_id', 'joinType' => 'INNER', 'className' => 'User.Usertypes']);
     $this->belongsTo('Personalinformations', ['foreignKey' => 'personalinformation_id', 'className' => 'User.Personalinformations']);
     $this->hasOne('Usersocialdata', ['foreignKey' => 'user_id', 'className' => 'User.Usersocialdata']);
     $this->hasMany('Usertokens', ['foreignKey' => 'user_id', 'className' => 'User.Usertokens']);
     $this->_setAppRelations(Configure::read('user_plugin.relations'));
     // Register event listeners
     $UserMailer = new UserMailer();
     $this->eventManager()->on($UserMailer);
 }