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:
parent
9c097c3957
commit
695d2fdaf6
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue