php - How to write the query in yii,using findAll() -


I have the following SQL query, how can I write in yii using findAll ()

I am not using CDbCriteria and to avoid that time.

User, category and job_profile using three tables. Enter the category at the INNER user.id = job_profile.USR_ID INNER on the INNER user from SELECT * job_profile category.id = job_profile.category_id where range_ id = 1 and experience = 2 and key_skills'% php% I have written the following questions, but I am not sure about joining:

  $ results = SearchEmployee :: Models () - & gt; FindAll (like "category_id =: Category and key_skills: skills and experience =: experience", array ('category' => gt; $ category, 'skill' = & gt; '%'. $ skill. '%', 'Experience' = & gt; $ experience);  
$ Models = JobProfile :: model () - & gt; With ('userrelationname', 'categoryrelationname') - & gt; findAll (like array ("condition" => "TC category_ID = 1 and T. experience = 2 and T. key_skillik '% php%'"));

You can find the names of relationships in your JobProfile model

Example for relationships

Your JobProfile model file will have source code such as < p>

  public function relation () {return array ('user' => array (auto :: BELONGS_TO, 'user', 'id'),)}   

The name of the connector is ...

In your controller example

  foreach ($ m $$ model) {echo $ m ['user' Id']; // Revert to your job_profile table $ m-> user- & gt; Id; // in your user table)    

Comments

Post a Comment

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -