/** * Removes a project from the database. * * @param \commpress\Cli\Entity\Project $project * The project to remove. * * @throws \commpress\Cli\Service\Database\Exception\DatabaseQueryException * If something goes wrong. */ public function removeProject(Project $project) { $query = sprintf('DELETE FROM projects WHERE %s = :id', Project::FIELD_ID); $stmt = $this->database->prepare($query); $stmt->bindValue(':' . Project::FIELD_ID, $project->getId()); $result = $stmt->execute(); $stmt->close(); if (!$result) { throw new DatabaseQueryException(sprintf('Failed to remove project [ id: %d, acronym: %s ] from database.', $project->getId(), $project->getShortName())); } }
public function __construct(Project $project, $gitBranch) { parent::__construct(sprintf('Project: %s, Branch: %s', $project->getShortName(), $gitBranch)); }
/** * Initializes all required member variables. * * @param \commpress\Cli\Entity\Project $project * The project. * @param $gitBranch * The git branch name. */ private function initialize(Project $project, $gitBranch) { $this->project = $project; $this->gitBranch = $gitBranch; $this->serverSuffix = $this->createServerSuffix($project->getShortName(), $gitBranch); $this->localProjectDirectory = $this->localProjectPath . '/' . $project->getShortName() . '/' . $gitBranch; }
/** * {@inheritdoc} */ protected function getData() { return [Project::FIELD_NAME => $this->project->getFullName(), Project::FIELD_SHORT_NAME => $this->project->getShortName(), Project::FIELD_REPOSITORY_URL => $this->project->getGitRepositoryUrl(), Project::FIELD_VHOST_NAME => $this->project->getVhostName()]; }