RepositoryForm: Use null as default in methods add() and edit()

An empty array is now considered valid data in method
onUpdateRequest() which now allows to avoid unnecessary
data retrieval.
This commit is contained in:
Johannes Meyer 2016-04-29 09:32:20 +02:00
parent 9c097c3957
commit 695d2fdaf6
1 changed files with 3 additions and 3 deletions

View File

@ -149,7 +149,7 @@ abstract class RepositoryForm extends Form
*
* @return $this
*/
public function add(array $data = array())
public function add(array $data = null)
{
$this->mode = static::MODE_INSERT;
$this->data = $data;
@ -164,7 +164,7 @@ abstract class RepositoryForm extends Form
*
* @return $this
*/
public function edit($name, array $data = array())
public function edit($name, array $data = null)
{
$this->mode = static::MODE_UPDATE;
$this->identifier = $name;
@ -239,7 +239,7 @@ abstract class RepositoryForm extends Form
protected function onUpdateRequest()
{
$data = $this->getData();
if (empty($data)) {
if ($data === null) {
$row = $this->repository
->select()
->from($this->getBaseTable())