/** * {@inheritdoc} * * @throws \RuntimeException When the MetaModel could not be retrieved. */ public function createCollection($settingId) { // TODO: we should provide a collector like for attributes. $information = $this->serviceContainer->getDatabase()->prepare('SELECT * FROM tl_metamodel_filter WHERE id=?')->execute($settingId)->row(); if (!empty($information)) { $modelFactory = $this->serviceContainer->getFactory(); $metaModel = $modelFactory->getMetaModel($modelFactory->translateIdToMetaModelName($information['pid'])); $collection = new Collection($information); if ($metaModel === null) { throw new \RuntimeException('Could not retrieve MetaModel ' . $information['pid']); } $collection->setMetaModel($metaModel); $this->collectRules($collection); return $collection; } return new Collection(array()); }