protected function checkRequiredAttributes($data)
    {
        $existingAttributes = array_keys($data);
        $errors = array();
        foreach ($this->requiredAttributes as $requiredAttribute) {
            if (!in_array($requiredAttribute, $existingAttributes)
                || $data[$requiredAttribute] === ''
                || $data[$requiredAttribute] === null
            ) {
                $errors[] = $requiredAttribute.' is missing or empty';
            }
        }

        if (count($errors) > 0) {
            throw new ValidationError('Missing required fields', $errors);
        }

        return true;
    }
protected function checkRequiredAttributes($data)
    {
        $existingAttributes = array_keys($data);
        $errors = array();
        foreach ($this->requiredAttributes as $requiredAttribute) {
            if (!in_array($requiredAttribute, $existingAttributes)
                || $data[$requiredAttribute] === ''
                || $data[$requiredAttribute] === null
            ) {
                $errors[] = $requiredAttribute.' is missing or empty';
            }
        }

        if (count($errors) > 0) {
            throw new ValidationError('Missing required fields', $errors);
        }

        return true;
    }
protected function checkRequiredAttributes ( $ data ) { $ existingAttributes = array_keys ( $ data ) ; $ errors = array ( ) ; foreach ( $ this -> requiredAttributes as $ requiredAttribute ) { if ( ! in_array ( $ requiredAttribute , $ existingAttributes ) || $ data [ $ requiredAttribute ] === '' || $ data [ $ requiredAttribute ] === null ) { $ errors [ ] = $ requiredAttribute . ' is missing or empty' ; } } if ( count ( $ errors ) > 0 ) { throw new ValidationError ( 'Missing required fields' , $ errors ) ; } return true ; }
Check if request data contains all of the required attributes to create a new record
@param array $data Request data
@return bool
Check if request data contains all of the required attributes to create a new record