public function deserialize(array $data, FieldFacetValue $fieldFacetValue = null, array $options = [])
    {
        $fieldFacet = $this->container->get('claroline.persistence.object_manager')
            ->getRepository(FieldFacet::class)
            ->findOneByUuid($data['fieldFacet']['id']);

        $fieldFacetValue->setFieldFacet($fieldFacet);
        $value = $data['value'];

        switch ($fieldFacet->getType()) {
            case FieldFacet::DATE_TYPE:
                $date = is_string($value) ?
                    new \DateTime($value) :
                    $value;
                $fieldFacetValue->setDateValue($date);
                break;
            case FieldFacet::NUMBER_TYPE:
                $fieldFacetValue->setFloatValue($value);
                break;
            case FieldFacet::CASCADE_TYPE:
                $fieldFacetValue->setArrayValue($value);
                break;
            case FieldFacet::CHOICE_TYPE:
                if (is_array($value)) {
                    $fieldFacetValue->setArrayValue($value);
                } else {
                    $fieldFacetValue->setStringValue($value);
                }
                break;
            case FieldFacet::BOOLEAN_TYPE:
                $fieldFacetValue->setBoolValue($value);
                break;
            default:
                $fieldFacetValue->setStringValue($value);
        }

        return $fieldFacetValue;
    }
public function deserialize(array $data, FieldFacetValue $fieldFacetValue = null, array $options = [])
    {
        $fieldFacet = $this->container->get('claroline.persistence.object_manager')
            ->getRepository(FieldFacet::class)
            ->findOneByUuid($data['fieldFacet']['id']);

        $fieldFacetValue->setFieldFacet($fieldFacet);
        $value = $data['value'];

        switch ($fieldFacet->getType()) {
            case FieldFacet::DATE_TYPE:
                $date = is_string($value) ?
                    new \DateTime($value) :
                    $value;
                $fieldFacetValue->setDateValue($date);
                break;
            case FieldFacet::NUMBER_TYPE:
                $fieldFacetValue->setFloatValue($value);
                break;
            case FieldFacet::CASCADE_TYPE:
                $fieldFacetValue->setArrayValue($value);
                break;
            case FieldFacet::CHOICE_TYPE:
                if (is_array($value)) {
                    $fieldFacetValue->setArrayValue($value);
                } else {
                    $fieldFacetValue->setStringValue($value);
                }
                break;
            case FieldFacet::BOOLEAN_TYPE:
                $fieldFacetValue->setBoolValue($value);
                break;
            default:
                $fieldFacetValue->setStringValue($value);
        }

        return $fieldFacetValue;
    }
public function deserialize ( array $ data , FieldFacetValue $ fieldFacetValue = null , array $ options = [ ] ) { $ fieldFacet = $ this -> container -> get ( 'claroline.persistence.object_manager' ) -> getRepository ( FieldFacet :: class ) -> findOneByUuid ( $ data [ 'fieldFacet' ] [ 'id' ] ) ; $ fieldFacetValue -> setFieldFacet ( $ fieldFacet ) ; $ value = $ data [ 'value' ] ; switch ( $ fieldFacet -> getType ( ) ) { case FieldFacet :: DATE_TYPE : $ date = is_string ( $ value ) ? new \ DateTime ( $ value ) : $ value ; $ fieldFacetValue -> setDateValue ( $ date ) ; break ; case FieldFacet :: NUMBER_TYPE : $ fieldFacetValue -> setFloatValue ( $ value ) ; break ; case FieldFacet :: CASCADE_TYPE : $ fieldFacetValue -> setArrayValue ( $ value ) ; break ; case FieldFacet :: CHOICE_TYPE : if ( is_array ( $ value ) ) { $ fieldFacetValue -> setArrayValue ( $ value ) ; } else { $ fieldFacetValue -> setStringValue ( $ value ) ; } break ; case FieldFacet :: BOOLEAN_TYPE : $ fieldFacetValue -> setBoolValue ( $ value ) ; break ; default : $ fieldFacetValue -> setStringValue ( $ value ) ; } return $ fieldFacetValue ; }
Deserializes a FieldFacetValue entity for the JSON api.

@param array                $data
@param FieldFacetValue|null $fieldFacetValue
@param array                $options         - a list of serialization options

@return array - the serialized representation of the field facet value
Deserializes a FieldFacetValue entity for the JSON api .