当前位置: 首页>>代码示例>>PHP>>正文


PHP TableGateway::delete方法代码示例

本文整理汇总了PHP中Zend\Db\TableGateway\TableGateway::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP TableGateway::delete方法的具体用法?PHP TableGateway::delete怎么用?PHP TableGateway::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Db\TableGateway\TableGateway的用法示例。


在下文中一共展示了TableGateway::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

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

示例2: delete

 /**
  * Delete a resource
  *
  * @param  mixed $id
  * @return ApiProblem|mixed
  */
 public function delete($id)
 {
     $result = $this->fetch($id);
     if (!$result) {
         return new ApiProblem(404, 'Registro não encontrado');
     }
     $this->tableGateway->delete(array('id' => $id));
     return true;
 }
开发者ID:siwane,项目名称:tutorial-angularjs-apigility-crud,代码行数:15,代码来源:ClienteResource.php

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

示例4: deleteanywhere

 public function deleteanywhere($mytable, $where)
 {
     $db = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $table = new TableGateway($mytable, $db);
     $table->delete($where);
     return 1;
 }
开发者ID:arvindjha304,项目名称:discoveryCRM,代码行数:7,代码来源:Index.php

示例5: testDelete

 /**
  * @covers Zend\Db\TableGateway\TableGateway::delete
  */
 public function testDelete()
 {
     $mockDelete = $this->mockSql->delete();
     // assert select::from() is called
     $mockDelete->expects($this->once())->method('where')->with($this->equalTo('foo'));
     $this->table->delete('foo');
 }
开发者ID:rikaix,项目名称:zf2,代码行数:10,代码来源:TableGatewayTest.php

示例6: delete

 /**
  * Удаляет объект
  *
  * @param mixed $id
  * @return \App\Storage\Mysql\Simple
  */
 public function delete($id)
 {
     if ($id instanceof EntityInterface) {
         $id = $id->getKeyValue();
     }
     $this->tableGateway->delete(array($this->getItemSetProto()->getFactory()->getEntityProto()->getKeyName() => $id));
     return $this;
 }
开发者ID:sedpro,项目名称:test_skyeng,代码行数:14,代码来源:Simple.php

示例7: testDelete

 /**
  * @covers Zend\Db\TableGateway\TableGateway::delete
  */
 public function testDelete()
 {
     $delete = $this->getMock('Zend\\Db\\Sql\\Delete');
     // assert select::from() is called
     $delete->expects($this->once())->method('where')->with($this->equalTo('foo'));
     $this->table->setSqlDelete($delete);
     $this->table->delete('foo');
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:11,代码来源:TableGatewayTest.php

示例8: clearLock

 /**
  * @param Lock\Handle $handle
  */
 public function clearLock(Lock\Handle $handle)
 {
     if (!isset($this->locks[$handle->getToken()])) {
         return;
     }
     $key = $this->locks[$handle->getToken()];
     $this->gateway->delete(['key' => $key]);
     unset($this->locks[$handle->getToken()]);
 }
开发者ID:beaucal,项目名称:beaucal-long-throttle,代码行数:12,代码来源:Db.php

示例9: remove

 /**
  * @param Request $request
  * @param Response $response
  * @param $args
  *
  * @return ResponseInterface
  */
 public function remove(Request $request, Response $response, $args)
 {
     try {
         $result = $this->gateway->delete($this->getIdArray($args));
         return $response->withJson(["result" => $result]);
     } catch (\Exception $e) {
         return $response->withStatus(400);
     }
 }
开发者ID:geggleto,项目名称:slimgateway,代码行数:16,代码来源:EntityController.php

示例10: deleteAccount

 /**
  * Deletes the account with the given id
  * @param int|string $id
  */
 public function deleteAccount($id)
 {
     $account = $this->getAccount($id);
     $dir = getcwd() . '/public/users/' . $account->getName();
     if (file_exists($dir)) {
         $this->rrmdir($dir);
     }
     $this->tableGateway->delete(['id' => $id]);
 }
开发者ID:snowiow,项目名称:eternaldeztiny,代码行数:13,代码来源:AccountTable.php

示例11: delete

 /**
  * delete by id of the table or array condition
  *
  * @param int/array $id        	
  */
 public function delete($id)
 {
     try {
         if (is_array($id)) {
             $effectedRows = $this->tableGateway->delete($id);
         } else {
             $effectedRows = $this->tableGateway->delete(array('id' => (int) $id));
         }
     } catch (\Exception $e) {
         return \Model\Custom\Error::trigger($e, $params);
     }
     return $effectedRows;
 }
开发者ID:narwalsandeep,项目名称:switchcodes.com,代码行数:18,代码来源:Table.php

示例12: deleteNode

 /**
  * Delete node
  *
  * @param integer $leftKey
  * @param integer $rightKey
  * @param array $filter
  * @param boolean $useTransaction
  * @return boolean|string
  */
 public function deleteNode($leftKey, $rightKey, array $filter = [], $useTransaction = true)
 {
     try {
         if ($useTransaction) {
             $this->tableGateway->getAdapter()->getDriver()->getConnection()->beginTransaction();
         }
         $predicate = new Predicate();
         $this->tableGateway->delete([$predicate->greaterThanOrEqualTo($this->left, $leftKey), $predicate->lessThanOrEqualTo($this->right, $rightKey)] + $filter);
         $predicate = new Predicate();
         $this->tableGateway->update([$this->left => new Expression('IF(' . $this->left . ' > ?, ' . $this->left . ' - (? - ? + 1), ' . $this->left . ')', [$leftKey, $rightKey, $leftKey]), $this->right => new Expression($this->right . ' - (? - ? + 1)', [$rightKey, $leftKey])], [$predicate->greaterThan($this->right, $rightKey)] + $filter);
         if ($useTransaction) {
             $this->tableGateway->getAdapter()->getDriver()->getConnection()->commit();
         }
     } catch (Exception $e) {
         if ($useTransaction) {
             $this->tableGateway->getAdapter()->getDriver()->getConnection()->rollback();
         }
         ApplicationErrorLogger::log($e);
         return $e->getMessage();
     }
     return true;
 }
开发者ID:esase,项目名称:dream-cms,代码行数:31,代码来源:ApplicationAbstractNestedSet.php

示例13: deleteUser

 /**
  * @param int $id
  */
 public function deleteUser($id)
 {
     $this->tableGateway->delete(array('user_id' => (int) $id));
 }
开发者ID:zekiunal,项目名称:zend-framework-blog-sample,代码行数:7,代码来源:UserTable.php

示例14: delete

 public function delete($version, $mdir_md5)
 {
     $this->tableGateway->delete(array('version' => $version, 'mdir_md5' => $mdir_md5));
 }
开发者ID:ycheukf,项目名称:migration,代码行数:4,代码来源:MigrationVersionTable.php

示例15: deleteAll

 /**
  * {@inheritdoc}
  *
  * {@inheritdoc}
  */
 public function deleteAll()
 {
     $where = '1=1';
     $deletedItemsCount = $this->dbTable->delete($where);
     return $deletedItemsCount;
 }
开发者ID:avz-cmf,项目名称:zaboy-res,代码行数:11,代码来源:DbTable.php


注:本文中的Zend\Db\TableGateway\TableGateway::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。