E
E
EVOSandru62015-01-02 03:32:35
Yii
EVOSandru6, 2015-01-02 03:32:35

How to write several with in searh criteria of a model in Yii?

Good afternoon,
The main model has 3 connections. Is it correct to write
in the context of the search() method like this:

$criteria->with	= ['manager']; 	
$criteria->with	= ['customer']; 
$criteria->with	= ['hotel'];

Or in this context, they interrupt each other?
This is how I caught the error:
$criteria->with = ['customer', 'manager', 'hotel'];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Kolokolnikov, 2015-01-02
@EVOSandru6

In the first case, you are overwriting the property, so only the last value remains. What is the error in the second case? This is the correct code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question