/** * @param Project $project * @return Project */ public function saveProject(Project $project) { if ($project->getId() !== null) { $this->getEntityManager()->merge($project); } else { $this->getEntityManager()->persist($project); } $this->getEntityManager()->flush(); return $project; }
/** * @param Project $project * @param bool|false $withWorkTime * @return ProjectDTO */ public static function withEntity(Project $project, $withWorkTime = false) { $dto = new ProjectDTO(); $dto->setId($project->getId()); $dto->setDescription($project->getDescription()); $dto->setHourlyRate($project->getHourlyRate()); $dto->setTitle($project->getTitle()); if ($withWorkTime) { foreach ($project->getWorkTimes() as $workTime) { $dto->addWorkTime(WorkTimeDTO::withEntity($workTime)); } } return $dto; }
/** * Creates a form to delete a Project entity. * * @param Project $project The Project entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(Project $project) { return $this->createFormBuilder()->setAction($this->generateUrl('projects_delete', array('id' => $project->getId())))->setMethod('DELETE')->getForm(); }
public function findByProject(Project $project) { $query = $this->createQueryBuilder('activity'); $query->leftJoin('activity.project', 'p')->leftJoin('activity.issue', 'i')->leftJoin('activity.user', 'u')->where('p.id = :project_id')->setParameter('project_id', $project->getId())->orderBy('activity.created', 'DESC')->setMaxResults(16); return $query->getQuery()->getResult(); }
/** * {@inheritDoc} */ public function getId() { if ($this->__isInitialized__ === false) { return (int) parent::getId(); } $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array()); return parent::getId(); }