protected function validateEntityIdCollectionItem()
    {
        $field = 'entity_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            return null;
        }

        $title = $this->getSubmitted('title');

        if (is_numeric($title)) {
            $value = $title;
        }

        $label = $this->translation->text('Entity');

        if (empty($value) || !is_numeric($value)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        $update = $this->getUpdating();

        if (isset($update['collection_item_id']) && $update[$field] == $value) {
            return null;
        }

        $conditions = array(
            'type' => $this->getSubmitted('collection.type'),
            'collection_id' => $this->getSubmitted('collection.collection_id')
        );

        $existing = $this->collection_item->getItems($conditions);

        if (isset($existing[$value])) {
            $this->setErrorExists($field, $label);
            return false;
        }

        $this->setSubmitted($field, $value);
        return true;
    }
protected function validateEntityIdCollectionItem()
    {
        $field = 'entity_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            return null;
        }

        $title = $this->getSubmitted('title');

        if (is_numeric($title)) {
            $value = $title;
        }

        $label = $this->translation->text('Entity');

        if (empty($value) || !is_numeric($value)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        $update = $this->getUpdating();

        if (isset($update['collection_item_id']) && $update[$field] == $value) {
            return null;
        }

        $conditions = array(
            'type' => $this->getSubmitted('collection.type'),
            'collection_id' => $this->getSubmitted('collection.collection_id')
        );

        $existing = $this->collection_item->getItems($conditions);

        if (isset($existing[$value])) {
            $this->setErrorExists($field, $label);
            return false;
        }

        $this->setSubmitted($field, $value);
        return true;
    }
protected function validateEntityIdCollectionItem ( ) { $ field = 'entity_id' ; if ( $ this -> isExcluded ( $ field ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( $ this -> isUpdating ( ) && ! isset ( $ value ) ) { return null ; } $ title = $ this -> getSubmitted ( 'title' ) ; if ( is_numeric ( $ title ) ) { $ value = $ title ; } $ label = $ this -> translation -> text ( 'Entity' ) ; if ( empty ( $ value ) || ! is_numeric ( $ value ) ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } $ update = $ this -> getUpdating ( ) ; if ( isset ( $ update [ 'collection_item_id' ] ) && $ update [ $ field ] == $ value ) { return null ; } $ conditions = array ( 'type' => $ this -> getSubmitted ( 'collection.type' ) , 'collection_id' => $ this -> getSubmitted ( 'collection.collection_id' ) ) ; $ existing = $ this -> collection_item -> getItems ( $ conditions ) ; if ( isset ( $ existing [ $ value ] ) ) { $ this -> setErrorExists ( $ field , $ label ) ; return false ; } $ this -> setSubmitted ( $ field , $ value ) ; return true ; }
Validates submitted collection item entity ID
@return boolean|null
Validates submitted collection item entity ID