Interface Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder

Description

The Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder is used to easily create anniversary triggers.

The Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder is used to easily create anniversary triggers. The following settings are mandatory:

  • The start date: Defines the date at which the trigger will be fired for the first time.
  • The sending time: Defines the time at which the trigger will be fired during each dispatch cycle.
  • The attribute ID: Defines the attribute used to determine the relevant recipients.
  • The column modificator: Defines how long after or before a specific date the trigger shall be fired.

Using only these settings the easiest possible anniversary trigger descriptor can be built using the following statements:

 $rmd = $session->createRecipientContext()->getMetaData();
 $birthdayId = $rmd->getUserAttribute( "Birthday" )->getId();
 $sendingTime = date('c', mktime(12, 30));

 $modificator = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
      Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::WAS_AGO(),
      Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::YEAR(), 50);

 $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
 $builder = $factory->createAnniversaryTriggerDescriptorBuilder();
 $builder->startDate( date('c') );
 $builder->sendingTime( $sendingTime );
 $builder->attribute( $birthdayId );
 $builder->columnModificator( $modificator );
 $descriptor = $builder->build();

There are also some optional settings which can be set:

  • The end date: Defines the date at which the trigger mailing will be dispatched for the last time.
  • The offset: Defines the offset of the attribute. For example, how many days after a specific date the trigger mailing shall be dispatched to a recipient.
  • The attribute value setters: Can be used to set recipient attribute values along with the dispatch of the trigger mailing.

Using all of these settings, the trigger descriptor could be built with the following statements:

 $rmd = $session->createRecipientContext()->getMetaData();
 $birthdayId = $rmd->getUserAttribute( "Birthday" )->getId();
 $counterId = $rmd->getUserAttribute( "Counter" )->getId();
 $endDate = date('c', strtotime('+1 year'));
 $sendingTime = date('c', mktime(12, 30));

 $modificator = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
      Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::WAS_AGO(),
      Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::YEAR(), 50);

 $offset = new Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset(
      Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffsetType::IS_IN(),
      Inx_Api_TriggerMailing_Descriptor_TimeTriggerUnit::DAY(), 1);

 $cmdFactory = $session->getActionManager()->getCommandFactory();
 $cmd = $cmdFactory->createSetRelativeValueCmd( $counterId, "1" );
 $commands = array( $cmd );

 $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
 $descriptor = $factory->createAnniversaryTriggerDescriptorBuilder()->startDate( date('c') )
      ->sendingTime( $sendingTime )->endDate( $endDate )->attribute( $birthdayId )
      ->columnModificator( $modificator )->offset( $offset )->attributeValueSetters( $commands )
      ->build();
The created trigger will fire one day before a recipients 50th birthday at 12:30 and will increase the Counter attribute. The trigger will be active from now on till the next year.

Located in /Api/TriggerMailing/Descriptor/AnniversaryTriggerDescriptorBuilder.php (line 84)

Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder
   |
   --Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder
      |
      --Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder
         |
         --Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder
Method Summary
Methods
columnModificator (line 99)

Sets the Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset used to define the time span between the dispatch date and the date specified by the attribute.

Sets the Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset used to define the time span between the dispatch date and the date specified by the attribute. Be aware that the only legal offset type is WAS_AGO. For example: An anniversary trigger mailing can be sent out ten years after the date specified by the attribute. This setting is mandatory.

  • return: the builder.
  • throws: Inx_Api_IllegalArgumentException if the offset type is not WAS_AGO.
  • throws: Inx_Api_NullPointerException if the given offset is null.
  • access: public

Inherited Methods

Inherited From Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder

Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder::attribute()
Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder::offset()

Inherited From Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder

Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder::attributeValueSetters()
Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder::endDate()
Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder::sendingTime()
Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder::startDate()

Inherited From Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder

Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder::build()
Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder::validate()

Documentation generated on Thu, 17 Sep 2015 14:27:20 +0200 by phpDocumentor 1.3.2