/** * @param Project $project * * @return Translations */ public function addProject(Project $project) { if ($this->getProject($project->getId())) { throw new \InvalidArgumentException(sprintf('Project "%s" already added', $project->getId())); } $this->projects[] = $project; return $this; }
public function deleteProject(Account $account, Project $project) { $dir = $this->getUserDirPath($account->getUsername()); $filesystem = new Filesystem(); $filesystem->remove($dir . '/' . $project->getId()); $account->getTranslations()->removeProject($project->getId()); $this->save($account->getUsername(), $account->getTranslations()); }