eZ\Publish\Core\FieldType\RelationList\Type::createValueFromInput PHP Method

createValueFromInput() protected method

Inspects given $inputValue and potentially converts it into a dedicated value object.
protected createValueFromInput ( integer | string | array | eZ\Publish\API\Repository\Values\Content\ContentInfo | Value $inputValue ) : Value
$inputValue integer | string | array | eZ\Publish\API\Repository\Values\Content\ContentInfo | Value
return Value The potentially converted and structurally plausible value.
    protected function createValueFromInput($inputValue)
    {
        // ContentInfo
        if ($inputValue instanceof ContentInfo) {
            $inputValue = new Value(array($inputValue->id));
        } elseif (is_integer($inputValue) || is_string($inputValue)) {
            // content id
            $inputValue = new Value(array($inputValue));
        } elseif (is_array($inputValue)) {
            // content id's
            $inputValue = new Value($inputValue);
        }
        return $inputValue;
    }