src/CRUDlex/EntityValidator.php
protected function fieldConstraintsToRules($field, AbstractData $data)
    {
        $rules = [];
        if ($this->definition->getField($field, 'required', false)) {
            $rules[] = ['required'];
        }
        if ($this->definition->getField($field, 'unique', false)) {
            $rules[] = ['unique', $data, $this->entity, $field];
        }
        return $rules;
    }
protected function fieldConstraintsToRules($field, AbstractData $data)
    {
        $rules = [];
        if ($this->definition->getField($field, 'required', false)) {
            $rules[] = ['required'];
        }
        if ($this->definition->getField($field, 'unique', false)) {
            $rules[] = ['unique', $data, $this->entity, $field];
        }
        return $rules;
    }
protected function fieldConstraintsToRules ( $ field , AbstractData $ data ) { $ rules = [ ] ; if ( $ this -> definition -> getField ( $ field , 'required' , false ) ) { $ rules [ ] = [ 'required' ] ; } if ( $ this -> definition -> getField ( $ field , 'unique' , false ) ) { $ rules [ ] = [ 'unique' , $ data , $ this -> entity , $ field ] ; } return $ rules ; }
Builds up the validation rules for a single field according to the
entity definition constraints.

@param string $field
the field for the rules
@param AbstractData $data
the data instance to use for validation

@return array
the validation rules for the field
Builds up the validation rules for a single field according to the entity definition constraints .