php - Zend Framework 2 - pagination -


i have problem pagination. have method getwithpaginationby in model:

public function getwithpaginationby($object, $where, $order = null) {     $select = $this->tablegateway->getsql()->select();     $select->where($where);      if (!empty($order))     {         $select->order($order);     }      $resultsetprototype = new resultset();     $resultsetprototype->setarrayobjectprototype($object);      $paginatoradapter = new dbselect($select, $this->tablegateway->getadapter(), $resultsetprototype);     $paginator = new paginator($paginatoradapter);      return $paginator; } 

and use in controller

$allnews = $this->getposttable()->getwithpaginationby(new post(), array('status_id' => $activestatusid, 'category' => 'news')); 

next take params routing, set current page number , set item count per page. in tutorial zend documentation.

i change name news.

  foreach($allnews $news)   {                 $news->setname('test');   } 

when dump $news in controller looks ok

object(cms\post\model\post)[497] protected 'id' => string '1' (length=1) protected 'name' => string 'test' (length=4) protected 'url' => string '1' (length=1) protected 'status_id' => string '1' (length=1) protected 'category' => string 'news' (length=4) protected 'text' => string '<p>22212</p>' (length=12) protected 'files' => null protected 'date' => null protected 'inputfilter' => null  object(cms\post\model\post)[494] protected 'id' => string '3' (length=1) protected 'name' => string 'test' (length=4) protected 'url' => string '2' (length=1) protected 'status_id' => string '1' (length=1) protected 'category' => string 'news' (length=4) protected 'text' => string '<p>2</p>' (length=8) protected 'files' => null protected 'date' => null protected 'inputfilter' => null 

but when dump news in view names db, not changed.

object(cms\post\model\post)[498] protected 'id' => string '1' (length=1) protected 'name' => string '1' (length=1) protected 'url' => string '1' (length=1) protected 'status_id' => string '1' (length=1) protected 'category' => string 'news' (length=4) protected 'text' => string '<p>22212</p>' (length=12) protected 'files' => null protected 'date' => null protected 'inputfilter' => null  object(cms\post\model\post)[494] protected 'id' => string '3' (length=1) protected 'name' => string '2' (length=1) protected 'url' => string '2' (length=1) protected 'status_id' => string '1' (length=1) protected 'category' => string 'news' (length=4) protected 'text' => string '<p>2</p>' (length=8) protected 'files' => null protected 'date' => null protected 'inputfilter' => null 

how can change example names in controller?


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -