Hi , I am showing data in a detalview of two tables that I have related, I used the crud’s gii manager and I created the model of the two tables, when I try to access the user properties by means of the relation , that is to say
public function getUsuario()
{
return $this->hasOne(Usuario::className(), ['id' => 'usuario_id']);
}
for this case $model->usuario->nombre
Everything is fine, I can even access all the other attributes of that table without problems, with the id that was related. But when I use another table, such as this one
public function getPlanNegocios()
{
return $this->hasMany(PlanNegocio::className(), ['negocio_id' => 'id']);
}
I get the error when I try to access its attributes
$model->planNegocios->fechainicio
I have respected the camelcase notation but I do not know what the error may be, maybe some relationship problem?