Mage_Core_Model_Mysql4_Website_Collection Class Reference

Inheritance diagram for Mage_Core_Model_Mysql4_Website_Collection:

Mage_Core_Model_Mysql4_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection

List of all members.

Public Member Functions

 addIdFilter ($ids)
 setLoadDefault ($loadDefault)
 getLoadDefault ()
 toOptionArray ()
 toOptionHash ()
 load ($printQuery=false, $logQuery=false)
 joinGroupAndStore ()

Protected Member Functions

 _construct ()

Protected Attributes

 $_loadDefault = false
 $_map = array('fields' => array('website_id' => 'main_table.website_id'))


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 40 of file Collection.php.

00041     {
00042         $this->_init('core/website');
00043     }

addIdFilter ( ids  ) 

Definition at line 45 of file Collection.php.

00046     {
00047         if (is_array($ids)) {
00048             if (empty($ids)) {
00049                 $this->addFieldToFilter('website_id', null);
00050             }
00051             else {
00052                 $this->addFieldToFilter('website_id', array('in'=>$ids));
00053             }
00054         }
00055         else {
00056             $this->addFieldToFilter('website_id', $ids);
00057         }
00058         return $this;
00059     }

getLoadDefault (  ) 

Definition at line 67 of file Collection.php.

00068     {
00069         return $this->_loadDefault;
00070     }

joinGroupAndStore (  ) 

Definition at line 94 of file Collection.php.

00095     {
00096         $this->_idFieldName = 'website_group_store';
00097         $this->getSelect()->joinLeft(
00098             array('group_table' => $this->getTable('core/store_group')),
00099             'main_table.website_id=group_table.website_id',
00100             array('group_id'=>'group_id', 'group_title'=>'name')
00101         )->joinLeft(
00102             array('store_table' => $this->getTable('core/store')),
00103             'group_table.group_id=store_table.group_id',
00104             array('store_id'=>'store_id', 'store_title'=>'name')
00105         );
00106         $this->addOrder('group_table.name', 'ASC')       // store name
00107             ->addOrder('CASE WHEN store_table.store_id = 0 THEN 0 ELSE 1 END', 'ASC') // view is admin
00108             ->addOrder('store_table.sort_order', 'ASC') // view sort order
00109             ->addOrder('store_table.name', 'ASC')       // view name
00110         ;
00111         return $this;
00112     }

load ( printQuery = false,
logQuery = false 
)

Load data

Returns:
Varien_Data_Collection_Db

Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.

Definition at line 82 of file Collection.php.

00083     {
00084         if (!$this->getLoadDefault()) {
00085             $this->getSelect()->where($this->getConnection()->quoteInto('main_table.website_id>?', 0));
00086         }
00087         $this->unshiftOrder('main_table.name', 'ASC')       // website name SECOND
00088             ->unshiftOrder('main_table.sort_order', 'ASC') // website sort order FIRST
00089         ;
00090         parent::load($printQuery, $logQuery);
00091         return $this;
00092     }

setLoadDefault ( loadDefault  ) 

Definition at line 61 of file Collection.php.

00062     {
00063         $this->_loadDefault = $loadDefault;
00064         return $this;
00065     }

toOptionArray (  ) 

Reimplemented from Varien_Data_Collection.

Definition at line 72 of file Collection.php.

00073     {
00074         return $this->_toOptionArray('website_id', 'name');
00075     }

toOptionHash (  ) 

Reimplemented from Varien_Data_Collection.

Definition at line 77 of file Collection.php.

00078     {
00079         return $this->_toOptionHash('website_id', 'name');
00080     }


Member Data Documentation

$_loadDefault = false [protected]

Definition at line 36 of file Collection.php.

$_map = array('fields' => array('website_id' => 'main_table.website_id')) [protected]

Reimplemented from Varien_Data_Collection_Db.

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:23:59 2009 for Magento by  doxygen 1.5.8