/**
  * returns the value of an attribute
  *
  * @param integer $attribute
  * @return mixed
  */
 public function getAttribute($attribute)
 {
     if (isset($this->attributes[$attribute])) {
         return $this->attributes[$attribute];
     }
     if (isset($this->parent)) {
         return $this->parent->getAttribute($attribute);
     }
     return null;
 }
Beispiel #2
0
 /**
  * returns the value of an attribute
  *
  * @param integer $attribute
  * @return mixed
  */
 public function getAttribute($attribute)
 {
     $attribute = (int) $attribute;
     if ($attribute < 0) {
         throw new Doctrine_Exception('Unknown attribute.');
     }
     if (isset($this->attributes[$attribute])) {
         return $this->attributes[$attribute];
     }
     if (isset($this->parent)) {
         return $this->parent->getAttribute($attribute);
     }
     return null;
 }
 /**
  * returns the value of an attribute
  *
  * @param integer $attribute
  * @return mixed
  */
 public function getAttribute($attribute)
 {
     if (is_string($attribute)) {
         $upper = strtoupper($attribute);
         $const = 'Doctrine::ATTR_' . $upper;
         if (defined($const)) {
             $attribute = constant($const);
             $this->_state = $attribute;
         } else {
             throw new Doctrine_Exception('Unknown attribute: "' . $attribute . '"');
         }
     }
     $attribute = (int) $attribute;
     if ($attribute < 0) {
         throw new Doctrine_Exception('Unknown attribute.');
     }
     if (isset($this->attributes[$attribute])) {
         return $this->attributes[$attribute];
     }
     if (isset($this->parent)) {
         return $this->parent->getAttribute($attribute);
     }
     return null;
 }
 /**
  * getAttribute
  * retrieves a database connection attribute
  *
  * @param integer $attribute
  * @return mixed
  */
 public function getAttribute($attribute)
 {
     if ($attribute >= 100 && $attribute < 1000) {
         if (!isset($this->attributes[$attribute])) {
             return parent::getAttribute($attribute);
         }
         return $this->attributes[$attribute];
     }
     if ($this->isConnected) {
         try {
             return $this->dbh->getAttribute($attribute);
         } catch (Exception $e) {
             throw new Doctrine_Connection_Exception('Attribute ' . $attribute . ' not found.');
         }
     } else {
         if (!isset($this->pendingAttributes[$attribute])) {
             $this->connect();
             $this->getAttribute($attribute);
         }
         return $this->pendingAttributes[$attribute];
     }
 }