This repository was archived by the owner on Jul 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
This repository was archived by the owner on Jul 11, 2024. It is now read-only.
PHP Fatal error #44
Copy link
Copy link
Open
Description
Code:
class DBTest extends \morph\Object
{
public function __construct($id = null)
{
parent::__construct($id);
$this
->addProperty(new \morph\property\Enum('Type', array('Test1','Test2'), ''))
->addProperty(new \morph\property\Integer('TestID'))
;
}
}
class DBObject extends \morph\Object
{
public function __construct($id = null)
{
parent::__construct($id);
$this->collection('Objects');
$this
->addProperty(new \morph\property\Date('Date'))
->addProperty(new \morph\property\ComposeOne('Test', 'DBTest'))
;
}
}
$Test = new DBTest();
$Test->Type = 'Test1';
$Test->TestID = 123;
$Obj = new DBObject();
$Obj->Date = time();
$Obj->Test = $Test;
$Obj->save();
$Temp = $Obj->__toArray(99);PHP Fatal error: Call to undefined method DBTest::getName() in phar://morph.phar/Object.php on line 233
Error is in __toArray function.
If we will update code (add public function getName()):
class DBTest extends \morph\Object
{
public function getName(){
return 'Test';
}
public function __construct($id = null)
{
parent::__construct($id);
$this
->addProperty(new \morph\property\Enum('Type', array('Test1','Test2'), ''))
->addProperty(new \morph\property\Integer('TestID'))
;
}
}Work fine!
Metadata
Metadata
Assignees
Labels
No labels