E
E
EVOSandru62015-08-13 07:33:07
css
EVOSandru6, 2015-08-13 07:33:07

How to properly organize BELONGS_TO connection in yii?

Good afternoon, There is such a structure of the Mysql
database : Application ---------- m_bids ---------- id Points ---------- mc_points ------ -- id bid_id In the Bids model, I set the link: But when I try to take the data out of the link:





'points'=>[self::BELONGS_TO, 'Points', 'bid_id'],

$model = Bids::model()->findByPk(23);

        foreach($model->points as $item)
        {
            echo $item->name . '<hr/>';
        }

That I catch such error:
Property "Bids.bid_id" is not defined.
What did I do wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Proskurin, 2019-02-03
@rtomonova

Your
div selector .lemon
means to find a .lemon that is inside the div, and you have it inside the body.
Perhaps you wanted to find a div with the lemon class? Then there should be no space between div and .lemon.

P
pantsarny, 2015-08-13
@EVOSandru6

'points' => [self::HAS_MANY, 'Points', 'bids_id'] is in Bids
'bid' => [self::BELONGS_TO, 'Bids', 'bids_id'] is in Points

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question