RamanSall
RamanSall

Reputation: 385

Relation In model yii

Creating relation in yii modelbut getting error:

'hotelconfirmdata' => array(self::HAS_MANY, 'HotelConfirm', 'hotel_code', array('condition'=>" hotel_type='voca_rental' AND hotel_code=ID "))

Error:Property "CHasManyRelation.0" is not defined

Need Help

Upvotes: 0

Views: 225

Answers (2)

sefburhan
sefburhan

Reputation: 63

a detailed wiki article on it with examples http://www.yiiframework.com/wiki/428/drills-search-by-a-has_many-relation-in-yii-1-1/

Upvotes: 0

topher
topher

Reputation: 14860

The relation definition is already an array so you shouldn't wrap the other parameters in an array:

'hotelconfirmdata' => array(self::HAS_MANY, 'HotelConfirm', 'hotel_code', 'condition' => " hotel_type='voca_rental' AND hotel_code=ID ")

Upvotes: 1

Related Questions