Skip to content

Commit

Permalink
Minor change to the way Admin::buildShow works so that it can correct…
Browse files Browse the repository at this point in the history
…ly detect and avoid entering a tight loop.

Info:

buildList, buildForm etc all set $this->[datagrid|list|etc] early on in
the method, meaning the return statement in the top of the methods can
correctly detect and return when the method is called again from within
itself.

buildShow was not setting $this->show  until the of the method, which left
it susceptible to entering a loop, which ultimately causes an exception
from showMapper as it tries to re-add already existing fields.
  • Loading branch information
benlumley committed Jun 3, 2012
1 parent bf26f2e commit f194c8f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,17 +610,15 @@ protected function buildShow()
return;
}

$collection = new FieldDescriptionCollection();
$mapper = new ShowMapper($this->showBuilder, $collection, $this);
$this->show = new FieldDescriptionCollection();
$mapper = new ShowMapper($this->showBuilder, $this->show, $this);

$this->configureShowField($mapper); // deprecated, use configureShowFields instead
$this->configureShowFields($mapper);

foreach ($this->getExtensions() as $extension) {
$extension->configureShowFields($mapper);
}

$this->show = $collection;
}

/**
Expand Down

0 comments on commit f194c8f

Please sign in to comment.