private function loadLayerAndCheck($path, array $stack)
    {
        if (in_array($path, $stack)) {
            throw new LogicException(sprintf(
                'Circular reference detected:'.PHP_EOL.'  - file: %s'.PHP_EOL.'  - load: %s then crash',
                implode(PHP_EOL.'  - load: ', $stack),
                $path
            ));
        }

        $metadata = unserialize(file_get_contents($this->getMetaFilename($path)));

        $pgVersion = $this->connection->getVersion();
        $cmpVersion = $metadata->getSupport();

        if (version_compare($pgVersion, $cmpVersion, '<')) {
            throw new LogicException(sprintf(
                'The current version of PostgreSQL is "%s" and the DAL "%s" requires a minimum version of "%s"',
                $pgVersion,
                $path,
                $cmpVersion
            ));
        }

        $stack[] = $path;

        $this->graphNodes[$path] = $graphNode = new GraphNode();

        $mapper = new HierarchicalMapper($graphNode);
        $mapper->setType('#', new FragmentConverter());

        $blueprint = new HierarchicalBlueprint($graphNode, $this->connection, $mapper, $this->executionStrategies, $this->environment);

        foreach ($metadata->getImports() as $import => $map) {
            $this->doLoad($import, $stack);

            $graphNode->import($this->graphNodes[$import], $map);
        }

        return $this->loadLayer($this->getFilename($path), $mapper, $blueprint);
    }