zend framework2常用操作2

1。分布处理

http://blog.csdn.net/xmlife/article/details/46486543

public function getPaginatorByuser($page = 1, $itemsPerPage = 2,$userid=3){
//         $sql = "SELECT pro.id,pro.reporturl,pro.name,pro.manager,pro.guest,pro.begintime,pro.number,pro.type,pro.brand
//        FROM project as pro left join  auth_lists as ua
//        on pro.id = ua.projectid
//        left join users on ua.userid = users.userid where users.userid=".$userid;
       $select = new Select();
       $select->from(array('pro' => 'projects'),array('id','name','manager','companyname','begintime','reporturl','samplesize','researchtype','brandname'))
       ->join(array('ua' => 'auth_lists'), 'pro.id = ua.projectid', array())
       ->join(array('us' => 'users'), 'ua.userid = us.userid', array())->where('us.userid='.$userid);
       
//         var_dump( $select);
//         die();
       $resultSetPrototype = new ResultSet();
       $resultSetPrototype->setArrayObjectPrototype(new Project());
       $adapter = new DbSelect($select, $this->tableGateway->getAdapter(), $resultSetPrototype);
       $paginator = new Paginator($adapter);
       $paginator->setCurrentPageNumber($page);
       $paginator->setItemCountPerPage($itemsPerPage);
       return $paginator;
    }

posted @ 2017-05-15 11:04  wepe  阅读(127)  评论(0编辑  收藏  举报