/
var
/
www
/
vhosts
/
ihelp.ro
/
_OLD
/
src
/
Model
/
Table
/
/var/www/vhosts/ihelp.ro/_OLD/src/Model/Table
mkdir
upload
Name
Size
Mode
Actions
CauseImagesTable.php
1590
0644
edit
dl
rm
CausesTable.php
3282
0644
edit
dl
rm
ProfilesTable.php
3851
0644
edit
dl
rm
UsersTable.php
3435
0644
edit
dl
rm
Edit:
/var/www/vhosts/ihelp.ro/_OLD/src/Model/Table/ProfilesTable.php
(3851B)
<?php declare(strict_types=1); namespace App\Model\Table; use Cake\ORM\Query; use Cake\ORM\RulesChecker; use Cake\ORM\Table; use Cake\Validation\Validator; /** * Profiles Model * * @property \App\Model\Table\UsersTable&\Cake\ORM\Association\BelongsTo $Users * @property \App\Model\Table\UserAcceptContactMethodsTable&\Cake\ORM\Association\BelongsTo $UserAcceptContactMethods * * @method \App\Model\Entity\Profile newEmptyEntity() * @method \App\Model\Entity\Profile newEntity(array $data, array $options = []) * @method \App\Model\Entity\Profile[] newEntities(array $data, array $options = []) * @method \App\Model\Entity\Profile get($primaryKey, $options = []) * @method \App\Model\Entity\Profile findOrCreate($search, ?callable $callback = null, $options = []) * @method \App\Model\Entity\Profile patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = []) * @method \App\Model\Entity\Profile[] patchEntities(iterable $entities, array $data, array $options = []) * @method \App\Model\Entity\Profile|false save(\Cake\Datasource\EntityInterface $entity, $options = []) * @method \App\Model\Entity\Profile saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = []) * @method \App\Model\Entity\Profile[]|\Cake\Datasource\ResultSetInterface|false saveMany(iterable $entities, $options = []) * @method \App\Model\Entity\Profile[]|\Cake\Datasource\ResultSetInterface saveManyOrFail(iterable $entities, $options = []) * @method \App\Model\Entity\Profile[]|\Cake\Datasource\ResultSetInterface|false deleteMany(iterable $entities, $options = []) * @method \App\Model\Entity\Profile[]|\Cake\Datasource\ResultSetInterface deleteManyOrFail(iterable $entities, $options = []) * * @mixin \Cake\ORM\Behavior\TimestampBehavior */ class ProfilesTable extends Table { /** * Initialize method * * @param array $config The configuration for the Table. * @return void */ public function initialize(array $config): void { parent::initialize($config); $this->setTable('profiles'); $this->setDisplayField('id'); $this->setPrimaryKey('id'); $this->addBehavior('Timestamp'); $this->belongsTo('Users', [ 'foreignKey' => 'user_id', 'joinType' => 'INNER', ]); } /** * Default validation rules. * * @param \Cake\Validation\Validator $validator Validator instance. * @return \Cake\Validation\Validator */ public function validationDefault(Validator $validator): Validator { $validator ->integer('id') ->allowEmptyString('id', null, 'create'); $validator ->scalar('first_name') ->maxLength('first_name', 255) ->requirePresence('first_name', 'create') ->notEmptyString('first_name'); $validator ->scalar('last_name') ->maxLength('last_name', 255) ->requirePresence('last_name', 'create') ->notEmptyString('last_name'); $validator ->scalar('address') ->maxLength('address', 255) ->requirePresence('address', 'create') ->notEmptyString('address'); $validator ->integer('phone') ->requirePresence('phone', 'create') ->notEmptyString('phone'); return $validator; } /** * Returns a rules checker object that will be used for validating * application integrity. * * @param \Cake\ORM\RulesChecker $rules The rules object to be modified. * @return \Cake\ORM\RulesChecker */ public function buildRules(RulesChecker $rules): RulesChecker { $rules->add($rules->existsIn(['user_id'], 'Users'), ['errorField' => 'user_id']); return $rules; } }
Save
cmd:
run