Changeset 4523 for trunk/lib/Doctrine
- Timestamp:
- 06/15/08 16:56:28 (7 months ago)
- Location:
- trunk/lib/Doctrine
- Files:
-
- 80 modified
-
Cache.php (modified) (1 diff)
-
ClassMetadata.php (modified) (32 diffs)
-
Collection.php (modified) (13 diffs)
-
Configurable.php (modified) (1 diff)
-
Configuration.php (modified) (7 diffs)
-
Connection.php (modified) (15 diffs)
-
Connection/Firebird.php (modified) (2 diffs)
-
Connection/Mysql.php (modified) (3 diffs)
-
Connection/Sqlite.php (modified) (3 diffs)
-
Connection/UnitOfWork.php (modified) (5 diffs)
-
ConnectionFactory.php (modified) (3 diffs)
-
Entity.php (modified) (99 diffs)
-
EntityManager.php (modified) (10 diffs)
-
EntityPersister/Abstract.php (modified) (9 diffs)
-
EntityPersister/JoinedSubclass.php (modified) (2 diffs)
-
EntityPersister/Standard.php (modified) (1 diff)
-
Event.php (modified) (1 diff)
-
EventManager.php (modified) (1 diff)
-
Formatter.php (modified) (2 diffs)
-
Hydrator/RecordDriver.php (modified) (4 diffs)
-
HydratorNew.php (modified) (12 diffs)
-
Lib.php (modified) (1 diff)
-
Query/Parser.php (modified) (1 diff)
-
Query/Printer.php (modified) (1 diff)
-
Query/Production.php (modified) (2 diffs)
-
Query/Production/AggregateExpression.php (modified) (2 diffs)
-
Query/Production/Atom.php (modified) (1 diff)
-
Query/Production/BetweenExpression.php (modified) (2 diffs)
-
Query/Production/ComparisonExpression.php (modified) (3 diffs)
-
Query/Production/ComparisonOperator.php (modified) (2 diffs)
-
Query/Production/ConditionalExpression.php (modified) (2 diffs)
-
Query/Production/ConditionalFactor.php (modified) (2 diffs)
-
Query/Production/ConditionalPrimary.php (modified) (2 diffs)
-
Query/Production/ConditionalTerm.php (modified) (2 diffs)
-
Query/Production/DeleteClause.php (modified) (2 diffs)
-
Query/Production/DeleteStatement.php (modified) (2 diffs)
-
Query/Production/ExistsExpression.php (modified) (2 diffs)
-
Query/Production/Expression.php (modified) (2 diffs)
-
Query/Production/Factor.php (modified) (2 diffs)
-
Query/Production/FieldIdentificationVariable.php (modified) (2 diffs)
-
Query/Production/FromClause.php (modified) (2 diffs)
-
Query/Production/Function.php (modified) (2 diffs)
-
Query/Production/GroupByClause.php (modified) (2 diffs)
-
Query/Production/GroupByItem.php (modified) (2 diffs)
-
Query/Production/HavingClause.php (modified) (2 diffs)
-
Query/Production/IdentificationVariable.php (modified) (2 diffs)
-
Query/Production/IdentificationVariableDeclaration.php (modified) (2 diffs)
-
Query/Production/IndexBy.php (modified) (2 diffs)
-
Query/Production/InExpression.php (modified) (2 diffs)
-
Query/Production/Join.php (modified) (2 diffs)
-
Query/Production/LikeExpression.php (modified) (2 diffs)
-
Query/Production/LimitClause.php (modified) (2 diffs)
-
Query/Production/NullComparisonExpression.php (modified) (2 diffs)
-
Query/Production/OffsetClause.php (modified) (2 diffs)
-
Query/Production/OrderByClause.php (modified) (2 diffs)
-
Query/Production/OrderByItem.php (modified) (2 diffs)
-
Query/Production/PathExpression.php (modified) (2 diffs)
-
Query/Production/PathExpressionEndingWithAsterisk.php (modified) (2 diffs)
-
Query/Production/Primary.php (modified) (2 diffs)
-
Query/Production/QuantifiedExpression.php (modified) (2 diffs)
-
Query/Production/QueryLanguage.php (modified) (1 diff)
-
Query/Production/RangeVariableDeclaration.php (modified) (2 diffs)
-
Query/Production/SelectClause.php (modified) (2 diffs)
-
Query/Production/SelectExpression.php (modified) (3 diffs)
-
Query/Production/SelectStatement.php (modified) (2 diffs)
-
Query/Production/SimpleConditionalExpression.php (modified) (2 diffs)
-
Query/Production/SimpleSelectClause.php (modified) (2 diffs)
-
Query/Production/Subselect.php (modified) (2 diffs)
-
Query/Production/Term.php (modified) (2 diffs)
-
Query/Production/UpdateClause.php (modified) (1 diff)
-
Query/Production/UpdateItem.php (modified) (2 diffs)
-
Query/Production/UpdateStatement.php (modified) (2 diffs)
-
Query/Production/VariableDeclaration.php (modified) (2 diffs)
-
Query/Production/WhereClause.php (modified) (2 diffs)
-
Query/ProductionParamHolder.php (modified) (1 diff)
-
Query/Scanner.php (modified) (2 diffs)
-
Query/SqlBuilder.php (modified) (2 diffs)
-
Query/SqlExecutor/SingleTableDeleteUpdate.php (modified) (1 diff)
-
Query/Token.php (modified) (1 diff)
-
Relation/LocalKey.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Doctrine/Cache.php
r4456 r4523 30 30 * @since 1.0 31 31 * @version $Revision$ 32 * @todo Can this be removed? 32 33 */ 33 34 class Doctrine_Cache extends Doctrine_EventListener implements Countable, IteratorAggregate -
trunk/lib/Doctrine/ClassMetadata.php
r4456 r4523 61 61 * @var Doctrine_Connection 62 62 */ 63 protected $_ conn;63 protected $_em; 64 64 65 65 /** … … 114 114 */ 115 115 protected $_generators = array(); 116 117 /**118 * An array containing all filters attached to the class.119 *120 * @see Doctrine_Record_Filter121 * @var array $_filters122 */123 protected $_filters = array();124 116 125 117 /** … … 157 149 */ 158 150 protected $_fieldNames = array(); 151 152 /** 153 * Enter description here... 154 * 155 * @var unknown_type 156 */ 157 protected $_attributes = array('loadReferences' => true); 159 158 160 159 /** … … 166 165 */ 167 166 protected $_columnNames = array(); 167 168 /** 169 * Enter description here... 170 * 171 * @var unknown_type 172 */ 173 protected $_subclassFieldNames = array(); 168 174 169 175 /** … … 279 285 $this->_entityName = $entityName; 280 286 $this->_rootEntityName = $entityName; 281 $this->_ conn= $em;287 $this->_em = $em; 282 288 $this->_parser = new Doctrine_Relation_Parser($this); 283 289 } … … 288 294 public function getConnection() 289 295 { 290 return $this->_ conn;296 return $this->_em; 291 297 } 292 298 293 299 public function getEntityManager() 294 300 { 295 return $this->_ conn;301 return $this->_em; 296 302 } 297 303 … … 349 355 public function isIdentifierComposite() 350 356 { 351 return ($this->_identifierType == Doctrine::IDENTIFIER_COMPOSITE);352 } 353 354 /** 355 * Check if the field is unique 357 return $this->_identifierType == Doctrine::IDENTIFIER_COMPOSITE; 358 } 359 360 /** 361 * Check if the field is unique. 356 362 * 357 363 * @param string $fieldName The field name … … 370 376 371 377 /** 372 * Check if the field is not null 378 * Check if the field is not null. 373 379 * 374 380 * @param string $fieldName The field name … … 392 398 * 393 399 * @return void 400 * @deprecated 401 * @todo Should be done through setTableOption(). 394 402 */ 395 403 public function addIndex($index, array $definition) … … 402 410 * 403 411 * @return array|boolean array on success, FALSE on failure 412 * @todo Should be done through getTableOption(). 413 * @deprecated 404 414 */ 405 415 public function getIndex($index) … … 425 435 public function setOption($name, $value) 426 436 { 427 /*switch ($name) {428 case 'tableName':429 case 'index':430 case 'sequenceName':431 case 'type':432 case 'charset':433 case 'collation':434 case 'collate':435 return $this->setTableOption($name, $value);436 case 'enumMap':437 $this->_enumMap = $value;438 return;439 }*/440 437 $this->_options[$name] = $value; 441 438 } … … 469 466 $this->_invokedMethods[$method] : false; 470 467 } 471 472 468 public function addBehaviorMethod($method, $behavior) 473 469 { … … 541 537 { 542 538 return isset($this->_mappedColumns[$columnName]) ? 543 $this->_mappedColumns[$columnName] : false;539 $this->_mappedColumns[$columnName] : false; 544 540 } 545 541 … … 556 552 { 557 553 return isset($this->_fieldNames[$columnName]) ? 558 $this->_fieldNames[$columnName] : $columnName; 559 } 560 561 private $_subclassFieldNames = array(); 554 $this->_fieldNames[$columnName] : $columnName; 555 } 562 556 563 557 /** … … 573 567 574 568 $classMetadata = $this; 575 $conn = $this->_ conn;569 $conn = $this->_em; 576 570 577 571 foreach ($classMetadata->getSubclasses() as $subClass) { … … 883 877 884 878 $columnName = $this->getColumnName($fieldName); 885 if ( ! $this->_ conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM) &&879 if ( ! $this->_em->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM) && 886 880 isset($this->_mappedColumns[$columnName]['values'][$index])) { 887 881 $enumValue = $this->_mappedColumns[$columnName]['values'][$index]; … … 905 899 $values = $this->getEnumValues($fieldName); 906 900 $index = array_search($value, $values); 907 if ($index === false || ! $this->_ conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) {901 if ($index === false || ! $this->_em->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) { 908 902 return $index; 909 903 } … … 1289 1283 { 1290 1284 if ($parentClassNames = $this->getParentClasses()) { 1291 if ($this->_ conn->getClassMetadata($parentClassNames[0])->getInheritanceType() != $type) {1285 if ($this->_em->getClassMetadata($parentClassNames[0])->getInheritanceType() != $type) { 1292 1286 throw new Doctrine_ClassMetadata_Exception("All classes in an inheritance hierarchy" 1293 1287 . " must share the same inheritance mapping type. Mixing is not allowed."); … … 1389 1383 public function export() 1390 1384 { 1391 $this->_ conn->export->exportTable($this);1385 $this->_em->export->exportTable($this); 1392 1386 } 1393 1387 … … 1410 1404 $parents = $this->getParentClasses(); 1411 1405 if ($parents) { 1412 $rootClass = $this->_ conn->getClassMetadata(array_pop($parents));1406 $rootClass = $this->_em->getClassMetadata(array_pop($parents)); 1413 1407 } else { 1414 1408 $rootClass = $this; … … 1416 1410 $subClasses = $rootClass->getSubclasses(); 1417 1411 foreach ($subClasses as $subClass) { 1418 $subClassMetadata = $this->_ conn->getClassMetadata($subClass);1412 $subClassMetadata = $this->_em->getClassMetadata($subClass); 1419 1413 $allColumns = array_merge($allColumns, $subClassMetadata->getColumns()); 1420 1414 } … … 1455 1449 case 'boolean': 1456 1450 if (isset($definition['default'])) { 1457 $definition['default'] = $this->_ conn->convertBooleans($definition['default']);1451 $definition['default'] = $this->_em->convertBooleans($definition['default']); 1458 1452 } 1459 1453 break; … … 1610 1604 1611 1605 /** 1612 * unshiftFilter1613 *1614 * @param object Doctrine_Record_Filter $filter1615 * @return object $this1616 * @todo Remove filters, if possible.1617 */1618 public function unshiftFilter(Doctrine_Record_Filter $filter)1619 {1620 $filter->setTable($this);1621 array_unshift($this->_filters, $filter);1622 1623 return $this;1624 }1625 1626 /**1627 1606 * getTree 1628 1607 * … … 1659 1638 1660 1639 /** 1661 * getFilters1662 *1663 * @return array $filters1664 * @todo Remove filters, if possible.1665 */1666 public function getFilters()1667 {1668 return $this->_filters;1669 }1670 1671 /**1672 1640 * Checks whether a persistent field is inherited from a superclass. 1673 1641 * … … 1727 1695 public function setTableName($tableName) 1728 1696 { 1729 $this->setTableOption('tableName', $this->_ conn->getConnection()1730 -> formatter->getTableName($tableName));1697 $this->setTableOption('tableName', $this->_em->getConnection() 1698 ->getFormatter()->getTableName($tableName)); 1731 1699 } 1732 1700 … … 1741 1709 { 1742 1710 //$contents = get_object_vars($this); 1743 /* @TODO How to handle $this->_ connand $this->_parser ? */1711 /* @TODO How to handle $this->_em and $this->_parser ? */ 1744 1712 //return serialize($contents); 1745 1713 return ""; … … 1835 1803 * @return Doctrine_Entity this object 1836 1804 * @todo Should be done through $_tableOptions 1805 * @deprecated 1837 1806 */ 1838 1807 public function check($constraint, $name = null) … … 1848 1817 return $this; 1849 1818 } 1850 1851 1819 protected function _addCheckConstraint($definition, $name) 1852 1820 { … … 1857 1825 } 1858 1826 } 1859 1860 /**1861 * Registers a custom mapper for the entity class.1862 *1863 * @param string $mapperClassName The class name of the custom mapper.1864 * @deprecated1865 */1866 public function setCustomMapperClass($mapperClassName)1867 {1868 if ( ! is_subclass_of($mapperClassName, 'Doctrine_Mapper')) {1869 throw new Doctrine_ClassMetadata_Exception("The custom mapper must be a subclass"1870 . " of Doctrine_Mapper.");1871 }1872 $this->_customRepositoryClassName = $mapperClassName;1873 }1874 1827 1875 1828 /** … … 1887 1840 $this->_customRepositoryClassName = $repositoryClassName; 1888 1841 } 1889 1890 /**1891 * Gets the name of the custom mapper class used for the entity class.1892 *1893 * @return string|null The name of the custom mapper class or NULL if the entity1894 * class does not have a custom mapper class.1895 * @deprecated1896 */1897 public function getCustomMapperClass()1898 {1899 return $this->_customRepositoryClassName;1900 }1901 1842 1843 /** 1844 * Gets the name of the custom repository class used for the entity class. 1845 * 1846 * @return string|null The name of the custom repository class or NULL if the entity 1847 * class does not have a custom repository class. 1848 */ 1902 1849 public function getCustomRepositoryClass() 1903 1850 { … … 1910 1857 public function setEntityType($type) 1911 1858 { 1912 //Doctrine::CLASSTYPE_ENTITY 1913 //Doctrine::CLASSTYPE_MAPPED_SUPERCLASS 1914 //Doctrine::CLASSTYPE_TRANSIENT 1915 } 1916 1917 /** 1918 * 1859 //Entity::TYPE_ENTITY 1860 //Entity::TYPE_MAPPED_SUPERCLASS 1861 //Entity::TYPE_TRANSIENT 1862 } 1863 1864 /** 1865 * Binds the entity instance of this class to a specific EntityManager. 1866 * 1919 1867 * @todo Implementation. Replaces the bindComponent() methods on the old Doctrine_Manager. 1920 1868 * Binding an Entity to a specific EntityManager in 2.0 is the same as binding … … 1975 1923 public function hasAttribute($name) 1976 1924 { 1977 return false;1925 return isset($this->_attributes[$name]); 1978 1926 } 1979 1927 1980 1928 public function getAttribute($name) 1981 1929 { 1982 return null; 1930 if ($this->hasAttribute($name)) { 1931 return $this->_attributes[$name]; 1932 } 1983 1933 } 1984 1934 1985 1935 public function setAttribute($name, $value) 1986 1936 { 1987 ; 1937 if ($this->hasAttribute($name)) { 1938 $this->_attributes[$name] = $value; 1939 } 1988 1940 } 1989 1941 -
trunk/lib/Doctrine/Collection.php
r4470 r4523 98 98 /** 99 99 * Constructor. 100 * Creates a new collection that will hold instances of the type that is101 * specified through the mapper. That means if the mapper is a mapper for102 * the entity "User", then the resulting collection will be a collection of103 * user objects.104 100 * 105 101 * @param Doctrine_Mapper|string $mapper The mapper used by the collection. … … 121 117 122 118 if ($keyField === null) { 123 $keyField = $mapper->getClassMetadata()->getAttribute(Doctrine::ATTR_COLL_KEY);119 //$keyField = $mapper->getClassMetadata()->getAttribute(Doctrine::ATTR_COLL_KEY); 124 120 } 125 121 … … 367 363 * @param mixed $key the key of the element 368 364 * @return boolean 365 * @todo Rename to containsKey(). 369 366 */ 370 367 public function contains($key) … … 433 430 * 434 431 * @return array An array containing all primary keys. 432 * @todo Rename. 435 433 */ 436 434 public function getPrimaryKeys() … … 627 625 foreach ($coll as $k => $related) { 628 626 if ($related[$foreign] == $record[$local]) { 629 $this->data[$key]-> setRelated($name, $related);627 $this->data[$key]->_setRelated($name, $related); 630 628 } 631 629 } … … 645 643 } 646 644 647 $this->data[$key]-> setRelated($name, $sub);645 $this->data[$key]->_setRelated($name, $sub); 648 646 } 649 647 } else if ($rel instanceof Doctrine_Relation_Association) { … … 664 662 } 665 663 } 666 $this->data[$key]-> setRelated($name, $sub);664 $this->data[$key]->_setRelated($name, $sub); 667 665 668 666 } … … 800 798 * @param string $deep 801 799 * @return void 800 * @todo Move elsewhere. 802 801 */ 803 802 public function exportTo($type, $deep = false) … … 818 817 * @param string $data 819 818 * @return void 819 * @todo Move elsewhere. 820 820 */ 821 821 public function importFrom($type, $data) … … 869 869 * @return Doctrine_Collection 870 870 */ 871 public function save(Doctrine_Connection $conn = null) 872 { 873 if ($conn == null) { 874 $conn = $this->_mapper->getConnection(); 875 } 871 public function save() 872 { 873 $conn = $this->_mapper->getConnection(); 876 874 877 875 try { … … 894 892 895 893 /** 896 * delete 897 * single shot delete 898 * deletes all records from this collection 899 * and uses only one database query to perform this operation 900 * 901 * @return Doctrine_Collection 902 */ 903 public function delete(Doctrine_Connection $conn = null) 904 { 905 if ($conn == null) { 906 $conn = $this->_mapper->getConnection(); 907 } 894 * Deletes all records from the collection. 895 * 896 * @return void 897 */ 898 public function delete($clearColl = false) 899 { 900 $conn = $this->_mapper->getConnection(); 908 901 909 902 try { … … 920 913 throw $e; 921 914 }