public function translateIdToMetaModelName($metaModelId)
{
if (!isset($this->lookupMap[$metaModelId])) {
$event = new GetMetaModelNameFromIdEvent($metaModelId);
$this->getEventDispatcher()->dispatch($event::NAME, $event);
$this->lookupMap[$metaModelId] = $event->getMetaModelName();
}
return $this->lookupMap[$metaModelId];
}
/** * Get all attribute ids of a metamodel. * * @param \DataContainer $dataContainer The data container driver. * * @return array */ public function getAttributes($dataContainer) { $options = array(); if ($dataContainer->activeRecord) { $layer = LayerModel::findByPk($dataContainer->activeRecord->pid); if (!$layer) { return $options; } $name = $this->metaModelsFactory->translateIdToMetaModelName($layer->metamodel); $metaModel = $this->metaModelsFactory->getMetaModel($name); if ($metaModel) { foreach ($metaModel->getAttributes() as $attribute) { $options[$attribute->get('id')] = $attribute->getName(); } } } return $options; }