/** * {@inheritDoc} */ public function load(ObjectManager $manager) { foreach (range(1, 2) as $s) { $project = new Project(); $project->setName('Project' . $s); $project->setDescription('Some project description goes here.'); $project->setCreatedAt(new \DateTime('now')); $project->setUpdatedAt(new \DateTime('now')); $date = new \DateTime('now'); $duedate = $date->add(new \DateInterval('P30D')); $project->setDueDate($duedate); $project->setStatus('Pending'); $manager->persist($project); $this->addReference('project' . $s, $project); } $manager->flush(); $this->addReference('project', $project); }
/** * Makes new Project Object and sets the values from the incoming data. * @param $data * @return Project */ public static function buildProjectDetailFromArray($data) { $project = new Project(); $project->setLead($data['lead']['displayName']); $project->setDescription($data['description']); $project->setAssigneeType($data['assigneeType']); if (!in_array('projectCategory', $data)) { null; } else { $project->setCategory($data['projectCategory']['name']); } if (!in_array('url', $data)) { null; } else { $project->setUrl($data['url']); } return $project; }
public function load(ObjectManager $manager) { $project = new Project(); $project->setName('Project 1'); $project->setDescription('This is the description of a genuin Maxwan project 1.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project1.png'); $project->setIsSlide(true); $project->setSlideImage('slide1.jpg'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('landscape')); $manager->persist($project); $manager->flush(); $this->addReference('project1', $project); $project = new Project(); $project->setName('Project 2'); $project->setDescription('This is the description of a genuin Maxwan project 2.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project2.png'); $project->setIsSlide(true); $project->setSlideImage('slide2.jpg'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('urbanism')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 3'); $project->setDescription('This is the description of a genuin Maxwan project 3.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project3.png'); $project->setIsSlide(true); $project->setSlideImage('slide3.jpg'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('landscape')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 5'); $project->setDescription('This is the description of a genuin Maxwan project 4.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project4.png'); $project->setIsSlide(true); $project->setSlideImage('slide4.jpg'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('urbanism')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 5'); $project->setDescription('This is the description of a genuin Maxwan project 5.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project5.png'); $project->setIsSlide(true); $project->setSlideImage('slide5.jpg'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('landscape')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 6'); $project->setDescription('This is the description of a genuin Maxwan project 6.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project6.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('urbanism')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 7'); $project->setDescription('This is the description of a genuin Maxwan project 7.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project7.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('landscape')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 8'); $project->setDescription('This is the description of a genuin Maxwan project 8.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project8.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('urbanism')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 9'); $project->setDescription('This is the description of a genuin Maxwan project 9.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project9.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('landscape')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 10'); $project->setDescription('This is the description of a genuin Maxwan project 10.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project10.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('urbanism')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 11'); $project->setDescription('This is the description of a genuin Maxwan project 11.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project11.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('landscape')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 12'); $project->setDescription('This is the description of a genuin Maxwan project 12.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project5.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('urbanism')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 13'); $project->setDescription('This is the description of a genuin Maxwan project 13.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project7.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('landscape')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 14'); $project->setDescription('This is the description of a genuin Maxwan project 14.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project2.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('urbanism')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 15'); $project->setDescription('This is the description of a genuin Maxwan project 15.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project3.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('landscape')); $manager->persist($project); $manager->flush(); $project = new Project(); $project->setName('Project 16'); $project->setDescription('This is the description of a genuin Maxwan project 16.'); $project->setStatus(false); $project->setClient('Stadsbestuur Antwerpen'); $project->setLocation('Antwerpen'); $project->setTeam('Donald, Rients, Rene'); $project->setCollaboration('Masa, IMG+'); $project->setPhotography('DesignUAll'); $project->setThumbnail('project10.png'); $project->setQuote('This is the quote of this project.'); $project->setCategory($this->getReference('urbanism')); $manager->persist($project); $manager->flush(); }
/** * @param $userId * @param $title * @param null|string $description * @param null|float $hourlyRate * @param null|int $id * @return Project * * @throws ProjectNotFoundException * @throws UserNotFoundException * @throws ValidationException */ public function saveProject($userId, $title, $description = null, $hourlyRate = null, $id = null) { if ($id !== null) { $project = $this->projectRepository->getProject($id, $userId); if ($project === null) { throw new ProjectNotFoundException(); } } else { $project = new Project(); } $user = $this->entityManager->getRepository('AppBundle:User')->find($userId); if ($user === null) { throw new UserNotFoundException(); } $project->setTitle($title); $project->setDescription($description); $project->setHourlyRate($hourlyRate); $project->setUser($user); $errors = $this->validator->validate($project); if ($errors->count() > 0) { throw new ValidationException($errors); } $this->projectRepository->saveProject($project); return ProjectDTO::withEntity($project); }
/** * {@inheritDoc} */ public function setDescription($description) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDescription', array($description)); return parent::setDescription($description); }