Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
titleExample Observer
<?php

/**
 * Class TNW_Salesforce_Model_Observer
 */
class TNW_Salesforce_Model_Observer
{
 
    public function syncMappingAccountAfter(Varien_Event_Observer $observer) {
		/**
		 * Mapping objects
		 * @var TNW_QuoteSalesforce_Model_Sync_Mapping_QuoteCustomer_OpportunityAccount $_mapping 
		 * 
		 * Example:
		 *     object(TNW_QuoteSalesforce_Model_Sync_Mapping_QuoteCustomer_OpportunityAccount)[716530]
		 *       protected '_type' => string 'QuoteAccount' (length=57)         // used $_mapping->getType()
		 *       protected '_allowedMappingTypes' =>                    // used $_mapping->getAllowedMappingTypes()
		 *         array (size=6)
		 *           0 => string 'Customer' (length=8)
		 *           1 => string 'BillingCustomer Group' (length=714)
		 *           2 => string 'ShippingBilling' (length=87)
		 *           3 => string 'CustomShipping' (length=68)
		 *           4 => string 'QuoteAitoc' (length=5)
		 *           5 => string 'Customer GroupCustom' (length=146)
		 *       protected '_mappingCollection' =>					    // used $_mapping->getMappingCollection()
		 *         object(TNW_Salesforce_Model_Mysql4_Mapping_Collection)[621]
		 *           protected '_items' => 
		 *             array (size=0)1)
		 *               object(TNW_Salesforce_Model_Mapping)[377]
		 *                 protected '_data' => 
		 *                   array (size=9)
		 *                     'mapping_id' => string '4' (length=1)
		 *                     'local_field' => string 'Billing : company' (length=17)
		 *                     'sf_field' => string 'Name' (length=4)
		 *                     'attribute_id' => string '24' (length=2)
		 *                     'backend_type' => string 'varchar' (length=7)
		 *                     'sf_object' => string 'Account' (length=7)
		 *                     'default_value' => null
		 *                     'local_field_type' => string 'Billing' (length=7)
		 *                     'local_field_attribute_code' => string 'company' (length=7)
		 *                 ...
		 *           ...
		 *       protected '_sync' => 								    // used $_mapping->getSync()
		 *         object(TNW_Quote_Helper_Salesforce_Cart2quote)
		 *       ...
		 */
		$_mapping = $observer->getData('mapping');

		/**
		 * Entity objects
		 * @var TNWMage_QuoteCustomer_Model_QqadvcustomerCustomer $_entity 
		 */
		$_entity = $observer->getData('entity');

		/**
		 * Additional entity objects
		 * @var null $_additional_object 
		 */
		$_additional_object = $observer->getData('additionalObject');

		// Your custom code
    }
 
}

...