Mage_Newsletter_Model_Mysql4_Problem_Collection Class Reference

Inheritance diagram for Mage_Newsletter_Model_Mysql4_Problem_Collection:

Mage_Core_Model_Mysql4_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 addSubscriberInfo ()
 addQueueInfo ()
 load ($printQuery=false, $logQuery=false)

Protected Member Functions

 _construct ()
 _addCustomersData ()

Protected Attributes

 $_subscribersInfoJoinedFlag = false
 $_problemGrouped = false


Detailed Description

Definition at line 35 of file Collection.php.


Member Function Documentation

_addCustomersData (  )  [protected]

Loads customers info to collection

Definition at line 71 of file Collection.php.

00072     {
00073         $customersIds = array();
00074 
00075         foreach ($this->getItems() as $item) {
00076             if($item->getCustomerId()) {
00077                 $customersIds[] = $item->getCustomerId();
00078             }
00079         }
00080 
00081         if(count($customersIds) == 0) {
00082             return;
00083         }
00084 
00085         $customers = Mage::getResourceModel('customer/customer_collection')
00086             ->addNameToSelect()
00087             ->addAttributeToFilter('entity_id', array("in"=>$customersIds));
00088 
00089         $customers->load();
00090 
00091         foreach($customers->getItems() as $customer) {
00092             $problems = $this->getItemsByColumnValue('customer_id', $customer->getId());
00093             foreach ($problems as $problem) {
00094                 $problem->setCustomerName($customer->getName())
00095                     ->setCustomerFirstName($customer->getFirstName())
00096                     ->setCustomerLastName($customer->getLastName());
00097             }
00098         }
00099 
00100     }

_construct (  )  [protected]

Initialization here

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 41 of file Collection.php.

00042     {
00043         $this->_init('newsletter/problem');
00044     }

addQueueInfo (  ) 

Definition at line 56 of file Collection.php.

00057     {
00058         $this->getSelect()
00059             ->joinLeft(array('queue'=>$this->getTable('queue')),'main_table.queue_id = queue.queue_id',
00060                        array('queue_start_at', 'queue_finish_at'))
00061             ->joinLeft(array('template'=>$this->getTable('template')),'main_table.queue_id = queue.queue_id',
00062                        array('template_subject','template_code','template_sender_name','template_sender_email'));
00063         return $this;
00064     }

addSubscriberInfo (  ) 

Definition at line 46 of file Collection.php.

00047     {
00048         $this->getSelect()
00049             ->joinLeft(array('subscriber'=>$this->getTable('subscriber')),'main_table.subscriber_id = subscriber.subscriber_id',
00050                        array('subscriber_email','customer_id','subscriber_status'));
00051         $this->_subscribersInfoJoinedFlag = true;
00052 
00053         return $this;
00054     }

load ( printQuery = false,
logQuery = false 
)

Load data

Returns:
Varien_Data_Collection_Db

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 102 of file Collection.php.

00103     {
00104         parent::load($printQuery, $logQuery);
00105         if($this->_subscribersInfoJoinedFlag && !$this->isLoaded()) {
00106             $this->_addCustomersData();
00107         }
00108         return $this;
00109     }


Member Data Documentation

$_problemGrouped = false [protected]

Definition at line 39 of file Collection.php.

$_subscribersInfoJoinedFlag = false [protected]

Definition at line 38 of file Collection.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:29 2009 for Magento by  doxygen 1.5.8