fix orm entity
This commit is contained in:
@@ -1006,7 +1006,7 @@ class BaseEntity implements Entity
|
||||
*/
|
||||
protected function cloneArray(?array $value) : ?array
|
||||
{
|
||||
if (!$value) {
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1050,7 +1050,7 @@ class BaseEntity implements Entity
|
||||
*/
|
||||
protected function cloneObject(?StdClass $value) : ?StdClass
|
||||
{
|
||||
if (!$value) {
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -271,6 +271,24 @@ class EntityTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
}
|
||||
|
||||
public function testEmptyArray() : void
|
||||
{
|
||||
$job = $this->createEntity('Job', Job::class);
|
||||
|
||||
$job->set('array', []);
|
||||
|
||||
$this->assertEquals([], $job->get('array'));
|
||||
}
|
||||
|
||||
public function testEmptyObject() : void
|
||||
{
|
||||
$job = $this->createEntity('Job', Job::class);
|
||||
|
||||
$job->set('object', (object) []);
|
||||
|
||||
$this->assertEquals((object) [], $job->get('object'));
|
||||
}
|
||||
|
||||
public function testCloningArray() : void
|
||||
{
|
||||
$original = [
|
||||
|
||||
Reference in New Issue
Block a user