Creates an alias.

@param string $id
@param string $referencedId

@return AliasConfigurator
424932
final public function alias($id, $referencedId)
    {
        $ref = static::processValue($referencedId, true);
        $alias = new Alias((string) $ref, $this->defaults->isPublic());
        $this->container->setAlias($id, $alias);

        return new AliasConfigurator($this, $alias);
    }
1004722
public function addAlias(string $id, string $alias): ContainerInterface
    {
        $this->registered[] = $alias;
        return $this->container->addAlias($id, $alias);
    }
556842
public function setReferenceId($id, $relatedId) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Video not found.']);
		}

		// update
		if ($this->doSetReferenceId($model, $relatedId)) {
			$this->dispatch(VideoEvent::PRE_REFERENCE_UPDATE, $model);
			$this->dispatch(VideoEvent::PRE_SAVE, $model);
			$model->save();
			$this->dispatch(VideoEvent::POST_REFERENCE_UPDATE, $model);
			$this->dispatch(VideoEvent::POST_SAVE, $model);

			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
11099
public function setPresence($id, $presence, $sessionId)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if (!in_array($presence, User::getPresences())) {
            throw new InvalidArgumentException;
        }

        if (!$sessionId) {
            throw new InvalidArgumentException;
        }

        $params = [
            'presence' => $presence,
            'session' => $sessionId
        ];

        $this->call('users/' . $id . '/setpresence', $params, 'post');
    }
1312534
public function withAnyMetaId($id)
	{
		$filters = array();
		
		foreach (func_get_args() as $arg) {
			$arg = (array) $arg;
			
			foreach ($arg as $meta_id) {
				$filters[] = array('id' => $m->id);
			}
		}
		
		$this->filters[]['metas'] = $filters;
		
		return $this;
	}
253645
public static function create(string $referenceName, string $methodName, array $parameterConverters) : self
    {
        return new self($referenceName, $methodName, $parameterConverters);
    }
50453
public function ref($id): Reference
	{
		$ref = new $this->reference_class($this->smalldb, $this, $id);
		if ($this->debug_logger) {
			$this->debug_logger->afterReferenceCreated(null, $ref);
		}
		return $ref;
	}
1353544
public function prepareCreateInToManyRelationship(
        string $relationshipName,
        string $identity,
        string $secondaryIdBindName
    ): self {
        list ($intermediateTable, $primaryKey, $secondaryKey) =
            $this->getModelSchemas()->getBelongsToManyRelationship($this->getModelClass(), $relationshipName);

        $this
            ->insert($this->quoteSingleIdentifier($intermediateTable))
            ->values([
                $this->quoteSingleIdentifier($primaryKey)   => $this->createNamedParameter($identity),
                $this->quoteSingleIdentifier($secondaryKey) => $secondaryIdBindName,
            ]);

        return $this;
    }
479979
public static function createTaxId($id, $params = null, $opts = null)
    {
        return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts);
    }
562512
private function getServiceCall($id, Reference $reference = null)
    {
        while ($this->container->hasAlias($id)) {
            $id = (string) $this->container->getAlias($id);
        }
        $id = $this->container->normalizeId($id);

        if ('service_container' === $id) {
            return '$this';
        }

        if ($this->container->hasDefinition($id) && ($definition = $this->container->getDefinition($id)) && !$definition->isSynthetic()) {
            if (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) {
                $code = 'null';
                if (!$definition->isShared()) {
                    return $code;
                }
            } elseif ($this->isTrivialInstance($definition)) {
                $code = substr($this->addNewInstance($definition, '', '', $id), 8, -2);
                if ($definition->isShared()) {
                    $code = sprintf('$this->services[\'%s\'] = %s', $id, $code);
                }
            } elseif ($this->asFiles && $definition->isShared() && !$this->isHotPath($definition)) {
                $code = sprintf("\$this->load('%s.php')", $this->generateMethodName($id));
            } else {
                $code = sprintf('$this->%s()', $this->generateMethodName($id));
            }
        } elseif (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) {
            return 'null';
        } elseif (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
            $code = sprintf('$this->get(\'%s\', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ %d)', $id, ContainerInterface::NULL_ON_INVALID_REFERENCE);
        } else {
            $code = sprintf('$this->get(\'%s\')', $id);
        }

        // The following is PHP 5.5 syntax for what could be written as "(\$this->services['$id'] ?? $code)" on PHP>=7.0

        return "\${(\$_ = isset(\$this->services['$id']) ? \$this->services['$id'] : $code) && false ?: '_'}";
    }
186407
public function createAlias($reference, $alias = null)
    {
        //if reference is array look for array(alias=>reference);
        if (is_array($reference)) {
            foreach ($reference as $key => $class) {
                $this->createAlias($class, $key);
            }

            return true;
        }

        //store in this->alias as an associative array of class to an array of aliases;
        foreach ((!is_array($alias) ? [$alias] : $alias) as $key) {
            $this->aliases[$key] = $reference;
        }
    }
349067
public static function factory ($id)
    {
        // Which class to instantiate
        $entityClassName = get_called_class();

        // Get object cache registry
        $ObjectRegistry  = \Teon\ObjectRegistry\ObjectRegistry::getInstance();

        // If this object already in cache, use that
        if ($ObjectRegistry->exists($entityClassName, $id)) {
            return $ObjectRegistry->get($entityClassName, $id);
        }

        // If not, instantiate new, store in object registry and return it
        $Object = new $entityClassName($id);
        $ObjectRegistry->store($Object);
        return $Object;
    }
1028175
public static function createReversal($id, $params = null, $opts = null)
    {
        return self::_createNestedResource($id, static::PATH_REVERSALS, $params, $opts);
    }
106482
public static function factory($id)
    {
        $id = (string)$id;
        if (!isset(static::$permissions[$id])) {
            static::$permissions[$id] = new static($id);
        }
        return static::$permissions[$id];
    }
419869
public function parent_id(string $type, $id, bool $ignoreUnmapped = false): ParentId
    {
        return new ParentId($type, $id, $ignoreUnmapped);
    }
420105
public function resolve($id, $required = false)
    {
        $id = $this->path($id);

        try {
            if (in_array($id, $this->resolutionStack)) {
                $path = array_map(
                    function ($a) {
                        return join('.', $a);
                    },
                    $this->resolutionStack
                );

                throw new CircularReferenceException(
                    sprintf(
                        "Circular reference detected: %s -> %s",
                        implode(' -> ', $path),
                        join('.', $id)
                    )
                );
            }

            array_push($this->resolutionStack, $id);
            $ret = $this->value($this->lookup($this->values, $id, $required));
            array_pop($this->resolutionStack);
            return $ret;
        } catch (\Exception $e) {
            if ($e instanceof CircularReferenceException) {
                throw $e;
            }
            throw new \RuntimeException("While resolving value " . join(".", $id), 0, $e);
        }
    }
604621
private function make(string $id, int $invalidBehavior)
    {
        if (isset($this->loading[$id])) {
            throw new ServiceCircularReferenceException($id, array_merge(array_keys($this->loading), [$id]));
        }

        $this->loading[$id] = true;

        try {
            if (isset($this->fileMap[$id])) {
                return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $this->load($this->fileMap[$id]);
            } elseif (isset($this->methodMap[$id])) {
                return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $this->{$this->methodMap[$id]}();
            }
        } catch (\Exception $e) {
            unset($this->services[$id]);

            throw $e;
        } finally {
            unset($this->loading[$id]);
        }

        if (/* self::EXCEPTION_ON_INVALID_REFERENCE */ 1 === $invalidBehavior) {
            if (!$id) {
                throw new ServiceNotFoundException($id);
            }
            if (isset($this->syntheticIds[$id])) {
                throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service is synthetic, it needs to be set at boot time before it can be used.', $id));
            }
            if (isset($this->getRemovedIds()[$id])) {
                throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.', $id));
            }

            $alternatives = [];
            foreach ($this->getServiceIds() as $knownId) {
                if ('' === $knownId || '.' === $knownId[0]) {
                    continue;
                }
                $lev = levenshtein($id, $knownId);
                if ($lev <= \strlen($id) / 3 || false !== strpos($knownId, $id)) {
                    $alternatives[] = $knownId;
                }
            }

            throw new ServiceNotFoundException($id, null, null, $alternatives);
        }
    }