You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
public function getCompany()
{
return $this->hasOne(Company:: className (), ['id' = > 'company_id']);
}
if the parent class has properties primarykey (in your example on the main page Project ) the same as the relation class (in your example on the main page Company ) then your behavior will work.
But if in Project establish primaryKey as project_id the will error
Unable to link models: the primary key of ...
because relation class not save
as for me it is more correct to write the following code
You have an error from 384 to 386 lines.
What's the point? With such a relations
if the parent class has properties primarykey (in your example on the main page Project ) the same as the relation class (in your example on the main page Company ) then your behavior will work.
But if in Project establish primaryKey as project_id the will error
because relation class not save
as for me it is more correct to write the following code
почему так для relation
$this->hasOne(Company::className(), ['id' => 'company_id']);
The text was updated successfully, but these errors were encountered: