Interface Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder

Description

The Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder is used to easily create attribute driven time triggers.

The Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder is used to easily create attribute driven time 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 shich the trigger will be fired during each dispatch cycle.
  • The attribute ID: Defines the attribute used to determine the relevant recipients.

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

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

 $factory = $session->getTriggerMailingManager()->getTriggerDescriptorBuilderFactory();
 $builder = $factory->createBirthdayTriggerDescriptorBuilder();
 $builder->startDate( date('c') );
 $builder->sendingTime( $sendingTime );
 $builder->attribute( $birthdayId );
 $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( "Geburtstag" )->getId();
 $counterId = $rmd->getUserAttribute( "Counter" )->getId();

 $endDate = date('c', strtotime('+1 year'));
 $sendingTime = date('c', mktime(12, 30));

 $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->createBirthdayTriggerDescriptorBuilder()->startDate( date('c') )
      ->sendingTime( $sendingTime )->endDate( $endDate )->attribute( $birthdayId )->offset( $offset )
      ->attributeValueSetters( $commands )->build();
The created trigger will fire one day before a recipients 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/AttributeTriggerDescriptorBuilder.php (line 76)

Inx_Api_TriggerMailing_Descriptor_TriggerDescriptorBuilder
   |
   --Inx_Api_TriggerMailing_Descriptor_TimeTriggerDescriptorBuilder
      |
      --Inx_Api_TriggerMailing_Descriptor_AttributeTriggerDescriptorBuilder
Direct descendents
Class Description
Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder The Inx_Api_TriggerMailing_Descriptor_AnniversaryTriggerDescriptorBuilder is used to easily create anniversary triggers.
Method Summary
Methods
attribute (line 85)

Sets the ID of the recipient attribute used as basis of the trigger.

Sets the ID of the recipient attribute used as basis of the trigger. This setting is mandatory.

  • return: the builder.
  • access: public
  • int $iAttributeId: the ID of the recipient attribute used as basis of the trigger.
offset (line 108)

Sets the Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset used to alter the dispatch date specified by the attribute.

Sets the Inx_Api_TriggerMailing_Descriptor_TimeTriggerOffset used to alter the dispatch date specified by the attribute. For example: Normally, birthday trigger mailings are sent on the birthday of the recipient. Using a TimeTriggerOffset you can send your congratulations before or after that date. This setting is optional. There are some restrictions regarding the permitted offset types and units:

  • Birthday trigger mailing: Only the DAY unit is permitted.
  • Reminder trigger mailing: Only the DAY unit and the IS_IN type are permitted.
  • Follow-up trigger mailing: Only the DAY unit and the WAS_AGO type are permitted.
  • Anniversary trigger mailing: Only the DAY unit is permitted.

  • return: the builder.
  • throws: Inx_Api_IllegalArgumentException if the offset type or unit is illegal in combination with the trigger type at hand.
  • access: public

Inherited Methods

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:21 +0200 by phpDocumentor 1.3.2