Ejemplo n.º 1
0
 protected function assertSegmentData()
 {
     $segmentType = new SegmentType(SegmentType::TYPE_DYNAMIC);
     $segment = $this->testEntity->getSegment();
     $this->assertEquals('Marketing List test segment', $segment->getName());
     $this->assertEquals('test', $segment->getDefinition());
     $this->assertEquals($this->testEntity->getOwner()->getOwner(), $segment->getOwner());
     $this->assertEquals($segmentType, $segment->getType());
 }
 /**
  * @param MarketingList $marketingList
  * @param string|null $type
  * @return array
  */
 public function getMarketingListTypedFields(MarketingList $marketingList, $type = null)
 {
     if ($marketingList->isManual()) {
         $typedFields = $this->getEntityTypedFields($marketingList->getEntity(), $type);
     } else {
         $typedFields = $this->getQueryTypedFields($marketingList->getSegment(), $type);
     }
     return $typedFields;
 }
Ejemplo n.º 3
0
 /**
  * @param MarketingList $marketingList
  * @param string|null $mixin
  * @return QueryBuilder|null
  */
 public function getMarketingListQueryBuilder(MarketingList $marketingList, $mixin = null)
 {
     if ($marketingList->getType()->getName() !== MarketingListType::TYPE_MANUAL) {
         $dataGrid = $this->getSegmentDataGrid($marketingList->getSegment(), $mixin);
         /** @var OrmDatasource $dataSource */
         $dataSource = $dataGrid->getAcceptedDatasource();
         $queryBuilder = $dataSource->getQueryBuilder();
         return $queryBuilder;
     }
     return null;
 }
Ejemplo n.º 4
0
 /**
  * @Route("/view/{id}", name="orocrm_marketing_list_view", requirements={"id"="\d+"}, defaults={"id"=0})
  * @Acl(
  *      id="orocrm_marketing_list_view",
  *      type="entity",
  *      permission="VIEW",
  *      class="OroCRMMarketingListBundle:MarketingList"
  * )
  * @Template
  *
  * @param MarketingList $entity
  *
  * @return array
  */
 public function viewAction(MarketingList $entity)
 {
     $entityConfig = $this->get('orocrm_marketing_list.entity_provider')->getEntity($entity->getEntity());
     return ['entity' => $entity, 'config' => $entityConfig, 'gridName' => Segment::GRID_PREFIX . $entity->getSegment()->getId()];
 }
Ejemplo n.º 5
0
 /**
  * Validate Marketing List.
  *
  * @param MarketingList $marketingList
  * @return bool
  */
 protected function isValid(MarketingList $marketingList)
 {
     $errors = $this->validator->validate($marketingList->getSegment(), array('marketing_list'));
     if (count($errors) > 0) {
         /** @var ConstraintViolationInterface $error */
         foreach ($errors as $error) {
             $this->form->addError(new FormError($error->getMessage(), $error->getMessageTemplate(), $error->getMessageParameters(), $error->getMessagePluralization()));
         }
     }
     return $this->form->isValid();
 }
 /**
  * @param MarketingList $marketingList
  * @return ColumnDefinitionListInterface
  */
 public function create(MarketingList $marketingList)
 {
     $segment = $marketingList->getSegment();
     $columnDefinitionList = new ColumnDefinitionList($segment);
     return $columnDefinitionList;
 }