public function create()
    {
        $entities  = [];
        $exclusive = $this->getExclusiveRules();
        if (count($exclusive)) {
            // Create an entry for *each* exclusivity rule as they will end up with different dates of exclusivity
            // expiration. Any of these entries will suffice for duplicate checking and limit checking.
            foreach ($exclusive as $rule) {
                if (!isset($entity)) {
                    $entity = $this->createEntity();
                } else {
                    // No need to re-run all the getters and setters.
                    $entity = clone $entity;
                }
                // Each entry may have different exclusion expiration.
                $expireDate = $this->getRepository()->oldestDateAdded(
                    $rule['duration'],
                    $this->getTimezone(),
                    $this->dateSend
                );
                $entity->setExclusiveExpireDate($expireDate);
                $entity->setExclusivePattern($rule['matching']);
                $entity->setExclusiveScope($rule['scope']);
                $entities[] = $entity;
            }
        } else {
            // A single entry will suffice for all duplicate checking and limit checking.
            $entities[] = $this->createEntity();
        }
        if (count($entities)) {
            $this->getRepository()->saveEntities($entities);
            $this->em->clear('MauticPlugin\MauticContactClientBundle\Entity\Cache');
        }
    }
public function create()
    {
        $entities  = [];
        $exclusive = $this->getExclusiveRules();
        if (count($exclusive)) {
            // Create an entry for *each* exclusivity rule as they will end up with different dates of exclusivity
            // expiration. Any of these entries will suffice for duplicate checking and limit checking.
            foreach ($exclusive as $rule) {
                if (!isset($entity)) {
                    $entity = $this->createEntity();
                } else {
                    // No need to re-run all the getters and setters.
                    $entity = clone $entity;
                }
                // Each entry may have different exclusion expiration.
                $expireDate = $this->getRepository()->oldestDateAdded(
                    $rule['duration'],
                    $this->getTimezone(),
                    $this->dateSend
                );
                $entity->setExclusiveExpireDate($expireDate);
                $entity->setExclusivePattern($rule['matching']);
                $entity->setExclusiveScope($rule['scope']);
                $entities[] = $entity;
            }
        } else {
            // A single entry will suffice for all duplicate checking and limit checking.
            $entities[] = $this->createEntity();
        }
        if (count($entities)) {
            $this->getRepository()->saveEntities($entities);
            $this->em->clear('MauticPlugin\MauticContactClientBundle\Entity\Cache');
        }
    }
public function create ( ) { $ entities = [ ] ; $ exclusive = $ this -> getExclusiveRules ( ) ; if ( count ( $ exclusive ) ) { // Create an entry for *each* exclusivity rule as they will end up with different dates of exclusivity // expiration. Any of these entries will suffice for duplicate checking and limit checking. foreach ( $ exclusive as $ rule ) { if ( ! isset ( $ entity ) ) { $ entity = $ this -> createEntity ( ) ; } else { // No need to re-run all the getters and setters. $ entity = clone $ entity ; } // Each entry may have different exclusion expiration. $ expireDate = $ this -> getRepository ( ) -> oldestDateAdded ( $ rule [ 'duration' ] , $ this -> getTimezone ( ) , $ this -> dateSend ) ; $ entity -> setExclusiveExpireDate ( $ expireDate ) ; $ entity -> setExclusivePattern ( $ rule [ 'matching' ] ) ; $ entity -> setExclusiveScope ( $ rule [ 'scope' ] ) ; $ entities [ ] = $ entity ; } } else { // A single entry will suffice for all duplicate checking and limit checking. $ entities [ ] = $ this -> createEntity ( ) ; } if ( count ( $ entities ) ) { $ this -> getRepository ( ) -> saveEntities ( $ entities ) ; $ this -> em -> clear ( 'MauticPlugin\MauticContactClientBundle\Entity\Cache' ) ; } }
Create all necessary cache entities for the given Contact and Contact Client.

@throws \Exception
Create all necessary cache entities for the given Contact and Contact Client .