A
A
Alexander2015-09-08 10:00:35
Yii
Alexander, 2015-09-08 10:00:35

Where are the rest of the relation in yii2?

Found two relationships in yii2 hasOne, hasMany.

public function getCompaniesCompany()
    {
        return $this->hasOne(Companies::className(), ['company_id' => 'companies_company_id']);
    }

    public function getDepartamens()
    {
        return $this->hasMay(Departamens::className(), ['branches_branch_id' => 'branch_id']);
    }

I want to know where BelongsTo , Many To Many , etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HaruAtari, 2015-09-08
@kentuck1213

Yii2 doesn't have them. HasOne() is used instead of belongsTo() and hasMany() is used instead of manyToMany() along with viaTable()
www.yiiframework.com/doc-2.0/guide-db-active-recor...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question