public function hashToFieldValue($fieldValue, array $context = array())
    {
        if (is_array($fieldValue) && array_key_exists('destinationContentId', $fieldValue)) {
            // fromHash format
            $id = $fieldValue['destinationContentId'];
        } else {
            // simplified format
            $id = $fieldValue;
        }

        if ($id === null) {
            return new Value();
        }

        // 1. resolve relations
        $id = $this->referenceResolver->resolveReference($id);
        // 2. resolve remote ids
        $id = $this->contentMatcher->matchOneByKey($id)->id;

        return new Value($id);
    }
public function hashToFieldValue($fieldValue, array $context = array())
    {
        if (is_array($fieldValue) && array_key_exists('destinationContentId', $fieldValue)) {
            // fromHash format
            $id = $fieldValue['destinationContentId'];
        } else {
            // simplified format
            $id = $fieldValue;
        }

        if ($id === null) {
            return new Value();
        }

        // 1. resolve relations
        $id = $this->referenceResolver->resolveReference($id);
        // 2. resolve remote ids
        $id = $this->contentMatcher->matchOneByKey($id)->id;

        return new Value($id);
    }
public function hashToFieldValue ( $ fieldValue , array $ context = array ( ) ) { if ( is_array ( $ fieldValue ) && array_key_exists ( 'destinationContentId' , $ fieldValue ) ) { // fromHash format $ id = $ fieldValue [ 'destinationContentId' ] ; } else { // simplified format $ id = $ fieldValue ; } if ( $ id === null ) { return new Value ( ) ; } // 1. resolve relations $ id = $ this -> referenceResolver -> resolveReference ( $ id ) ; // 2. resolve remote ids $ id = $ this -> contentMatcher -> matchOneByKey ( $ id ) -> id ; return new Value ( $ id ) ; }
Creates a value object to use as the field value when setting an ez relation field type.

@param array|string|int $fieldValue The definition of the field value, structured in the yml file
@param array $context The context for execution of the current migrations. Contains f.e. the path to the migration
@return Value
Creates a value object to use as the field value when setting an ez relation field type .