public function createCollection($settingId)
    {
        $query = $this->database
            ->createQueryBuilder()
            ->select('*')
            ->from('tl_metamodel_filter')
            ->where('id=:id')
            ->setMaxResults(1)
            ->setParameter('id', $settingId)
            ->execute();
        if (!$query) {
            throw new \RuntimeException('Could not retrieve filter setting');
        }

        if (!empty($information = $query->fetch(\PDO::FETCH_ASSOC))) {
            $metaModel = $this->factory->getMetaModel($this->factory->translateIdToMetaModelName($information['pid']));
            if ($metaModel === null) {
                throw new \RuntimeException('Could not retrieve MetaModel ' . $information['pid']);
            }
            $collection = new Collection($information);

            $collection->setMetaModel($metaModel);
            $this->collectRules($collection);

            return $collection;
        }

        return new Collection(array());
    }
public function createCollection($settingId)
    {
        $query = $this->database
            ->createQueryBuilder()
            ->select('*')
            ->from('tl_metamodel_filter')
            ->where('id=:id')
            ->setMaxResults(1)
            ->setParameter('id', $settingId)
            ->execute();
        if (!$query) {
            throw new \RuntimeException('Could not retrieve filter setting');
        }

        if (!empty($information = $query->fetch(\PDO::FETCH_ASSOC))) {
            $metaModel = $this->factory->getMetaModel($this->factory->translateIdToMetaModelName($information['pid']));
            if ($metaModel === null) {
                throw new \RuntimeException('Could not retrieve MetaModel ' . $information['pid']);
            }
            $collection = new Collection($information);

            $collection->setMetaModel($metaModel);
            $this->collectRules($collection);

            return $collection;
        }

        return new Collection(array());
    }
{@inheritdoc}

@throws \RuntimeException When the MetaModel could not be retrieved.