Example #1
0
 public function setBanner(Banner &$banner)
 {
     $oldBanner = $this->em->getRepository('AppBundle:Banner')->findOldBanner($banner->getGid(), $banner->getSide(), $banner->getCompany()->getId());
     if ($oldBanner) {
         $oldBanner->setAdrs($banner->getAdrs());
         $oldBanner->setTitle($banner->getTitle());
         $oldBanner->setBody($banner->getBody());
         $oldBanner->setSide($banner->getSide());
         $oldBanner->setCity($banner->getCity());
         $oldBanner->setGid($banner->getGid());
         $oldBanner->setGrp($banner->getGrp());
         $oldBanner->setOts($banner->getOts());
         $oldBanner->setPrice($banner->getPrice());
         $oldBanner->setPrice2($banner->getPrice2());
         $oldBanner->setPriceDeploy($banner->getPriceDeploy());
         $oldBanner->setTaxType($banner->getTaxType());
         $oldBanner->setFormat($banner->getFormat());
         $oldBanner->setType($banner->getType());
         $oldBanner->setArea($banner->getArea());
         $oldBanner->setLight($banner->getLight());
         $oldBanner->setImg($banner->getImg());
         $oldBanner->setLink($banner->getLight());
         $oldBanner->setLongitude($banner->getLongitude());
         $oldBanner->setLatitude($banner->getLatitude());
         $this->em->flush($oldBanner);
         $banner = $oldBanner;
     } else {
         $this->em->persist($banner);
         $this->em->flush($banner);
     }
     $this->em->refresh($banner);
     return $banner;
 }