예제 #1
0
 public function createAction()
 {
     $curtainPriceBandRepository = $this->getDoctrine()->getRepository('ElmetSiteBundle:CurtainPriceBand');
     $curtainPriceBand = $curtainPriceBandRepository->findOneById($this->getRequest()->get('priceband'));
     $curtainDesign = new CurtainDesign();
     $curtainDesign->setCurtainPriceBand($curtainPriceBand);
     $curtainDesign->setCushionFinish($this->getRequest()->get('cushionfinish'));
     $curtainDesign->setEyeletsAvailable($this->getRequest()->get('eyelets'));
     $curtainDesign->setFabricWidth($this->getRequest()->get('fabricwidth'));
     $curtainDesign->setFinish($this->getRequest()->get('curtainfinish'));
     $curtainDesign->setLined($this->getRequest()->get('lined'));
     $curtainDesign->setMaterials($this->getRequest()->get('materials'));
     $curtainDesign->setName($this->getRequest()->get('name'));
     $curtainDesign->setNew($this->getRequest()->get('new'));
     $curtainDesign->setPatternRepeatLength($this->getRequest()->get('patternrepeatlength'));
     $curtainDesign->setTapeSize($this->getRequest()->get('tapesize'));
     $curtainDesign->setUrlName($this->getRequest()->get('shortname'));
     $curtainDesign->setPosition($this->getRequest()->get('position'));
     $curtainDesign->setDisplay($this->getRequest()->get('display'));
     $curtainDesign->setSpecialPurchase($this->getRequest()->get('special'));
     $em = $this->getDoctrine()->getEntityManager();
     $em->persist($curtainDesign);
     $em->flush();
     return $this->viewAction($curtainDesign->getId());
 }
예제 #2
0
 public function testOnDisplaySortByInStockandPosition()
 {
     $curtainDesign = new CurtainDesign();
     $curtainColour1 = new CurtainColour();
     $curtainColour1->setId(1);
     $curtainColour1->setName("one");
     $curtainColour1->setinStock(1);
     $curtainColour1->setDisplay(1);
     $curtainColour1->setPosition(1);
     $curtainDesign->addCurtainColour($curtainColour1);
     $curtainColour2 = new CurtainColour();
     $curtainColour2->setId(2);
     $curtainColour2->setName("two");
     $curtainColour2->setinStock(0);
     $curtainColour2->setDisplay(1);
     $curtainColour2->setPosition(1);
     $curtainDesign->addCurtainColour($curtainColour2);
     $curtainColour3 = new CurtainColour();
     $curtainColour3->setId(3);
     $curtainColour3->setName("three");
     $curtainColour3->setinStock(1);
     $curtainColour3->setDisplay(0);
     $curtainColour1->setPosition(0);
     $curtainDesign->addCurtainColour($curtainColour3);
     $curtainColour4 = new CurtainColour();
     $curtainColour4->setId(4);
     $curtainColour4->setName("four");
     $curtainColour4->setinStock(0);
     $curtainColour4->setDisplay(1);
     $curtainColour4->setPosition(0);
     $curtainDesign->addCurtainColour($curtainColour4);
     $sortedColours = $curtainDesign->getOnDisplayCurtainColoursSortedByInStockAndPosition();
     reset($sortedColours);
     $this->assertEquals("one", current($sortedColours)->getName());
     $this->assertEquals("four", next($sortedColours)->getName());
     $this->assertEquals("two", next($sortedColours)->getName());
 }
예제 #3
0
 /** * @codeCoverageIgnore */
 public function createAction()
 {
     $repository = $this->getDoctrine()->getRepository('ElmetSiteBundle:CurtainPriceBand');
     $curtainPriceBand = $repository->findOneByName('A');
     $curtainDesign = new CurtainDesign();
     $curtainDesign->setUrlName("elevetham");
     $curtainDesign->setName("elevetham");
     $curtainDesign->setMaterials("100% Silk");
     $curtainDesign->setTapeSize("3");
     $curtainDesign->setLined('1');
     $curtainDesign->setEyeletsAvailable(1);
     $curtainDesign->setFabricWidth(140);
     $curtainDesign->setPatternRepeatLength(8.0);
     $curtainDesign->setFinish("Fringed");
     $curtainDesign->setCushionFinish("Corded");
     $curtainDesign->setNew('1');
     $curtainDesign->setCurtainPriceBand($curtainPriceBand);
     $curtainColour = new CurtainColour();
     $curtainColour->setName("Black");
     $curtainColour->setCurtainDesign($curtainDesign);
     $curtainColour->setFullFilepath("/fullpath");
     $curtainColour->setSwatchFilepath("/swatchpath");
     $curtainColour->setThumbnailFilepath("/thumbnailpath");
     $curtainColour->setInStock(1);
     $curtainColour->setBuynow(1);
     $em = $this->getDoctrine()->getEntityManager();
     $em->persist($curtainDesign);
     $em->persist($curtainColour);
     $em->flush();
     return new Response('Created curtain design id ' . $curtainDesign->getId() . ' Created curtain colour id ' . $curtainColour->getId());
 }