Hello everyone. Pardon my lack of understanding over PHP.
I got a class that have a hasMany relation.
class MyModel
{
public function initialize()
{
$this->hasMany('id', 'References', 'id_refs', ['alias' => 'refs']);
}
}
I also have a controller that instantiate form with data from the model.
class MyController
{
public function editAction($id)
{
$data = MyModel::findFirst();
$form = new MyForm($data);
// code in question below is put here
}
}
- Why
$form->getValue('refs')resolve tonull? - Even though
$form->getEntity()->getRefs()and$form->getEntity()->refsresolve to the right value, why calling the latter makes$form->getValue('refs')resolve to the right value?
As for my setup, I'm using PHP 7.3.0 and Phalcon 3.4.2.
Thanks.