echo66
            (Deathdevil66)
          
          
          
              
              
          1
          
         
        
          I’m a newbie at using frameworks and i have a question.
What does “new User(‘search’);” do? I don’t understand the use of the ‘search’ argument.
	/**
	 * Manages all models.
	 */
	public function actionAdmin()
	{
		$model=new User('search');
		if(isset($_GET['User']))
			$model->attributes=$_GET['User'];
		$this->render('admin',array(
			'model'=>$model,
		));
	}
Thanks in advance.
         
        
          
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            tri
            (tri - Tommy Riboe)
          
          
          
              
              
          2
          
         
        
          
It initializes the ‘scenario’ property to ‘search’ instead of the default ‘insert’. See also:
http://www.yiiframework.com/doc/api/CActiveRecord#__construct-detail
I’m not sure about the reason, but the effect would be that all the searchable attributes can be massively assigned in the statement
$model->attributes=$_GET['User'];
/Tommy
         
        
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            echo66
            (Deathdevil66)
          
          
          
              
              
          3
          
         
        
          Thanks for the explanation but im having a hard time understanding what scenarios are.
I have read the documentation “Creating a Model” and search in google about it and i still don’t get it.
         
        
        
           
           
           
         
         
            
            
          
       
      
        
          
          
            echo66
            (Deathdevil66)
          
          
          
              
              
          4
          
         
        
          seems i jumped one line in my reading about scenarios  
so…
$model=new LoginForm;
$model->scenario='login';
if(isset($_POST['LoginForm']))
    $model->attributes=$_POST['LoginForm'];
so, to define a scenario is just like that? Seems easy.  
Sorry again for the dumb questions…i’m new to the framework field (ANY FRAMEWORK   )
 )