Skip to content

Commit 33413fd

Browse files
author
dzsubek
committed
default value when attribute doesn't exist
1 parent 61ed6dd commit 33413fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/SlapOM/Entity.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function isNew()
5353
}
5454

5555

56-
public function get($name, $default = null)
56+
public function get($name, $default = '')
5757
{
5858
if (!$this->has($name))
5959
{
@@ -137,7 +137,7 @@ public function remove($field, $key)
137137
*/
138138
public function __call($method, $arguments)
139139
{
140-
list($operation, $attribute) = preg_split('/(?=[A-Z])/', $method, 2);
140+
list($operation, $attribute) = preg_split('/(?=[A-Z])/', $method, 2);
141141
$attribute = strtolower($attribute[0]).substr($attribute, 1);
142142

143143
switch($operation)
@@ -148,7 +148,7 @@ public function __call($method, $arguments)
148148
case 'get':
149149
return isset($arguments[0]) ? $this->get($attribute, $arguments[0]) : $this->get($attribute);
150150
case 'has':
151-
return $this->has($attribute);
151+
return true;
152152
case 'clear':
153153
$this->clear($attribute);
154154
break;

0 commit comments

Comments
 (0)