Changeset 4852
- Timestamp:
- 08/27/08 20:26:49 (10 months ago)
- Location:
- branches/1.0
- Files:
-
- 1 added
- 5 modified
-
lib/Doctrine.php (modified) (1 diff)
-
lib/Doctrine/Configurable.php (modified) (1 diff)
-
lib/Doctrine/Manager.php (modified) (1 diff)
-
lib/Doctrine/Record.php (modified) (3 diffs)
-
tests/run.php (modified) (1 diff)
-
tests/Ticket/1077TestCase.php (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/lib/Doctrine.php
r4847 r4852 196 196 const ATTR_RECURSIVE_MERGE_FIXTURES = 162; 197 197 const ATTR_USE_DQL_CALLBACKS = 164; 198 const ATTR_AUTO_ACCESSOR_OVERRIDE = 165; 198 199 199 200 /** -
branches/1.0/lib/Doctrine/Configurable.php
r4682 r4852 182 182 case Doctrine::ATTR_RECURSIVE_MERGE_FIXTURES; 183 183 case Doctrine::ATTR_USE_DQL_CALLBACKS; 184 case Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE; 184 185 185 186 break; -
branches/1.0/lib/Doctrine/Manager.php
r4845 r4852 103 103 Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES => false, 104 104 Doctrine::ATTR_USE_DQL_CALLBACKS => false, 105 Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE => false, 105 106 ); 106 107 foreach ($attributes as $attribute => $value) { -
branches/1.0/lib/Doctrine/Record.php
r4826 r4852 139 139 140 140 /** 141 * Array of custom accessors for cache 142 * 143 * @var array 144 */ 145 protected static $_customAccessors = array(); 146 147 /** 148 * Array of custom mutators for cache 149 * 150 * @var array 151 */ 152 protected static $_customMutators = array(); 153 154 /** 141 155 * @var integer $index this index is used for creating object identifiers 142 156 */ … … 893 907 public function get($fieldName, $load = true) 894 908 { 909 if ($this->_table->getAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE)) { 910 $componentName = $this->_table->getComponentName(); 911 $accessor = isset(self::$_customAccessors[$componentName][$fieldName]) ? self::$_customAccessors[$componentName][$fieldName]:'get' . Doctrine_Inflector::classify($fieldName); 912 if (isset(self::$_customAccessors[$componentName][$fieldName]) || method_exists($this, $accessor)) { 913 self::$_customAccessors[$componentName][$fieldName] = $accessor; 914 return $this->$accessor($load); 915 } 916 } 917 return $this->_get($fieldName, $load); 918 } 919 920 protected function _get($fieldName, $load = true) 921 { 895 922 $value = self::$_null; 896 923 … … 960 987 */ 961 988 public function set($fieldName, $value, $load = true) 989 { 990 if ($this->_table->getAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE)) { 991 $componentName = $this->_table->getComponentName(); 992 $mutator = isset(self::$_customMutators[$componentName][$fieldName]) ? self::$_customMutators[$componentName][$fieldName]:'set' . Doctrine_Inflector::classify($fieldName); 993 if (isset(self::$_customMutators[$componentName][$fieldName]) || method_exists($this, $mutator)) { 994 self::$_customMutators[$componentName][$fieldName] = $mutator; 995 return $this->$mutator($value, $load); 996 } 997 } 998 return $this->_set($fieldName, $value, $load); 999 } 1000 1001 protected function _set($fieldName, $value, $load = true) 962 1002 { 963 1003 if (isset($this->_data[$fieldName])) { -
branches/1.0/tests/run.php
r4845 r4852 82 82 $tickets->addTestCase(new Doctrine_Ticket_1071_TestCase()); 83 83 $tickets->addTestCase(new Doctrine_Ticket_1072_TestCase()); 84 $tickets->addTestCase(new Doctrine_Ticket_1077_TestCase()); 84 85 $tickets->addTestCase(new Doctrine_Ticket_1099_TestCase()); 85 86 $tickets->addTestCase(new Doctrine_Ticket_1106_TestCase());