Add more controls.

This commit is contained in:
David Molineus committed 2015-01-05 14:58:37 +01:00
1 parent be9060795d
commit c00d08c872
8 files changed
+173 -5

No files matched your search

@@ -43,6 +43,11 @@ class DefinitionMapper
*/
private $mapId;
/**
* @var array
*/
private $mapped = array();
/**
* Construct.
*
@@ -88,6 +93,12 @@ class DefinitionMapper
*/
public function handle(\Model $model, $elementId = null)
{
$hash = $model->getTable() . '.' . $model->{$model->getPk()};
if (isset($this->mapped[$hash])) {
return $this->mapped[$hash];
}
krsort($this->builders);
$this->mapId = $elementId ?: ($model->alias ?: ('map_' . $model->id));
@@ -100,6 +111,8 @@ class DefinitionMapper
$event = new BuildDefinitionEvent($definition, $model);
$this->eventDispatcher->dispatch($event::NAME, $event);
$this->mapped[$hash] = $definition;
return $definition;
}
}