From 695d2fdaf6819c5ba9e139f930ec564b35d999eb Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 29 Apr 2016 09:32:20 +0200 Subject: [PATCH] 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. --- application/forms/RepositoryForm.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/forms/RepositoryForm.php b/application/forms/RepositoryForm.php index 8626560f6d..1485d98b2f 100644 --- a/application/forms/RepositoryForm.php +++ b/application/forms/RepositoryForm.php @@ -149,7 +149,7 @@ public function shouldDelete() * * @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 @@ public function add(array $data = array()) * * @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 @@ protected function onInsertRequest() protected function onUpdateRequest() { $data = $this->getData(); - if (empty($data)) { + if ($data === null) { $row = $this->repository ->select() ->from($this->getBaseTable())