Hi all
I have a problem, I have two tables with model like below:
namespace Mymodel\Models;
class Deliverable extends ModelBase
{
[...]
public idTask;
public function initialize()
{
$this->useDynamicUpdate(true);
$this->hasOne('idTask', 'Mymodel\Models\Task', 'id', ['alias' => 'Task']);
}
}
And model two
namespace Mymodel\Models;
class Task extends ModelBase
{
[....]
/**
* @var integer
*/
public $idDeliverable;
public function initialize()
{
$this->hasMany('idDeliverable', 'Mymodel\Models\Deliverable', 'id', ['alias' => 'deliverable']);
}
when in controller I call it
//do something
$object = Task::findFirstById($id);
foreach ($object->deliverable as $key => $value) {
d($value)
}
It nothing, I don't know while
//
d($object->deliverable)
is object