Changeset 3678

Show
Ignore:
Timestamp:
01/30/08 00:25:55 (17 months ago)
Author:
guilhermeblanco
Message:

Merged changeset #3589 into 0.9 and 0.10 branches

Location:
branches
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/0.10/lib/Doctrine/Configurable.php

    r3441 r3678  
    6767     * 
    6868     * $manager->setAttribute('portability', Doctrine::PORTABILITY_ALL); 
     69     * 
     70     * // or 
     71     * 
     72     * $manager->setAttribute('portability', 'all'); 
    6973     * </code> 
    7074     * 
     
    7680     * @return void 
    7781     */ 
    78     public function setAttribute($attribute,$value) 
     82    public function setAttribute($attribute, $value) 
    7983    { 
    8084        if (is_string($attribute)) { 
    8185            $upper = strtoupper($attribute); 
    8286 
    83             $const = 'Doctrine::ATTR_' . $attribute; 
     87            $const = 'Doctrine::ATTR_' . $upper;  
     88 
    8489            if (defined($const)) { 
    85                 $this->_state = constant($const); 
     90                $attribute = constant($const); 
     91                $this->_state = $attribute; 
    8692            } else { 
    87                 throw new Doctrine_Exception('Unknown attribute ' . $attribute); 
    88             } 
    89         } 
     93                throw new Doctrine_Exception('Unknown attribute: "' . $attribute . '"'); 
     94            } 
     95        } 
     96 
     97        if (is_string($value) && isset($upper)) { 
     98            $const = 'Doctrine::' . $upper . '_' . strtoupper($value); 
     99 
     100            if (defined($const)) { 
     101                $value = constant($const); 
     102            } else { 
     103                throw new Doctrine_Exception('Unknown attribute value: "' . $value . '"'); 
     104            } 
     105        } 
     106 
    90107        switch ($attribute) { 
    91108            case Doctrine::ATTR_FETCHMODE: 
  • branches/0.9/lib/Doctrine/Configurable.php

    r3067 r3678  
    6767     * 
    6868     * $manager->setAttribute('portability', Doctrine::PORTABILITY_ALL); 
     69     * 
     70     * // or 
     71     * 
     72     * $manager->setAttribute('portability', 'all'); 
    6973     * </code> 
    7074     * 
     
    7680     * @return void 
    7781     */ 
    78     public function setAttribute($attribute,$value) 
     82    public function setAttribute($attribute, $value) 
    7983    { 
    8084        if (is_string($attribute)) { 
    8185            $upper = strtoupper($attribute); 
    8286 
    83             $const = 'Doctrine::ATTR_' . $attribute; 
     87            $const = 'Doctrine::ATTR_' . $upper;  
     88 
    8489            if (defined($const)) { 
    85                 $this->_state = constant($const); 
     90                $attribute = constant($const); 
     91                $this->_state = $attribute; 
    8692            } else { 
    87                 throw new Doctrine_Exception('Unknown attribute ' . $attribute); 
    88             } 
    89         } 
     93                throw new Doctrine_Exception('Unknown attribute: "' . $attribute . '"'); 
     94            } 
     95        } 
     96 
     97        if (is_string($value) && isset($upper)) { 
     98            $const = 'Doctrine::' . $upper . '_' . strtoupper($value); 
     99 
     100            if (defined($const)) { 
     101                $value = constant($const); 
     102            } else { 
     103                throw new Doctrine_Exception('Unknown attribute value: "' . $value . '"'); 
     104            } 
     105        } 
     106 
    90107        switch ($attribute) { 
    91108            case Doctrine::ATTR_FETCHMODE: 
    92                 throw new Doctrine_Exception('Deprecated attribute. See http://doctrine.pengus.net/doctrine/manual/new/?chapter=configuration'); 
     109                throw new Doctrine_Exception('Deprecated attribute. See http://www.phpdoctrine.org/documentation/manual?chapter=configuration'); 
    93110            case Doctrine::ATTR_LISTENER: 
    94111                $this->setEventListener($value);