當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TableGateway::select方法代碼示例

本文整理匯總了PHP中Zend\Db\TableGateway\TableGateway::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP TableGateway::select方法的具體用法?PHP TableGateway::select怎麽用?PHP TableGateway::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Db\TableGateway\TableGateway的用法示例。


在下文中一共展示了TableGateway::select方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getWarstatus

 /**
  * Retrieves an Account with the warstatus
  * @param int $account_id
  * @return null|Warstatus
  */
 public function getWarstatus(int $id)
 {
     $rowset = $this->tableGateway->select(function (Select $select) use($id) {
         $select->where(['id' => $id]);
     });
     $row = $rowset->current();
     return $row;
 }
開發者ID:snowiow,項目名稱:eternaldeztiny,代碼行數:13,代碼來源:WarstatusTable.php

示例2: getComment

 /**
  * Returns a comment by id.
  *
  * @param  int                      $id
  * @return \RbComment\Model\Comment
  */
 public function getComment($id)
 {
     $id = (int) $id;
     $rowset = $this->tableGateway->select(array('id' => $id));
     $row = $rowset->current();
     return $row;
 }
開發者ID:robertboloc,項目名稱:rbcomment,代碼行數:13,代碼來源:CommentTable.php

示例3: getApplicationCountLast30Days

 public function getApplicationCountLast30Days()
 {
     $dateNow = new \DateTime();
     $dateBehind = (new \DateTime())->sub(new \DateInterval('P30D'));
     return $this->tableGateway->select(function (Select $select) use($dateNow, $dateBehind) {
         $select->where->between('date_applied', $dateBehind->format('Y-m-d H:i:s'), $dateNow->format('Y-m-d H:i:s'));
     })->count();
 }
開發者ID:snowiow,項目名稱:eternaldeztiny,代碼行數:8,代碼來源:ApplicationTable.php

示例4: getByUserId

 /**
  * @param int    $id
  * @param int $limit
  * @param int $offset
  *
  * @return \Zend\Db\ResultSet\ResultSet
  */
 public function getByUserId($id, $limit = 10, $offset = 0)
 {
     $id = (int) $id;
     $rows = $this->tableGateway->select(function (Select $select) use($id, $limit, $offset) {
         $select->where(array('user_id' => $id))->limit($limit)->offset(0)->order('news_id DESC');
     });
     return $rows;
 }
開發者ID:zekiunal,項目名稱:zend-framework-blog-sample,代碼行數:15,代碼來源:NewsTable.php

示例5: getCityById

 /**
  * @param $id
  * @return City|null
  */
 public function getCityById($id)
 {
     $city = $this->cityTable->select(['ID' => $id]);
     if ($city->count() < 1) {
         return null;
     }
     return $city->current();
 }
開發者ID:GeeH,項目名稱:bad-puppy,代碼行數:12,代碼來源:DataService.php

示例6: getByToken

 /**
  * @param $token
  *
  * @return User
  * @throws \Exception
  */
 public function getByToken($token)
 {
     $rows = $this->tableGateway->select(array('token' => $token));
     $row = $rows->current();
     if (!$row) {
         throw new \Exception("Could not find row " . $token);
     }
     return $row;
 }
開發者ID:zekiunal,項目名稱:zend-framework-blog-sample,代碼行數:15,代碼來源:UserTable.php

示例7: getWarlog

 /**
  *
  * @param string|int $id
  *
  * @return array|\ArrayObject|null the account with the given id
  */
 public function getWarlog()
 {
     $rowset = $this->tableGateway->select([1]);
     $row = $rowset->current();
     if (!$row) {
         return null;
     }
     return $row;
 }
開發者ID:snowiow,項目名稱:eternaldeztiny,代碼行數:15,代碼來源:WarlogTable.php

示例8: getNewsCategoryBy

 /**
  * Returns the data requested by the array. Key of array must be column name of Account table and $value the actual value
  * @param array $array with one [key => value] pair
  *
  * @return array|\ArrayObject|null|Account the account with the given email
  */
 public function getNewsCategoryBy($array)
 {
     $rowset = $this->tableGateway->select($array);
     $row = $rowset->current();
     if (!$row) {
         return null;
     }
     return $row;
 }
開發者ID:snowiow,項目名稱:eternaldeztiny,代碼行數:15,代碼來源:NewsCategoryTable.php

示例9: getCategoryById

 public function getCategoryById($id)
 {
     $rowset = $this->tableGateway->select(array('id_category' => $id));
     $row = $rowset->current();
     if (!$row) {
         throw new \Exception("Could not find row with id {$id}");
     }
     return $row;
 }
開發者ID:Lebe1ge,項目名稱:JobeetForZF2,代碼行數:9,代碼來源:CategoryTable.php

示例10: fetch

 /**
  * @param Request $request
  * @param Response $response
  * @param $args
  *
  * @return ResponseInterface
  */
 public function fetch(Request $request, Response $response, $args)
 {
     try {
         $result = $this->gateway->select(['id' => 1])->current();
         return $response->withJson($result->getArrayCopy(), 200);
     } catch (\Exception $e) {
         return $response->withStatus(400);
     }
 }
開發者ID:geggleto,項目名稱:slimgateway,代碼行數:16,代碼來源:EntityController.php

示例11: getCurrentVersion

 public function getCurrentVersion()
 {
     $result = $this->tableGateway->select(function (Select $select) {
         $select->order('version DESC')->limit(1);
     });
     if (!$result->count()) {
         return 0;
     }
     return $result->current()->getVersion();
 }
開發者ID:dpoltoratsky,項目名稱:ZfSimpleMigrations,代碼行數:10,代碼來源:MigrationVersionTable.php

示例12: getForm

 public function getForm($id)
 {
     $id = (int) $id;
     $rowset = $this->tableGateway->select(array('id' => $id));
     $row = $rowset->current();
     if (!$row) {
         throw new \Exception("Could not find row {$id}");
     }
     return $row;
 }
開發者ID:elmosgot,項目名稱:cool-builder,代碼行數:10,代碼來源:FormTable.php

示例13: findAll

 /**
  * 
  * @return Contact[]
  */
 public function findAll()
 {
     $rowset = $this->gateway->select();
     $results = [];
     foreach ($rowset as $row) {
         $contact = new Contact();
         $this->hydrator->hydrate((array) $row, $contact);
         $results[] = $contact;
     }
     return $results;
 }
開發者ID:bioub,項目名稱:Formation_ZF1_Viveris_2016_02,代碼行數:15,代碼來源:ContactMapper.php

示例14: read

 /**
  * {@inheritdoc}
  *
  * {@inheritdoc}
  */
 public function read($id)
 {
     $this->checkIdentifierType($id);
     $identifier = $this->getIdentifier();
     $rowset = $this->dbTable->select(array($identifier => $id));
     $row = $rowset->current();
     if (isset($row)) {
         return $row->getArrayCopy();
     } else {
         return null;
     }
 }
開發者ID:avz-cmf,項目名稱:zaboy-res,代碼行數:17,代碼來源:DbTable.php

示例15: dbMultiAction

 /**
  * @return \Zend\View\Model\JsonModel
  */
 public function dbMultiAction()
 {
     /* @var $request \Zend\Http\Request */
     $request = $this->getRequest();
     $queries = $request->getQuery('queries', 1);
     $worlds = array();
     for ($i = 0; $i < $queries; $i += 1) {
         foreach ($this->tableGateway->select(array('id' => mt_rand(1, 10000))) as $found) {
             $worlds[] = $found;
         }
     }
     return new JsonModel($worlds);
 }
開發者ID:davidpersson,項目名稱:FrameworkBenchmarks,代碼行數:16,代碼來源:DbController.php


注:本文中的Zend\Db\TableGateway\TableGateway::select方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。