@param string $instance
@param string $node

@return ConnectionInterface
13530
private static function getConnection(string $instance, string $node, $ts = 'query'): ConnectionInterface
    {
        $transactionConnection = self::getTransactionConnection($instance);
        if ($transactionConnection !== null) {
            return $transactionConnection;
        }

        $pool = DbHelper::getPool($instance, $node);

        return $pool->getConnection();
    }
1263290
public function setInstance($instance)
    {
        $this->instance = $instance;
        $this->setClassName(get_class($this->instance));

        return $this;
    }
46268
public function setInstance(Instance $instance)
    {
        $this->instance = $instance;
        $this->exception = null;
        $this->connect();
        
        return $this;
    }
1300683
protected function getClassNodeTransfer(ClassNode $node): ClassNodeTransfer
    {
        $className = $node->getName();
        $classNamespace = $node->getNamespaceName();
        $classFilePath = $node->getFileName();
        $classModuleName = $this->getFacade()->getModuleName($node);

        $pathTransfer = $this->getFacade()->getPath($classFilePath);
        $reflectionNodeClass = $this->getFacade()->getReflectionClassByNode($node);

        $classNodeTransfer = new ClassNodeTransfer();

        $classNodeTransfer->setClassName($className);
        $classNodeTransfer->setClassNamespace($classNamespace);
        $classNodeTransfer->setClassFilePath($classFilePath);
        $classNodeTransfer->setClassModuleName($classModuleName);
        $classNodeTransfer->setNode($node);
        $classNodeTransfer->setReflectionClass($reflectionNodeClass);
        $classNodeTransfer->setPathTransfer($pathTransfer);

        return $classNodeTransfer;
    }
161813
public function enterNode(Node $node, Environment $environment): Node
    {
        if ($node instanceof ModelNode) {
            $this->assign($node->getSourceContext(), $node->getAttribute('presentation_model'));
        }

        return $node;
    }
662429
private function instantiateComponent($instanceName) {
		if (!isset($this->declaredInstances[$instanceName])) {
			throw new MoufInstanceNotFoundException("The object instance '".$instanceName."' is not defined.", 1, $instanceName);
		}
		try {
			$instanceDefinition = $this->declaredInstances[$instanceName];
	
			if (isset($instanceDefinition['code'])) {
				if (isset($instanceDefinition['error'])) {
					throw new MoufException("The code defining instance '$instanceName' is invalid: ".$instanceDefinition['error']);
				}
				$closures = $this->getClosures();
				$closure = $closures[$instanceName];
				$instance = $closure($this->delegateLookupContainer);
				$this->objectInstances[$instanceName] = $instance;
				return $instance;
			}
			
			$className = $instanceDefinition["class"];
	
			if (isset($instanceDefinition['constructor'])) {
				$constructorParametersArray = $instanceDefinition['constructor'];
				
				$classDescriptor = new \ReflectionClass($className);
				
				$constructorParameters = array();
				foreach ($constructorParametersArray as $key=>$constructorParameterDefinition) {
					$value = $constructorParameterDefinition["value"];
					switch ($constructorParameterDefinition['parametertype']) {
						case "primitive":
							switch ($constructorParameterDefinition["type"]) {
								case "string":
									$constructorParameters[] = $value;
									break;
								case "request":
									$constructorParameters[] = $_REQUEST[$value];
									break;
								case "session":
									$constructorParameters[] = $_SESSION[$value];
									break;
								case "config":
									$constructorParameters[] = constant($value);
									break;
								case "php":
									$closures = $this->getClosures();
									$closure = $closures[$instanceName]['constructor'][$key];
									if ($closure instanceof \Closure) {
										$constructorParameters[] = $closure($this->delegateLookupContainer);
									} else {
										throw new MoufException("Parse error in the callback of '$instanceName' constructor argument '$key': ".$closure);
									}
									break;
								default:
									throw new MoufException("Invalid type '".$constructorParameterDefinition["type"]."' for object instance '$instanceName'.");
							}
							break;
						case "object":
							if (is_array($value)) {
								$tmpArray = array();
								foreach ($value as $keyInstanceName=>$valueInstanceName) {
									if ($valueInstanceName !== null) {
										$tmpArray[$keyInstanceName] = $this->delegateLookupContainer->get($valueInstanceName);
									} else {
										$tmpArray[$keyInstanceName] = null;
									}
								}
								$constructorParameters[] = $tmpArray;
							} else {
								if ($value !== null) {
									$constructorParameters[] = $this->delegateLookupContainer->get($value);
								} else {
									$constructorParameters[] = null;
								}
							}
							break;
						default:	
							throw new MoufException("Unknown parameter type ".$constructorParameterDefinition['parametertype']." for parameter in constructor of instance '".$instanceName."'");
					}
				}
				if (!isset($this->objectInstances[$instanceName])) {
						$object = $classDescriptor->newInstanceArgs($constructorParameters);
				} else {
						$object = $this->objectInstances[$instanceName];
				}
			} else {
				$object = new $className();
			}
			$this->objectInstances[$instanceName] = $object;
			if (isset($instanceDefinition["fieldProperties"])) {
				foreach ($instanceDefinition["fieldProperties"] as $key=>$valueDef) {
					switch ($valueDef["type"]) {
						case "string":
							$object->$key = $valueDef["value"];
							break;
						case "request":
							$object->$key = $_REQUEST[$valueDef["value"]];
							break;
						case "session":
							$object->$key = $_SESSION[$valueDef["value"]];
							break;
						case "config":
							$object->$key = constant($valueDef["value"]);
							break;
						case "php":
							$closures = $this->getClosures();
							$closure = $closures[$instanceName]['fieldProperties'][$key];
							if ($closure instanceof \Closure) {
								$closure = $closure->bindTo($object);
								$object->$key = $closure($this->delegateLookupContainer);
							} else {
								throw new MoufContainerException("Parse error in the callback of '$instanceName' property '$key': ".$closure);
							}
							break;
						default:
							throw new MoufContainerException("Invalid type '".$valueDef["type"]."' for object instance '$instanceName'.");
					}
				}
			}
	
			if (isset($instanceDefinition["setterProperties"])) {
				foreach ($instanceDefinition["setterProperties"] as $key=>$valueDef) {
					//$object->$key($valueDef["value"]);
					switch ($valueDef["type"]) {
						case "string":
							$object->$key($valueDef["value"]);
							break;
						case "request":
							$object->$key($_REQUEST[$valueDef["value"]]);
							break;
						case "session":
							$object->$key($_SESSION[$valueDef["value"]]);
							break;
						case "config":
							$object->$key(constant($valueDef["value"]));
							break;
						case "php":
							$closures = $this->getClosures();
							$closure = $closures[$instanceName]['setterProperties'][$key];
							if ($closure instanceof \Closure) {
								$closure = $closure->bindTo($object);
							} else {
								throw new MoufContainerException("Parse error in the callback of '$instanceName' setter '$key': ".$closure);
							}
							$object->$key($closure($this->delegateLookupContainer));
							break;
						default:
							throw new MoufContainerException("Invalid type '".$valueDef["type"]."' for object instance '$instanceName'.");
					}
				}
			}
	
			if (isset($instanceDefinition["fieldBinds"])) {
				foreach ($instanceDefinition["fieldBinds"] as $key=>$value) {
					if (is_array($value)) {
						$tmpArray = array();
						foreach ($value as $keyInstanceName=>$valueInstanceName) {
							if ($valueInstanceName !== null) {
								$tmpArray[$keyInstanceName] = $this->get($valueInstanceName);
							} else {
								$tmpArray[$keyInstanceName] = null;
							}
						}
						$object->$key = $tmpArray;
					} else {
						$object->$key = $this->get($value);
					}
				}
			}
	
			if (isset($instanceDefinition["setterBinds"])) {
				foreach ($instanceDefinition["setterBinds"] as $key=>$value) {
					if (is_array($value)) {
						$tmpArray = array();
						foreach ($value as $keyInstanceName=>$valueInstanceName) {
							if ($valueInstanceName !== null) {
								$tmpArray[$keyInstanceName] = $this->get($valueInstanceName);
							} else {
								$tmpArray[$keyInstanceName] = null;
							}
						}
						$object->$key($tmpArray);
					} else {
						$object->$key($this->get($value));
					}
				}
			}
		} catch (MoufInstanceNotFoundException $e) {
			throw new MissingDependencyException("The object instance '".$instanceName."' could not be created because it depends on an object in error (".$e->getMissingInstanceName().")", 2, $instanceName, $e);
		}
		return $object;
	}
1165412
public function addToObjectNode(string $key, AbstractNode $node): QueryBuilderInterface
    {
        if (!$this->node instanceof ObjectNode) {
            throw new \Exception(sprintf('You cannot call %s on node type: %s', __FUNCTION__, get_class($this->node)));
        }

        $this->node->add($key, $node);
        $this->reassignParent($node);

        return $this;
    }
221303
public function instance($abstract, $instance)
    {
        $this->sharedInstances[$abstract] = $instance;

        // This will never be called, but makes resolved, bound etc. easier
        $this->storeBinding($abstract, function ($container) use ($instance) {
            return $instance;
        }, true);

        $this->callAllListeners($abstract, $instance);

        return $this;
    }
42819
protected function bindClosureToInstance($closure, $instance)
    {
        if ($closure instanceof \Closure) {
            $closure = $closure->bind($closure, $instance, get_class($instance));
        }

        return $closure;
    }
1166732
public function build(): RequestChildNodesRequest
	{
		$instance = new RequestChildNodesRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		$instance->depth = $this->depth;
		$instance->pierce = $this->pierce;
		return $instance;
	}
145047
protected function create($id, $instanceName, $content)
    {
        $this->getConnection()->table($this->getTableName())
            ->insert([
                'id' => $id,
                'instance' => $instanceName,
                'content' => $content,
            ]);
    }
695164
public function getPageWithNodeInterface(Node $node, $locale)
    {
        $nodeTranslation = $node->getNodeTranslation($locale, true);
        $nodeVersion = $nodeTranslation->getPublicNodeVersion();

        return $nodeVersion->getRef($this->em);
    }
581337
public static function Create( $context, $node )
	{
		if ( is_a( $node, __CLASS__ ) )
		{
			/**
			 * @var PathStep $res
			 */
			$res = $node;
			return $res;
		}

		if ( $node instanceof PathExprNode )
		{
			/**
			 * @var PathExprNode $pathExpr
			 */
			$pathExpr = $node;
			return $pathExpr->FirstStep;
		}

		return PathStep::fromNode( AbstractNode::Create( $context, $node ) );
	}
538996
public function enterNode(Node $node)
    {
        if ($node instanceof ConstFetch || $node instanceof FuncCall) {
            $node->name = null;
        }

        if ($node instanceof FullyQualified) {
            $this->names[] = $node->toString();
        }

        return $node;
    }
436270
public function buildNodeEntityMetadata(\SimpleXMLElement $node, $className)
    {
        $reflection = new \ReflectionClass($className);

        return new NodeEntityMetadata(
            $className,
            $reflection,
            $this->buildNodeMetadata($node, $className),
            $this->idXmlMetadataFactory->buildEntityIdMetadata($node, $className, $reflection),
            $this->propertyXmlMetadataFactory->buildPropertiesMetadata($node, $className, $reflection),
            $this->relationshipXmlMetadataFactory->buildRelationshipsMetadata($node, $className, $reflection)
        );
    }
260744
public function enterNode(Node $node)
    {
        if (!$node instanceof Instanceof_) {
            return;
        }

        if (($node->expr instanceof Scalar && !$node->expr instanceof Encapsed) || $node->expr instanceof ConstFetch) {
            throw new FatalErrorException(self::EXCEPTION_MSG, 0, E_ERROR, null, $node->getLine());
        }
    }
583187
public function instanceConnector()
    {
        $config = $this->getConfig();
        if (isset($config['database']['connector'])) {
            $connector = $config['database']['connector'];
            return new $connector();
        }
        return new MySQLConnection();
    }