difference between hasone() and hasmany()

Hi guys,

I just noticed, that generator created different relations, like this:





    public function getAbrechnungsweg() {

        return $this->hasOne(\common\modules\lookup\models\LAbrechnungsweg::className(), ['id' => 'id_abrechnungsweg']);

    }


    public function getEMatchingbegriffs() {

        return $this->hasMany(\common\modules\erweiterung\models\EMatchingbegriff::className(), ['id_bewerber' => 'id']);

    }



Both are 1:n cardinality. So, I ask me, why generator didn’t set hasmany()-relation for both?

As I assume hasone() should be used for 1:1 cardinality and hasmany() for 1:n cardinality

Is this a bug of mootensai-generator or do I wrong?

Has one:

If a user can be associated with just one phone number.

Has many:

An invoice can have may order details on it. One "order" but several items ordered like the grocery store trip, one receipt, many items.

Usually a 1:N relation has a hasOne relation on one end and a corresponding hasMany relation on the other end.

When Class_A has one Class_B, then Class_B should have many Class_As, for instance.

Check LAbrechnungsweg and EMatchingbegriff classes.