Transforms a string (id) to an object.

@param  string $id

@return Object|null

@throws TransformationFailedException if object is not found.
344032
public function reverseTransform($id)
    {
        if (!$id) {
            return null;
        }
        if($this->sinDigito) {
            $id=trim(substr($id,0,-1));
        }
        $id=intval($id);
        $object = $this->om
            ->getRepository($this->objectClass)
            ->find($id);

        if (null === $object) {
            throw new TransformationFailedException(sprintf(
                'Object class %s con id "%s" no existe!',
                $this->objectClass, $id
            ));
        }

        return $object;
    }
450560
public function train(string $id)
    {
        $modelResult = $this->getRequest()->request(
            'POST',
            $this->getRequestUrl(sprintf('models/%s/versions', $id))
        );

        return $this->getModelFromResult($modelResult);
    }
1101277
public function reverseTransform($value): ?array
    {
        if (null === $value) {
            return null;
        }

        if (!is_string($value)) {
            throw new TransformationFailedException('Expected a string.');
        }

        $parts = explode(':', $value);

        if (count($parts) < 3) {
            throw new TransformationFailedException('Policy string must contain at least 3 parts.');
        }

        return [
            'id' => $parts[0],
            'module' => $parts[1],
            'function' => $parts[2],
        ];
    }
963937
public function resolveId($id = null)
    {
        if ($id === null) {
            $id = $this->owner->getId();
        }
        if (isset($this->owner->htmlOptions['id'])) {
            $id = $this->owner->htmlOptions['id'];
        } else {
            $this->owner->htmlOptions['id'] = $id;
        }
        return $id;
    }
1368794
protected function normalizeId($id)
    {
        if (null !== $this->getSessionPrefix()) {
            return $this->getSessionPrefix() . self::ID_SEPARATOR . $id;
        }

        return $id;
    }
805320
public static function convertId($id)
    {
        if (strlen($id) === 17) {
            $converted = substr($id, 3) - 61197960265728;
        } else {
            $converted = '765' . ($id + 61197960265728);
        }
        return (string)$converted;
    }
296471
public static function convertKey($id)
    {
        if (is_string($id) && strlen($id) === 24 && ctype_xdigit($id)) {
            return new ObjectID($id);
        }

        return $id;
    }
1206162
public function getChild(string $id)
    {
        $menuItem = $this->menuItem->getChild($id);

        return $menuItem ? $this->generateMenuItem($menuItem) : null;
    }
1372392
public function reverseTransform($fID)
    {
        if (!is_numeric($fID) || $fID == 0) {
            return null;
        }

        $rep = $this->entityManager->getRepository('Concrete\Core\File\File');

        $f = $rep->find($fID);
        if (!is_object($f) || $f->isError()) {
            throw new TransformationFailedException('Invalid file ID.');
        }

        return $f;
    }
756848
public function findByStringOrFail(string $id): Model
    {
        $model = $this->findByString($id);
        if (empty($model)) {
            throw new ResourceNotFoundException();
        }

        return $model;
    }
737911
public function transform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!$value instanceof User) {
            throw new TransformationFailedException('Expected a ' . User::class . ' object.');
        }

        return $value->id;
    }
859080
public function reverseTransform($value)
    {
        if (null === $value || '' === $value) {
            return null;
        }

        if (!is_scalar($value)) {
            throw new TransformationFailedException('Expected a scalar.');
        }

        $entity = $this->repository->find($value);

        if (null === $entity) {
            throw new TransformationFailedException(
                sprintf('Entity %s with identifier "%s" not found.', $this->className, $value)
            );
        }

        return $entity;
    }
30113
public function transform($value)
    {
        if ($value === null || $value == '') {
            return null;
        }
        if (!($value instanceof Page)) {
            throw new TransformationFailedException('Expected an instance of a concrete5 page object.');
        }
        return intval($value->getCollectionID());
    }
917148
public function transform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!is_object($value) || is_callable($value)) {
            throw new TransformationFailedException('Expected an object.');
        }

        $className = ClassUtils::getClass($value);

        if ($className !== $this->className && !is_subclass_of($className, $this->className)) {
            throw new TransformationFailedException(sprintf('Expected entity %s.', $this->className));
        }

        $identifierValues = $this->metadata->getIdentifierValues($value);

        return reset($identifierValues);
    }
1200578
public function get($id)
    {
        if ($this->has($id) === false)
        {
            $message = 'Alias (%s) is not defined';

            $message = sprintf($message, $id);

            throw new NotFoundException($message);
        }

        return $this->objects[$id];
    }
469541
public function get($id)
    {
        if (!is_string($id)) {
            throw new ContainerException('$id must be a string');
        }

        if (!isset($this->definitions[$id])) {
            throw new NotFoundException("Unresolvable ".$id);
        }

        return $this->definitions[$id];
    }
1146757
public function convert($id)
    {
        if (null === $application = $this->repository->find((int) $id)) {
            throw new NotFoundHttpException(sprintf('Application %s not found.', $id));
        }

        return $application;
    }