/**
  * @Rest\Post(
  *      "/staticsegment/{id}/status",
  *      requirements={"id"="\d+"}
  * )
  * @ParamConverter("staticSegment", options={"id"="id"})
  * @Rest\QueryParam(
  *      name="id",
  *      requirements="\d+",
  *      nullable=false,
  *      description="Static Segment Id"
  * )
  * @ApiDoc(
  *      description="Update Static Segment status",
  *      resource=false
  * )
  * @AclAncestor("orocrm_mailchimp")
  * @param StaticSegment $staticSegment
  * @return Response
  */
 public function updateStatusAction(StaticSegment $staticSegment)
 {
     $status = $this->getRequest()->get('status');
     $staticSegment->setSyncStatus($status);
     $em = $this->getDoctrine()->getManager();
     $em->persist($staticSegment);
     $em->flush();
     return $this->handleView($this->view('', Codes::HTTP_OK));
 }
 /**
  * @param MarketingList $marketingList
  * @return StaticSegment
  */
 protected function getStaticSegmentByMarketingList(MarketingList $marketingList)
 {
     $staticSegment = $this->findStaticSegmentByMarketingList($marketingList);
     if (!$staticSegment) {
         $staticSegment = new StaticSegment();
         $staticSegment->setName(mb_substr($marketingList->getName(), 0, 100));
         $staticSegment->setSyncStatus(StaticSegment::STATUS_NOT_SYNCED);
         $staticSegment->setMarketingList($marketingList);
     }
     return $staticSegment;
 }