Ejemplo n.º 1
0
 protected function _preDelete()
 {
     tables\EditionComponents::getTable()->deleteByEditionID($this->getID());
 }
Ejemplo n.º 2
0
 protected function _preDelete()
 {
     tables\IssueAffectsComponent::getTable()->deleteByComponentID($this->getID());
     tables\EditionComponents::getTable()->deleteByComponentID($this->getID());
 }
Ejemplo n.º 3
0
 protected function moveProject($project_id, $to_scope_id)
 {
     $this->cliEcho("--------------\n");
     $this->cliEcho("Moving project\n");
     $this->cliEcho("--------------\n");
     $this->moveIssues($project_id, $to_scope_id);
     $this->cliEcho("Moving components, editions and releases...");
     $tables = ['\\thebuggenie\\core\\entities\\tables\\Components' => 'components', '\\thebuggenie\\core\\entities\\tables\\Editions' => 'editions', '\\thebuggenie\\core\\entities\\tables\\Builds' => 'builds'];
     foreach ($tables as $class_name => $table_name) {
         $crit = $class_name::getTable()->getCriteria();
         $crit->addUpdate($table_name . '.scope', $to_scope_id);
         $crit->addWhere($table_name . '.project', $project_id);
         $class_name::getTable()->doUpdate($crit);
     }
     $edition_criteria = Editions::getTable()->getCriteria();
     $edition_criteria->addWhere('editions.project', $project_id);
     $edition_criteria->addSelectionColumn('editions.id', 'id');
     if ($res = Editions::getTable()->doSelect($edition_criteria)) {
         while ($row = $res->getNextRow()) {
             $edition_id = $row['id'];
             $edition_criteria = EditionComponents::getTable()->getCriteria();
             $edition_criteria->addWhere('editioncomponents.edition', $edition_id);
             $edition_criteria->addUpdate('editioncomponents.scope', $to_scope_id);
             EditionComponents::getTable()->doUpdate($edition_criteria);
         }
     }
     $this->cliEcho(" done\n");
     $this->cliEcho("Moving project dashboard...");
     $dashboard_criteria = Dashboards::getTable()->getCriteria();
     $dashboard_criteria->addWhere('dashboards.project_id', $project_id);
     $dashboard_criteria->addSelectionColumn('dashboards.id', 'id');
     $dashboard_ids = [];
     if ($res = Dashboards::getTable()->doSelect($dashboard_criteria)) {
         while ($row = $res->getNextRow()) {
             $dashboard_ids[] = $row['id'];
         }
         $dashboardviews_criteria = DashboardViews::getTable()->getCriteria();
         $dashboardviews_criteria->addWhere('dashboard_views.dashboard_id', $dashboard_ids, Criteria::DB_IN);
         $dashboardviews_criteria->addUpdate('dashboards.scope', $to_scope_id);
         DashboardViews::getTable()->doUpdate($dashboardviews_criteria);
         $dashboard_criteria = Dashboards::getTable()->getCriteria();
         $dashboard_criteria->addWhere('dashboards.project_id', $project_id);
         $dashboard_criteria->addUpdate('dashboards.scope', $to_scope_id);
         Dashboards::getTable()->doUpdate($dashboard_criteria);
     }
     $this->cliEcho(" done\n");
     $this->moveDatatypes($project_id, $to_scope_id);
     $crit = Projects::getTable()->getCriteria();
     $crit->addUpdate('projects.scope', $to_scope_id);
     Projects::getTable()->doUpdateById($crit, $project_id);
     $this->cliEcho("-------------------\n");
     $this->cliEcho("Done moving project\n");
     $this->cliEcho("-------------------\n");
 }