Skip to content

Commit

Permalink
set the handler decorator on first use
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Jan 6, 2021
1 parent 8c212be commit 3b6ff53
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ public function decorate($for): Decorator

public function getHandlerDecorator($fieldName = null): DataHandlerDecorator
{
return $this->_handlerDecorator[$fieldName] ?? $this->_defaultHandlerDecorator();
if(!isset($this->_handlerDecorator[$fieldName]))
{
$this->_handlerDecorator[$fieldName] = clone $this->_defaultHandlerDecorator();
}
return $this->_handlerDecorator[$fieldName];
}

public function setHandlerDecorator(DataHandlerDecorator $decorator, string $field = null)
Expand Down

0 comments on commit 3b6ff53

Please sign in to comment.