<?php
namespace App\Model\Table;


use Cake\ORM\Table;
use Cake\Validation\Validator;

/**
 * StudentCheckLists Model

 * @method \App\Model\Entity\CheckList get($primaryKey, $options = [])
 * @method \App\Model\Entity\CheckList newEntity($data = null, array $options = [])
 * @method \App\Model\Entity\CheckList[] newEntities(array $data, array $options = [])
 * @method \App\Model\Entity\CheckList|false save(\Cake\Datasource\EntityInterface $entity, $options = [])
 * @method \App\Model\Entity\CheckList saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
 * @method \App\Model\Entity\CheckList patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
 * @method \App\Model\Entity\CheckList[] patchEntities($entities, array $data, array $options = [])
 * @method \App\Model\Entity\CheckList findOrCreate($search, callable $callback = null, $options = [])
 */
class StudentCheckListsTable extends Table
{
    /**
     * Initialize method
     *
     * @param array $config The configuration for the Table.
     * @return void
     */
    public function initialize(array $config)
    {
        parent::initialize($config);

        $this->setTable('student_checklists');
        $this->setPrimaryKey('id');

    }

    /**
     * Default validation rules.
     *
     * @param \Cake\Validation\Validator $validator Validator instance.
     * @return \Cake\Validation\Validator
     */
    public function validationDefault(Validator $validator)
    {
        $validator
            ->integer('id')
            ->allowEmptyString('id', null, 'create');

        $validator
            ->integer('student_id')
            ->notEmptyString('student_id');

        $validator
            ->integer('checklist_id')
            ->notEmptyString('checklist_id');

        $validator
            ->integer('created_by_id')
            ->allowEmptyString('created_by_id');

        $validator
            ->integer('updated_by_id')
            ->allowEmptyString('updated_by_id');

        $validator
            ->dateTime('created_at')
            ->allowEmptyDateTime('created_at');

        $validator
            ->dateTime('updated_at')
            ->allowEmptyDateTime('updated_at');

        return $validator;
    }


}
