Mage_Customer_Model_Entity_Customer_Collection Class Reference

Inheritance diagram for Mage_Customer_Model_Entity_Customer_Collection:

Mage_Eav_Model_Entity_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection Mage_ProductAlert_Model_Mysql4_Price_Customer_Collection Mage_ProductAlert_Model_Mysql4_Stock_Customer_Collection Mage_Reports_Model_Mysql4_Customer_Collection Mage_Tag_Model_Entity_Customer_Collection Mage_Tag_Model_Mysql4_Customer_Collection Mage_Reports_Model_Mysql4_Accounts_Collection Mage_Reports_Model_Mysql4_Tag_Customer_Collection

List of all members.

Public Member Functions

 groupByEmail ()
 addNameToSelect ()
 getSelectCountSql ()
 getAllIds ($limit=null, $offset=null)

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 34 of file Collection.php.


Member Function Documentation

_construct (  )  [protected]

Initialize collection

Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.

Definition at line 36 of file Collection.php.

00037     {
00038         $this->_init('customer/customer');
00039     }

addNameToSelect (  ) 

Definition at line 52 of file Collection.php.

00053     {
00054         $fields = array();
00055         foreach (Mage::getConfig()->getFieldset('customer_account') as $code=>$node) {
00056             if ($node->is('name')) {
00057                 //$this->addAttributeToSelect($code);
00058                 $fields[$code] = $code;
00059             }
00060         }
00061 
00062         $expr = 'CONCAT('
00063             .(isset($fields['prefix']) ? 'IF({{prefix}} IS NOT NULL AND {{prefix}} != "", CONCAT({{prefix}}," "), ""),' : '')
00064             .'{{firstname}}'.(isset($fields['middlename']) ?  ',IF({{middlename}} IS NOT NULL AND {{middlename}} != "", CONCAT(" ",{{middlename}}), "")' : '').'," ",{{lastname}}'
00065             .(isset($fields['suffix']) ? ',IF({{suffix}} IS NOT NULL AND {{suffix}} != "", CONCAT(" ",{{suffix}}), "")' : '')
00066         .')';
00067 
00068         $this->addExpressionAttributeToSelect('name', $expr, $fields);
00069         return $this;
00070     }

getAllIds ( limit = null,
offset = null 
)

Retrive all ids for collection

Returns:
array

Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.

Definition at line 98 of file Collection.php.

00099     {
00100         $idsSelect = clone $this->getSelect();
00101         $idsSelect->reset(Zend_Db_Select::ORDER);
00102         $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT);
00103         $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
00104         $idsSelect->reset(Zend_Db_Select::COLUMNS);
00105         $idsSelect->from(null, 'e.'.$this->getEntity()->getIdFieldName());
00106         $idsSelect->limit($limit, $offset);
00107         $idsSelect->resetJoinLeft();
00108 
00109         return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams);
00110     }

getSelectCountSql (  ) 

Get SQL for get record count

Returns:
Varien_Db_Select

Reimplemented from Varien_Data_Collection_Db.

Reimplemented in Mage_Reports_Model_Mysql4_Customer_Collection, Mage_Reports_Model_Mysql4_Tag_Customer_Collection, and Mage_Tag_Model_Mysql4_Customer_Collection.

Definition at line 77 of file Collection.php.

00078     {
00079         $this->_renderFilters();
00080 
00081         $countSelect = clone $this->getSelect();
00082         $countSelect->reset(Zend_Db_Select::ORDER);
00083         $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
00084         $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
00085         $countSelect->reset(Zend_Db_Select::COLUMNS);
00086 
00087         $countSelect->from('', 'COUNT(*)');
00088         $countSelect->resetJoinLeft();
00089 
00090         return $countSelect;
00091     }

groupByEmail (  ) 

Definition at line 41 of file Collection.php.

00042     {
00043         $this->getSelect()
00044             ->from(array('email'=>$this->getEntity()->getEntityTable()),
00045                 array('email_count'=>new Zend_Db_Expr('COUNT(email.entity_id)'))
00046             )
00047             ->where('email.entity_id=e.entity_id')
00048             ->group('email.email');
00049         return $this;
00050     }


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

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