From 167b3556b08ad94c3e98b492040ee0d463fc20c1 Mon Sep 17 00:00:00 2001 From: oscarotero Date: Thu, 20 Feb 2014 00:52:12 +0100 Subject: [PATCH] ensure rows have all fields defined on init --- SimpleCrud/Row.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimpleCrud/Row.php b/SimpleCrud/Row.php index 04f3da6..c0f875f 100644 --- a/SimpleCrud/Row.php +++ b/SimpleCrud/Row.php @@ -23,7 +23,7 @@ public function __construct (Entity $entity, array $data = null, $onlyDeclaredFi $data = array_intersect_key($data, $this->entity->getFieldsNames()); } - $this->values = ($data === null) ? $entity->getDefaults() : $data; + $this->values = ($data ?: array()) + $entity->getDefaults(); }