Ejemplo n.º 1
0
 /**
  * Db tree constructor
  *
  * $fields = array(
  *      Varien_Data_Tree_Dbp::ID_FIELD       => string,
  *      Varien_Data_Tree_Dbp::PATH_FIELD     => string,
  *      Varien_Data_Tree_Dbp::ORDER_FIELD    => string
  * )
  *
  * @param Zend_Db_Adapter_Abstract $connection
  * @param string $table
  * @param array $fields
  */
 public function __construct($connection, $table, $fields)
 {
     parent::__construct();
     if (!$connection) {
         throw new Exception('Wrong "$connection" parametr');
     }
     $this->_conn = $connection;
     $this->_table = $table;
     if (!isset($fields[self::ID_FIELD]) || !isset($fields[self::PATH_FIELD]) || !isset($fields[self::ORDER_FIELD])) {
         throw new Exception('"$fields" tree configuratin array');
     }
     $this->_idField = $fields[self::ID_FIELD];
     $this->_pathField = $fields[self::PATH_FIELD];
     $this->_orderField = $fields[self::ORDER_FIELD];
     $this->_select = $this->_conn->select();
     $this->_select->from($this->_table);
 }