public function isRequired($field)
    {
        $parts = explode('.', $field);
        $entity = $this->entity($parts);

        $isNew = true;
        if ($entity instanceof EntityInterface) {
            $isNew = $entity->isNew();
        }

        $validator = $this->_getValidator($parts);
        $fieldName = array_pop($parts);
        if (!$validator->hasField($fieldName)) {
            return false;
        }
        if ($this->type($field) !== 'boolean') {
            return $validator->isEmptyAllowed($fieldName, $isNew) === false;
        }

        return false;
    }
public function isRequired($field)
    {
        $parts = explode('.', $field);
        $entity = $this->entity($parts);

        $isNew = true;
        if ($entity instanceof EntityInterface) {
            $isNew = $entity->isNew();
        }

        $validator = $this->_getValidator($parts);
        $fieldName = array_pop($parts);
        if (!$validator->hasField($fieldName)) {
            return false;
        }
        if ($this->type($field) !== 'boolean') {
            return $validator->isEmptyAllowed($fieldName, $isNew) === false;
        }

        return false;
    }
public function isRequired ( $ field ) { $ parts = explode ( '.' , $ field ) ; $ entity = $ this -> entity ( $ parts ) ; $ isNew = true ; if ( $ entity instanceof EntityInterface ) { $ isNew = $ entity -> isNew ( ) ; } $ validator = $ this -> _getValidator ( $ parts ) ; $ fieldName = array_pop ( $ parts ) ; if ( ! $ validator -> hasField ( $ fieldName ) ) { return false ; } if ( $ this -> type ( $ field ) !== 'boolean' ) { return $ validator -> isEmptyAllowed ( $ fieldName , $ isNew ) === false ; } return false ; }
Check if a field should be marked as required.

@param string $field The dot separated path to the field you want to check.
@return bool
Check if a field should be marked as required .