Interface Inx_Api_Recipient_UnsubscriptionRecipientRowSet

Description

An Inx_Api_Recipient_UnsubscriptionRecipientRowSet is best explained as a table of data representing a set of recipients, which is usually generated by executing a selection that queries unsubscribed recipients from the recipient context.

An Inx_Api_Recipient_UnsubscriptionRecipientRowSet is best explained as a table of data representing a set of recipients, which is usually generated by executing a selection that queries unsubscribed recipients from the recipient context. An UnsubscriptionRecipientRowSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next() method moves the cursor to the next row (recipient), and because it returns false when there are no more rows in the UnsubscriptionRecipientRowSet, it can be used in a while loop to iterate through the result set.

Be sure to call next() before the first retrieval statement on the row set. As stated above, initially the cursor is before the first row, thus no data can be retrieved from the row set before calling next(). Doing so will trigger an Inx_Api_DataException.

The Inx_Api_Recipient_UnsubscriptionRecipientRowSet interface provides getter methods (getString, getInteger, and so on) for retrieving attribute values from the current row. Values can be retrieved using the attribute object.

The following snippet shows how to retrieve the email address of all recipients in the row set (all recipients who were unsubscribed from the specified list), thus also illustrating how to iterate over an UnsubscriptionRecipientRowSet:

 $oRecipientContext = $oSession->createRecipientContext();
 $oAttribute = $oRecipientContext->getMetaData()->getEmailAttribute();
 $oListContext = $oSession->getListContextManager()->findByName( "Desired list" );
 $oUnsubscriptionRecipientRowSet = $oRecipientContext->selectUnsubscriber( $oListContext );

 while( $oUnsubscriptionRecipientRowSet->next() )
 {
 	echo $oUnsubscriptionRecipientRowSet->getString( $oAttribute )."<br>";
 }

 $oUnsubscriptionRecipientRowSet->close();

An Inx_Api_Recipient_UnsubscriptionRecipientRowSet offers no update methods. It's primary purpose is to resubscribe recipients, who were previously unsubscribed from a list. To update recipient data, either use an Inx_Api_Recipient_RecipientRowSet or the Inx_Api_Recipient_BatchChannel.

For resubscription of the recipient use the resubscribe() method. It offers a date parameter for setting a new subscription date. If you want to use the original subscription date set the parameter to null. The following snippet shows how to resubscribe the first ten recipients in the row set using the current datetime as subscription date:

 $oRecipientContext = $oSession->createRecipientContext();
 $oListContext = $oSession->getListContextManager()->findByName( "Desired list" );
 $oUnsubscriptionRecipientRowSet = $oRecipientContext->selectUnsubscriber( $oListContext );

 $oUnsubscriptionRecipientRowSet->setResubscribe( date('c'), new Inx_Api_IndexSelection( 0, 9 ) );
 $oUnsubscriptionRecipientRowSet->close();
Note: The setResubscribe() methods do not require a call to commitRowUpdate() to be reflected on the server. However, the resubscribe() method does.

<strong>Note:<strong> An Inx_Api_Recipient_UnsubscriptionRecipientRowSet object <strong>must</strong> be closed once it is not needed anymore to prevent memory leaks and other potentially harmful side effects.

For more information about recipients and the operations that can be performed on them, see the Inx_Api_Recipient_RecipientContext documentation.

Located in /Api/Recipient/UnsubscriptionRecipientRowSet.php (line 80)

Inx_Api_InxRowSet
   |
   --Inx_Api_Recipient_ReadOnlyRecipientRowSet
      |
      --Inx_Api_Recipient_UnsubscriptionRecipientRowSet
Method Summary
int getId ()
void resubscribe (subscriptionDate $subscriptionDate)
true, setResubscribe (subscriptionDate $subscriptionDate, [Inx_Api_IndexSelection $oSelection = null])
Methods
getId (line 108)

Retrieves the recipient id in the current row of this Inx_Api_Recipient_UnsubscriptionRecipientRowSet object.

Retrieves the recipient id in the current row of this Inx_Api_Recipient_UnsubscriptionRecipientRowSet object.

  • return: the recipient id in the current row.
  • throws: Inx_Api_DataException if the selected recipient is deleted.
  • access: public
int getId ()
getUnsubscriptionDate (line 118)

Returns the point in time when the current recipient was unsubscribed from the selected list.

Returns the point in time when the current recipient was unsubscribed from the selected list.

  • return: the point in time when the current recipient was unsubscribed from the selected list as ISO 8601 formatted datetime string. May be null if the subscription attribute was not found.
  • exception: Inx_Api_DataException if the recipient was deleted or no recipient is selected (e.g. you forgot to call next()).
  • access: public
string getUnsubscriptionDate ()
resubscribe (line 89)

Resubscribes the recipient.

Resubscribes the recipient. The resubscription will be processed after calling

  1. commitRowUpdate()
.

  • since: API 1.6.0
  • access: public
void resubscribe (subscriptionDate $subscriptionDate)
  • subscriptionDate $subscriptionDate: the subscription date. If null the original subscription date will be used.
setResubscribe (line 100)

Resubscribes the recipients in the specified selection.

Resubscribes the recipients in the specified selection. If the selection is ommitted, all recipients in this row set will be resubscribed.

  • return: if the recipients were resubscribed, false otherwise.
  • access: public
true, setResubscribe (subscriptionDate $subscriptionDate, [Inx_Api_IndexSelection $oSelection = null])
  • subscriptionDate $subscriptionDate: the subscription date. If null the original subscription date will be used.
  • selection $oSelection: the selected rows. May be ommitted.

Inherited Methods

Inherited From Inx_Api_Recipient_ReadOnlyRecipientRowSet

Inx_Api_Recipient_ReadOnlyRecipientRowSet::getBoolean()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getContext()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getDate()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getDatetime()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getDouble()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getInteger()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getMetaData()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getObject()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getString()
Inx_Api_Recipient_ReadOnlyRecipientRowSet::getTime()

Inherited From Inx_Api_InxRowSet

Inx_Api_InxRowSet::afterLastRow()
Inx_Api_InxRowSet::beforeFirstRow()
Inx_Api_InxRowSet::close()
Inx_Api_InxRowSet::getRow()
Inx_Api_InxRowSet::getRowCount()
Inx_Api_InxRowSet::next()
Inx_Api_InxRowSet::previous()
Inx_Api_InxRowSet::setRow()

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