src/Model/Behavior/SlugBehavior.php
public function buildValidator(Event $event, Validator $validator, $name)
    {
        foreach ((array)$this->getConfig('displayField') as $field) {
            if (strpos($field, '.') === false) {
                $validator->requirePresence($field, 'create')
                    ->notEmpty($field);
            }
        }
    }
public function buildValidator(Event $event, Validator $validator, $name)
    {
        foreach ((array)$this->getConfig('displayField') as $field) {
            if (strpos($field, '.') === false) {
                $validator->requirePresence($field, 'create')
                    ->notEmpty($field);
            }
        }
    }
public function buildValidator ( Event $ event , Validator $ validator , $ name ) { foreach ( ( array ) $ this -> getConfig ( 'displayField' ) as $ field ) { if ( strpos ( $ field , '.' ) === false ) { $ validator -> requirePresence ( $ field , 'create' ) -> notEmpty ( $ field ) ; } } }
Callback for Model.buildValidator event.

@param \Cake\Event\Event $event The beforeSave event that was fired.
@param \Cake\Validation\Validator $validator Validator instance.
@param string $name Validator name.
@return void
Callback for Model . buildValidator event .