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


PHP DBServer::listByFilter方法代码示例

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


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

示例1: delete

 /**
  * {@inheritdoc}
  * @see Scalr_Model::delete()
  */
 public function delete($id = null)
 {
     $servers = \DBServer::listByFilter(['clientId' => $this->id]);
     foreach ($servers as $server) {
         /* @var $server \DBServer */
         $server->Remove();
     }
     try {
         $this->db->StartTrans();
         //TODO: Use models
         $this->db->Execute("\n                DELETE account_team_users FROM account_team_users, account_teams\n                WHERE account_teams.account_id = ?\n                AND account_team_users.team_id = account_teams.id\n            ", array($this->id));
         $this->db->Execute("DELETE FROM account_users WHERE account_id=?", array($this->id));
         $this->db->Execute("DELETE FROM account_teams WHERE account_id=?", array($this->id));
         $this->db->Execute("DELETE FROM account_limits WHERE account_id=?", array($this->id));
         /* @var $environment Environment */
         foreach (Environment::findByAccountId($this->id) as $environment) {
             $environment->delete(true);
         }
         CloudCredentials::deleteByAccountId($this->id);
         $this->db->Execute("\n                DELETE account_team_user_acls FROM account_team_user_acls, acl_account_roles\n                WHERE acl_account_roles.account_id = ?\n                AND account_team_user_acls.account_role_id = acl_account_roles.account_role_id\n            ", array($this->id));
         $this->db->Execute("DELETE FROM acl_account_roles WHERE account_id=?", array($this->id));
         $this->db->Execute("DELETE FROM ec2_ebs WHERE client_id=?", array($this->id));
         $this->db->Execute("DELETE FROM apache_vhosts WHERE client_id=?", array($this->id));
         $this->db->Execute("DELETE FROM scheduler WHERE account_id=?", array($this->id));
         foreach ($this->db->Execute("SELECT id FROM farms WHERE clientid=?", [$this->id]) as $farm) {
             $this->db->Execute("DELETE FROM farms WHERE id=?", array($farm["id"]));
             $this->db->Execute("DELETE FROM farm_roles WHERE farmid=?", array($farm["id"]));
             $this->db->Execute("DELETE FROM elastic_ips WHERE farmid=?", array($farm["id"]));
         }
         $roles = $this->db->GetAll("SELECT id FROM roles WHERE client_id = '{$this->id}'");
         foreach ($roles as $role) {
             $this->db->Execute("DELETE FROM roles WHERE id = ?", array($role['id']));
             $this->db->Execute("DELETE FROM role_behaviors WHERE role_id = ?", array($role['id']));
             $this->db->Execute("DELETE FROM role_images WHERE role_id = ?", array($role['id']));
             $this->db->Execute("DELETE FROM role_properties WHERE role_id = ?", array($role['id']));
             $this->db->Execute("DELETE FROM role_security_rules WHERE role_id = ?", array($role['id']));
         }
         //Removing cost centres and projects which are set up from this account
         $this->db->Execute("\n                DELETE project_properties FROM project_properties, projects\n                WHERE projects.project_id = project_properties.project_id\n                AND projects.account_id = ?\n            ", [$this->id]);
         $this->db->Execute("DELETE FROM projects WHERE account_id = ?", [$this->id]);
         $this->db->Execute("\n                DELETE cc_properties FROM cc_properties, ccs\n                WHERE ccs.cc_id = cc_properties.cc_id\n                AND ccs.account_id = ?\n            ", [$this->id]);
         $this->db->Execute("DELETE FROM ccs WHERE account_id = ?", [$this->id]);
         parent::delete();
         ReportEntity::deleteByAccountId($this->id);
         NotificationEntity::deleteByAccountId($this->id);
         $this->db->CompleteTrans();
     } catch (\Exception $e) {
         $this->db->RollbackTrans();
         throw $e;
     }
 }
开发者ID:scalr,项目名称:scalr,代码行数:55,代码来源:Account.php

示例2: delete

 /**
  * {@inheritdoc}
  * @see Scalr_Model::delete()
  */
 public function delete($id = null)
 {
     if ($this->db->GetOne("SELECT COUNT(*) FROM farms WHERE env_id = ?", array($this->id))) {
         throw new Exception("Cannot remove environment. You need to remove all your farms first.");
     }
     if ($this->db->GetOne("SELECT COUNT(*) FROM client_environments WHERE client_id = ?", array($this->clientId)) < 2) {
         throw new Exception('At least one environment should be in account. You cannot remove the last one.');
     }
     parent::delete();
     try {
         $this->db->Execute("DELETE FROM client_environment_properties WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM apache_vhosts WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM autosnap_settings WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM bundle_tasks WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM dm_applications WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM dm_deployment_tasks WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM dm_sources WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM dns_zones WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM ec2_ebs WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM elastic_ips WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM farms WHERE env_id=?", array($this->id));
         $this->db->Execute("DELETE FROM roles WHERE env_id=?", array($this->id));
         $servers = \DBServer::listByFilter(['envId' => $this->id]);
         foreach ($servers as $server) {
             /* @var $server \DBServer */
             $server->Remove();
         }
         $this->db->Execute("DELETE FROM `account_team_envs` WHERE env_id = ?", array($this->id));
     } catch (Exception $e) {
         throw new Exception(sprintf(_("Cannot delete record. Error: %s"), $e->getMessage()), $e->getCode());
     }
 }
开发者ID:mheydt,项目名称:scalr,代码行数:36,代码来源:Environment.php

示例3: delete

 /**
  * {@inheritdoc}
  * @see AbstractEntity::delete()
  *
  * @param   bool    $force Delete ignoring restrictions
  */
 public function delete($force = false)
 {
     $db = $this->db();
     if (!$force) {
         if ($db->GetOne("SELECT 1 FROM `farms` WHERE `env_id` = ? LIMIT 1", [$this->id])) {
             throw new ObjectInUseException('Cannot remove environment. You need to remove all your farms first.');
         }
         if ($db->GetOne("SELECT COUNT(*) FROM client_environments WHERE client_id = ?", [$this->accountId]) < 2) {
             throw new ObjectInUseException('At least one environment should be in account. You cannot remove the last one.');
         }
     }
     parent::delete();
     try {
         $db->Execute("DELETE FROM client_environment_properties WHERE env_id=?", [$this->id]);
         $db->Execute("DELETE FROM apache_vhosts WHERE env_id=?", [$this->id]);
         $db->Execute("DELETE FROM autosnap_settings WHERE env_id=?", [$this->id]);
         $db->Execute("DELETE FROM bundle_tasks WHERE env_id=?", [$this->id]);
         $db->Execute("DELETE FROM dns_zones WHERE env_id=?", [$this->id]);
         $db->Execute("DELETE FROM ec2_ebs WHERE env_id=?", [$this->id]);
         $db->Execute("DELETE FROM elastic_ips WHERE env_id=?", [$this->id]);
         $db->Execute("DELETE FROM farms WHERE env_id=?", [$this->id]);
         $db->Execute("DELETE FROM roles WHERE env_id=?", [$this->id]);
         $servers = \DBServer::listByFilter(['envId' => $this->id]);
         foreach ($servers as $server) {
             /* @var $server \DBServer */
             $server->Remove();
         }
         Entity\EnvironmentCloudCredentials::deleteByEnvId($this->id);
         Entity\CloudCredentials::deleteByEnvId($this->id);
         TeamEnvs::deleteByEnvId($this->id);
     } catch (Exception $e) {
         throw new Exception(sprintf(_("Cannot delete record. Error: %s"), $e->getMessage()), $e->getCode());
     }
 }
开发者ID:scalr,项目名称:scalr,代码行数:40,代码来源:Environment.php


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