Skip to content

Commit

Permalink
RepositoryForm: Use null as default in methods add() and edit()
Browse files Browse the repository at this point in the history
An empty array is now considered valid data in method
onUpdateRequest() which now allows to avoid unnecessary
data retrieval.
  • Loading branch information
Johannes Meyer committed Apr 29, 2016
1 parent 9c097c3 commit 695d2fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions application/forms/RepositoryForm.php
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 695d2fd

Please sign in to comment.