Skip to content

Latest commit

 

History

History
48 lines (38 loc) · 1.1 KB

File metadata and controls

48 lines (38 loc) · 1.1 KB

QueryObject

only use QueryObject in Repository

$obj = \SugarLoad::QueryObj();

Service Methods

QueryObject::q([string],[...])

  • [string] foramt : [QueryClass.functionName] , eg: Post.getLastPost
  • [...] QueryClass function param
  • chain function return QueryObject
//sample
         $obj = \SugarLoad::QueryObj();

         $obj->q('Post.join_comments')
            ->q('Post.getLastPost');

QueryObject::getArray()

  • return cakephp query array
//sample
        $obj = \SugarLoad::QueryObj();

         $obj->q('Post.join_comments')
            ->q('Post.getLastPost');
         $res = $this->m->find('all',$obj->getArray());

QueryObject::get($model,$type)

//sample
         $post = \SugarLoad::Model('Post');
         $res = \SugarLoad::QueryObj()
                  ->get($post);
                  
        $res = \SugarLoad::QueryObj()
         ->get($post,'first');