{@inheritdoc}

@param mixed $incoming The input data.
@param Map|null $context An optional generic key-value map, for providing
contextual values during the build process.
@return mixed The built model.
341814
public function build($incoming, Map $context = null)
    {
        $callable = $this->getDelegate();

        if (null === $context && $this->provide_fallback_context) {
            // Provide a non-null context so null checks aren't later required
            $context = new Map();
        }

        return $callable($incoming, $context);
    }
498653
public function load(LoadingContext $context, ParentChildMap $map)
    {
        /** @var Row[] $parentRows */
        $parentRows = [];
        /** @var ParentChildItem[] $items */
        $items = [];

        $requiredColumnLookup = $this->getRequiredColumnLookup();

        foreach ($map->getItems() as $key => $item) {
            $parentRow = $item->getParent();

            if ($this->objectIssetColumnName) {
                $objectIssetValue = $parentRow->getColumn($this->objectIssetColumnName);
                if ($this->isWithinValueObject && $objectIssetValue === null) {
                    continue;
                } elseif (!$this->isWithinValueObject && !$objectIssetValue) {
                    continue;
                }
            } else {
                // In case this relation was loaded via a LEFT JOIN the columns may be null
                // even if they are not nullable hence we must only load the object if all the non nullable columns
                // does not contain a null value.
                foreach ($this->parentColumnsToLoad as $requiredColumn) {
                    if (isset($requiredColumnLookup[$requiredColumn]) && $parentRow->getColumn($requiredColumn) === null) {
                        continue 2;
                    }
                }
            }

            $parentRows[$key] = $parentRow;
            $items[$key]      = $item;
        }

        $objects = $this->mapper->loadAll($context, $parentRows);

        foreach ($objects as $key => $object) {
            $items[$key]->setChild($object);
        }
    }
97197
public function map($field, $context = null)
    {
        if (array_key_exists('hidden', $field)) {
            $field['hidden'] = (bool) $field['hidden'];
        } else {
            $field['hidden'] = false;
        }

        if (!array_key_exists('restrictions', $field)) {
            $field['restrictions'] = [];
        }

        return $field;
    }
1022379
public function serializeContextFunction($context)
    {
        $json = array();

        foreach ($context as $key => $value) {
            if (!in_array($key, array('_parent', 'assetic', 'app')) && !preg_match('#sonata#', $key)) {
                try {
                    $serializedValue = $this->serializer->serialize($value, 'json');
                } catch (\JMS\Serializer\Exception\RuntimeException $ex) {
                    $serializedValue = json_encode($value, null, 2);
                }

                if (!empty($serializedValue)) {
                    $json[] = $this->serializer->serialize($key, 'json').':'.$serializedValue;
                }
            }
        }

        return '{'.implode(',', $json).'}';
    }
22703
public function execute(MappingContext $context)
	{
		$typeMap = $this->config->findTypeMap($context->getSourceType(), $context->getDestinationType());

		try {
			$typeMap->validate();
			$mapFunc = $typeMap->getMapFunc();

			$destination = is_array($context->getSource())
				? $this->mapCollection($context, $mapFunc)
				: $this->mapObject($context, $mapFunc);
			return $destination;
		} catch (\Exception $e) {
			$message = sprintf("Error while mapping %s -> %s", $typeMap->getSourceType(), $typeMap->getDestinationType());
			throw new MappingException($message, 0, $e);
		}
	}
973900
private function createParamsFromContext(ClientMethodContext $context): ParameterGenerator
    {
        if (!$context->isMultiArgument()) {
            $param = current($context->getMethod()->getParameters());

            return ParameterGenerator::fromArray($param->toArray());
        }

        return ParameterGenerator::fromArray(
            [
                'name' => 'multiArgumentRequest',
                'type' => MultiArgumentRequest::class,
            ]
        );
    }
1226284
public function map($field, $context = null)
    {
        foreach ($this->mappers as $mapper) {
            $field = $mapper->map($field, $context);
        }
        return $field;
    }
112391
public function prepareValue(Context $context)
    {
        if (isset($this->name) && isset($context[$this->name])) {
            $value = $context[$this->name];
        } elseif ($this->value instanceof VariableOperand) {
            $value = $this->value->prepareValue($context);
        } else {
            $value = $this->value;
        }

        return ($value instanceof Value) ? $value : new Value($value);
    }
128388
public function getProxy( string $context ): ThenProxy
	{
		if( isset($this->proxy[$context]) )
		{
			return $this->proxy[$context];
		}

		if( !$this->lang->load($context) )
		{
			throw new \InvalidArgumentException("Cannot load the '{$context}' language package");
		}

		$this->proxy[$context] = new ThenProxy($this, $context);
		return $this->proxy[$context];
	}
577770
public function map($field, $context = null)
    {
        $field['serializerType'] = $field['type'];
        if (substr($field['type'], -2) == '[]') {
            $field['serializerType'] = sprintf('array<%s>', substr($field['type'], 0, -2));
        }

        // @todo this assumtion is a hack and needs fixing
        if ($field['type'] === 'array') {
            $field['serializerType'] = 'array<string>';
        }

        if ($field['type'] === 'object') {
            $field['serializerType'] = 'array';
        }

        return $field;
    }
1366576
public function resolveEntryNameByContext($entryName, $context = null)
    {
        if (!interface_exists($entryName) && !class_exists($entryName)) {
            return null;
        }

        if (null === $context) {
            return $entryName;
        }

        $contextClass = $this->buildClassNameContext($context);
        $className = $this->buildClassNameByEntryName($entryName);

        $resolveByContext = $this->resolve($className, $contextClass);
        if (null !== $resolveByContext) {
            return $resolveByContext;
        }

        return $this->resolve($className, $className);
    }
809839
public function create($context = null)
    {
        try {
            $this->context = strlen($context) ? $context : $this->getConfig('create[context]', self::CONTEXT_CREATE);
            $this->controller->pageTitle = $this->controller->pageTitle ?: $this->getLang(
                "{$this->context}[title]",
                'backend::lang.form.create_title'
            );

            $model = $this->controller->formCreateModelObject();
            $model = $this->controller->formExtendModel($model) ?: $model;

            $this->initForm($model);
        }
        catch (Exception $ex) {
            $this->controller->handleError($ex);
        }
    }
509019
private function getRouteVars(RouteContextInterface $context, array $parameters)
    {
        return array_merge(
            array_combine(array_values($v = $context->getVars()), array_fill(1, count($v), null)),
            $parameters
        );
    }
161209
public function serializeToJsonOrYml(VisitorInterface $visitor, $entity, array $type, Context $context)
    {
        $object = new \stdClass();
        $object->id = $type['params']['id'];

        return $object;
    }
1246766
public function fromContext(Context $context)
    {
        $route  = $this->matcher->match($context);

        return $route
            ? $this->fromRoute($route)
            : $this->failedAction($context);
    }
1344750
public function merge(ResourceSerializationContext $context): MutableSerializationContext
    {
        $cloned = clone $this;

        $cloned->payload = array_merge($cloned->payload, $context->payload);

        return $cloned;
    }
1171164
private function initializeInstance(Context $context)
    {
        foreach ($this->contextInitializers as $initializer) {
            $initializer->initializeContext($context);
        }
    }