shivam4u  
          
              
                June 1, 2020,  7:50am
               
              1 
           
         
        
          Dear All,
Its fun to use Yii . I would like to project a minor change.
We know model::find()  return ActiveQuery object.  So why this function name is find(). I think it can be safely renamed in future version as model::query().
Thats can also be adapted for Yii3.0
Thanks
         
        
           
         
            
       
      
        
          
          
            samdark  
          
              
                June 1, 2020,  9:26am
               
              2 
           
         
        
          That was done so querying was like writing English sentences (a bit reversed but still):
$posts = Post::find()->where(['author_id' => 10])->all();
// post *find* where author_id is 10 *all*
Query would work as well. @vanhelvzla  what do you think?
         
        
           1 Like 
         
         
            
       
      
        
        
          We have also findOne, findAll, findBySql methods. Maybe findXXX is more expressive than queryXXX
         
        
           2 Likes 
         
         
            
       
      
        
          
          
            shivam4u  
          
              
                June 1, 2020, 10:38am
               
              4 
           
         
        
          Well, Idea was just for find() function not finalAll().  find() return ActiveQuery object . And finalAll() it return data array which is OK.
         
        
           
         
            
       
      
        
          
          
            shivam4u  
          
              
                June 1, 2020, 10:41am
               
              5 
           
         
        
          @samdark ,  I like find() too but  query() would give hint that its returning ActiveQuery object  and not data.
Its just minor improvement.  We can have both find() and query() .
         
        
           
         
            
       
      
        
          
          
            samdark  
          
              
                June 2, 2020, 10:24am
               
              6 
           
         
        
          @fabriziocaldarelli  has a point. Overall it is more consistent with find():
$posts = Post::find()->where(['author_id' => 10])->all();
$posts = Post::findAll(['author_id' => 10]);
vs
$posts = Post::query()->where(['author_id' => 10])->all();
$posts = Post::findAll(['author_id' => 10]);
 
        
           1 Like 
         
         
            
       
      
        
          
          
            vanhelvzla  
          
              
                June 2, 2020,  5:18pm
               
              7 
           
         
        
          Totally agree with @fabriziocaldarelli , i don’t think we should change the yii2 syntax if it is not necessary, it will be easier to migrate.