Add parent to mapper handle method.

This commit is contained in:
David Molineus
2015-01-20 16:38:23 +01:00
parent 2496994759
commit 762e6b5dbc
19 changed files with 77 additions and 42 deletions

View File

@@ -77,15 +77,16 @@ class DefinitionMapper
/**
* Build a model.
*
* @param mixed $model The definition model.
* @param LatLngBounds $bounds Optional bounds where elements should be in.
* @param string $elementId Optional element id. If none given the mapId or alias is used.
* @param mixed $model The definition model.
* @param LatLngBounds $bounds Optional bounds where elements should be in.
* @param string $elementId Optional element id. If none given the mapId or alias is used.
* @param Definition|null $parent Optional pass the parent object.
*
* @return Definition|null
*
* @throws \RuntimeException If model could not be mapped to a definition.
*/
public function handle($model, LatLngBounds $bounds = null, $elementId = null)
public function handle($model, LatLngBounds $bounds = null, $elementId = null, $parent = null)
{
$hash = $this->getHash($model, $elementId);
@@ -96,7 +97,7 @@ class DefinitionMapper
foreach ($this->builders as $builders) {
foreach ($builders as $builder) {
if ($builder->match($model)) {
$definition = $builder->handle($model, $this, $bounds, $elementId);
$definition = $builder->handle($model, $this, $bounds, $elementId, $parent);
if ($definition) {
$event = new BuildDefinitionEvent($definition, $model, $bounds);