Changeset 3678
- Timestamp:
- 01/30/08 00:25:55 (17 months ago)
- Location:
- branches
- Files:
-
- 2 modified
-
0.10/lib/Doctrine/Configurable.php (modified) (2 diffs)
-
0.9/lib/Doctrine/Configurable.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.10/lib/Doctrine/Configurable.php
r3441 r3678 67 67 * 68 68 * $manager->setAttribute('portability', Doctrine::PORTABILITY_ALL); 69 * 70 * // or 71 * 72 * $manager->setAttribute('portability', 'all'); 69 73 * </code> 70 74 * … … 76 80 * @return void 77 81 */ 78 public function setAttribute($attribute, $value)82 public function setAttribute($attribute, $value) 79 83 { 80 84 if (is_string($attribute)) { 81 85 $upper = strtoupper($attribute); 82 86 83 $const = 'Doctrine::ATTR_' . $attribute; 87 $const = 'Doctrine::ATTR_' . $upper; 88 84 89 if (defined($const)) { 85 $this->_state = constant($const); 90 $attribute = constant($const); 91 $this->_state = $attribute; 86 92 } 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 90 107 switch ($attribute) { 91 108 case Doctrine::ATTR_FETCHMODE: -
branches/0.9/lib/Doctrine/Configurable.php
r3067 r3678 67 67 * 68 68 * $manager->setAttribute('portability', Doctrine::PORTABILITY_ALL); 69 * 70 * // or 71 * 72 * $manager->setAttribute('portability', 'all'); 69 73 * </code> 70 74 * … … 76 80 * @return void 77 81 */ 78 public function setAttribute($attribute, $value)82 public function setAttribute($attribute, $value) 79 83 { 80 84 if (is_string($attribute)) { 81 85 $upper = strtoupper($attribute); 82 86 83 $const = 'Doctrine::ATTR_' . $attribute; 87 $const = 'Doctrine::ATTR_' . $upper; 88 84 89 if (defined($const)) { 85 $this->_state = constant($const); 90 $attribute = constant($const); 91 $this->_state = $attribute; 86 92 } 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 90 107 switch ($attribute) { 91 108 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'); 93 110 case Doctrine::ATTR_LISTENER: 94 111 $this->setEventListener($value);