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


PHP TableGateway\TableGateway類代碼示例

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


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

示例1: saveCommandeProduit

 public function saveCommandeProduit($id, $ajouterCommande, $prixproduit)
 {
     $data = array('COMMANDE_ID' => $id, 'PRODUIT_ID' => $ajouterCommande, 'COMMANDEPRODUIT_PRIX' => $prixproduit);
     $adapter = $this->tableGateway->getAdapter();
     $otherTable = new TableGateway('commandeproduit', $adapter);
     $otherTable->insert($data);
 }
開發者ID:JohannesGirard,項目名稱:WebCashRegister-zf2,代碼行數:7,代碼來源:CommandeproduitTable.php

示例2: save

 /**
  * Save Role
  *
  * @return integer
  */
 public function save()
 {
     $this->events()->trigger(__CLASS__, 'before.save', $this);
     $arraySave = array('name' => $this->getName(), 'description' => $this->getDescription());
     try {
         $roleId = $this->getId();
         if (empty($roleId)) {
             $this->insert($arraySave);
             $this->setId($this->getLastInsertId());
         } else {
             $this->update($arraySave, array('id' => $this->getId()));
         }
         $permissions = $this->getPermissions();
         if (!empty($permissions)) {
             $aclTable = new TableGateway('user_acl', $this->getAdapter());
             $aclTable->delete(array('user_acl_role_id' => $this->getId()));
             foreach ($permissions as $permissionId => $value) {
                 if (!empty($value)) {
                     $aclTable->insert(array('user_acl_role_id' => $this->getId(), 'user_acl_permission_id' => $permissionId));
                 }
             }
         }
         $this->events()->trigger(__CLASS__, 'after.save', $this);
         return $this->getId();
     } catch (\Exception $e) {
         $this->events()->trigger(__CLASS__, 'after.save.failed', $this);
         throw new \Gc\Exception($e->getMessage(), $e->getCode(), $e);
     }
 }
開發者ID:gotcms,項目名稱:gotcms,代碼行數:34,代碼來源:Model.php

示例3: fetchAll

 /**
  * @param bool $paginated
  * @param string $filter
  * @param string $orderBy
  * @param string $order
  * @return \Zend\Db\ResultSet\ResultSet|\Zend\Paginator\Paginator
  * @throws \Exception
  */
 public function fetchAll($paginated = false, $filter = '', $orderBy = 'attendanceDate', $order = 'DESC')
 {
     if ($paginated) {
         return $this->paginate($filter, $orderBy, $order, $this->boardView);
     }
     $attendanceBoard = new TableGateway($this->boardView, $this->adapter);
     return $attendanceBoard->select();
 }
開發者ID:khinmyatkyi,項目名稱:Office_Management,代碼行數:16,代碼來源:AttendanceDataAccess.php

示例4: fetchAll

 /**
  * @param bool $paginated
  * @param string $filter
  * @param string $orderBy
  * @param string $order
  * @return \Zend\Db\ResultSet\ResultSet
  * @throws \Exception
  */
 public function fetchAll($paginated = false, $filter = '', $orderBy = 'contractBy', $order = 'ASC')
 {
     if ($paginated) {
         $this->paginate($filter, $orderBy, $order);
     }
     $contractView = new TableGateway($this->table, $this->adapter);
     return $contractView->select(array('contract' => $this->staffId));
 }
開發者ID:khinmyatkyi,項目名稱:Office_Management,代碼行數:16,代碼來源:ContractDataAccess.php

示例5: fetchAll

 /**
  * @param bool $paginated
  * @param string $filter
  * @param string $orderBy
  * @param string $order
  * @return \Zend\Db\ResultSet\ResultSet|Paginator
  * @throws \Exception
  */
 public function fetchAll($paginated = false, $filter = '', $orderBy = 'name', $order = 'ASC')
 {
     $view = 'vw_hr_position';
     if ($paginated) {
         return $this->paginate($filter, $orderBy, $order, $view);
     }
     $tableGateway = new TableGateway($view, $this->adapter);
     return $tableGateway->select();
 }
開發者ID:khinmyatkyi,項目名稱:Office_Management,代碼行數:17,代碼來源:PositionDataAccess.php

示例6: fetchAll

 /**
  * @param bool $paginated
  * @param string $filter
  * @param string $orderBy
  * @param string $order
  * @return \Zend\Db\ResultSet\ResultSet|\Zend\Paginator\Paginator
  * @throws \Exception
  */
 public function fetchAll($paginated = false, $filter = '', $orderBy = 'proposalDate', $order = 'ASC')
 {
     $view = 'vw_cr_proposal';
     if ($paginated) {
         return $this->paginate($filter, $orderBy, $order, $view);
     }
     $proposalView = new TableGateway($view, $this->adapter);
     return $proposalView->select(array('proposalBy' => $this->staffId));
 }
開發者ID:khinmyatkyi,項目名稱:Office_Management,代碼行數:17,代碼來源:ProposalDataAccess.php

示例7: fetchAll

 /**
  * @param bool $paginated
  * @param string $filter
  * @param string $orderBy
  * @param string $order
  * @return \Zend\Db\ResultSet\ResultSet|\Zend\Paginator\Paginator
  * @throws \Exception
  */
 public function fetchAll($paginated = false, $filter = '', $orderBy = 'contactName', $order = 'ASC')
 {
     $view = 'vw_cr_contact';
     if ($paginated) {
         return $this->paginate($filter, $orderBy, $order, $view);
     }
     $contactView = new TableGateway($view, $this->adapter);
     return $contactView->select();
 }
開發者ID:khinmyatkyi,項目名稱:Office_Management,代碼行數:17,代碼來源:ContactDataAccess.php

示例8: __construct

 /**
  * Constructs instance.
  *
  * @param TableGateway                $tableGateway
  * @param Where|\Closure|string|array $where
  * @param null                        $order
  */
 public function __construct(TableGateway $tableGateway, $where = null, $order = null)
 {
     $select = $tableGateway->getSql()->select();
     if ($where) {
         $select->where($where);
     }
     if ($order) {
         $select->order($order);
     }
     $dbAdapter = $tableGateway->getAdapter();
     $resultSetPrototype = $tableGateway->getResultSetPrototype();
     parent::__construct($select, $dbAdapter, $resultSetPrototype);
 }
開發者ID:idwsdta,項目名稱:INIT-frame,代碼行數:20,代碼來源:DbTableGateway.php

示例9: testGetRolesWithInheritance

 /**
  * @covers \BjyAuthorize\Provider\Role\ZendDb::getRoles
  */
 public function testGetRolesWithInheritance()
 {
     $this->tableGateway->expects($this->any())->method('selectWith')->will($this->returnValue(array(array('id' => 1, 'role_id' => 'guest', 'is_default' => 1, 'parent_id' => null), array('id' => 2, 'role_id' => 'user', 'is_default' => 0, 'parent_id' => 1))));
     $this->serviceLocator->expects($this->any())->method('get')->will($this->returnValue($this->tableGateway));
     $provider = new ZendDb(array(), $this->serviceLocator);
     $this->assertEquals($provider->getRoles(), array(new Role('guest'), new Role('user', 'guest')));
 }
開發者ID:pbrilius,項目名稱:BjyAuthorize,代碼行數:10,代碼來源:ZendDbTest.php

示例10: 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

示例11: deleteCategory

 public function deleteCategory($id)
 {
     try {
         return $this->tableGateway->delete(array('id_category' => $id));
     } catch (InvalidQueryException $e) {
         return 0;
     }
 }
開發者ID:Lebe1ge,項目名稱:JobeetForZF2,代碼行數:8,代碼來源:CategoryTable.php

示例12: _initObject

 /**
  * This method init $this->object
  */
 protected function _initObject($data = null)
 {
     if (is_null($data)) {
         $data = $this->_itemsArrayDelault;
     }
     $this->_prepareTable($data);
     $this->dbTable->insert($data);
 }
開發者ID:avz-cmf,項目名稱:zaboy-rest,代碼行數:11,代碼來源:DbTableMultiInsertTest.php

示例13: testSave

 public function testSave()
 {
     //Insert
     $data = new ArrayObject(['fullName' => 'Test', 'email' => 'test@test.com']);
     $this->assertEquals(1, $this->table->save($data));
     $this->assertNotNull($data['id']);
     //Update
     $data = new ArrayObject(['id' => 1, 'fullName' => 'TestUser' . rand(10, 99), 'email' => 'test@test.com']);
     $this->assertEquals(1, $this->table->save($data));
 }
開發者ID:zfegg,項目名稱:zend-db-feature,代碼行數:10,代碼來源:CommonCallFeatureTest.php

示例14: getCurrentVersion

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

示例15: 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


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