Mage_Core_Model_Mysql4_Store_Collection Class Reference

Inheritance diagram for Mage_Core_Model_Mysql4_Store_Collection:

Mage_Core_Model_Mysql4_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 setLoadDefault ($loadDefault)
 getLoadDefault ()
 setWithoutDefaultFilter ()
 addGroupFilter ($groupId)
 addIdFilter ($store)
 addWebsiteFilter ($website)
 addCategoryFilter ($category)
 toOptionArray ()
 toOptionHash ()
 load ($printQuery=false, $logQuery=false)
 loadByCategoryIds (array $categories)
 addRootCategoryIdAttribute ()

Protected Member Functions

 _construct ()

Protected Attributes

 $_loadDefault = false


Detailed Description

Definition at line 34 of file Collection.php.


Member Function Documentation

_construct (  )  [protected]

Initialization here

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 38 of file Collection.php.

00039     {
00040         $this->_init('core/store');
00041     }

addCategoryFilter ( category  ) 

Add root category id filter to store collection

Parameters:
int|array $category
Returns:
Mage_Core_Model_Mysql4_Store_Collection

Definition at line 99 of file Collection.php.

00100     {
00101         if (!is_array($category)) {
00102             $category = array($category);
00103         }
00104         return $this->loadByCategoryIds($category);
00105     }

addGroupFilter ( groupId  ) 

Definition at line 60 of file Collection.php.

00061     {
00062         $condition = $this->getConnection()->quoteInto("main_table.group_id=?", $groupId);
00063         $this->addFilter('group_id', $condition, 'string');
00064         return $this;
00065     }

addIdFilter ( store  ) 

Definition at line 67 of file Collection.php.

00068     {
00069         if (is_array($store)) {
00070             $condition = $this->getConnection()->quoteInto("main_table.store_id IN (?)", $store);
00071         }
00072         else {
00073             $condition = $this->getConnection()->quoteInto("main_table.store_id=?",$store);
00074         }
00075 
00076         $this->addFilter('store_id', $condition, 'string');
00077         return $this;
00078     }

addRootCategoryIdAttribute (  ) 

Definition at line 148 of file Collection.php.

00149     {
00150         $this->_select->joinLeft(
00151             array('group_table' => $this->getTable('core/store_group')),
00152             'main_table.group_id=group_table.group_id',
00153             array('root_category_id')
00154         );
00155         return $this;
00156     }

addWebsiteFilter ( website  ) 

Definition at line 80 of file Collection.php.

00081     {
00082         if (is_array($website)) {
00083             $condition = $this->getConnection()->quoteInto("main_table.website_id IN (?)", $website);
00084         }
00085         else {
00086             $condition = $this->getConnection()->quoteInto("main_table.website_id=?",$website);
00087         }
00088 
00089         $this->addFilter('website_id', $condition, 'string');
00090         return $this;
00091     }

getLoadDefault (  ) 

Definition at line 49 of file Collection.php.

00050     {
00051         return $this->_loadDefault;
00052     }

load ( printQuery = false,
logQuery = false 
)

Load data

Returns:
Varien_Data_Collection_Db

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 117 of file Collection.php.

00118     {
00119         if (!$this->getLoadDefault()) {
00120             $this->getSelect()->where($this->getConnection()->quoteInto('main_table.store_id>?', 0));
00121         }
00122         $this->addOrder('CASE WHEN main_table.store_id = 0 THEN 0 ELSE 1 END', 'ASC')
00123             ->addOrder('main_table.sort_order', 'ASC')
00124             ->addOrder('main_table.name', 'ASC');
00125         parent::load($printQuery, $logQuery);
00126         return $this;
00127     }

loadByCategoryIds ( array categories  ) 

Add root category id filter to store collection

Parameters:
array $categories
Returns:
Mage_Core_Model_Mysql4_Store_Collection

Definition at line 135 of file Collection.php.

00136     {
00137         $this->setLoadDefault(true);
00138         $condition = $this->getConnection()->quoteInto('group_table.root_category_id IN(?)', $categories);
00139         $this->_select->joinLeft(
00140             array('group_table' => $this->getTable('core/store_group')),
00141             'main_table.group_id=group_table.group_id',
00142             array('root_category_id')
00143         )->where($condition);
00144 
00145         return $this;
00146     }

setLoadDefault ( loadDefault  ) 

Definition at line 43 of file Collection.php.

00044     {
00045         $this->_loadDefault = $loadDefault;
00046         return $this;
00047     }

setWithoutDefaultFilter (  ) 

Definition at line 54 of file Collection.php.

00055     {
00056         $this->getSelect()->where($this->getConnection()->quoteInto('main_table.store_id>?', 0));
00057         return $this;
00058     }

toOptionArray (  ) 

Reimplemented from Varien_Data_Collection.

Definition at line 107 of file Collection.php.

00108     {
00109         return $this->_toOptionArray('store_id', 'name');
00110     }

toOptionHash (  ) 

Reimplemented from Varien_Data_Collection.

Definition at line 112 of file Collection.php.

00113     {
00114         return $this->_toOptionHash('store_id', 'name');
00115     }


Member Data Documentation

$_loadDefault = false [protected]

Definition at line 36 of file Collection.php.


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

Generated on Sat Jul 4 17:23:59 2009 for Magento by  doxygen 1.5.8