From f2e9aa91b9dcd4230e59b4eb4af60c9f8d1075c9 Mon Sep 17 00:00:00 2001 From: jwage Date: Sat, 14 Feb 2009 22:45:08 +0000 Subject: [PATCH] [2.0] Cleaning up old stuff. --- CHANGELOG | 19 - README | 0 docs/manual/en.txt | 1 + .../manual/en/query-language.txt | 0 manual/docs/.htaccess | 1 - manual/docs/en.txt | 28 - ...iguration - Custom getters and setters.php | 22 - ...figuration - Custom primary key column.php | 10 - .../Configuration - List of attributes.php | 51 - ...ration - Setting default eventlistener.php | 11 - ...figuration - Setting default fetchmode.php | 12 - .../Configuration - Using sequences.php | 10 - ...Query Language) - Functions - Contains.php | 8 - ...ine Query Language) - Functions - Like.php | 8 - ...e Query Language) - Functions - Regexp.php | 8 - ...guage) - Operators - Logical operators.php | 167 - ...Database operations - Limit and offset.php | 8 - ...abase operations - Nested transactions.php | 18 - .../Database operations - Query logging.php | 16 - .../Database operations - Sequences.php | 8 - .../Database operations - Transactions.php | 15 - ... Relations - Composites and aggregates.php | 14 - ...Runtime classes - Doctrine_Association.php | 1 - .../Runtime classes - Doctrine_Collection.php | 1 - ...me classes - Doctrine_Collection_Batch.php | 1 - ...lasses - Doctrine_Collection_Immediate.php | 1 - ...ime classes - Doctrine_Collection_Lazy.php | 1 - .../Runtime classes - Doctrine_ForeignKey.php | 1 - .../Runtime classes - Doctrine_Manager.php | 2 - .../Runtime classes - Doctrine_Record.php | 43 - .../Runtime classes - Doctrine_Session.php | 34 - .../Runtime classes - Doctrine_Table.php | 2 - .../Schema reference - Data types - Array.php | 1 - ...eference - Foreign keys - Introduction.php | 2 - ...iew - Collection - Fetching strategies.php | 124 - ...overview - Query - Aggregate functions.php | 16 - ...nt overview - Query - Bound parameters.php | 7 - ...verview - Query - DQL - SQL conversion.php | 63 - ...overview - Query - Fetching strategies.php | 26 - ...rview - Query - Lazy property fetching.php | 7 - ... overview - Query - Method overloading.php | 22 - ... overview - Query - Relation operators.php | 27 - ...ent overview - Record - Adding records.php | 3 - manual/docs/en/basic-schema-mapping.txt | 7 - .../docs/en/basic-schema-mapping/columns.txt | 5 - .../columns/column-aliases.txt | 14 - .../columns/column-naming.txt | 8 - .../columns/data-types.txt | 344 - .../columns/default-values.txt | 14 - .../constraints-and-validators.txt | 166 - .../docs/en/basic-schema-mapping/indexes.txt | 119 - .../en/basic-schema-mapping/introduction.txt | 65 - .../record-identifiers.txt | 133 - .../table-and-class-naming.txt | 12 - .../en/basic-schema-mapping/table-options.txt | 50 - manual/docs/en/caching.txt | 175 - manual/docs/en/caching/configuration.txt | 26 - manual/docs/en/caching/introduction.txt | 22 - manual/docs/en/caching/overview.txt | 49 - manual/docs/en/class-templates.txt | 461 -- manual/docs/en/coding-standards.txt | 5 - .../docs/en/coding-standards/coding-style.txt | 246 - .../coding-standards/naming-conventions.txt | 93 - manual/docs/en/coding-standards/overview.txt | 2 - .../coding-standards/php-file-formatting.txt | 23 - manual/docs/en/coding-standards/testing.txt | 25 - manual/docs/en/component-overview.txt | 758 --- manual/docs/en/component-overview/hook.txt | 7 - .../en/component-overview/locking-manager.txt | 103 - .../docs/en/component-overview/profiler.txt | 32 - .../docs/en/component-overview/validators.txt | 118 - manual/docs/en/component-overview/view.txt | 39 - manual/docs/en/configuration.txt | 189 - manual/docs/en/configuration/introduction.txt | 5 - .../configuration/levels-of-configuration.txt | 33 - .../en/configuration/setting-attributes.txt | 2 - manual/docs/en/connection-management.txt | 5 - .../connection-component-binding.txt | 20 - .../dsn-the-data-source-name.txt | 102 - .../lazy-connecting-to-database.txt | 14 - .../managing-connections.txt | 52 - .../opening-a-new-connection.txt | 13 - manual/docs/en/data-fixtures.txt | 134 - manual/docs/en/database-abstraction.txt | 442 -- .../docs/en/dql-doctrine-query-language.txt | 71 - .../en/dql-doctrine-query-language/bnf.txt | 185 - .../conditional-expressions.txt | 241 - .../delete-queries.txt | 28 - .../dql-doctrine-query-language/examples.txt | 0 .../from-clause.txt | 22 - .../functional-expressions.txt | 73 - .../group-by-having-clauses.txt | 48 - .../indexby-keyword.txt | 30 - .../introduction.txt | 45 - .../join-syntax.txt | 77 - .../limit-and-offset-clauses.txt | 90 - .../order-by-clause.txt | 58 - .../select-queries.txt | 86 - .../subqueries.txt | 8 - .../update-queries.txt | 34 - .../where-clause.txt | 10 - manual/docs/en/event-listeners.txt | 427 -- manual/docs/en/exceptions-and-warnings.txt | 32 - manual/docs/en/file-parser.txt | 68 - manual/docs/en/getting-started.txt | 6 - .../en/getting-started/exporting-classes.txt | 101 - .../docs/en/getting-started/installation.txt | 53 - .../getting-started/starting-new-project.txt | 41 - .../working-with-existing-databases.txt | 154 - manual/docs/en/hierarchical-data.txt | 5 - .../en/hierarchical-data/adjacency-list.txt | 1 - .../en/hierarchical-data/introduction.txt | 18 - .../hierarchical-data/materialized-path.txt | 4 - .../docs/en/hierarchical-data/nested-set.txt | 224 - manual/docs/en/improving-performance.txt | 6 - .../bundle-your-class-files.txt | 1 - .../docs/en/improving-performance/compile.txt | 11 - .../fetch-only-what-you-need.txt | 60 - .../en/improving-performance/introduction.txt | 4 - .../en/improving-performance/other-tips.txt | 16 - .../use-a-bytecode-cache.txt | 1 - manual/docs/en/introduction.txt | 7 - .../docs/en/introduction/further-reading.txt | 7 - manual/docs/en/introduction/key-concepts.txt | 43 - .../docs/en/introduction/the-big-picture.txt | 12 - .../introduction/what-it-is-and-what-not.txt | 23 - manual/docs/en/mapping-relations.txt | 532 -- manual/docs/en/migration.txt | 178 - manual/docs/en/native-sql.txt | 97 - manual/docs/en/object-relational-mapping.txt | 7 - manual/docs/en/plugins.txt | 239 - manual/docs/en/real-world-examples.txt | 3 - .../en/real-world-examples/album-lister.txt | 1 - .../real-world-examples/forum-application.txt | 53 - .../user-management-system.txt | 1 - manual/docs/en/relations.txt | 693 -- manual/docs/en/schema-files.txt | 349 - manual/docs/en/searching.txt | 152 - manual/docs/en/technology.txt | 4 - manual/docs/en/technology/architecture.txt | 42 - .../en/technology/design-patterns-used.txt | 22 - .../en/technology/internal-optimizations.txt | 1 - manual/docs/en/technology/speed.txt | 21 - manual/docs/en/transactions.txt | 8 - manual/docs/en/transactions/introduction.txt | 28 - .../docs/en/transactions/isolation-levels.txt | 24 - .../en/transactions/locking-strategies.txt | 2 - manual/docs/en/transactions/nesting.txt | 23 - manual/docs/en/transactions/savepoints.txt | 50 - manual/docs/en/transactions/unit-of-work.txt | 18 - manual/docs/en/utilities.txt | 7 - .../en/utilities/command-line-interface.txt | 85 - manual/docs/en/utilities/facade.txt | 129 - manual/docs/en/utilities/pagination.txt | 9 - .../advanced-layouts-with-pager.txt | 137 - .../pagination/controlling-range-styles.txt | 84 - .../pagination/customizing-pager-layout.txt | 124 - .../en/utilities/pagination/introduction.txt | 4 - .../pagination/working-with-pager.txt | 112 - manual/docs/en/utilities/sandbox.txt | 13 - manual/docs/en/working-with-objects.txt | 239 - .../component-overview/collection.txt | 1 - .../component-overview/connection.txt | 2 - .../component-overview/manager.txt | 59 - .../component-overview/record.txt | 1 - .../component-overview/table.txt | 91 - .../dealing-with-relations.txt | 203 - manual/images/doctrine-layers.jpg | Bin 59694 -> 0 bytes manual/images/relational-bounds.jpg | Bin 40849 -> 0 bytes manual/index.php | 284 - manual/lib/.htaccess | 1 - manual/lib/Text/Wiki/Doc.php | 68 - manual/lib/Text/Wiki/Parse/Doc/Code.php | 97 - manual/lib/Text/Wiki/Parse/Doc/Doclink.php | 49 - manual/lib/Text/Wiki/Parse/Doc/Prefilter.php | 93 - manual/lib/Text/Wiki/Parse/Doc/Table.php | 255 - manual/lib/Text/Wiki/Render/Latex.php | 88 - manual/lib/Text/Wiki/Render/Latex/Code.php | 44 - manual/lib/Text/Wiki/Render/Latex/Doclink.php | 8 - manual/lib/Text/Wiki/Render/Latex/Heading.php | 41 - manual/lib/Text/Wiki/Render/Latex/List.php | 77 - .../lib/Text/Wiki/Render/Latex/Phplookup.php | 38 - manual/lib/Text/Wiki/Render/Latex/Table.php | 140 - manual/lib/Text/Wiki/Render/Latex/Url.php | 44 - .../lib/Text/Wiki/Render/Xhtml/Blockquote.php | 82 - manual/lib/Text/Wiki/Render/Xhtml/Code.php | 116 - manual/lib/Text/Wiki/Render/Xhtml/Doclink.php | 29 - manual/lib/highlight.php | 568 -- manual/scripts/mootools.v1.11.js | 3 - manual/scripts/toc.js | 71 - manual/scripts/tree.js | 33 - manual/styles/basic.css | 283 - manual/styles/iefix.css | 15 - manual/styles/print.css | 129 - manual/templates/.htaccess | 1 - manual/templates/index.tpl.php | 37 - manual/templates/latex.tpl.php | 107 - manual/templates/xhtml.tpl.php | 62 - manual/tmp/.htaccess | 1 - package.php | 94 - package.xml | 1190 ---- package_Core.php | 95 - package_Core.xml | 905 --- package_DBAL.php | 71 - package_DBAL.xml | 164 - package_ORM.php | 89 - package_ORM.xml | 481 -- svn2cl.xsl | 463 -- tests_old/AccessTestCase.php | 125 - tests_old/AuditLogTestCase.php | 101 - tests_old/BatchIteratorTestCase.php | 87 - tests_old/Cache/ApcTestCase.php | 37 - tests_old/Cache/MemcacheTestCase.php | 51 - tests_old/Cache/SqliteTestCase.php | 40 - tests_old/CacheFileTestCase.php | 59 - tests_old/CacheQuerySqliteTestCase.php | 39 - tests_old/CacheSqliteTestCase.php | 109 - tests_old/CacheTestCase.php | 178 - tests_old/CascadingDeleteTestCase.php | 91 - tests_old/ClassTableInheritanceTestCase.php | 280 - tests_old/Collection/SnapshotTestCase.php | 143 - tests_old/CollectionOffsetTestCase.php | 77 - tests_old/CollectionTestCase.php | 332 - .../ColumnAggregationInheritanceTestCase.php | 74 - tests_old/ColumnAliasTestCase.php | 155 - tests_old/CompositePrimaryKeyTestCase.php | 13 - tests_old/ConfigurableTestCase.php | 180 - tests_old/Connection/FirebirdTestCase.php | 60 - tests_old/Connection/InformixTestCase.php | 4 - tests_old/Connection/MssqlTestCase.php | 99 - tests_old/Connection/MysqlTestCase.php | 153 - tests_old/Connection/OracleTestCase.php | 124 - tests_old/Connection/PgsqlTestCase.php | 217 - tests_old/Connection/ProfilerTestCase.php | 183 - tests_old/Connection/SqliteTestCase.php | 89 - tests_old/Connection/UnitOfWork.php | 215 - tests_old/ConnectionTestCase.php | 240 - tests_old/ConnectionTransactionTestCase.php | 182 - tests_old/CtiColumnAggregationTestCase.php | 100 - tests_old/CustomPrimaryKeyTestCase.php | 60 - tests_old/CustomResultSetOrderTestCase.php | 178 - .../CustomResultSetOrderTestCaseTestCase.php | 34 - tests_old/DBTestCase.php | 420 -- tests_old/Data/ExportTestCase.php | 35 - tests_old/Data/ImportTestCase.php | 35 - tests_old/DataDict/FirebirdTestCase.php | 279 - tests_old/DataDict/InformixTestCase.php | 36 - tests_old/DataDict/MssqlTestCase.php | 249 - tests_old/DataDict/MysqlTestCase.php | 353 - tests_old/DataDict/OracleTestCase.php | 293 - tests_old/DataDict/PgsqlTestCase.php | 358 - tests_old/DataDict/SqliteTestCase.php | 165 - tests_old/DataDictSqliteTestCase.php | 63 - tests_old/DataDictTestCase.php | 34 - tests_old/DataType/BooleanTestCase.php | 118 - tests_old/DataType/EnumTestCase.php | 213 - tests_old/Db/ProfilerTestCase.php | 176 - tests_old/DbProfilerTestCase.php | 137 - tests_old/DoctrineTest.php | 256 - tests_old/DoctrineTest/Coverage.php | 340 - .../DoctrineTest/Doctrine_UnitTestCase.php | 312 - tests_old/DoctrineTest/GroupTest.php | 77 - tests_old/DoctrineTest/Reporter.php | 12 - tests_old/DoctrineTest/Reporter/Cli.php | 23 - tests_old/DoctrineTest/Reporter/Html.php | 83 - tests_old/DoctrineTest/UnitTestCase.php | 140 - tests_old/DriverTestCase.php | 199 - tests_old/EventListener/ChainTestCase.php | 50 - tests_old/EventListenerTestCase.php | 199 - tests_old/Export/CheckConstraintTestCase.php | 56 - tests_old/Export/FirebirdTestCase.php | 86 - tests_old/Export/InformixTestCase.php | 34 - tests_old/Export/MssqlTestCase.php | 34 - tests_old/Export/MysqlTestCase.php | 347 - tests_old/Export/OracleTestCase.php | 153 - tests_old/Export/PgsqlTestCase.php | 144 - tests_old/Export/RecordTestCase.php | 107 - tests_old/Export/ReporterTestCase.php | 10 - tests_old/Export/SchemaTestCase.php | 61 - tests_old/Export/SqliteTestCase.php | 173 - tests_old/ExportTestCase.php | 88 - tests_old/Expression/DriverTestCase.php | 171 - tests_old/Expression/FirebirdTestCase.php | 34 - tests_old/Expression/InformixTestCase.php | 34 - tests_old/Expression/MssqlTestCase.php | 34 - tests_old/Expression/MysqlTestCase.php | 34 - tests_old/Expression/OracleTestCase.php | 34 - tests_old/Expression/PgsqlTestCase.php | 34 - tests_old/Expression/SqliteTestCase.php | 34 - tests_old/ExpressionTestCase.php | 62 - tests_old/ForeignKeyTestCase.php | 56 - tests_old/HookTestCase.php | 172 - tests_old/Hydrate/FetchModeTestCase.php | 177 - tests_old/HydrateTestCase.php | 108 - tests_old/I18nTestCase.php | 138 - tests_old/Import/BuilderTestCase.php | 44 - tests_old/Import/FirebirdTestCase.php | 77 - tests_old/Import/InformixTestCase.php | 34 - tests_old/Import/MssqlTestCase.php | 72 - tests_old/Import/MysqlTestCase.php | 34 - tests_old/Import/OracleTestCase.php | 105 - tests_old/Import/PgsqlTestCase.php | 169 - tests_old/Import/SchemaTestCase.php | 104 - tests_old/Import/SqliteTestCase.php | 61 - tests_old/ImportTestCase.php | 52 - tests_old/Inheritance/JoinedTestCase.php | 232 - tests_old/Inheritance/SingleTableTestCase.php | 110 - .../Inheritance/TablePerClassTestCase.php | 108 - tests_old/IntegrityActionTestCase.php | 71 - tests_old/ManagerTestCase.php | 130 - tests_old/Metadata/FactoryTestCase.php | 249 - tests_old/Migration/MysqlTestCase.php | 80 - tests_old/MigrationTestCase.php | 54 - tests_old/NestedSet/LoadInSetUpTestCase.php | 57 - tests_old/NestedSet/SingleRootTestCase.php | 94 - tests_old/NewCoreTestCase.php | 48 - .../OneTableOneClassInheritanceTestCase.php | 46 - tests_old/ParserTestCase.php | 99 - tests_old/PessimisticLockingTestCase.php | 112 - tests_old/PluginTestCase.php | 115 - tests_old/Query/AggregateValueTestCase.php | 222 - tests_old/Query/ApplyInheritanceTestCase.php | 57 - tests_old/Query/CacheTestCase.php | 151 - tests_old/Query/CheckTestCase.php | 69 - tests_old/Query/ComponentAliasTestCase.php | 123 - tests_old/Query/ConditionTestCase.php | 122 - tests_old/Query/DeleteTestCase.php | 106 - tests_old/Query/DriverTestCase.php | 104 - tests_old/Query/ExpressionTestCase.php | 113 - tests_old/Query/FromTestCase.php | 119 - tests_old/Query/GroupbyTestCase.php | 43 - tests_old/Query/HavingTestCase.php | 75 - tests_old/Query/IdentifierQuotingTestCase.php | 103 - tests_old/Query/JoinCondition2TestCase.php | 126 - tests_old/Query/JoinConditionTestCase.php | 71 - tests_old/Query/JoinTestCase.php | 207 - tests_old/Query/LimitTestCase.php | 304 - tests_old/Query/MultiJoin2TestCase.php | 115 - tests_old/Query/MultiJoinTestCase.php | 192 - .../Query/MultipleAggregateValueTestCase.php | 101 - .../Query/MysqlSubqueryHavingTestCase.php | 73 - tests_old/Query/MysqlSubqueryTestCase.php | 117 - tests_old/Query/OneToOneFetchingTestCase.php | 263 - tests_old/Query/OrderbyTestCase.php | 67 - tests_old/Query/PgsqlSubqueryTestCase.php | 73 - tests_old/Query/ReferenceModelTestCase.php | 203 - tests_old/Query/RegistryTestCase.php | 67 - tests_old/Query/SelectExpressionTestCase.php | 113 - tests_old/Query/SelectTestCase.php | 311 - tests_old/Query/ShortAliasesTestCase.php | 24 - tests_old/Query/SubqueryTestCase.php | 130 - tests_old/Query/UpdateTestCase.php | 83 - tests_old/Query/WhereTestCase.php | 327 - tests_old/QueryTestCase.php | 133 - tests_old/RawSqlTestCase.php | 298 - tests_old/Record/FilterTestCase.php | 104 - tests_old/Record/HookTestCase.php | 103 - tests_old/Record/InheritanceTestCase.php | 59 - tests_old/Record/LockTestCase.php | 23 - tests_old/Record/SaveBlankRecordTestCase.php | 62 - .../Record/SerializeUnserializeTestCase.php | 117 - tests_old/Record/StateTestCase.php | 253 - tests_old/Record/SynchronizeTestCase.php | 121 - tests_old/Record/ZeroValuesTestCase.php | 79 - tests_old/RecordFilterTestCase.php | 45 - tests_old/RecordTestCase.php | 928 --- tests_old/Relation/AccessTestCase.php | 215 - tests_old/Relation/CircularSavingTestCase.php | 108 - tests_old/Relation/ManyToMany2TestCase.php | 135 - tests_old/Relation/ManyToManyTestCase.php | 207 - tests_old/Relation/NestTestCase.php | 241 - tests_old/Relation/OneToManyTestCase.php | 118 - tests_old/Relation/OneToOneTestCase.php | 101 - tests_old/Relation/ParserTestCase.php | 202 - tests_old/RelationTestCase.php | 166 - tests_old/RepositoryTestCase.php | 5 - tests_old/Search/FileTestCase.php | 55 - tests_old/Search/IndexerTestCase.php | 68 - tests_old/Search/QueryTestCase.php | 328 - tests_old/Search/QueryWeightTestCase.php | 129 - tests_old/Search/_files/content.html | 7 - tests_old/Search/_files/content.txt | 12 - tests_old/SearchTestCase.php | 177 - tests_old/Sequence/FirebirdTestCase.php | 55 - tests_old/Sequence/InformixTestCase.php | 34 - tests_old/Sequence/MssqlTestCase.php | 63 - tests_old/Sequence/MysqlTestCase.php | 59 - tests_old/Sequence/OracleTestCase.php | 55 - tests_old/Sequence/PgsqlTestCase.php | 55 - tests_old/Sequence/SqliteTestCase.php | 61 - tests_old/SequenceTestCase.php | 62 - tests_old/TableTestCase.php | 245 - tests_old/TemplateTestCase.php | 136 - tests_old/Ticket/381TestCase.php | 60 - tests_old/Ticket/424BTestCase.php | 97 - tests_old/Ticket/424CTestCase.php | 96 - tests_old/Ticket/428TestCase.php | 65 - tests_old/Ticket/438TestCase.php | 144 - tests_old/Ticket/480TestCase.php | 62 - tests_old/Ticket/576TestCase.php | 52 - tests_old/Ticket/583TestCase.php | 40 - tests_old/Ticket/587TestCase.php | 106 - tests_old/Ticket/626BTestCase.php | 144 - tests_old/Ticket/626CTestCase.php | 85 - tests_old/Ticket/626DTestCase.php | 58 - tests_old/Ticket/638TestCase.php | 151 - tests_old/Ticket/642TestCase.php | 65 - tests_old/Ticket/673TestCase.php | 71 - tests_old/Ticket/697TestCase.php | 63 - tests_old/Ticket/741TestCase.php | 80 - tests_old/Ticket/749TestCase.php | 149 - tests_old/Ticket/912TestCase.php | 234 - tests_old/Ticket/NjeroTestCase.php | 88 - tests_old/TokenizerTestCase.php | 137 - tests_old/Transaction/FirebirdTestCase.php | 113 - tests_old/Transaction/InformixTestCase.php | 35 - tests_old/Transaction/MssqlTestCase.php | 62 - tests_old/Transaction/MysqlTestCase.php | 75 - tests_old/Transaction/OracleTestCase.php | 73 - tests_old/Transaction/PgsqlTestCase.php | 69 - tests_old/Transaction/SqliteTestCase.php | 56 - tests_old/TransactionTestCase.php | 317 - tests_old/TreeStructureTestCase.php | 128 - tests_old/UnitOfWorkTestCase.php | 137 - tests_old/UnsortedTestCase.php | 29 - tests_old/Validator/FutureTestCase.php | 84 - tests_old/Validator/PastTestCase.php | 84 - tests_old/ValidatorTestCase.php | 431 -- tests_old/ValueHolderTestCase.php | 60 - tests_old/ViewTestCase.php | 78 - tests_old/coverage/Doctrine.html | 3570 ---------- tests_old/coverage/Doctrine_Access.html | 471 -- tests_old/coverage/Doctrine_Adapter_Mock.html | 498 -- .../Doctrine_Adapter_Statement_Mock.html | 1059 --- tests_old/coverage/Doctrine_AuditLog.html | 375 -- .../coverage/Doctrine_AuditLog_Listener.html | 273 - tests_old/coverage/Doctrine_Cache_Array.html | 351 - tests_old/coverage/Doctrine_Collection.html | 2514 ------- tests_old/coverage/Doctrine_Configurable.html | 1251 ---- tests_old/coverage/Doctrine_Connection.html | 3978 ------------ .../coverage/Doctrine_Connection_Common.html | 182 - .../Doctrine_Connection_Exception.html | 362 -- .../Doctrine_Connection_Firebird.html | 344 - ...octrine_Connection_Firebird_Exception.html | 419 -- .../coverage/Doctrine_Connection_Module.html | 260 - .../coverage/Doctrine_Connection_Mssql.html | 593 -- .../Doctrine_Connection_Mssql_Exception.html | 236 - .../coverage/Doctrine_Connection_Mysql.html | 639 -- .../Doctrine_Connection_Mysql_Exception.html | 266 - .../coverage/Doctrine_Connection_Oracle.html | 365 -- .../Doctrine_Connection_Oracle_Exception.html | 251 - .../coverage/Doctrine_Connection_Pgsql.html | 596 -- .../Doctrine_Connection_Pgsql_Exception.html | 335 - .../Doctrine_Connection_Profiler.html | 560 -- .../coverage/Doctrine_Connection_Sqlite.html | 342 - .../Doctrine_Connection_Sqlite_Exception.html | 245 - .../Doctrine_Connection_Statement.html | 1389 ---- .../Doctrine_Connection_UnitOfWork.html | 2139 ------ tests_old/coverage/Doctrine_DataDict.html | 299 - .../coverage/Doctrine_DataDict_Exception.html | 113 - .../coverage/Doctrine_DataDict_Firebird.html | 665 -- .../coverage/Doctrine_DataDict_Mssql.html | 579 -- .../coverage/Doctrine_DataDict_Mysql.html | 1421 ---- .../coverage/Doctrine_DataDict_Oracle.html | 609 -- .../coverage/Doctrine_DataDict_Pgsql.html | 1884 ------ .../coverage/Doctrine_DataDict_Sqlite.html | 911 --- tests_old/coverage/Doctrine_Event.html | 999 --- .../coverage/Doctrine_EventListener.html | 372 -- .../Doctrine_EventListener_Chain.html | 1230 ---- tests_old/coverage/Doctrine_Exception.html | 288 - tests_old/coverage/Doctrine_Export.html | 3846 ----------- .../coverage/Doctrine_Export_Exception.html | 113 - .../coverage/Doctrine_Export_Firebird.html | 1665 ----- tests_old/coverage/Doctrine_Export_Mysql.html | 1982 ------ .../coverage/Doctrine_Export_Oracle.html | 1514 ----- tests_old/coverage/Doctrine_Export_Pgsql.html | 1100 ---- .../coverage/Doctrine_Export_Schema.html | 404 -- .../coverage/Doctrine_Export_Sqlite.html | 1260 ---- tests_old/coverage/Doctrine_Expression.html | 444 -- .../coverage/Doctrine_Expression_Driver.html | 2198 ------- .../Doctrine_Expression_Exception.html | 113 - .../coverage/Doctrine_Expression_Mock.html | 116 - .../coverage/Doctrine_Expression_Mysql.html | 350 - .../coverage/Doctrine_Expression_Pgsql.html | 689 -- .../coverage/Doctrine_Expression_Sqlite.html | 527 -- tests_old/coverage/Doctrine_Formatter.html | 738 --- tests_old/coverage/Doctrine_Hook.html | 702 -- tests_old/coverage/Doctrine_Hook_Equal.html | 167 - tests_old/coverage/Doctrine_Hook_Integer.html | 236 - tests_old/coverage/Doctrine_Hook_Parser.html | 212 - .../Doctrine_Hook_Parser_Complex.html | 332 - .../coverage/Doctrine_Hook_WordLike.html | 210 - tests_old/coverage/Doctrine_Hydrate.html | 3852 ----------- .../coverage/Doctrine_Hydrate_Array.html | 231 - .../coverage/Doctrine_Hydrate_Record.html | 390 -- tests_old/coverage/Doctrine_Hydrator.html | 1002 --- .../coverage/Doctrine_Hydrator_Abstract.html | 357 - .../Doctrine_Hydrator_ArrayDriver.html | 231 - .../Doctrine_Hydrator_RecordDriver.html | 414 -- tests_old/coverage/Doctrine_I18n.html | 348 - tests_old/coverage/Doctrine_Import.html | 692 -- .../coverage/Doctrine_Import_Builder.html | 2502 ------- .../coverage/Doctrine_Import_Firebird.html | 395 -- tests_old/coverage/Doctrine_Import_Mssql.html | 608 -- .../coverage/Doctrine_Import_Oracle.html | 729 --- tests_old/coverage/Doctrine_Import_Pgsql.html | 734 --- .../coverage/Doctrine_Import_Schema.html | 1451 ----- .../coverage/Doctrine_Import_Sqlite.html | 731 --- tests_old/coverage/Doctrine_Lib.html | 813 --- .../coverage/Doctrine_Locator_Injectable.html | 459 -- tests_old/coverage/Doctrine_Manager.html | 2082 ------ .../coverage/Doctrine_Manager_Exception.html | 113 - tests_old/coverage/Doctrine_Migration.html | 1773 ----- .../coverage/Doctrine_Migration_Process.html | 764 --- tests_old/coverage/Doctrine_Node.html | 554 -- .../coverage/Doctrine_Node_NestedSet.html | 2993 --------- tests_old/coverage/Doctrine_Null.html | 149 - tests_old/coverage/Doctrine_Parser.html | 458 -- tests_old/coverage/Doctrine_Parser_Yml.html | 233 - tests_old/coverage/Doctrine_Plugin.html | 729 --- tests_old/coverage/Doctrine_Query.html | 5763 ----------------- .../coverage/Doctrine_Query_Abstract.html | 5319 --------------- tests_old/coverage/Doctrine_Query_Check.html | 518 -- .../coverage/Doctrine_Query_Condition.html | 348 - .../coverage/Doctrine_Query_Exception.html | 113 - tests_old/coverage/Doctrine_Query_From.html | 278 - .../coverage/Doctrine_Query_Groupby.html | 207 - tests_old/coverage/Doctrine_Query_Having.html | 306 - .../Doctrine_Query_JoinCondition.html | 323 - tests_old/coverage/Doctrine_Query_Limit.html | 128 - tests_old/coverage/Doctrine_Query_Offset.html | 128 - .../coverage/Doctrine_Query_Orderby.html | 171 - tests_old/coverage/Doctrine_Query_Part.html | 195 - .../coverage/Doctrine_Query_Registry.html | 221 - tests_old/coverage/Doctrine_Query_Select.html | 128 - tests_old/coverage/Doctrine_Query_Set.html | 191 - .../coverage/Doctrine_Query_Tokenizer.html | 1163 ---- tests_old/coverage/Doctrine_Query_Where.html | 522 -- tests_old/coverage/Doctrine_RawSql.html | 1002 --- .../coverage/Doctrine_RawSql_Exception.html | 113 - tests_old/coverage/Doctrine_Record.html | 5016 -------------- .../coverage/Doctrine_Record_Abstract.html | 1014 --- .../coverage/Doctrine_Record_Exception.html | 113 - .../coverage/Doctrine_Record_Filter.html | 197 - .../Doctrine_Record_Filter_Compound.html | 311 - .../Doctrine_Record_Filter_Standard.html | 182 - .../coverage/Doctrine_Record_Iterator.html | 254 - .../coverage/Doctrine_Record_Listener.html | 240 - .../Doctrine_Record_Listener_Chain.html | 579 -- tests_old/coverage/Doctrine_Relation.html | 1001 --- .../Doctrine_Relation_Association.html | 305 - .../coverage/Doctrine_Relation_Exception.html | 113 - .../Doctrine_Relation_ForeignKey.html | 308 - .../coverage/Doctrine_Relation_LocalKey.html | 254 - .../coverage/Doctrine_Relation_Nest.html | 440 -- .../coverage/Doctrine_Relation_Parser.html | 1481 ----- .../Doctrine_Relation_Parser_Exception.html | 113 - tests_old/coverage/Doctrine_Search.html | 891 --- .../Doctrine_Search_Analyzer_Standard.html | 906 --- .../coverage/Doctrine_Search_Exception.html | 113 - tests_old/coverage/Doctrine_Search_File.html | 216 - .../coverage/Doctrine_Search_Listener.html | 180 - tests_old/coverage/Doctrine_Search_Query.html | 717 -- tests_old/coverage/Doctrine_Sequence.html | 233 - .../coverage/Doctrine_Sequence_Firebird.html | 332 - .../coverage/Doctrine_Sequence_Mssql.html | 482 -- .../coverage/Doctrine_Sequence_Mysql.html | 347 - .../coverage/Doctrine_Sequence_Oracle.html | 299 - .../coverage/Doctrine_Sequence_Pgsql.html | 293 - .../coverage/Doctrine_Sequence_Sqlite.html | 353 - tests_old/coverage/Doctrine_Table.html | 5718 ---------------- .../coverage/Doctrine_Table_Exception.html | 134 - .../coverage/Doctrine_Table_Repository.html | 500 -- tests_old/coverage/Doctrine_Template.html | 477 -- .../coverage/Doctrine_Template_I18n.html | 228 - ...trine_Template_Listener_Timestampable.html | 314 - .../coverage/Doctrine_Template_NestedSet.html | 152 - .../Doctrine_Template_Searchable.html | 213 - .../coverage/Doctrine_Template_Sluggable.html | 222 - .../Doctrine_Template_Timestampable.html | 233 - .../Doctrine_Template_Versionable.html | 168 - tests_old/coverage/Doctrine_Tokenizer.html | 951 --- tests_old/coverage/Doctrine_Transaction.html | 1371 ---- .../Doctrine_Transaction_Exception.html | 113 - .../Doctrine_Transaction_Firebird.html | 431 -- .../coverage/Doctrine_Transaction_Mock.html | 119 - .../coverage/Doctrine_Transaction_Mssql.html | 215 - .../coverage/Doctrine_Transaction_Mysql.html | 359 - .../coverage/Doctrine_Transaction_Oracle.html | 329 - .../coverage/Doctrine_Transaction_Pgsql.html | 326 - .../coverage/Doctrine_Transaction_Sqlite.html | 209 - tests_old/coverage/Doctrine_Tree.html | 401 -- .../coverage/Doctrine_Tree_NestedSet.html | 1082 ---- tests_old/coverage/Doctrine_Validator.html | 993 --- .../coverage/Doctrine_Validator_Date.html | 170 - .../coverage/Doctrine_Validator_Driver.html | 359 - .../coverage/Doctrine_Validator_Email.html | 245 - .../Doctrine_Validator_ErrorStack.html | 459 -- .../Doctrine_Validator_Exception.html | 311 - .../coverage/Doctrine_Validator_Future.html | 248 - .../coverage/Doctrine_Validator_Notblank.html | 149 - .../coverage/Doctrine_Validator_Notnull.html | 146 - .../coverage/Doctrine_Validator_Past.html | 248 - .../coverage/Doctrine_Validator_Range.html | 164 - .../coverage/Doctrine_Validator_Regexp.html | 197 - .../coverage/Doctrine_Validator_Unique.html | 224 - .../coverage/Doctrine_Validator_Unsigned.html | 161 - .../coverage/Doctrine_Validator_Usstate.html | 326 - tests_old/coverage/Doctrine_View.html | 515 -- tests_old/coverage/coverage.txt | 1 - tests_old/coverage/index.php | 57 - tests_old/index.php | 2 - tests_old/migration_classes/001_add_table.php | 14 - tests_old/models/Account.php | 10 - tests_old/models/Address.php | 11 - tests_old/models/Album.php | 14 - tests_old/models/App.php | 11 - tests_old/models/App_Category.php | 9 - tests_old/models/App_User.php | 13 - tests_old/models/Assignment.php | 8 - tests_old/models/Auth.php | 11 - tests_old/models/Author.php | 12 - tests_old/models/BadlyNamed__Class.php | 7 - tests_old/models/BarRecord.php | 10 - tests_old/models/BaseSymfonyRecord.php | 10 - tests_old/models/Blog.php | 23 - tests_old/models/BlogTag.php | 10 - tests_old/models/BoardWithPosition.php | 8 - tests_old/models/Book.php | 13 - tests_old/models/Bookmark.php | 9 - tests_old/models/BookmarkUser.php | 11 - tests_old/models/BooleanTest.php | 7 - tests_old/models/CPK_Association.php | 7 - tests_old/models/CPK_Test.php | 7 - tests_old/models/CPK_Test2.php | 7 - tests_old/models/CascadeDeleteRelatedTest.php | 17 - .../models/CascadeDeleteRelatedTest2.php | 12 - tests_old/models/CascadeDeleteTest.php | 11 - tests_old/models/CategoryNestedSet.php | 12 - tests_old/models/CategoryWithPosition.php | 8 - tests_old/models/CheckConstraintTest.php | 10 - tests_old/models/ClientModel.php | 47 - tests_old/models/ColumnAliasTest.php | 12 - tests_old/models/ConcreteEmail.php | 8 - tests_old/models/ConcreteGroup.php | 8 - tests_old/models/ConcreteGroupUser.php | 8 - .../models/ConcreteInheritanceTestParent.php | 16 - tests_old/models/ConcreteUser.php | 9 - tests_old/models/CoverageCodeN.php | 10 - tests_old/models/CustomPK.php | 7 - tests_old/models/CustomSequenceRecord.php | 9 - tests_old/models/Data_File.php | 8 - tests_old/models/DateTest.php | 7 - tests_old/models/Description.php | 8 - tests_old/models/Element.php | 10 - tests_old/models/Email.php | 11 - tests_old/models/Entity.php | 29 - tests_old/models/EntityAddress.php | 9 - tests_old/models/EntityReference.php | 10 - tests_old/models/EnumTest.php | 10 - tests_old/models/EnumTest2.php | 8 - tests_old/models/EnumTest3.php | 7 - tests_old/models/Error.php | 10 - tests_old/models/EventListenerChainTest.php | 19 - tests_old/models/EventListenerTest.php | 13 - tests_old/models/FieldNameTest.php | 12 - tests_old/models/File_Owner.php | 7 - tests_old/models/FilterTest.php | 7 - tests_old/models/FilterTest2.php | 7 - tests_old/models/FooBarRecord.php | 9 - tests_old/models/FooForeignlyOwned.php | 9 - tests_old/models/FooForeignlyOwnedWithPK.php | 8 - tests_old/models/FooLocallyOwned.php | 9 - tests_old/models/FooRecord.php | 38 - tests_old/models/FooReferenceRecord.php | 10 - tests_old/models/ForeignKeyTest.php | 22 - tests_old/models/ForeignKeyTest2.php | 10 - tests_old/models/Forum_Board.php | 11 - tests_old/models/Forum_Category.php | 12 - tests_old/models/Forum_Entry.php | 14 - tests_old/models/Forum_Thread.php | 11 - tests_old/models/Group.php | 20 - tests_old/models/Groupuser.php | 12 - tests_old/models/GzipTest.php | 6 - tests_old/models/I18nTest.php | 10 - tests_old/models/InheritanceDeal.php | 12 - tests_old/models/InheritanceDealUser.php | 27 - tests_old/models/InheritanceUser.php | 12 - tests_old/models/JC1.php | 8 - tests_old/models/JC2.php | 8 - tests_old/models/JC3.php | 8 - tests_old/models/LiabilityCodeN.php | 10 - tests_old/models/Location.php | 10 - tests_old/models/LocationI18n.php | 11 - tests_old/models/Log_Entry.php | 8 - tests_old/models/Log_Status.php | 6 - tests_old/models/M2MTest.php | 12 - tests_old/models/M2MTest2.php | 9 - tests_old/models/MigrationTest.php | 8 - tests_old/models/MyGroup.php | 17 - tests_old/models/MyOneThing.php | 10 - tests_old/models/MyOtherThing.php | 10 - tests_old/models/MyUser.php | 10 - tests_old/models/MyUser2.php | 23 - tests_old/models/MyUserGroup.php | 18 - tests_old/models/MyUserOneThing.php | 7 - tests_old/models/MyUserOtherThing.php | 7 - tests_old/models/MysqlGroup.php | 9 - tests_old/models/MysqlGroupMember.php | 10 - tests_old/models/MysqlIndexTestRecord.php | 17 - tests_old/models/MysqlTestRecord.php | 11 - tests_old/models/MysqlUser.php | 9 - tests_old/models/NestReference.php | 9 - tests_old/models/NestTest.php | 19 - .../models/NestedSetTest_SingleRootNode.php | 9 - tests_old/models/NotNullTest.php | 7 - tests_old/models/ORM_AccessControl.php | 12 - tests_old/models/ORM_AccessControlsGroups.php | 9 - tests_old/models/ORM_AccessGroup.php | 11 - tests_old/models/ORM_TestEntry.php | 15 - tests_old/models/ORM_TestItem.php | 13 - tests_old/models/Package.php | 7 - tests_old/models/PackageVersion.php | 12 - tests_old/models/PackageVersionNotes.php | 13 - tests_old/models/Page.php | 13 - tests_old/models/Phonenumber.php | 21 - tests_old/models/Photo.php | 7 - tests_old/models/Phototag.php | 7 - tests_old/models/PluginSymfonyRecord.php | 15 - tests_old/models/PluginSymfonyRecordTable.php | 5 - tests_old/models/Policy.php | 12 - tests_old/models/PolicyAsset.php | 12 - tests_old/models/PolicyCodeN.php | 10 - tests_old/models/PolicyN.php | 12 - tests_old/models/QueryTest_Board.php | 21 - tests_old/models/QueryTest_Category.php | 30 - tests_old/models/QueryTest_Entry.php | 15 - tests_old/models/QueryTest_Item.php | 10 - tests_old/models/QueryTest_Rank.php | 18 - tests_old/models/QueryTest_User.php | 13 - tests_old/models/QueryTest_UserRank.php | 9 - tests_old/models/RTC1.php | 10 - tests_old/models/RTC2.php | 10 - tests_old/models/RTC3.php | 11 - tests_old/models/RTC4.php | 8 - tests_old/models/RateN.php | 16 - tests_old/models/Rec1.php | 11 - tests_old/models/Rec2.php | 10 - tests_old/models/RecordFilterTest.php | 15 - tests_old/models/RecordHookTest.php | 46 - tests_old/models/Record_City.php | 10 - tests_old/models/Record_Country.php | 9 - tests_old/models/Record_District.php | 6 - tests_old/models/RelationTest.php | 26 - tests_old/models/Resource.php | 8 - tests_old/models/ResourceReference.php | 8 - tests_old/models/ResourceType.php | 8 - tests_old/models/Role.php | 11 - tests_old/models/SearchTest.php | 12 - tests_old/models/SelfRefTest.php | 11 - tests_old/models/SequenceRecord.php | 8 - tests_old/models/SerializeTest.php | 31 - tests_old/models/SoftDeleteTest.php | 20 - tests_old/models/Song.php | 13 - tests_old/models/SymfonyRecord.php | 16 - tests_old/models/SymfonyRecordTable.php | 7 - tests_old/models/Tag.php | 7 - tests_old/models/Task.php | 9 - tests_old/models/TestMovie.php | 25 - tests_old/models/TestMovieUserBookmark.php | 10 - tests_old/models/TestMovieUserVote.php | 9 - tests_old/models/TestRecord.php | 8 - tests_old/models/TestUser.php | 19 - tests_old/models/TreeLeaf.php | 11 - tests_old/models/User.php | 50 - tests_old/models/ValidatorTest.php | 24 - .../models/ValidatorTest_AddressModel.php | 19 - .../models/ValidatorTest_ClientModel.php | 11 - .../ValidatorTest_ClientToAddressModel.php | 8 - tests_old/models/ValidatorTest_DateModel.php | 9 - .../models/ValidatorTest_FootballPlayer.php | 8 - tests_old/models/ValidatorTest_Person.php | 10 - tests_old/models/VersioningTest.php | 10 - tests_old/models/ZeroValueTest.php | 16 - tests_old/models/export/Cms_Category.php | 18 - .../models/export/Cms_CategoryLanguages.php | 18 - tests_old/models/gnatEmail.php | 10 - tests_old/models/gnatUser.php | 13 - tests_old/models/mmrGroupUser_B.php | 9 - tests_old/models/mmrGroupUser_C.php | 10 - tests_old/models/mmrGroup_B.php | 14 - tests_old/models/mmrGroup_C.php | 12 - tests_old/models/mmrUser_B.php | 18 - tests_old/models/mmrUser_C.php | 19 - .../001_mysql_add_table.php | 14 - .../002_mysql_change_column.php | 13 - tests_old/run.php | 312 - tests_old/schema.xml | 2 - tests_old/schema.yml | 55 - tests_old/template.tpl | 35 - tests_old/unsolved.php | 38 - tools/Bot.php | 154 - tools/sandbox/config.php | 55 - tools/sandbox/doctrine | 4 - tools/sandbox/doctrine.php | 32 - tools/sandbox/index.php.dist | 2 - vendor/PEAR.php | 1108 ---- vendor/Sensei/Sensei.php | 139 - vendor/Sensei/Sensei/Doc/Renderer.php | 87 - .../Sensei/Sensei/Doc/Renderer/Exception.php | 35 - vendor/Sensei/Sensei/Doc/Renderer/Latex.php | 73 - vendor/Sensei/Sensei/Doc/Renderer/Pdf.php | 158 - vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php | 242 - vendor/Sensei/Sensei/Doc/Section.php | 401 -- vendor/Sensei/Sensei/Doc/Toc.php | 132 - vendor/Sensei/Sensei/Exception.php | 35 - vendor/Text/Wiki.php | 1552 ----- vendor/Text/Wiki/Default.php | 27 - vendor/Text/Wiki/Parse.php | 264 - vendor/Text/Wiki/Parse/Default/Anchor.php | 87 - vendor/Text/Wiki/Parse/Default/Blockquote.php | 180 - vendor/Text/Wiki/Parse/Default/Bold.php | 79 - vendor/Text/Wiki/Parse/Default/Break.php | 72 - vendor/Text/Wiki/Parse/Default/Center.php | 78 - vendor/Text/Wiki/Parse/Default/Code.php | 99 - vendor/Text/Wiki/Parse/Default/Colortext.php | 89 - vendor/Text/Wiki/Parse/Default/Deflist.php | 122 - vendor/Text/Wiki/Parse/Default/Delimiter.php | 80 - vendor/Text/Wiki/Parse/Default/Embed.php | 106 - vendor/Text/Wiki/Parse/Default/Emphasis.php | 85 - vendor/Text/Wiki/Parse/Default/Freelink.php | 134 - vendor/Text/Wiki/Parse/Default/Function.php | 141 - vendor/Text/Wiki/Parse/Default/Heading.php | 107 - vendor/Text/Wiki/Parse/Default/Horiz.php | 70 - vendor/Text/Wiki/Parse/Default/Html.php | 75 - vendor/Text/Wiki/Parse/Default/Image.php | 136 - vendor/Text/Wiki/Parse/Default/Include.php | 100 - vendor/Text/Wiki/Parse/Default/Interwiki.php | 138 - vendor/Text/Wiki/Parse/Default/Italic.php | 85 - vendor/Text/Wiki/Parse/Default/List.php | 248 - vendor/Text/Wiki/Parse/Default/Newline.php | 75 - vendor/Text/Wiki/Parse/Default/Paragraph.php | 146 - vendor/Text/Wiki/Parse/Default/Phplookup.php | 73 - vendor/Text/Wiki/Parse/Default/Prefilter.php | 84 - vendor/Text/Wiki/Parse/Default/Raw.php | 73 - vendor/Text/Wiki/Parse/Default/Revise.php | 145 - vendor/Text/Wiki/Parse/Default/Smiley.php | 157 - vendor/Text/Wiki/Parse/Default/Strong.php | 86 - vendor/Text/Wiki/Parse/Default/Subscript.php | 79 - .../Text/Wiki/Parse/Default/Superscript.php | 79 - vendor/Text/Wiki/Parse/Default/Table.php | 226 - vendor/Text/Wiki/Parse/Default/Tighten.php | 49 - vendor/Text/Wiki/Parse/Default/Toc.php | 130 - vendor/Text/Wiki/Parse/Default/Tt.php | 84 - vendor/Text/Wiki/Parse/Default/Underline.php | 79 - vendor/Text/Wiki/Parse/Default/Url.php | 281 - vendor/Text/Wiki/Parse/Default/Wikilink.php | 204 - vendor/Text/Wiki/Render.php | 218 - vendor/Text/Wiki/Render/Latex.php | 90 - vendor/Text/Wiki/Render/Latex/Anchor.php | 33 - vendor/Text/Wiki/Render/Latex/Blockquote.php | 36 - vendor/Text/Wiki/Render/Latex/Bold.php | 28 - vendor/Text/Wiki/Render/Latex/Box.php | 54 - vendor/Text/Wiki/Render/Latex/Break.php | 24 - vendor/Text/Wiki/Render/Latex/Center.php | 33 - vendor/Text/Wiki/Render/Latex/Code.php | 26 - vendor/Text/Wiki/Render/Latex/Colortext.php | 58 - vendor/Text/Wiki/Render/Latex/Deflist.php | 53 - vendor/Text/Wiki/Render/Latex/Delimiter.php | 25 - vendor/Text/Wiki/Render/Latex/Embed.php | 23 - vendor/Text/Wiki/Render/Latex/Emphasis.php | 29 - vendor/Text/Wiki/Render/Latex/Font.php | 73 - vendor/Text/Wiki/Render/Latex/Freelink.php | 6 - vendor/Text/Wiki/Render/Latex/Function.php | 23 - vendor/Text/Wiki/Render/Latex/Heading.php | 33 - vendor/Text/Wiki/Render/Latex/Horiz.php | 23 - vendor/Text/Wiki/Render/Latex/Html.php | 25 - vendor/Text/Wiki/Render/Latex/Image.php | 70 - vendor/Text/Wiki/Render/Latex/Include.php | 8 - vendor/Text/Wiki/Render/Latex/Interwiki.php | 58 - vendor/Text/Wiki/Render/Latex/Italic.php | 28 - vendor/Text/Wiki/Render/Latex/List.php | 76 - vendor/Text/Wiki/Render/Latex/Newline.php | 12 - vendor/Text/Wiki/Render/Latex/Page.php | 48 - vendor/Text/Wiki/Render/Latex/Paragraph.php | 31 - vendor/Text/Wiki/Render/Latex/Phplookup.php | 34 - vendor/Text/Wiki/Render/Latex/Plugin.php | 49 - vendor/Text/Wiki/Render/Latex/Prefilter.php | 40 - .../Text/Wiki/Render/Latex/Preformatted.php | 48 - vendor/Text/Wiki/Render/Latex/Raw.php | 23 - vendor/Text/Wiki/Render/Latex/Revise.php | 38 - vendor/Text/Wiki/Render/Latex/Smiley.php | 44 - vendor/Text/Wiki/Render/Latex/Specialchar.php | 54 - vendor/Text/Wiki/Render/Latex/Strong.php | 30 - vendor/Text/Wiki/Render/Latex/Subscript.php | 54 - vendor/Text/Wiki/Render/Latex/Superscript.php | 31 - vendor/Text/Wiki/Render/Latex/Table.php | 99 - vendor/Text/Wiki/Render/Latex/Tighten.php | 9 - vendor/Text/Wiki/Render/Latex/Titlebar.php | 54 - vendor/Text/Wiki/Render/Latex/Toc.php | 30 - vendor/Text/Wiki/Render/Latex/Tt.php | 30 - vendor/Text/Wiki/Render/Latex/Underline.php | 30 - vendor/Text/Wiki/Render/Latex/Url.php | 41 - vendor/Text/Wiki/Render/Latex/Wikilink.php | 60 - vendor/Text/Wiki/Render/Plain.php | 16 - vendor/Text/Wiki/Render/Plain/Anchor.php | 23 - vendor/Text/Wiki/Render/Plain/Blockquote.php | 39 - vendor/Text/Wiki/Render/Plain/Bold.php | 23 - vendor/Text/Wiki/Render/Plain/Box.php | 48 - vendor/Text/Wiki/Render/Plain/Break.php | 24 - vendor/Text/Wiki/Render/Plain/Center.php | 23 - vendor/Text/Wiki/Render/Plain/Code.php | 24 - vendor/Text/Wiki/Render/Plain/Colortext.php | 23 - vendor/Text/Wiki/Render/Plain/Deflist.php | 59 - vendor/Text/Wiki/Render/Plain/Delimiter.php | 23 - vendor/Text/Wiki/Render/Plain/Embed.php | 23 - vendor/Text/Wiki/Render/Plain/Emphasis.php | 23 - vendor/Text/Wiki/Render/Plain/Font.php | 44 - vendor/Text/Wiki/Render/Plain/Freelink.php | 23 - vendor/Text/Wiki/Render/Plain/Function.php | 39 - vendor/Text/Wiki/Render/Plain/Heading.php | 14 - vendor/Text/Wiki/Render/Plain/Horiz.php | 23 - vendor/Text/Wiki/Render/Plain/Html.php | 24 - vendor/Text/Wiki/Render/Plain/Image.php | 22 - vendor/Text/Wiki/Render/Plain/Include.php | 8 - vendor/Text/Wiki/Render/Plain/Interwiki.php | 29 - vendor/Text/Wiki/Render/Plain/Italic.php | 23 - vendor/Text/Wiki/Render/Plain/List.php | 68 - vendor/Text/Wiki/Render/Plain/Newline.php | 12 - vendor/Text/Wiki/Render/Plain/Page.php | 48 - vendor/Text/Wiki/Render/Plain/Paragraph.php | 31 - vendor/Text/Wiki/Render/Plain/Phplookup.php | 25 - vendor/Text/Wiki/Render/Plain/Plugin.php | 49 - vendor/Text/Wiki/Render/Plain/Prefilter.php | 40 - .../Text/Wiki/Render/Plain/Preformatted.php | 48 - vendor/Text/Wiki/Render/Plain/Raw.php | 23 - vendor/Text/Wiki/Render/Plain/Revise.php | 24 - vendor/Text/Wiki/Render/Plain/Smiley.php | 44 - vendor/Text/Wiki/Render/Plain/Specialchar.php | 54 - vendor/Text/Wiki/Render/Plain/Strong.php | 24 - vendor/Text/Wiki/Render/Plain/Subscript.php | 48 - vendor/Text/Wiki/Render/Plain/Superscript.php | 23 - vendor/Text/Wiki/Render/Plain/Table.php | 65 - vendor/Text/Wiki/Render/Plain/Tighten.php | 10 - vendor/Text/Wiki/Render/Plain/Titlebar.php | 54 - vendor/Text/Wiki/Render/Plain/Toc.php | 39 - vendor/Text/Wiki/Render/Plain/Tt.php | 24 - vendor/Text/Wiki/Render/Plain/Underline.php | 23 - vendor/Text/Wiki/Render/Plain/Url.php | 29 - vendor/Text/Wiki/Render/Plain/Wikilink.php | 24 - vendor/Text/Wiki/Render/Xhtml.php | 107 - vendor/Text/Wiki/Render/Xhtml/Address.php | 54 - vendor/Text/Wiki/Render/Xhtml/Anchor.php | 48 - vendor/Text/Wiki/Render/Xhtml/Blockquote.php | 72 - vendor/Text/Wiki/Render/Xhtml/Bold.php | 57 - vendor/Text/Wiki/Render/Xhtml/Box.php | 62 - vendor/Text/Wiki/Render/Xhtml/Break.php | 52 - vendor/Text/Wiki/Render/Xhtml/Center.php | 62 - vendor/Text/Wiki/Render/Xhtml/Code.php | 133 - vendor/Text/Wiki/Render/Xhtml/Colortext.php | 79 - vendor/Text/Wiki/Render/Xhtml/Deflist.php | 87 - vendor/Text/Wiki/Render/Xhtml/Delimiter.php | 46 - vendor/Text/Wiki/Render/Xhtml/Embed.php | 46 - vendor/Text/Wiki/Render/Xhtml/Emphasis.php | 58 - vendor/Text/Wiki/Render/Xhtml/Font.php | 83 - vendor/Text/Wiki/Render/Xhtml/Freelink.php | 35 - vendor/Text/Wiki/Render/Xhtml/Function.php | 108 - vendor/Text/Wiki/Render/Xhtml/Heading.php | 88 - vendor/Text/Wiki/Render/Xhtml/Horiz.php | 51 - vendor/Text/Wiki/Render/Xhtml/Html.php | 47 - vendor/Text/Wiki/Render/Xhtml/Image.php | 184 - vendor/Text/Wiki/Render/Xhtml/Include.php | 32 - vendor/Text/Wiki/Render/Xhtml/Interwiki.php | 103 - vendor/Text/Wiki/Render/Xhtml/Italic.php | 57 - vendor/Text/Wiki/Render/Xhtml/List.php | 172 - vendor/Text/Wiki/Render/Xhtml/Newline.php | 35 - vendor/Text/Wiki/Render/Xhtml/Page.php | 46 - vendor/Text/Wiki/Render/Xhtml/Paragraph.php | 59 - vendor/Text/Wiki/Render/Xhtml/Phplookup.php | 81 - vendor/Text/Wiki/Render/Xhtml/Plugin.php | 47 - vendor/Text/Wiki/Render/Xhtml/Prefilter.php | 34 - .../Text/Wiki/Render/Xhtml/Preformatted.php | 47 - vendor/Text/Wiki/Render/Xhtml/Raw.php | 46 - vendor/Text/Wiki/Render/Xhtml/Revise.php | 68 - vendor/Text/Wiki/Render/Xhtml/Smiley.php | 74 - vendor/Text/Wiki/Render/Xhtml/Specialchar.php | 52 - vendor/Text/Wiki/Render/Xhtml/Strong.php | 58 - vendor/Text/Wiki/Render/Xhtml/Subscript.php | 57 - vendor/Text/Wiki/Render/Xhtml/Superscript.php | 57 - vendor/Text/Wiki/Render/Xhtml/Table.php | 140 - vendor/Text/Wiki/Render/Xhtml/Tighten.php | 34 - vendor/Text/Wiki/Render/Xhtml/Titlebar.php | 57 - vendor/Text/Wiki/Render/Xhtml/Toc.php | 115 - vendor/Text/Wiki/Render/Xhtml/Tt.php | 58 - vendor/Text/Wiki/Render/Xhtml/Underline.php | 57 - vendor/Text/Wiki/Render/Xhtml/Url.php | 131 - vendor/Text/Wiki/Render/Xhtml/Wikilink.php | 177 - vendor/spikephpcoverage/CoverageRecorder.php | 443 -- vendor/spikephpcoverage/PEAR.php | 1055 --- vendor/spikephpcoverage/XML/Parser.php | 690 -- vendor/spikephpcoverage/XML/Parser/Simple.php | 297 - vendor/spikephpcoverage/cli/driver.php | 267 - vendor/spikephpcoverage/cli/instrument.php | 305 - .../conf/phpcoverage.conf.php | 28 - .../parser/BasicXmlParser.php | 171 - .../parser/CoverageXmlParser.php | 92 - vendor/spikephpcoverage/parser/PHPParser.php | 425 -- vendor/spikephpcoverage/parser/Parser.php | 217 - vendor/spikephpcoverage/phpcoverage.inc.php | 56 - .../phpcoverage.remote.bottom.inc.php | 51 - .../phpcoverage.remote.top.inc.php | 151 - .../remote/RemoteCoverageRecorder.php | 309 - .../remote/XdebugTraceReader.php | 125 - .../reporter/CoverageReporter.php | 302 - .../reporter/HtmlCoverageReporter.php | 616 -- .../reporter/css/spikesource.css | 1035 --- .../reporter/html/footer.html | 6 - .../reporter/html/header.html | 17 - .../reporter/html/indexfooter.html | 18 - .../reporter/html/indexheader.html | 41 - .../reporter/images/arrow_down.gif | Bin 169 -> 0 bytes .../reporter/images/arrow_up.gif | Bin 169 -> 0 bytes .../reporter/images/spacer.gif | Bin 43 -> 0 bytes .../images/spikesource/phpcoverage.gif | Bin 4271 -> 0 bytes .../reporter/js/sort_spikesource.js | 310 - .../spikephpcoverage/util/CoverageLogger.php | 103 - vendor/spikephpcoverage/util/Utility.php | 224 - 1027 files changed, 1 insertion(+), 202351 deletions(-) delete mode 100644 README create mode 100644 docs/manual/en.txt rename query-language.txt => docs/manual/en/query-language.txt (100%) delete mode 100644 manual/docs/.htaccess delete mode 100644 manual/docs/en.txt delete mode 100644 manual/docs/en/_old-docs/Configuration - Custom getters and setters.php delete mode 100644 manual/docs/en/_old-docs/Configuration - Custom primary key column.php delete mode 100644 manual/docs/en/_old-docs/Configuration - List of attributes.php delete mode 100644 manual/docs/en/_old-docs/Configuration - Setting default eventlistener.php delete mode 100644 manual/docs/en/_old-docs/Configuration - Setting default fetchmode.php delete mode 100644 manual/docs/en/_old-docs/Configuration - Using sequences.php delete mode 100644 manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Contains.php delete mode 100644 manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Like.php delete mode 100644 manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Regexp.php delete mode 100644 manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Operators - Logical operators.php delete mode 100644 manual/docs/en/_old-docs/Database operations - Limit and offset.php delete mode 100644 manual/docs/en/_old-docs/Database operations - Nested transactions.php delete mode 100644 manual/docs/en/_old-docs/Database operations - Query logging.php delete mode 100644 manual/docs/en/_old-docs/Database operations - Sequences.php delete mode 100644 manual/docs/en/_old-docs/Database operations - Transactions.php delete mode 100644 manual/docs/en/_old-docs/Object relational mapping - Relations - Composites and aggregates.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Association.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Batch.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Immediate.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Lazy.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_ForeignKey.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Manager.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Record.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Session.php delete mode 100644 manual/docs/en/_old-docs/Runtime classes - Doctrine_Table.php delete mode 100644 manual/docs/en/_old-docs/Schema reference - Data types - Array.php delete mode 100644 manual/docs/en/_old-docs/Schema reference - Foreign keys - Introduction.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Collection - Fetching strategies.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Query - Aggregate functions.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Query - Bound parameters.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Query - DQL - SQL conversion.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Query - Fetching strategies.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Query - Lazy property fetching.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Query - Method overloading.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Query - Relation operators.php delete mode 100644 manual/docs/en/_old-docs/Working with objects - Component overview - Record - Adding records.php delete mode 100644 manual/docs/en/basic-schema-mapping.txt delete mode 100644 manual/docs/en/basic-schema-mapping/columns.txt delete mode 100644 manual/docs/en/basic-schema-mapping/columns/column-aliases.txt delete mode 100644 manual/docs/en/basic-schema-mapping/columns/column-naming.txt delete mode 100644 manual/docs/en/basic-schema-mapping/columns/data-types.txt delete mode 100644 manual/docs/en/basic-schema-mapping/columns/default-values.txt delete mode 100644 manual/docs/en/basic-schema-mapping/constraints-and-validators.txt delete mode 100644 manual/docs/en/basic-schema-mapping/indexes.txt delete mode 100644 manual/docs/en/basic-schema-mapping/introduction.txt delete mode 100644 manual/docs/en/basic-schema-mapping/record-identifiers.txt delete mode 100644 manual/docs/en/basic-schema-mapping/table-and-class-naming.txt delete mode 100644 manual/docs/en/basic-schema-mapping/table-options.txt delete mode 100644 manual/docs/en/caching.txt delete mode 100644 manual/docs/en/caching/configuration.txt delete mode 100644 manual/docs/en/caching/introduction.txt delete mode 100644 manual/docs/en/caching/overview.txt delete mode 100644 manual/docs/en/class-templates.txt delete mode 100644 manual/docs/en/coding-standards.txt delete mode 100644 manual/docs/en/coding-standards/coding-style.txt delete mode 100644 manual/docs/en/coding-standards/naming-conventions.txt delete mode 100644 manual/docs/en/coding-standards/overview.txt delete mode 100644 manual/docs/en/coding-standards/php-file-formatting.txt delete mode 100644 manual/docs/en/coding-standards/testing.txt delete mode 100644 manual/docs/en/component-overview.txt delete mode 100644 manual/docs/en/component-overview/hook.txt delete mode 100644 manual/docs/en/component-overview/locking-manager.txt delete mode 100644 manual/docs/en/component-overview/profiler.txt delete mode 100644 manual/docs/en/component-overview/validators.txt delete mode 100644 manual/docs/en/component-overview/view.txt delete mode 100644 manual/docs/en/configuration.txt delete mode 100644 manual/docs/en/configuration/introduction.txt delete mode 100644 manual/docs/en/configuration/levels-of-configuration.txt delete mode 100644 manual/docs/en/configuration/setting-attributes.txt delete mode 100644 manual/docs/en/connection-management.txt delete mode 100644 manual/docs/en/connection-management/connection-component-binding.txt delete mode 100644 manual/docs/en/connection-management/dsn-the-data-source-name.txt delete mode 100644 manual/docs/en/connection-management/lazy-connecting-to-database.txt delete mode 100644 manual/docs/en/connection-management/managing-connections.txt delete mode 100644 manual/docs/en/connection-management/opening-a-new-connection.txt delete mode 100644 manual/docs/en/data-fixtures.txt delete mode 100644 manual/docs/en/database-abstraction.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/bnf.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/conditional-expressions.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/delete-queries.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/examples.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/from-clause.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/functional-expressions.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/group-by-having-clauses.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/indexby-keyword.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/introduction.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/join-syntax.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/limit-and-offset-clauses.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/order-by-clause.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/select-queries.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/subqueries.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/update-queries.txt delete mode 100644 manual/docs/en/dql-doctrine-query-language/where-clause.txt delete mode 100644 manual/docs/en/event-listeners.txt delete mode 100644 manual/docs/en/exceptions-and-warnings.txt delete mode 100644 manual/docs/en/file-parser.txt delete mode 100644 manual/docs/en/getting-started.txt delete mode 100644 manual/docs/en/getting-started/exporting-classes.txt delete mode 100644 manual/docs/en/getting-started/installation.txt delete mode 100644 manual/docs/en/getting-started/starting-new-project.txt delete mode 100644 manual/docs/en/getting-started/working-with-existing-databases.txt delete mode 100644 manual/docs/en/hierarchical-data.txt delete mode 100644 manual/docs/en/hierarchical-data/adjacency-list.txt delete mode 100644 manual/docs/en/hierarchical-data/introduction.txt delete mode 100644 manual/docs/en/hierarchical-data/materialized-path.txt delete mode 100644 manual/docs/en/hierarchical-data/nested-set.txt delete mode 100644 manual/docs/en/improving-performance.txt delete mode 100644 manual/docs/en/improving-performance/bundle-your-class-files.txt delete mode 100644 manual/docs/en/improving-performance/compile.txt delete mode 100644 manual/docs/en/improving-performance/fetch-only-what-you-need.txt delete mode 100644 manual/docs/en/improving-performance/introduction.txt delete mode 100644 manual/docs/en/improving-performance/other-tips.txt delete mode 100644 manual/docs/en/improving-performance/use-a-bytecode-cache.txt delete mode 100644 manual/docs/en/introduction.txt delete mode 100644 manual/docs/en/introduction/further-reading.txt delete mode 100644 manual/docs/en/introduction/key-concepts.txt delete mode 100644 manual/docs/en/introduction/the-big-picture.txt delete mode 100644 manual/docs/en/introduction/what-it-is-and-what-not.txt delete mode 100644 manual/docs/en/mapping-relations.txt delete mode 100644 manual/docs/en/migration.txt delete mode 100644 manual/docs/en/native-sql.txt delete mode 100644 manual/docs/en/object-relational-mapping.txt delete mode 100644 manual/docs/en/plugins.txt delete mode 100644 manual/docs/en/real-world-examples.txt delete mode 100644 manual/docs/en/real-world-examples/album-lister.txt delete mode 100644 manual/docs/en/real-world-examples/forum-application.txt delete mode 100644 manual/docs/en/real-world-examples/user-management-system.txt delete mode 100644 manual/docs/en/relations.txt delete mode 100644 manual/docs/en/schema-files.txt delete mode 100644 manual/docs/en/searching.txt delete mode 100644 manual/docs/en/technology.txt delete mode 100644 manual/docs/en/technology/architecture.txt delete mode 100644 manual/docs/en/technology/design-patterns-used.txt delete mode 100644 manual/docs/en/technology/internal-optimizations.txt delete mode 100644 manual/docs/en/technology/speed.txt delete mode 100644 manual/docs/en/transactions.txt delete mode 100644 manual/docs/en/transactions/introduction.txt delete mode 100644 manual/docs/en/transactions/isolation-levels.txt delete mode 100644 manual/docs/en/transactions/locking-strategies.txt delete mode 100644 manual/docs/en/transactions/nesting.txt delete mode 100644 manual/docs/en/transactions/savepoints.txt delete mode 100644 manual/docs/en/transactions/unit-of-work.txt delete mode 100644 manual/docs/en/utilities.txt delete mode 100644 manual/docs/en/utilities/command-line-interface.txt delete mode 100644 manual/docs/en/utilities/facade.txt delete mode 100644 manual/docs/en/utilities/pagination.txt delete mode 100644 manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt delete mode 100644 manual/docs/en/utilities/pagination/controlling-range-styles.txt delete mode 100644 manual/docs/en/utilities/pagination/customizing-pager-layout.txt delete mode 100644 manual/docs/en/utilities/pagination/introduction.txt delete mode 100644 manual/docs/en/utilities/pagination/working-with-pager.txt delete mode 100644 manual/docs/en/utilities/sandbox.txt delete mode 100644 manual/docs/en/working-with-objects.txt delete mode 100644 manual/docs/en/working-with-objects/component-overview/collection.txt delete mode 100644 manual/docs/en/working-with-objects/component-overview/connection.txt delete mode 100644 manual/docs/en/working-with-objects/component-overview/manager.txt delete mode 100644 manual/docs/en/working-with-objects/component-overview/record.txt delete mode 100644 manual/docs/en/working-with-objects/component-overview/table.txt delete mode 100644 manual/docs/en/working-with-objects/dealing-with-relations.txt delete mode 100644 manual/images/doctrine-layers.jpg delete mode 100644 manual/images/relational-bounds.jpg delete mode 100644 manual/index.php delete mode 100644 manual/lib/.htaccess delete mode 100644 manual/lib/Text/Wiki/Doc.php delete mode 100644 manual/lib/Text/Wiki/Parse/Doc/Code.php delete mode 100644 manual/lib/Text/Wiki/Parse/Doc/Doclink.php delete mode 100644 manual/lib/Text/Wiki/Parse/Doc/Prefilter.php delete mode 100644 manual/lib/Text/Wiki/Parse/Doc/Table.php delete mode 100644 manual/lib/Text/Wiki/Render/Latex.php delete mode 100644 manual/lib/Text/Wiki/Render/Latex/Code.php delete mode 100644 manual/lib/Text/Wiki/Render/Latex/Doclink.php delete mode 100644 manual/lib/Text/Wiki/Render/Latex/Heading.php delete mode 100644 manual/lib/Text/Wiki/Render/Latex/List.php delete mode 100644 manual/lib/Text/Wiki/Render/Latex/Phplookup.php delete mode 100644 manual/lib/Text/Wiki/Render/Latex/Table.php delete mode 100644 manual/lib/Text/Wiki/Render/Latex/Url.php delete mode 100644 manual/lib/Text/Wiki/Render/Xhtml/Blockquote.php delete mode 100644 manual/lib/Text/Wiki/Render/Xhtml/Code.php delete mode 100644 manual/lib/Text/Wiki/Render/Xhtml/Doclink.php delete mode 100644 manual/lib/highlight.php delete mode 100644 manual/scripts/mootools.v1.11.js delete mode 100644 manual/scripts/toc.js delete mode 100644 manual/scripts/tree.js delete mode 100644 manual/styles/basic.css delete mode 100644 manual/styles/iefix.css delete mode 100644 manual/styles/print.css delete mode 100644 manual/templates/.htaccess delete mode 100644 manual/templates/index.tpl.php delete mode 100644 manual/templates/latex.tpl.php delete mode 100644 manual/templates/xhtml.tpl.php delete mode 100644 manual/tmp/.htaccess delete mode 100644 package.php delete mode 100644 package.xml delete mode 100644 package_Core.php delete mode 100644 package_Core.xml delete mode 100644 package_DBAL.php delete mode 100644 package_DBAL.xml delete mode 100644 package_ORM.php delete mode 100644 package_ORM.xml delete mode 100644 svn2cl.xsl delete mode 100644 tests_old/AccessTestCase.php delete mode 100644 tests_old/AuditLogTestCase.php delete mode 100644 tests_old/BatchIteratorTestCase.php delete mode 100644 tests_old/Cache/ApcTestCase.php delete mode 100644 tests_old/Cache/MemcacheTestCase.php delete mode 100644 tests_old/Cache/SqliteTestCase.php delete mode 100644 tests_old/CacheFileTestCase.php delete mode 100644 tests_old/CacheQuerySqliteTestCase.php delete mode 100644 tests_old/CacheSqliteTestCase.php delete mode 100644 tests_old/CacheTestCase.php delete mode 100644 tests_old/CascadingDeleteTestCase.php delete mode 100644 tests_old/ClassTableInheritanceTestCase.php delete mode 100644 tests_old/Collection/SnapshotTestCase.php delete mode 100644 tests_old/CollectionOffsetTestCase.php delete mode 100644 tests_old/CollectionTestCase.php delete mode 100644 tests_old/ColumnAggregationInheritanceTestCase.php delete mode 100644 tests_old/ColumnAliasTestCase.php delete mode 100644 tests_old/CompositePrimaryKeyTestCase.php delete mode 100644 tests_old/ConfigurableTestCase.php delete mode 100644 tests_old/Connection/FirebirdTestCase.php delete mode 100644 tests_old/Connection/InformixTestCase.php delete mode 100644 tests_old/Connection/MssqlTestCase.php delete mode 100644 tests_old/Connection/MysqlTestCase.php delete mode 100644 tests_old/Connection/OracleTestCase.php delete mode 100644 tests_old/Connection/PgsqlTestCase.php delete mode 100644 tests_old/Connection/ProfilerTestCase.php delete mode 100644 tests_old/Connection/SqliteTestCase.php delete mode 100644 tests_old/Connection/UnitOfWork.php delete mode 100644 tests_old/ConnectionTestCase.php delete mode 100644 tests_old/ConnectionTransactionTestCase.php delete mode 100644 tests_old/CtiColumnAggregationTestCase.php delete mode 100644 tests_old/CustomPrimaryKeyTestCase.php delete mode 100644 tests_old/CustomResultSetOrderTestCase.php delete mode 100644 tests_old/CustomResultSetOrderTestCaseTestCase.php delete mode 100644 tests_old/DBTestCase.php delete mode 100644 tests_old/Data/ExportTestCase.php delete mode 100644 tests_old/Data/ImportTestCase.php delete mode 100644 tests_old/DataDict/FirebirdTestCase.php delete mode 100644 tests_old/DataDict/InformixTestCase.php delete mode 100644 tests_old/DataDict/MssqlTestCase.php delete mode 100644 tests_old/DataDict/MysqlTestCase.php delete mode 100644 tests_old/DataDict/OracleTestCase.php delete mode 100644 tests_old/DataDict/PgsqlTestCase.php delete mode 100644 tests_old/DataDict/SqliteTestCase.php delete mode 100644 tests_old/DataDictSqliteTestCase.php delete mode 100644 tests_old/DataDictTestCase.php delete mode 100644 tests_old/DataType/BooleanTestCase.php delete mode 100644 tests_old/DataType/EnumTestCase.php delete mode 100644 tests_old/Db/ProfilerTestCase.php delete mode 100644 tests_old/DbProfilerTestCase.php delete mode 100644 tests_old/DoctrineTest.php delete mode 100644 tests_old/DoctrineTest/Coverage.php delete mode 100644 tests_old/DoctrineTest/Doctrine_UnitTestCase.php delete mode 100644 tests_old/DoctrineTest/GroupTest.php delete mode 100644 tests_old/DoctrineTest/Reporter.php delete mode 100644 tests_old/DoctrineTest/Reporter/Cli.php delete mode 100644 tests_old/DoctrineTest/Reporter/Html.php delete mode 100644 tests_old/DoctrineTest/UnitTestCase.php delete mode 100644 tests_old/DriverTestCase.php delete mode 100644 tests_old/EventListener/ChainTestCase.php delete mode 100644 tests_old/EventListenerTestCase.php delete mode 100644 tests_old/Export/CheckConstraintTestCase.php delete mode 100644 tests_old/Export/FirebirdTestCase.php delete mode 100644 tests_old/Export/InformixTestCase.php delete mode 100644 tests_old/Export/MssqlTestCase.php delete mode 100644 tests_old/Export/MysqlTestCase.php delete mode 100644 tests_old/Export/OracleTestCase.php delete mode 100644 tests_old/Export/PgsqlTestCase.php delete mode 100644 tests_old/Export/RecordTestCase.php delete mode 100644 tests_old/Export/ReporterTestCase.php delete mode 100644 tests_old/Export/SchemaTestCase.php delete mode 100644 tests_old/Export/SqliteTestCase.php delete mode 100644 tests_old/ExportTestCase.php delete mode 100644 tests_old/Expression/DriverTestCase.php delete mode 100644 tests_old/Expression/FirebirdTestCase.php delete mode 100644 tests_old/Expression/InformixTestCase.php delete mode 100644 tests_old/Expression/MssqlTestCase.php delete mode 100644 tests_old/Expression/MysqlTestCase.php delete mode 100644 tests_old/Expression/OracleTestCase.php delete mode 100644 tests_old/Expression/PgsqlTestCase.php delete mode 100644 tests_old/Expression/SqliteTestCase.php delete mode 100644 tests_old/ExpressionTestCase.php delete mode 100644 tests_old/ForeignKeyTestCase.php delete mode 100644 tests_old/HookTestCase.php delete mode 100644 tests_old/Hydrate/FetchModeTestCase.php delete mode 100644 tests_old/HydrateTestCase.php delete mode 100644 tests_old/I18nTestCase.php delete mode 100644 tests_old/Import/BuilderTestCase.php delete mode 100644 tests_old/Import/FirebirdTestCase.php delete mode 100644 tests_old/Import/InformixTestCase.php delete mode 100644 tests_old/Import/MssqlTestCase.php delete mode 100644 tests_old/Import/MysqlTestCase.php delete mode 100644 tests_old/Import/OracleTestCase.php delete mode 100644 tests_old/Import/PgsqlTestCase.php delete mode 100644 tests_old/Import/SchemaTestCase.php delete mode 100644 tests_old/Import/SqliteTestCase.php delete mode 100644 tests_old/ImportTestCase.php delete mode 100644 tests_old/Inheritance/JoinedTestCase.php delete mode 100644 tests_old/Inheritance/SingleTableTestCase.php delete mode 100644 tests_old/Inheritance/TablePerClassTestCase.php delete mode 100644 tests_old/IntegrityActionTestCase.php delete mode 100644 tests_old/ManagerTestCase.php delete mode 100644 tests_old/Metadata/FactoryTestCase.php delete mode 100644 tests_old/Migration/MysqlTestCase.php delete mode 100644 tests_old/MigrationTestCase.php delete mode 100644 tests_old/NestedSet/LoadInSetUpTestCase.php delete mode 100644 tests_old/NestedSet/SingleRootTestCase.php delete mode 100644 tests_old/NewCoreTestCase.php delete mode 100644 tests_old/OneTableOneClassInheritanceTestCase.php delete mode 100644 tests_old/ParserTestCase.php delete mode 100644 tests_old/PessimisticLockingTestCase.php delete mode 100644 tests_old/PluginTestCase.php delete mode 100644 tests_old/Query/AggregateValueTestCase.php delete mode 100644 tests_old/Query/ApplyInheritanceTestCase.php delete mode 100644 tests_old/Query/CacheTestCase.php delete mode 100644 tests_old/Query/CheckTestCase.php delete mode 100644 tests_old/Query/ComponentAliasTestCase.php delete mode 100644 tests_old/Query/ConditionTestCase.php delete mode 100644 tests_old/Query/DeleteTestCase.php delete mode 100644 tests_old/Query/DriverTestCase.php delete mode 100644 tests_old/Query/ExpressionTestCase.php delete mode 100644 tests_old/Query/FromTestCase.php delete mode 100644 tests_old/Query/GroupbyTestCase.php delete mode 100644 tests_old/Query/HavingTestCase.php delete mode 100644 tests_old/Query/IdentifierQuotingTestCase.php delete mode 100755 tests_old/Query/JoinCondition2TestCase.php delete mode 100644 tests_old/Query/JoinConditionTestCase.php delete mode 100644 tests_old/Query/JoinTestCase.php delete mode 100644 tests_old/Query/LimitTestCase.php delete mode 100644 tests_old/Query/MultiJoin2TestCase.php delete mode 100644 tests_old/Query/MultiJoinTestCase.php delete mode 100644 tests_old/Query/MultipleAggregateValueTestCase.php delete mode 100644 tests_old/Query/MysqlSubqueryHavingTestCase.php delete mode 100644 tests_old/Query/MysqlSubqueryTestCase.php delete mode 100644 tests_old/Query/OneToOneFetchingTestCase.php delete mode 100644 tests_old/Query/OrderbyTestCase.php delete mode 100644 tests_old/Query/PgsqlSubqueryTestCase.php delete mode 100644 tests_old/Query/ReferenceModelTestCase.php delete mode 100644 tests_old/Query/RegistryTestCase.php delete mode 100644 tests_old/Query/SelectExpressionTestCase.php delete mode 100644 tests_old/Query/SelectTestCase.php delete mode 100644 tests_old/Query/ShortAliasesTestCase.php delete mode 100644 tests_old/Query/SubqueryTestCase.php delete mode 100644 tests_old/Query/UpdateTestCase.php delete mode 100644 tests_old/Query/WhereTestCase.php delete mode 100644 tests_old/QueryTestCase.php delete mode 100644 tests_old/RawSqlTestCase.php delete mode 100644 tests_old/Record/FilterTestCase.php delete mode 100644 tests_old/Record/HookTestCase.php delete mode 100644 tests_old/Record/InheritanceTestCase.php delete mode 100644 tests_old/Record/LockTestCase.php delete mode 100644 tests_old/Record/SaveBlankRecordTestCase.php delete mode 100644 tests_old/Record/SerializeUnserializeTestCase.php delete mode 100644 tests_old/Record/StateTestCase.php delete mode 100644 tests_old/Record/SynchronizeTestCase.php delete mode 100644 tests_old/Record/ZeroValuesTestCase.php delete mode 100644 tests_old/RecordFilterTestCase.php delete mode 100644 tests_old/RecordTestCase.php delete mode 100644 tests_old/Relation/AccessTestCase.php delete mode 100644 tests_old/Relation/CircularSavingTestCase.php delete mode 100644 tests_old/Relation/ManyToMany2TestCase.php delete mode 100644 tests_old/Relation/ManyToManyTestCase.php delete mode 100644 tests_old/Relation/NestTestCase.php delete mode 100644 tests_old/Relation/OneToManyTestCase.php delete mode 100644 tests_old/Relation/OneToOneTestCase.php delete mode 100644 tests_old/Relation/ParserTestCase.php delete mode 100644 tests_old/RelationTestCase.php delete mode 100644 tests_old/RepositoryTestCase.php delete mode 100644 tests_old/Search/FileTestCase.php delete mode 100644 tests_old/Search/IndexerTestCase.php delete mode 100644 tests_old/Search/QueryTestCase.php delete mode 100644 tests_old/Search/QueryWeightTestCase.php delete mode 100644 tests_old/Search/_files/content.html delete mode 100644 tests_old/Search/_files/content.txt delete mode 100644 tests_old/SearchTestCase.php delete mode 100644 tests_old/Sequence/FirebirdTestCase.php delete mode 100644 tests_old/Sequence/InformixTestCase.php delete mode 100644 tests_old/Sequence/MssqlTestCase.php delete mode 100644 tests_old/Sequence/MysqlTestCase.php delete mode 100644 tests_old/Sequence/OracleTestCase.php delete mode 100644 tests_old/Sequence/PgsqlTestCase.php delete mode 100644 tests_old/Sequence/SqliteTestCase.php delete mode 100644 tests_old/SequenceTestCase.php delete mode 100644 tests_old/TableTestCase.php delete mode 100644 tests_old/TemplateTestCase.php delete mode 100644 tests_old/Ticket/381TestCase.php delete mode 100644 tests_old/Ticket/424BTestCase.php delete mode 100644 tests_old/Ticket/424CTestCase.php delete mode 100644 tests_old/Ticket/428TestCase.php delete mode 100644 tests_old/Ticket/438TestCase.php delete mode 100644 tests_old/Ticket/480TestCase.php delete mode 100644 tests_old/Ticket/576TestCase.php delete mode 100644 tests_old/Ticket/583TestCase.php delete mode 100644 tests_old/Ticket/587TestCase.php delete mode 100644 tests_old/Ticket/626BTestCase.php delete mode 100644 tests_old/Ticket/626CTestCase.php delete mode 100644 tests_old/Ticket/626DTestCase.php delete mode 100644 tests_old/Ticket/638TestCase.php delete mode 100644 tests_old/Ticket/642TestCase.php delete mode 100644 tests_old/Ticket/673TestCase.php delete mode 100644 tests_old/Ticket/697TestCase.php delete mode 100644 tests_old/Ticket/741TestCase.php delete mode 100644 tests_old/Ticket/749TestCase.php delete mode 100644 tests_old/Ticket/912TestCase.php delete mode 100644 tests_old/Ticket/NjeroTestCase.php delete mode 100644 tests_old/TokenizerTestCase.php delete mode 100644 tests_old/Transaction/FirebirdTestCase.php delete mode 100644 tests_old/Transaction/InformixTestCase.php delete mode 100644 tests_old/Transaction/MssqlTestCase.php delete mode 100644 tests_old/Transaction/MysqlTestCase.php delete mode 100644 tests_old/Transaction/OracleTestCase.php delete mode 100644 tests_old/Transaction/PgsqlTestCase.php delete mode 100644 tests_old/Transaction/SqliteTestCase.php delete mode 100644 tests_old/TransactionTestCase.php delete mode 100644 tests_old/TreeStructureTestCase.php delete mode 100644 tests_old/UnitOfWorkTestCase.php delete mode 100644 tests_old/UnsortedTestCase.php delete mode 100644 tests_old/Validator/FutureTestCase.php delete mode 100644 tests_old/Validator/PastTestCase.php delete mode 100644 tests_old/ValidatorTestCase.php delete mode 100644 tests_old/ValueHolderTestCase.php delete mode 100644 tests_old/ViewTestCase.php delete mode 100644 tests_old/coverage/Doctrine.html delete mode 100644 tests_old/coverage/Doctrine_Access.html delete mode 100644 tests_old/coverage/Doctrine_Adapter_Mock.html delete mode 100644 tests_old/coverage/Doctrine_Adapter_Statement_Mock.html delete mode 100644 tests_old/coverage/Doctrine_AuditLog.html delete mode 100644 tests_old/coverage/Doctrine_AuditLog_Listener.html delete mode 100644 tests_old/coverage/Doctrine_Cache_Array.html delete mode 100644 tests_old/coverage/Doctrine_Collection.html delete mode 100644 tests_old/coverage/Doctrine_Configurable.html delete mode 100644 tests_old/coverage/Doctrine_Connection.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Common.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Firebird.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Firebird_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Module.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Mssql.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Mssql_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Mysql.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Mysql_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Oracle.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Oracle_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Pgsql.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Pgsql_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Profiler.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Sqlite.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Sqlite_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Connection_Statement.html delete mode 100644 tests_old/coverage/Doctrine_Connection_UnitOfWork.html delete mode 100644 tests_old/coverage/Doctrine_DataDict.html delete mode 100644 tests_old/coverage/Doctrine_DataDict_Exception.html delete mode 100644 tests_old/coverage/Doctrine_DataDict_Firebird.html delete mode 100644 tests_old/coverage/Doctrine_DataDict_Mssql.html delete mode 100644 tests_old/coverage/Doctrine_DataDict_Mysql.html delete mode 100644 tests_old/coverage/Doctrine_DataDict_Oracle.html delete mode 100644 tests_old/coverage/Doctrine_DataDict_Pgsql.html delete mode 100644 tests_old/coverage/Doctrine_DataDict_Sqlite.html delete mode 100644 tests_old/coverage/Doctrine_Event.html delete mode 100644 tests_old/coverage/Doctrine_EventListener.html delete mode 100644 tests_old/coverage/Doctrine_EventListener_Chain.html delete mode 100644 tests_old/coverage/Doctrine_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Export.html delete mode 100644 tests_old/coverage/Doctrine_Export_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Export_Firebird.html delete mode 100644 tests_old/coverage/Doctrine_Export_Mysql.html delete mode 100644 tests_old/coverage/Doctrine_Export_Oracle.html delete mode 100644 tests_old/coverage/Doctrine_Export_Pgsql.html delete mode 100644 tests_old/coverage/Doctrine_Export_Schema.html delete mode 100644 tests_old/coverage/Doctrine_Export_Sqlite.html delete mode 100644 tests_old/coverage/Doctrine_Expression.html delete mode 100644 tests_old/coverage/Doctrine_Expression_Driver.html delete mode 100644 tests_old/coverage/Doctrine_Expression_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Expression_Mock.html delete mode 100644 tests_old/coverage/Doctrine_Expression_Mysql.html delete mode 100644 tests_old/coverage/Doctrine_Expression_Pgsql.html delete mode 100644 tests_old/coverage/Doctrine_Expression_Sqlite.html delete mode 100644 tests_old/coverage/Doctrine_Formatter.html delete mode 100644 tests_old/coverage/Doctrine_Hook.html delete mode 100644 tests_old/coverage/Doctrine_Hook_Equal.html delete mode 100644 tests_old/coverage/Doctrine_Hook_Integer.html delete mode 100644 tests_old/coverage/Doctrine_Hook_Parser.html delete mode 100644 tests_old/coverage/Doctrine_Hook_Parser_Complex.html delete mode 100644 tests_old/coverage/Doctrine_Hook_WordLike.html delete mode 100644 tests_old/coverage/Doctrine_Hydrate.html delete mode 100644 tests_old/coverage/Doctrine_Hydrate_Array.html delete mode 100644 tests_old/coverage/Doctrine_Hydrate_Record.html delete mode 100644 tests_old/coverage/Doctrine_Hydrator.html delete mode 100644 tests_old/coverage/Doctrine_Hydrator_Abstract.html delete mode 100644 tests_old/coverage/Doctrine_Hydrator_ArrayDriver.html delete mode 100644 tests_old/coverage/Doctrine_Hydrator_RecordDriver.html delete mode 100644 tests_old/coverage/Doctrine_I18n.html delete mode 100644 tests_old/coverage/Doctrine_Import.html delete mode 100644 tests_old/coverage/Doctrine_Import_Builder.html delete mode 100644 tests_old/coverage/Doctrine_Import_Firebird.html delete mode 100644 tests_old/coverage/Doctrine_Import_Mssql.html delete mode 100644 tests_old/coverage/Doctrine_Import_Oracle.html delete mode 100644 tests_old/coverage/Doctrine_Import_Pgsql.html delete mode 100644 tests_old/coverage/Doctrine_Import_Schema.html delete mode 100644 tests_old/coverage/Doctrine_Import_Sqlite.html delete mode 100644 tests_old/coverage/Doctrine_Lib.html delete mode 100644 tests_old/coverage/Doctrine_Locator_Injectable.html delete mode 100644 tests_old/coverage/Doctrine_Manager.html delete mode 100644 tests_old/coverage/Doctrine_Manager_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Migration.html delete mode 100755 tests_old/coverage/Doctrine_Migration_Process.html delete mode 100644 tests_old/coverage/Doctrine_Node.html delete mode 100644 tests_old/coverage/Doctrine_Node_NestedSet.html delete mode 100644 tests_old/coverage/Doctrine_Null.html delete mode 100644 tests_old/coverage/Doctrine_Parser.html delete mode 100644 tests_old/coverage/Doctrine_Parser_Yml.html delete mode 100644 tests_old/coverage/Doctrine_Plugin.html delete mode 100644 tests_old/coverage/Doctrine_Query.html delete mode 100644 tests_old/coverage/Doctrine_Query_Abstract.html delete mode 100644 tests_old/coverage/Doctrine_Query_Check.html delete mode 100644 tests_old/coverage/Doctrine_Query_Condition.html delete mode 100644 tests_old/coverage/Doctrine_Query_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Query_From.html delete mode 100644 tests_old/coverage/Doctrine_Query_Groupby.html delete mode 100644 tests_old/coverage/Doctrine_Query_Having.html delete mode 100644 tests_old/coverage/Doctrine_Query_JoinCondition.html delete mode 100644 tests_old/coverage/Doctrine_Query_Limit.html delete mode 100644 tests_old/coverage/Doctrine_Query_Offset.html delete mode 100644 tests_old/coverage/Doctrine_Query_Orderby.html delete mode 100644 tests_old/coverage/Doctrine_Query_Part.html delete mode 100644 tests_old/coverage/Doctrine_Query_Registry.html delete mode 100644 tests_old/coverage/Doctrine_Query_Select.html delete mode 100644 tests_old/coverage/Doctrine_Query_Set.html delete mode 100644 tests_old/coverage/Doctrine_Query_Tokenizer.html delete mode 100644 tests_old/coverage/Doctrine_Query_Where.html delete mode 100644 tests_old/coverage/Doctrine_RawSql.html delete mode 100644 tests_old/coverage/Doctrine_RawSql_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Record.html delete mode 100644 tests_old/coverage/Doctrine_Record_Abstract.html delete mode 100644 tests_old/coverage/Doctrine_Record_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Record_Filter.html delete mode 100644 tests_old/coverage/Doctrine_Record_Filter_Compound.html delete mode 100644 tests_old/coverage/Doctrine_Record_Filter_Standard.html delete mode 100644 tests_old/coverage/Doctrine_Record_Iterator.html delete mode 100644 tests_old/coverage/Doctrine_Record_Listener.html delete mode 100644 tests_old/coverage/Doctrine_Record_Listener_Chain.html delete mode 100644 tests_old/coverage/Doctrine_Relation.html delete mode 100644 tests_old/coverage/Doctrine_Relation_Association.html delete mode 100644 tests_old/coverage/Doctrine_Relation_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Relation_ForeignKey.html delete mode 100644 tests_old/coverage/Doctrine_Relation_LocalKey.html delete mode 100644 tests_old/coverage/Doctrine_Relation_Nest.html delete mode 100644 tests_old/coverage/Doctrine_Relation_Parser.html delete mode 100644 tests_old/coverage/Doctrine_Relation_Parser_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Search.html delete mode 100644 tests_old/coverage/Doctrine_Search_Analyzer_Standard.html delete mode 100644 tests_old/coverage/Doctrine_Search_Exception.html delete mode 100755 tests_old/coverage/Doctrine_Search_File.html delete mode 100644 tests_old/coverage/Doctrine_Search_Listener.html delete mode 100644 tests_old/coverage/Doctrine_Search_Query.html delete mode 100644 tests_old/coverage/Doctrine_Sequence.html delete mode 100644 tests_old/coverage/Doctrine_Sequence_Firebird.html delete mode 100644 tests_old/coverage/Doctrine_Sequence_Mssql.html delete mode 100644 tests_old/coverage/Doctrine_Sequence_Mysql.html delete mode 100644 tests_old/coverage/Doctrine_Sequence_Oracle.html delete mode 100644 tests_old/coverage/Doctrine_Sequence_Pgsql.html delete mode 100644 tests_old/coverage/Doctrine_Sequence_Sqlite.html delete mode 100644 tests_old/coverage/Doctrine_Table.html delete mode 100644 tests_old/coverage/Doctrine_Table_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Table_Repository.html delete mode 100644 tests_old/coverage/Doctrine_Template.html delete mode 100644 tests_old/coverage/Doctrine_Template_I18n.html delete mode 100644 tests_old/coverage/Doctrine_Template_Listener_Timestampable.html delete mode 100644 tests_old/coverage/Doctrine_Template_NestedSet.html delete mode 100644 tests_old/coverage/Doctrine_Template_Searchable.html delete mode 100644 tests_old/coverage/Doctrine_Template_Sluggable.html delete mode 100644 tests_old/coverage/Doctrine_Template_Timestampable.html delete mode 100644 tests_old/coverage/Doctrine_Template_Versionable.html delete mode 100644 tests_old/coverage/Doctrine_Tokenizer.html delete mode 100644 tests_old/coverage/Doctrine_Transaction.html delete mode 100644 tests_old/coverage/Doctrine_Transaction_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Transaction_Firebird.html delete mode 100644 tests_old/coverage/Doctrine_Transaction_Mock.html delete mode 100644 tests_old/coverage/Doctrine_Transaction_Mssql.html delete mode 100644 tests_old/coverage/Doctrine_Transaction_Mysql.html delete mode 100644 tests_old/coverage/Doctrine_Transaction_Oracle.html delete mode 100644 tests_old/coverage/Doctrine_Transaction_Pgsql.html delete mode 100644 tests_old/coverage/Doctrine_Transaction_Sqlite.html delete mode 100644 tests_old/coverage/Doctrine_Tree.html delete mode 100644 tests_old/coverage/Doctrine_Tree_NestedSet.html delete mode 100644 tests_old/coverage/Doctrine_Validator.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Date.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Driver.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Email.html delete mode 100644 tests_old/coverage/Doctrine_Validator_ErrorStack.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Exception.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Future.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Notblank.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Notnull.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Past.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Range.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Regexp.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Unique.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Unsigned.html delete mode 100644 tests_old/coverage/Doctrine_Validator_Usstate.html delete mode 100644 tests_old/coverage/Doctrine_View.html delete mode 100644 tests_old/coverage/coverage.txt delete mode 100644 tests_old/coverage/index.php delete mode 100755 tests_old/index.php delete mode 100644 tests_old/migration_classes/001_add_table.php delete mode 100644 tests_old/models/Account.php delete mode 100644 tests_old/models/Address.php delete mode 100644 tests_old/models/Album.php delete mode 100644 tests_old/models/App.php delete mode 100644 tests_old/models/App_Category.php delete mode 100644 tests_old/models/App_User.php delete mode 100644 tests_old/models/Assignment.php delete mode 100644 tests_old/models/Auth.php delete mode 100644 tests_old/models/Author.php delete mode 100644 tests_old/models/BadlyNamed__Class.php delete mode 100644 tests_old/models/BarRecord.php delete mode 100644 tests_old/models/BaseSymfonyRecord.php delete mode 100644 tests_old/models/Blog.php delete mode 100644 tests_old/models/BlogTag.php delete mode 100644 tests_old/models/BoardWithPosition.php delete mode 100644 tests_old/models/Book.php delete mode 100644 tests_old/models/Bookmark.php delete mode 100644 tests_old/models/BookmarkUser.php delete mode 100644 tests_old/models/BooleanTest.php delete mode 100644 tests_old/models/CPK_Association.php delete mode 100644 tests_old/models/CPK_Test.php delete mode 100644 tests_old/models/CPK_Test2.php delete mode 100644 tests_old/models/CascadeDeleteRelatedTest.php delete mode 100644 tests_old/models/CascadeDeleteRelatedTest2.php delete mode 100644 tests_old/models/CascadeDeleteTest.php delete mode 100644 tests_old/models/CategoryNestedSet.php delete mode 100644 tests_old/models/CategoryWithPosition.php delete mode 100644 tests_old/models/CheckConstraintTest.php delete mode 100644 tests_old/models/ClientModel.php delete mode 100644 tests_old/models/ColumnAliasTest.php delete mode 100644 tests_old/models/ConcreteEmail.php delete mode 100644 tests_old/models/ConcreteGroup.php delete mode 100644 tests_old/models/ConcreteGroupUser.php delete mode 100644 tests_old/models/ConcreteInheritanceTestParent.php delete mode 100644 tests_old/models/ConcreteUser.php delete mode 100644 tests_old/models/CoverageCodeN.php delete mode 100644 tests_old/models/CustomPK.php delete mode 100644 tests_old/models/CustomSequenceRecord.php delete mode 100644 tests_old/models/Data_File.php delete mode 100644 tests_old/models/DateTest.php delete mode 100644 tests_old/models/Description.php delete mode 100644 tests_old/models/Element.php delete mode 100644 tests_old/models/Email.php delete mode 100644 tests_old/models/Entity.php delete mode 100644 tests_old/models/EntityAddress.php delete mode 100644 tests_old/models/EntityReference.php delete mode 100644 tests_old/models/EnumTest.php delete mode 100644 tests_old/models/EnumTest2.php delete mode 100644 tests_old/models/EnumTest3.php delete mode 100644 tests_old/models/Error.php delete mode 100644 tests_old/models/EventListenerChainTest.php delete mode 100644 tests_old/models/EventListenerTest.php delete mode 100644 tests_old/models/FieldNameTest.php delete mode 100644 tests_old/models/File_Owner.php delete mode 100644 tests_old/models/FilterTest.php delete mode 100644 tests_old/models/FilterTest2.php delete mode 100644 tests_old/models/FooBarRecord.php delete mode 100644 tests_old/models/FooForeignlyOwned.php delete mode 100644 tests_old/models/FooForeignlyOwnedWithPK.php delete mode 100644 tests_old/models/FooLocallyOwned.php delete mode 100644 tests_old/models/FooRecord.php delete mode 100644 tests_old/models/FooReferenceRecord.php delete mode 100644 tests_old/models/ForeignKeyTest.php delete mode 100644 tests_old/models/ForeignKeyTest2.php delete mode 100644 tests_old/models/Forum_Board.php delete mode 100644 tests_old/models/Forum_Category.php delete mode 100644 tests_old/models/Forum_Entry.php delete mode 100644 tests_old/models/Forum_Thread.php delete mode 100644 tests_old/models/Group.php delete mode 100644 tests_old/models/Groupuser.php delete mode 100644 tests_old/models/GzipTest.php delete mode 100644 tests_old/models/I18nTest.php delete mode 100644 tests_old/models/InheritanceDeal.php delete mode 100644 tests_old/models/InheritanceDealUser.php delete mode 100644 tests_old/models/InheritanceUser.php delete mode 100644 tests_old/models/JC1.php delete mode 100644 tests_old/models/JC2.php delete mode 100644 tests_old/models/JC3.php delete mode 100644 tests_old/models/LiabilityCodeN.php delete mode 100644 tests_old/models/Location.php delete mode 100644 tests_old/models/LocationI18n.php delete mode 100644 tests_old/models/Log_Entry.php delete mode 100644 tests_old/models/Log_Status.php delete mode 100644 tests_old/models/M2MTest.php delete mode 100644 tests_old/models/M2MTest2.php delete mode 100644 tests_old/models/MigrationTest.php delete mode 100644 tests_old/models/MyGroup.php delete mode 100644 tests_old/models/MyOneThing.php delete mode 100644 tests_old/models/MyOtherThing.php delete mode 100644 tests_old/models/MyUser.php delete mode 100644 tests_old/models/MyUser2.php delete mode 100644 tests_old/models/MyUserGroup.php delete mode 100644 tests_old/models/MyUserOneThing.php delete mode 100644 tests_old/models/MyUserOtherThing.php delete mode 100644 tests_old/models/MysqlGroup.php delete mode 100644 tests_old/models/MysqlGroupMember.php delete mode 100644 tests_old/models/MysqlIndexTestRecord.php delete mode 100644 tests_old/models/MysqlTestRecord.php delete mode 100644 tests_old/models/MysqlUser.php delete mode 100644 tests_old/models/NestReference.php delete mode 100644 tests_old/models/NestTest.php delete mode 100644 tests_old/models/NestedSetTest_SingleRootNode.php delete mode 100644 tests_old/models/NotNullTest.php delete mode 100644 tests_old/models/ORM_AccessControl.php delete mode 100644 tests_old/models/ORM_AccessControlsGroups.php delete mode 100644 tests_old/models/ORM_AccessGroup.php delete mode 100644 tests_old/models/ORM_TestEntry.php delete mode 100644 tests_old/models/ORM_TestItem.php delete mode 100644 tests_old/models/Package.php delete mode 100644 tests_old/models/PackageVersion.php delete mode 100644 tests_old/models/PackageVersionNotes.php delete mode 100644 tests_old/models/Page.php delete mode 100644 tests_old/models/Phonenumber.php delete mode 100644 tests_old/models/Photo.php delete mode 100644 tests_old/models/Phototag.php delete mode 100644 tests_old/models/PluginSymfonyRecord.php delete mode 100644 tests_old/models/PluginSymfonyRecordTable.php delete mode 100644 tests_old/models/Policy.php delete mode 100644 tests_old/models/PolicyAsset.php delete mode 100644 tests_old/models/PolicyCodeN.php delete mode 100644 tests_old/models/PolicyN.php delete mode 100644 tests_old/models/QueryTest_Board.php delete mode 100644 tests_old/models/QueryTest_Category.php delete mode 100644 tests_old/models/QueryTest_Entry.php delete mode 100644 tests_old/models/QueryTest_Item.php delete mode 100644 tests_old/models/QueryTest_Rank.php delete mode 100644 tests_old/models/QueryTest_User.php delete mode 100644 tests_old/models/QueryTest_UserRank.php delete mode 100644 tests_old/models/RTC1.php delete mode 100644 tests_old/models/RTC2.php delete mode 100644 tests_old/models/RTC3.php delete mode 100644 tests_old/models/RTC4.php delete mode 100644 tests_old/models/RateN.php delete mode 100644 tests_old/models/Rec1.php delete mode 100644 tests_old/models/Rec2.php delete mode 100644 tests_old/models/RecordFilterTest.php delete mode 100644 tests_old/models/RecordHookTest.php delete mode 100644 tests_old/models/Record_City.php delete mode 100644 tests_old/models/Record_Country.php delete mode 100644 tests_old/models/Record_District.php delete mode 100644 tests_old/models/RelationTest.php delete mode 100644 tests_old/models/Resource.php delete mode 100644 tests_old/models/ResourceReference.php delete mode 100644 tests_old/models/ResourceType.php delete mode 100644 tests_old/models/Role.php delete mode 100644 tests_old/models/SearchTest.php delete mode 100644 tests_old/models/SelfRefTest.php delete mode 100644 tests_old/models/SequenceRecord.php delete mode 100644 tests_old/models/SerializeTest.php delete mode 100644 tests_old/models/SoftDeleteTest.php delete mode 100644 tests_old/models/Song.php delete mode 100644 tests_old/models/SymfonyRecord.php delete mode 100644 tests_old/models/SymfonyRecordTable.php delete mode 100644 tests_old/models/Tag.php delete mode 100644 tests_old/models/Task.php delete mode 100644 tests_old/models/TestMovie.php delete mode 100644 tests_old/models/TestMovieUserBookmark.php delete mode 100644 tests_old/models/TestMovieUserVote.php delete mode 100644 tests_old/models/TestRecord.php delete mode 100644 tests_old/models/TestUser.php delete mode 100644 tests_old/models/TreeLeaf.php delete mode 100644 tests_old/models/User.php delete mode 100644 tests_old/models/ValidatorTest.php delete mode 100644 tests_old/models/ValidatorTest_AddressModel.php delete mode 100644 tests_old/models/ValidatorTest_ClientModel.php delete mode 100644 tests_old/models/ValidatorTest_ClientToAddressModel.php delete mode 100644 tests_old/models/ValidatorTest_DateModel.php delete mode 100644 tests_old/models/ValidatorTest_FootballPlayer.php delete mode 100644 tests_old/models/ValidatorTest_Person.php delete mode 100644 tests_old/models/VersioningTest.php delete mode 100644 tests_old/models/ZeroValueTest.php delete mode 100644 tests_old/models/export/Cms_Category.php delete mode 100644 tests_old/models/export/Cms_CategoryLanguages.php delete mode 100644 tests_old/models/gnatEmail.php delete mode 100644 tests_old/models/gnatUser.php delete mode 100644 tests_old/models/mmrGroupUser_B.php delete mode 100644 tests_old/models/mmrGroupUser_C.php delete mode 100644 tests_old/models/mmrGroup_B.php delete mode 100644 tests_old/models/mmrGroup_C.php delete mode 100644 tests_old/models/mmrUser_B.php delete mode 100644 tests_old/models/mmrUser_C.php delete mode 100644 tests_old/mysql_migration_classes/001_mysql_add_table.php delete mode 100644 tests_old/mysql_migration_classes/002_mysql_change_column.php delete mode 100644 tests_old/run.php delete mode 100755 tests_old/schema.xml delete mode 100644 tests_old/schema.yml delete mode 100644 tests_old/template.tpl delete mode 100644 tests_old/unsolved.php delete mode 100644 tools/Bot.php delete mode 100644 tools/sandbox/config.php delete mode 100755 tools/sandbox/doctrine delete mode 100644 tools/sandbox/doctrine.php delete mode 100644 tools/sandbox/index.php.dist delete mode 100644 vendor/PEAR.php delete mode 100644 vendor/Sensei/Sensei.php delete mode 100644 vendor/Sensei/Sensei/Doc/Renderer.php delete mode 100644 vendor/Sensei/Sensei/Doc/Renderer/Exception.php delete mode 100644 vendor/Sensei/Sensei/Doc/Renderer/Latex.php delete mode 100644 vendor/Sensei/Sensei/Doc/Renderer/Pdf.php delete mode 100644 vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php delete mode 100644 vendor/Sensei/Sensei/Doc/Section.php delete mode 100644 vendor/Sensei/Sensei/Doc/Toc.php delete mode 100644 vendor/Sensei/Sensei/Exception.php delete mode 100644 vendor/Text/Wiki.php delete mode 100644 vendor/Text/Wiki/Default.php delete mode 100644 vendor/Text/Wiki/Parse.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Anchor.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Blockquote.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Bold.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Break.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Center.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Code.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Colortext.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Deflist.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Delimiter.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Embed.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Emphasis.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Freelink.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Function.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Heading.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Horiz.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Html.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Image.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Include.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Interwiki.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Italic.php delete mode 100644 vendor/Text/Wiki/Parse/Default/List.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Newline.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Paragraph.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Phplookup.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Prefilter.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Raw.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Revise.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Smiley.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Strong.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Subscript.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Superscript.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Table.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Tighten.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Toc.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Tt.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Underline.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Url.php delete mode 100644 vendor/Text/Wiki/Parse/Default/Wikilink.php delete mode 100644 vendor/Text/Wiki/Render.php delete mode 100644 vendor/Text/Wiki/Render/Latex.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Anchor.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Blockquote.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Bold.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Box.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Break.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Center.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Code.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Colortext.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Deflist.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Delimiter.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Embed.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Emphasis.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Font.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Freelink.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Function.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Heading.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Horiz.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Html.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Image.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Include.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Interwiki.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Italic.php delete mode 100644 vendor/Text/Wiki/Render/Latex/List.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Newline.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Page.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Paragraph.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Phplookup.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Plugin.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Prefilter.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Preformatted.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Raw.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Revise.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Smiley.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Specialchar.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Strong.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Subscript.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Superscript.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Table.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Tighten.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Titlebar.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Toc.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Tt.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Underline.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Url.php delete mode 100644 vendor/Text/Wiki/Render/Latex/Wikilink.php delete mode 100644 vendor/Text/Wiki/Render/Plain.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Anchor.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Blockquote.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Bold.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Box.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Break.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Center.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Code.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Colortext.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Deflist.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Delimiter.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Embed.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Emphasis.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Font.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Freelink.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Function.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Heading.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Horiz.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Html.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Image.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Include.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Interwiki.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Italic.php delete mode 100644 vendor/Text/Wiki/Render/Plain/List.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Newline.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Page.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Paragraph.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Phplookup.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Plugin.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Prefilter.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Preformatted.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Raw.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Revise.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Smiley.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Specialchar.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Strong.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Subscript.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Superscript.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Table.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Tighten.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Titlebar.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Toc.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Tt.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Underline.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Url.php delete mode 100644 vendor/Text/Wiki/Render/Plain/Wikilink.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Address.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Anchor.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Blockquote.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Bold.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Box.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Break.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Center.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Code.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Colortext.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Deflist.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Delimiter.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Embed.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Emphasis.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Font.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Freelink.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Function.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Heading.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Horiz.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Html.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Image.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Include.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Interwiki.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Italic.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/List.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Newline.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Page.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Paragraph.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Phplookup.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Plugin.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Prefilter.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Preformatted.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Raw.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Revise.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Smiley.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Specialchar.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Strong.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Subscript.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Superscript.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Table.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Tighten.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Titlebar.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Toc.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Tt.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Underline.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Url.php delete mode 100644 vendor/Text/Wiki/Render/Xhtml/Wikilink.php delete mode 100644 vendor/spikephpcoverage/CoverageRecorder.php delete mode 100644 vendor/spikephpcoverage/PEAR.php delete mode 100644 vendor/spikephpcoverage/XML/Parser.php delete mode 100644 vendor/spikephpcoverage/XML/Parser/Simple.php delete mode 100644 vendor/spikephpcoverage/cli/driver.php delete mode 100644 vendor/spikephpcoverage/cli/instrument.php delete mode 100644 vendor/spikephpcoverage/conf/phpcoverage.conf.php delete mode 100644 vendor/spikephpcoverage/parser/BasicXmlParser.php delete mode 100644 vendor/spikephpcoverage/parser/CoverageXmlParser.php delete mode 100644 vendor/spikephpcoverage/parser/PHPParser.php delete mode 100644 vendor/spikephpcoverage/parser/Parser.php delete mode 100644 vendor/spikephpcoverage/phpcoverage.inc.php delete mode 100644 vendor/spikephpcoverage/phpcoverage.remote.bottom.inc.php delete mode 100644 vendor/spikephpcoverage/phpcoverage.remote.top.inc.php delete mode 100644 vendor/spikephpcoverage/remote/RemoteCoverageRecorder.php delete mode 100644 vendor/spikephpcoverage/remote/XdebugTraceReader.php delete mode 100644 vendor/spikephpcoverage/reporter/CoverageReporter.php delete mode 100644 vendor/spikephpcoverage/reporter/HtmlCoverageReporter.php delete mode 100644 vendor/spikephpcoverage/reporter/css/spikesource.css delete mode 100644 vendor/spikephpcoverage/reporter/html/footer.html delete mode 100644 vendor/spikephpcoverage/reporter/html/header.html delete mode 100644 vendor/spikephpcoverage/reporter/html/indexfooter.html delete mode 100644 vendor/spikephpcoverage/reporter/html/indexheader.html delete mode 100644 vendor/spikephpcoverage/reporter/images/arrow_down.gif delete mode 100644 vendor/spikephpcoverage/reporter/images/arrow_up.gif delete mode 100644 vendor/spikephpcoverage/reporter/images/spacer.gif delete mode 100644 vendor/spikephpcoverage/reporter/images/spikesource/phpcoverage.gif delete mode 100644 vendor/spikephpcoverage/reporter/js/sort_spikesource.js delete mode 100644 vendor/spikephpcoverage/util/CoverageLogger.php delete mode 100644 vendor/spikephpcoverage/util/Utility.php diff --git a/CHANGELOG b/CHANGELOG index 540fcc61a..8b1378917 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,20 +1 @@ -Beta 3 ------- -* r3323: Added Doctrine_Record and Doctrine_Collection synchronizeWithArray method -* r3264: Added a $deep parameter to Doctrine_Record::refresh() - -Beta 2 ------- - -* r3183: NestedSet: 'level' column renamed to 'lvl' because LEVEL is an oracle keyword. - In order to upgrade existing trees you need to rename the level column to lvl - in your databases. This does not affect your code because the NestedSet now uses - a column alias (lvl as level). So your code still refers to the 'level' field. -* r3048: Doctrine::exportSchema() replaced by Doctrine::createTablesFromModels() -* r3048: Doctrine::exportSql() replaced by Doctrine::generateSqlFromModels() -* r3048: Doctrine::importSchema() replaced by Doctrine::generateModelsFromDb() -* r3048: loadAll() loadAllRuntimeClasses() removed - -Beta 1 ------- diff --git a/README b/README deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/manual/en.txt b/docs/manual/en.txt new file mode 100644 index 000000000..ed20a0980 --- /dev/null +++ b/docs/manual/en.txt @@ -0,0 +1 @@ ++ Query Language diff --git a/query-language.txt b/docs/manual/en/query-language.txt similarity index 100% rename from query-language.txt rename to docs/manual/en/query-language.txt diff --git a/manual/docs/.htaccess b/manual/docs/.htaccess deleted file mode 100644 index 3418e55a6..000000000 --- a/manual/docs/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/manual/docs/en.txt b/manual/docs/en.txt deleted file mode 100644 index fc2e9cf1e..000000000 --- a/manual/docs/en.txt +++ /dev/null @@ -1,28 +0,0 @@ -+ Introduction -+ Getting started -+ Connection management -+ Basic schema mapping -+ Relations -+ Working with objects -+ Component overview -+ Hierarchical data -+ Configuration -+ DQL (Doctrine Query Language) -+ Native SQL -+ Transactions -+ Caching -+ Event listeners -+ Class templates -+ Plugins -+ File parser -+ Migration -+ Data fixtures -+ Schema Files -+ Searching -+ Database abstraction -+ Improving Performance -+ Technology -+ Exceptions and warnings -+ Real world examples -+ Coding standards -+ Utilities \ No newline at end of file diff --git a/manual/docs/en/_old-docs/Configuration - Custom getters and setters.php b/manual/docs/en/_old-docs/Configuration - Custom getters and setters.php deleted file mode 100644 index b264d58fa..000000000 --- a/manual/docs/en/_old-docs/Configuration - Custom getters and setters.php +++ /dev/null @@ -1,22 +0,0 @@ - - -class Customer extends Doctrine_Record { - public function setUp() { - // setup code goes here - } - public function setTableDefinition() { - // table definition code goes here - } - - public function getAvailibleProducts() { - // some code - } - public function setName($name) { - if($this->isValidName($name)) - $this->set("name",$name); - } - public function getName() { - return $this->get("name"); - } -} - diff --git a/manual/docs/en/_old-docs/Configuration - Custom primary key column.php b/manual/docs/en/_old-docs/Configuration - Custom primary key column.php deleted file mode 100644 index 7cb9b3cde..000000000 --- a/manual/docs/en/_old-docs/Configuration - Custom primary key column.php +++ /dev/null @@ -1,10 +0,0 @@ - - -// custom primary key column name - -class Group extends Doctrine_Record { - public function setUp() { - $this->setPrimaryKeyColumn("group_id"); - } -} - diff --git a/manual/docs/en/_old-docs/Configuration - List of attributes.php b/manual/docs/en/_old-docs/Configuration - List of attributes.php deleted file mode 100644 index 715d83f24..000000000 --- a/manual/docs/en/_old-docs/Configuration - List of attributes.php +++ /dev/null @@ -1,51 +0,0 @@ - * Doctrine::ATTR_LISTENER - * Doctrine::ATTR_FETCHMODE = 2; - - * Doctrine::ATTR_CACHE_DIR = 3; - - * Doctrine::ATTR_CACHE_TTL = 4; - - * Doctrine::ATTR_CACHE_SIZE = 5; - - * Doctrine::ATTR_CACHE_SLAM = 6; - - * Doctrine::ATTR_CACHE = 7; - - * Doctrine::ATTR_BATCH_SIZE = 8; - - * Doctrine::ATTR_PK_COLUMNS = 9; - - /** - * primary key type attribute - */ - * Doctrine::ATTR_PK_TYPE = 10; - - /** - * locking attribute - */ - * Doctrine::ATTR_LOCKMODE = 11; - - /** - * validatate attribute - */ - * Doctrine::ATTR_VLD = 12; - - /** - * name prefix attribute - */ - * Doctrine::ATTR_NAME_PREFIX = 13; - - /** - * create tables attribute - */ - * Doctrine::ATTR_CREATE_TABLES = 14; - - /** - * collection key attribute - */ - * Doctrine::ATTR_COLL_KEY = 15; - - /** - * collection limit attribute - */ - * Doctrine::ATTR_COLL_LIMIT = 16; diff --git a/manual/docs/en/_old-docs/Configuration - Setting default eventlistener.php b/manual/docs/en/_old-docs/Configuration - Setting default eventlistener.php deleted file mode 100644 index 8bf431544..000000000 --- a/manual/docs/en/_old-docs/Configuration - Setting default eventlistener.php +++ /dev/null @@ -1,11 +0,0 @@ - - -class Email extends Doctrine_Record { - public function setUp() { - $this->setAttribute(Doctrine::ATTR_LISTENER,new MyListener()); - } - public function setTableDefinition() { - $this->hasColumn("address","string",150,"email|unique"); - } -} - diff --git a/manual/docs/en/_old-docs/Configuration - Setting default fetchmode.php b/manual/docs/en/_old-docs/Configuration - Setting default fetchmode.php deleted file mode 100644 index 09e50959e..000000000 --- a/manual/docs/en/_old-docs/Configuration - Setting default fetchmode.php +++ /dev/null @@ -1,12 +0,0 @@ - - -// setting default fetchmode -// availible fetchmodes are Doctrine::FETCH_LAZY, Doctrine::FETCH_IMMEDIATE and Doctrine::FETCH_BATCH -// the default fetchmode is Doctrine::FETCH_LAZY - -class Address extends Doctrine_Record { - public function setUp() { - $this->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_IMMEDIATE); - } -} - diff --git a/manual/docs/en/_old-docs/Configuration - Using sequences.php b/manual/docs/en/_old-docs/Configuration - Using sequences.php deleted file mode 100644 index af5767efa..000000000 --- a/manual/docs/en/_old-docs/Configuration - Using sequences.php +++ /dev/null @@ -1,10 +0,0 @@ - - -// using sequences - -class User extends Doctrine_Record { - public function setUp() { - $this->setSequenceName("user_seq"); - } -} - diff --git a/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Contains.php b/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Contains.php deleted file mode 100644 index 67b931d12..000000000 --- a/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Contains.php +++ /dev/null @@ -1,8 +0,0 @@ - - -$q = new Doctrine_Query(); - -$q->from('User')->where('User.Phonenumber.phonenumber.contains(?,?,?)'); - -$users = $q->execute(array('123 123 123', '0400 999 999', '+358 100 100')); - diff --git a/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Like.php b/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Like.php deleted file mode 100644 index 1c3aa1ceb..000000000 --- a/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Like.php +++ /dev/null @@ -1,8 +0,0 @@ - - -$q = new Doctrine_Query(); - -$q->from('User')->where('User.Phonenumber.phonenumber.like(?,?)'); - -$users = $q->execute(array('%123%', '456%')); - diff --git a/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Regexp.php b/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Regexp.php deleted file mode 100644 index 7ff724015..000000000 --- a/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Functions - Regexp.php +++ /dev/null @@ -1,8 +0,0 @@ - - -$q = new Doctrine_Query(); - -$q->from('User')->where('User.Phonenumber.phonenumber.regexp(?,?)'); - -$users = $q->execute(array('[123]', '^[3-5]')); - diff --git a/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Operators - Logical operators.php b/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Operators - Logical operators.php deleted file mode 100644 index 4fb406426..000000000 --- a/manual/docs/en/_old-docs/DQL (Doctrine Query Language) - Operators - Logical operators.php +++ /dev/null @@ -1,167 +0,0 @@ - -* - - -NOT, ! - - - - - Logical NOT. Evaluates to 1 if the - operand is 0, to 0 if - the operand is non-zero, and NOT NULL - returns NULL. - -DQL condition :** NOT 10 - - -> 0 - -DQL condition :** NOT 0 - - -> 1 - -DQL condition :** NOT NULL - - -> NULL - -DQL condition :** ! (1+1) - - -> 0 - -DQL condition :** ! 1+1 - - -> 1 - - - - - - The last example produces 1 because the - expression evaluates the same way as - ( ! 1)+1. - - -* - - - - - - - - AND - - - - - Logical AND. Evaluates to 1 if all - operands are non-zero and not NULL, to - 0 if one or more operands are - 0, otherwise NULL is - returned. - -DQL condition :** 1 AND 1 - - -> 1 - -DQL condition :** 1 AND 0 - - -> 0 - -DQL condition :** 1 AND NULL - - -> NULL - -DQL condition :** 0 AND NULL - - -> 0 - -DQL condition :** NULL AND 0 - - -> 0 - - - -* - - - OR - - - - - Logical OR. When both operands are - non-NULL, the result is - 1 if any operand is non-zero, and - 0 otherwise. With a - NULL operand, the result is - 1 if the other operand is non-zero, and - NULL otherwise. If both operands are - NULL, the result is - NULL. - -DQL condition :** 1 OR 1 - - -> 1 - -DQL condition :** 1 OR 0 - - -> 1 - -DQL condition :** 0 OR 0 - - -> 0 - -DQL condition :** 0 OR NULL - - -> NULL - -DQL condition :** 1 OR NULL - - -> 1 - - - -* - - - - - - XOR - - - - - Logical XOR. Returns NULL if either - operand is NULL. For - non-NULL operands, evaluates to - 1 if an odd number of operands is - non-zero, otherwise 0 is returned. - -DQL condition :** 1 XOR 1 - - -> 0 - -DQL condition :** 1 XOR 0 - - -> 1 - -DQL condition :** 1 XOR NULL - - -> NULL - -DQL condition :** 1 XOR 1 XOR 1 - - -> 1 - - - - - - a XOR b is mathematically equal to - (a AND (NOT b)) OR ((NOT a) and b). - - - - diff --git a/manual/docs/en/_old-docs/Database operations - Limit and offset.php b/manual/docs/en/_old-docs/Database operations - Limit and offset.php deleted file mode 100644 index 9dc98d60d..000000000 --- a/manual/docs/en/_old-docs/Database operations - Limit and offset.php +++ /dev/null @@ -1,8 +0,0 @@ - - -$sess = Doctrine_Manager::getInstance()->openConnection(new PDO("dsn","username","password")); - -// select first ten rows starting from the row 20 - -$sess->select("select * from user",10,20); - diff --git a/manual/docs/en/_old-docs/Database operations - Nested transactions.php b/manual/docs/en/_old-docs/Database operations - Nested transactions.php deleted file mode 100644 index ecdb3d370..000000000 --- a/manual/docs/en/_old-docs/Database operations - Nested transactions.php +++ /dev/null @@ -1,18 +0,0 @@ - - -try { - $conn->beginTransaction(); - - $user->save(); - - $conn->beginTransaction(); - $group->save(); - $email->save(); - - $conn->commit(); - - $conn->commit(); -} catch(Exception $e) { - $conn->rollback(); -} - diff --git a/manual/docs/en/_old-docs/Database operations - Query logging.php b/manual/docs/en/_old-docs/Database operations - Query logging.php deleted file mode 100644 index f3714c558..000000000 --- a/manual/docs/en/_old-docs/Database operations - Query logging.php +++ /dev/null @@ -1,16 +0,0 @@ - - - -// works only if you use doctrine database handler - -$dbh = $conn->getDBH(); - -$times = $dbh->getExecTimes(); - -// print all executed queries and their execution times - -foreach($dbh->getQueries() as $index => $query) { - print $query." ".$times[$index]; -} - - diff --git a/manual/docs/en/_old-docs/Database operations - Sequences.php b/manual/docs/en/_old-docs/Database operations - Sequences.php deleted file mode 100644 index a9f2e9e02..000000000 --- a/manual/docs/en/_old-docs/Database operations - Sequences.php +++ /dev/null @@ -1,8 +0,0 @@ - - -$sess = Doctrine_Manager::getInstance()->openConnection(new PDO("dsn","username","password")); - -// gets the next ID from a sequence - -$sess->getNextID($sequence); - diff --git a/manual/docs/en/_old-docs/Database operations - Transactions.php b/manual/docs/en/_old-docs/Database operations - Transactions.php deleted file mode 100644 index 04f5f624d..000000000 --- a/manual/docs/en/_old-docs/Database operations - Transactions.php +++ /dev/null @@ -1,15 +0,0 @@ - - -$sess = Doctrine_Manager::getInstance()->openConnection(new PDO("dsn","username","password")); -try { -$sess->beginTransaction(); - - // some database operations - -$sess->commit(); - -} catch(Exception $e) { - $sess->rollback(); -} - - diff --git a/manual/docs/en/_old-docs/Object relational mapping - Relations - Composites and aggregates.php b/manual/docs/en/_old-docs/Object relational mapping - Relations - Composites and aggregates.php deleted file mode 100644 index bdf774f06..000000000 --- a/manual/docs/en/_old-docs/Object relational mapping - Relations - Composites and aggregates.php +++ /dev/null @@ -1,14 +0,0 @@ -Doctrine supports aggregates and composites. When binding composites you can use methods Doctrine_Record::ownsOne() and Doctrine_Record::ownsMany(). When binding -aggregates you can use methods Doctrine_Record::hasOne() and Doctrine_Record::hasMany(). Basically using the owns* methods is like adding a database level ON CASCADE DELETE -constraint on related component with an exception that doctrine handles the deletion in application level. - - - -In Doctrine if you bind an Email to a User using ownsOne or ownsMany methods, everytime User record calls delete the associated -Email record is also deleted. - - - -Then again if you bind an Email to a User using hasOne or hasMany methods, everytime User record calls delete the associated -Email record is NOT deleted. - diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Association.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Association.php deleted file mode 100644 index 17a2a8859..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Association.php +++ /dev/null @@ -1 +0,0 @@ -Doctrine_Association represents a many-to-many association between database tables. diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection.php deleted file mode 100644 index 3eee67814..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection.php +++ /dev/null @@ -1 +0,0 @@ -Doctrine_Collection is a collection of Data Access Objects. Doctrine_Collection represents a record set. diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Batch.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Batch.php deleted file mode 100644 index d894cbb1b..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Batch.php +++ /dev/null @@ -1 +0,0 @@ -Doctrine_Collection_Batch is a Doctrine_Collection with batch fetching strategy. diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Immediate.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Immediate.php deleted file mode 100644 index 88a47e37d..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Immediate.php +++ /dev/null @@ -1 +0,0 @@ -Doctrine_Collection_Immediate is a Doctrine_Collection with immediate fetching strategy. diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Lazy.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Lazy.php deleted file mode 100644 index 9e0fbcc21..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Collection_Lazy.php +++ /dev/null @@ -1 +0,0 @@ -Doctrine_Collection_Lazy is a Doctrine_Collection with lazy fetching strategy. diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_ForeignKey.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_ForeignKey.php deleted file mode 100644 index db22a18d6..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_ForeignKey.php +++ /dev/null @@ -1 +0,0 @@ -Doctrine_ForeignKey represents a one-to-many association or one-to-one association between two database tables. diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Manager.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Manager.php deleted file mode 100644 index 3e40e60a8..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Manager.php +++ /dev/null @@ -1,2 +0,0 @@ -Doctrine_Manager is the base component of Doctrine ORM framework. Doctrine_Manager is a colletion of Doctrine_Connections. All the new connections are being -opened by Doctrine_Manager::openConnection(). diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Record.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Record.php deleted file mode 100644 index 0d522f176..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Record.php +++ /dev/null @@ -1,43 +0,0 @@ -Doctrine_Record is a wrapper for database row. - - - -$user = $table->find(2); - -// get state -$state = $user->getState(); - -print $user->name; - -print $user["name"]; - -print $user->get("name"); - -$user->name = "Jack Daniels"; - -$user->set("name","Jack Daniels"); - -// serialize record - -$serialized = serialize($user); - -$user = unserialize($serialized); - -// create a copy - -$copy = $user->copy(); - -// get primary key - -$id = $user->getID(); - -// print lots of useful info - -print $user; - -// save all the properties and composites -$user->save(); - -// delete this data access object and related objects -$user->delete(); - diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Session.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Session.php deleted file mode 100644 index 13549761f..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Session.php +++ /dev/null @@ -1,34 +0,0 @@ -Doctrine_Connection is a wrapper for database connection. It creates Doctrine_Tables and keeps track of all the created tables. -Doctrine_Connection provides things that are missing from PDO like sequence support and limit/offset emulation. - - - -$sess = $manager->openConnection(Doctrine_Db::getConnection("schema://username:password@hostname/database")); - -// get connection state: -switch($sess): - case Doctrine_Connection::STATE_BUSY: - // multiple open transactions - break; - case Doctrine_Connection::STATE_ACTIVE: - // one open transaction - break; - case Doctrine_Connection::STATE_CLOSED: - // closed state - break; - case Doctrine_Connection::STATE_OPEN: - // open state and zero open transactions - break; -endswitch; - -// getting database handler - -$dbh = $sess->getDBH(); - -// flushing the connection -$sess->flush(); - - -// print lots of useful info about connection: -print $sess; - diff --git a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Table.php b/manual/docs/en/_old-docs/Runtime classes - Doctrine_Table.php deleted file mode 100644 index 90fbb5320..000000000 --- a/manual/docs/en/_old-docs/Runtime classes - Doctrine_Table.php +++ /dev/null @@ -1,2 +0,0 @@ -Doctrine_Table creates records and holds info of all foreign keys and associations. Doctrine_Table -represents a database table. diff --git a/manual/docs/en/_old-docs/Schema reference - Data types - Array.php b/manual/docs/en/_old-docs/Schema reference - Data types - Array.php deleted file mode 100644 index 7666e9bc7..000000000 --- a/manual/docs/en/_old-docs/Schema reference - Data types - Array.php +++ /dev/null @@ -1 +0,0 @@ -This is the same as 'array' type in PHP. diff --git a/manual/docs/en/_old-docs/Schema reference - Foreign keys - Introduction.php b/manual/docs/en/_old-docs/Schema reference - Foreign keys - Introduction.php deleted file mode 100644 index 24be45d15..000000000 --- a/manual/docs/en/_old-docs/Schema reference - Foreign keys - Introduction.php +++ /dev/null @@ -1,2 +0,0 @@ -A foreign key constraint specifies that the values in a column (or a group of columns) must match the values appearing in some row of another table. -In other words foreign key constraints maintain the referential integrity between two related tables. diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Collection - Fetching strategies.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Collection - Fetching strategies.php deleted file mode 100644 index da55b4238..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Collection - Fetching strategies.php +++ /dev/null @@ -1,124 +0,0 @@ -Whenever you fetch records with eg. Doctrine_Table::findAll or Doctrine_Connection::query methods an instance of -Doctrine_Collection is returned. There are many types of collections in Doctrine and it is crucial to understand -the differences of these collections. Remember choosing the right fetching strategy (collection type) is one of the most -influental things when it comes to boosting application performance. - - - -* Immediate Collection -Fetches all records and all record data immediately into collection memory. Use this collection only if you really need to show all that data -in web page. - - - -Example query: - -SELECT id, name, type, created FROM user - - - -* Batch Collection -Fetches all record primary keys into colletion memory. When individual collection elements are accessed this collection initializes proxy objects. -When the non-primary-key-property of a proxy object is accessed that object sends request to Batch collection which loads the data -for that specific proxy object as well as other objects close to that proxy object. - - - -Example queries: - -SELECT id FROM user - -SELECT id, name, type, created FROM user WHERE id IN (1,2,3,4,5) - -SELECT id, name, type, created FROM user WHERE id IN (6,7,8,9,10) - -[ ... ] - - -* Lazy Collection -Lazy collection is exactly same as Batch collection with batch size preset to one. - - - -Example queries: - -SELECT id FROM user - -SELECT id, name, type, created FROM user WHERE id = 1 - -SELECT id, name, type, created FROM user WHERE id = 2 - -SELECT id, name, type, created FROM user WHERE id = 3 - -[ ... ] - - -* Offset Collection -Offset collection is the same as immediate collection with the difference that it uses database provided limiting of queries. - - - -Example queries: - -SELECT id, name, type, created FROM user LIMIT 5 - -SELECT id, name, type, created FROM user LIMIT 5 OFFSET 5 - -SELECT id, name, type, created FROM user LIMIT 5 OFFSET 10 - -[ ... ] - - - - -$table = $conn->getTable("User"); - -$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_IMMEDIATE); - -$users = $table->findAll(); - -// or - -$users = $conn->query("FROM User-I"); // immediate collection - -foreach($users as $user) { - print $user->name; -} - - -$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_LAZY); - -$users = $table->findAll(); - -// or - -$users = $conn->query("FROM User-L"); // lazy collection - -foreach($users as $user) { - print $user->name; -} - -$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_BATCH); - -$users = $table->findAll(); - -// or - -$users = $conn->query("FROM User-B"); // batch collection - -foreach($users as $user) { - print $user->name; -} - -$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_OFFSET); - -$users = $table->findAll(); - -// or - -$users = $conn->query("FROM User-O"); // offset collection - -foreach($users as $user) { - print $user->name; -} - diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Aggregate functions.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Aggregate functions.php deleted file mode 100644 index b5db6f348..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Aggregate functions.php +++ /dev/null @@ -1,16 +0,0 @@ - - -$q = new Doctrine_Query(); - -$q->from('User(COUNT(id))'); - -// returns an array -$a = $q->execute(); - -// selecting multiple aggregate values: -$q = new Doctrine_Query(); - -$q->from('User(COUNT(id)).Phonenumber(MAX(phonenumber))'); - -$a = $q->execute(); - diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Bound parameters.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Bound parameters.php deleted file mode 100644 index 1985b8f04..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Bound parameters.php +++ /dev/null @@ -1,7 +0,0 @@ - - -$query->from("User") - ->where("User.name = ?"); - -$query->execute(array('Jack Daniels')); - diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - DQL - SQL conversion.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Query - DQL - SQL conversion.php deleted file mode 100644 index e68c79aed..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - DQL - SQL conversion.php +++ /dev/null @@ -1,63 +0,0 @@ -**SELECT**",$line); - $l = str_replace("FROM"," -**FROM**",$l); - $l = str_replace("LEFT JOIN"," -**LEFT JOIN**",$l); - $l = str_replace("INNER JOIN"," -**INNER JOIN**",$l); - $l = str_replace("WHERE"," -**WHERE**",$l); - $l = str_replace("AS","**AS**",$l); - $l = str_replace("ON","**ON**",$l); - $l = str_replace("ORDER BY","**ORDER BY**",$l); - $l = str_replace("LIMIT","**LIMIT**",$l); - $l = str_replace("OFFSET","**OFFSET**",$l); - $l = str_replace("DISTINCT","**DISTINCT**",$l); - $l = str_replace(" ","
",$l); - - print $l."
"; - if(substr($l,0,3) == "SQL") print "
"; -} -} -renderQueries($str); -*/ -?> - diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Fetching strategies.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Fetching strategies.php deleted file mode 100644 index 5c73a8e9c..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Fetching strategies.php +++ /dev/null @@ -1,26 +0,0 @@ - - -// select all users and load the data directly (Immediate fetching strategy) - -$coll = $conn->query("FROM User-I"); - -// or - -$coll = $conn->query("FROM User-IMMEDIATE"); - -// select all users and load the data in batches - -$coll = $conn->query("FROM User-B"); - -// or - -$coll = $conn->query("FROM User-BATCH"); - -// select all user and use lazy fetching - -$coll = $conn->query("FROM User-L"); - -// or - -$coll = $conn->query("FROM User-LAZY"); - diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Lazy property fetching.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Lazy property fetching.php deleted file mode 100644 index 777285716..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Lazy property fetching.php +++ /dev/null @@ -1,7 +0,0 @@ - - - -// retrieve all users with only their properties id and name loaded - -$users = $conn->query("FROM User(id, name)"); - diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Method overloading.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Method overloading.php deleted file mode 100644 index ac9a8f05f..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Method overloading.php +++ /dev/null @@ -1,22 +0,0 @@ -You can overload the query object by calling the dql query parts as methods. - - -$conn = Doctrine_Manager::getInstance()->openConnection(new PDO("dsn","username","password")); - -$query = new Doctrine_Query($conn); - -$query->from("User-b") - ->where("User.name LIKE 'Jack%'") - ->orderby("User.created") - ->limit(5); - -$users = $query->execute(); - -$query->from("User.Group.Phonenumber") - ->where("User.Group.name LIKE 'Actors%'") - ->orderby("User.name") - ->limit(10) - ->offset(5); - -$users = $query->execute(); - diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Relation operators.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Relation operators.php deleted file mode 100644 index 6886e3ad0..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Query - Relation operators.php +++ /dev/null @@ -1,27 +0,0 @@ -Doctrine provides two relation operators: '.' aka dot and ':' aka colon. - - - -The dot-operator is used for SQL LEFT JOINs and the colon-operator is used -for SQL INNER JOINs. Basically you should use dot operator if you want for example -to select all users and their phonenumbers AND it doesn't matter if the users actually have any phonenumbers. - - - -On the other hand if you want to select only the users which actually have phonenumbers you should use the colon-operator. - - -$query->from('User u')->innerJoin('u.Email e'); - -$query->execute(); - -// executed SQL query: -// SELECT ... FROM user INNER JOIN email ON ... - -$query->from('User u')->leftJoin('u.Email e'); - -$query->execute(); - -// executed SQL query: -// SELECT ... FROM user LEFT JOIN email ON ... - diff --git a/manual/docs/en/_old-docs/Working with objects - Component overview - Record - Adding records.php b/manual/docs/en/_old-docs/Working with objects - Component overview - Record - Adding records.php deleted file mode 100644 index 074911bcc..000000000 --- a/manual/docs/en/_old-docs/Working with objects - Component overview - Record - Adding records.php +++ /dev/null @@ -1,3 +0,0 @@ -There are three possible ways to access the properties of a record (fields of database row). -You can use overloading, ArrayAccess interface or simply Doctrine_Record::get() method. -**Doctrine_Record objects have always all properties in lowercase**. diff --git a/manual/docs/en/basic-schema-mapping.txt b/manual/docs/en/basic-schema-mapping.txt deleted file mode 100644 index bc1cf7d28..000000000 --- a/manual/docs/en/basic-schema-mapping.txt +++ /dev/null @@ -1,7 +0,0 @@ -++ Introduction -++ Table and class naming -++ Table options -++ Columns -++ Constraints and validators -++ Record identifiers -++ Indexes diff --git a/manual/docs/en/basic-schema-mapping/columns.txt b/manual/docs/en/basic-schema-mapping/columns.txt deleted file mode 100644 index c49fad1a8..000000000 --- a/manual/docs/en/basic-schema-mapping/columns.txt +++ /dev/null @@ -1,5 +0,0 @@ -+++ Column naming -+++ Column aliases -+++ Default values -+++ Data types -+++ About type conversion diff --git a/manual/docs/en/basic-schema-mapping/columns/column-aliases.txt b/manual/docs/en/basic-schema-mapping/columns/column-aliases.txt deleted file mode 100644 index cd4920eee..000000000 --- a/manual/docs/en/basic-schema-mapping/columns/column-aliases.txt +++ /dev/null @@ -1,14 +0,0 @@ -Doctrine offers a way of setting column aliases. This can be very useful when you want to keep the application logic separate from the database logic. For example if you want to change the name of the database field all you need to change at your application is the column definition. - - -class Book extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('bookName as name', 'string'); - } -} -$book = new Book(); -$book->name = 'Some book'; -$book->save(); - diff --git a/manual/docs/en/basic-schema-mapping/columns/column-naming.txt b/manual/docs/en/basic-schema-mapping/columns/column-naming.txt deleted file mode 100644 index cac20b906..000000000 --- a/manual/docs/en/basic-schema-mapping/columns/column-naming.txt +++ /dev/null @@ -1,8 +0,0 @@ -One problem with database compatibility is that many databases differ in their behaviour of how the result set of a query is returned. MySQL leaves the field names unchanged, which means if you issue a query of the form "SELECT myField FROM ..." then the result set will contain the field 'myField'. - -Unfortunately, this is just the way MySql and some other databases do it. Postgres for example returns all field names in lowercase whilst Oracle returns all field names in uppercase. "So what? In what way does this influence me when using Doctrine?", you may ask. Fortunately, you don't have to bother about that issue at all. - -Doctrine takes care of this problem transparently. That means if you define a derived Record class and define a field called 'myField' you will always access it through $record->myField (or $record['myField'], whatever you prefer) no matter whether you're using MySQL or Postgres or Oracle etc. - -In short: You can name your fields however you want, using under_scores, camelCase or whatever you prefer. - diff --git a/manual/docs/en/basic-schema-mapping/columns/data-types.txt b/manual/docs/en/basic-schema-mapping/columns/data-types.txt deleted file mode 100644 index f0e0e004f..000000000 --- a/manual/docs/en/basic-schema-mapping/columns/data-types.txt +++ /dev/null @@ -1,344 +0,0 @@ -++++ Introduction - -All DBMS provide multiple choice of data types for the information that can be stored in their database table fields. However, the set of data types made available varies from DBMS to DBMS. - -To simplify the interface with the DBMS supported by Doctrine, it was defined a base set of data types that applications may access independently of the underlying DBMS. - -The Doctrine applications programming interface takes care of mapping data types when managing database options. It is also able to convert that is sent to and received from the underlying DBMS using the respective driver. - -The following data type examples should be used with Doctrine's createTable() method. The example array at the end of the data types section may be used with createTable() to create a portable table on the DBMS of choice (please refer to the main Doctrine documentation to find out what DBMS back ends are properly supported). It should also be noted that the following examples do not cover the creation and maintenance of indices, this chapter is only concerned with data types and the proper usage thereof. - -It should be noted that the length of the column affects in database level type as well as application level validated length (the length that is validated with Doctrine validators). - -Example 1. Column named 'content' with type 'string' and length 3000 results in database type 'TEXT' of which has database level length of 4000. However when the record is validated it is only allowed to have 'content' -column with maximum length of 3000. - -Example 2. Column with type 'integer' and length 1 results in 'TINYINT' on many databases. - -In general Doctrine is smart enough to know which integer/string type to use depending on the specified length. - - -++++ Type modifiers - -Within the Doctrine API there are a few modifiers that have been designed to aid in optimal table design. These are: - -* The notnull modifiers -* The length modifiers -* The default modifiers -* unsigned modifiers for some field definitions, although not all DBMS's support this modifier for integer field types. -* zerofill modifiers (not supported by all drivers) -* collation modifiers (not supported by all drivers) -* fixed length modifiers for some field definitions. - -Building upon the above, we can say that the modifiers alter the field definition to create more specific field types for specific usage scenarios. The notnull modifier will be used in the following way to set the default DBMS NOT NULL Flag on the field to true or false, depending on the DBMS's definition of the field value: In PostgreSQL the "NOT NULL" definition will be set to "NOT NULL", whilst in MySQL (for example) the "NULL" option will be set to "NO". In order to define a "NOT NULL" field type, we simply add an extra parameter to our definition array (See the examples in the following section) - - -'sometime' = array( - 'type' => 'time', - 'default' => '12:34:05', - 'notnull' => true, -), - - -Using the above example, we can also explore the default field operator. Default is set in the same way as the notnull operator to set a default value for the field. This value may be set in any character set that the DBMS supports for text fields, and any other valid data for the field's data type. In the above example, we have specified a valid time for the "Time" data type, '12:34:05'. Remember that when setting default dates and times, as well as datetimes, you should research and stay within the epoch of your chosen DBMS, otherwise you will encounter difficult to diagnose errors! - - -'sometext' = array( - 'type' => 'string', - 'length' => 12, -), - - -The above example will create a character varying field of length 12 characters in the database table. If the length definition is left out, Doctrine will create a length of the maximum allowable length for the data type specified, which may create a problem with some field types and indexing. Best practice is to define lengths for all or most of your fields. - - -++++ Boolean - -The boolean data type represents only two values that can be either 1 or 0. Do not assume that these data types are stored as integers because some DBMS drivers may implement this type with single character text fields for a matter of efficiency. Ternary logic is possible by using null as the third possible value that may be assigned to fields of this type. - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('booltest', 'boolean'); - } -} - - - -++++ Integer - -The integer type is the same as integer type in PHP. It may store integer values as large as each DBMS may handle. - -Fields of this type may be created optionally as unsigned integers but not all DBMS support it. Therefore, such option may be ignored. Truly portable applications should not rely on the availability of this option. - -The integer type maps to different database type depending on the column length. - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('integertest', 'integer', 4, array('unsigned' => true)); - } -} - - - -++++ Float - -The float data type may store floating point decimal numbers. This data type is suitable for representing numbers within a large scale range that do not require high accuracy. The scale and the precision limits of the values that may be stored in a database depends on the DBMS that it is used. - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('floattest', 'float'); - } -} - - - -++++ String - -The text data type is available with two options for the length: one that is explicitly length limited and another of undefined length that should be as large as the database allows. - -The length limited option is the most recommended for efficiency reasons. The undefined length option allows very large fields but may prevent the use of indexes, nullability and may not allow sorting on fields of its type. - -The fields of this type should be able to handle 8 bit characters. Drivers take care of DBMS specific escaping of characters of special meaning with the values of the strings to be converted to this type. - -By default Doctrine will use variable length character types. If fixed length types should be used can be controlled via the fixed modifier. - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('stringtest', 'string', 200, array('fixed' => true)); - } -} - - - -++++ Array - -This is the same as 'array' type in PHP. - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('arraytest', 'array', 10000); - } -} - - - -++++ Object - -Doctrine supports objects as column types. Basically you can set an object to a field and Doctrine handles automatically the serialization / unserialization of that object. - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('objecttest', 'object'); - } -} - - - -++++ Blob - -Blob (Binary Large OBject) data type is meant to store data of undefined length that may be too large to store in text fields, like data that is usually stored in files. - -Blob fields are usually not meant to be used as parameters of query search clause (WHERE) unless the underlying DBMS supports a feature usually known as "full text search" - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('blobtest', 'blob'); - } -} - - - -++++ Clob - -Clob (Character Large OBject) data type is meant to store data of undefined length that may be too large to store in text fields, like data that is usually stored in files. - -Clob fields are meant to store only data made of printable ASCII characters whereas blob fields are meant to store all types of data. - -Clob fields are usually not meant to be used as parameters of query search clause (WHERE) unless the underlying DBMS supports a feature usually known as "full text search" - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('clobtest', 'clob'); - } -} - - - -++++ Timestamp - -The timestamp data type is a mere combination of the date and the time of the day data types. The representation of values of the time stamp type is accomplished by joining the date and time string values in a single string joined by a space. Therefore, the format template is YYYY-MM-DD HH:MI:SS. The represented values obey the same rules and ranges described for the date and time data types - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('timestamptest', 'timestamp'); - } -} - - - -++++ Time - -The time data type may represent the time of a given moment of the day. DBMS independent representation of the time of the day is also accomplished by using text strings formatted according to the ISO-8601 standard. - -The format defined by the ISO-8601 standard for the time of the day is HH:MI:SS where HH is the number of hour the day from 00 to 23 and MI and SS are respectively the number of the minute and of the second from 00 to 59. Hours, minutes and seconds numbered below 10 should be padded on the left with 0. - -Some DBMS have native support for time of the day formats, but for others the DBMS driver may have to represent them as integers or text values. In any case, it is always possible to make comparisons between time values as well sort query results by fields of this type. - - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('timetest', 'time'); - } -} - - - -++++ Date - -The date data type may represent dates with year, month and day. DBMS independent representation of dates is accomplished by using text strings formatted according to the IS0-8601 standard. - -The format defined by the ISO-8601 standard for dates is YYYY-MM-DD where YYYY is the number of the year (Gregorian calendar), MM is the number of the month from 01 to 12 and DD is the number of the day from 01 to 31. Months or days numbered below 10 should be padded on the left with 0. - -Some DBMS have native support for date formats, but for others the DBMS driver may have to represent them as integers or text values. In any case, it is always possible to make comparisons between date values as well sort query results by fields of this type. - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('datetest', 'date'); - } -} - - - -++++ Enum - -Doctrine has a unified enum type. Enum typed columns automatically convert the string values into index numbers and vice versa. The possible values for the column can be specified with Doctrine_Record::setEnumValues(columnName, array values). - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('enumtest', 'enum', 4, - array( - 'values' => array( - 'php', - 'java', - 'python' - ) - ) - ); - } -} - - - -++++ Gzip - -Gzip datatype is the same as string except that its automatically compressed when persisted and uncompressed when fetched. This datatype can be useful when storing data with a large compressibility ratio, such as bitmap images. - - -class Test extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('gziptest', 'gzip'); - } -} - - -++++ Examples - -Consider the following definition: - - - -class Example extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumns(array( - 'id' => array( - 'type' => 'text', - 'length' => 32, - 'fixed' => true, - ), - 'someint' => array( - 'type' => 'integer', - 'length' => 10, - 'unsigned' => true, - ), - 'sometext' => array( - 'type' => 'text', - 'length' => 12, - ), - 'somedate' => array( - 'type' => 'date', - ), - 'sometimestamp' => array( - 'type' => 'timestamp', - ), - 'someboolean' => array( - 'type' => 'boolean', - ), - 'somedecimal' => array( - 'type' => 'decimal', - ), - 'somefloat' => array( - 'type' => 'float', - ), - 'sometime' => array( - 'type' => 'time', - 'default' => '12:34:05', - 'notnull' => true, - ), - 'somedate' => array( - 'type' => 'date', - ), - 'someclob' => array( - 'type' => 'clob', - ), - 'someblob' => array( - 'type' => 'blob', - )); -} - - - - -The above example will create a database table as such in Pgsql: - - -|| Column || Type || Not Null ||Default || comment || -|| id || character(32) || || || || -|| somename || character || varying(12) || || || || -|| somedate || date || || || || -|| sometimestamp || timestamp without time zone || || || || -|| someboolean || boolean || || || || -|| somedecimal || numeric(18,2) || || || || -|| somefloat || double precision || || || || -|| sometime || time without time zone || NOT NULL || '12:34:05' || || -|| someclob || text || || || || -|| someblob || bytea || || || || - -And the following table in Mysql: - -|| Field || Type || Collation || Attributes || Null || Default || comment || -|| id || char(32) || || || YES || || || -|| somename || varchar(12) || latin1_swedish_ci || || YES || || || -|| somedate || date || || || YES || || || -|| sometimestamp || timestamp without time zone || || || YES || || || -|| someboolean || tinyint(1) || || || YES || || || -|| somedecimal || decimal(18,2) || || || YES || || || -|| somefloat || double || || || YES || || || -|| sometime || time || || || NO || 12:34:05 || || -|| someclob || longtext || latin1_swedish_ci || || YES || || || -|| someblob || longblob || || binary || YES || || || - - - diff --git a/manual/docs/en/basic-schema-mapping/columns/default-values.txt b/manual/docs/en/basic-schema-mapping/columns/default-values.txt deleted file mode 100644 index afebeb70b..000000000 --- a/manual/docs/en/basic-schema-mapping/columns/default-values.txt +++ /dev/null @@ -1,14 +0,0 @@ -Doctrine supports default values for all data types. When default value is attached to a record column this means two of things. -First this value is attached to every newly created Record. - - -class User extends Doctrine_record { - public function setTableDefinition() { - $this->hasColumn('name', 'string', 50, array('default' => 'default name')); - } -} -$user = new User(); -print $user->name; // default name - - -Also when exporting record class to database DEFAULT //value// is attached to column definition statement. diff --git a/manual/docs/en/basic-schema-mapping/constraints-and-validators.txt b/manual/docs/en/basic-schema-mapping/constraints-and-validators.txt deleted file mode 100644 index a6f1913fe..000000000 --- a/manual/docs/en/basic-schema-mapping/constraints-and-validators.txt +++ /dev/null @@ -1,166 +0,0 @@ -+++ Introduction - -//From [http://www.postgresql.org/docs/8.2/static/ddl-constraints.html PostgreSQL Documentation]:// - -> Data types are a way to limit the kind of data that can be stored in a table. For many applications, however, the constraint they provide is too coarse. For example, a column containing a product price should probably only accept positive values. But there is no standard data type that accepts only positive numbers. Another issue is that you might want to constrain column data with respect to other columns or rows. For example, in a table containing product information, there should be only one row for each product number. - -Doctrine allows you to define *portable* constraints on columns and tables. Constraints give you as much control over the data in your tables as you wish. If a user attempts to store data in a column that would violate a constraint, an error is raised. This applies even if the value came from the default value definition. - -Doctrine constraints act as database level constraints as well as application level validators. This means double security: the database doesn't allow wrong kind of values and neither does the application. - -Here is a full list of available validators within Doctrine: - -|| validator(arguments) || constraints || description || -|| notnull || NOT NULL || Ensures the 'not null' constraint in both application and database level || -|| email || || Checks if value is valid email. || -|| notblank || NOT NULL || Checks if value is not blank. || -|| notnull || || Checks if value is not null. || -|| nospace || || Checks if value has no space chars. || -|| past || CHECK constraint || Checks if value is a date in the past. || -|| future || || Checks if value is a date in the future. || -|| minlength(length) || || Checks if value satisfies the minimum length. || -|| country || || Checks if value is a valid country code. || -|| ip || || Checks if value is valid IP (internet protocol) address. || -|| htmlcolor || || Checks if value is valid html color. || -|| range(min, max) || CHECK constraint || Checks if value is in range specified by arguments. || -|| unique || UNIQUE constraint || Checks if value is unique in its database table. || -|| regexp(expression) || || Checks if value matches a given regexp. || -|| creditcard || || Checks whether the string is a well formated credit card number || -|| digits(int, frac) || Precision and scale || Checks if given value has //int// number of integer digits and //frac// number of fractional digits || - -+++ Notnull - -A not-null constraint simply specifies that a column must not assume the null value. A not-null constraint is always written as a column constraint. - -The following definition uses a notnull constraint for column {{name}}. This means that the specified column doesn't accept null values. - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 200, array('notnull' => true, - 'primary' => true)); - } -} - - -When this class gets exported to database the following SQL statement would get executed (in MySQL): - - -CREATE TABLE user (name VARCHAR(200) NOT NULL, PRIMARY KEY(name)) - - -The notnull constraint also acts as an application level validator. This means that if Doctrine validators are turned on, Doctrine will automatically check that specified columns do not contain null values when saved. - -If those columns happen to contain null values {{Doctrine_Validator_Exception}} is raised. - - -+++ Unique - -Unique constraints ensure that the data contained in a column or a group of columns is unique with respect to all the rows in the table. - -In general, a unique constraint is violated when there are two or more rows in the table where the values of all of the columns included in the constraint are equal. However, two null values are not considered equal in this comparison. That means even in the presence of a unique constraint it is possible to store duplicate rows that contain a null value in at least one of the constrained columns. This behavior conforms to the SQL standard, but some databases do not follow this rule. So be careful when developing applications that are intended to be portable. - -The following definition uses a unique constraint for column {{name}}. - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 200, array('unique' => true)); - } -} - - ->> Note: You should only use unique constraints for other than primary key columns. Primary key columns are always unique. - -+++ Check - -Some of the Doctrine validators also act as database level check constraints. When a record with these validators is exported additional CHECK constraints are being added to CREATE TABLE statement. - -Consider the following example which uses 'min' validator: - - -class Product extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', 4, 'primary'); - $this->hasColumn('price', 'decimal', 18, array('min' => 0)); - } -} - - -When exported the given class definition would execute the following statement (in pgsql): - - -CREATE TABLE product ( - id INTEGER, - price NUMERIC, - PRIMARY KEY(id), - CHECK (price >= 0)) - - -So Doctrine optionally ensures even at the database level that the price of any product cannot be below zero. - -You can also set the maximum value of a column by using the 'max' validator. This also creates the equivalent CHECK constraint. - - -class Product extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', 4, 'primary'); - $this->hasColumn('price', 'decimal', 18, array('min' => 0, 'max' => 1000000)); - } -} - - -Generates (in pgsql): - - -CREATE TABLE product ( - id INTEGER, - price NUMERIC, - PRIMARY KEY(id), - CHECK (price >= 0), - CHECK (price <= 1000000)) - - -Lastly you can create any kind of CHECK constraints by using the check() method of the Doctrine_Record. In the last example we add constraint to ensure that price is always higher than the discounted price. - - -class Product extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', 4, 'primary'); - $this->hasColumn('price', 'decimal', 18, array('min' => 0, 'max' => 1000000)); - $this->hasColumn('discounted_price', 'decimal', 18, array('min' => 0, 'max' => 1000000)); - - $this->check('price > discounted_price'); - } -} - - -Generates (in pgsql): - - -CREATE TABLE product ( - id INTEGER, - price NUMERIC, - PRIMARY KEY(id), - CHECK (price >= 0), - CHECK (price <= 1000000), - CHECK (price > discounted_price)) - - - -> NOTE: some databases don't support CHECK constraints. When this is the case Doctrine simple skips the creation of check constraints. - -If the Doctrine validators are turned on the given definition would also ensure that when a record is being saved its price is always greater than zero. - -If some of the prices of the saved products within a transaction is below zero, Doctrine throws Doctrine_Validator_Exception and automatically rolls back the transaction. - diff --git a/manual/docs/en/basic-schema-mapping/indexes.txt b/manual/docs/en/basic-schema-mapping/indexes.txt deleted file mode 100644 index 96a872cb4..000000000 --- a/manual/docs/en/basic-schema-mapping/indexes.txt +++ /dev/null @@ -1,119 +0,0 @@ -+++ Introduction - -Indexes are used to find rows with specific column values quickly. Without an index, the database must begin with the first row and then read through the entire table to find the relevant rows. - -The larger the table, the more this consumes time. If the table has an index for the columns in question, the database can quickly determine the position to seek to in the middle of the data file without having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than reading rows one-by-one. - -Indexes come with a cost as they slow down the inserts and updates. However, in general you should **always** use indexes for the fields that are used in SQL where conditions. - - -+++ Adding indexes - -You can add indexes by simple calling {{Doctrine_Record::index('indexName', $definition)}} where {{$definition}} is the definition array. - -An example of adding a simple index to field called {{name}}: - - -class IndexTest extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - - $this->index('myindex', array('fields' => 'name')); - } -} - - -An example of adding a multi-column index to field called {{name}}: - - -class MultiColumnIndexTest extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('code', 'string'); - - $this->index('myindex', array('fields' => array('name', 'code'))); - } -} - - -An example of adding a multiple indexes on same table: - - -class MultipleIndexTest extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('code', 'string'); - $this->hasColumn('age', 'integer'); - - $this->index('myindex', array('fields' => array('name', 'code'))); - $this->index('ageindex', array('fields' => array('age')); - } -} - - - -+++ Index options - -Doctrine offers many index options, some of them being db-specific. Here is a full list of available options: - - -sorting => string('ASC' / 'DESC') - what kind of sorting does the index use (ascending / descending) - -length => integer - index length (only some drivers support this) - -primary => boolean(true / false) - whether or not the index is primary index - -type => string('unique', -- supported by most drivers - 'fulltext', -- only availible on Mysql driver - 'gist', -- only availible on Pgsql driver - 'gin') -- only availible on Pgsql driver - - - -class MultipleIndexTest extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('code', 'string'); - $this->hasColumn('age', 'integer'); - - $this->index('myindex', array( - 'fields' => array( - 'name' => - array('sorting' => 'ASC', - 'length' => 10), - 'code'), - 'type' => 'unique', - )); - } -} - - - -+++ Special indexes - -Doctrine supports many special indexes. These include Mysql FULLTEXT and Pgsql GiST indexes. In the following example we define a Mysql FULLTEXT index for the field 'content'. - - -class Article -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('content', 'string'); - - $this->index('content', array('fields' => 'content', - 'type' => 'fulltext')); - } -} - diff --git a/manual/docs/en/basic-schema-mapping/introduction.txt b/manual/docs/en/basic-schema-mapping/introduction.txt deleted file mode 100644 index 2205e64d0..000000000 --- a/manual/docs/en/basic-schema-mapping/introduction.txt +++ /dev/null @@ -1,65 +0,0 @@ -This chapter and its subchapters tell you how to do basic schema mappings with Doctrine. After you've come in terms with the concepts of this chapter you'll know how to: - -1. Define columns for your record classes -2. Define table options -3. Define indexes -4. Define basic constraints and validators for columns - -All column mappings within Doctrine are being done via the hasColumn() method of the Doctrine_Record. The hasColumn takes 4 arguments: - -# **column name** String that specifies the column name and optional alias. This is needed for all columns. If you want to specify an alias for the column name you'll need to use the format '[columnName] as [columnAlias]' -# **column type** String that specifies the column type. See the column types section. -# **column length** Integer that specifies the column length. Some column types depend not only the given portable type but also on the given length. For example type string with length 1000 will be translated into native type TEXT on mysql. -# **column constraints and validators** An array that specifies the list of constraints and validators applied to given column. - -Note that validators / column constraints and the column length fields are optional. The length may be omitted by using **null** for the length argument, allowing doctrine to use a default length and permitting a fourth argument for validation or column constraints. - -Lets take our first example. The following definition defines a class called Email which refers to a table called 'emails'. The Email class has two columns id (an auto-incremented primary key column) and a string column called address. - -Notice how we add two validators / constraints for the address column (notblank and email). The notblank validator assures that the address column isn't blank (so it must not contain space-characters only) whereas the email validator ensures that the address is a valid email address. - - -class Email extends Doctrine_Record { - public function setTableDefinition() { - // setting custom table name: - $this->setTableName('emails'); - - $this->hasColumn('address', // name of the column - 'string', // column type - '200', // column length - array('notblank' => true, - 'email' => true // validators / constraints - ) - ); - } -} - - -Now lets create an export script for this class: - - -require_once('Email.php'); -require_once('path-to-Doctrine/Doctrine.php'); - -require_once('path-to-doctrine/lib/Doctrine.php'); - -spl_autoload_register(array('Doctrine', 'autoload')); - -// in order to export we need a database connection -$manager = Doctrine_Manager::getInstance(); -$conn = $manager->openConnection('mysql://user:pass@localhost/test'); - -$conn->export->exportClasses(array('Email')); - - -The script would execute the following sql (we are using Mysql here as the database backend): - - -CREATE TABLE emails (id INT NOT NULL AUTO_INCREMENT, address VARCHAR(200) NOT NULL) - - - - - - - diff --git a/manual/docs/en/basic-schema-mapping/record-identifiers.txt b/manual/docs/en/basic-schema-mapping/record-identifiers.txt deleted file mode 100644 index 91f0d92bd..000000000 --- a/manual/docs/en/basic-schema-mapping/record-identifiers.txt +++ /dev/null @@ -1,133 +0,0 @@ -+++ Introduction - -Doctrine supports many kind of identifiers. For most cases it is recommended not to specify any primary keys (Doctrine will then use field name {{id}} as an autoincremented primary key). When using table creation Doctrine is smart enough to emulate the autoincrementation with sequences and triggers on databases that doesn't support it natively. - - -+++ Natural - -Natural identifier is a property or combination of properties that is unique and non-null. The use of natural identifiers is encouraged. - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 200, array('primary' => true)); - } -} - - -+++ Autoincremented -Autoincrement primary key is the most basic identifier and its usage is strongly encouraged. Sometimes you may want to use some other name than {{id}} for your autoinc primary key. It can be specified as follows: - - -class User extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('uid', 'integer', 20, array('primary' => true, 'autoincrement' => true)); - - } -} - - -You should consider using autoincremented or sequential primary keys only when the record cannot be identified naturally (in other words it doesn't have a natural identifier). - -The following example shows why natural identifiers are more efficient. - -Consider three classes Permission, Role and RolePermission. Roles having many permissions and vice versa (so their relation is many-to-many). Now lets also assume that each role and permission are naturally identified by their names. - -Now adding autoincremented primary keys to these classes would be simply stupid. It would require more data and it would make the queries more inefficient. For example fetching all permissions for role 'Admin' would be done as follows (when using autoinc pks): - - -SELECT p.* - FROM Permission p - LEFT JOIN RolePermission rp ON rp.permission_id = p.id - LEFT JOIN Role r ON rp.role_id = r.id - WHERE r.name = 'Admin' - - -Now remember sql JOINS are always expensive and here we are using two of those. When using natural identifiers the query would look like: - - -SELECT p.* - FROM Permission p - LEFT JOIN RolePermission rp ON rp.permission_name = p.name - WHERE rp.role_name = 'Admin' - - -Thats -1 JOIN ! - -+++ Composite - -Composite primary key can be used efficiently in association tables (tables that connect two components together). It is not recommended to use composite primary keys in anywhere else as Doctrine does not support mapping relations on multiple columns. - -Due to this fact your doctrine-based system will scale better if it has autoincremented primary key even for association tables. - - -class Groupuser extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('user_id', 'integer', 20, array('primary' => true)); - $this->hasColumn('group_id', 'integer', 20, array('primary' => true)); - } -} - - - -+++ Sequence - -Doctrine supports sequences for generating record identifiers. Sequences are a way of offering unique IDs for data rows. If you do most of your work with e.g. MySQL, think of sequences as another way of doing {{AUTO_INCREMENT}}. - -Doctrine knows how to do sequence generation in the background so you don't have to worry about calling database specific queries - Doctrine does it for you, all you need to do is define a column as a sequence column and optionally provide the name of the sequence table and the id column name of the sequence table. - -Consider the following record definition: - - -class Book extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', null, array('primary' => true, 'sequence' => true)); - $this->hasColumn('name', 'string'); - } -} - - -By default Doctrine uses the following format for sequence tables {{[tablename]_seq}}. If you wish to change this you can use the following piece of code to change the formatting: - - -$manager = Doctrine_Manager::getInstance(); -$manager->setAttribute(Doctrine::ATTR_SEQNAME_FORMAT, '%s_my_seq'); - - -Doctrine uses column named id as the sequence generator column of the sequence table. If you wish to change this globally (for all connections and all tables) you can use the following code: - - -$manager = Doctrine_Manager::getInstance(); -$manager->setAttribute(Doctrine::ATTR_SEQCOL_NAME, 'my_seq_column'); - - -In the following example we do not wish to change global configuration we just want to make the {{id}} column to use sequence table called {{book_sequence}}. It can be done as follows: - - -class Book extends Doctrine_Record { - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', null, array('primary', 'sequence' => 'book_sequence')); - $this->hasColumn('name', 'string'); - } -} - - -Here we take the preceding example a little further: we want to have a custom sequence column. Here it goes: - - -class Book extends Doctrine_Record { - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', null, array('primary', 'sequence' => array('book_sequence', 'sequence'))); - $this->hasColumn('name', 'string'); - } -} - - diff --git a/manual/docs/en/basic-schema-mapping/table-and-class-naming.txt b/manual/docs/en/basic-schema-mapping/table-and-class-naming.txt deleted file mode 100644 index bf47ff62c..000000000 --- a/manual/docs/en/basic-schema-mapping/table-and-class-naming.txt +++ /dev/null @@ -1,12 +0,0 @@ -Doctrine automatically creates table names from the record class names. For this reason, it is recommended to name your record classes using the following rules: - -* Use {{CamelCase}} naming -* Underscores are allowed -* The first letter must be capitalized -* The class name cannot be one of the following (these keywords are reserved in DQL API): - * {{ALL}}, {{AND}}, {{ANY}}, {{AS}}, {{ASC}}, {{AVG}}, {{BETWEEN}}, {{BIT_LENGTH}}, {{BY}}, {{CHARACTER_LENGTH}}, {{CHAR_LENGTH}}, {{COUNT}}, {{CURRENT_DATE}}, {{CURRENT_TIME}}, {{CURRENT_TIMESTAMP}}, {{DELETE}}, {{DESC}}, {{DISTINCT}}, {{EMPTY}}, {{EXISTS}}, {{FALSE}}, {{FETCH}}, {{FROM}}, {{GROUP}}, {{HAVING}}, {{IN}}, {{INDEXBY}}, {{INNER}}, {{IS}}, {{JOIN}}, {{LEFT}}, {{LIKE}}, {{LOWER}}, {{MAX}}, {{MEMBER}}, {{MIN}}, {{MOD}}, {{NEW}}, {{NOT}}, {{NULL}}, {{OBJECT}}, {{OF}}, {{OR}}, {{ORDER}}, {{OUTER}}, {{POSITION}}, {{SELECT}}, {{SOME}}, {{SUM}}, {{TRIM}}, {{TRUE}}, {{UNKNOWN}}, {{UPDATE}}, {{UPPER}} and {{WHERE}}. - -**Example:** {{My_PerfectClass}} - -If you need to use a different naming schema, you can override this using the {{setTableName()}} method in the {{setTableDefinition()}} method. - diff --git a/manual/docs/en/basic-schema-mapping/table-options.txt b/manual/docs/en/basic-schema-mapping/table-options.txt deleted file mode 100644 index 883ca4866..000000000 --- a/manual/docs/en/basic-schema-mapping/table-options.txt +++ /dev/null @@ -1,50 +0,0 @@ -Doctrine offers various table options. All table options can be set via {{Doctrine_Record::option($optionName, $value)}}. - -For example if you are using MySQL and want to use INNODB tables it can be done as follows: - - -class MyInnoDbRecord extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - - $this->option('type', 'INNODB'); - } -} - - -In the following example we set the collate and character set options: - - -class MyCustomOptionRecord extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - - $this->option('collate', 'utf8_unicode_ci'); - $this->option('charset', 'utf8'); - } -} - - -It is worth noting that for certain databases (Firebird, MySql and PostgreSQL) setting the charset option might not be enough for Doctrine to return data properly. For those databases, users are advised to also use the setCharset function of the database connection: - - -Doctrine_Manager::connection($name)->setCharset("utf8"); - - -Doctrine offers the ability to turn off foreign key constraints for specific Models. - - -class MyCustomOptionRecord extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - - $this->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL ^ Doctrine::EXPORT_CONSTRAINTS); - } -} - \ No newline at end of file diff --git a/manual/docs/en/caching.txt b/manual/docs/en/caching.txt deleted file mode 100644 index 33e46458c..000000000 --- a/manual/docs/en/caching.txt +++ /dev/null @@ -1,175 +0,0 @@ -++ Introduction -{{Doctrine_Cache}} offers an intuitive and easy-to-use query caching solution. It provides the following things: - -* Multiple cache backends to choose from (including Memcached, APC and Sqlite) -* Advanced options for fine-tuning. {{Doctrine_Cache}} has many options for fine-tuning performance. - -Initializing a new cache driver instance: - - -$cacheDriver = new Doctrine_Cache_Memcache($options); - - -++ Drivers -+++ Memcache -Memcache driver stores cache records into a memcached server. Memcached is a high-performance, distributed memory object caching system. In order to use this backend, you need a memcached daemon and the memcache PECL extension. - - -// memcache allows multiple servers -$servers = array('host' => 'localhost', - 'port' => 11211, - 'persistent' => true); - -$cacheDriver = new Doctrine_Cache_Memcache(array('servers' => $servers, - 'compression' => false)); - - -Available options for Memcache driver: - -||~ Option ||~ Data Type ||~ Default Value ||~ Description || -|| servers || array || array(array('host' => 'localhost','port' => 11211, 'persistent' => true)) || An array of memcached servers ; each memcached server is described by an associative array : 'host' => (string) : the name of the memcached server, 'port' => (int) : the port of the memcached server, 'persistent' => (bool) : use or not persistent connections to this memcached server || -|| compression || boolean || false || true if you want to use on-the-fly compression || - -+++ APC -The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. - -The APC cache driver of Doctrine stores cache records in shared memory. - - -$cacheDriver = new Doctrine_Cache_Apc(); - - - -+++ Db - -Db caching backend stores cache records into given database. Usually some fast flat-file based database is used (such as sqlite). - -Initializing sqlite cache driver can be done as above: - - -$conn = Doctrine_Manager::connection(new PDO('sqlite::memory:')); - -$cacheDriver = new Doctrine_Cache_Sqlite(array('connection' => $conn)); - - -++ Query Cache & Result Cache - -+++ Introduction - -Doctrine provides means for caching the results of the DQL parsing process, as well as the end results of DQL queries (the data). These two caching mechanisms can greatly increase performance. Consider the standard workflow of DQL query execution: - -# Init new DQL query -# Parse DQL query -# Build database specific SQL query -# Execute the SQL query -# Build the result set -# Return the result set - -Now these phases can be very time consuming, especially phase 4 which sends the query to your database server. When Doctrine query cache is being used only the following phases occur: -# Init new DQL query -# Execute the SQL query (grabbed from the cache) -# Build the result set -# Return the result set -If a DQL query has a valid cache entry the cached SQL query is used, otherwise the phases 2-3 are executed normally and the result of these steps is then stored in the cache. -The query cache has no disadvantages, since you always get a fresh query result. You should therefore always use it in a production environment. That said, you can easily use it during development, too. Whenever you change a DQL query and execute it the first time Doctrine sees that is has been modified and will therefore create a new cache entry, so you dont even need to invalidate the cache. It's worth noting that the effectiveness of the query cache greatly relies on the usage of prepared staments (which are used by Doctrine by default anyway). You should not directly embed dynamic query parts and always use placeholders instead. - -When using a result cache things get even better. Then your query process looks as follows (assuming a valid cache entry is found): -# Init new DQL query -# Return the result set -As you can see, the result cache implies the query cache shown previously. -You should always consider using a result cache if the data returned by the query does not need to be up-to-date at any time. - -+++ Query Cache - -++++ Using the query cache - -You can set a connection or manager level query cache driver by using Doctrine::ATTR_QUERY_CACHE. Setting a connection level cache driver means that all queries executed with this connection use the specified cache driver whereas setting a manager level cache driver means that all connections (unless overridden at connection level) will use the given cache driver. - -Setting a manager level query cache driver: - -$manager = Doctrine_Manager::getInstance(); - -$manager->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver); - - -Setting a connection level cache driver: - -$manager = Doctrine_Manager::getInstance(); -$conn = $manager->openConnection('pgsql://user:pass@localhost/test'); - -$conn->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver); - - -++++ Fine-tuning - -In the previous chapter we used global caching attributes. These attributes can be overriden at the query level. You can override the cache driver by calling useQueryCache with a valid cacheDriver. This rarely makes sense for the query cache but is possible: - - -$query = new Doctrine_Query(); - -$query->useQueryCache(new Doctrine_Cache_Apc()); - - -+++ Result Cache - -++++ Using the result cache - -You can set a connection or manager level result cache driver by using Doctrine::ATTR_RESULT_CACHE. Setting a connection level cache driver means that all queries executed with this connection use the specified cache driver whereas setting a manager level cache driver means that all connections (unless overridden at connection level) will use the given cache driver. - -Setting a manager level cache driver: - -$manager = Doctrine_Manager::getInstance(); - -$manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver); - - -Setting a connection level cache driver: - -$manager = Doctrine_Manager::getInstance(); -$conn = $manager->openConnection('pgsql://user:pass@localhost/test'); - -$conn->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver); - - -Usually the cache entries are valid for only some time. You can set global value for how long the cache entries should be considered valid by using Doctrine::ATTR_RESULT_CACHE_LIFESPAN. - -$manager = Doctrine_Manager::getInstance(); - -// set the lifespan as one hour (60 seconds * 60 minutes = 1 hour = 3600 secs) -$manager->setAttribute(Doctrine::ATTR_RESULT_CACHE_LIFESPAN, 3600); - -Now as we have set a cache driver for use we can make a DQL query to use it: - -$query = new Doctrine_Query(); - -// fetch blog titles and the number of comments -$query->select('b.title, COUNT(c.id) count') - ->from('Blog b') - ->leftJoin('b.Comments c') - ->limit(10) - ->useResultCache(true); - -$entries = $query->execute(); - - -++++ Fine-tuning - -In the previous chapter we used global caching attributes. These attributes can be overriden at the query level. You can override the cache driver by calling useCache with a valid cacheDriver: - - -$query = new Doctrine_Query(); - -$query->useResultCache(new Doctrine_Cache_Apc()); - - -Also you can override the lifespan attribute by calling setResultCacheLifeSpan(): - - -$query = new Doctrine_Query(); - -// set the lifespan as half an hour -$query->setResultCacheLifeSpan(60 * 30); - - - - diff --git a/manual/docs/en/caching/configuration.txt b/manual/docs/en/caching/configuration.txt deleted file mode 100644 index bcdb4d39f..000000000 --- a/manual/docs/en/caching/configuration.txt +++ /dev/null @@ -1,26 +0,0 @@ -There are couple of availible Cache attributes on Doctrine: - - * Doctrine::ATTR_CACHE_SIZE - - * Defines which cache container Doctrine uses - * Possible values: Doctrine::CACHE_* (for example Doctrine::CACHE_FILE) - - * Doctrine::ATTR_CACHE_DIR - - * cache directory where .cache files are saved - * the default cache dir is %ROOT%/cachedir, where - %ROOT% is automatically converted to doctrine root dir - - * Doctrine::ATTR_CACHE_SLAM - - * On very busy servers whenever you start the server or modify files you can create a race of many processes all trying to cache the same file at the same time. This option sets the percentage of processes that will skip trying to cache an uncached file. Or think of it as the probability of a single process to skip caching. For example, setting apc.slam_defense to 75 would mean that there is a 75% chance that the process will not cache an uncached file. So, the higher the setting the greater the defense against cache slams. Setting this to 0 disables this feature - - * Doctrine::ATTR_CACHE_SIZE - - * Cache size attribute - - * Doctrine::ATTR_CACHE_TTL - - * How often the cache is cleaned - - diff --git a/manual/docs/en/caching/introduction.txt b/manual/docs/en/caching/introduction.txt deleted file mode 100644 index fe1710b11..000000000 --- a/manual/docs/en/caching/introduction.txt +++ /dev/null @@ -1,22 +0,0 @@ -{{Doctrine_Cache}} offers an intuitive and easy-to-use query caching solution. It provides the following things: - -* Multiple cache backends to choose from (including Memcached, APC and Sqlite) -* Manual tuning and/or self-optimization. {{Doctrine_Cache}} knows how to optimize itself, yet it leaves user full freedom of whether or not he/she wants to take advantage of this feature. -* Advanced options for fine-tuning. {{Doctrine_Cache}} has many options for fine-tuning performance. -* Cache hooks itself directly into {{Doctrine_Db}} eventlistener system allowing it to be easily added on-demand. - -{{Doctrine_Cache}} hooks into {{Doctrine_Db}} eventlistener system allowing pluggable caching. It evaluates queries and puts {{SELECT}} statements in cache. The caching is based on propabalistics. For example if {{savePropability = 0.1}} there is a 10% chance that a query gets cached. - -Now eventually the cache would grow very big, hence Doctrine uses propabalistic cache cleaning. When calling {{Doctrine_Cache::clean()}} with {{cleanPropability = 0.25}} there is a 25% chance of the clean operation being invoked. What the cleaning does is that it first reads all the queries in the stats file and sorts them by the number of times occurred. Then if the size is set to 100 it means the cleaning operation will leave 100 most issued queries in cache and delete all other cache entries. - -Initializing a new cache instance: - - -$dbh = new Doctrine_Db('mysql:host=localhost;dbname=test', $user, $pass); -$cache = new Doctrine_Cache('memcache'); - -// register it as a Doctrine_Db listener -$dbh->addListener($cache); - - -Now you know how to set up the query cache. In the next chapter you'll learn how to tweak the cache in order to get maximum performance. diff --git a/manual/docs/en/caching/overview.txt b/manual/docs/en/caching/overview.txt deleted file mode 100644 index a909a7d52..000000000 --- a/manual/docs/en/caching/overview.txt +++ /dev/null @@ -1,49 +0,0 @@ -Doctrine has very comprehensive and fast caching solution. -Its cache is **always up-to-date**. -In order to achieve this doctrine does the following things: - - - -|| 1. Every Doctrine_Table has its own cache directory. The default is cache/componentname/. All the cache files are saved into that directory. -The format of each cache file is [primarykey].cache. - - - -2. When retrieving records from the database doctrine always tries to hit the cache first. - - - -3. If a record (Doctrine_Record) is retrieved from database or inserted into database it will be saved into cache. - - - -4. When a Data Access Object is deleted or updated it will be deleted from the cache || - - - -Now one might wonder that this kind of solution won't work since eventually the cache will be a copy of database! -So doctrine does the following things to ensure the cache won't get too big: - - - -|| 1. Every time a cache file is accessed the id of that record will be added into the $fetched property of Doctrine_Cache - - - -2. At the end of each script the Doctrine_Cache destructor will write all these primary keys at the end of a stats.cache file - - - -3. Doctrine does propabalistic cache cleaning. The default interval is 200 page loads (= 200 constructed Doctrine_Managers). Basically this means -that the average number of page loads between cache cleans is 200. - - - -4. On every cache clean stats.cache files are being read and the least accessed cache files -(cache files that have the smallest id occurance in the stats file) are then deleted. -For example if the cache size is set to 200 and the number of files in cache is 300, then 100 least accessed files are being deleted. -Doctrine also clears every stats.cache file. || - - - -So for every 199 fast page loads there is one page load which suffers a little overhead from the cache cleaning operation. diff --git a/manual/docs/en/class-templates.txt b/manual/docs/en/class-templates.txt deleted file mode 100644 index 125429506..000000000 --- a/manual/docs/en/class-templates.txt +++ /dev/null @@ -1,461 +0,0 @@ -++ Introduction - -Many times you may find classes having similar things within your models. These things may contain anything related to the schema of the component itself (relations, column definitions, index definitions etc.). One obvious way of refactoring the code is having a base class with some classes extending it. - -However inheritance solves only a fraction of things. The following subchapters show how many times using Doctrine_Template is much more powerful and flexible than using inheritance. - -Doctrine_Template is a class templating system. Templates are basically ready-to-use little components that your Record classes can load. When a template is being loaded its setTableDefinition() and setUp() methods are being invoked and the method calls inside them are being directed into the class in question. - -++ Simple templates - -In the following example we define a template called TimestampTemplate. Basically the purpose of this template is to add date columns 'created' and 'updated' to the record class that loads this template. Additionally this template uses a listener called Timestamp listener which updates these fields based on record actions. - - -class TimestampListener extends Doctrine_Record_Listener -{ - public function preInsert(Doctrine_Event $event) - { - $event->getInvoker()->created = date('Y-m-d', time()); - $event->getInvoker()->updated = date('Y-m-d', time()); - } - public function preUpdate(Doctrine_Event $event) - { - $event->getInvoker()->created = date('Y-m-d', time()); - $event->getInvoker()->updated = date('Y-m-d', time()); - } -} -class TimestampTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('created', 'date'); - $this->hasColumn('updated', 'date'); - - $this->setListener(new TimestampListener()); - } -} - - -Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add loadTemplate() call in the class definition. - - -class Blog extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 200); - $this->hasColumn('content', 'string'); - } - public function setUp() - { - $this->loadTemplate('TimestampTemplate'); - } -} - - - -++ Templates with relations - -Many times the situations tend to be much more complex than the situation in the previous chapter. You may have model classes with relations to other model classes and you may want to replace given class with some extended class. - -Consider we have two classes, User and Email, with the following definitions: - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - } - public function setUp() - { - $this->hasMany('Email', array('local' => 'id', 'foreign' => 'user_id')); - } -} -class Email extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('address', 'string'); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() - { - $this->hasOne('User', array('local' => 'user_id', 'foreign' => 'id')); - } -} - - -Now if we extend the User and Email classes and create, for example, classes ExtendedUser and ExtendedEmail, the ExtendedUser will still have a relation to the Email class - not the ExtendedEmail class. We could of course override the setUp() method of the User class and define relation to the ExtendedEmail class, but then we lose the whole point of inheritance. Doctrine_Template can solve this problem elegantly with its dependency injection solution. - -In the following example we'll define two templates, UserTemplate and EmailTemplate, with almost identical definitions as the User and Email class had. - - -class UserTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - } - public function setUp() - { - $this->hasMany('EmailTemplate as Email', array('local' => 'id', 'foreign' => 'user_id')); - } -} -class EmailTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('address', 'string'); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() - { - $this->hasOne('UserTemplate as User', array('local' => 'user_id', 'foreign' => 'id')); - } -} - - -Notice how we set the relations. We are not pointing to concrete Record classes, rather we are setting the relations to templates. This tells Doctrine that it should try to find concrete Record classes for those templates. If Doctrine can't find these concrete implementations the relation parser will throw an exception, but before we go ahead of things, here are the actual record classes: - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->loadTemplate('UserTemplate'); - } -} -class Email extends Doctrine_Record -{ - public function setUp() - { - $this->loadTemplate('EmailTemplate'); - } -} - - -Now consider the following code snippet. This does NOT work since we haven't yet set any concrete implementations for the templates. - - -$user = new User(); -$user->Email; // throws an exception - - -The following version works. Notice how we set the concrete implementations for the templates globally using Doctrine_Manager. - - -$manager = Doctrine_Manager::getInstance(); -$manager->setImpl('UserTemplate', 'User') - ->setImpl('EmailTemplate', 'Email'); - -$user = new User(); -$user->Email; - - -The implementations for the templates can be set at manager, connection and even at the table level. - -++ Delegate methods - -Besides from acting as a full table definition delegate system, Doctrine_Template allows the delegation of method calls. This means that every method within the loaded templates is available in the record that loaded the templates. Internally the implementation uses magic method called __call() to achieve this functionality. - -Lets take an example: we have a User class that loads authentication functionality through a template. - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('fullname', 'string', 30); - } - public function setUp() - { - $this->loadTemplate('AuthTemplate'); - } -} -class AuthTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 16); - $this->hasColumn('password', 'string', 16); - } - public function login($username, $password) - { - // some login functionality here - } -} - - -Now you can simply use the methods found in AuthTemplate within the User class as shown above. - - -$user = new User(); - -$user->login($username, $password); - - -You can get the record that invoked the delegate method by using the getInvoker() method of Doctrine_Template. Consider the AuthTemplate example. If we want to have access to the User object we just need to do the following: - - -class AuthTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 16); - $this->hasColumn('password', 'string', 16); - } - public function login($username, $password) - { - // do something with the Invoker object here - $object = $this->getInvoker(); - } -} - - -++ Working with multiple templates - -Each class can consists of multiple templates. If the templates contain similar definitions the most recently loaded template always overrides the former. - -++ Core Templates - -Doctrine comes bundled with some templates that offer out of the box functionality for your models. You can enable these templates in your models very easily. You can do it directly in your Doctrine_Records or you can specify them in your yaml schema if you are managing your models with a yaml schema file. - -+++ Versionable -PHP Example - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 125); - $this->hasColumn('password', 'string', 255); - } - - public function setUp() - { - $this->actAs('Versionable', array('versionColumn' => 'version', 'className' => '%CLASS%Version')); - } -} - - -YAML Example - ---- -User: - actAs: - Versionable: - versionColumn: version - className: %CLASS%Version - columns: - username: - type: string(125) - password: - type: string(255) - - -+++ Timestampable - -The 2nd argument array is not required. It defaults to all the values that are present in the example below. - -PHP Example - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 125); - $this->hasColumn('password', 'string', 255); - } - - public function setUp() - { - $this->actAs('Timestampable', array('created' => array('name' => 'created_at', - 'type' => 'timestamp', - 'format' => 'Y-m-d H:i:s', - 'disabled' => false, - 'options' => array()), - 'updated' => array('name' => 'updated_at', - 'type' => 'timestamp', - 'format' => 'Y-m-d H:i:s', - 'disabled' => false, - 'options' => array()))); - } -} - - -YAML Example - ---- -User: - actAs: - Timestampable: - created: - name: created_at - type: timestamp - format:Y-m-d H:i:s - options: [] - updated: - name: updated_at - type: timestamp - format: Y-m-d H:i:s - options: [] - columns: - username: - type: string(125) - password: - type: string(255) - - -If you are only interested in using only one of the columns, such as a created_at timestamp, but not a an updated_at field, set the flag disabled=>true for either of the fields as in the example below. - -YAML Example - ---- -User: - actAs: - Timestampable: - created: - name: created_at - type: timestamp - format:Y-m-d H:i:s - options: [] - updated: - disabled: true - columns: - username: - type: string(125) - password: - type: string(255) - - -+++ Sluggable -If you do not specify the columns to create the slug from, it will default to just using the toString() method on the model. - -PHP Example - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 125); - $this->hasColumn('password', 'string', 255); - } - - public function setUp() - { - $this->actAs('Sluggable', array('fields' => array('username'))); - } -} - - -YAML Example - ---- -User: - actAs: - Sluggable: - columns: [username] - fields: - username: - type: string(125) - password: - type: string(255) - - -+++ I18n -PHP Example - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 125); - $this->hasColumn('password', 'string', 255); - } - - public function setUp() - { - $this->actAs('I18n', array('fields' => array('title'))); - } -} - - -YAML Example - ---- -User: - actAs: - I18n: - fields: [title] - columns: - username: - type: string(125) - password: - type: string(255) - - -+++ NestedSet -PHP Example - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 125); - $this->hasColumn('password', 'string', 255); - } - - public function setUp() - { - $this->actAs('NestedSet', array('hasManyRoots' => true, 'rootColumnName' => 'root_id')); - } -} - - -YAML Example - ---- -User: - actAs: - NestedSet: - hasManyRoots: true - rootColumnName: root_id - columns: - username: - type: string(125) - password: - type: string(255) - - -+++ Searchable -PHP Example - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 125); - $this->hasColumn('password', 'string', 255); - } - - public function setUp() - { - $this->actAs('Searchable', array('fields' => array('title', 'content'))); - } -} - - -YAML Example - ---- -User: - actAs: - Searchable: - fields: [title, content] - columns: - username: - type: string(125) - password: - type: string(255) - \ No newline at end of file diff --git a/manual/docs/en/coding-standards.txt b/manual/docs/en/coding-standards.txt deleted file mode 100644 index 5d26225c9..000000000 --- a/manual/docs/en/coding-standards.txt +++ /dev/null @@ -1,5 +0,0 @@ -++ Overview -++ PHP File Formatting -++ Naming Conventions -++ Coding Style -++ Testing diff --git a/manual/docs/en/coding-standards/coding-style.txt b/manual/docs/en/coding-standards/coding-style.txt deleted file mode 100644 index f65d5afd9..000000000 --- a/manual/docs/en/coding-standards/coding-style.txt +++ /dev/null @@ -1,246 +0,0 @@ -+++ PHP code demarcation - -* PHP code must always be delimited by the full-form, standard PHP tags -* Short tags are never allowed. For files containing only PHP code, the closing tag must always be omitted - - -+++ Strings - -* When a string is literal (contains no variable substitutions), the apostrophe or "single quote" must always used to demarcate the string: - - -// literal string -$string = 'something'; - - -* When a literal string itself contains apostrophes, it is permitted to demarcate the string with quotation marks or "double quotes". This is especially encouraged for SQL statements: - - -// string contains apostrophes -$sql = "SELECT id, name FROM people WHERE name = 'Fred' OR name = 'Susan'"; - - -* Variable substitution is permitted using the following form: - - -// variable substitution -$greeting = "Hello $name, welcome back!"; - - -* Strings may be concatenated using the "." operator. A space must always be added before and after the "." operator to improve readability: - - -// concatenation -$framework = 'Doctrine' . ' ORM ' . 'Framework'; - - -* When concatenating strings with the "." operator, it is permitted to break the statement into multiple lines to improve readability. In these cases, each successive line should be padded with whitespace such that the "."; operator is aligned under the "=" operator: - - -// concatenation line breaking -$sql = "SELECT id, name FROM user " - . "WHERE name = ? " - . "ORDER BY name ASC"; - - - -+++ Arrays - -* Negative numbers are not permitted as indices. -* An indexed array may be started with any non-negative number, however this is discouraged and it is recommended that all arrays have a base index of 0. -* When declaring indexed arrays with the array construct, a trailing space must be added after each comma delimiter to improve readability. -* It is also permitted to declare multiline indexed arrays using the "array" construct. In this case, each successive line must be padded with spaces. -* When declaring associative arrays with the array construct, it is encouraged to break the statement into multiple lines. In this case, each successive line must be padded with whitespace such that both the keys and the values are aligned: - - -$sampleArray = array('Doctrine', 'ORM', 1, 2, 3); - - -$sampleArray = array(1, 2, 3, - $a, $b, $c, - 56.44, $d, 500); - - -$sampleArray = array('first' => 'firstValue', - 'second' => 'secondValue'); - - - -+++ Classes - -* Classes must be named by following the naming conventions. -* The brace is always written next line after the class name (or interface declaration). -* Every class must have a documentation block that conforms to the PHPDocumentor standard. -* Any code within a class must be indented four spaces. -* Only one class is permitted per PHP file. -* Placing additional code in a class file is NOT permitted. - -This is an example of an acceptable class declaration: - - -/** - * Documentation here - */ -class Doctrine_SampleClass -{ - // entire content of class - // must be indented four spaces -} - - - -+++ Functions and methods - -* Methods must be named by following the naming conventions. -* Methods must always declare their visibility by using one of the private, protected, or public constructs. -* Like classes, the brace is always written next line after the method name. There is no space between the function name and the opening parenthesis for the arguments. -* Functions in the global scope are strongly discouraged. -* This is an example of an acceptable function declaration in a class: - - -/** - * Documentation Block Here - */ -class Foo -{ - /** - * Documentation Block Here - */ - public function bar() - { - // entire content of function - // must be indented four spaces - } -} - - -* Passing by-reference is permitted in the function declaration only: - - -/** - * Documentation Block Here - */ -class Foo -{ - /** - * Documentation Block Here - */ - public function bar(&$baz) - { - } -} - - -* Call-time pass by-reference is prohibited. -* The return value must not be enclosed in parentheses. This can hinder readability and can also break code if a method is later changed to return by reference. - - -/** - * Documentation Block Here - */ -class Foo -{ - /** - * WRONG - */ - public function bar() { - return($this->bar); - } - /** - * RIGHT - */ - public function bar() - { - return $this->bar; - } -} - - -* Function arguments are separated by a single trailing space after the comma delimiter. This is an example of an acceptable function call for a function that takes three arguments: - - -threeArguments(1, 2, 3); - - -* Call-time pass by-reference is prohibited. See above for the proper way to pass function arguments by-reference. -* For functions whose arguments permitted arrays, the function call may include the {{array}} construct and can be split into multiple lines to improve readability. In these cases, the standards for writing arrays still apply: - - -threeArguments(array(1, 2, 3), 2, 3); - -threeArguments(array(1, 2, 3, 'Framework', - 'Doctrine', 56.44, 500), 2, 3); - - - -+++ Control statements - -* Control statements based on the {{if}} and {{elseif}} constructs must have a single space before the opening parenthesis of the conditional, and a single space after the closing parenthesis. -* Within the conditional statements between the parentheses, operators must be separated by spaces for readability. Inner parentheses are encouraged to improve logical grouping of larger conditionals. -* The opening brace is written on the same line as the conditional statement. The closing brace is always written on its own line. Any content within the braces must be indented four spaces. - - -if ($foo != 2) { - $foo = 2; -} - - -* For {{if}} statements that include {{elseif}} or {{else}}, the formatting must be as in these examples: - - -if ($foo != 1) { - $foo = 1; -} else { - $foo = 3; -} -if ($foo != 2) { - $foo = 2; -} elseif ($foo == 1) { - $foo = 3; -} else { - $foo = 11; -} - - -When ! operand is being used it must use the following formatting: - - -if ( ! $foo) { - -} - - -* Control statements written with the {{switch}} construct must have a single space before the opening parenthesis of the conditional statement, and also a single space after the closing parenthesis. -* All content within the {{switch}} statement must be indented four spaces. Content under each {{case}} statement must be indented an additional four spaces but the breaks must be at the same indentation level as the {{case}} statements. - - -switch ($case) { - case 1: - case 2: - break; - case 3: - break; - default: - break; -} - - -* The construct default may never be omitted from a switch statement. - - -+++ Inline documentation - -Documentation Format: - -* All documentation blocks ("docblocks") must be compatible with the phpDocumentor format. Describing the phpDocumentor format is beyond the scope of this document. For more information, visit: http://phpdoc.org/ - -Methods: - -* Every method, must have a docblock that contains at a minimum: - * A description of the function - * All of the arguments - * All of the possible return values -* It is not necessary to use the {{@access}} tag because the access level is already known from the {{public}}, {{private}}, or {{protected}} construct used to declare the function. -* If a function/method may throw an exception, use {{@throws}}: - * {{@throws exceptionclass [description]}} - diff --git a/manual/docs/en/coding-standards/naming-conventions.txt b/manual/docs/en/coding-standards/naming-conventions.txt deleted file mode 100644 index e05d4e067..000000000 --- a/manual/docs/en/coding-standards/naming-conventions.txt +++ /dev/null @@ -1,93 +0,0 @@ -+++ Classes - -* The Doctrine ORM Framework uses the same class naming convention as PEAR and Zend framework, where the names of the classes directly map to the directories in which they are stored. The root level directory of the Doctrine Framework is the "Doctrine/" directory, under which all classes are stored hierarchially. -* Class names may only contain alphanumeric characters. Numbers are permitted in class names but are discouraged. Underscores are only permitted in place of the path separator, eg. the filename "Doctrine/Table/Exception.php" must map to the class name "Doctrine_Table_Exception". -* If a class name is comprised of more than one word, the first letter of each new word must be capitalized. Successive capitalized letters are not allowed, e.g. a class "XML_Reader" is not allowed while "Xml_Reader" is acceptable. - - -+++ Interfaces - -* Interface classes must follow the same conventions as other classes (see above), however must end with the word "{{Interface}}" (unless the interface is approved not to contain it such as {{Doctrine_Overloadable}}). Some examples: - * {{Doctrine_Db_EventListener_Interface}} - * {{Doctrine_EventListener_Interface}} - - -+++ Filenames - -* For all other files, only alphanumeric characters, underscores, and the dash character ("-") are permitted. Spaces are prohibited. -* Any file that contains any PHP code must end with the extension ".php". These examples show the acceptable filenames for containing the class names from the examples in the section above: - * {{Doctrine/Db.php}} - * {{Doctrine/Connection/Transaction.php}} -* File names must follow the mapping to class names described above. - - -+++ Functions and methods - -* Function names may only contain alphanumeric characters. Underscores are not permitted. Numbers are permitted in function names but are discouraged. -* Function names must always start with a lowercase letter. When a function name consists of more than one word, the first letter of each new word must be capitalized. This is commonly called the "studlyCaps" or "camelCaps" method. -* Verbosity is encouraged. Function names should be as verbose as is practical to enhance the understandability of code. -* For object-oriented programming, accessors for objects should always be prefixed with either "get" or "set". This applies to all classes except for Doctrine_Record which has some accessor methods prefixed with 'obtain' and 'assign'. The reason for this is that since all user defined ActiveRecords inherit {{Doctrine_Record}}, it should populate the get / set namespace as little as possible. -* Functions in the global scope ("floating functions") are NOT permmitted. All static functions should be wrapped in a static class. - - -+++ Variables - -All variables must satisfy the following conditions: - -* Variable names may only contain alphanumeric characters. Underscores are not permitted. Numbers are permitted in variable names but are discouraged. -* Variable names must always start with a lowercase letter and follow the "camelCaps" capitalization convention. -* Verbosity is encouraged. Variables should always be as verbose as practical. Terse variable names such as "$i" and "$n" are discouraged for anything other than the smallest loop contexts. If a loop contains more than 20 lines of code, the variables for the indices need to have more descriptive names. -* Within the framework certain generic object variables should always use the following names: - -||~ Object type ||~ Variable name || -|| {{Doctrine_Connection}} || {{$conn}} || -|| {{Doctrine_Collection}} || {{$coll}} || -|| {{Doctrine_Manager}} || {{$manager}} || -|| {{Doctrine_Query}} || {{$query}} || -|| {{Doctrine_Db}} || {{$db}} || - -* There are cases when more descriptive names are more appropriate (for example when multiple objects of the same class are used in same context), in that case it is allowed to use different names than the ones mentioned. - - -+++ Constants - -Following rules must apply to all constants used within Doctrine framework: - -* Constants may contain both alphanumeric characters and the underscore. -* Constants must always have all letters capitalized. -* For readablity reasons, words in constant names must be separated by underscore characters. For example, {{ATTR_EXC_LOGGING}} is permitted but {{ATTR_EXCLOGGING}} is not. -* Constants must be defined as class members by using the "const" construct. Defining constants in the global scope with "define" is NOT permitted. - - -class Doctrine_SomeClass -{ - const MY_CONSTANT = 'something'; -} -print Doctrine_SomeClass::MY_CONSTANT; - - -+++ Record columns - -* All record columns must be in lowercase -* Usage of _ is encouraged for columns that consist of more than one word - -class User -{ - public function setTableDefinition() - { - $this->hasColumn('home_address', 'string'); - } -} - -* Foreign key fields must be in format [tablename]_[column] - -class Phonenumber -{ - public function setTableDefinition() - { - // this field is a foreign key that points to user(id) - $this->hasColumn('user_id', 'integer'); - } -} - - diff --git a/manual/docs/en/coding-standards/overview.txt b/manual/docs/en/coding-standards/overview.txt deleted file mode 100644 index ebf719f25..000000000 --- a/manual/docs/en/coding-standards/overview.txt +++ /dev/null @@ -1,2 +0,0 @@ -+++ Scope -+++ Goals diff --git a/manual/docs/en/coding-standards/php-file-formatting.txt b/manual/docs/en/coding-standards/php-file-formatting.txt deleted file mode 100644 index 42456bb21..000000000 --- a/manual/docs/en/coding-standards/php-file-formatting.txt +++ /dev/null @@ -1,23 +0,0 @@ -+++ General - -For files that contain only PHP code, the closing tag ("{{?>}}") is never permitted. It is not required by PHP. Not including it prevents trailing whitespace from being accidentally injected into the output. - -IMPORTANT: Inclusion of arbitrary binary data as permitted by {{__HALT_COMPILER()}} is prohibited from any Doctrine framework PHP file or files derived from them. Use of this feature is only permitted for special installation scripts. - - -+++ Indentation - -Use an indent of 4 spaces, with no tabs. - - -+++ Maximum line length - -The target line length is 80 characters, i.e. developers should aim keep code as close to the 80-column boundary as is practical. However, longer lines are acceptable. The maximum length of any line of PHP code is 120 characters. - - -+++ Line termination - -* Line termination is the standard way for Unix text files. Lines must end only with a linefeed (LF). Linefeeds are represented as ordinal 10, or hexadecimal 0x0A. -* Do not use carriage returns (CR) like Macintosh computers (0x0D). -* Do not use the carriage return/linefeed combination (CRLF) as Windows computers (0x0D, 0x0A). - diff --git a/manual/docs/en/coding-standards/testing.txt b/manual/docs/en/coding-standards/testing.txt deleted file mode 100644 index a548d0c6d..000000000 --- a/manual/docs/en/coding-standards/testing.txt +++ /dev/null @@ -1,25 +0,0 @@ -+++ Writing tests - -++++ Classes - -* All test classes should be referring to a class or specific testing aspect of some class. - * For example {{Doctrine_Record_TestCase}} is a valid name since its referring to class named {{Doctrine_Record}}. - * {{Doctrine_Record_State_TestCase}} is also a valid name since its referring to testing the state aspect of the {{Doctrine_Record}} class. - * However something like {{Doctrine_PrimaryKey_TestCase}} is not valid since its way too generic. -* Every class should have atleast one {{TestCase}} equivalent -* All testcase classes should inherit {{Doctrine_UnitTestCase}} - - -++++ Methods - -* All methods should support agile documentation; if some method failed it should be evident from the name of the test method what went wrong. Also the test method names should give information of the system they test. - * For example {{Doctrine_Export_Pgsql_TestCase::testCreateTableSupportsAutoincPks()}} is a valid test method name. Just by looking at it we know what it is testing. Also we can run agile documentation tool to get little up-to-date system information. - -NOTE: Commonly used testing method naming convention {{TestCase::test[methodName]}} is **not** allowed in Doctrine. So in this case {{Doctrine_Export_Pgsql_TestCase::testCreateTable()}} would not be allowed! - -* Test method names can often be long. However the content within the methods should rarely be more than dozen lines long. If you need several assert-calls divide the method into smaller methods. - -++++ Assertions - -* There should never be assertions within any loops and rarely within functions. - diff --git a/manual/docs/en/component-overview.txt b/manual/docs/en/component-overview.txt deleted file mode 100644 index a6998ebe9..000000000 --- a/manual/docs/en/component-overview.txt +++ /dev/null @@ -1,758 +0,0 @@ -++ Record -{{Doctrine_Record}} is one of the most essential components of Doctrine ORM. The class is a wrapper for database row but along with that it speficies what relations it has -on other components and what columns it has. It may access the related components, hence its refered as an ActiveRecord. - -The classes that inherit {{Doctrine_Record}} are called components. There should be atleast one component for each database table. - -There are couple of ways for creating new records. Propably the easiest is using native php new -operator. The other ways are calling {{Doctrine_Table::create()}} or {{Doctrine_Connection::create()}}. The last two exists only for backward compatibility. The recommended way of creating new objects is the new operator. - - -$user = $conn->create("User"); - -// alternative way: - -$table = $conn->getTable("User"); - -$user = $table->create(); - -// the simpliest way: - -$user = new User(); - -// records support array access -$user['name'] = 'John Locke'; - -// save user into database -$user->save(); - - -Every record has an object identifier, which is an internal unique identifier. You can get the object identifier with the oid() method. Basically two objects are considered the same if they share the same object identifier. - - -+++ Properties - -Each assigned column property of {{Doctrine_Record}} represents a database table column. As you've learned in the previous chapters the column definitions can be achieved with the hasColumn() method. Now accessing the columns is easy. You can use any of the means described above. The recommended way is using the ArrayAccess as it makes it easy to switch between record and array fetching when needed. - - -$user = $table->find(3); - -// access property through overloading - -$name = $user->name; - -// access property with get() - -$name = $user->get("name"); - -// access property with ArrayAccess interface - -$name = $user['name']; - - -Iterating trhough the properties of a record can be done in similar way as iterating through an array - by using the foreach construct. This is possible since {{Doctrine_Record}} implements a magic IteratorAggregate interface. - - -foreach ($user as $field => $value) { - -} - - -As with arrays you can use the isset() for checking if given property exists and unset() for setting given property to null. - - -// checking if property called 'name' exists -if (isset($user['name'])) { - -} - -// unsetting name property -unset($user['name']); - - -When you have set values for record properties you can get the names of modified properties with modifiedFields() method. This method returns an array of modified field names. - - -$user['name'] = 'Jack Daniels'; - -$user['age'] = 100; - -print_r($user->modifiedFields()); // array('name', 'age'); - -$user->isModified(); // true - - -Sometimes you may want to retrieve the column count of given record. In order to do this you can simply pass the record as an argument for the count() function. This is possible since {{Doctrine_Record}} implements a magic Countable interface. The other way would be calling the count() method. - - -// get the number of columns - -$colCount = $record->count(); - -$colCount = count($record); - - - -{{Doctrine_Record}} offers a special method for accessing the identifier of given record. This method is called identifier() and it returns an array with identifier field names as keys and values as the associated property values. - -$user['name'] = 'Jack Daniels'; - -$user->save(); - -$user->identifier(); // array('id' => 1) - - -A common case is that you have an array of values which you need to assign to a given record. It may feel awkward and clumsy to set these values separately. No need to worry though, {{Doctrine_Record}} offers a way for merging given array to property values. - -The merge() method iterates through the properties of given record and assigns the values of given array to the associated properties. - - -$values = array('name' => 'someone', - 'age' => 11, - 'unknownproperty' => '...'); - -// notice that here the unknownproperty won't get assigned -// as the User class doesn't have a column with that name -$user->merge($values); - -print $user->name; // someone -print $user->age; // 11 - -print $user->unknownproperty; // throws exception - - - -+++ Retrieving existing records - -Doctrine provides many ways for record retrieval. The fastest ways for retrieving existing records are the finder methods provided by {{Doctrine_Table}}. If you need to use more complex queries take a look at the DQL API. - - -$table = $conn->getTable("User"); - -// find by primary key - -$user = $table->find(2); -if($user !== false) - print $user->name; - -// get all users -foreach($table->findAll() as $user) { - print $user->name; -} - -// finding by dql -foreach($table->findByDql("name LIKE '%John%'") as $user) { - print $user->created; -} - -// finding objects with DQL - -$users = $conn->query("FROM User u WHERE u.name LIKE '%John%'"); - - - - - -+++ Updating records - -Updating objects is very easy, you just call the {{Doctrine_Record::save()}} method. The other way is to call {{Doctrine_Connection::flush()}} which saves all objects. It should be noted though that flushing is a much heavier operation than just calling save method. - - -$table = $conn->getTable('User'); - -$user = $table->find(2); - -if($user !== false) { - $user->name = 'Jack Daniels'; - - $user->save(); -} - - -Sometimes you may want to do a direct update. In direct update the objects aren't loaded from database, rather the state of the database is directly updated. In the following example we use DQL UPDATE statement to update all users. - - - -// make all usernames lowercased -Doctrine_Query::create()->update('User u') - ->set('u.name', 'LOWER(u.name)') - ->execute(); - - -+++ Refreshing records - -Sometimes you may want to refresh your record with data from the database, use {{Doctrine_Record::refresh()}}. - - -$user = $conn->getTable('User')->find(2); -$user->name = 'New name'; -// oups, I want to refresh the name -$user->refresh(); - - -++++ Refreshing relationships - -The {{Doctrine_Record::refresh()}} method can also refresh record relationships, but you need to specify them on the query. - - -$user = Doctrine_Query::create() - ->from('User') - ->leftJoin('Groups') - ->where('id = ?') - ->fetchOne(array(1)); - -$group = Doctrine_Query::create() - ->from('Group') - ->leftJoin('Users') - ->where('id = ?') - ->fetchOne(array(1)); - -$userGroup = new UserGroup(); -$userGroup->user_id = $user->id; -$userGroup->group_id = $group->id; -$userGroup->save(); - -// get new group on user -$user->refresh(true); -// get new user on group -$group->refresh(true); - - -+++ Deleting records - -Deleting records in Doctrine is handled by {{Doctrine_Record::delete()}}, {{Doctrine_Collection::delete()}} and {{Doctrine_Connection::delete()}} methods. - - -$table = $conn->getTable("User"); - -$user = $table->find(2); - -// deletes user and all related composite objects -if($user !== false) - $user->delete(); - - -$users = $table->findAll(); - - -// delete all users and their related composite objects -$users->delete(); - - -+++ Using expression values - -There might be situations where you need to use SQL expressions as values of columns. This can be achieved by using Doctrine_Expression which converts portable DQL expressions to your native SQL expressions. - -Lets say we have a class called event with columns timepoint(datetime) and name(string). Saving the record with the current timepoint can be achieved as follows: - -$event = new Event(); -$event->name = 'Rock festival'; -$event->timepoint = new Doctrine_Expression('NOW()'); - -$event->save(); - - -The last line would execute sql (in sqlite): - -INSERT INTO event (name, timepoint) VALUES ('Rock festival', 'NOW()') - - -+++ Getting record state - -{{Every Doctrine_Record}} has a state. First of all records can be transient or persistent. Every record that is retrieved from database is persistent and every newly created record is considered transient. If a {{Doctrine_Record}} is retrieved from database but the only loaded property is its primary key, then this record has a state called proxy. - -Every transient and persistent {{Doctrine_Record}} is either clean or dirty. {{Doctrine_Record}} is clean when none of its properties are changed and dirty when atleast one of its properties has changed. - -A record can also have a state called locked. In order to avoid infinite recursion in some rare circular reference cases Doctrine uses this state internally to indicate that a record is currently under a manipulation operation. - - -$state = $record->state(); - -switch($state): - case Doctrine_Record::STATE_PROXY: - // record is in proxy state, - // meaning its persistent but not all of its properties are - // loaded from the database - break; - case Doctrine_Record::STATE_TCLEAN: - // record is transient clean, - // meaning its transient and - // none of its properties are changed - break; - case Doctrine_Record::STATE_TDIRTY: - // record is transient dirty, - // meaning its transient and - // some of its properties are changed - break; - case Doctrine_Record::STATE_DIRTY: - // record is dirty, - // meaning its persistent and - // some of its properties are changed - break; - case Doctrine_Record::STATE_CLEAN: - // record is clean, - // meaning its persistent and - // none of its properties are changed - break; - case Doctrine_Record::STATE_LOCKED: - // record is locked - break; -endswitch; - - - -+++ Getting object copy - -Sometimes you may want to get a copy of your object (a new object with all properties copied). Doctrine provides a simple method for this: {{Doctrine_Record::copy()}}. - - -$copy = $user->copy(); - - -Notice that copying the record with copy() returns a new record (state TDIRTY) with the values of the old record, and it copies the relations of that record. If you do not want to copy the relations too, you need to use copy(false). - - -// get a copy of user without the relations -$copy = $user->copy(false); - - -+++ Saving a blank record - -By default Doctrine doesn't execute when save() is being called on an unmodified record. There might be situations where you want to force-insert the record even if it has not been modified. This can be achieved by assigning the state of the record to Doctrine_Record::STATE_TDIRTY. - - -$user = new User(); -$user->state('TDIRTY'); -$user->save(); - -$user->id; // 1 - - -+++ Mapping custom values - -There might be situations where you want to map custom values to records. For example values that depend on some outer sources and you only want these values to be availible at runtime not persisting those values into database. This can be achieved as follows: - - -$user->mapValue('isRegistered', true); - -$user->isRegistered; // true - - - -+++ Serializing - -Sometimes you may want to serialize your record objects (possibly for caching purposes). Records can be serialized, but remember: Doctrine cleans all relations, before doing this. So remember to persist your objects into database before serializing them. - - -$string = serialize($user); - -$user = unserialize($string); - - - -+++ Checking existence - -Very commonly you'll need to know if given record exists in the database. You can use the exists() method for checking if given record has a database row equivalent. - - -$record = new User(); - -$record->exists(); // false - -$record->name = 'someone'; -$record->save(); - -$record->exists(); // true - - -+++ Function callbacks for columns - -{{Doctrine_Record}} offers a way for attaching callback calls for column values. For example if you want to trim certain column, you can simply type: - - -$record->call('trim', 'column1'); - - -++ Collection - -{{Doctrine_Collection}} is a collection of records (see {{Doctrine_Record}}). As with records the collections can be deleted and saved using {{Doctrine_Collection::delete()}} and {{Doctrine_Collection::save()}} accordingly. - -When fetching data from database with either DQL API (see {{Doctrine_Query}}) or rawSql API (see {{Doctrine_RawSql}}) the methods return an instance of {{Doctrine_Collection}} by default. - -The following example shows how to initialize a new collection: - - -$conn = Doctrine_Manager::getInstance() - ->openConnection(new PDO("dsn", "username", "pw")); - -// initalizing a new collection -$users = new Doctrine_Collection($conn->getTable('User')); - -// alternative (propably easier) -$users = new Doctrine_Collection('User'); - -// adding some data -$users[0]->name = 'Arnold'; - -$users[1]->name = 'Somebody'; - -// finally save it! -$users->save(); - - - -+++ Accessing elements - -You can access the elements of {{Doctrine_Collection}} with {{set()}} and {{get()}} methods or with {{ArrayAccess}} interface. - - -$table = $conn->getTable("User"); - -$users = $table->findAll(); - -// accessing elements with ArrayAccess interface - -$users[0]->name = "Jack Daniels"; - -$users[1]->name = "John Locke"; - -// accessing elements with get() - -print $users->get(1)->name; - - - -+++ Adding new elements - -When accessing single elements of the collection and those elements (records) don't exist Doctrine auto-adds them. - -In the following example we fetch all users from database (there are 5) and then add couple of users in the collection. - -As with PHP arrays the indexes start from zero. - - -$users = $table->findAll(); - -print count($users); // 5 - -$users[5]->name = "new user 1"; -$users[6]->name = "new user 2"; - - - -+++ Getting collection count - -The {{Doctrine_Collection}} method {{count()}} returns the number of elements currently in the collection. - - -$users = $table->findAll(); - -print $users->count(); - - -Since {{Doctrine_Collection}} implements Countable interface a valid alternative for the previous example is to simply pass the collection as an argument for the count() function. - - -print count($users); // Doctrine_Collection implements Countable interface - - - -+++ Saving the collection - -Similar to {{Doctrine_Record}} the collection can be saved by calling the {{save()}} method. When save() gets called Doctrine issues save() operations an all records and wraps the whole procedure in a transaction. - - -$users = $table->findAll(); - -$users[0]->name = 'Jack Daniels'; - -$users[1]->name = 'John Locke'; - -$users->save(); - - - -+++ Deleting collection - -Doctrine Collections can be deleted in very same way is Doctrine Records you just call {{delete()}} method. As for all collections Doctrine knows how to perform single-shot-delete meaning it only performs one database query for the each collection. - -For example if we have collection of users. When deleting the collection -of users doctrine only performs one query for this whole transaction. The query would look something like: - - -DELETE FROM user WHERE id IN (1,2,3, ... ,N) - - -+++ Key mapping - -Sometimes you may not want to use normal indexing for collection elements. For example in some cases mapping primary keys as collection keys might be useful. The following example demonstrates how this can be achieved. - - -// mapping id column - -$user = new User(); - -$user->setAttribute(Doctrine::ATTR_COLL_KEY, 'id'); - -// now user collections will use the values of -// id column as element indexes - -$users = $user->getTable()->findAll(); - -foreach($users as $id => $user) { - print $id . $user->name; -} - -// mapping name column - -$user = new User(); - -$user->setAttribute(Doctrine::ATTR_COLL_KEY, 'name'); - -// now user collections will use the values of -// name column as element indexes - -$users = $user->getTable()->findAll(); - -foreach($users as $name => $user) { - print $name . $user->type; -} - - - -+++ Loading related records - -Doctrine provides means for efficiently retrieving all related records for all record elements. That means when you have for example a collection of users you can load all phonenumbers for all users by simple calling the {{loadRelated()}} method. - -However, in most cases you don't need to load related elements explicitly, rather what you should do is try to load everything at once by using the DQL API and JOINS. - -The following example uses three queries for retrieving users, their phonenumbers and the groups they belong to. - - -$users = $conn->query('FROM User'); - -// now lets load phonenumbers for all users - -$users->loadRelated('Phonenumber'); - -foreach($users as $user) { - print $user->Phonenumber[0]->phonenumber; - // no additional db queries needed here -} - -// the loadRelated works an any relation, even associations: - -$users->loadRelated('Group'); - -foreach($users as $user) { - print $user->Group[0]->name; -} - - -The example below shows how to do this more efficiently by using the DQL API. - - -// load everything here -$users = $conn->query('FROM User u LEFT JOIN u.Phonenumber p LEFT JOIN u.Group g'); - -foreach($users as $user) { - // no additional db queries needed here - print $user->Phonenumber->phonenumber; - - print $user->Group->name; -} - - -++ Connection - -Doctrine_Connection is a wrapper for database connection. It handles several things: - -* Handles database portability things missing from PDO (eg. {{LIMIT}} / {{OFFSET}} emulation) -* Keeps track of {{Doctrine_Table}} objects -* Keeps track of records -* Keeps track of records that need to be updated / inserted / deleted -* Handles transactions and transaction nesting -* Handles the actual querying of the database in the case of {{INSERT}} / {{UPDATE}} / {{DELETE}} operations -* Can query the database using the DQL API (see {{Doctrine_Query}}) -* Optionally validates transactions using {{Doctrine_Validator}} and gives full information of possible errors. - - -+++ Available drivers - -Doctrine has drivers for every PDO-supported database. The supported databases are: - -* FreeTDS / Microsoft SQL Server / Sybase -* Firebird/Interbase 6 -* Informix -* Mysql -* Oracle -* Odbc -* PostgreSQL -* Sqlite - - -+++ Getting a table object - -In order to get table object for specified record just call {{Doctrine_Record::getTable()}} or {{Doctrine_Connection::getTable()}}. - - -$manager = Doctrine_Manager::getInstance(); - -// open new connection - -$conn = $manager->openConnection(new PDO('dsn','username','password')); - -// getting a table object - -$table = $conn->getTable('User'); - - - -+++ Flushing the connection - -Creating new record (database row) is very easy. You can either use the {{Doctrine_Connection::create()}} or {{Doctrine_Table::create()}} method to do this or just simply use the new operator. - - -$user = new User(); -$user->name = 'Jack'; - -$group = $conn->create('Group'); -$group->name = 'Drinking Club'; - -// saves all the changed objects into database - -$conn->flush(); - - - -+++ Querying the database - -{{Doctrine_Connection::query()}} is a simple method for efficient object retrieval. It takes one parameter (DQL query) and optionally prepared statement params. - - - -// select all users - -$users = $conn->query('FROM User'); - -// select all users where user email is jackdaniels@drinkmore.info - -$users = $conn->query("FROM User WHERE User.Email.address = 'jackdaniels@drinkmore.info'"); - -// using prepared statements - -$users = $conn->query('FROM User WHERE User.name = ?', array('Jack')); - - - - -++ Table -{{Doctrine_Table}} holds the schema information specified by the given component (record). For example if you have a User class that extends Doctrine_Record, each schema definition call gets delegated to a unique table object that holds the information for later use. - -Each {{Doctrine_Table}} is registered by {{Doctrine_Connection}}, which means you can retrieve the tables from the connection by calling the getTable() method with the appropriate component name. - -For example, lets say we want to retrieve the table object for the User class. We can do this by simply giving the 'User' as the first argument for the getTable() method. - - -// get the current connection -$conn = Doctrine_Manager::connection(); - -$table = $conn->getTable('User'); - - -+++ Getting column information - -You can retrieve the column definitions set in {{Doctrine_Record}} by using the appropriate {{Doctrine_Table}} methods. If you need all information of all columns you can simply use: - - -// getting all information of all columns -$columns = $table->getColumns(); - - -Sometimes this can be an overkill. The following example shows how to retrieve the column names as an array: - - -// getting column names -$names = $table->getColumnNames(); - - -+++ Getting relation information - - -+++ Finder methods - -{{Doctrine_Table}} provides basic finder methods. These finder methods are very fast and should be used if you only need to fetch data from one database table. If you need queries that use several components (database tables) use {{Doctrine_Connection::query()}}. - - -$table = $conn->getTable("User"); - -// find by primary key - -$user = $table->find(2); - -if($user !== false) - print $user->name; - - -// get all users -foreach($table->findAll() as $user) { - print $user->name; -} - -// finding by dql -foreach($table->findByDql("name LIKE '%John%'") as $user) { - print $user->created; -} - - - -++++ Custom table classes - -Adding custom table classes is very easy. Only thing you need to do is name the classes as {{[componentName]Table}} and make them inherit {{Doctrine_Table}}. - - - -// valid table object - -class UserTable extends Doctrine_Table -{ -} - -// not valid [doesn't extend Doctrine_Table] -class GroupTable { } - - - -+++ Custom finders - -You can add custom finder methods to your custom table object. These finder methods may use fast {{Doctrine_Table}} finder methods or DQL API ({{Doctrine_Connection::query()}}). - - -class UserTable extends Doctrine_Table { - /** - * you can add your own finder methods here - */ - public function findByName($name) { - return $this->getConnection()->query("FROM User WHERE name LIKE '%$name%'"); - } -} -class User extends Doctrine_Record { } - -$conn = Doctrine_Manager::getInstance() - ->openConnection(new PDO("dsn","username","password")); - -// doctrine will now check if a class called UserTable exists -// and if it inherits Doctrine_Table - -$table = $conn->getTable("User"); - -print get_class($table); // UserTable - -$users = $table->findByName("Jack"); - - - -++ Validators -++ Profiler -++ Locking manager -++ View - diff --git a/manual/docs/en/component-overview/hook.txt b/manual/docs/en/component-overview/hook.txt deleted file mode 100644 index c2e8be15e..000000000 --- a/manual/docs/en/component-overview/hook.txt +++ /dev/null @@ -1,7 +0,0 @@ -+++ Introduction - -Many web applications have different kinds of lists. The lists may contain data from multiple components (= database tables) and they may have actions such as paging, sorting and setting conditions. {{Doctrine_Hook}} helps building these lists. It has a simple API for building search criteria forms as well as building a DQL query from the 'hooked' parameters. - - -+++ Building queries -+++ List of parsers diff --git a/manual/docs/en/component-overview/locking-manager.txt b/manual/docs/en/component-overview/locking-manager.txt deleted file mode 100644 index 8cd49dc11..000000000 --- a/manual/docs/en/component-overview/locking-manager.txt +++ /dev/null @@ -1,103 +0,0 @@ -+++ Introduction - -[**Note**: The term 'Transaction' doesnt refer to database transactions here but to the general meaning of this term] - -[**Note**: This component is in **Alpha State**] - -Locking is a mechanism to control concurrency. The two most well known locking strategies are optimistic and pessimistic locking. The following is a short description of these two strategies from which only pessimistic locking is currently supported by Doctrine. - -**Optimistic Locking:** - -The state/version of the object(s) is noted when the transaction begins. When the transaction finishes the noted state/version of the participating objects is compared to the current state/version. When the states/versions differ the objects have been modified by another transaction and the current transaction should fail. This approach is called 'optimistic' because it is assumed that it is unlikely that several users will participate in transactions on the same objects at the same time. - -**Pessimistic Locking:** - -The objects that need to participate in the transaction are locked at the moment the user starts the transaction. No other user can start a transaction that operates on these objects while the locks are active. This ensures that the user who starts the transaction can be sure that noone else modifies the same objects until he has finished his work. - -Doctrine's pessimistic offline locking capabilities can be used to control concurrency during actions or procedures that take several HTTP request and response cycles and/or a lot of time to complete. - - -+++ Examples - -The following code snippet demonstrates the use of Doctrine's pessimistic offline locking capabilities. - -At the page where the lock is requested... - - - -// Get a locking manager instance -$lockingMngr = new Doctrine_Locking_Manager_Pessimistic(); - -try -{ - // Ensure that old locks which timed out are released - // before we try to acquire our lock - // 300 seconds = 5 minutes timeout - $lockingMngr->releaseAgedLocks(300); - - // Try to get the lock on a record - $gotLock = $lockingMngr->getLock( - // The record to lock. This can be any Doctrine_Record - $myRecordToLock, - // The unique identifier of the user who is trying to get the lock - 'Bart Simpson' - ); - - if($gotLock) - { - echo "Got lock!"; - // ... proceed - } - else - { - echo "Sorry, someone else is currently working on this record"; - } -} -catch(Doctrine_Locking_Exception $dle) -{ - echo $dle->getMessage(); - // handle the error -} - - - -At the page where the transaction finishes... - - -// Get a locking manager instance -$lockingMngr = new Doctrine_Locking_Manager_Pessimistic(); - -try -{ - if($lockingMngr->releaseLock($myRecordToUnlock, 'Bart Simpson')) - { - echo "Lock released"; - } - else - { - echo "Record was not locked. No locks released."; - } -} -catch(Doctrine_Locking_Exception $dle) -{ - echo $dle->getMessage(); - // handle the error -} - - - -+++ Planned - -* Possibility to release locks of a specific Record type (i.e. releasing all locks on 'User' objects). - -+++ Technical Details - -The pessimistic offline locking manager stores the locks in the database (therefore 'offline'). The required locking table is automatically created when you try to instantiate an instance of the manager and the ATTR_CREATE_TABLES is set to TRUE. This behaviour may change in the future to provide a centralised and consistent table creation procedure for installation purposes. - - -+++ Maintainer - -Roman Borschel - romanb at #doctrine (freenode) - -Don't hesitate to contact me if you have questions, ideas, ect. - diff --git a/manual/docs/en/component-overview/profiler.txt b/manual/docs/en/component-overview/profiler.txt deleted file mode 100644 index 85f5729cd..000000000 --- a/manual/docs/en/component-overview/profiler.txt +++ /dev/null @@ -1,32 +0,0 @@ -+++ Introduction -{{Doctrine_Connection_Profiler}} is an eventlistener for {{Doctrine_Connection}}. It provides flexible query profiling. Besides the SQL strings the query profiles include elapsed time to run the queries. This allows inspection of the queries that have been performed without the need for adding extra debugging code to model classes. - -{{Doctrine_Connection_Profiler}} can be enabled by adding it as an eventlistener for {{Doctrine_Connection}}. - - -$conn = Doctrine_Manager::connection($dsn); - -$profiler = new Doctrine_Connection_Profiler(); - -$conn->setListener($profiler); - -+++ Basic usage - -Perhaps some of your pages is loading slowly. The following shows how to build a complete profiler report from the connection: - - -$time = 0; -foreach ($profiler as $event) { - $time += $event->getElapsedSecs(); - echo $event->getName() . " " . sprintf("%f", $event->getElapsedSecs()) . "
\n"; - echo $event->getQuery() . "
\n"; - $params = $event->getParams(); - if( ! empty($params)) { - var_dump($params); - } -} -echo "Total time: " . $time . "
\n"; -
- -+++ Advanced usage - diff --git a/manual/docs/en/component-overview/validators.txt b/manual/docs/en/component-overview/validators.txt deleted file mode 100644 index 0e4f7e889..000000000 --- a/manual/docs/en/component-overview/validators.txt +++ /dev/null @@ -1,118 +0,0 @@ -+++ Introduction - -Validation in Doctrine is a way to enforce your business rules in the model part of the MVC architecture. You can think of this validation as a gateway that needs to be passed right before data gets into the persistent data store. The definition of these business rules takes place at the record level, that means in your active record model classes (classes derived from {{Doctrine_Record}}). The first thing you need to do to be able to use this kind of validation is to enable it globally. This is done through the {{Doctrine_Manager}} (see the code below). - -Once you enabled validation, you'll get a bunch of validations automatically: - -* **Data type validations**: All values assigned to columns are checked for the right type. That means if you specified a column of your record as type 'integer', Doctrine will validate that any values assigned to that column are of this type. This kind of type validation tries to be as smart as possible since PHP is a loosely typed language. For example 2 as well as "7" are both valid integers whilst "3f" is not. Type validations occur on every column (since every column definition needs a type). -* **Length validation**: As the name implies, all values assigned to columns are validated to make sure that the value does not exceed the maximum length. - - -// turning on validation -Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - -You can combine the following constants by using bitwise operations: VALIDATE_ALL, VALIDATE_TYPES, VALIDATE_LENGTHS, -VALIDATE_CONSTRAINTS, VALIDATE_NONE. For example to enable all validations except length validations you would use: - -VALIDATE_ALL & ~VALIDATE_LENGTHS - - -+++ More Validation - -The type and length validations are handy but most of the time they're not enough. Therefore Doctrine provides some mechanisms that can be used to validate your data in more detail. - -Validators are an easy way to specify further validations. Doctrine has a lot of predefined validators that are frequently needed such as email, country, ip, range and regexp validators. You find a full list of available validators at the bottom of this page. You can specify which validators apply to which column through the 4th argument of the {{hasColumn()}} method. If that is still not enough and you need some specialized validation that is not yet available as a predefined validator you have three options: - -* You can write the validator on your own. -* You can propose your need for a new validator to a Doctrine developer. -* You can use validation hooks. - -The first two options are advisable if it is likely that the validation is of general use and is potentially applicable in many situations. In that case it is a good idea to implement a new validator. However if the validation is special it is better to use hooks provided by Doctrine: - -* {{validate()}} (Executed every time the record gets validated) -* {{validateOnInsert()}} (Executed when the record is new and gets validated) -* {{validateOnUpdate()}} (Executed when the record is not new and gets validated) - -If you need a special validation in your active record you can simply override one of these methods in your active record class (a descendant of {{Doctrine_Record}}). Within thess methods you can use all the power of PHP to validate your fields. When a field doesnt pass your validation you can then add errors to the record's error stack. The following code snippet shows an example of how to define validators together with custom validation: - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->ownsOne('Email', array('local' => 'email_id')); - } - public function setTableDefinition() - { - // no special validators used only types - // and lengths will be validated - $this->hasColumn('name', 'string', 15); - $this->hasColumn('email_id', 'integer'); - $this->hasColumn('created', 'integer', 11); - } - // Our own validation - protected function validate() - { - if ($this->name == 'God') { - // Blasphemy! Stop that! ;-) - // syntax: add(, ) - $this->getErrorStack()->add('name', 'forbiddenName'); - } - } -} -class Email extends Doctrine_Record { - public function setTableDefinition() { - // validators 'email' and 'unique' used - $this->hasColumn("address","string",150, array("email", "unique")); - } -} - - - -+++ Valid or Not Valid - -Now that you know how to specify your business rules in your models, it is time to look at how to deal with these rules in the rest of your application. - -++++ Implicit validation - -Whenever a record is going to be saved to the persistent data store (i.e. through calling {{$record->save()}}) the full validation procedure is executed. If errors occur during that process an exception of the type {{Doctrine_Validator_Exception}} will be thrown. You can catch that exception and analyze the errors by using the instance method {{Doctine_Validator_Exception::getInvalidRecords()}}. This method returns an ordinary array with references to all records that did not pass validation. You can then further explore the errors of each record by analyzing the error stack of each record. The error stack of a record can be obtained with the instance method {{Doctrine_Record::getErrorStack()}}. Each error stack is an instance of the class {{Doctrine_Validator_ErrorStack}}. The error stack provides an easy to use interface to inspect the errors. - -++++ Explicit validation - -You can explicitly trigger the validation for any record at any time. For this purpose Doctrine_Record provides the instance method {{Doctrine_Record::isValid()}}. This method returns a boolean value indicating the result of the validation. If the method returns false, you can inspect the error stack in the same way as seen above except that no exception is thrown, so you simply obtain the error stack of the record that didnt pass validation through {{Doctrine_Record::getErrorStack()}}. - -The following code snippet shows an example of handling implicit validation which caused a {{Doctrine_Validator_Exception}}. - - -try { - $user->name = "this is an example of too long name"; - $user->Email->address = "drink@@notvalid.."; - $user->save(); -} catch(Doctrine_Validator_Exception $e) { - // Note: you could also use $e->getInvalidRecords(). The direct way - // used here is just more simple when you know the records you're dealing with. - $userErrors = $user->getErrorStack(); - $emailErrors = $user->Email->getErrorStack(); - - /* Inspect user errors */ - foreach($userErrors as $fieldName => $errorCodes) { - switch ($fieldName) { - case 'name': - // $user->name is invalid. inspect the error codes if needed. - break; - } - } - - /* Inspect email errors */ - foreach($emailErrors as $fieldName => $errorCodes) { - switch ($fieldName) { - case 'address': - // $user->Email->address is invalid. inspect the error codes if needed. - break; - } - } -} - - - diff --git a/manual/docs/en/component-overview/view.txt b/manual/docs/en/component-overview/view.txt deleted file mode 100644 index d70e1b469..000000000 --- a/manual/docs/en/component-overview/view.txt +++ /dev/null @@ -1,39 +0,0 @@ -+++ Introduction - -Database views can greatly increase the performance of complex queries. You can think of them as cached queries. {{Doctrine_View}} provides integration between database views and DQL queries. - - -+++ Managing views - - -$conn = Doctrine_Manager::getInstance() - ->openConnection(new PDO("dsn","username","password")); - -$query = new Doctrine_Query($conn); -$query->from('User.Phonenumber')->limit(20); - -$view = new Doctrine_View($query, 'MyView'); - -// creating a database view -$view->create(); - -// dropping the view from the database -$view->drop(); - - - -+++ Using views - - -$conn = Doctrine_Manager::getInstance() - ->openConnection(new PDO("dsn","username","password")); - -$query = new Doctrine_Query($conn); -$query->from('User.Phonenumber')->limit(20); - -// hook the query into appropriate view -$view = new Doctrine_View($query, 'MyView'); - -// now fetch the data from the view -$coll = $view->execute(); - diff --git a/manual/docs/en/configuration.txt b/manual/docs/en/configuration.txt deleted file mode 100644 index 3b7f27787..000000000 --- a/manual/docs/en/configuration.txt +++ /dev/null @@ -1,189 +0,0 @@ -++ Introduction -++ Levels of configuration -++ General attributes -+++ Portability - -Each database management system (DBMS) has it's own behaviors. For example, some databases capitalize field names in their output, some lowercase them, while others leave them alone. These quirks make it difficult to port your scripts over to another server type. Doctrine strives to overcome these differences so your program can switch between DBMS's without any changes. - -You control which portability modes are enabled by using the portability configuration option. Configuration options are set via {{factory()}} and {{setOption()}}. - -The portability modes are bitwised, so they can be combined using {{|}} and removed using {{^}}. See the examples section below on how to do this. - - -++++ Portability Mode Constants - - -: {{Doctrine::PORTABILITY_ALL}} (default) : turn on all portability features. this is the default setting. - -: {{Doctrine::PORTABILITY_DELETE_COUNT}} : Force reporting the number of rows deleted. Some DBMS's don't count the number of rows deleted when performing simple {{DELETE FROM}} tablename queries. This mode tricks such DBMS's into telling the count by adding {{WHERE 1=1}} to the end of {{DELETE}} queries. - -: {{Doctrine::PORTABILITY_EMPTY_TO_NULL}} : Convert empty strings values to null in data in and output. Needed because Oracle considers empty strings to be null, while most other DBMS's know the difference between empty and null. - -: {{Doctrine::PORTABILITY_ERRORS}} : Makes certain error messages in certain drivers compatible with those from other DBMS's - -: {{Doctrine::PORTABILITY_FIX_ASSOC_FIELD_NAMES}} : This removes any qualifiers from keys in associative fetches. some RDBMS , like for example SQLite, will be default use the fully qualified name for a column in assoc fetches if it is qualified in a query. - -: {{Doctrine::PORTABILITY_FIX_CASE}} : Convert names of tables and fields to lower or upper case in all methods. The case depends on the {{field_case}} option that may be set to either {{CASE_LOWER}} (default) or {{CASE_UPPER}} - -: {{Doctrine::PORTABILITY_NONE}} : Turn off all portability features - -: {{Doctrine::PORTABILITY_NUMROWS}} : Enable hack that makes {{numRows()}} work in Oracle - -: {{Doctrine::PORTABILITY_EXPR}} : Makes DQL API throw exceptions when non-portable expressions are being used. - -: {{Doctrine::PORTABILITY_RTRIM}} : Right trim the data output for all data fetches. This does not applied in drivers for RDBMS that automatically right trim values of fixed length character values, even if they do not right trim value of variable length character values. - - -++++ Examples - -Using {{setAttribute()}} to enable portability for lowercasing and trimming - - -$conn->setAttribute('portability', - Doctrine::PORTABILITY_FIX_CASE | Doctrine::PORTABILITY_RTRIM); - - -Using {{setAttribute()}} to enable all portability options except trimming - - -$conn->setAttribute('portability', - Doctrine::PORTABILITY_ALL ^ Doctrine::PORTABILITY_RTRIM); - - - -+++ Identifier quoting - -You can quote the db identifiers (table and field names) with {{quoteIdentifier()}}. The delimiting style depends on which database driver is being used. - -NOTE: just because you CAN use delimited identifiers, it doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve. Anyway, it may be necessary when you have a reserved word as a field name (in this case, we suggest you to change it, if you can). - -Some of the internal Doctrine methods generate queries. Enabling the {{quote_identifier}} attribute of Doctrine you can tell Doctrine to quote the identifiers in these generated queries. For all user supplied queries this option is irrelevant. - -Portability is broken by using the following characters inside delimited identifiers: - -* backtick (`) -- due to MySQL -* double quote (") -- due to Oracle -* brackets ([ or ]) -- due to Access - -Delimited identifiers are known to generally work correctly under the following drivers: - -* Mssql -* Mysql -* Oracle -* Pgsql -* Sqlite -* Firebird - -When using the {{ATTR_QUOTE_IDENTIFIER}} option, all of the field identifiers will be automatically quoted in the resulting SQL statements: - - -$conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - -will result in a SQL statement that all the field names are quoted with the backtick '`' operator (in MySQL). - - -SELECT * FROM `sometable` WHERE `id` = '123' - - -as opposed to: - - -SELECT * FROM sometable WHERE id='123' - - - -+++ Exporting - -The export attribute is used for telling Doctrine what it should export when exporting classes. - -If you don't want to export anything when calling export() you can use: - - -$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_NONE); - - -For exporting tables only (but not constraints) you can use on of the following: - - -$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_TABLES); -// or you can use -$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL ^ Doctrine::EXPORT_CONSTRAINTS); - - -For exporting everything (tables and constraints) you can use: - - -$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL); - - -+++ Event listener - - -// setting default event listener -$manager->setAttribute(Doctrine::ATTR_LISTENER, new MyListener()); - -++ Naming convention attributes - -Naming convention attributes affect on the naming of different database related elements such as tables, indexes and sequences. Basically every naming convention attribute has affect in both ways. When importing schemas from the database to classes and when exporting classes into database. - -So for example by default Doctrine naming convention for indexes is %s_idx. Not only do the indexes you set get a special suffix, also the imported classes get their indexes mapped to their non-suffixed equivalents. This applies to all naming convention attributes. - -+++ Index name format - -Doctrine::ATTR_IDXNAME_FORMAT can be used for changing the naming convention of indexes. By default Doctrine uses the format [name]_idx. So defining an index called 'ageindex' will actually be converted into 'ageindex_idx'. - - -// changing the index naming convention -$manager->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%s_index'); - - -+++ Sequence name format - -Similar to Doctrine::ATTR_IDXNAME_FORMAT, Doctrine::ATTR_SEQNAME_FORMAT can be used for changing the naming convention of sequences. By default Doctrine uses the format [name]_seq, hence creating a new sequence with the name of 'mysequence' will lead into creation of sequence called 'mysequence_seq'. - - -// changing the sequence naming convention -$manager->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%s_sequence'); - - -+++ Table name format - -+++ Database name format - - -// changing the database naming convention -$manager->setAttribute(Doctrine::ATTR_DBNAME_FORMAT, 'myframework_%s'); - - -++ Validation attributes - -Doctrine provides complete control over what it validates. The validation procedure can be controlled with Doctrine::ATTR_VALIDATE. - -The validation modes are bitwised, so they can be combined using {{|}} and removed using {{^}}. See the examples section below on how to do this. - -+++ Validation mode constants - -: {Doctrine::VALIDATE_NONE} : Turns off the whole validation procedure. This is the default value. - -: {Doctrine::VALIDATE_LENGTHS} : Makes Doctrine validate all field lengths. - -: {Doctrine::VALIDATE_TYPES} : Makes Doctrine validate all field types. Doctrine does loose type validation. This means that for example string with value '13.3' will not pass as an integer but '13' will. - -: {Doctrine::VALIDATE_CONSTRAINTS} : Makes Doctrine validate all field constraints such as notnull, email etc. - -: {Doctrine::VALIDATE_ALL} : Turns on all validations. - -+++ Examples - -Turning on all validations: - - -$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - -Validating lengths and types, but not constraints: - - -$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_LENGTHS | Doctrine::VALIDATE_TYPES); - diff --git a/manual/docs/en/configuration/introduction.txt b/manual/docs/en/configuration/introduction.txt deleted file mode 100644 index 23a485f05..000000000 --- a/manual/docs/en/configuration/introduction.txt +++ /dev/null @@ -1,5 +0,0 @@ - -$manager = Doctrine_Manager::getInstance(); - -$manager->setAttribute(Doctrine::ATTR_LISTENER, new MyListener()); - diff --git a/manual/docs/en/configuration/levels-of-configuration.txt b/manual/docs/en/configuration/levels-of-configuration.txt deleted file mode 100644 index d648809af..000000000 --- a/manual/docs/en/configuration/levels-of-configuration.txt +++ /dev/null @@ -1,33 +0,0 @@ -Doctrine has a three-level configuration structure. You can set configuration attributes in global, connection and table level. If the same attribute is set on both lower level and upper level, the uppermost attribute will always be used. So for example if user first sets default fetchmode in global level to {{Doctrine::FETCH_BATCH}} and then sets {{example}} table fetchmode to {{Doctrine::FETCH_LAZY}}, the lazy fetching strategy will be used whenever the records of 'example' table are being fetched. - -: **Global level** : The attributes set in global level will affect every connection and every table in each connection. -: **Connection level** : The attributes set in connection level will take effect on each table in that connection. -: **Table level** : The attributes set in table level will take effect only on that table. - -In the following example we set an attribute at the global level: - -// setting a global level attribute -$manager = Doctrine_Manager::getInstance(); - -$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - -In the next example above we override the global attribute on given connection. - -// setting a connection level attribute -// (overrides the global level attribute on this connection) - -$conn = $manager->openConnection(new PDO('dsn', 'username', 'pw')); - -$conn->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - - -In the last example we override once again the connection level attribute in the table level. - -// setting a table level attribute -// (overrides the connection/global level attribute on this table) - -$table = $conn->getTable('User'); - -$table->setAttribute(Doctrine::ATTR_LISTENER, new UserListener()); - diff --git a/manual/docs/en/configuration/setting-attributes.txt b/manual/docs/en/configuration/setting-attributes.txt deleted file mode 100644 index 99a809136..000000000 --- a/manual/docs/en/configuration/setting-attributes.txt +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/manual/docs/en/connection-management.txt b/manual/docs/en/connection-management.txt deleted file mode 100644 index 3d23cf6a1..000000000 --- a/manual/docs/en/connection-management.txt +++ /dev/null @@ -1,5 +0,0 @@ -++ DSN, the Data Source Name -++ Opening a new connection -++ Lazy-connecting to database -++ Managing connections -++ Connection-component binding diff --git a/manual/docs/en/connection-management/connection-component-binding.txt b/manual/docs/en/connection-management/connection-component-binding.txt deleted file mode 100644 index aa19916c5..000000000 --- a/manual/docs/en/connection-management/connection-component-binding.txt +++ /dev/null @@ -1,20 +0,0 @@ -Doctrine allows you to bind connections to components (= your ActiveRecord classes). This means everytime a component issues a query or data is being fetched from the table the component is pointing at Doctrine will use the bound connection. - - -$conn = $manager->openConnection(new PDO('dsn','username','password'), 'connection 1'); - -$conn2 = $manager->openConnection(new PDO('dsn2','username2','password2'), 'connection 2'); - -$manager->bindComponent('User', 'connection 1'); - -$manager->bindComponent('Group', 'connection 2'); - -$q = new Doctrine_Query(); - -// Doctrine uses 'connection 1' for fetching here -$users = $q->from('User u')->where('u.id IN (1,2,3)')->execute(); - -// Doctrine uses 'connection 2' for fetching here -$groups = $q->from('Group g')->where('g.id IN (1,2,3)')->execute(); - - diff --git a/manual/docs/en/connection-management/dsn-the-data-source-name.txt b/manual/docs/en/connection-management/dsn-the-data-source-name.txt deleted file mode 100644 index 83b9ae1da..000000000 --- a/manual/docs/en/connection-management/dsn-the-data-source-name.txt +++ /dev/null @@ -1,102 +0,0 @@ -In order to connect to a database through Doctrine, you have to create a valid DSN - data source name. - -Doctrine supports both PEAR DB/MDB2 like data source names as well as PDO style data source names. The following section deals with PEAR like data source names. If you need more info about the PDO-style data source names see [[php PDO->__construct()]]. - -The DSN consists in the following parts: - -||~ DSN part ||~ Description || -|| phptype || Database backend used in PHP (i.e. mysql , pgsql etc.) || -|| dbsyntax || Database used with regards to SQL syntax etc. || -|| protocol || Communication protocol to use ( i.e. tcp, unix etc.) || -|| hostspec || Host specification (hostname[:port]) || -|| database || Database to use on the DBMS server || -|| username || User name for login || -|| password || Password for login || -|| proto_opts || Maybe used with protocol || -|| option || Additional connection options in URI query string format. Options are separated by ampersand (&). The Following table shows a non complete list of options: || - - -**List of options** - -||~ Name ||~ Description || -|| charset || Some backends support setting the client charset.|| -|| new_link || Some RDBMS do not create new connections when connecting to the same host multiple times. This option will attempt to force a new connection. || - -The DSN can either be provided as an associative array or as a string. The string format of the supplied DSN is in its fullest form: - -phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value - -Most variations are allowed: - - -phptype://username:password@protocol+hostspec:110//usr/db_file.db -phptype://username:password@hostspec/database -phptype://username:password@hostspec -phptype://username@hostspec -phptype://hostspec/database -phptype://hostspec -phptype:///database -phptype:///database?option=value&anotheroption=anothervalue -phptype(dbsyntax) -phptype - - -The currently supported database backends are: - -||~ Driver name ||~ Supported databases || -|| firbird || Firebird || -|| informix || Informix || -|| mssql || Microsoft SQL Server || -|| mysql || MySQL || -|| oracle || Oracle || -|| pgsql || PostgreSQL || -|| sqlite || SQLite || - -A second DSN format supported is - - -phptype(syntax)://user:pass@protocol(proto_opts)/database - - -If your database, option values, username or password contain characters used to delineate DSN parts, you can escape them via URI hex encodings: - -||~ Character ||~ Hex Code || -|| : || %3a || -|| / || %2f || -|| @ || %40 || -|| + || %2b || -|| ( || %28 || -|| ) || %29 || -|| ? || %3f || -|| = || %3d || -|| & || %26 || - -Warning -Please note, that some features may be not supported by all database backends. - - -+++ Examples - -**Example 1.** Connect to database through a socket - - -mysql://user@unix(/path/to/socket)/pear - - -**Example 2.** Connect to database on a non standard port - - -pgsql://user:pass@tcp(localhost:5555)/pear - - -**Example 3.** Connect to SQLite on a Unix machine using options - - -sqlite:////full/unix/path/to/file.db?mode=0666 - - -**Example 4.** Connect to SQLite on a Windows machine using options - - -sqlite:///c:/full/windows/path/to/file.db?mode=0666 - diff --git a/manual/docs/en/connection-management/lazy-connecting-to-database.txt b/manual/docs/en/connection-management/lazy-connecting-to-database.txt deleted file mode 100644 index 6c676a76f..000000000 --- a/manual/docs/en/connection-management/lazy-connecting-to-database.txt +++ /dev/null @@ -1,14 +0,0 @@ -Lazy-connecting to database can save a lot of resources. There might be many pages where you don't need an actual database connection, hence its always recommended to use lazy-connecting (that means Doctrine will only connect to database when needed). - -This feature can be very useful when using for example page caching, hence not actually needing a database connection on every request. Remember connecting to database is an expensive operation. - - -$dsn = 'mysql://username:password@localhost/test'; - -// initalize a new Doctrine_Connection -$conn = Doctrine_Manager::connection($dsn); -// !! no actual database connection yet !! - -// connects database and performs a query -$conn->query('FROM User u'); - diff --git a/manual/docs/en/connection-management/managing-connections.txt b/manual/docs/en/connection-management/managing-connections.txt deleted file mode 100644 index 72146214d..000000000 --- a/manual/docs/en/connection-management/managing-connections.txt +++ /dev/null @@ -1,52 +0,0 @@ -From the start Doctrine has been designed to work with multiple connections. Unless separately specified Doctrine always uses the current connection for executing the queries. The following example uses {{openConnection()}} second argument as an optional connection alias. - - -// Doctrine_Manager controls all the connections - -$manager = Doctrine_Manager::getInstance(); - -// open first connection - -$conn = $manager->openConnection(new PDO('dsn','username','password'), 'connection 1'); - - -For convenience {{Doctrine_Manager}} provides static method {{connection()}} which opens new connection when arguments are given to it and returns the current connection when no arguments have been speficied. - - -// open first connection - -$conn = Doctrine_Manager::connection(new PDO('dsn','username','password'), 'connection 1'); - -$conn2 = Doctrine_Manager::connection(); - -// $conn2 == $conn - - -The current connection is the lastly opened connection. - - -// open second connection - -$conn2 = $manager->openConnection(new PDO('dsn2','username2','password2'), 'connection 2'); - -$manager->getCurrentConnection(); // $conn2 - - -You can change the current connection by calling {{setCurrentConnection()}}. - - -$manager->setCurrentConnection('connection 1'); - -$manager->getCurrentConnection(); // $conn - - -You can iterate over the opened connection by simple passing the manager object to foreach clause. This is possible since {{Doctrine_Manager}} implements special {{IteratorAggregate}} interface. - - -// iterating through connections - -foreach($manager as $conn) { - -} - - diff --git a/manual/docs/en/connection-management/opening-a-new-connection.txt b/manual/docs/en/connection-management/opening-a-new-connection.txt deleted file mode 100644 index 4e927576f..000000000 --- a/manual/docs/en/connection-management/opening-a-new-connection.txt +++ /dev/null @@ -1,13 +0,0 @@ -Opening a new database connection in Doctrine is very easy. If you wish to use PDO (www.php.net/PDO) you can just initalize a new PDO object: - - -$dsn = 'mysql:dbname=testdb;host=127.0.0.1'; -$user = 'dbuser'; -$password = 'dbpass'; - -try { - $dbh = new PDO($dsn, $user, $password); -} catch (PDOException $e) { - echo 'Connection failed: ' . $e->getMessage(); -} - diff --git a/manual/docs/en/data-fixtures.txt b/manual/docs/en/data-fixtures.txt deleted file mode 100644 index 80f702d33..000000000 --- a/manual/docs/en/data-fixtures.txt +++ /dev/null @@ -1,134 +0,0 @@ -Doctrine Data uses the Doctrine Parser for the dumping and loading of fixtures data so it is possible to use any of the formats available in the Parser. Currently yml is the only fully supported format but xml and others are next. - -++ Exporting - -You can export data to fixtures file in many different formats - - -// A few ways exist for specifying where you export the data - -// Dump to one large fixture file -$data = new Doctrine_Data(); -$data->exportData('data.yml', 'yml'); - -// Dump to individual files. One file per model. 3rd argument true specifies to dump to individual files -$data = new Doctrine_Data(); -$data->exportData('path/to/directory', 'yml', true); - - -++ Importing - -You can import data from fixtures files in many different formats - - -// Path can be in a few different formats -$path = 'path/to/data.yml'; // Path directly to one yml file -$path = array('data.yml', 'data2.yml', 'more.yml'); // Array of yml file paths -$path = array('directory1', 'directory2', 'directory3'); // Array of directories which contain yml files. It will find all files with an extension of .yml - -// Specify the format of the data you are importing -$format = 'yml'; // xml, yml, json - -$models = array('User', 'Phonenumber'); // you can optionally specify an array of the models you wish to import the data for, by default it loads data for all the available loaded models and the data that exists - -$data = new Doctrine_Data(); -$data->importData($path, $format, $models); - - -++ Dummy Data - -With Doctrine Data you can import dummy data to all your Doctrine Records - - -$numRecords = 3; // Number of dummy records to populate for each model -$models = array('User', 'Email'); // Models to generate dummy data for. If none specified it generates dummy data for all loaded models. - -$data = new Doctrine_Data(); -$data->importDummyData($numRecords, $models); - - -++ Writing - -You can write your fixtures files manually and load them in to your applications. Below is a sample data.yml fixtures file. You can also split your data fixtures file up in to multiple files. Doctrine will read all fixtures files and parse them, then load all data. - -Imagine a schema with the following relationships: - - -Resource hasMany Tag as Tags -Resource hasOne ResourceType as Type -ResourceType hasMany Resource as Resources -Tag hasMany Resource as Resources - - - ---- -Resource: - Resource_1: - name: Doctrine Video Tutorial - Type: Video - Tags: [tutorial, doctrine, help] - Resource_2: - name: Doctrine Cheat Sheet - Type: Image - Tags: [tutorial, cheat, help] - -ResourceType: - Video: - name: Video - Image: - name: Image - -Tag: - tutorial: - name: tutorial - doctrine: - name: doctrine - help: - name: help - cheat: - name: cheat - - -You could optionally specify the Resources each tag is related to instead of specifying the Tags a Resource has. - - -Tag: - tutorial: - name: tutorial - Resources: [Resource_1, Resource_2] - doctrine: - name: doctrine - Resources: [Resource_1] - help: - name: help - Resources: [Resource_1, Resource_2] - cheat: - name: cheat - Resources: [Resource_1] - - -Here is how you would write code to load the data from that data.yml file - - -$data = new Doctrine_Data(); -$data->importData('data.yml', 'yml'); - - -++ Fixtures For Nested Sets - -Writing a fixtures file for a nested set tree is slightly different from writing regular fixtures files. The structure of the tree is defined like this: - - ---- - Category: - Category_1: - title: Categories # the root node - children: - Category_2: - title: Category 1 - Category_3: - title: Category 2 - children: - Category_4: - title: Subcategory of Category 2 - \ No newline at end of file diff --git a/manual/docs/en/database-abstraction.txt b/manual/docs/en/database-abstraction.txt deleted file mode 100644 index 4d4d34891..000000000 --- a/manual/docs/en/database-abstraction.txt +++ /dev/null @@ -1,442 +0,0 @@ -++ Modules -++ Export -+++ Introduction -The Export module provides methods for managing database structure. The methods can be grouped based on their responsibility: create, edit (alter or update), list or delete (drop) database elements. The following document lists the available methods, providing examples of their use. - -Every schema altering method in the Export module has an equivalent which returns the sql that is used for the altering operation. For example createTable() executes the query / queries returned by createTableSql(). - -In this chapter the following tables will be created, altered and finally dropped, in a database named "events_db": -events(id, name, datetime); -people(id, name); -event_participants(event_id, person_id); - -+++ Creating a database - -$conn->export->createDatabase('events_db'); - -+++ Creating tables - -Now that the database is created, we can proceed with adding some tables. The method createTable() takes three parameters: the table name, an array of field definition and some extra options (optional and RDBMS-specific). Now lets create the events table: - - -$definition = array ( - 'id' => array ( - 'type' => 'integer', - 'unsigned' => 1, - 'notnull' => 1, - 'default' => 0, - ), - 'name' => array ( - 'type' => 'string', - 'length' => 255 - ), - 'datetime' => array ( - 'type' => 'timestamp' - ) -); - -$conn->export->createTable('events', $definition); - - -The keys of the definition array are the names of the fields in the table. The values are arrays containing the required key 'type' as well as other keys, depending on the value of 'type'. The values for the 'type' key are the same as the possible Doctrine datatypes. Depending on the datatype, the other options may vary. - -||~ Datatype ||~ length ||~ default ||~ not null ||~ unsigned ||~ autoincrement || -|| string || x || x || x || || || -|| boolean || || x || x || || || -|| integer || x || x || x || x || x || -|| decimal || || x || x || || || -|| float || || x || x || || || -|| timestamp || || x || x || || || -|| time || || x || x || || || -|| date || || x || x || || || -|| clob || x || || x || || || -|| blob || x || || x || || || - -Creating the people table: - - -$options = array( - 'comment' => 'Repository of people', - 'character_set' => 'utf8', - 'collate' => 'utf8_unicode_ci', - 'type' => 'innodb', -); -$definition = array ( - 'id' => array ( - 'type' => 'integer', - 'unsigned' => 1, - 'notnull' => 1, - 'default' => 0, - ), - 'name' => array ( - 'type' => 'string', - 'length' => 255 - ) -); -$conn->export->createTable('people', $definition, $options); - - - - -+++ Creating foreign keys - -Creating the event_participants table with a foreign key: - - -$options = array( - 'foreignKeys' => array('local' => 'event_id', - 'foreign' => 'id' - 'foreignTable' => 'events' - 'onDelete' => 'CASCADE'), - 'primary' => array('event_id', 'person_id'), -); -$definition = array ( - 'event_id' => array ( - 'type' => 'integer', - 'unsigned' => 1, - 'notnull' => 1, - 'default' => 0, - ), - 'person_id' => array ( - 'type' => 'integer', - 'unsigned' => 1, - 'notnull' => 1, - 'default' => 0, - ), -); - -$conn->export->createTable('event_participants', $definition, $options); - - -Now lets say we want to add foreign key on person_id too. This can be achieved as follows: - - -$definition = array('local' => 'person_id', - 'foreign' => 'id' - 'foreignTable' => 'people' - 'onDelete' => 'CASCADE')) - -$conn->export->createForeignKey('event_participants', $definition); - - -+++ Altering table - -Doctrine_Export drivers provide an easy database portable way of altering existing database tables. - -NOTE: if you only want to get the generated sql (and not execute it) use Doctrine_Export::alterTableSql() - - -$dbh = new PDO('dsn','username','pw'); -$conn = Doctrine_Manager::getInstance() - ->openConnection($dbh); - -$a = array('add' => array('name' => array('type' => 'string', 'length' => 255))); - - -$conn->export->alterTableSql('mytable', $a); - -// On mysql this method returns: -// ALTER TABLE mytable ADD COLUMN name VARCHAR(255) - - -Doctrine_Export::alterTable() takes two parameters: - -: string //$name// : name of the table that is intended to be changed. - -: array //$changes// : associative array that contains the details of each type of change that is intended to be performed. - -An optional third parameter (default: false) is accepted in alterTable and alterTableSql; it is named //$check// and it identifies if the DBMS driver can perform the requested table alterations if the value is true or actually perform them otherwise. - -The types of changes that are currently supported are defined as follows: - -* //name// -New name for the table. - -* //add// - -Associative array with the names of fields to be added as indexes of the array. The value of each entry of the array should be set to another associative array with the properties of the fields to be added. The properties of the fields should be the same as defined by the Doctrine parser. - -* //remove// - -Associative array with the names of fields to be removed as indexes of the array. Currently the values assigned to each entry are ignored. An empty array should be used for future compatibility. - -* //rename// - -Associative array with the names of fields to be renamed as indexes of the array. The value of each entry of the array should be set to another associative array with the entry named name with the new field name and the entry named Declaration that is expected to contain the portion of the field declaration already in DBMS specific SQL code as it is used in the CREATE TABLE statement. - -* //change// - -Associative array with the names of the fields to be changed as indexes of the array. Keep in mind that if it is intended to change either the name of a field and any other properties, the change array entries should have the new names of the fields as array indexes. - -The value of each entry of the array should be set to another associative array with the properties of the fields to that are meant to be changed as array entries. These entries should be assigned to the new values of the respective properties. The properties of the fields should be the same as defined by the Doctrine parser. - - -$a = array('name' => 'userlist', - 'add' => array( - 'quota' => array( - 'type' => 'integer', - 'unsigned' => 1 - ) - ), - 'remove' => array( - 'file_limit' => array(), - 'time_limit' => array() - ), - 'change' => array( - 'name' => array( - 'length' => '20', - 'definition' => array( - 'type' => 'string', - 'length' => 20 - ) - ) - ), - 'rename' => array( - 'sex' => array( - 'name' => 'gender', - 'definition' => array( - 'type' => 'string', - 'length' => 1, - 'default' => 'M' - ) - ) - ) - - ); - -$dbh = new PDO('dsn','username','pw'); -$conn = Doctrine_Manager::getInstance()->openConnection($dbh); - -$conn->export->alterTable('mytable', $a); - -+++ Creating indices -To create an index, the method createIndex() is used, which has similar signature as createConstraint(), so it takes table name, index name and a definition array. The definition array has one key fields with a value which is another associative array containing fields that will be a part of the index. The fields are defined as arrays with possible keys: - - -sorting, with values ascending and descending - -length, integer value - -Not all RDBMS will support index sorting or length, in these cases the drivers will ignore them. In the test events database, we can assume that our application will show events occuring in a specific timeframe, so the selects will use the datetime field in WHERE conditions. It will help if there is an index on this field. - - - -$definition = array( - 'fields' => array( - 'datetime' => array() - ) -); -$conn->export->createIndex('events', 'event_timestamp', $definition); - -+++ Deleting database elements -For every create*() method as shown above, there is a corresponding drop*() method to delete a database, a table, field, index or constraint. The drop*() methods do not check if the item to be deleted exists, so it's developer's responsibility to check for exceptions. - - -// drop a sequence -try { - $conn->export->dropSequence('nonexisting'); -} catch(Doctrine_Exception $e) { - -} -// another sequence -$result = $conn->export->dropSequence('people'); - -// drop a constraint -$conn->export->dropConstraint('events', 'PRIMARY', true); -// note: the third parameter gives a hint -// that this is a primary key constraint -$conn->export->dropConstraint('event_participants', 'unique_participant'); - -// drop an index -$conn->export->dropIndex('events', 'event_timestamp'); - -// drop a table -$conn->export->dropTable('events'); - -// drop the database already! -$conn->export->dropDatabase('events_db'); - - - - - - - - - -++ Import -+++ Introduction - -To see what's in the database, you can use the list*() family of functions in the Import module. - -* listDatabases() - -* listFunctions() - -* listSequences(): takes optional database name as a parameter. If not supplied, the currently selected database is assumed. - -* listTableConstraints(): takes a table name - -* listTableFields(): takes a table name - -* listTableIndexes(): takes a table name - -* listTables(): takes an optional database name - -* listTableTriggers(): takes a table name - -* listTableViews(): takes a table name - -* listUsers() - -* listViews(): takes an optional database name - - -+++ Listing databases - -$dbs = $conn->import->listDatabases(); -print_r($dbs); - -+++ Listing sequences - - -$seqs = $conn->import->listSequences('events_db'); -print_r($seqs); - - -+++ Listing constraints - - -$cons = $conn->import->listTableConstraints('event_participants'); - - -+++ Listing table fields - - -$fields = $conn->import->listTableFields('events'); -print_r($fields); -/* -prints: -Array -( - [0] => id - [1] => name - [2] => datetime -) -*/ - - -+++ Listing table indices - -$idx = $conn->import->listTableIndexes('events'); -print_r($idx); -/* -prints: -Array -( - [0] => event_timestamp -) -*/ - - -+++ Listing tables - - -$tables = $conn->import->listTables(); -print_r($tables); -/* -prints: -Array -( - [0] => event_participants - [1] => events - [2] => people -) -*/ - - -+++ Listing views - - -// currently there is no method to create a view, -// so let's do it "manually" -$sql = "CREATE VIEW names_only AS SELECT name FROM people"; -$conn->exec($sql); -$sql = "CREATE VIEW last_ten_events AS SELECT * FROM events ORDER BY id DESC LIMIT 0,10"; -$conn->exec($sql); -// list views -$views = $conn->import->listViews(); -print_r($views); -/* -prints: -Array -( - [0] => last_ten_events - [1] => names_only -) -*/ - - -++ DataDict -+++ Introduction -Doctrine uses DataDict module internally to convert native RDBMS types to Doctrine types and the reverse. DataDict module uses two methods for the conversions: -1. getPortableDeclaration(), which is used for converting native RDBMS type declaration to portable Doctrine declaration -2. getNativeDeclaration(), which is used for converting portable Doctrine declaration to driver specific type declaration - - -+++ Getting portable declaration - -$dbh = new PDO('mysql:host=localhost;dbname=test', 'username', 'pw'); -$conn = Doctrine_Manager::getInstance()->openConnection($dbh); - -$decl = $conn->dataDict->getPortableDeclaration('VARCHAR(255)'); - -print_r($decl); -/* -array('type' => 'string', - 'length' => 255, - 'fixed' => false, - 'unsigned' => false - ); -*/ - -+++ Getting native declaration - -$dbh = new PDO('mysql:host=localhost;dbname=test', 'username', 'pw'); -$conn = Doctrine_Manager::getInstance()->openConnection($dbh); - -$portableDecl = array('type' => 'string', - 'length' => 20, - 'fixed' => true); -$nativeDecl = $conn->dataDict->getNativeDeclaration($portableDecl); - -print $nativeDecl; // CHAR(20) - - -++ Drivers -+++ Mysql -++++ Setting table type - - -$dbh = new PDO('dsn','username','pw'); -$conn = Doctrine_Manager::getInstance()->openConnection($dbh); - -$fields = array('id' => array( - 'type' => 'integer', - 'autoincrement' => true), - 'name' => array( - 'type' => 'string', - 'fixed' => true, - 'length' => 8) - ); -// the following option is mysql specific and -// skipped by other drivers -$options = array('type' => 'MYISAM'); - -$conn->export->createTable('mytable', $fields); - -// on mysql this executes query: -// CREATE TABLE mytable (id INT AUTO_INCREMENT PRIMARY KEY, -// name CHAR(8)); - - diff --git a/manual/docs/en/dql-doctrine-query-language.txt b/manual/docs/en/dql-doctrine-query-language.txt deleted file mode 100644 index 6e02a860f..000000000 --- a/manual/docs/en/dql-doctrine-query-language.txt +++ /dev/null @@ -1,71 +0,0 @@ -++ Introduction -++ SELECT queries -++ UPDATE queries -++ DELETE queries -++ FROM clause -++ JOIN syntax -++ INDEXBY keyword -++ WHERE clause -++ Conditional expressions -++ Functional Expressions -++ Subqueries -++ GROUP BY, HAVING clauses -++ ORDER BY clause -++ LIMIT and OFFSET clauses -++ Examples -++ The Query Registry - -Doctrine_Query_Registry is a class for registering and naming queries. It helps with the organization of your applications queries and along with that it offers some very nice convenience stuff. - -The queries are added using the add() method of the registry object. It takes two parameters, the query name and the actual DQL query. - - -$r = Doctrine_Manager::getInstance()->getQueryRegistry(); - -$r->add('all-users', 'FROM User u'); - - -+++ Namespaces - -The Query registry supports namespaces. The namespace is separated from the actual name with / -mark. If the name of the namespace is a record name the given record has all the named queries available in its local scope. - - -$r = Doctrine_Manager::getInstance()->getQueryRegistry(); - -$r->add('User/all', 'FROM User u'); -$r->add('User/byName', 'FROM User u WHERE u.name = ?'); - -$user = new User(); - -// find the user named Jack Daniels -$user = $user->findOne('byName', array('Jack Daniels')); - -// find all users -$users = $user->find('all'); - - -++ BNF - -++ Magic Finders - -Doctrine offers some magic finders for your Doctrine models that allow you to find a record by any column that is present in the model. This is helpful for simply finding a user by their username, or finding a group by the name of it. Normally this would require writing a Doctrine_Query instance and storing this somewhere so it can be reused. That is no longer needed for simple situations like that. - -The basic pattern for the finder methods are as follows: findBy%s($value) or findOneBy%s($value). The %s can be a column name or a relation alias. If you give a column name you must give the value you are looking for. If you specify a relationship alias, you can either pass an instance of the relation class to find, or give the actual primary key value. - -Examples: - -// The normal find by primary key method -$userTable = Doctrine::getTable('User'); - -$user = $userTable->find(1); - -// Find one user by the username -$userTable = Doctrine::getTable('User'); - -$user = $userTable->findOneByUsername('jonwage'); - -// Find phonenumbers for the user above -$phoneTable = Doctrine::getTable('Phonenumber'); - -$phonenumbers = $phoneTable->findByUser($user); - \ No newline at end of file diff --git a/manual/docs/en/dql-doctrine-query-language/bnf.txt b/manual/docs/en/dql-doctrine-query-language/bnf.txt deleted file mode 100644 index 5ae00ed74..000000000 --- a/manual/docs/en/dql-doctrine-query-language/bnf.txt +++ /dev/null @@ -1,185 +0,0 @@ - -QL_statement ::= select_statement | update_statement | delete_statement -select_statement ::= select_clause from_clause [where_clause] [groupby_clause] -[having_clause] [orderby_clause] -update_statement ::= update_clause [where_clause] -delete_statement ::= delete_clause [where_clause] -from_clause ::= -FROM identification_variable_declaration -{, {identification_variable_declaration | collection_member_declaration}}* -identification_variable_declaration ::= range_variable_declaration { join | fetch_join }* -range_variable_declaration ::= abstract_schema_name [AS ] identification_variable -join ::= join_spec join_association_path_expression [AS ] identification_variable -fetch_join ::= join_specFETCH join_association_path_expression -association_path_expression ::= -collection_valued_path_expression | single_valued_association_path_expression -join_spec::= [LEFT [OUTER ] |INNER ]JOIN -join_association_path_expression ::= join_collection_valued_path_expression | -join_single_valued_association_path_expression -join_collection_valued_path_expression::= -identification_variable.collection_valued_association_field -join_single_valued_association_path_expression::= -identification_variable.single_valued_association_field -collection_member_declaration ::= -IN ( collection_valued_path_expression) [AS ] identification_variable -single_valued_path_expression ::= -state_field_path_expression | single_valued_association_path_expression -state_field_path_expression ::= -{identification_variable | single_valued_association_path_expression}.state_field -single_valued_association_path_expression ::= -identification_variable.{single_valued_association_field.}* single_valued_association_field -collection_valued_path_expression ::= -identification_variable.{single_valued_association_field.}*collection_valued_association_field -state_field ::= {embedded_class_state_field.}*simple_state_field -update_clause ::=UPDATE abstract_schema_name [[AS ] identification_variable] -SET update_item {, update_item}* -update_item ::= [identification_variable.]{state_field | single_valued_association_field} = -new_value -new_value ::= -simple_arithmetic_expression | -string_primary | -datetime_primary | - -boolean_primary | -enum_primary -simple_entity_expression | -NULL -delete_clause ::=DELETE FROM abstract_schema_name [[AS ] identification_variable] -select_clause ::=SELECT [DISTINCT ] select_expression {, select_expression}* -select_expression ::= -single_valued_path_expression | -aggregate_expression | -identification_variable | -OBJECT( identification_variable) | -constructor_expression -constructor_expression ::= -NEW constructor_name( constructor_item {, constructor_item}*) -constructor_item ::= single_valued_path_expression | aggregate_expression -aggregate_expression ::= -{AVG |MAX |MIN |SUM }( [DISTINCT ] state_field_path_expression) | -COUNT ( [DISTINCT ] identification_variable | state_field_path_expression | -single_valued_association_path_expression) -where_clause ::=WHERE conditional_expression -groupby_clause ::=GROUP BY groupby_item {, groupby_item}* -groupby_item ::= single_valued_path_expression | identification_variable -having_clause ::=HAVING conditional_expression -orderby_clause ::=ORDER BY orderby_item {, orderby_item}* -orderby_item ::= state_field_path_expression [ASC |DESC ] -subquery ::= simple_select_clause subquery_from_clause [where_clause] -[groupby_clause] [having_clause] -subquery_from_clause ::= -FROM subselect_identification_variable_declaration -{, subselect_identification_variable_declaration}* -subselect_identification_variable_declaration ::= -identification_variable_declaration | -association_path_expression [AS ] identification_variable | -collection_member_declaration -simple_select_clause ::=SELECT [DISTINCT ] simple_select_expression -simple_select_expression::= -single_valued_path_expression | -aggregate_expression | -identification_variable -conditional_expression ::= conditional_term | conditional_expressionOR conditional_term -conditional_term ::= conditional_factor | conditional_termAND conditional_factor -conditional_factor ::= [NOT ] conditional_primary -conditional_primary ::= simple_cond_expression |( conditional_expression) -simple_cond_expression ::= -comparison_expression | -between_expression | -like_expression | -in_expression | -null_comparison_expression | -empty_collection_comparison_expression | - -collection_member_expression | -exists_expression -between_expression ::= -arithmetic_expression [NOT ]BETWEEN -arithmetic_expressionAND arithmetic_expression | -string_expression [NOT ]BETWEEN string_expressionAND string_expression | -datetime_expression [NOT ]BETWEEN -datetime_expressionAND datetime_expression -in_expression ::= -state_field_path_expression [NOT ]IN ( in_item {, in_item}* | subquery) -in_item ::= literal | input_parameter -like_expression ::= -string_expression [NOT ]LIKE pattern_value [ESCAPE escape_character] -null_comparison_expression ::= -{single_valued_path_expression | input_parameter}IS [NOT ] NULL -empty_collection_comparison_expression ::= -collection_valued_path_expressionIS [NOT] EMPTY -collection_member_expression ::= entity_expression -[NOT ]MEMBER [OF ] collection_valued_path_expression -exists_expression::= [NOT ]EXISTS (subquery) -all_or_any_expression ::= {ALL |ANY |SOME } (subquery) -comparison_expression ::= -string_expression comparison_operator {string_expression | all_or_any_expression} | -boolean_expression {= |<> } {boolean_expression | all_or_any_expression} | -enum_expression {= |<> } {enum_expression | all_or_any_expression} | -datetime_expression comparison_operator -{datetime_expression | all_or_any_expression} | -entity_expression {= |<> } {entity_expression | all_or_any_expression} | -arithmetic_expression comparison_operator -{arithmetic_expression | all_or_any_expression} -comparison_operator ::== |> |>= |< |<= |<> -arithmetic_expression ::= simple_arithmetic_expression | (subquery) -simple_arithmetic_expression ::= -arithmetic_term | simple_arithmetic_expression {+ |- } arithmetic_term -arithmetic_term ::= arithmetic_factor | arithmetic_term {* |/ } arithmetic_factor -arithmetic_factor ::= [{+ |- }] arithmetic_primary -arithmetic_primary ::= -state_field_path_expression | -numeric_literal | -(simple_arithmetic_expression) | -input_parameter | -functions_returning_numerics | -aggregate_expression -string_expression ::= string_primary | (subquery) -string_primary ::= -state_field_path_expression | -string_literal | -input_parameter | -functions_returning_strings | -aggregate_expression - -datetime_expression ::= datetime_primary | (subquery) -datetime_primary ::= -state_field_path_expression | -input_parameter | -functions_returning_datetime | -aggregate_expression -boolean_expression ::= boolean_primary | (subquery) -boolean_primary ::= -state_field_path_expression | -boolean_literal | -input_parameter | -enum_expression ::= enum_primary | (subquery) -enum_primary ::= -state_field_path_expression | -enum_literal | -input_parameter | -entity_expression ::= -single_valued_association_path_expression | simple_entity_expression -simple_entity_expression ::= -identification_variable | -input_parameter -functions_returning_numerics::= -LENGTH( string_primary) | -LOCATE( string_primary, string_primary[, simple_arithmetic_expression]) | -ABS( simple_arithmetic_expression) | -SQRT( simple_arithmetic_expression) | -MOD( simple_arithmetic_expression, simple_arithmetic_expression) | -SIZE( collection_valued_path_expression) -functions_returning_datetime ::= - CURRENT_DATE | - CURRENT_TIME | - CURRENT_TIMESTAMP -functions_returning_strings ::= -CONCAT( string_primary, string_primary) | -SUBSTRING( string_primary, -simple_arithmetic_expression, simple_arithmetic_expression)| -TRIM( [[trim_specification] [trim_character]FROM ] string_primary) | -LOWER( string_primary) | -UPPER( string_primary) -trim_specification ::=LEADING | TRAILING | BOTH - diff --git a/manual/docs/en/dql-doctrine-query-language/conditional-expressions.txt b/manual/docs/en/dql-doctrine-query-language/conditional-expressions.txt deleted file mode 100644 index cf3f79cfd..000000000 --- a/manual/docs/en/dql-doctrine-query-language/conditional-expressions.txt +++ /dev/null @@ -1,241 +0,0 @@ -+++ Literals - -**Strings** - -A string literal is enclosed in single quotes; for example: 'literal'. A string literal that includes a single quote is represented by two single quotes; for example: 'literal''s'. - - -FROM User WHERE User.name = 'Vincent' - - -**Integers** - -Integer literals support the use of PHP integer literal syntax. - - -FROM User WHERE User.id = 4 - - -**Floats** - -Float literals support the use of PHP float literal syntax. - - -FROM Account WHERE Account.amount = 432.123 - - -**Booleans** - -The boolean literals are true and false. - - -FROM User WHERE User.admin = true - -FROM Session WHERE Session.is_authed = false - - -**Enums** - -The enumerated values work in the same way as string literals. - - -FROM User WHERE User.type = 'admin' - - -Predefined reserved literals are case insensitive, although its a good standard to write them in uppercase. - - -+++ Input parameters - - - -// POSITIONAL PARAMETERS: -$users = $conn->query("FROM User WHERE User.name = ?", array('Arnold')); - -$users = $conn->query("FROM User WHERE User.id > ? AND User.name LIKE ?", array(50, 'A%')); - - -// NAMED PARAMETERS: - -$users = $conn->query("FROM User WHERE User.name = :name", array(':name' => 'Arnold')); - -$users = $conn->query("FROM User WHERE User.id > :id AND User.name LIKE :name", array(':id' => 50, ':name' => 'A%')); - - - -+++ Operators and operator precedence - -The operators are listed below in order of decreasing precedence. - -||~ Operator ||~ Description || -|| . || Navigation operator || -|| || //Arithmetic operators: // || -|| +, - || unary || -|| *, / || multiplication and division || -|| +, - || addition and subtraction || -|| =, >, >=, <, <=, <> (not equal), || Comparison operators || -|| [NOT] LIKE, [NOT] IN, IS [NOT] NULL, IS [NOT] EMPTY || || -|| || //Logical operators: // || -|| NOT || || -|| AND || || -|| OR || || - - -+++ Between expressions - - -+++ In expressions - -Syntax: - - - IN (|) - - -An IN conditional expression returns true if the //operand// is found from result of the //subquery// or if its in the specificied comma separated //value list//, hence the IN expression is always false if the result of the subquery is empty. - -When //value list// is being used there must be at least one element in that list. - - -FROM C1 WHERE C1.col1 IN (FROM C2(col1)); - -FROM User WHERE User.id IN (1,3,4,5) - - -The keyword IN is an alias for = ANY. Thus, these two statements are equal: - - -FROM C1 WHERE C1.col1 = ANY (FROM C2(col1)); -FROM C1 WHERE C1.col1 IN (FROM C2(col1)); - - - -+++ Like Expressions - -Syntax: - - -string_expression [NOT] LIKE pattern_value [ESCAPE escape_character] - - -The string_expression must have a string value. The pattern_value is a string literal or a string-valued input parameter in which an underscore (_) stands for any single character, a percent (%) character stands for any sequence of characters (including the empty sequence), and all other characters stand for themselves. The optional escape_character is a single-character string literal or a character-valued input parameter (i.e., char or Character) and is used to escape the special meaning of the underscore and percent characters in pattern_value. - -Examples: - -* address.phone LIKE '12%3' is true for '123' '12993' and false for '1234' -* asentence.word LIKE 'l_se' is true for 'lose' and false for 'loose' -* aword.underscored LIKE '\_%' ESCAPE '\' is true for '_foo' and false for 'bar' -* address.phone NOT LIKE '12%3' is false for '123' and '12993' and true for '1234' - -If the value of the string_expression or pattern_value is NULL or unknown, the value of the LIKE expression is unknown. If the escape_characteris specified and is NULL, the value of the LIKE expression is unknown. - - - -// finding all users whose email ends with '@gmail.com' -$users = $conn->query("FROM User u, u.Email e WHERE e.address LIKE '%@gmail.com'"); - -// finding all users whose name starts with letter 'A' -$users = $conn->query("FROM User u WHERE u.name LIKE 'A%'"); - - - -+++ Null Comparison Expressions -+++ Empty Collection Comparison Expressions -+++ Collection Member Expressions - - -+++ Exists Expressions - -Syntax: - - - [NOT ]EXISTS () - -The EXISTS operator returns TRUE if the subquery returns one or more rows and FALSE otherwise. - -The NOT EXISTS operator returns TRUE if the subquery returns 0 rows and FALSE otherwise. - -Finding all articles which have readers: - - -FROM Article a - WHERE EXISTS (SELECT r.id FROM ReaderLog r - WHERE r.article_id = a.id) - - -Finding all articles which don't have readers: - - -FROM Article a - WHERE NOT EXISTS (SELECT r.id FROM ReaderLog r - WHERE r.article_id = a.id) - - - -+++ All and Any Expressions - -Syntax: - - -operand comparison_operator ANY (subquery) -operand comparison_operator SOME (subquery) -operand comparison_operator ALL (subquery) - - -An ALL conditional expression returns true if the comparison operation is true for all values in the result of the subquery or the result of the subquery is empty. An ALL conditional expression is false if the result of the comparison is false for at least one row, and is unknown if neither true nor false. - - -FROM C WHERE C.col1 < ALL (FROM C2(col1)) - - -An ANY conditional expression returns true if the comparison operation is true for some value in the result of the subquery. An ANY conditional expression is false if the result of the subquery is empty or if the comparison operation is false for every value in the result of the subquery, and is unknown if neither true nor false. - - -FROM C WHERE C.col1 > ANY (FROM C2(col1)) - - -The keyword SOME is an alias for ANY. - - -FROM C WHERE C.col1 > SOME (FROM C2(col1)) - - -The comparison operators that can be used with ALL or ANY conditional expressions are =, <, <=, >, >=, <>. The result of the subquery must be same type with the conditional expression. - -NOT IN is an alias for <> ALL. Thus, these two statements are equal: - - -FROM C WHERE C.col1 <> ALL (FROM C2(col1)); -FROM C WHERE C.col1 NOT IN (FROM C2(col1)); - - - -+++ Subqueries - -A subquery can contain any of the keywords or clauses that an ordinary SELECT query can contain. - -Some advantages of the subqueries: - -* They allow queries that are structured so that it is possible to isolate each part of a statement. -* They provide alternative ways to perform operations that would otherwise require complex joins and unions. -* They are, in many people's opinion, readable. Indeed, it was the innovation of subqueries that gave people the original idea of calling the early SQL "Structured Query Language." - - -// finding all users which don't belong to any group 1 -$query = "FROM User WHERE User.id NOT IN - (SELECT u.id FROM User u - INNER JOIN u.Group g WHERE g.id = ?)"; - -$users = $conn->query($query, array(1)); - -// finding all users which don't belong to any groups -// Notice: -// the usage of INNER JOIN -// the usage of empty brackets preceding the Group component - -$query = "FROM User WHERE User.id NOT IN - (SELECT u.id FROM User u - INNER JOIN u.Group g)"; - -$users = $conn->query($query); - diff --git a/manual/docs/en/dql-doctrine-query-language/delete-queries.txt b/manual/docs/en/dql-doctrine-query-language/delete-queries.txt deleted file mode 100644 index af74d9cab..000000000 --- a/manual/docs/en/dql-doctrine-query-language/delete-queries.txt +++ /dev/null @@ -1,28 +0,0 @@ - -DELETE FROM - [WHERE ] - [ORDER BY ...] - [LIMIT ] - - -* The {{DELETE}} statement deletes records from {{component_name}} and returns the number of records deleted. -* The optional {{WHERE}} clause specifies the conditions that identify which records to delete. Without {{WHERE}} clause, all records are deleted. -* If the {{ORDER BY}} clause is specified, the records are deleted in the order that is specified. -* The {{LIMIT}} clause places a limit on the number of rows that can be deleted. The statement will stop as soon as it has deleted {{record_count}} records. - - -$q = 'DELETE FROM Account WHERE id > ?'; - -$rows = $this->conn->query($q, array(3)); - -// the same query using the query interface - -$q = new Doctrine_Query(); - -$rows = $q->delete('Account') - ->from('Account a') - ->where('a.id > ?', 3) - ->execute(); - -print $rows; // the number of affected rows - diff --git a/manual/docs/en/dql-doctrine-query-language/examples.txt b/manual/docs/en/dql-doctrine-query-language/examples.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/docs/en/dql-doctrine-query-language/from-clause.txt b/manual/docs/en/dql-doctrine-query-language/from-clause.txt deleted file mode 100644 index eb039e54e..000000000 --- a/manual/docs/en/dql-doctrine-query-language/from-clause.txt +++ /dev/null @@ -1,22 +0,0 @@ -Syntax: - - -FROM [[LEFT | INNER] JOIN ] ... - - -The {{FROM}} clause indicates the component or components from which to retrieve records. If you name more than one component, you are performing a join. For each table specified, you can optionally specify an alias. - -Consider the following DQL query: - -FROM User u - - -Here 'User' is the name of the class (component) and 'u' is the alias. You should always use short aliases, since most of the time those make the query much shorther and also because when using for example caching the cached form of the query takes less space when short aliases are being used. - -The following example shows how to fetch all records from class 'User'. - - -$users = Doctrine_Query::create() - ->from('User u') - ->execute(); - diff --git a/manual/docs/en/dql-doctrine-query-language/functional-expressions.txt b/manual/docs/en/dql-doctrine-query-language/functional-expressions.txt deleted file mode 100644 index 8c3d99579..000000000 --- a/manual/docs/en/dql-doctrine-query-language/functional-expressions.txt +++ /dev/null @@ -1,73 +0,0 @@ -+++ String functions - -* The //CONCAT// function returns a string that is a concatenation of its arguments. In the example above we map the concatenation of users firstname and lastname to a value called name - - -$q = new Doctrine_Query(); - -$users = $q->select('CONCAT(u.firstname, u.lastname) name')->from('User u')->execute(); - -foreach($users as $user) { - // here 'name' is not a property of $user, - // its a mapped function value - print $user->name; -} - - -* The second and third arguments of the //SUBSTRING// function denote the starting position and length of the substring to be returned. These arguments are integers. The first position of a string is denoted by 1. The //SUBSTRING// function returns a string. - - -$q = new Doctrine_Query(); - -$users = $q->select('u.name')->from('User u')->where("SUBSTRING(u.name, 0, 1) = 'z'")->execute(); - -foreach($users as $user) { - print $user->name; -} - - -* The //TRIM// function trims the specified character from a string. If the character to be trimmed is not specified, it is assumed to be space (or blank). The optional trim_character is a single-character string literal or a character-valued input parameter (i.e., char or Character)[30]. If a trim specification is not provided, BOTH is assumed. The //TRIM// function returns the trimmed string. - - -$q = new Doctrine_Query(); - -$users = $q->select('u.name')->from('User u')->where("TRIM(u.name) = 'Someone'")->execute(); - -foreach($users as $user) { - print $user->name; -} - - -* The //LOWER// and //UPPER// functions convert a string to lower and upper case, respectively. They return a string. - - -$q = new Doctrine_Query(); - -$users = $q->select('u.name')->from('User u')->where("LOWER(u.name) = 'someone'")->execute(); - -foreach($users as $user) { - print $user->name; -} - - -* The //LOCATE// function returns the position of a given string within a string, starting the search at a specified position. It returns the first position at which the string was found as an integer. The first argument is the string to be located; the second argument is the string to be searched; the optional third argument is an integer that represents the string position at which the search is started (by default, the beginning of the string to be searched). The first position in a string is denoted by 1. If the string is not found, 0 is returned. -* The //LENGTH// function returns the length of the string in characters as an integer. - - -+++ Arithmetic functions - -Availible DQL arithmetic functions: - - -ABS(simple_arithmetic_expression) -SQRT(simple_arithmetic_expression) -MOD(simple_arithmetic_expression, simple_arithmetic_expression) - - -* The //ABS// function returns the absolute value for given number. - -* The //SQRT// function returns the square root for given number. - -* The //MOD// function returns the modulus of first argument using the second argument. - -+++ Datetime functions diff --git a/manual/docs/en/dql-doctrine-query-language/group-by-having-clauses.txt b/manual/docs/en/dql-doctrine-query-language/group-by-having-clauses.txt deleted file mode 100644 index 27dc89d18..000000000 --- a/manual/docs/en/dql-doctrine-query-language/group-by-having-clauses.txt +++ /dev/null @@ -1,48 +0,0 @@ -DQL GROUP BY syntax: - - -GROUP BY groupby_item {, groupby_item}* - - -DQL HAVING syntax: - - -HAVING conditional_expression - - -* GROUP BY and HAVING clauses can be used for dealing with aggregate functions -* Following aggregate functions are available on DQL: COUNT, MAX, MIN, AVG, SUM - -Selecting alphabetically first user by name. - - -SELECT MIN(u.name) FROM User u - - -Selecting the sum of all Account amounts. - - -SELECT SUM(a.amount) FROM Account a - - -* Using an aggregate function in a statement containing no GROUP BY clause, results in grouping on all rows. In the example above we fetch all users and the number of phonenumbers they have. - - -SELECT u.*, COUNT(p.id) FROM User u, u.Phonenumber p GROUP BY u.id - - -* The HAVING clause can be used for narrowing the results using aggregate values. In the following example we fetch all users which have atleast 2 phonenumbers - - -SELECT u.* FROM User u, u.Phonenumber p HAVING COUNT(p.id) >= 2 - - - -// retrieve all users and the phonenumber count for each user - -$users = $conn->query("SELECT u.*, COUNT(p.id) count FROM User u, u.Phonenumber p GROUP BY u.id"); - -foreach($users as $user) { - print $user->name . ' has ' . $user->Phonenumber[0]->count . ' phonenumbers'; -} - diff --git a/manual/docs/en/dql-doctrine-query-language/indexby-keyword.txt b/manual/docs/en/dql-doctrine-query-language/indexby-keyword.txt deleted file mode 100644 index 7f65b3acb..000000000 --- a/manual/docs/en/dql-doctrine-query-language/indexby-keyword.txt +++ /dev/null @@ -1,30 +0,0 @@ -The INDEXBY keyword offers a way of mapping certain columns as collection / array keys. By default Doctrine indexes multiple elements to numerically indexed arrays / collections. The mapping starts from zero. In order to override this behaviour you need to use INDEXBY keyword as shown above: - - -$q = new Doctrine_Query(); -$q->from('User u INDEXBY u.name'); - -$users = $q->execute(); - - -Now the users in $users collection are accessible through their names. - - -print $user['jack daniels']->id; - - -The INDEXBY keyword can be applied to any given JOIN. This means that any given component can have each own indexing behaviour. In the following we use distinct indexing for both Users and Groups. - - - -$q = new Doctrine_Query(); -$q->from('User u INDEXBY u.name')->innerJoin('u.Group g INDEXBY g.name'); - -$users = $q->execute(); - - -Now lets print out the drinkers club's creation date. - - -print $users['jack daniels']->Group['drinkers club']->createdAt; - diff --git a/manual/docs/en/dql-doctrine-query-language/introduction.txt b/manual/docs/en/dql-doctrine-query-language/introduction.txt deleted file mode 100644 index 52f693cb8..000000000 --- a/manual/docs/en/dql-doctrine-query-language/introduction.txt +++ /dev/null @@ -1,45 +0,0 @@ -Doctrine Query Language (DQL) is an Object Query Language created for helping users in complex object retrieval. You should always consider using DQL (or raw SQL) when retrieving relational data efficiently (eg. when fetching users and their phonenumbers). - -When compared to using raw SQL, DQL has several benefits: - -* From the start it has been designed to retrieve records(objects) not result set rows -* DQL understands relations so you don't have to type manually sql joins and join conditions -* DQL is portable on different databases -* DQL has some very complex built-in algorithms like (the record limit algorithm) which can help developer to efficiently retrieve objects -* It supports some functions that can save time when dealing with one-to-many, many-to-many relational data with conditional fetching. - -If the power of DQL isn't enough, you should consider using the rawSql API for object population. - -You may already be familiar with the following syntax: - -// DO NOT USE THE FOLLOWING CODE -// (uses many sql queries for object population) - -$users = $conn->getTable('User')->findAll(); - -foreach($users as $user) { - print $user->name . ' has phonenumbers: '; - - foreach($user->Phonenumber as $phonenumber) { - print $phonenumber . ' '; - } -} - - -However you should not use it. Below is the same behaviour implemented much more efficiently: - - -// same thing implemented much more efficiently: -// (using only one sql query for object population) - -$users = $conn->query('FROM User u LEFT JOIN u.Phonenumber p'); - -foreach($users as $user) { - print $user->name . ' has phonenumbers: '; - - foreach($user->Phonenumber as $phonenumber) { - print $phonenumber . ' '; - } -} - - diff --git a/manual/docs/en/dql-doctrine-query-language/join-syntax.txt b/manual/docs/en/dql-doctrine-query-language/join-syntax.txt deleted file mode 100644 index 98e6e8a76..000000000 --- a/manual/docs/en/dql-doctrine-query-language/join-syntax.txt +++ /dev/null @@ -1,77 +0,0 @@ -DQL JOIN Syntax: - - -[[LEFT | INNER] JOIN ] [ON | WITH] [INDEXBY] , -[[LEFT | INNER] JOIN ] [ON | WITH] [INDEXBY] , -... -[[LEFT | INNER] JOIN ] [ON | WITH] [INDEXBY] - - -DQL supports two kinds of joins INNER JOINs and LEFT JOINs. For each joined component, you can optionally specify an alias. - -* The default join type is {{LEFT JOIN}}. This join can be indicated by the use of either {{LEFT JOIN}} clause or simply '{{,}}', hence the following queries are equal: - - -SELECT u.*, p.* FROM User u LEFT JOIN u.Phonenumber - -SELECT u.*, p.* FROM User u, u.Phonenumber p - - -The recommended form is the first one. - -* {{INNER JOIN}} produces an intersection between two specified components (that is, each and every record in the first component is joined to each and every record in the second component). So basically {{INNER JOIN}} can be used when you want to efficiently fetch for example all users which have one or more phonenumbers. - - -SELECT u.*, p.* FROM User u INNER JOIN u.Phonenumber p - - -By default DQL auto-adds the primary key join condition, so for DQL query: - - -SELECT u.id, p.id FROM User u LEFT JOIN u.Phonenumber - - -Would have a SQL equivalent: - - -SELECT u.id AS u__id, p.id AS p__id FROM User u LEFT JOIN Phonenumber p ON u.id = p.user_id - - -+++ ON keyword -If you want to override this behaviour and add your own custom join condition you can do it with the {{ON}} keyword. Consider the following DQL query: - - -SELECT u.id, p.id FROM User u LEFT JOIN u.Phonenumber ON u.id = 2 - - -This query would be converted into SQL: - - -SELECT u.id AS u__id, p.id AS p__id FROM User u LEFT JOIN Phonenumber p ON u.id = 2 - - -+++ WITH keyword -Most of the time you don't need to override the primary join condition, rather you may want to add some custom conditions. This can be achieved with the {{WITH}} keyword. - -DQL: - -SELECT u.id, p.id FROM User u LEFT JOIN u.Phonenumber WITH u.id = 2 - - -SQL: - -SELECT u.id AS u__id, p.id AS p__id FROM User u LEFT JOIN Phonenumber p ON u.id = p.user_id AND u.id = 2 - - - -The Doctrine_Query API offers two convenience methods for adding JOINS. These are called innerJoin() and leftJoin(), which usage should be quite intuitive as shown below: - - -$q = new Doctrine_Query(); -$q->from('User u') - ->leftJoin('u.Group g') - ->innerJoin('u.Phonenumber p WITH u.id > 3') - ->leftJoin('u.Email e'); - -$users = $q->execute(); - diff --git a/manual/docs/en/dql-doctrine-query-language/limit-and-offset-clauses.txt b/manual/docs/en/dql-doctrine-query-language/limit-and-offset-clauses.txt deleted file mode 100644 index 97f60d432..000000000 --- a/manual/docs/en/dql-doctrine-query-language/limit-and-offset-clauses.txt +++ /dev/null @@ -1,90 +0,0 @@ -Propably the most complex feature DQL parser has to offer is its LIMIT clause parser. Not only does the DQL LIMIT clause parser take care of LIMIT database portability it is capable of limiting the number of records instead of rows by using complex query analysis and subqueries. - - -// retrieve the first 20 users and all their associated phonenumbers - -$users = $conn->query("SELECT u.*, p.* FROM User u, u.Phonenumber p LIMIT 20"); - -foreach($users as $user) { - print ' --- '.$user->name.' --- \n'; - - foreach($user->Phonenumber as $p) { - print $p->phonenumber.'\n'; - } -} - - -+++ Driver portability - -DQL LIMIT clause is portable on all supported databases. Special attention have been paid to following facts: - -* Only Mysql, Pgsql and Sqlite implement LIMIT / OFFSET clauses natively -* In Oracle / Mssql / Firebird LIMIT / OFFSET clauses need to be emulated in driver specific way -* The limit-subquery-algorithm needs to execute to subquery separately in mysql, since mysql doesn't yet support LIMIT clause in subqueries -* Pgsql needs the order by fields to be preserved in SELECT clause, hence limit-subquery-algorithm needs to take this into consideration when pgsql driver is used -* Oracle only allows < 30 object identifiers (= table/column names/aliases), hence the limit subquery must use as short aliases as possible and it must avoid alias collisions with the main query. - -+++ The limit-subquery-algorithm - -The limit-subquery-algorithm is an algorithm that DQL parser uses internally when one-to-many / many-to-many relational data is being fetched simultaneously. This kind of special algorithm is needed for the LIMIT clause to limit the number of records instead of sql result set rows. - -This behaviour can be overwritten using the configuration system (at global, connection or table level) using: - -$table->setAttribute(Doctrine::ATTR_QUERY_LIMIT, Doctrine::LIMIT_ROWS); -$table->setAttribute(Doctrine::ATTR_QUERY_LIMIT, Doctrine::LIMIT_RECORDS); // revert - - -In the following example we have users and phonenumbers with their relation being one-to-many. Now lets say we want fetch the first 20 users and all their related phonenumbers. - -Now one might consider that adding a simple driver specific LIMIT 20 at the end of query would return the correct results. Thats wrong, since we you might get anything between 1-20 users as the first user might have 20 phonenumbers and then record set would consist of 20 rows. - -DQL overcomes this problem with subqueries and with complex but efficient subquery analysis. In the next example we are going to fetch first 20 users and all their phonenumbers with single efficient query. Notice how the DQL parser is smart enough to use column aggregation inheritance even in the subquery and how it's smart enough to use different aliases for the tables in the subquery to avoid alias collisions. - -DQL QUERY: - - -SELECT u.id, u.name, p.* FROM User u LEFT JOIN u.Phonenumber p LIMIT 20 - - -SQL QUERY: - - -SELECT - e.id AS e__id, - e.name AS e__name, - p.id AS p__id, - p.phonenumber AS p__phonenumber, - p.entity_id AS p__entity_id -FROM entity e -LEFT JOIN phonenumber p ON e.id = p.entity_id -WHERE e.id IN ( -SELECT DISTINCT e2.id -FROM entity e2 -WHERE (e2.type = 0) LIMIT 20) AND (e.type = 0) - - -In the next example we are going to fetch first 20 users and all their phonenumbers and only those users that actually have phonenumbers with single efficient query, hence we use an INNER JOIN. Notice how the DQL parser is smart enough to use the INNER JOIN in the subquery. - -DQL QUERY: - - -SELECT u.id, u.name, p.* FROM User u LEFT JOIN u.Phonenumber p LIMIT 20 - - -SQL QUERY: - - -SELECT - e.id AS e__id, - e.name AS e__name, - p.id AS p__id, - p.phonenumber AS p__phonenumber, - p.entity_id AS p__entity_id -FROM entity e -LEFT JOIN phonenumber p ON e.id = p.entity_id -WHERE e.id IN ( -SELECT DISTINCT e2.id -FROM entity e2 -INNER JOIN phonenumber p2 ON e2.id = p2.entity_id -WHERE (e2.type = 0) LIMIT 20) AND (e.type = 0) - diff --git a/manual/docs/en/dql-doctrine-query-language/order-by-clause.txt b/manual/docs/en/dql-doctrine-query-language/order-by-clause.txt deleted file mode 100644 index 118e3bdcd..000000000 --- a/manual/docs/en/dql-doctrine-query-language/order-by-clause.txt +++ /dev/null @@ -1,58 +0,0 @@ -+++ Introduction - -Record collections can be sorted efficiently at the database level using the ORDER BY clause. - -Syntax: - - - [ORDER BY {ComponentAlias.columnName} - [ASC | DESC], ...] - - -Examples: - - -FROM User u LEFT JOIN u.Phonenumber p - ORDER BY u.name, p.phonenumber - -FROM User u, u.Email e - ORDER BY e.address, u.id - - -In order to sort in reverse order you can add the DESC (descending) keyword to the name of the column in the ORDER BY clause that you are sorting by. The default is ascending order; this can be specified explicitly using the ASC keyword. - - -FROM User u LEFT JOIN u.Email e - ORDER BY e.address DESC, u.id ASC; - - - -+++ Sorting by an aggregate value - -In the following example we fetch all users and sort those users by the number of phonenumbers they have. - - -$q = new Doctrine_Query(); - -$users = $q->select('u.*, COUNT(p.id) count') - ->from('User u') - ->innerJoin('u.Phonenumber p') - ->orderby('count'); - - -+++ Using random order - -In the following example we use random in the ORDER BY clause in order to fetch random post. - - -$q = new Doctrine_Query(); - -$posts = $q->select('p.*, RANDOM() rand') - ->from('Post p') - ->orderby('rand') - ->limit(1) - ->execute(); - -$randomPost = $posts[0]; - - diff --git a/manual/docs/en/dql-doctrine-query-language/select-queries.txt b/manual/docs/en/dql-doctrine-query-language/select-queries.txt deleted file mode 100644 index 87263505a..000000000 --- a/manual/docs/en/dql-doctrine-query-language/select-queries.txt +++ /dev/null @@ -1,86 +0,0 @@ -{{SELECT}} statement syntax: - - -SELECT - [ALL | DISTINCT] - , ... - [FROM - [WHERE ] - [GROUP BY - [ASC | DESC], ... ] - [HAVING ] - [ORDER BY - [ASC | DESC], ...] - [LIMIT OFFSET }] - - -The {{SELECT}} statement is used for the retrieval of data from one or more components. - -* Each {{select_expr}} indicates a column or an aggregate function value that you want to retrieve. There must be at least one {{select_expr}} in every {{SELECT}} statement. - - -SELECT a.name, a.amount FROM Account a - - -* An asterisk can be used for selecting all columns from given component. Even when using an asterisk the executed sql queries never actually use it (Doctrine converts asterisk to appropriate column names, hence leading to better performance on some databases). - - -SELECT a.* FROM Account a - - -* {{FROM}} clause {{components}} indicates the component or components from which to retrieve records. - - -SELECT a.* FROM Account a - -SELECT u.*, p.*, g.* FROM User u LEFT JOIN u.Phonenumber p LEFT JOIN u.Group g - - -* The {{WHERE}} clause, if given, indicates the condition or conditions that the records must satisfy to be selected. {{where_condition}} is an expression that evaluates to true for each row to be selected. The statement selects all rows if there is no {{WHERE}} clause. - - -SELECT a.* FROM Account a WHERE a.amount > 2000 - - -* In the {{WHERE}} clause, you can use any of the functions and operators that DQL supports, except for aggregate (summary) functions -* The {{HAVING}} clause can be used for narrowing the results with aggregate functions - - -SELECT u.* FROM User u LEFT JOIN u.Phonenumber p HAVING COUNT(p.id) > 3 - - -* The {{ORDER BY}} clause can be used for sorting the results - - -SELECT u.* FROM User u ORDER BY u.name - - -* The {{LIMIT}} and {{OFFSET}} clauses can be used for efficiently limiting the number of records to a given {{row_count}} - - -SELECT u.* FROM User u LIMIT 20 - - - -+++ DISTINCT keyword - - -+++ Aggregate values - -Aggregate value {{SELECT}} syntax: - - -// SELECT u.*, COUNT(p.id) num_posts FROM User u, u.Posts p WHERE u.id = 1 GROUP BY u.id - -$query = new Doctrine_Query(); - -$query->select('u.*, COUNT(p.id) num_posts') - ->from('User u, u.Posts p') - ->where('u.id = ?', 1) - ->groupby('u.id'); - -$users = $query->execute(); - -echo $users->Posts[0]->num_posts . ' posts found'; - - diff --git a/manual/docs/en/dql-doctrine-query-language/subqueries.txt b/manual/docs/en/dql-doctrine-query-language/subqueries.txt deleted file mode 100644 index 4bb2d4b5b..000000000 --- a/manual/docs/en/dql-doctrine-query-language/subqueries.txt +++ /dev/null @@ -1,8 +0,0 @@ -+++ Introduction -+++ Comparisons using subqueries -+++ Conditional expressions -++++ ANY, IN and SOME -++++ ALL -++++ EXISTS and NOT EXISTS -+++ Correlated subqueries -+++ Subqueries in FROM clause diff --git a/manual/docs/en/dql-doctrine-query-language/update-queries.txt b/manual/docs/en/dql-doctrine-query-language/update-queries.txt deleted file mode 100644 index 29cbfa165..000000000 --- a/manual/docs/en/dql-doctrine-query-language/update-queries.txt +++ /dev/null @@ -1,34 +0,0 @@ -{{UPDATE}} statement syntax: - - -UPDATE //component_name// - SET //col_name1//=//expr1// [, //col_name2//=//expr2// ...] - [WHERE //where_condition//] - [ORDER BY ...] - [LIMIT //record_count//] - - -* The {{UPDATE}} statement updates columns of existing records in {{component_name}} with new values and returns the number of affected records. -* The {{SET}} clause indicates which columns to modify and the values they should be given. -* The optional {{WHERE}} clause specifies the conditions that identify which records to update. Without {{WHERE}} clause, all records are updated. -* The optional {{ORDER BY}} clause specifies the order in which the records are being updated. -* The {{LIMIT}} clause places a limit on the number of records that can be updated. You can use {{LIMIT row_count}} to restrict the scope of the {{UPDATE}}. -A {{LIMIT}} clause is a **rows-matched restriction** not a rows-changed restriction. -The statement stops as soon as it has found {{record_count}} rows that satisfy the {{WHERE}} clause, whether or not they actually were changed. - - -$q = 'UPDATE Account SET amount = amount + 200 WHERE id > 200'; - -$rows = $this->conn->query($q); - -// the same query using the query interface - -$q = new Doctrine_Query(); - -$rows = $q->update('Account') - ->set('amount', 'amount + 200') - ->where('id > 200') - ->execute(); - -print $rows; // the number of affected rows - diff --git a/manual/docs/en/dql-doctrine-query-language/where-clause.txt b/manual/docs/en/dql-doctrine-query-language/where-clause.txt deleted file mode 100644 index 9ffab2761..000000000 --- a/manual/docs/en/dql-doctrine-query-language/where-clause.txt +++ /dev/null @@ -1,10 +0,0 @@ -Syntax: - - -WHERE - - -* The {{WHERE}} clause, if given, indicates the condition or conditions that the records must satisfy to be selected. -* {{where_condition}} is an expression that evaluates to true for each row to be selected. -* The statement selects all rows if there is no {{WHERE}} clause. -* When narrowing results with aggregate function values {{HAVING}} clause should be used instead of {{WHERE}} clause diff --git a/manual/docs/en/event-listeners.txt b/manual/docs/en/event-listeners.txt deleted file mode 100644 index c7050b690..000000000 --- a/manual/docs/en/event-listeners.txt +++ /dev/null @@ -1,427 +0,0 @@ -++ Introduction - -Doctrine provides flexible event listener architecture that not only allows listening for different events but also for altering the execution of the listened methods. - -There are several different listeners and hooks for various Doctrine components. Listeners are separate classes whereas hooks are empty template methods within the listened class. - -Hooks are simpler than eventlisteners but they lack the separation of different aspects. An example of using Doctrine_Record hooks: - - -class Blog extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 200); - $this->hasColumn('content', 'string'); - $this->hasColumn('created', 'date'); - } - public function preInsert($event) - { - $this->created = date('Y-m-d', time()); - } -} - -// initialize connection etc, then: - -$blog = new Blog(); -$blog->title = 'New title'; -$blog->content = 'Some content'; -$blog->save(); - -$blog->created; // 2007-06-20 (format: YYYY-MM-DD) - - -Each listener and hook method takes one parameter Doctrine_Event object. Doctrine_Event object holds information about the event in question and can alter the execution of the listened method. - -For the purposes of this documentation many method tables are provided with column named 'params' indicating names of the parameters that an event object holds on given event. For example the preCreateSavepoint event has one parameter the name of the created savepoint, which is quite intuitively named as savepoint. - -++ Connection listeners - -Connection listeners are used for listening the methods of Doctrine_Connection and its modules (such as Doctrine_Transaction). All listener methods take one argument Doctrine_Event which holds information about the listened event. - -+++ Creating a new listener -There are three different ways of defining a listener. First you can create a listener by making a class that inherits Doctrine_EventListener: - - -class MyListener extends Doctrine_EventListener -{ - public function preExec(Doctrine_Event $event) - { - - } -} - - -Note that by declaring a class that extends Doctrine_EventListener you don't have to define all the methods within the Doctrine_EventListener_Interface. This is due to a fact that Doctrine_EventListener already has empty skeletons for all these methods. - -Sometimes it may not be possible to define a listener that extends Doctrine_EventListener (you might have a listener that inherits some other base class). In this case you can make it implement Doctrine_EventListener_Interface. - - -class MyListener implements Doctrine_EventListener_Interface -{ - // notice: all listener methods must be defined here - // (otherwise PHP throws fatal error) - - public function preExec(Doctrine_Event $event) - { } - public function postExec(Doctrine_Event $event) - { } - - // ... -} - - -The third way of creating a listener is a very elegant one. You can make a class that implements Doctrine_Overloadable. This interface has only one method: __call(), which can be used for catching *all* the events. - - -class MyDebugger implements Doctrine_Overloadable -{ - public function __call($methodName, $args) - { - print $methodName . ' called !'; - } -} - - -+++ Attaching listeners - -You can attach the listeners to a connection with setListener(). - - -$conn->setListener(new MyDebugger()); - - -If you need to use multiple listeners you can use addListener(). - - -$conn->addListener(new MyDebugger()); -$conn->addListener(new MyLogger()); - - -+++ preConnect, postConnect - -+++ Transaction listeners -||~ Methods ||~ Listens ||~ Params || -|| preTransactionBegin(Doctrine_Event $event) || Doctrine_Transaction::beginTransaction() || || -|| postTransactionBegin(Doctrine_Event $event) || Doctrine_Transaction::beginTransaction() || || -|| preTransactionRollback(Doctrine_Event $event) || Doctrine_Transaction::rollback() || || -|| postTransactionRollback(Doctrine_Event $event) || Doctrine_Transaction::rollback() || || -|| preTransactionCommit(Doctrine_Event $event) || Doctrine_Transaction::commit() || || -|| postTransactionCommit(Doctrine_Event $event) || Doctrine_Transaction::commit() || || -|| preCreateSavepoint(Doctrine_Event $event) || Doctrine_Transaction::createSavepoint() || savepoint || -|| postCreateSavepoint(Doctrine_Event $event) || Doctrine_Transaction::createSavepoint() || savepoint || -|| preRollbackSavepoint(Doctrine_Event $event) || Doctrine_Transaction::rollbackSavepoint() || savepoint || -|| postRollbackSavepoint(Doctrine_Event $event) || Doctrine_Transaction::rollbackSavepoint() || savepoint || -|| preReleaseSavepoint(Doctrine_Event $event) || Doctrine_Transaction::releaseSavepoint() || savepoint || -|| postReleaseSavepoint(Doctrine_Event $event) || Doctrine_Transaction::releaseSavepoint() || savepoint || - - -class MyTransactionListener extends Doctrine_EventListener -{ - public function preTransactionBegin(Doctrine_Event $event) - { - print 'beginning transaction... '; - } - - public function preTransactionRollback(Doctrine_Event $event) - { - print 'rolling back transaction... '; - } -} - - - -+++ Query execution listeners - -||~ Methods ||~ Listens ||~ Params || -|| prePrepare(Doctrine_Event $event) || Doctrine_Connection::prepare() || query || -|| postPrepare(Doctrine_Event $event) || Doctrine_Connection::prepare() || query || -|| preExec(Doctrine_Event $event) || Doctrine_Connection::exec() || query || -|| postExec(Doctrine_Event $event) || Doctrine_Connection::exec() || query, rows || -|| preStmtExecute(Doctrine_Event $event) || Doctrine_Connection_Statement::execute() || query || -|| postStmtExecute(Doctrine_Event $event) || Doctrine_Connection_Statement::execute() || query || -|| preExecute(Doctrine_Event $event) || Doctrine_Connection::execute() * || query || -|| postExecute(Doctrine_Event $event) || Doctrine_Connection::execute() * || query || -|| preFetch(Doctrine_Event $event) || Doctrine_Connection::fetch() || query, data || -|| postFetch(Doctrine_Event $event) || Doctrine_Connection::fetch() || query, data || -|| preFetchAll(Doctrine_Event $event) || Doctrine_Connection::fetchAll() || query, data || -|| postFetchAll(Doctrine_Event $event) || Doctrine_Connection::fetchAll() || query, data || - -* preExecute() and postExecute() only get invoked when Doctrine_Connection::execute() is being called without prepared statement parameters. Otherwise Doctrine_Connection::execute() invokes prePrepare, postPrepare, preStmtExecute and postStmtExecute. - - - -++ Query listeners - -The query listeners can be used for listening the DQL query building and resultset hydration procedures. Couple of methods exist for listening the hydration procedure: preHydrate and postHydrate. - -If you set the hydration listener on connection level the code within the preHydrate and postHydrate blocks will be invoked by all components within a multi-component resultset. However if you add a similar listener on table level it only gets invoked when the data of that table is being hydrated. - -Consider we have a class called User with the following fields: firstname, lastname and age. In the following example we create a listener that always builds a generated field called fullname based on firstname and lastname fields. - - -class HydrationListener extends Doctrine_Record_Listener -{ - public function preHydrate(Doctrine_Event $event) - { - $data = $event->data; - - $data['fullname'] = $data['firstname'] . ' ' . $data['lastname']; - $event->data = $data; - } -} - - -Now all we need to do is attach this listener to the User record and fetch some users. - - -$user = new User(); -$user->addListener(new HydrationListener()); - -$users = Doctrine_Query::create()->from('User'); - -foreach ($users as $user) { - print $user->fullname; -} - - -++ Record listeners - -Doctrine_Record provides listeners very similar to Doctrine_Connection. You can set the listeners at global, connection and record(=table) level. - -Here is a list of all available listener methods: - -||~ Methods ||~ Listens || -|| preSave(Doctrine_Event $event) || Doctrine_Record::save() || -|| postSave(Doctrine_Event $event) || Doctrine_Record::save() || -|| preUpdate(Doctrine_Event $event) || Doctrine_Record::save() when the record state is DIRTY || -|| postUpdate(Doctrine_Event $event) || Doctrine_Record::save() when the record state is DIRTY || -|| preInsert(Doctrine_Event $event) || Doctrine_Record::save() when the record state is TDIRTY || -|| postInsert(Doctrine_Event $event) || Doctrine_Record::save() when the record state is TDIRTY || -|| preDelete(Doctrine_Event $event) || Doctrine_Record::delete() || -|| postDelete(Doctrine_Event $event) || Doctrine_Record::delete() || -|| preValidate(Doctrine_Event $event) || Doctrine_Validator::validate() || -|| postValidate(Doctrine_Event $event) || Doctrine_Validator::validate() || - -Just like with connection listeners there are three ways of defining a record listener: by extending Doctrine_Record_Listener, by implement Doctrine_Record_Listener_Interface or by implementing Doctrine_Overloadable. In the following we'll create a global level listener by implementing Doctrine_Overloadable: - -class Logger extends Doctrine_Overloadable -{ - public function __call($m, $a) - { - print 'catched event ' . $m; - - // do some logging here... - } -} - - -Attaching the listener to manager is easy: - - -$manager->addRecordListener(new Logger()); - - -Note that by adding a manager level listener it affects on all connections and all tables / records within these connections. In the following we create a connection level listener: - - -class Debugger extends Doctrine_Record_Listener -{ - public function preInsert(Doctrine_Event $event) - { - print 'inserting a record ...'; - } - public function preUpdate(Doctrine_Event $event) - { - print 'updating a record...'; - } -} - - -Attaching the listener to a connection is as easy as: - - -$conn->addRecordListener(new Debugger()); - - -Many times you want the listeners to be table specific so that they only apply on the actions on that given table. Here is an example: - - -class Debugger extends Doctrine_Record_Listener -{ - public function postDelete(Doctrine_Event $event) - { - print 'deleted ' . $event->getInvoker()->id; - } -} - - -Attaching this listener to given table can be done as follows: - - -class MyRecord extends Doctrine_Record -{ - public function setTableDefinition() - { - // some definitions - } - - public function setUp() - { - $this->addListener(new Debugger()); - } -} - - - - -++ Record hooks -||~ Methods ||~ Listens || -|| preSave($event) || Doctrine_Record::save() || -|| postSave($event) || Doctrine_Record::save() || -|| preUpdate($event) || Doctrine_Record::save() when the record state is DIRTY || -|| postUpdate($event) || Doctrine_Record::save() when the record state is DIRTY || -|| preInsert($event) || Doctrine_Record::save() when the record state is TDIRTY || -|| postInsert($event) || Doctrine_Record::save() when the record state is TDIRTY || -|| preDelete($event) || Doctrine_Record::delete() || -|| postDelete($event) || Doctrine_Record::delete() || -|| preValidate($event) || Doctrine_Validator::validate() || -|| postValidate($event) || Doctrine_Validator::validate() || - -Example 1. Using insert and update hooks - -class Blog extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 200); - $this->hasColumn('content', 'string'); - $this->hasColumn('created', 'date'); - $this->hasColumn('updated', 'date'); - } - public function preInsert($event) - { - $this->created = date('Y-m-d', time()); - } - public function preUpdate($event) - { - $this->updated = date('Y-m-d', time()); - } -} - - -++ Chaining listeners - -Doctrine allows chaining of different eventlisteners. This means that more than one listener can be attached for listening the same events. The following example attaches two listeners for given connection: - - -// here Debugger and Logger both inherit Doctrine_EventListener - -$conn->addListener(new Debugger()); -$conn->addListener(new Logger()); - - -++ The Event object -+++ Getting the invoker -You can get the object that invoked the event by calling getInvoker(): - -class MyListener extends Doctrine_EventListener -{ - public function preExec(Doctrine_Event $event) - { - $event->getInvoker(); // Doctrine_Connection - } -} - -+++ Event codes - -Doctrine_Event uses constants as event codes. Above is the list of all available event constants: - -* Doctrine_Event::CONN_QUERY -* Doctrine_Event::CONN_EXEC -* Doctrine_Event::CONN_PREPARE -* Doctrine_Event::CONN_CONNECT -* Doctrine_Event::STMT_EXECUTE -* Doctrine_Event::STMT_FETCH -* Doctrine_Event::STMT_FETCHALL - - -class MyListener extends Doctrine_EventListener -{ - public function preExec(Doctrine_Event $event) - { - $event->getCode(); // Doctrine_Event::CONN_EXEC - } -} - - -* Doctrine_Event::TX_BEGIN -* Doctrine_Event::TX_COMMIT -* Doctrine_Event::TX_ROLLBACK -* Doctrine_Event::SAVEPOINT_CREATE -* Doctrine_Event::SAVEPOINT_ROLLBACK -* Doctrine_Event::SAVEPOINT_COMMIT -* Doctrine_Event::RECORD_DELETE -* Doctrine_Event::RECORD_SAVE -* Doctrine_Event::RECORD_UPDATE -* Doctrine_Event::RECORD_INSERT -* Doctrine_Event::RECORD_SERIALIZE -* Doctrine_Event::RECORD_UNSERIALIZE - - -class MyRecord extends Doctrine_Record -{ - public function preUpdate(Doctrine_Event $event) - { - $event->getCode(); // Doctrine_Event::RECORD_UPDATE - } -} - -+++ getInvoker() - -The method getInvoker() returns the object that invoked the given event. For example for event Doctrine_Event::CONN_QUERY the invoker is a Doctrine_Connection object. Example: - - -class MyRecord extends Doctrine_Record -{ - public function preUpdate(Doctrine_Event $event) - { - $event->getInvoker(); // Object(MyRecord) - } -} - - -+++ skipOperation() -Doctrine_Event provides many methods for altering the execution of the listened method as well as for altering the behaviour of the listener chain. - -For some reason you may want to skip the execution of the listened method. It can be done as follows (note that preExec could be any listener method): - - -class MyListener extends Doctrine_EventListener -{ - public function preExec(Doctrine_Event $event) - { - // some business logic, then: - - $event->skipOperation(); - } -} - - - -+++ skipNextListener() - -When using a chain of listeners you might want to skip the execution of the next listener. It can be achieved as follows: - - -class MyListener extends Doctrine_EventListener -{ - public function preExec(Doctrine_Event $event) - { - // some business logic, then: - - $event->skipNextListener(); - } -} - - diff --git a/manual/docs/en/exceptions-and-warnings.txt b/manual/docs/en/exceptions-and-warnings.txt deleted file mode 100644 index 2ee9ad38e..000000000 --- a/manual/docs/en/exceptions-and-warnings.txt +++ /dev/null @@ -1,32 +0,0 @@ -++ Manager exceptions - -Doctrine_Manager_Exception is thrown if something failed at the connection management - - -try { - $manager->getConnection('unknown'); -} catch (Doctrine_Manager_Exception) { - // catch errors -} - - -++ Relation exceptions - -Relation exceptions are being thrown if something failed during the relation parsing. - -++ Connection exceptions - -Connection exceptions are being thrown if something failed at the database level. Doctrine offers fully portable database error handling. This means that whether you are using sqlite or some other database you can always get portable error code and message for the occurred error. - - -try { - $conn->execute('SELECT * FROM unknowntable'); -} catch (Doctrine_Connection_Exception $e) { - print 'Code : ' . $e->getPortableCode(); - print 'Message : ' . $e->getPortableMessage(); -} - - -++ Query exceptions - -thrown if DQL parsing fails somehow diff --git a/manual/docs/en/file-parser.txt b/manual/docs/en/file-parser.txt deleted file mode 100644 index cd1c41db1..000000000 --- a/manual/docs/en/file-parser.txt +++ /dev/null @@ -1,68 +0,0 @@ -The parser is built to allow dumping and loading from many different formats. Currently xml and yml are the only drivers but later other file formats such as csv may be added. You can specify the data to load/dump in with the $type argument on dump() and load() - -++ Dumping - -Dumping array to yml variable - - -$array = array('test' => array('key' => 'value'), 'test2' => 'test'); - -// Dump the array to yml and return, set to $yml(does not write to file). Replace null with a path to a yml file if you wish to write to disk -$yml = Doctrine_Parser::dump($array, 'yml'); - - -$yml would contain the following - ---- -test: - key: value -test2: test - - - -Dumping array to yml file - - -$array = array('test' => array('key' => 'value'), 'test2' => 'test'); - -// Dump the above array to test.yml using yml parser -Doctrine_Parser::dump($array, 'yml', 'test.yml'); - - -A file named test.yml would be created and would contain the following - ---- -test: - key: value -test2: test - - -++ Loading - -Loading and parsing data from a yml file to a php array - - -$array = array('test' => array('key' => 'value'), 'test2' => 'test'); - -// We dump the above array to test.yml using the yml parser dumper -Doctrine_Parser::dump($array, 'yml', 'test.yml'); - -// Now we reload that dumped yaml file back to the original array format using the yml parser loder -$array = Doctrine_Parser::load('test.yml', 'yml'); - -print_r($array); - - -The print_r() would output the following - - -Array -( - [test] => Array - ( - [key] => value - ) - - [test2] => test -) - \ No newline at end of file diff --git a/manual/docs/en/getting-started.txt b/manual/docs/en/getting-started.txt deleted file mode 100644 index 30e837476..000000000 --- a/manual/docs/en/getting-started.txt +++ /dev/null @@ -1,6 +0,0 @@ -++ Requirements -Doctrine requires PHP >= 5.2. it doesn't require any external libraries. For database function call abstraction Doctrine uses PDO which is bundled with php by default. -++ Installation -++ Starting new project -++ Working with existing databases -++ Exporting classes diff --git a/manual/docs/en/getting-started/exporting-classes.txt b/manual/docs/en/getting-started/exporting-classes.txt deleted file mode 100644 index 728537474..000000000 --- a/manual/docs/en/getting-started/exporting-classes.txt +++ /dev/null @@ -1,101 +0,0 @@ -+++ Introduction - -Doctrine supports exporting record classes into database. This means that based on the definitions given in your record definitions Doctrine will alter your database schema. - -Lets say we have a classes called User and Phonenumber with the following definitions: - - -// file User.php -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 20); - } - public function setUp() - { - $this->hasMany('Phonenumber', array('local' => 'id', - 'foreign' => 'user_id')); - } -} -// file Phonenumber.php -class Phonenumber extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('phonenumber', 'string', 20); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() - { - $this->hasOne('User', array('local' => 'user_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} - - -Now lets say these classes are in directory 'models/'. We can make Doctrine to iterate through this directory and attach these classes into your database structure with the following script: - - - -require_once('path-to-doctrine/lib/Doctrine.php'); - -spl_autoload_register(array('Doctrine', 'autoload')); - -//in order to export we need a database connection -Doctrine_Manager::connection('mysql://user:pass@localhost/test'); - -Doctrine::createTablesFromModels('models'); - - -This would execute the following queries on mysql. - - -CREATE TABLE user (id BIGINT AUTO_INCREMENT, name VARCHAR(20), PRIMARY KEY(id), INDEX(id)); -CREATE TABLE phonenumber (id INT AUTO_INCREMENT, phonenumber VARCHAR(20), user_id BIGINT, PRIMARY KEY(id), INDEX(user_id)); -ALTER TABLE phonenumber ADD CONSTRAINT FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE; - - -Pay attention to the following things: - -# The autoincrement primary key columns are auto-added since we didn't specify any primary key columns -# Doctrine auto-adds indexes to the referenced relation columns (this is needed in mysql) - -+++ Getting export queries - -There might be situations where you don't want to execute the export queries immediately rather you want to get the query strings and maybe attach them to a build.sql file. This can be easily achieved as follows: - - -require_once('path-to-doctrine/lib/Doctrine.php'); - -spl_autoload_register(array('Doctrine', 'autoload')); - -Doctrine_Manager::connection('mgsql://user:pass@localhost/test'); - -$queries = Doctrine::generateSqlFromModels('models'); - -echo $queries; - - -Consider the same situation and you want to get the string of sql queries needed to perform the exporting. It can be achieved with Doctrine::generateSqlFromModels(). - -+++ Export options - - -// export everything, table definitions and constraints -$manager = Doctrine_Manager::getInstance(); - -$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL); - -// export classes without constraints - -$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_TABLES ^ - Doctrine::EXPORT_CONSTRAINTS); - -// turn off exporting - -$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_NONE); - -$sql = Doctrine::generateSqlFromModels(); - diff --git a/manual/docs/en/getting-started/installation.txt b/manual/docs/en/getting-started/installation.txt deleted file mode 100644 index c3f34d374..000000000 --- a/manual/docs/en/getting-started/installation.txt +++ /dev/null @@ -1,53 +0,0 @@ -There are currently two different methods to install Doctrine. - -* SVN (subversion) -* SVN externals - -It is recommended to download Doctrine via SVN (subversion), because in this case updating is easy. -If your project is already under version control with SVN, you should choose SVN externals. - - -+++ SVN - -The installation of doctrine via SVN is very easy. Just get the latest revision of Doctrine from http://svn.phpdoctrine.org/trunk. - -In order to check out Doctrine in the current directory using the **svn** command line tool use the following code: - - -svn co http://svn.phpdoctrine.org/trunk . - - -If you do not have a SVN client, chose one from the list below. Find the **Checkout** option and enter svn.phpdoctrine.org/trunk in the **path** or **repository url** parameter. There is no need for a username or password to check out Doctrine. - -* [http://tortoisesvn.tigris.org/ TortoiseSVN] a Windows application that integrates into Windows Explorer -* [http://www.apple.com/downloads/macosx/development_tools/svnx.html svnx] a Mac OS X GUI svn application -* Eclipse has SVN integration through the [http://subclipse.tigris.org/ subeclipse] plugin - -You can update to the latest version with - - -svn update - - -in your doctrine directory. - - -+++ SVN externals - -If your project is under version control with SVN, you should set up doctrine via svn externals. You can do this with the **svn** command line tool: - - -svn pe svn:externals /path/to/project - - -You have to put the following line in the editor and save the changes. - - -doctrine http://svn.phpdoctrine.org/trunk - - -Afterwards you can download doctrine with - - -svn update - diff --git a/manual/docs/en/getting-started/starting-new-project.txt b/manual/docs/en/getting-started/starting-new-project.txt deleted file mode 100644 index 4f7f064a7..000000000 --- a/manual/docs/en/getting-started/starting-new-project.txt +++ /dev/null @@ -1,41 +0,0 @@ -Doctrine_Record is the basic component of every doctrine-based project. There should be atleast one Doctrine_Record for each of your database tables. Doctrine_Record follows the [http://www.martinfowler.com/eaaCatalog/activeRecord.html Active Record pattern] - -Doctrine always adds a primary key column named 'id' to tables that doesn't have any primary keys specified. Only thing you need to for creating database tables is defining a class which extends Doctrine_Record and setting a setTableDefinition method with hasColumn() method calls and by exporting those classes. - -Lets say we want to create a database table called 'user' with columns id(primary key), name, username, password and created. Provided that you have already installed Doctrine these few lines of code are all you need: - -User.php : - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - // set 'user' table columns, note that - // id column is auto-created as no primary key is specified - - $this->hasColumn('name', 'string',30); - $this->hasColumn('username', 'string',20); - $this->hasColumn('password', 'string',16); - $this->hasColumn('created', 'integer',11); - } -} - - -For exporting the user class into database we need a simple build script: - - -//require the base Doctrine class -require_once('path-to-doctrine/lib/Doctrine.php'); - -//register the autoloader -spl_autoload_register(array('Doctrine', 'autoload')); - -require_once('User.php'); - -//set up a connection -Doctrine_Manager::connection('mysql://user:pass@localhost/test'); - -//export the classes -Doctrine::createTablesFromArray(array('User')); - -We now have a user model that supports basic CRUD opperations! diff --git a/manual/docs/en/getting-started/working-with-existing-databases.txt b/manual/docs/en/getting-started/working-with-existing-databases.txt deleted file mode 100644 index 2f25ecfee..000000000 --- a/manual/docs/en/getting-started/working-with-existing-databases.txt +++ /dev/null @@ -1,154 +0,0 @@ -+++ Introduction - -A common case when looking for ORM tools like Doctrine is that the database and the code that access it is growing large/complex. A more substantial tool is needed then manual SQL code. - -Doctrine has support for generating Doctrine_Record classes from your existing database. There is no need for you to manually write all the Doctrine_Record classes for your domain model. - -+++ Making the first import - -Let's consider we have a mysql database called test with a single table called 'file'. - -The file table has been created with the following sql statement: - - -CREATE TABLE file ( - id INT UNSIGNED AUTO_INCREMENT NOT NULL, - name VARCHAR(150), - size BIGINT, - modified BIGINT, - type VARCHAR(10), - content TEXT, - path TEXT, - PRIMARY KEY(id)) - - -Now we would like to convert it into Doctrine record class. It can be achieved easily with the following code snippet: - - -require_once('path-to-doctrine/lib/Doctrine.php'); - -spl_autoload_register(array('Doctrine', 'autoload')); -Doctrine_Manager::connection('mysql://root:dc34@localhost/test'); - -// import method takes one parameter: the import directory (the directory where -// the generated record files will be put in -Doctrine::generateModelsFromDb('myrecords'); - - -That's it! Now there should be a file called File.php in your myrecords directory. The file should look like: - - -/** - * This class has been auto-generated by the Doctrine ORM Framework - */ -abstract class BaseFile extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->setTableName('file'); - $this->hasColumn('id', 'integer', 4, array ( - 'alltypes' => - array ( - 0 => 'integer', - ), - 'ntype' => 'int(10) unsigned', - 'unsigned' => 1, - 'values' => - array ( - ), - 'primary' => true, - 'notnull' => true, - 'autoincrement' => true, -)); - $this->hasColumn('name', 'string', 150, array ( - 'alltypes' => - array ( - 0 => 'string', - ), - 'ntype' => 'varchar(150)', - 'fixed' => false, - 'values' => - array ( - ), - 'primary' => false, - 'notnull' => false, - 'autoincrement' => false, -)); - $this->hasColumn('size', 'integer', 8, array ( - 'alltypes' => - array ( - 0 => 'integer', - ), - 'ntype' => 'bigint(20)', - 'unsigned' => 0, - 'values' => - array ( - ), - 'primary' => false, - 'notnull' => false, - 'autoincrement' => false, -)); - $this->hasColumn('modified', 'integer', 8, array ( - 'alltypes' => - array ( - 0 => 'integer', - ), - 'ntype' => 'bigint(20)', - 'unsigned' => 0, - 'values' => - array ( - ), - 'primary' => false, - 'notnull' => false, - 'autoincrement' => false, -)); - $this->hasColumn('type', 'string', 10, array ( - 'alltypes' => - array ( - 0 => 'string', - ), - 'ntype' => 'varchar(10)', - 'fixed' => false, - 'values' => - array ( - ), - 'primary' => false, - 'notnull' => false, - 'autoincrement' => false, -)); - $this->hasColumn('content', 'string', null, array ( - 'alltypes' => - array ( - 0 => 'string', - 1 => 'clob', - ), - 'ntype' => 'text', - 'fixed' => false, - 'values' => - array ( - ), - 'primary' => false, - 'notnull' => false, - 'autoincrement' => false, -)); - $this->hasColumn('path', 'string', null, array ( - 'alltypes' => - array ( - 0 => 'string', - 1 => 'clob', - ), - 'ntype' => 'text', - 'fixed' => false, - 'values' => - array ( - ), - 'primary' => false, - 'notnull' => false, - 'autoincrement' => false, -)); - } -} - - -+++ Import options - diff --git a/manual/docs/en/hierarchical-data.txt b/manual/docs/en/hierarchical-data.txt deleted file mode 100644 index 0892df843..000000000 --- a/manual/docs/en/hierarchical-data.txt +++ /dev/null @@ -1,5 +0,0 @@ -++ Introduction -++ Adjacency list -++ Nested set -++ Materialized path -++ Examples diff --git a/manual/docs/en/hierarchical-data/adjacency-list.txt b/manual/docs/en/hierarchical-data/adjacency-list.txt deleted file mode 100644 index 2b798236c..000000000 --- a/manual/docs/en/hierarchical-data/adjacency-list.txt +++ /dev/null @@ -1 +0,0 @@ -Not yet implemented diff --git a/manual/docs/en/hierarchical-data/introduction.txt b/manual/docs/en/hierarchical-data/introduction.txt deleted file mode 100644 index 400bb8ab9..000000000 --- a/manual/docs/en/hierarchical-data/introduction.txt +++ /dev/null @@ -1,18 +0,0 @@ -Most users at one time or another have dealt with hierarchical data in a SQL database and no doubt learned that the management of hierarchical data is not what a relational database is intended for. The tables of a relational database are not hierarchical (like XML), but are simply a flat list. Hierarchical data has a parent-child relationship that is not naturally represented in a relational database table. - -For our purposes, hierarchical data is a collection of data where each item has a single parent and zero or more children (with the exception of the root item, which has no parent). Hierarchical data can be found in a variety of database applications, including forum and mailing list threads, business organization charts, content management categories, and product categories. - -In a hierarchical data model, data is organized into a tree-like structure. The tree structure allows repeating information using parent/child relationships. For an explanation of the tree data structure, see [http://en.wikipedia.org/wiki/Tree_data_structure here]. - -There are three major approaches to managing tree structures in relational databases, these are: - -* the adjacency list model -* the nested set model (otherwise known as the modified pre-order tree traversal algorithm) -* materialized path model - -These are explained in more detail in the following chapters, or see - -* [http://www.dbazine.com/oracle/or-articles/tropashko4 http://www.dbazine.com/oracle/or-articles/tropashko4] -* [http://dev.mysql.com/tech-resources/articles/hierarchical-data.html http://dev.mysql.com/tech-resources/articles/hierarchical-data.html] - - diff --git a/manual/docs/en/hierarchical-data/materialized-path.txt b/manual/docs/en/hierarchical-data/materialized-path.txt deleted file mode 100644 index 0ccc6e8cf..000000000 --- a/manual/docs/en/hierarchical-data/materialized-path.txt +++ /dev/null @@ -1,4 +0,0 @@ -Not yet implemented - - - diff --git a/manual/docs/en/hierarchical-data/nested-set.txt b/manual/docs/en/hierarchical-data/nested-set.txt deleted file mode 100644 index 878544a20..000000000 --- a/manual/docs/en/hierarchical-data/nested-set.txt +++ /dev/null @@ -1,224 +0,0 @@ -+++ Introduction - -Nested Set is a solution for storing hierarchical data that provides very fast read access. However, updating nested set trees is more costly. Therefore this solution is best suited for hierarchies that are much more frequently read than written to. And because of the nature of the web, this is the case for most web applications. - -For more detailed information on the Nested Set, read here: - -* [http://www.sitepoint.com/article/hierarchical-data-database/2 http://www.sitepoint.com/article/hierarchical-data-database/2] -* [http://dev.mysql.com/tech-resources/articles/hierarchical-data.html http://dev.mysql.com/tech-resources/articles/hierarchical-data.html] - - -+++ Setting up - -To set up your model as Nested Set, you must add the following code to your model's table definition. - - -... - public function setTableDefinition() { - ... - - $this->actAs('NestedSet'); - - ... - } -... - - -"actAs" is a convenience method that loads templates that are shipped with Doctrine(Doctrine_Template_* classes). The more general alternative would look like this: - - -... - public function setTableDefinition() { - ... - - $this->loadTemplate('Doctrine_Template_NestedSet'); - - ... - } -... - - -Detailed information on Doctrine's templating model can be found in chapter [doc class-templates :index :name]. These templates add some functionality to your model. In the example of the nested set, your model gets 3 additional fields: "lft", "rgt", "level". You never need to care about "lft" and "rgt". These are used internally to manage the tree structure. The "level" field however, is of interest for you because it's an integer value that represents the depth of a node within it's tree. A level of 0 means it's a root node. 1 means it's a direct child of a root node and so on. By reading the "level" field from your nodes you can easily display your tree with proper indendation. - -**You must never assign values to lft, rgt, level. These are managed transparently by the nested set implementation.** - -+++ More than 1 tree in a single table - -The nested set implementation can be configured to allow your table to have multiple root nodes, and therefore multiple trees within the same table. - -The example below shows how to setup and use multiple roots based upon the set up above: - - -... - public function setTableDefinition() { - ... - $options = array('hasManyRoots' => true, // enable many roots - 'rootColumnName' => 'root_id'); // set root column name, defaults to 'root_id' - $this->actAs('NestedSet', $options); - - ... - } -... - - -The rootColumnName is the column that is used to differentiate between trees. When you create a new node to insert it into an existing tree you dont need to care about this field. This is done by the nested set implementation. However, when you want to create a new root node you have the option to set the "root_id" manually. The nested set implementation will recognize that. In the same way you can move nodes between different trees without caring about the "root_id". All of this is handled for you. - -+++ Working with the tree(s) - -After you successfully set up your model as a nested set you can start working with it. Working with Doctrine's nested set implementation is all about 2 classes: Doctrine_Tree_NestedSet and Doctrine_Node_NestedSet. These are nested set implementations of the interfaces Doctrine_Tree_Interface and Doctrine_Node_Interface. Tree objects are bound to your table objects and node objects are bound to your record objects. This looks as follows: - - // Assuming $conn is an instance of some Doctrine_Connection - $treeObject = $conn->getTable('MyNestedSetModel')->getTree(); - // ... the full tree interface is available on $treeObject - - // Assuming $entity is an instance of MyNestedSetModel - $nodeObject = $entity->getNode(); - // ... the full node interface is available on $nodeObject - - -In the following sub-chapters you'll see code snippets that demonstrate the most frequently used operations with the node and tree classes. - -++++ Creating a root node - - -... -$root = new MyNestedSetModel(); -$root->name = 'root'; -$treeObject = $conn->getTable('MyNestedSetModel')->getTree(); -$treeObject->createRoot($root); // calls $root->save() internally -... - - -++++ Inserting a node - - -... -// Assuming $someOtherRecord is an instance of MyNestedSetModel -$record = new MyNestedSetModel(); -$record->name = 'somenode'; -$record->getNode()->insertAsLastChildOf($someOtherRecord); // calls $record->save() internally -... - - -++++ Deleting a node - - -... -// Assuming $record is an instance of MyNestedSetModel -$record->getNode()->delete(); // calls $record->delete() internally. It's important to delete on the node and not on the record. Otherwise you may corrupt the tree. -... - - -Deleting a node will also delete all descendants of that node. So make sure you move them elsewhere before you delete the node if you dont want to delete them. - -++++ Moving a node - - -... -// Assuming $record and $someOtherRecord are both instances of MyNestedSetModel -$record->getNode()->moveAsLastChildOf($someOtherRecord); -... - - -There are 4 move methods: moveAsLastChildOf($other), moveAsFirstChildOf($other), moveAsPrevSiblingOf($other) and moveAsNextSiblingOf($other). The method names are self-explanatory. - -++++ Examining a node - - -... -// Assuming $record is an instance of MyNestedSetModel -$isLeaf = $record->getNode()->isLeaf(); // true/false -$isRoot = $record->getNode()->isRoot(); // true/false -... - - -++++ Examining and retrieving siblings - - -... -// Assuming $record is an instance of MyNestedSetModel -$hasNextSib = $record->getNode()->hasNextSibling(); // true/false -$haPrevSib = $record->getNode()->hasPrevSibling(); // true/false - -$nextSib = $record->getNode()->getNextSibling(); // returns false if there is no next sibling, otherwise returns the sibling -$prevSib = $record->getNode()->getPrevSibling(); // returns false if there is no previous sibling, otherwise returns the sibling - -$siblings = $record->getNode()->getSiblings(); // an array of all siblings -... - - -++++ Examining and retrieving children / parents / descendants / ancestors - - -... -// Assuming $record is an instance of MyNestedSetModel -$hasChildren = $record->getNode()->hasChildren(); // true/false -$hasParent = $record->getNode()->hasParent(); // true/false - -$firstChild = $record->getNode()->getFirstChild(); // returns false if there is no first child, otherwise returns the child -$lastChild = $record->getNode()->getLastChild(); // returns false if there is no lase child, otherwise returns the child -$parent = $record->getNode()->getParent(); // returns false if there is no parent, otherwise returns the parent - -$children = $record->getNode()->getChildren(); // returns false if there are no children, otherwise returns the children -// !!! IMPORATNT: getChildren() returns only the direct descendants. If you want all descendants, use getDescendants() !!! - -$descendants = $record->getNode()->getDescendants(); // returns false if there are no descendants, otherwise returns the descendants -$ancestors = $record->getNode()->getAncestors(); // returns false if there are no ancestors, otherwise returns the ancestors - -$numChildren = $record->getNode()->getNumberChildren(); // returns the number of children -$numDescendants = $record->getNode()->getNumberDescendants(); // returns the number of descendants - -... - - -getDescendants() and getAncestors() both accept a parameter that you can use to specify the "depth" of the resulting branch. For example getDescendants(1) retrieves only the direct descendants (the descendants that are 1 level below, that's the same as getChildren()). In the same fashion getAncestors(1) would only retrieve the direct ancestor (the parent), etc. getAncestors() can be very useful to efficiently determine the path of this node up to the root node or up to some specific ancestor (i.e. to construct a breadcrumb navigation). - -++++ Simple Example: Displaying a tree - - -... -$treeObject = $conn->getTable('MyNestedSetModel')->getTree(); -$tree = $treeObject->fetchTree(); -foreach ($tree as $node) { - echo str_repeat('  ', $node['level']) . $node['name'] . '
'; -} -... -
- -+++ Advanced usage - -The previous sections have explained the basic usage of Doctrine's nested set implementation. This section will go one step further. - -++++ Fetching a tree with relations - -If you're a demanding software developer this question may already have come into your mind: "How do I fetch a tree/branch with related data?". Simple example: You want to display a tree of categories, but you also want to display some related data of each category, let's say some details of the hottest product in that category. Fetching the tree as seen in the previous sections and simply accessing the relations while iterating over the tree is possible but produces a lot of unnecessary database queries. Luckily, Doctrine_Query and some flexibility in the nested set implementation have come to your rescue. The nested set implementation uses Doctrine_Query objects for all it's database work. By giving you access to the base query object of the nested set implementation you can unleash the full power of Doctrine_Query while using your nested set. Take a look at the following code snippet: - - -$query = new Doctrine_Query(); -$query->select("cat.name, hp.name, m.name")->from("Category cat") - ->leftJoin("cat.hottestProduct hp") - ->leftJoin("hp.manufacturer m"); -$treeObject = $conn->getTable('Category')->getTree(); -$treeObject->setBaseQuery($query); -$tree = $treeObject->fetchTree(); -$treeObject->resetBaseQuery(); - - -There it is, the tree with all the related data you need, all in one query. - -You can take it even further. As mentioned in the chapter "Improving Performance" you should only fetch objects when you need them. So, if we need the tree only for display purposes (read-only) we can do: - - -$query = new Doctrine_Query(); -$query->select("base.name, hp.name, m.name")->from("Category base") - ->leftJoin("base.hottestProduct hp") - ->leftJoin("hp.manufacturer m") - ->setHydrationMode(Doctrine::HYDRATE_ARRAY); -$treeObject = $conn->getTable('Category')->getTree(); -$treeObject->setBaseQuery($query); -$tree = $treeObject->fetchTree(); -$treeObject->resetBaseQuery(); - - -Now you got a nicely structured array in $tree and if you use array access on your records anyway, such a change will not even effect any other part of your code. This method of modifying the query can be used for all node and tree methods (getAncestors(), getDescendants(), getChildren(), getParent(), ...). Simply create your query, set it as the base query on the tree object and then invoke the appropriate method. - diff --git a/manual/docs/en/improving-performance.txt b/manual/docs/en/improving-performance.txt deleted file mode 100644 index 04d378e12..000000000 --- a/manual/docs/en/improving-performance.txt +++ /dev/null @@ -1,6 +0,0 @@ -++ Introduction -++ Compile -++ Fetch only what you need -++ Bundle your class files -++ Use a bytecode cache -++ Other tips diff --git a/manual/docs/en/improving-performance/bundle-your-class-files.txt b/manual/docs/en/improving-performance/bundle-your-class-files.txt deleted file mode 100644 index 2ae24c696..000000000 --- a/manual/docs/en/improving-performance/bundle-your-class-files.txt +++ /dev/null @@ -1 +0,0 @@ -When using Doctrine or any other large OO library or framework the number of files that need to be included on a regular HTTP request rises significantly. 50-100 includes per request are not uncommon. This has a significant performance impact because it results in a lot of disk operations. While this is generally no issue in a dev environment, it's not suited for production. The recommended way to handle this problem is to bundle the most-used classes of your libraries into a single file for production, stripping out any unnecessary whitespaces, linebreaks and comments. This way you get a significant performance improvement even without a bytecode cache (see next section). The best way to create such a bundle is probably as part of an automated build process i.e. with Phing. diff --git a/manual/docs/en/improving-performance/compile.txt b/manual/docs/en/improving-performance/compile.txt deleted file mode 100644 index 1560b45ba..000000000 --- a/manual/docs/en/improving-performance/compile.txt +++ /dev/null @@ -1,11 +0,0 @@ -Doctrine is quite big framework and usually dozens of files are being included on each request. This brings a lot of overhead. In fact these file operations are as time consuming as sending multiple queries to database server. The clean separation of class per file works well in developing environment, however when project goes commercial distribution the speed overcomes the clean separation of class per file -convention. - -Doctrine offers method called {{compile()}} to solve this issue. The compile method makes a single file of most used Doctrine components which can then be included on top of your script. By default the file is created into Doctrine root by the name {{Doctrine.compiled.php}}. - -Compiling is a method for making a single file of most used doctrine runtime components including the compiled file instead of multiple files (in worst cases dozens of files) can improve performance by an order of magnitude. In cases where this might fail, a {{Doctrine_Exception}} is throw detailing the error. - - -Doctrine::compile(); -// on some other script: -require_once('path_to_doctrine/Doctrine.compiled.php'); - diff --git a/manual/docs/en/improving-performance/fetch-only-what-you-need.txt b/manual/docs/en/improving-performance/fetch-only-what-you-need.txt deleted file mode 100644 index 6ed0937bf..000000000 --- a/manual/docs/en/improving-performance/fetch-only-what-you-need.txt +++ /dev/null @@ -1,60 +0,0 @@ -Maybe the most important rule is to only fetch the data you actually need. This may sound trivial but laziness or lack of knowledge about the possibilities that are available often lead to a lot of unnecessary overhead. - -Take a look at this example: - -$record = $table->find($id); - - -How often do you find yourself writing code like that? It's convenient but it's very often not what you need. The example above will pull all columns of the record out of the database and populate the newly created object with that data. This not only means unnecessary network traffic but also means that Doctrine has to populate data into objects that is never used. I'm pretty sure you all know why - -SELECT * FROM ... - is bad in any application and this is also true when using Doctine. In fact it's even worse when using Doctrine because populating objects with data that is not needed is a waste of time. - -Another important rule that belongs in this category is: **Only fetch objects when you really need them**. Until recently this statement would make no sense at all but one of the recent additions to Doctrine is the ability to fetch "array graphs" instead of object graphs. At first glance this may sound strange because why use an object-relational mapper in the first place then? Take a second to think about it. PHP is by nature a prodecural language that has been enhanced with a lot of features for decent OOP. Arrays are still the most efficient data structures you can use in PHP. Objects have the most value when they're used to accomplish complex business logic. It's a waste of resources when data gets wrapped in costly object structures when you have no benefit of that. Take a look at the following pseudo-code that fetches all comments with some related data for an article, passing them to the view for display afterwards: - -$comments = $query->select("c.id, ...")->from("Comment c") - ->leftJoin("c.foo f") - ->leftJoin("f.bar b") - ->where("c.article_id = ?") - ->execute(array(1)); -$view->comments = $comments; - Can you think of any benefit of having objects in the view instead of arrays? You're not going to execute business logic in the view, are you? One parameter can save you a lot of unnecessary processing: - - ... ->execute(array(1), Doctrine::FETCH_ARRAY); - This will return a bunch of nested php arrays. It could look something like this, assuming we fetched some comments: - -array(5) ( - [0] => array( - 'title' => 'Title1', - 'message' => 'Hello there! I like donuts!', - 'author' => array( - 'first_name' => 'Bart', - 'last_name' => 'Simpson' - ) - ), - [1] => array( - 'title' => 'Title2', - 'message' => 'Hullo!', - 'author' => array( - 'first_name' => 'Homer', - 'last_name' => 'Simpson' - ) - ), - ... -) - Here 'author' is a related component of a 'comment' and thus results in a sub-array. If you always use the array syntax for accessing data, then the switch to array fetching requires nothing more than adding the additional parameter. The following code works regardless of the fetching style: - -foreach ($comments as $comment) { - echo $comment['title'] . '
'; - echo $comment['message'] . '
'; - echo $comment['author']['first_name'] . ' - ' . $comment['author']['last_name'] . '
'; -} -
**Array fetching is the best choice whenever you need data read-only like passing it to the view for display. And from my experience, most of the time when you fetch a large amount of data it's only for display purposes. And these are exactly the cases where you get the best performance payoff when fetching arrays instead of objects.** - -Sometimes, you may want the direct output from PDO instead of an object or an array. To do this, set the hydration mode to **Doctrine::HYDRATE_NONE**. Here's an example: - -$total = Doctrine_Query::create() - ->select('SUM(d.amount)') - ->from('Donation d') - ->execute(array(), Doctrine::HYDRATE_NONE); - diff --git a/manual/docs/en/improving-performance/introduction.txt b/manual/docs/en/improving-performance/introduction.txt deleted file mode 100644 index 8a3648b70..000000000 --- a/manual/docs/en/improving-performance/introduction.txt +++ /dev/null @@ -1,4 +0,0 @@ -Performance is a very important aspect of all medium to large sized applications. Doctrine is a large -abstraction library that provides a database abstraction layer as well as object-relational mapping. -While this provides a lot of benefits like portability and ease of development it's inevitable that this -leads to drawbacks in terms of performance. This chapter tries to help you to get the best performance out of Doctrine. \ No newline at end of file diff --git a/manual/docs/en/improving-performance/other-tips.txt b/manual/docs/en/improving-performance/other-tips.txt deleted file mode 100644 index c3153143f..000000000 --- a/manual/docs/en/improving-performance/other-tips.txt +++ /dev/null @@ -1,16 +0,0 @@ -**Helping the DQL parser** -There are two possible ways when it comes to using DQL. The first one is writing the plain DQL queries and passing them to Doctrine_Connection::query($dql). The second one is to use a Doctrine_Query object and its fluent interface. The latter should be preferred for all but very simple queries. The reason is that using the Doctrine_Query object and it's methods makes the life of the DQL parser a little bit easier. It reduces the amount of query parsing that needs to be done and is therefore faster. - -**Efficient relation handling** -When you want to add a relation between two components you should **NOT** do something like the following: - -// Assuming a many-many between role - user -$user->roles[] = $newRole; - This will load all roles of the user from the database if they're not yet loaded! Just to add one new link! Do this instead: - -// Assuming a many-many between role - user, where UserRoleXref is the cross-reference table -$ref = new UserRoleXref(); -$ref->role_id = $role_id; -$ref->user_id = $user_id; -$ref->save(); - \ No newline at end of file diff --git a/manual/docs/en/improving-performance/use-a-bytecode-cache.txt b/manual/docs/en/improving-performance/use-a-bytecode-cache.txt deleted file mode 100644 index bca90ac7a..000000000 --- a/manual/docs/en/improving-performance/use-a-bytecode-cache.txt +++ /dev/null @@ -1 +0,0 @@ -A bytecode cache like APC will cache the bytecode that is generated by php prior to executing it. That means that the parsing of a file and the creation of the bytecode happens only once and not on every request. This is especially useful when using large libraries and/or frameworks. Together with file bundling for production this should give you a significant performance improvement. To get the most out of a bytecode cache you should contact the manual pages since most of these caches have a lot of configuration options which you can tweak to optimize the cache to your needs. \ No newline at end of file diff --git a/manual/docs/en/introduction.txt b/manual/docs/en/introduction.txt deleted file mode 100644 index cd5212731..000000000 --- a/manual/docs/en/introduction.txt +++ /dev/null @@ -1,7 +0,0 @@ -++ The Big Picture - -++ What it is and what not - -++ Key Concepts - -++ Further Reading diff --git a/manual/docs/en/introduction/further-reading.txt b/manual/docs/en/introduction/further-reading.txt deleted file mode 100644 index e0a6d6a94..000000000 --- a/manual/docs/en/introduction/further-reading.txt +++ /dev/null @@ -1,7 +0,0 @@ -For people new to object-relational mapping and (object-oriented) domain models we recommend the following literature: - -[http://www.martinfowler.com/books.html Patterns of Enterprise Application Architecture] -Covers a lot of the basic ORM terminology, the different approaches of modeling business logic and the patterns involved. - -[http://domaindrivendesign.org/books/#DDD Domain-Driven Design] -Though serious Domain-Driven Design is currently not possible with Doctrine, this is an excellent resource for good domain modeling, especially in complex business domains, and the terminology around domain models that is pretty widespread nowadays is explained in depth (Entities, Value Objects, Repositories, ...). diff --git a/manual/docs/en/introduction/key-concepts.txt b/manual/docs/en/introduction/key-concepts.txt deleted file mode 100644 index 7e727b819..000000000 --- a/manual/docs/en/introduction/key-concepts.txt +++ /dev/null @@ -1,43 +0,0 @@ -Now, let's get familar with the key concepts, tools and classes that form the backbone of the Doctrine ORM. - -+++ Doctrine Query Language -The Doctrine Query Language (DQL) is an object query language. It let's you express queries for single objects or full object graphs, using the terminology of your domain model: class names, field names, relations between classes, etc. This is a powerful tool for retrieving or even manipulating objects without breaking the separation of the domain model (field names, class names, ..) from the relational model (table names, column names, ...). -DQL looks very much like SQL and this is intended because it makes it relatively easy to grasp for people knowing SQL. There are, however, a few very important differences you should always keep in mind: - -Take this example: - -from Employee emp join emp.tasks t where emp.salary < 40000 - - -The things to notice about this query: -* We select from **classes** (Employee) -* We join along **associations** (emp.tasks) -* We can reference **fields** (emp.salary) -* There is no join condition (ON x.y = y.x). The associations between your classes and how these are expressed in the database are known to Doctrine (You need to make this mapping known to Doctrine, of course. How to do that is explained later.). - -**DQL expresses a query in the terms of your domain model (your classes, the attributes they have, the relations they have to other classes, etc.)** - -It's very important that we speak about classes, fields and associations between classes here. 'Employee' is **not** a table / table name . It may be that the name of the database table the Employee class is mapped to is indeed named Employee but you should nevertheless adhere to this differentiation of the terminology. This may sound nitpicky since, due to the ActiveRecord approach, your relational model is often very similar to your domain model but it's really important. The column names are rarely the same as the field names and as soon as inheritance is involved the relational model starts to diverge from the domain model. You can have a class Employee that is in fact mapped to several tables in the database. At this point it should be clear that talking about "selecting from the Employee table" is simply wrong then. And as Doctrine development continues there will be more features available that allow the 2 models to diverge even more. - -+++ Metadata Mapping -[todo: explain what this is and how it's done in doctrine. mention the alternative approach (code generation)] - -+++ Classes -The following is a list of the most important classes of the Doctrine ORM and their responsibilities. - -++++ Doctrine::ORM::Entity -The Entity class is the "ActiveRecord" base class. A class needs to extend this base class in order to enable Doctrine to manage it's persistence. -The Entity class provides extending classes with the usual ActiveRecord interface (save()/delete()) and a lot of other methods that are useful in the basic maintenance of the persistent state. - -++++ Doctrine::ORM::Mapper -The Mapper class is the gateway to the main mapping facilities and functionality. If you're going a straight ActiveRecord route you will never have to deal with that class. However, if you don't want to bloat your Entity classes with static finder methods, you can use custom mapper classes that act as your Entity repositories that provide an OO interface for retrieving Entities in the terms of the language of your domain. As you will see, such custom mapper classes come with a lot of functionality out of the box without any custom coding. This is because all custom mapper classes need to inherit from Doctrien::ORM::Mapper [Link to custom mapper docs here?]. - -++++ Doctrine::ORM::EntityManager -The EntityManager class does exactly what the name implies. It manages the lifecycles of all Entities used during the processing of one HTTP request. The EntityManager is the entrypoint for a lot of ORM related functionality. One exception is the usage of the ActiveRecord interface on your Entities, the EntityManager is then involved behind the scenes. One of the key features you'll most likely use the most is the creation of object queries using DQL (Doctrine's OQL implementation). -An EntityManager needs a database connection to operate on (An instance of Doctrine::DBAL::Connection). - -++++ Doctrine::ORM::Query -[coming soon] - -++++ Doctrine::ORM::ClassMetadata -[coming soon] \ No newline at end of file diff --git a/manual/docs/en/introduction/the-big-picture.txt b/manual/docs/en/introduction/the-big-picture.txt deleted file mode 100644 index 36a3ff321..000000000 --- a/manual/docs/en/introduction/the-big-picture.txt +++ /dev/null @@ -1,12 +0,0 @@ -+++ Overview -Doctrine is a tool for object-relational mapping in PHP. It sits on top of PDO and is itself divided into two main layers, The DBAL and the ORM. See the picture below. - -[http://code-factory.org/doctrine-manual-images/doctrine-layers.jpg] - -The DBAL layer completes and extends the basic database abstraction/independance that is already provided by PDO. The DBAL library can be used standalone, if all you want is a powerful database abstraction layer on top of PDO. [Link to DBAL download here]. -The ORM layer depends on the DBAL and therefore, when you load the ORM package the DBAL is already included. - -+++ The terminology used in the manual -**Entity class** : A class whose instances are persisted into a relational database (classes that inherit directly or indirectly from Doctrine::ORM::Entity). -**Entity** : An object that is an instance of an Entity class. -[More key words and short explanations] \ No newline at end of file diff --git a/manual/docs/en/introduction/what-it-is-and-what-not.txt b/manual/docs/en/introduction/what-it-is-and-what-not.txt deleted file mode 100644 index 04b8dd0a3..000000000 --- a/manual/docs/en/introduction/what-it-is-and-what-not.txt +++ /dev/null @@ -1,23 +0,0 @@ -The following section tries to explain where Doctrine stands in the world of ORM tools. - -The Doctrine ORM is mainly build around the [http://www.martinfowler.com/eaaCatalog/activeRecord.html ActiveRecord], [http://www.martinfowler.com/eaaCatalog/dataMapper.html Data Mapper] and [http://www.martinfowler.com/eaaCatalog/metadataMapping.html Metadata Mapping] patterns. The former two may sound contradictory but that has it's reasons. Doctrine started out as a plain ActiveRecord implementation. As the featureset grew larger and larger, all the main mapping work of the ORM moved to separate components, among others, the Mappers. Nevertheless, Doctrine has the ActiveRecord-style base class that must be extended by all Entity classes. - -Through extending this specific base class, all the Entity classes get the typical ActiveRecord interface (save/delete/etc.) and it allows Doctrine to easily participate in & monitor the lifecycles of your Entities. The real work, however, is mostly forwarded to other components, like the Mappers. These mappers have the typical Data Mapper interface, save(entity), delete(entity), find(id), etc. So the ActiveRecord base class enables Doctrine to manage your Entities and provides your Entities with the typical ActiveRecord interface whilst the mapping footwork is done elsewhere. As you'll see later, you have a bit of freedom in how you do things, whether you want to use the pure ActiveRecord approach or want to make use of custom Mapper classes. - -However, it's currently not possible to ditch the ActiveRecord approach completely in favor of a Data Mapper approach when using Doctrine, for the reasons described above. - -The ActiveRecord approach comes with it's typical limitations. The most obvious is the enforcement for a class to extend a specific base class in order to be persistent (an Entity). In general, the design of your domain model is pretty much restricted by the design of your relational model. There is an exception though. When dealing with inheritance structures, Doctrine provides some sophisticated mapping strategies which allow your domain model to diverge a bit from the relational model and therefore give you a bit more freedom. Doctrine is in a continous development process and we always try to add new features that provide more freedom in the modeling of the domain. However, as long as Doctrine remains mainly an ActiveRecord approach, there will always be a pretty large, (forced) similarity of these two models. -The current situation is depicted in the following picture. - -[http://code-factory.org/doctrine-manual-images/relational-bounds.jpg] - -As you see in the picture, the domain model can't drift far away from the bounds of the relational model. - -After mentioning these drawbacks, it's time to mention some advantages of the ActiveRecord approach. Apart from the (arguably slightly) simpler programming model, it turns out that the strong similarity of the relational model and the (OO) domain model also has an advantage: It makes it relatively easy to provide powerful generation tools, that can create a basic domain model out of an existing relational schema. And as the domain model can't drift far from the relational model due to the reasons above, such generation and synchronization tools can easily be used throughout the development process. Such tools are one of Doctrine's strengths. - -We think that these limitations of the ActiveRecord approach are not that much of a problem for the majority of web applications because the complexity of the business domains is often moderate, but we also admit that the ActiveRecord approach is certainly not suited for complex business logic (which is often approached using Domain-Driven Design) as it simply puts too many restrictions and has too much influence on your domain model. - -Doctrine is a great tool to drive the persistence of simple or moderately complex domain models(1) and you may even find that it's a good choice for complex domain models if you consider the trade-off between making your domain model more database-centric and implementing all the mapping on your own (because at the time of this writing we are not aware of any powerful ORM tools for PHP that are not based on an ActiveRecord approach). -1) Note that complexity != size. A domain model can be pretty large without being complex and vice versa. Obviously, larger domain models have a greater probability of being complex. - -Now you already know a lot about what Doctrine is and what it is not. If you would like to dive in now and get started right away, jump straight to the next chapter "Getting Started". \ No newline at end of file diff --git a/manual/docs/en/mapping-relations.txt b/manual/docs/en/mapping-relations.txt deleted file mode 100644 index fcdddc106..000000000 --- a/manual/docs/en/mapping-relations.txt +++ /dev/null @@ -1,532 +0,0 @@ -++ Introduction - -In Doctrine all record relations are being set with {{hasMany}}, {{hasOne}} methods. Doctrine supports almost any kind of database relation from simple one-to-one foreign key relations to join table self-referencing relations. - - -++ Relation aliases - -Doctrine supports relation aliases through {{as}} keyword. - - -class Forum_Board extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 100); - $this->hasColumn('description', 'string', 5000); - } - public function setUp() - { - // notice the 'as' keyword here - $this->hasMany('Forum_Thread as Threads', array('local' => 'id', - 'foreign' => 'board_id'); - } -} - -class Forum_Thread extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('board_id', 'integer', 10); - $this->hasColumn('updated', 'integer', 10); - $this->hasColumn('closed', 'integer', 1); - } - public function setUp() - { - // notice the 'as' keyword here - $this->hasOne('Forum_Board as Board', array('local' => 'board_id', - 'foreign' => 'id'); - } -} -$board = new Board(); -$board->Threads[0]->updated = time(); - - - -++ Foreign key associations -+++ One-To-One - -Binding One-To-One foreign key associations is done with {{Doctrine_Record::ownsOne()}} and {{Doctrine_Record::hasOne()}} methods. In the following example user owns one email and has one address. So the relationship between user and email is one-to-one composite. The relationship between user and address is one-to-one aggregate. - -The {{Email}} component here is mapped to {{User}} component's column {{email_id}} hence their relation is called LOCALKEY relation. On the other hand the {{Address}} component is mapped to {{User}} by it's {{user_id}} column hence the relation between {{User}} and {{Address}} is called FOREIGNKEY relation. - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasOne('Address', array('local' => 'id', 'foreign' => 'user_id')); - $this->hasOne('Email', array('local' => 'email_id', 'foreign' => 'id')); - $this->hasMany('Phonenumber', array('local' => 'id', 'foreign' => 'user_id')); - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string',50); - $this->hasColumn('loginname', 'string',20); - $this->hasColumn('password', 'string',16); - - // foreign key column for email id - $this->hasColumn('email_id', 'integer'); - } -} -class Email extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('address', 'string', 150); - } -} -class Address extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('street', 'string', 50); - $this->hasColumn('user_id', 'integer'); - } -} - - - -+++ One-to-Many, Many-to-One - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasMany('Phonenumber', array('local' => 'id', 'foreign' => 'user_id')); - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 50); - $this->hasColumn('loginname', 'string', 20); - $this->hasColumn('password', 'string', 16); - } -} -class Phonenumber extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('phonenumber', 'string', 50); - $this->hasColumn('user_id', 'integer'); - } -} - - - -+++ Tree structure - - -class Task extends Doctrine_Record -{ - public function setUp() - { - $this->hasOne('Task as Parent', array('local' => 'parent_id', 'foreign' => 'id')); - $this->hasMany('Task as Subtask', array('local' => 'id', 'foreign' => 'parent_id')); - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 100); - $this->hasColumn('parent_id', 'integer'); - } -} - - -++ Join table associations - -+++ Many-to-Many - -If you are coming from relational database background it may be familiar to you how many-to-many associations are handled: an additional association table is needed. - -In many-to-many relations the relation between the two components is always an aggregate relation and the association table is owned by both ends. For example in the case of users and groups when user is being deleted the groups it belongs to are not being deleted and the associations between this user and the groups it belongs to are being deleted. - -Sometimes you may not want that association table rows are being deleted when user / group is being deleted. You can override this behoviour by setting the relations to association component (in this case {{Groupuser}}) explicitly. - -In the following example we have Groups and Users of which relation is defined as many-to-many. In this case we also need to define an additional class called {{Groupuser}}. - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasMany('Group', array('local' => 'user_id', - 'foreign' => 'group_id', - // the following line is needed in many-to-many relations! - 'refClass' => 'GroupUser')); - - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - } -} - -class Group extends Doctrine_Record -{ - public function setUp() { - $this->hasMany('User', array('local' => 'group_id', - 'foreign' => 'user_id', - // the following line is needed in many-to-many relations! - 'refClass' => 'GroupUser')); - } - public function setTableDefinition() { - $this->hasColumn('name', 'string', 30); - } -} - -class GroupUser extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('user_id', 'integer', null, array('primary' => true)); - $this->hasColumn('group_id', 'integer', null, array('primary' => true)); - } -} - - -$user = new User(); - -// add two groups -$user->Group[0]->name = 'First Group'; - -$user->Group[1]->name = 'Second Group'; - -// save changes into database -$user->save(); - -// deleting the associations between user and groups it belongs to - -$user->Groupuser->delete(); - -$groups = new Doctrine_Collection($conn->getTable('Group')); - -$groups[0]->name = 'Third Group'; - -$groups[1]->name = 'Fourth Group'; - -$user->Group[2] = $groups[0]; -// $user will now have 3 groups - -$user->Group = $groups; -// $user will now have two groups 'Third Group' and 'Fourth Group' - - - - -+++ Self-referencing (Nest relations) -++++ Non-equal nest relations - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasMany('User as Parents', array('local' => 'parent_id', - 'foreign' => 'child_id', - 'refClass' => 'UserReference' - ); - - $this->hasMany('User as Children', array('local' => 'child_id', - 'foreign' => 'parent_id', - 'refClass' => 'UserReference' - ); - - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - } -} -class UserReference extends Doctrine_Record -{ - public function setTableDefinition() { - $this->hasColumn('parent_id', 'integer', null, array('primary' => true)); - $this->hasColumn('child_id', 'integer', null, array('primary' => true)); - } -} - -++++ Equal nest relations - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasMany('User as Friend', array('local' => 'user1', - 'foreign' => 'user2', - 'refClass' => 'UserReference' - 'equal' => true, - ); - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - } -} -class UserReference extends Doctrine_Record -{ - public function setTableDefinition() { - $this->hasColumn('user1', 'integer', null, array('primary' => true)); - $this->hasColumn('user2', 'integer', null, array('primary' => true)); - } -} - - -++ Inheritance -+++ One table, many classes - -When it comes to handling inheritance Doctrine is very smart. In the following example we have one database table called {{entity}}. Users and groups are both entities and they share the same database table. The only thing we have to make is 3 records ({{Entity}}, {{Group}} and {{User}}). - -Doctrine is smart enough to know that the inheritance type here is one-table-many-classes. - - -class Entity extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - $this->hasColumn('username', 'string', 20); - $this->hasColumn('password', 'string', 16); - $this->hasColumn('created', 'integer', 11); - } -} - -class User extends Entity -{ } - -class Group extends Entity -{ } - - - -+++ One table, one class - -One-table-one-class inheritance is the only inheritance type that allows additional fields for inherited classes. As shown in the example above adding additional columns is very easy: - - -class TextItem extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('topic', 'string', 100); - } -} - -class Comment extends TextItem -{ - public function setTableDefinition() - { - parent::setTableDefinition(); - - $this->hasColumn('content', 'string', 300); - } -} - - - -In one-table-one-class inheritance you don't necessarily have to define additional columns, but in order to make Doctrine create separate tables for each class you'll have to make iterative setTableDefinition() calls. - -In the following example we have three database tables called {{entity}}, {{user}} and {{group}}. Users and groups are both entities. The only thing we have to do is write 3 classes ({{Entity}}, {{Group}} and {{User}}) and make iterative {{setTableDefinition}} method calls. - - -class Entity extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - $this->hasColumn('username', 'string', 20); - $this->hasColumn('password', 'string', 16); - $this->hasColumn('created', 'integer', 11); - } -} - -class User extends Entity -{ - public function setTableDefinition() - { - // the following method call is needed in - // one-table-one-class inheritance - parent::setTableDefinition(); - } -} - -class Group extends Entity -{ - public function setTableDefinition() - { - // the following method call is needed in - // one-table-one-class inheritance - parent::setTableDefinition(); - } -} - - - -+++ Column aggregation - -In the following example we have one database table called {{entity}}. Users and groups are both entities and they share the same database table. - -The entity table has a column called {{type}} which tells whether an entity is a group or a user. Then we decide that users are type 1 and groups type 2. - -The only thing we have to do is to create 3 records (the same as before) and add -call the {{Doctrine_Table::setSubclasses()}} method from the parent class. - - -class Entity extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - $this->hasColumn('username', 'string', 20); - $this->hasColumn('password', 'string', 16); - $this->hasColumn('created', 'integer', 11); - - // this column is used for column - // aggregation inheritance - $this->hasColumn('type', 'integer', 11); - $this->setSubclasses(array( - "User" => array("type" => 1), - "Group" => array("type" => 2) - )); - } -} - -class User extends Entity {} -class Group extends Entity {} - - - -This feature also enable us to query the {{Entity}} table and get a {{User}} or -{{Group}} object back if the returned object matches the constraints set in the -parent class. See the code example below for an example of this. - - -$user = new User(); -$user->name = 'Bjarte S. Karlsen'; -$user->username = 'meus'; -$user->password = 'rat'; -$user->save(); - -$group = new Group(); -$group->name = 'Users'; -$group->username = 'users'; -$group->password = 'password'; -$group->save(); - -$q = new Doctrine_Query(); -$user = $q->from('Entity')->where('id=?')->execute(array($user->id))->getFirst(); -assert($user instanceOf User); - -$q = new Doctrine_Query(); -$group = $q->from('Entity')->where('id=?')->execute(array($group->id))->getFirst(); -assert($group instanceOf Group); - - -++ Foreign key constraints -+++ Introduction - -A foreign key constraint specifies that the values in a column (or a group of columns) must match the values appearing in some row of another table. In other words foreign key constraints maintain the referential integrity between two related tables. - -Say you have the product table with the following definition: - - -class Product extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', null, 'primary'); - $this->hasColumn('name', 'string'); - $this->hasColumn('price', 'decimal', 18); - } -} - - -Let's also assume you have a table storing orders of those products. We want to ensure that the order table only contains orders of products that actually exist. So we define a foreign key constraint in the orders table that references the products table: - - -class Order extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('order_id', 'integer', null, 'primary'); - $this->hasColumn('product_id', 'integer'); - $this->hasColumn('quantity', 'integer'); - } - public function setUp() - { - $this->hasOne('Product', array('local' => 'product_id', 'foreign' => 'id')); - - // foreign key columns should *always* have indexes - - $this->index('product_id', array('fields' => 'product_id')); - } -} - - -When exported the class {{Order}} would execute the following SQL: - - -CREATE TABLE orders ( - order_id integer PRIMARY KEY, - product_id integer REFERENCES products (id), - quantity integer, - INDEX product_id_idx (product_id) -) - - -Now it is impossible to create orders with product_no entries that do not appear in the products table. - -We say that in this situation the orders table is the referencing table and the products table is the referenced table. Similarly, there are referencing and referenced columns. - - -+++ Integrity actions - -//CASCADE//: -Delete or update the row from the parent table and automatically delete or update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported. Between two tables, you should not define several ON UPDATE CASCADE clauses that act on the same column in the parent table or in the child table. - -//SET NULL// : -Delete or update the row from the parent table and set the foreign key column or columns in the child table to NULL. This is valid only if the foreign key columns do not have the NOT NULL qualifier specified. Both ON DELETE SET NULL and ON UPDATE SET NULL clauses are supported. - -//NO ACTION// : -In standard SQL, NO ACTION means no action in the sense that an attempt to delete or update a primary key value is not allowed to proceed if there is a related foreign key value in the referenced table. - -//RESTRICT// : -Rejects the delete or update operation for the parent table. NO ACTION and RESTRICT are the same as omitting the ON DELETE or ON UPDATE clause. - -//SET DEFAULT// : - -In the following example we define two classes, User and Phonenumber with their relation being one-to-many. We also add a foreign key constraint with onDelete cascade action. This means that everytime a users is being deleted its associated phonenumbers will also be deleted. - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 50); - $this->hasColumn('loginname', 'string', 20); - $this->hasColumn('password', 'string', 16); - } - public function setUp() - { - $this->index('id', array('fields' => 'id')); - - $this->hasMany('Phonenumber', array('local' => 'id', - 'foreign' => 'user_id')); - } -} -class Phonenumber extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('phonenumber', 'string', 50); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() - { - $this->index('product_id', array('fields' => 'user_id')); - - $this->hasMany('User', array('local' => 'user_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} - diff --git a/manual/docs/en/migration.txt b/manual/docs/en/migration.txt deleted file mode 100644 index 8036f337b..000000000 --- a/manual/docs/en/migration.txt +++ /dev/null @@ -1,178 +0,0 @@ -The Doctrine Migration tools allow you to migrate databases and it issues alter table statements directly to your databases when you need to deploy database changes. - -++ Writing Migration Classes - -Migration classes consist of a simple class that extends from Doctrine_Migration. You can define a public up() and down() method that is meant for doing and undoing changes to a database for that migration step. The class name is completely arbitrary, but the name of the file which contains the class must have a prefix containing the number it represents in the migration process. Example: XXX_representative_name.class.php - - -// 001_add_table.class.php -class AddTable extends Doctrine_Migration -{ - public function up() - { - $this->createTable('migration_test', array('field1' => array('type' => 'string'))); - } - - public function down() - { - $this->dropTable('migration_test'); - } -} - -// 002_add_column.class.php -class AddColumn extends Doctrine_Migration -{ - public function up() - { - $this->addColumn('migration_test', 'field1', 'string'); - } - - public function down() - { - $this->renameColumn('migration_test', 'field1', 'field2'); - } -} - -// 003_change_column.class.php -class ChangeColumn extends Doctrine_Migration -{ - public function up() - { - $this->changeColumn('migration_test', 'field1', 'integer'); - } - - public function down() - { - $this->changeColumn('migration_test', 'field1', 'string'); - } -} - - -+++ Methods - -Here is a list of the available methods you can use to alter your database in your migration classes - - -public function createTable($tableName, array $fields = array(), array $options = array()) -public function dropTable($tableName) -public function renameTable($oldTableName, $newTableName) -public function addColumn($tableName, $columnName, $type, array $options = array()) -public function renameColumn($tableName, $oldColumnName, $newColumnName) -public function changeColumn($tableName, $columnName, $type, array $options = array()) -public function removeColumn($tableName, $columnName) -public function addIndex($tableName, $indexName, array $options = array()) -public function removeIndex($tableName, $indexName) -public function createConstraint($tableName, $constraintName, array $definition) -public function dropConstraint($tableName, $constraintName, $primary = false) -public function createForeignKey($tableName, array $definition) -public function dropForeignKey($tableName, $fkName) - - - -+++ Altering Data - -You can alter table directly in your up() and down() methods like you normally would by creating new model instances and calling save() or creating queries and deleting data. - - -// XXX_add_user.class.php -class AddUser extends Doctrine_Migration -{ - public function up() - { - // Add new user - $user = new User(); - $user->loginname = 'jwage'; - $user->save(); - } - - public function down() - { - // Delete the user we added in the up - $query = new Doctrine_Query(); - $query->delete('User')->from('User u')->where('u.loginname = ?', 'jwage')->execute(); - - } -} - - -Since the functions for creating tables and columns in reality just set up the migration (no sql is executed until after the up() or down() function returns), if you wish to insert data into tables created in that step you should use one of the following functions: - - -public function preUp() -public function postUp() -public function preDown() -public function postDown() - - -In the case of an upward progression where version '5' of your schema you create a user table and would like to insert test data you would use the postUp() function as shown below, otherwise the insertion of the user record would happen before the creation of the table. - - -// 005_add_user.class.php -class AddUser extends Doctrine_Migration -{ - public function up() - { - $this->createTable('users',array( - 'id'=>array('type'=>'integer','primary'=>true,'autoincrement'=>true), - 'name'=>array('type'=>'string','length'=>32) - ), - array('indexes'=>array(),'primary'=>array(0=>'id')); - } - - public function postUp() - { - // Add new user - $user = new User(); - $user->name = 'jwage'; - $user->save(); - } - - public function down() - { - // Effectively deletes the user we added in the up - $this->dropTable('users'); - } -} - - -++ Performing Migrations - - -$migration = new Doctrine_Migration('/path/to/migration_classes'); - -// Assume current version is 0 -$migration->migrate(3); // takes you from 0 to 3 -$migration->migrate(0); // takes you from 3 to 0 - -echo $migration->getCurrentVersion(); // 0 - - -++ Migration Notes - -Migrations aren't feature complete and still have many bugs, so the documentation below is from experience and will likely need to go away when everything is solidified. Migrations as of yet do not auto-create themselves based on changes to models or schema. Moving from one level to another will not modify or update your models. At this time It strictly allows you to move a project's DB or any copy of a project's DB between versions of a schema. If you move between one version and another, you'll have to modify either your schema or the models directly to match the current DB. This is obviously an incomplete feature as we hope to be able to use migrations to keep your schema and / or models in sync with the changes made in a migration step. - -When using migrations on an pre-existing project (particularly with symfony), there are tasks to create the initial migration classes. Last I checked it had a bug where the migration class files were not numbered correctly. The task should create one migration class for each table in your schema, and a single migration class for all the foreign keys. Since I prefer to have each migration perform one logical step, I move them all into one class. Thus my 001_create_tables.class, is very large and essentially does the same thing as the insert-sql task. In the case where you have already created the database, and it is populated with data, you will have to manually create the migration table within your database. Its a very simple table. Since your project already contains a database, you will also have to insert the starting version. In my case with all tables created in 001_create_tables.class.php I would do the following. - - -CREATE TABLE migration_version ( version INT ); -INSERT INTO migration_versiont (version) VALUES (1); - - -If you prefer the one operation per migration, you may be starting at step 9 or 30 or who knows. If you have no existing tables or data that you care to keep, you can drop all your existing tables and call the migration function to create all your initial tables. - -If you had to migrate a few steps down, you might get stuck between two migration steps if your model is out of sync with your table. -Assume that migration step 3 adds a new attribute to your model - and step 2 tries to access that model, you cannot migrate to step 3, because the table doesn't know about the new attribute: - -$migration = new Doctrine_Migration('/path/to/migration_classes'); - -// Current version is 3 -echo $migration->getCurrentVersion(); // 3 - -$migration->migrate(0); // takes you from 3 to 0 -$migration->migrate(3); // should take you from 0 to 3 but might throw an error if your model is out of sync - -echo $migration->getCurrentVersion(); // 1 - - -A simple workaround is to comment out the new attribute in your model file, migrate up stepwise and uncomment the attribute, when you're done. - \ No newline at end of file diff --git a/manual/docs/en/native-sql.txt b/manual/docs/en/native-sql.txt deleted file mode 100644 index cc2224a6b..000000000 --- a/manual/docs/en/native-sql.txt +++ /dev/null @@ -1,97 +0,0 @@ -++ Introduction - -Doctrine_RawSql provides convient interface for building raw sql queries. Similar to Doctrine_Query, Doctrine_RawSql provides means for fetching arrays and objects, the way you prefer. - -Using raw sql for fetching might be useful when you want to utilize database specific features such as query hints or the CONNECT keyword in Oracle. - -Creating Doctrine_RawSql object is easy: - - -$q = new Doctrine_RawSql(); - - -Optionally a connection parameter can be given: - - -$q = new Doctrine_RawSql($conn); // here $conn is an instance of Doctrine_Connection - - -++ Component queries - -The first thing to notice when using Doctrine_RawSql is that you always have to place the fields you are selecting in curly brackets {}. Also for every selected component you have to call addComponent(). - -The following example should clarify the usage of these: - - -$q = new Doctrine_RawSql(); - -$q->select('{u.*}') - ->from('user') - ->addComponent('user', 'User'); // here we tell that user table is bound to class called 'User' - -$users = $q->execute(); -$user[0]; // User object - - -Pay attention to following things: - -# Fields must be in curly brackets -# For every selected table there must be one addComponent call - - -++ Fetching from multiple components - -When fetching from multiple components the addComponent calls become a bit more complicated as not only do we have to tell which tables are bound to which components, we also have to tell the parser which components belongs to which. - -Consider the following model: - - -// file User.php -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 20); - } - public function setUp() - { - $this->hasMany('Phonenumber', array('local' => 'id', - 'foreign' => 'user_id')); - } -} -// file Phonenumber.php -class Phonenumber extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('phonenumber', 'string', 20); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() - { - $this->hasOne('User', array('local' => 'user_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} - - -In the following example we fetch all users and their phonenumbers: - - -$q = new Doctrine_RawSql(); - -$q->select('{u.*}, {p.*}') - ->from('user u LEFT JOIN phonenumber p ON u.id = p.user_id') - // here we tell that user table is bound to class called 'User' - // we also add an alias for User class called 'u' - // this alias will be used when referencing to User class - ->addComponent('u', 'User u') - // here we add another component that is bound to table phonenumber - // notice how we reference that the Phonenumber class is "User's phonenumber" - ->addComponent('p', 'u.Phonenumber p'); - - -$users = $q->execute(); -$users[0]; // User object - diff --git a/manual/docs/en/object-relational-mapping.txt b/manual/docs/en/object-relational-mapping.txt deleted file mode 100644 index bc1cf7d28..000000000 --- a/manual/docs/en/object-relational-mapping.txt +++ /dev/null @@ -1,7 +0,0 @@ -++ Introduction -++ Table and class naming -++ Table options -++ Columns -++ Constraints and validators -++ Record identifiers -++ Indexes diff --git a/manual/docs/en/plugins.txt b/manual/docs/en/plugins.txt deleted file mode 100644 index a10bf01ff..000000000 --- a/manual/docs/en/plugins.txt +++ /dev/null @@ -1,239 +0,0 @@ -This chapter describes the usage of various plugins availible for Doctrine. You'll also learn how to create your own plugins. In order to grasp the concepts of this chapter you should already be familiar with the theory behind Doctrine_Template and Doctrine_Record_Generator. When refering to plugins we refer to class packages that use templates, generators and listeners extensively. All the introduced components in this chapter can be considered 'core' plugins, that means they reside at the Doctrine main repository. There are other official plugins too which can be found at the homesite of the Sensei project (www.sensei-project.org). - -Usually plugins use generators side-to-side with template classes (classes that extend Doctrine_Template). The common workflow is: - -# A new template is being initiliazed -# The template creates the generator and calls initialize() method -# The template is attached to given class - -As you may already know templates are used for adding common definitions and options to record classes. The purpose of generators is much more complex. Usually they are being used for creating generic record classes dynamically. The definitions of these generic classes usually depend on the owner class. For example the columns of the auditlog versioning class are the columns of the parent class with all the sequence and autoincrement definitions removed. - - -++ Internationalization with I18n - -Doctrine_I18n package is a plugin for Doctrine that provides internationalization support for record classes. In the following example we have a NewsItem class with two fields 'title' and 'content'. We want to have the field 'title' with different languages support. This can be achieved as follows: - - -class NewsItem extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 200); - $this->hasColumn('content', 'string'); - } - - public function setUp() - { - $this->actAs('I18n', array('fields' => array('title'))); - } -} - - -Now the first time you initialize a new NewsItem record Doctrine initializes the plugin that builds the followings things: - -1. Record class called NewsItemTranslation -2. Bi-directional relations between NewsItemTranslation and NewsItem - -+++ Creating the I18n table - -The I18n table can be created as follows: - - -$conn->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL); - -$conn->export->exportClasses(array('NewsItem')); - - -The following code example executes two sql statements. When using mysql those statements would look like: - - -CREATE TABLE news_item (id INT NOT NULL AUTO_INCREMENT, content TEXT) -CREATE TABLE news_item_translation (id INT NOT NULL, title VARCHAR(200), lang VARCHAR(20)) - - -Notice how the field 'title' is not present in the news_item table. Since its present in the translation table it would be a waste of resources to have that same field in the main table. Basically Doctrine always automatically removes all translated fields from the main table. - -+++ Using I18n - -In the following example we add some data with finnish and english translations: - - -$item = new NewsItem(); -$item->content = 'This is some content. This field is not being translated.'; - -$item->Translation['FI']->title = 'Joku otsikko'; -$item->Translation['EN']->title = 'Some title'; -$item->save(); - - -Now lets find all items and their finnish translations: - - -$items = Doctrine_Query::create() - ->from('NewsItem n') - ->leftJoin('n.Translation t INDEXBY t.lang') - ->where('t.lang = ?') - ->execute(array('FI')); - -$items[0]->Translation['FI']->title; // 'joku otsikko' - - - -++ AuditLog and versioning -Doctrine_AuditLog provides a full versioning solution. Lets say we have a NewsItem class that we want to be versioned. This functionality can be applied by simply adding $this->actAs('Versionable') into your record setup. - - -class NewsItem extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 200); - $this->hasColumn('content', 'string'); - // the versioning plugin needs version column - $this->hasColumn('version', 'integer'); - } - - public function setUp() - { - $this->actAs('Versionable'); - } -} - - -Now when we have defined this record to be versionable, Doctrine does internally the following things: - -* It creates a class called NewsItemVersion on-the-fly, the table this record is pointing at is news_item_version -* Everytime a NewsItem object is deleted / updated the previous version is stored into news_item_version -* Everytime a NewsItem object is updated its version number is increased. - -+++ Creating the version table - -As with all other plugins, the plugin-table, in this case the table that holds the different versions, can be created by enabling Doctrine::EXPORT_PLUGINS. The easiest way to set this is by setting the value of Doctrine::ATTR_EXPORT to Doctrine::EXPORT_ALL. The following example shows the usage: - - -$conn->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL); - -$conn->export->exportClasses(array('NewsItem')); - - -The following code example executes two sql statements. When using mysql those statements would look like: - - -CREATE TABLE news_item (id INT NOT NULL AUTO_INCREMENT, title VARCHAR(200), content TEXT, version INTEGER) -CREATE TABLE news_item_version (id INT NOT NULL, title VARCHAR(200), content TEXT, version INTEGER) - - -+++ Using versioning - - -$newsItem = new NewsItem(); -$newsItem->title = 'No news is good news'; -$newsItem->content = 'All quiet on the western front'; - -$newsItem->save(); -$newsItem->version; // 1 - -$newsItem->title = 'A different title'; -$newsItem->save(); -$newsItem->version; // 2 - - -+++ Reverting changes - -Doctrine_Record provides a method called revert() which can be used for reverting to specified version. Internally Doctrine queries the version table and fetches the data for given version. If the given version is not found a Doctrine_Record_Exception is being thrown. - - -$newsItem->revert(1); - -$newsItem->title; // No news is good news - - -+++ Advanced usage - -There are many options for the versioning plugin. Sometimes you may want to use other version column than 'version'. This can be achieved by giving the options parameter to actAs() method. - - -class NewsItem extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 200); - $this->hasColumn('content', 'string'); - // the versioning plugin needs version column - $this->hasColumn('news_version', 'integer'); - } - - public function setUp() - { - $this->actAs('Versionable', array('versionColumn' => 'news_version')); - } -} - - -You can also control the name of the versioning record and the name of the version table with option attributes 'className' and 'tableName'. - -++ Soft-delete - -Soft-delete is a very simple plugin for achieving the following behaviour: when a record is deleted its not removed from database. Usually the record contains some special field like 'deleted' which tells the state of the record (deleted or alive). - -The following code snippet shows what you need in order to achieve this kind of behaviour. Notice how we define two event hooks: preDelete and postDelete. Also notice how the preDelete hook skips the actual delete-operation with skipOperation() call. For more info about the event hooks see chapter [doc event-listeners :index :name]. - - -class SoftDeleteTest extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', null, array('primary' => true)); - $this->hasColumn('deleted', 'boolean', 1); - } - public function preDelete($event) - { - $event->skipOperation(); - } - public function postDelete($event) - { - $this->deleted = true; - $this->save(); - } -} - - -Now lets put the plugin in action: - - - -// save a new record -$record = new SoftDeleteTest(); -$record->name = 'new record'; -$record->save(); - -$record->delete(); -var_dump($record->deleted); // true - - -++ Creating plugins - -This subchapter provides you the means for creating your own plugins. Lets say we have various different Record classes that need to have one-to-many emails. We achieve this functionality by creating a generic plugin which creates Email classes on the fly. - -We start this task by creating a plugin called EmailPlugin with buildDefinition() method. Inside the buildDefinition() method various helper methods can be used for easily creating the dynamic record definition. Commonly the following methods are being used: - -# buildForeignKeys() - - -class EmailPlugin extends Doctrine_Record_Generator -{ - public function initOptions() - { - $this->setOption('className', '%CLASS%Email'); - } - - public function setTableDefinition() - { - $this->hasColumn('address', 'string', 255, array('email' => true, - 'primary' => true)); - } -} - - -++ Nesting plugins - diff --git a/manual/docs/en/real-world-examples.txt b/manual/docs/en/real-world-examples.txt deleted file mode 100644 index ab9b6732f..000000000 --- a/manual/docs/en/real-world-examples.txt +++ /dev/null @@ -1,3 +0,0 @@ -++ User management system -++ Forum application -++ Album lister diff --git a/manual/docs/en/real-world-examples/album-lister.txt b/manual/docs/en/real-world-examples/album-lister.txt deleted file mode 100644 index 8b1378917..000000000 --- a/manual/docs/en/real-world-examples/album-lister.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/manual/docs/en/real-world-examples/forum-application.txt b/manual/docs/en/real-world-examples/forum-application.txt deleted file mode 100644 index b81dfaf1f..000000000 --- a/manual/docs/en/real-world-examples/forum-application.txt +++ /dev/null @@ -1,53 +0,0 @@ - - -class Forum_Category extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn("root_category_id", "integer", 10); - $this->hasColumn("parent_category_id", "integer", 10); - $this->hasColumn("name", "string", 50); - $this->hasColumn("description", "string", 99999); - } - public function setUp() { - $this->hasMany("Forum_Category as Subcategory", "Subcategory.parent_category_id"); - $this->hasOne("Forum_Category as Rootcategory", "Forum_Category.root_category_id"); - } -} -class Forum_Board extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn("category_id", "integer", 10); - $this->hasColumn("name", "string", 100); - $this->hasColumn("description", "string", 5000); - } - public function setUp() { - $this->hasOne("Forum_Category as Category", "Forum_Board.category_id"); - $this->ownsMany("Forum_Thread as Threads", "Forum_Thread.board_id"); - } -} - -class Forum_Entry extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn("author", "string", 50); - $this->hasColumn("topic", "string", 100); - $this->hasColumn("message", "string", 99999); - $this->hasColumn("parent_entry_id", "integer", 10); - $this->hasColumn("thread_id", "integer", 10); - $this->hasColumn("date", "integer", 10); - } - public function setUp() { - $this->hasOne("Forum_Entry as Parent", "Forum_Entry.parent_entry_id"); - $this->hasOne("Forum_Thread as Thread", "Forum_Entry.thread_id"); - } -} - -class Forum_Thread extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn("board_id", "integer", 10); - $this->hasColumn("updated", "integer", 10); - $this->hasColumn("closed", "integer", 1); - } - public function setUp() { - $this->hasOne("Forum_Board as Board", "Forum_Thread.board_id"); - $this->ownsMany("Forum_Entry as Entries", "Forum_Entry.thread_id"); - } -} - diff --git a/manual/docs/en/real-world-examples/user-management-system.txt b/manual/docs/en/real-world-examples/user-management-system.txt deleted file mode 100644 index 8b1378917..000000000 --- a/manual/docs/en/real-world-examples/user-management-system.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/manual/docs/en/relations.txt b/manual/docs/en/relations.txt deleted file mode 100644 index a6a750b10..000000000 --- a/manual/docs/en/relations.txt +++ /dev/null @@ -1,693 +0,0 @@ -++ Introduction - -In Doctrine all record relations are being set with {{hasMany}}, {{hasOne}} methods. Doctrine supports almost all kinds of database relations from simple one-to-one foreign key relations to join table self-referencing relations. - -Unlike the column definitions the {{hasMany}} and {{hasOne}} methods are placed within a method called setUp(). Both methods take two arguments: the first argument is a string containing the name of the class and optional alias, the second argument is an array consisting of relation options. The option array contains the following keys: - -* **local**, the local field of the relation. Local field is the linked field or fields in the defining class. -* **foreign**, the foreign field of the relation. Foreign field is the linked field or fields in the linked class. -* **refClass**, the name of the reference / join class. This is needed for many-to-many associations. -* **onDelete**, the onDelete integrity action. -* **onUpdate**, the onUpdate integrity action. - -So lets take our first example, say we have two classes Forum_Board and Forum_Thread. Here Forum_Board has many Forum_Threads, hence their relation is one-to-many. We don't want to write Forum_ when accessing relations, so we use relation aliases and use the alias Threads. - -First lets take a look at the Forum_Board class. It has three columns: name, description and since we didn't specify any primary key, Doctrine auto-creates an id column for it. - -We define the relation to the Forum_Thread class by using the hasMany() method. Here the local field is the primary key of the board class whereas the foreign field is the board_id field of the Forum_Thread class. - - -class Forum_Board extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 100); - $this->hasColumn('description', 'string', 5000); - } - public function setUp() - { - // notice the 'as' keyword here - $this->hasMany('Forum_Thread as Threads', array('local' => 'id', - 'foreign' => 'board_id')); - } -} - - -Then lets have a peek at the Forum_Thread class. The columns here are irrelevant, but pay attention to how we define the relation. Since each Thread can have only one Board we are using the hasOne() method. Also notice how we once again use aliases and how the local column here is board_id while the foreign column is the id column. - - -class Forum_Thread extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('board_id', 'integer', 10); - $this->hasColumn('title', 'string', 200); - $this->hasColumn('updated', 'integer', 10); - $this->hasColumn('closed', 'integer', 1); - } - public function setUp() - { - // notice the 'as' keyword here - $this->hasOne('Forum_Board as Board', array('local' => 'board_id', - 'foreign' => 'id')); - } -} - - -Now we can start using these classes. The same accessors that you've already used for properties are all availible for relations. - - -// first create a board -$board = new Forum_Board(); -$board->name = 'Some board'; - -// lets create a new thread -$board->Thread[0]->title = 'new thread'; - -// save the changes -$board->save(); - - -++ Foreign key associations -+++ One-To-One - -One-to-one relations are propably the most basic relations. In the following example we have two classes, User and Email with their relation being one-to-one. - -First lets take a look at the Email class. Since we are binding a one-to-one relationship we are using the hasOne() method. Notice how we define the foreign key column (user_id) in the Email class. This is due to a fact that Email is owned by the User class and not the other way around. In fact you should always follow this convention - always place the foreign key in the owned class. - -The recommended naming convention for foreign key columns is: [tableName]_[primaryKey]. As here the foreign table is 'user' and its primary key is 'id' we have named the foreign key column as 'user_id'. - - -class Email extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('user_id', 'integer'); - $this->hasColumn('address', 'string', 150); - } - public function setUp() - { - $this->hasOne('User', array('local' => 'user_id', 'foreign' => 'id')); - } -} - - -The User class is very similar to the Email class. Notice how the local and foreign columns are switched in the hasOne() definition compared to the definition of the Email class. - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string',50); - $this->hasColumn('loginname', 'string',20); - $this->hasColumn('password', 'string',16); - } - public function setUp() - { - $this->hasOne('Email', array('local' => 'id', 'foreign' => 'user_id')); - } -} - - - -+++ One-to-Many, Many-to-One - -One-to-Many and Many-to-One relations are very similar to One-to-One relations. The recommended conventions you came in terms with in the previous chapter also apply to one-to-many and many-to-one relations. - -In the following example we have two classes: User and Phonenumber. We define their relation as one-to-many (a user can have many phonenumbers). Here once again the Phonenumber is clearly owned by the User so we place the foreign key in the Phonenumber class. - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasMany('Phonenumber', array('local' => 'id', 'foreign' => 'user_id')); - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 50); - $this->hasColumn('loginname', 'string', 20); - $this->hasColumn('password', 'string', 16); - } -} -class Phonenumber extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('phonenumber', 'string', 50); - $this->hasColumn('user_id', 'integer'); - } -} - - - -+++ Tree structure - -A tree structure is a self-referencing foreign key relation. The following definition is also called Adjacency List implementation in terms of hierarchical data concepts. - -However this mainly just serves as an example how the self-referencing can be done. The definition above is rarely a good way of expressing hierarchical data, hence you should take a look at chapter [doc hierarchical-data :index :name] for how to set up efficient parent/child relations. - - -class Task extends Doctrine_Record -{ - public function setUp() - { - $this->hasOne('Task as Parent', array('local' => 'parent_id', 'foreign' => 'id')); - $this->hasMany('Task as Subtask', array('local' => 'id', 'foreign' => 'parent_id')); - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 100); - $this->hasColumn('parent_id', 'integer'); - } -} - - -++ Join table associations - -+++ Many-to-Many - -If you are coming from relational database background it may be familiar to you how many-to-many associations are handled: an additional association table is needed. - -In many-to-many relations the relation between the two components is always an aggregate relation and the association table is owned by both ends. For example in the case of users and groups: when a user is being deleted, the groups he/she belongs to are not being deleted. However, the associations between this user and the groups he/she belongs to are instead being deleted. This removes the relation between the user and the groups he/she belonged to, but does not remove the user nor the groups. - -Sometimes you may not want that association table rows are being deleted when user / group is being deleted. You can override this behaviour by setting the relations to association component (in this case {{Groupuser}}) explicitly. - -In the following example we have Groups and Users of which relation is defined as many-to-many. In this case we also need to define an additional class called {{Groupuser}}. - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasMany('Group', array('local' => 'user_id', // <- these are the column names - 'foreign' => 'group_id', // <- in the association table - // the following line is needed in many-to-many relations! - 'refClass' => 'GroupUser')); - - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - } -} - -class Group extends Doctrine_Record -{ - public function setUp() { - $this->hasMany('User', array('local' => 'group_id', // <- these are the column names - 'foreign' => 'user_id', // <- in the association table - // the following line is needed in many-to-many relations! - 'refClass' => 'GroupUser')); - - //group is reserved keyword so either do this or enable ATTR_QUOTE_IDENTIFIERS - $this->setTableName('my_group'); - } - public function setTableDefinition() { - $this->hasColumn('name', 'string', 30); - } -} - -class GroupUser extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('user_id', 'integer', null, array('primary' => true)); - $this->hasColumn('group_id', 'integer', null, array('primary' => true)); - } -} - - -$user = new User(); - -// add two groups -$user->Group[0]->name = 'First Group'; - -$user->Group[1]->name = 'Second Group'; - -// save changes into database -$user->save(); - -// deleting the associations between user and groups it belongs to - -$user->Groupuser->delete(); - -$groups = new Doctrine_Collection($conn->getTable('Group')); - -$groups[0]->name = 'Third Group'; - -$groups[1]->name = 'Fourth Group'; - -$user->Group[2] = $groups[0]; -// $user will now have 3 groups - -$user->Group = $groups; -// $user will now have two groups 'Third Group' and 'Fourth Group' - - - - -+++ Self-referencing (Nest relations) -++++ Non-equal nest relations - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasMany('User as Parents', array('local' => 'parent_id', - 'foreign' => 'child_id', - 'refClass' => 'UserReference' - )); - - $this->hasMany('User as Children', array('local' => 'child_id', - 'foreign' => 'parent_id', - 'refClass' => 'UserReference' - )); - - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - } -} -class UserReference extends Doctrine_Record -{ - public function setTableDefinition() { - $this->hasColumn('parent_id', 'integer', null, array('primary' => true)); - $this->hasColumn('child_id', 'integer', null, array('primary' => true)); - } -} - -++++ Equal nest relations - -Equal nest relations are perfectly suitable for expressing relations where a class references to itself and the columns within the reference class are equal. - -This means that when fetching related records it doesn't matter which column in the reference class has the primary key value of the main class. - -The previous clause maybe hard to understand so lets take an example. We define a class called user which can have many friends. Notice here how we use the 'equal' option. - - -class User extends Doctrine_Record -{ - public function setUp() - { - $this->hasMany('User as Friend', array('local' => 'user1', - 'foreign' => 'user2', - 'refClass' => 'UserReference', - 'equal' => true, - )); - } - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - } -} -class UserReference extends Doctrine_Record -{ - public function setTableDefinition() { - $this->hasColumn('user1', 'integer', null, array('primary' => true)); - $this->hasColumn('user2', 'integer', null, array('primary' => true)); - } -} - - -Now lets define 4 users: Jack Daniels, John Brandy, Mikko Koskenkorva and Stefan Beer with Jack Daniels and John Brandy being buddies and Mikko Koskenkorva being the friend of all of them. - - -$daniels = new User(); -$daniels->name = 'Jack Daniels'; - -$brandy = new User(); -$brandy->name = 'John Brandy'; - -$koskenkorva = new User(); -$koskenkorva->name = 'Mikko Koskenkorva'; - -$beer = new User(); -$beer->name = 'Stefan Beer'; - -$daniels->Friend[0] = $brandy; - -$koskenkorva->Friend[0] = $daniels; -$koskenkorva->Friend[1] = $brandy; -$koskenkorva->Friend[2] = $beer; - -$conn->flush(); - - -Now if we access for example the friends of John Beer it would return one user 'Mikko Koskenkorva'. - - -++ Inheritance - -Doctrine supports 4 types of inheritance strategies which can be mixed together. - -+++ Simple inheritance - -Simple inheritance is the simpliest inheritance. In simple inheritance all the child classes share the same columns as the parent. - - -class Entity extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - $this->hasColumn('username', 'string', 20); - $this->hasColumn('password', 'string', 16); - $this->hasColumn('created', 'integer', 11); - } -} - -class User extends Entity -{ } - -class Group extends Entity -{ } - - -+++ Class table inheritance - -Class table inheritance is the basic inheritance type, yet its internally the most complex one. Class table inheritance allows the child classes to have additional columns compared with the parent. - -Internally the parent and the child classes are stored in separate tables, with parent and children containing only their own distinct columns and the shared primary key column(s). - -Consider the following class definition. - - -class Entity extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 100); - } -} - -class User extends Entity -{ - public function setTableDefinition() - { - $this->hasColumn('age', 'integer', 2); - $this->hasColumn('password', 'string', 16); - } -} - - -When class 'User' is being exported into mysql database Doctrine would issue the following queries: - - -CREATE TABLE entity (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY(id)) -CREATE TABLE user (id INT NOT NULL, age INT, password VARCHAR(16), PRIMARY KEY(id)) - - -Notice how only the parent has the auto-incremented id column. When no primary keys are set for the entire inheritance tree this is the default strategy Doctrine uses. When setting the primary keys manually all classes in the inheritance tree should share the same primary key definition, with the exception of autoinc/sequential primary key. In class table inheritance only the tree root can contain autoinc/sequential pk . - -Whenever you fetch data with DQL from a class that uses class table inheritance, Doctrine is smart enough to produce the necessary joins. Lets say we want to fetch all users with their name starting with letter A. - - -$q = new Doctrine_Query(); - -$users = $q->from('User u')->where("u.name LIKE 'A%'")->execute(); - - -Now Doctrine would issue the following query: - - -SELECT ... FROM user u LEFT JOIN entity e ON u.id = e.id WHERE u.name LIKE 'A%' - - -Doctrine also knows how to perform other operations as multi-table operations. Creating and saving a new user will actually execute two INSERT statements as seen above. Notice how Doctrine is smart enough to attach the newly created entity id for the user record. - - -$user = new User(); -$user->age = 13; -$user->password = 'secret'; -$user->name = 'someone'; - -$user->save(); - - -Executes: - -INSERT INTO entity (name) VALUES ('someone') -INSERT INTO user (id, age, password) VALUES (1, 13, 'secret') - - -The updates and deletes are also performed to span accross multiple tables. Consider the following example: - - -$user->age = 14; -$user->password = 'newpassword'; -$user->name = 'newname'; - -$user->save(); - -$user->delete(); - - -The example would execute the following statements: - -UPDATE entity SET name = 'newname' WHERE id = 1 -UPDATE user SET age = 14, password = 'newpassword' WHERE id = 1 - -DELETE FROM entity WHERE id = 1 -DELETE FROM user WHERE id = 1 - - - - - -+++ Concrete inheritance - -Concrete inheritance is similar to class table inheritance in a way that it creates separate tables for child classes. However in concrete inheritance each class generates a table which contains all columns (including inherited columns). In order to use concrete inheritance instead of the default class table inheritance you'll need to add explicit parent::setTableDefinition() calls to child classes as shown above. - - -class TextItem extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('topic', 'string', 100); - } -} - -class Comment extends TextItem -{ - public function setTableDefinition() - { - parent::setTableDefinition(); - - $this->hasColumn('content', 'string', 300); - } -} - - - -In concrete inheritance you don't necessarily have to define additional columns, but in order to make Doctrine create separate tables for each class you'll have to make iterative setTableDefinition() calls. - -In the following example we have three database tables called {{entity}}, {{user}} and {{group}}. Users and groups are both entities. The only thing we have to do is write 3 classes ({{Entity}}, {{Group}} and {{User}}) and make iterative {{setTableDefinition}} method calls. - - -class Entity extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - $this->hasColumn('username', 'string', 20); - $this->hasColumn('password', 'string', 16); - $this->hasColumn('created', 'integer', 11); - } -} - -class User extends Entity -{ - public function setTableDefinition() - { - // the following method call is needed in - // one-table-one-class inheritance - parent::setTableDefinition(); - } -} - -class Group extends Entity -{ - public function setTableDefinition() - { - // the following method call is needed in - // one-table-one-class inheritance - parent::setTableDefinition(); - } -} - - -Even though concrete inheritance duplicates schema definitions its in many cases much better inheritance strategy to use than class table inheritance. In class table inheritance an inheritance tree of depth N uses N number of joins for SELECTs and executes N number of statements for each manipulation operation whereas in concrete inheritance every operation can be invoked by single statement. - - -+++ Column aggregation inheritance - -In the following example we have one database table called {{entity}}. Users and groups are both entities and they share the same database table. - -The entity table has a column called {{type}} which tells whether an entity is a group or a user. Then we decide that users are type 1 and groups type 2. - -The only thing we have to do is to create 3 records (the same as before) and add -call the {{Doctrine_Table::setSubclasses()}} method from the parent class. - - -class Entity extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 30); - $this->hasColumn('username', 'string', 20); - $this->hasColumn('password', 'string', 16); - $this->hasColumn('created', 'integer', 11); - - // this column is used for column - // aggregation inheritance - $this->hasColumn('type', 'integer', 11); - $this->setSubclasses(array( - 'User' => array('type' => 1), - 'Group' => array('type' => 2) - )); - } -} - -class User extends Entity {} -class Group extends Entity {} - - - -This feature also enable us to query the {{Entity}} table and get a {{User}} or -{{Group}} object back if the returned object matches the constraints set in the -parent class. See the code example below for an example of this. - - -$user = new User(); -$user->name = 'Bjarte S. Karlsen'; -$user->username = 'meus'; -$user->password = 'rat'; -$user->save(); - -$group = new Group(); -$group->name = 'Users'; -$group->username = 'users'; -$group->password = 'password'; -$group->save(); - -$q = new Doctrine_Query(); -$user = $q->from('Entity')->where('id = ?')->fetchOne(array($user->id)); -assert($user instanceOf User); - -$q = new Doctrine_Query(); -$group = $q->from('Entity')->where('id = ?')->fetchOne(array($group->id)); -assert($group instanceOf Group); - - -++ Foreign key constraints -+++ Introduction - -A foreign key constraint specifies that the values in a column (or a group of columns) must match the values appearing in some row of another table. In other words foreign key constraints maintain the referential integrity between two related tables. - -Say you have the product table with the following definition: - - -class Product extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', null, 'primary'); - $this->hasColumn('name', 'string'); - $this->hasColumn('price', 'decimal', 18); - } -} - - -Let's also assume you have a table storing orders of those products. We want to ensure that the order table only contains orders of products that actually exist. So we define a foreign key constraint in the orders table that references the products table: - - -class Order extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('order_id', 'integer', null, 'primary'); - $this->hasColumn('product_id', 'integer'); - $this->hasColumn('quantity', 'integer'); - } - public function setUp() - { - $this->hasOne('Product', array('local' => 'product_id', 'foreign' => 'id')); - - // foreign key columns should *always* have indexes - - $this->index('product_id', array('fields' => 'product_id')); - } -} - - -When exported the class {{Order}} would execute the following SQL: - - -CREATE TABLE orders ( - order_id integer PRIMARY KEY, - product_id integer REFERENCES products (id), - quantity integer, - INDEX product_id_idx (product_id) -) - - -Now it is impossible to create orders with product_no entries that do not appear in the products table. - -We say that in this situation the orders table is the referencing table and the products table is the referenced table. Similarly, there are referencing and referenced columns. - - -+++ Integrity actions - -//CASCADE//: -Delete or update the row from the parent table and automatically delete or update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported. Between two tables, you should not define several ON UPDATE CASCADE clauses that act on the same column in the parent table or in the child table. - -//SET NULL// : -Delete or update the row from the parent table and set the foreign key column or columns in the child table to NULL. This is valid only if the foreign key columns do not have the NOT NULL qualifier specified. Both ON DELETE SET NULL and ON UPDATE SET NULL clauses are supported. - -//NO ACTION// : -In standard SQL, NO ACTION means no action in the sense that an attempt to delete or update a primary key value is not allowed to proceed if there is a related foreign key value in the referenced table. - -//RESTRICT// : -Rejects the delete or update operation for the parent table. NO ACTION and RESTRICT are the same as omitting the ON DELETE or ON UPDATE clause. - -//SET DEFAULT// : - -In the following example we define two classes, User and Phonenumber with their relation being one-to-many. We also add a foreign key constraint with onDelete cascade action. This means that everytime a users is being deleted its associated phonenumbers will also be deleted. - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 50); - $this->hasColumn('loginname', 'string', 20); - $this->hasColumn('password', 'string', 16); - } - public function setUp() - { - $this->index('id_idx', array('fields' => 'id')); - - $this->hasMany('Phonenumber', array('local' => 'id', - 'foreign' => 'user_id')); - } -} -class Phonenumber extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('phonenumber', 'string', 50); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() - { - $this->index('user_id_idx', array('fields' => 'user_id')); - - $this->hasOne('User', array('local' => 'user_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} - diff --git a/manual/docs/en/schema-files.txt b/manual/docs/en/schema-files.txt deleted file mode 100644 index 80db02285..000000000 --- a/manual/docs/en/schema-files.txt +++ /dev/null @@ -1,349 +0,0 @@ -++ Introduction - -The purpose of schema files is to allow you to manage your model definitions directly from a yaml file rather then editing php code. The yaml schema file is parsed and used to generate all your model definitions/classes. This makes Doctrine model definitions much more portable. - -Schema files support all the normal things you would write with manual php code. Component to connection binding, relationships, attributes, templates/behaviors, indexes, etc. - -++ Relationships - -When specifying relationships it is only necessary to specify the relationship on the end where the foreign key exists, although both ways are supported. - -+++ One to One - - ---- -User: - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - username: - type: string(255) - password: - type: string(255) - relations: - Contact: - foreignType: one -Contact: - columns: - id: - type: integer(4) - primary: true - autoincrement: true - name: - type: string(255) - - -+++ One to Many - - ---- -User: - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - username: - type: string(255) - password: - type: string(255) -Phonenumber: - columns: - id: - type: integer(4) - primary: true - autoincrement: true - name: - type: string(255) - user_id: - type: integer(4) - relations: - User: - foreignAlias: Phonenumbers - - -+++ Many to Many - - -User: - columns: - id: - type: integer(4) - autoincrement: true - primary: true - username: - type: string(255) - password: - type: string(255) - attributes: - export: all - validate: true -Group: - tableName: group_table - columns: - id: - type: integer(4) - autoincrement: true - primary: true - name: - type: string(255) - relations: - Users: - foreignAlias: Groups - class: User - refClass: GroupUser -GroupUser: - columns: - group_id: - type: integer(4) - primary: true - user_id: - type: integer(4) - primary: true - - -+++ One to One Aggregate - - ---- -User: - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - username: - type: string(255) - password: - type: string(255) - relations: - Contact: - foreignType: one - onDelete: CASCADE -Contact: - columns: - id: - type: integer(4) - primary: true - autoincrement: true - name: - type: string(255) - - -++ Connection Binding - - -Doctrine::connection('mysql://user:pass@localhost/connection1', 'connection1'); - - - ---- -User: - connection: connection1 - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - username: - type: string(255) - password: - type: string(255) - - -++ Attributes - - ---- -User: - connection: connection1 - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - username: - type: string(255) - password: - type: string(255) - attributes: - export: none - validate: false - - -++ Enums - - ---- -TvListing: - tableName: tv_listing - actAs: [Timestampable] - columns: - notes: - type: string - taping: - type: enum - length: 4 - values: ['live', 'tape'] - region: - type: enum - length: 4 - values: ['US', 'CA'] - - -++ Templates - - ---- -User: - connection: connection1 - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - username: - type: string(255) - password: - type: string(255) - templates: - MyCustomTemplate - option1: value - option2: value - - -++ ActAs - - ---- -User: - connection: connection1 - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - username: - type: string(255) - password: - type: string(255) - actAs: - Sluggable: - fields: [username] - - -++ Options - - ---- -User: - connection: connection1 - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - username: - type: string(255) - password: - type: string(255) - options: - type: INNODB - collate: utf8_unicode_ci - charset: utf8 - - -++ Indexes - -Please see chapter [doc basic-schema-mapping :index :name] for more information about indexes and their options. - -schema.yml - ---- -UserProfile: - columns: - user_id: - type: integer - length: 4 - primary: true - autoincrement: true - first_name: - type: string - length: 20 - last_name: - type: string - length: 20 - indexes: - name_index: - fields: - first_name: - sorting: ASC - length: 10 - primary: true - last_name: [] - type: unique - - -This is the PHP line of code that is auto-generated inside setTableDefinition() inside your base model class. - - -$this->index('name_index', array('fields' => array('first_name' => array( 'sorting' => 'ASC', 'length' => '10', 'primary' => true ), 'last_name' => array( ) ), 'type' => 'unique')); - - -++ Inheritance - - ---- -Entity: - actAs: [Timestampable] - columns: - id: - type: integer(4) - primary: true - autoincrement: true - username: - type: string(255) - password: - type: string(255) -User: - inheritance: - extends: Entity -Group: - inheritance: - extends: Entity - - -++ Generating Models - -Once you have defined your schema files you need some code to - -// The options are completely optional. Only use this if you need something beyond the default configuration for model generation -$options = array('packagesPrefix' => 'Package', // What to prefix the middle package models with - 'packagesPath' => '', // this defaults to the "#models_path#/packages" - 'generateBaseClasses' => true, // Whether or not to generate abstract base models containing the definition and a top level class which is empty extends the base - 'generateTableClasses' => true, // Whether or not to generate a table class for each model - 'baseClassesDirectory' => 'generated', // Name of the folder to generate the base class definitions in - 'baseClassName' => 'Doctrine_Record', // Name of the base Doctrine_Record class - 'suffix' => '.php'); // Extension for your generated models - -// This code will generate the models for schema.yml at /path/to/generate/models -Doctrine::generateModelsFromYaml('schema.yml', '/path/to/generate/models', $options); - diff --git a/manual/docs/en/searching.txt b/manual/docs/en/searching.txt deleted file mode 100644 index c13c12da6..000000000 --- a/manual/docs/en/searching.txt +++ /dev/null @@ -1,152 +0,0 @@ -++ Introduction - -Searching is a huge topic, hence an entire chapter has been devoted to a plugin called Doctrine_Search. Doctrine_Search is a fulltext indexing and searching tool. It can be used for indexing and searching both database and files. - -Consider we have a class called NewsItem with the following definition: - - -class NewsItem extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 200); - $this->hasColumn('content', 'string'); - } -} - - -Now lets say we have an application where users are allowed to search for different news items, an obvious way to implement this would be building a form and based on that form build DQL queries such as: - -SELECT n.* FROM NewsItem n WHERE n.title LIKE ? OR n.content LIKE ? - - -As the application grows these kind of queries become very slow. For example -when using the previous query with parameters '%framework%' and '%framework%' -(this would be equivalent of 'find all news items whose title or content -contains word 'framework') the database would have to traverse through each row in the table, which would naturally be very very slow. - -Doctrine solves this with its search component and inverse indexes. First lets alter our definition a bit: - - -class NewsItem extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 200); - $this->hasColumn('content', 'string'); - } - public function setUp() - { - $this->actAs('Searchable', array('fields' => array('title', 'content'))); - } -} - - -Here we tell Doctrine that NewsItem class acts as searchable (internally Doctrine loads Doctrine_Template_Searchable) and fields title and content are marked as fulltext indexed fields. This means that everytime a NewsItem is added or updated Doctrine will: - -1. Update the inverse search index or -2. Add new pending entry to the inverse search index (sometimes it can be efficient to update the inverse search index in batches) - -Sometimes you may want to alter the search object options afterwards. The search object can be accessed as follows: - - -$search = $conn->getTable('NewsItem') - ->getTemplate('Searchable') - ->getPlugin(); - - -++ Index structure - -The structure of the inverse index Doctrine uses is the following: - -[ (string) keyword] [ (string) field ] [ (integer) position ] [ (mixed) [foreign_keys] ] - -* **keyword** is the keyword in the text that can be searched for -* **field** is the field where the keyword was found -* **position** is the position where the keyword was found -* **[foreign_keys]** either one or multiple fields depending on the owner component (here NewsItem) - -In the NewsItem example the [foreign_keys] would simply contain one field id with foreign key references to NewsItem(id) and with onDelete => CASCADE constraint. - -An example row in this table might look something like: - -|| keyword || field || position || id || -|| database || title || 3 || 1 || - -In this example the word database is the third word of the title field of NewsItem 1. - -++ Index building - -Whenever a searchable record is being inserted into database Doctrine executes the index building procedure. This happens in the background as the procedure is being invoked by the search listener. The phases of this procedure are: - -1. Analyze the text using a Doctrine_Search_Analyzer based class -2. Insert new rows into index table for all analyzed keywords - -Sometimes you may not want to update the index table directly when new searchable entries are added. Rather you may want to batch update the index table in certain intervals. For disabling the direct update functionality you'll need to set the batchUpdates option to true. - - -$search->setOption('batchUpdates', true); - - -The actual batch updating procedure can be invoked with the batchUpdateIndex() method. It takes two optional arguments: limit and offset. Limit can be used for limiting the number of batch indexed entries while the offset can be used for setting the first entry to start the indexing from. - - -$newsItem = new NewsItem(); - -$newsItem->batchUpdateIndex(); - - - -++ Text analyzers - -By default Doctrine uses Doctrine_Search_Analyzer_Standard for analyzing the text. This class performs the following things: - -1. Strips out stop-keywords (such as 'and', 'if' etc.) - As many commonly used words such as 'and', 'if' etc. have no relevance for the search, they are being stripped out in order to keep the index size reasonable. -2. Makes all keywords lowercased - When searching words 'database' and 'DataBase' are considered equal by the standard analyzer, hence the standard analyzer lowercases all keywords. -3. Replaces all non alpha-numeric marks with whitespace - In normal text many keywords might contain non alpha-numeric chars after them, for example 'database.'. The standard analyzer strips these out so that 'database' matches 'database.'. -4. Replaces all quotation marks with empty strings so that "O'Connor" matches "oconnor" - -You can write your own analyzer class by making a class that implements Doctrine_Search_Analyzer_Interface. This analyzer can then be applied to the search object as follows: - - -$search->setOption('analyzer', new MyAnalyzer()); - - -++ Query language - -Doctrine_Search provides a query language similar to Apache Lucene. The parsed behind Doctrine_Search_Query converts human readable, easy-to-construct search queries to their complex sql equivalents. - -++ File searches - -As stated before Doctrine_Search can also be used for searching files. Lets say we have a directory which we want to be searchable. First we need to create an instance of Doctrine_Search_File which is a child of Doctrine_Search providing some extra functionality needed for the file searches. - - -$search = new Doctrine_Search_File(); - - -Second thing to do is to generate the index table. By default Doctrine names the database index class as FileIndex. - - -$search->buildDefinition(); // builds to table and record class definitions - -$conn->export->exportClasses(array('FileIndex')); - - -Now we can start using the file searcher. First lets index some directory: - - -$search->indexDirectory('myfiles'); - - -The indexDirectory() iterates recursively through given directory and analyzes all files within it updating the index table as necessary. - -Finally we can start searching for pieces of text within the indexed files: - - -$resultSet = $search->search('database orm'); - - - diff --git a/manual/docs/en/technology.txt b/manual/docs/en/technology.txt deleted file mode 100644 index 30a2c3b48..000000000 --- a/manual/docs/en/technology.txt +++ /dev/null @@ -1,4 +0,0 @@ -++ Architecture -++ Design patterns used -++ Speed -++ Internal optimizations diff --git a/manual/docs/en/technology/architecture.txt b/manual/docs/en/technology/architecture.txt deleted file mode 100644 index 8f8eceab9..000000000 --- a/manual/docs/en/technology/architecture.txt +++ /dev/null @@ -1,42 +0,0 @@ -Doctrine is divided into 3 main packages: - -* Doctrine CORE - * Doctrine - * Doctrine_Manager - * Doctrine_Connection - * Doctrine_Compiler - * Doctrine_Exception - * Doctrine_Formatter - * Doctrine_Object - * Doctrine_Null - * Doctrine_Event - * Doctrine_Overloadable - * Doctrine_Configurable - * Doctrine_EventListener - -* Doctrine DBAL - * Doctrine_Expression_Driver - * Doctrine_Export - * Doctrine_Import - * Doctrine_Sequence - * Doctrine_Transaction - * Doctrine_DataDict - -Doctrine DBAL is also divided into driver packages. - -* Doctrine ORM - * Doctrine_Record - * Doctrine_Table - * Doctrine_Relation - * Doctrine_Expression - * Doctrine_Query - * Doctrine_RawSql - * Doctrine_Collection - * Doctrine_Tokenizer - -There are also plugins for Doctrine: - -* Doctrine_Validator -* Doctrine_Hook -* Doctrine_View -* Doctrine_Tree + Doctrine_Node diff --git a/manual/docs/en/technology/design-patterns-used.txt b/manual/docs/en/technology/design-patterns-used.txt deleted file mode 100644 index 303af22a6..000000000 --- a/manual/docs/en/technology/design-patterns-used.txt +++ /dev/null @@ -1,22 +0,0 @@ -GoF (Gang of Four) design patterns used: - -* [http://www.dofactory.com/Patterns/PatternSingleton.aspx Singleton], for forcing only one instance of {{Doctrine_Manager}} -* [http://www.dofactory.com/Patterns/PatternComposite.aspx Composite], for leveled configuration -* [http://www.dofactory.com/Patterns/PatternFactory.aspx Factory], for connection driver loading and many other things -* [http://www.dofactory.com/Patterns/PatternObserver.aspx Observer], for event listening -* [http://www.dofactory.com/Patterns/PatternFlyweight.aspx Flyweight], for efficient usage of validators -* [http://www.dofactory.com/Patterns/PatternFlyweight.aspx Iterator], for iterating through components (Tables, Connections, Records etc.) -* [http://www.dofactory.com/Patterns/PatternState.aspx State], for state-wise connections -* [http://www.dofactory.com/Patterns/PatternStrategy.aspx Strategy], for algorithm strategies - -Enterprise application design patterns used: - -* [http://www.martinfowler.com/eaaCatalog/activeRecord.html Active Record], Doctrine is an implementation of this pattern -* [http://www.martinfowler.com/eaaCatalog/unitOfWork.html UnitOfWork], for maintaining a list of objects affected in a transaction -* [http://www.martinfowler.com/eaaCatalog/identityField.html Identity Field], for maintaining the identity between record and database row -* [http://www.martinfowler.com/eaaCatalog/metadataMapping.html Metadata Mapping], for Doctrine DataDict -* [http://www.martinfowler.com/eaaCatalog/dependentMapping.html Dependent Mapping], for mapping in general, since all records extend {{Doctrine_Record}} which performs all mappings -* [http://www.martinfowler.com/eaaCatalog/foreignKeyMapping.html Foreign Key Mapping], for one-to-one, one-to-many and many-to-one relationships -* [http://www.martinfowler.com/eaaCatalog/associationTableMapping.html Association Table Mapping], for association table mapping (most commonly many-to-many relationships) -* [http://www.martinfowler.com/eaaCatalog/lazyLoad.html Lazy Load], for lazy loading of objects and object properties -* [http://www.martinfowler.com/eaaCatalog/queryObject.html Query Object], DQL API is actually an extension to the basic idea of Query Object pattern diff --git a/manual/docs/en/technology/internal-optimizations.txt b/manual/docs/en/technology/internal-optimizations.txt deleted file mode 100644 index 8b1378917..000000000 --- a/manual/docs/en/technology/internal-optimizations.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/manual/docs/en/technology/speed.txt b/manual/docs/en/technology/speed.txt deleted file mode 100644 index 05e932341..000000000 --- a/manual/docs/en/technology/speed.txt +++ /dev/null @@ -1,21 +0,0 @@ -: **Lazy initialization** : For collection elements - -: **Subselect fetching** : Doctrine knows how to fetch collections efficiently using a subselect. - -: **Executing SQL statements later, when needed** : The connection never issues an INSERT or UPDATE until it is actually needed. So if an exception occurs and you need to abort the transaction, some statements will never actually be issued. Furthermore, this keeps lock times in the database as short as possible (from the late UPDATE to the transaction end). - -: **Join fetching** : Doctrine knows how to fetch complex object graphs using joins and subselects - -: **Multiple collection fetching strategies** : Doctrine has multiple collection fetching strategies for performance tuning. - -: **Dynamic mixing of fetching strategies** : Fetching strategies can be mixed and for example users can be fetched in a batch collection while users' phonenumbers are loaded in offset collection using only one query. - -: **Driver specific optimizations** : Doctrine knows things like bulk-insert on mysql - -: **Transactional single-shot delete** : Doctrine knows how to gather all the primary keys of the pending objects in delete list and performs only one sql delete statement per table. - -: **Updating only the modified columns.** : Doctrine always knows which columns have been changed. - -: **Never inserting/updating unmodified objects.** : Doctrine knows if the the state of the record has changed. - -: **PDO for database abstraction** : PDO is by far the fastest availible database abstraction layer for php. diff --git a/manual/docs/en/transactions.txt b/manual/docs/en/transactions.txt deleted file mode 100644 index 00f4e608e..000000000 --- a/manual/docs/en/transactions.txt +++ /dev/null @@ -1,8 +0,0 @@ -++ Introduction -++ Unit of work -++ Nesting -++ Savepoints -++ Locking strategies -++ Lock modes -++ Isolation levels -++ Deadlocks diff --git a/manual/docs/en/transactions/introduction.txt b/manual/docs/en/transactions/introduction.txt deleted file mode 100644 index 38c0763cc..000000000 --- a/manual/docs/en/transactions/introduction.txt +++ /dev/null @@ -1,28 +0,0 @@ -A database transaction is a unit of interaction with a database management system or similar system that is treated in a coherent and reliable way independent of other transactions that must be either entirely completed or aborted. Ideally, a database system will guarantee all of the ACID (Atomicity, Consistency, Isolation, and Durability) properties for each transaction. - -* [http://en.wikipedia.org/wiki/Atomicity Atomicity] refers to the ability of the DBMS to guarantee that either all of the tasks of a transaction are performed or none of them are. The transfer of funds can be completed or it can fail for a multitude of reasons, but atomicity guarantees that one account won't be debited if the other is not credited as well. -* [http://en.wikipedia.org/wiki/Database_consistency Consistency] refers to the database being in a legal state when the transaction begins and when it ends. This means that a transaction can't break the rules, or //integrity constraints//, of the database. If an integrity constraint states that all accounts must have a positive balance, then any transaction violating this rule will be aborted. -* [http://en.wikipedia.org/wiki/Isolation_%28computer_science%29 Isolation] refers to the ability of the application to make operations in a transaction appear isolated from all other operations. This means that no operation outside the transaction can ever see the data in an intermediate state; a bank manager can see the transferred funds on one account or the other, but never on both - even if she ran her query while the transfer was still being processed. More formally, isolation means the transaction history (or [http://en.wikipedia.org/wiki/Schedule_%28computer_science%29 schedule]) is [http://en.wikipedia.org/wiki/Serializability serializable]. For performance reasons, this ability is the most often relaxed constraint. See the [http://en.wikipedia.org/wiki/Isolation_%28computer_science%29 isolation] article for more details. -* [http://en.wikipedia.org/wiki/Durability_%28computer_science%29 Durability] refers to the guarantee that once the user has been notified of success, the transaction will persist, and not be undone. This means it will survive system failure, and that the [http://en.wikipedia.org/wiki/Database_system database system] has checked the integrity constraints and won't need to abort the transaction. Typically, all transactions are written into a [http://en.wikipedia.org/wiki/Database_log log] that can be played back to recreate the system to its state right before the failure. A transaction can only be deemed committed after it is safely in the log. - -- //from [http://www.wikipedia.org wikipedia]// - -In Doctrine all operations are wrapped in transactions by default. There are some things that should be noticed about how Doctrine works internally: - -* Doctrine uses application level transaction nesting. -* Doctrine always executes {{INSERT}} / {{UPDATE}} / {{DELETE}} queries at the end of transaction (when the outermost commit is called). The operations are performed in the following order: all inserts, all updates and last all deletes. Doctrine knows how to optimize the deletes so that delete operations of the same component are gathered in one query. - - -$conn->beginTransaction(); - -$user = new User(); -$user->name = 'New user'; -$user->save(); - -$user = $conn->getTable('User')->find(5); -$user->name = 'Modified user'; -$user->save(); - -$conn->commit(); // all the queries are executed here - - diff --git a/manual/docs/en/transactions/isolation-levels.txt b/manual/docs/en/transactions/isolation-levels.txt deleted file mode 100644 index 19f077be5..000000000 --- a/manual/docs/en/transactions/isolation-levels.txt +++ /dev/null @@ -1,24 +0,0 @@ -A transaction isolation level sets the default transactional behaviour. As the name 'isolation level' suggests, the setting determines how isolated each transation is, or what kind of locks are associated with queries inside a transaction. The four available levels are (in ascending order of strictness): - -: {{READ UNCOMMITTED}} : Barely transactional, this setting allows for so-called 'dirty reads', where queries inside one transaction are affected by uncommitted changes in another transaction. - -: {{READ COMMITTED}} : Committed updates are visible within another transaction. This means identical queries within a transaction can return differing results. This is the default in some DBMS's. - -: {{REPEATABLE READ}} : Within a transaction, all reads are consistent. This is the default of Mysql INNODB engine. - -: {{SERIALIZABLE}} : Updates are not permitted in other transactions if a transaction has run an ordinary {{SELECT}} query. - - -$tx = $conn->transaction; // get the transaction module - -// sets the isolation level to READ COMMITTED -$tx->setIsolation('READ COMMITTED'); - -// sets the isolation level to SERIALIZABLE -$tx->setIsolation('SERIALIZABLE'); - -// Some drivers (like Mysql) support the fetching of current transaction -// isolation level. It can be done as follows: -$level = $tx->getIsolation(); - - diff --git a/manual/docs/en/transactions/locking-strategies.txt b/manual/docs/en/transactions/locking-strategies.txt deleted file mode 100644 index 4698e311a..000000000 --- a/manual/docs/en/transactions/locking-strategies.txt +++ /dev/null @@ -1,2 +0,0 @@ -+++ Pessimistic locking -+++ Optimistic locking diff --git a/manual/docs/en/transactions/nesting.txt b/manual/docs/en/transactions/nesting.txt deleted file mode 100644 index 57814c9a0..000000000 --- a/manual/docs/en/transactions/nesting.txt +++ /dev/null @@ -1,23 +0,0 @@ - -function saveUserAndGroup(Doctrine_Connection $conn, User $user, Group $group) { - $conn->beginTransaction(); - - $user->save(); - - $group->save(); - - $conn->commit(); -} - -try { - $conn->beginTransaction(); - - saveUserAndGroup($conn,$user,$group); - saveUserAndGroup($conn,$user2,$group2); - saveUserAndGroup($conn,$user3,$group3); - - $conn->commit(); -} catch(Doctrine_Exception $e) { - $conn->rollback(); -} - diff --git a/manual/docs/en/transactions/savepoints.txt b/manual/docs/en/transactions/savepoints.txt deleted file mode 100644 index 98cb51dc0..000000000 --- a/manual/docs/en/transactions/savepoints.txt +++ /dev/null @@ -1,50 +0,0 @@ -Doctrine supports transaction savepoints. This means you can set named transactions and have them nested. - -The {{Doctrine_Transaction::beginTransaction($savepoint)}} sets a named transaction savepoint with a name of {{$savepoint}}. If the current transaction has a savepoint with the same name, the old savepoint is deleted and a new one is set. - - -try { - $conn->beginTransaction(); - // do some operations here - - // creates a new savepoint called mysavepoint - $conn->beginTransaction('mysavepoint'); - try { - // do some operations here - - $conn->commit('mysavepoint'); - } catch(Exception $e) { - $conn->rollback('mysavepoint'); - } - $conn->commit(); -} catch(Exception $e) { - $conn->rollback(); -} - - -The {{Doctrine_Transaction::rollback($savepoint)}} rolls back a transaction to the named savepoint. Modifications that the current transaction made to rows after the savepoint was set are undone in the rollback. - -NOTE: Mysql, for example, does not release the row locks that were stored in memory after the savepoint. - -Savepoints that were set at a later time than the named savepoint are deleted. - -The {{Doctrine_Transaction::commit($savepoint)}} removes the named savepoint from the set of savepoints of the current transaction. - -All savepoints of the current transaction are deleted if you execute a commit or if a rollback is being called without savepoint name parameter. - - -try { - $conn->beginTransaction(); - // do some operations here - - // creates a new savepoint called mysavepoint - $conn->beginTransaction('mysavepoint'); - - // do some operations here - - $conn->commit(); // deletes all savepoints -} catch(Exception $e) { - $conn->rollback(); // deletes all savepoints -} - - diff --git a/manual/docs/en/transactions/unit-of-work.txt b/manual/docs/en/transactions/unit-of-work.txt deleted file mode 100644 index f15505227..000000000 --- a/manual/docs/en/transactions/unit-of-work.txt +++ /dev/null @@ -1,18 +0,0 @@ - -$conn->beginTransaction(); - -$user = new User(); -$user->name = 'New user'; -$user->save(); - -$user = $conn->getTable('User')->find(5); -$user->name = 'Modified user'; -$user->save(); - - -$pending = $conn->getInserts(); // an array containing one element - -$pending = $conn->getUpdates(); // an array containing one element - -$conn->commit(); // all the queries are executed here - diff --git a/manual/docs/en/utilities.txt b/manual/docs/en/utilities.txt deleted file mode 100644 index 8a414bdad..000000000 --- a/manual/docs/en/utilities.txt +++ /dev/null @@ -1,7 +0,0 @@ -++ Pagination - -++ Facade - -++ Command Line Interface - -++ Sandbox \ No newline at end of file diff --git a/manual/docs/en/utilities/command-line-interface.txt b/manual/docs/en/utilities/command-line-interface.txt deleted file mode 100644 index b4ffd1f53..000000000 --- a/manual/docs/en/utilities/command-line-interface.txt +++ /dev/null @@ -1,85 +0,0 @@ -+++ Introduction -The Doctrine Cli is a collection of tasks that help you with your day to do development and testing with your Doctrine implementation. Typically with the examples in this manual, you setup php scripts to perform whatever tasks you may need. This Cli tool is aimed at providing an out of the box solution for those tasks. - -+++ Tasks -Below is a list of available tasks for managing your Doctrine implementation. - - - -./cli build-all -./cli build-all-load -./cli build-all-reload -./cli compile -./cli create-db -./cli create-tables -./cli dql -./cli drop-db -./cli dump-data -./cli generate-migration -./cli generate-migrations-from-db -./cli generate-migrations-from-models -./cli generate-models-from-db -./cli generate-models-from-yaml -./cli generate-sql -./cli generate-yaml-from-db -./cli generate-yaml-from-models -./cli load-data -./cli load-dummy-data -./cli migrate -./cli rebuild-db - - - -The tasks for the CLI are separate from the CLI and can be used standalone. Below is an example. - - -$task = new Doctrine_Task_GenerateModelsFromYaml(); - -$args = array('yaml_schema_path' => '/path/to/schema', - 'models_path' => '/path/to/models'); - -$task->setArguments($args); - -try { - if ($task->validate()) { - $task->execute(); - } -} catch (Exception $e) { - throw new Doctrine_Exception($e->getMessage()); -} - - -+++ Usage - -File named "cli" that is set to executable - - -#!/usr/bin/env php - - -Actual php file named "cli.php" that implements the Doctrine_Cli. - -// Include your Doctrine configuration/setup here, your connections, models, etc. - -// Configure Doctrine Cli -// Normally these are arguments to the cli tasks but if they are set here the arguments will be auto-filled and are not required for you to enter them. - -$config = array('data_fixtures_path' => '/path/to/data/fixtures', - 'models_path' => '/path/to/models', - 'migrations_path' => '/path/to/migrations', - 'sql_path' => '/path/to/data/sql', - 'yaml_schema_path' => '/path/to/schema'); - -$cli = new Doctrine_Cli($config); -$cli->run($_SERVER['argv']); - - -Now you can begin executing commands. - - -./cli generate-models-from-yaml -./cli create-tables - \ No newline at end of file diff --git a/manual/docs/en/utilities/facade.txt b/manual/docs/en/utilities/facade.txt deleted file mode 100644 index 16b989744..000000000 --- a/manual/docs/en/utilities/facade.txt +++ /dev/null @@ -1,129 +0,0 @@ -+++ Creating & Dropping Databases - -Doctrine offers the ability to create and drop your databases from your defined Doctrine connections. The only trick to using it is that the name of your Doctrine connection must be the name of your database. This is required due to the fact that PDO does not offer a method for retrieving the name of the database you are connected to. So in order to create and drop the database Doctrine itself must be aware of the name of the database. - -+++ Convenience Methods - -Doctrine offers static convenience methods available in the main Doctrine class. These methods perform some of the most used functionality of Doctrine with one method. Most of these methods are using in the Doctrine_Task system. These tasks are also what are executed from the Doctrine_Cli. - - -// Turn debug on/off and check for whether it is on/off -Doctrine::debug(true); - -if (Doctrine::debug()) { - echo 'debugging is on'; -} else { - echo 'debugging is off'; -} - -// Get the path to your Doctrine libraries -$path = Doctrine::getPath(); - -// Load your models so that they are present and loaded for Doctrine to work with -// Returns an array of the Doctrine_Records that were found and loaded -$models = Doctrine::loadModels('/path/to/models'); -print_r($models); - -// Get array of all the models loaded and present to Doctrine -$models = Doctrine::getLoadedModels(); - -// Pass an array of classes to the above method and it will filter out the ones that are not Doctrine_Records -$models = Doctrine::getLoadedModels(array('User', 'Formatter', 'Doctrine_Record')); -print_r($models); // would return array('User') because Formatter and Doctrine_Record are not Doctrine_Records - -// Get Doctrine_Connection object for an actual table name -$conn = Doctrine::getConnectionByTableName('user'); // returns the connection object that the table name is associated with - -// Generate your models from an existing database -Doctrine::generateModelsFromDb('/path/to/generate/models'); - -// Generate YAML schema from an existing database -Doctrine::generateYamlFromDb('/path/to/dump/schema.yml'); - -// Generate your models from YAML schema -Doctrine::generateModelsFromYaml('/path/to/schema.yml', '/path/to/generate/models'); - -// Create all your tables from an existing set of models -Doctrine::createTablesFromModels('/path/to/models'); - -// Create the tables supplied in the array -Doctrine::createTablesFromArray(array('User', 'Phoneumber')); - -// Generate string of sql commands from an existing set of models -Doctrine::generateSqlFromModels('/path/to/models'); - -// Generate YAML schema from an existing set of models -Doctrine::generateYamlFromModels('/path/to/schema.yml', '/path/to/models'); - -// It is required your connection name to be the same as your database name in order for the drop/create functionality below to work. - -// Create all databases for connections. -Doctrine::createDatabases(); - -// Drop all databases for connections -Doctrine::dropDatabases(); - -// Dump all data for your models to a yaml fixtures file -// 2nd argument is a bool value for whether or not to generate individual fixture files for each model. If true you need to specify a folder instead of a file. -Doctrine::dumpData('/path/to/dump/data.yml', true); - -// Load data from yaml fixtures files -// 2nd argument is a bool value for whether or not to append the data when loading or delete all data first before loading -Doctrine::loadData('/path/to/fixture/files', true); - -// Run a migration process for a set of migration classes -$num = 5; // migrate to version #5 -Doctrine::migration('/path/to/migrations', $num); - -// Generate a blank migration class template -Doctrine::generateMigrationClass('ClassName', '/path/to/migrations'); - -// Generate all migration classes for an existing database -Doctrine::generateMigrationsFromDb('/path/to/migrations'); - -// Generate all migration classes for an existing set of models -// 2nd argument is optional if you have already loaded your models using loadModels() -Doctrine::generateMigrationsFromModels('/path/to/migrations', '/path/to/models'); - -// Get Doctrine_Table instance for a model -$userTable = Doctrine::getTable('User'); - -// Compile doctrine in to a single php file -$drivers = array('mysql'); // specify the array of drivers you want to include in this compiled version -Doctrine::compile('/path/to/write/compiled/doctrine', $drivers); - -// Dump doctrine objects for debugging -$conn = Doctrine_Manager::connection(); -Doctrine::dump($conn); - - -+++ Tasks - -Tasks are classes which bundle some of the core convenience methods in to tasks that can be easily executed by setting the required arguments. These tasks are directly used in the Doctrine command line interface. - - -BuildAll -BuildAllLoad -BuildAllReload -Compile -CreateDb -CreateTables -Dql -DropDb -DumpData -Exception -GenerateMigration -GenerateMigrationsDb -GenerateMigrationsModels -GenerateModelsDb -GenerateModelsYaml -GenerateSql -GenerateYamlDb -GenerateYamlModels -LoadData -LoadDummyData -Migrate -RebuildDb - - -You can read below about how to execute Doctrine Tasks standalone in your own scripts. \ No newline at end of file diff --git a/manual/docs/en/utilities/pagination.txt b/manual/docs/en/utilities/pagination.txt deleted file mode 100644 index 8f4c89b98..000000000 --- a/manual/docs/en/utilities/pagination.txt +++ /dev/null @@ -1,9 +0,0 @@ -+++ Introduction - -+++ Working with pager - -+++ Controlling range styles - -+++ Advanced layouts with pager - -+++ Customizing pager layout \ No newline at end of file diff --git a/manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt b/manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt deleted file mode 100644 index ad930d4ee..000000000 --- a/manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt +++ /dev/null @@ -1,137 +0,0 @@ -Until now, we learned how to create paginations and how to retrieve ranges around the current page. To abstract the business logic involving the page links generation, there is a powerful component called {{Doctrine_Pager_Layout}}. -The main idea of this component is to abstract php logic and only leave HTML to be defined by Doctrine developer. - -{{Doctrine_Pager_Layout}} accepts 3 obrigatory arguments: a {{Doctrine_Pager}} instance, a {{Doctrine_Pager_Range}} subclass instance and a string which is the URL to be assigned as {%url} mask in templates. As you may see, there are 2 types of "variables" in {{Doctrine_Pager_Layout}}: - -++++ Mask - -A piece of string that is defined inside template as replacements. They are defined as **{%mask_name}** and are replaced by what you define in options or what is defined internally by {{Doctrine_Pager_Layout}} component. Currently, these are the internal masks available: - -* **{%page}** Holds the page number, exactly as page_number, but can be overwritable by {{addMaskReplacement()}} to behavior like another mask or value -* **{%page_number}** Stores the current page number, but cannot be overwritable -* **{%url}** Available only in {{setTemplate()}} and {{setSelectedTemplate()}} methods. Holds the processed URL, which was defined in constructor - -++++ Template - -As the name explains itself, it is the skeleton of HTML or any other resource that is applied to each page returned by {{Doctrine_Pager_Range::rangeAroundPage()}} subclasses. There are 3 distinct templates that can be defined: - -* {{setTemplate()}} Defines the template that can be used in all pages returned by {{Doctrine_Pager_Range::rangeAroundPage()}} subclass call -* {{setSelectedTemplate()}} Template that is applied when it is the page to be processed is the current page you are. If nothing is defined (a blank string or no definition), the template you defined in {{setTemplate()}} is used -* {{setSeparatorTemplate()}} Separator template is the string that is applied between each processed page. It is not included before the first call and after the last one. The defined template of this method is not affected by options and also it cannot process masks - - -Now we know how to create the {{Doctrine_Pager_Layout}} and the types that are around this component, it is time to view the basic usage: - - -// Creating pager layout -$pager_layout = new Doctrine_Pager_Layout( - new Doctrine_Pager( - Doctrine_Query::create() - ->from( 'User u' ) - ->leftJoin( 'u.Group g' ) - ->orderby( 'u.username ASC' ), - $currentPage, - $resultsPerPage - ), - new Doctrine_Pager_Range_Sliding(array( - 'chunk' => 5 - )), - 'http://wwww.domain.com/app/User/list/page,{%page_number}' -); - -// Assigning templates for page links creation -$pager_layout->setTemplate('[{%page}]'); -$pager_layout->setSelectedTemplate('[{%page}]'); - -// Retrieving Doctrine_Pager instance -$pager = $pager_layout->getPager(); - -// Fetching users -$users = $pager->execute(); // This is possible too! - -// Displaying page links -// Displays: [1][2][3][4][5] -// With links in all pages, except the $currentPage (our example, page 1) -$pager_layout->display(); - - -Explaining this source, the first part creates the pager layout instance. Second, it defines the templates for all pages and for the current page. The last part, it retrieves the {{Doctrine_Pager}} object and executes the query, returning in variable {{$users}}. The last part calls the displar without any optional mask, which applies the template in all pagfes found by {{Doctrine_Pager_Range::rangeAroundPage()}} subclass call. - -As you may see, there is no need to use other masks except the internals ones. Lets suppose we implement a new functionality to search for Users in our existent application, and we need to support this feature in pager layout too. To simplify our case, the search parameter is named "search" and is received through {{$_GET}} superglobal array. -The first change we need to do is tho adjust the {{Doctrine_Query}} object and also the URL, to allow it to be sent to other pages. - - -// Creating pager layout -$pager_layout = new Doctrine_Pager_Layout( - new Doctrine_Pager( - Doctrine_Query::create() - ->from( 'User u' ) - ->leftJoin( 'u.Group g' ) - ->where( 'LOWER(u.username) LIKE LOWER(?)', array( '%'.$_GET['search'].'%' ) ) - ->orderby( 'u.username ASC' ), - $currentPage, - $resultsPerPage - ), - new Doctrine_Pager_Range_Sliding(array( - 'chunk' => 5 - )), - 'http://wwww.domain.com/app/User/list/page,{%page_number}?search={%search}' -); - - -Check out the code and notice we added a new mask, called {{{%search}}}. We'll need to send it to template processment at a later stage. -We then assign the templates, just as defined before, without any change. And also, we do not need to change execution of query. - - -// Assigning templates for page links creation -$pager_layout->setTemplate('[{%page}]'); -$pager_layout->setSelectedTemplate('[{%page}]'); - -// Fetching users -$users = $pager_layout->execute(); - -foreach ($users as $user) { - // ... -} - - -The method {{display()}} is the place where we define the custom mask we created. This method accepts 2 optional arguments: one array of optional masks and if the output should be returned instead of printed on screen. -In our case, we need to define a new mask, the {{{%search}}}, which is the search offset of {{$_GET}} superglobal array. Also, remember that since it'll be sent as URL, it needs to be encoded. -Custom masks are defined in key => value pairs. So all needed code is to define an array with the offset we desire and the value to be replaced: - - -// Displaying page links -$pager_layout->display( array( - 'search' => urlencode($_GET['search']) -) ); - - -{{Doctrine_Pager_Layout}} component offers accessors to defined resources. There is not need to define pager and pager range as variables and send to the pager layout. These instances can be retrieved by these accessors: - - -// Return the Pager associated to the Pager_Layout -$pager_layout->getPager(); - -// Return the Pager_Range associated to the Pager_Layout -$pager_layout->getPagerRange(); - -// Return the URL mask associated to the Pager_Layout -$pager_layout->getUrlMask(); - -// Return the template associated to the Pager_Layout -$pager_layout->getTemplate(); - -// Return the current page template associated to the Pager_Layout -$pager_layout->getSelectedTemplate(); - -// Defines the Separator template, applied between each page -$pager_layout->setSeparatorTemplate($separatorTemplate); - -// Return the current page template associated to the Pager_Layout -$pager_layout->getSeparatorTemplate(); - -// Handy method to execute the query without need to retrieve the Pager instance -$pager_layout->execute($params = array(), $hydrationMode = Doctrine::FETCH_RECORD); - - -There are a couple of other methods that are available if you want to extend the {{Doctrine_Pager_Layout}} to create you custom layouter. We will see these methods in the next section. \ No newline at end of file diff --git a/manual/docs/en/utilities/pagination/controlling-range-styles.txt b/manual/docs/en/utilities/pagination/controlling-range-styles.txt deleted file mode 100644 index ba3070901..000000000 --- a/manual/docs/en/utilities/pagination/controlling-range-styles.txt +++ /dev/null @@ -1,84 +0,0 @@ -There are some cases where simple paginations are not enough. One example situation is when you want to write page links listings. -To enable a more powerful control over pager, there is a small subset of pager package that allows you to create ranges. - -Currently, Doctrine implements two types (or styles) of ranges: Sliding ({{Doctrine_Pager_Range_Sliding}}) and Jumping ({{Doctrine_Pager_Range_Jumping}}). - -++++ Sliding - -Sliding page range style, the page range moves smoothly with the current page. The current page is always in the middle, except in the first and last pages of the range. -Check out how does it work with a chunk length of 5 items: - - -Listing 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -Page 1: o-------| -Page 2: |-o-----| -Page 3: |---o---| -Page 4: |---o---| -Page 5: |---o---| -Page 6: |---o---| -Page 7: |---o---| -Page 8: |---o---| - - -++++ Jumping - -In Jumping page range style, the range of page links is always one of a fixed set of "frames": 1-5, 6-10, 11-15, and so on. - - -Listing 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -Page 1: o-------| -Page 2: |-o-----| -Page 3: |---o---| -Page 4: |-----o-| -Page 5: |-------o -Page 6: o---------| -Page 7: |-o-------| -Page 8: |---o-----| - - - -Now that we know how the different of styles of pager range works, it's time to learn how to use them: - - -$pager_range = new Doctrine_Pager_Range_Sliding( - array( - 'chunk' => 5 // Chunk length - ), - $pager // Doctrine_Pager object we learned how to create in previous topic -); - - -What is the advantage to use this object, instead of the {{Doctrine_Pager}}? Just one; it allows you to retrieve ranges around the current page. -Look at the example: - - -// Retrieves the range around the current page -// In our example, we are using sliding style and we are at page 1 -$pages = $pager_range->rangeAroundPage(); - -// Outputs: [1][2][3][4][5] -echo '['. implode('][', $pages) .']'; - - -If you build your {{Doctrine_Pager}} inside the range object, the API gives you enough power to retrieve information related to {{Doctrine_Pager_Range}} subclass instance: - - -// Return the Pager associated to this Pager_Range -$pager_range->getPager(); - -// Defines a new Doctrine_Pager (automatically call _initialize protected method) -$pager_range->setPager($pager); - -// Return the options assigned to the current Pager_Range -$pager_range->getOptions(); - -// Returns the custom Doctrine_Pager_Range implementation offset option -$pager_range->getOption($option); - -// Check if a given page is in the range -$pager_range->isInRange($page); - -// Return the range around the current page (obtained from Doctrine_Pager -// associated to the $pager_range instance) -$pager_range->rangeAroundPage(); - \ No newline at end of file diff --git a/manual/docs/en/utilities/pagination/customizing-pager-layout.txt b/manual/docs/en/utilities/pagination/customizing-pager-layout.txt deleted file mode 100644 index 95e71cfa6..000000000 --- a/manual/docs/en/utilities/pagination/customizing-pager-layout.txt +++ /dev/null @@ -1,124 +0,0 @@ -{{Doctrine_Pager_Layout}} does a really good job, but sometimes it is not enough. Let's suppose a situation where you have to create a layout of pagination like this one: - -<< < 1 2 3 4 5 > >> - -Currently, it is impossible with raw {{Doctrine_Pager_Layout}}. But if you extend it and use the available methods, you can achieve it. The base Layout class provides you some methods that can be used to create your own implementation. They are: - - -// $this refers to an instance of Doctrine_Pager_Layout - -// Defines a mask replacement. When parsing template, it converts replacement -// masks into new ones (or values), allowing to change masks behavior on the fly -$this->addMaskReplacement($oldMask, $newMask, $asValue = false); - -// Remove a mask replacement -$this->removeMaskReplacement($oldMask); - -// Remove all mask replacements -$this->cleanMaskReplacements(); - -// Parses the template and returns the string of a processed page -$this->processPage($options = array()); // Needs at least page_number offset in $options array - -// Protected methods, although very useful - -// Parse the template of a given page and return the processed template -$this->_parseTemplate($options = array()); - -// Parse the url mask to return the correct template depending of the options sent -// Already process the mask replacements assigned -$this->_parseUrlTemplate($options = array()); - -// Parse the mask replacements of a given page -$this->_parseReplacementsTemplate($options = array()); - -// Parse the url mask of a given page and return the processed url -$this->_parseUrl($options = array()); - -// Parse the mask replacements, changing from to-be replaced mask with new masks/values -$this->_parseMaskReplacements($str); - - -Now that you have a small tip of useful methods to be used when extending {{Doctrine_Pager_Layout}}, it's time to see our implemented class: - - -class PagerLayoutWithArrows extends Doctrine_Pager_Layout -{ - public function display($options = array(), $return = false) - { - $pager = $this->getPager(); - $str = ''; - - // First page - $this->addMaskReplacement('page', '«', true); - $options['page_number'] = $pager->getFirstPage(); - $str .= $this->processPage($options); - - // Previous page - $this->addMaskReplacement('page', '‹', true); - $options['page_number'] = $pager->getPreviousPage(); - $str .= $this->processPage($options); - - // Pages listing - $this->removeMaskReplacement('page'); - $str .= parent::display($options, true); - - // Next page - $this->addMaskReplacement('page', '›', true); - $options['page_number'] = $pager->getNextPage(); - $str .= $this->processPage($options); - - // Last page - $this->addMaskReplacement('page', '»', true); - $options['page_number'] = $pager->getLastPage(); - $str .= $this->processPage($options); - - // Possible wish to return value instead of print it on screen - if ($return) { - return $str; - } - - echo $str; - } -} - - - -As you may see, I have to manual process the items <<, <, > and >>. I override the **{%page}** mask by setting a raw value to it (raw value is achieved by setting the third parameter as true). Then I define the only MUST HAVE information to process the page and call it. The return is the template processed as a string. I do it to any of my custom buttons. - -Now supposing a totally different situation. Doctrine is framework agnostic, but many of our users use it together with Symfony. {{Doctrine_Pager}} and subclasses are 100% compatible with Symfony, but {{Doctrine_Pager_Layout}} needs some tweaks to get it working with Symfony's {{link_to}} helper function. To allow this usage with {{Doctrine_Pager_Layout}}, you have to extend it and add your custom processor over it. For example purpose (it works in Symfony), I used **{link_to}...{/link_to}** as a template processor to do this job. Here is the extended class and usage in Symfony: - - -// CLASS: - -class sfDoctrinePagerLayout extends Doctrine_Pager_Layout -{ - public function __construct($pager, $pagerRange, $urlMask) - { - sfLoader::loadHelpers(array('Url', 'Tag')); - parent::__construct($pager, $pagerRange, $urlMask); - } - - - protected function _parseTemplate($options = array()) - { - $str = parent::_parseTemplate($options); - - return preg_replace( - '/\{link_to\}(.*?)\{\/link_to\}/', link_to('$1', $this->_parseUrl($options)), $str - ); - } -} - - - -// USAGE: - -$pager_layout = new sfDoctrinePagerLayout( - $pager, - new Doctrine_Pager_Range_Sliding(array('chunk' => 5)), - '@hostHistoryList?page={%page_number}' -); - -$pager_layout->setTemplate('[{link_to}{%page}{/link_to}]'); - \ No newline at end of file diff --git a/manual/docs/en/utilities/pagination/introduction.txt b/manual/docs/en/utilities/pagination/introduction.txt deleted file mode 100644 index ccf3ac938..000000000 --- a/manual/docs/en/utilities/pagination/introduction.txt +++ /dev/null @@ -1,4 +0,0 @@ -In real world applications, display content from database tables is a commom task. Also, imagine that this content is a search result containing thousands of items. Undoubtely, it will be a huge listing, memory expensive and hard for users to find the right item. That is where some organization of this content display is needed and pagination comes in rescue. - -Doctrine implements a highly flexible pager package, allowing you to not only split listing in pages, but also enabling you to control the layout of page links. -In this chapter, we'll learn how to create pager objects, control pager styles and at the end, overview the pager layout object - a powerful page links displayer of Doctrine. \ No newline at end of file diff --git a/manual/docs/en/utilities/pagination/working-with-pager.txt b/manual/docs/en/utilities/pagination/working-with-pager.txt deleted file mode 100644 index e830e9fd5..000000000 --- a/manual/docs/en/utilities/pagination/working-with-pager.txt +++ /dev/null @@ -1,112 +0,0 @@ -Paginating queries is as simple as effectively do the queries itself. {{Doctrine_Pager}} is the responsible to process queries and paginate them. Check out this small piece of code: - - -// Defining initial variables -$currentPage = 1; -$resultsPerPage = 50; - -// Creating pager object -$pager = new Doctrine_Pager( - Doctrine_Query::create() - ->from( 'User u' ) - ->leftJoin( 'u.Group g' ) - ->orderby( 'u.username ASC' ), - $currentPage, // Current page of request - $resultsPerPage // (Optional) Number of results per page. Default is 25 -); - - -Until this place, the source you have is the same as the old {{Doctrine_Query}} object. The only difference is that now you have 2 new arguments. Your old query object plus these 2 arguments are now encapsulated by the {{Doctrine_Pager}} object. -At this stage, {{Doctrine_Pager}} defines the basic data needed to control pagination. If you want to know that actual status of the pager, all you have to do is to check if it's already executed: - - -$pager->getExecuted(); - - -If you try to access any of the methods provided by Doctrine_Pager now, you'll experience {{Doctrine_Pager_Exception}} thrown, reporting you that Pager was not yet executed. When executed, {{Doctrine_Pager}} offer you powerful methods to retrieve information. The API usage is listed at the end of this topic. - -To run the query, the process is similar to the current existent {{Doctrine_Query}} execute call. It even allow arguments the way you usually do it. Here is the PHP complete syntax, including the syntax of optional parameters: - - -$items = $pager->execute([$args = array() [, $fetchType = Doctrine::FETCH_RECORD]]); - -foreach ($items as $item) { - // ... -} - - -There are some special cases where the return records query differ of the counter query. To allow this situation, {{Doctrine_Pager}} has some methods that enable you to count and then to execute. The first thing you have to do is to define the count query: - - -$pager->setCountQuery($query [, $params = null]); - -// ... - -$rs = $pager->execute(); - - -The first param of {{setCountQuery}} can be either a valid {{Doctrine_Query}} object or a DQL string. The second argument you can define the optional parameters that may be sent in the counter query. If you do not define the params now, you're still able to define it later by calling the {{setCountQueryParams}}: - - -$pager->setCountQueryParams([$params = array() [, $append = false]]); - - -This method accepts 2 parameters. The first one is the params to be sent in count query and the second parameter is if the {{$params}} should be appended to the list or if it should override the list of count query parameters. The default behavior is to override the list. -One last thing to mention about count query is, if you do not define any parameter for count query, it will still send the parameters you define in {{$pager->execute()}} call. - -Count query is always enabled to be accessed. If you do not define it and call {{$pager->getCountQuery()}}, it will return the "fetcher" query to you. - -If you need access the other functionalities that {{Doctrine_Pager}} provides, you can access them through the API: - - -// Returns the check if Pager was already executed -$pager->getExecuted(); - -// Return the total number of itens found on query search -$pager->getNumResults(); - -// Return the first page (always 1) -$pager->getFirstPage(); - -// Return the total number of pages -$pager->getLastPage(); - -// Return the current page -$pager->getPage(); - -// Defines a new current page (need to call execute again to adjust offsets and values) -$pager->setPage($page); - -// Return the next page -$pager->getNextPage(); - -// Return the previous page -$pager->getPreviousPage(); - -// Return true if it's necessary to paginate or false if not -$pager->haveToPaginate(); - -// Return the maximum number of records per page -$pager->getMaxPerPage(); - -// Defined a new maximum number of records per page (need to call execute again to adjust offset and values) -$pager->setMaxPerPage($maxPerPage); - -// Returns the number of itens in current page -$pager->getResultsInPage(); - -// Returns the Doctrine_Query object that is used to make the count results to pager -$pager->getCountQuery(); - -// Defines the counter query to be used by pager -$pager->setCountQuery($query, $params = null); - -// Returns the params to be used by counter Doctrine_Query (return $defaultParams if no param is defined) -$pager->getCountQueryParams($defaultParams = array()); - -// Defines the params to be used by counter Doctrine_Query -$pager->setCountQueryParams($params = array(), $append = false); - -// Return the Doctrine_Query object -$pager->getQuery(); - \ No newline at end of file diff --git a/manual/docs/en/utilities/sandbox.txt b/manual/docs/en/utilities/sandbox.txt deleted file mode 100644 index b9fca4d33..000000000 --- a/manual/docs/en/utilities/sandbox.txt +++ /dev/null @@ -1,13 +0,0 @@ -+++ Installation - -Currently the only way you can install and use the sandbox is by svn. It is available by checking out the trunk of Doctrine. The sandbox comes loaded with generated models, sample schema files, data fixtures and a portable sqlite database to play with. - - -svn co http://doctrine.pengus.net/svn/trunk doctrine_trunk -cd doctrine_trunk/tools/sandbox -chmod 0777 cli - -./cli - - -The above steps should give you a functioning sandbox. Execute the ./cli command without specifying a task will show you an index of all the available cli tasks in Doctrine. \ No newline at end of file diff --git a/manual/docs/en/working-with-objects.txt b/manual/docs/en/working-with-objects.txt deleted file mode 100644 index fec2425a2..000000000 --- a/manual/docs/en/working-with-objects.txt +++ /dev/null @@ -1,239 +0,0 @@ -++ Dealing with relations -++ Many-to-Many relations -+++ Creating a new link -Lets say we have two classes User and Group which are linked trhough a GroupUser association class. When working with transient (new) records the fastest way for adding a User and couple of Groups for it is: - -$user = new User(); -$user->name = 'Some User'; -$user->Group[0]->name = 'Some Group'; -$user->Group[1]->name = 'Some Other Group'; -$user->save(); - - -However in real world scenarious you often already have existing groups, where you want to add a given user. The most efficient way of doing this is: - -$gu = new GroupUser(); -$gu->user_id = $userId; -$gu->group_id = $groupId; -$gu->save(); - - -+++ Deleting a link - -The right way to delete links between many-to-many associated records is by using the DQL DELETE statement. Convenient and recommended way of using DQL DELETE is trhough the Query API. - - -$deleted = Doctrine_Query::create() - ->delete() - ->from('GroupUser') - ->addWhere('user_id = 5') - ->whereIn('group_id', $groupIds); - ->execute(); -// print out the deleted links -print $deleted; - - -Another way to {{unlink}} the relationships between related objects is through the {{Doctrine_Record::unlink}} method. However, you should avoid using this method unless you already have the parent model, since it involves querying the database first. - - -$user = $conn->getTable('User')->find(5); -$user->unlink('Group', array(0, 1)); -$user->save(); - -// you can also unlink ALL relationships to Group -$user->unlink('Group'); - - -While the obvious and convinient way of deleting a link between User and Group would be the following, you still should *NOT* do this: - - -$user = $conn->getTable('User')->find(5); -$user->GroupUser - ->remove(0) - ->remove(1); -$user->save(); - - -This is due to a fact that $user->GroupUser loads all group links for given user. This can time-consuming task if user belongs to many groups. Even if the user belongs to few groups this will still execute an unnecessary SELECT statement. - -++ Fetching objects - -Normally when you fetch data from database the following phases are executed: - -1. Sending the query to database -2. Retrieve the returned data from the database - -In terms of object fetching we call these two phases the 'fetching' phase. Doctrine also has another phase called hydration phase. The hydration phase takes place whenever you are fecthing structured arrays / objects. Unless explicitly specified everything in Doctrine gets hydrated. - -Lets consider we have users and phonenumbers with their relation being one-to-many. Now consider the following plain sql query: - - -$dbh->fetchAll('SELECT u.id, u.name, p.phonenumber FROM user u LEFT JOIN phonenumber p ON u.id = p.user_id'); - - -If you are familiar with these kind of one-to-many joins it may be familiar to you how the basic result set is constructed. Whenever the user has more than one phonenumbers there will be duplicated data in the result set. The result set might look something like: - - - index | u.id | u.name | p.phonenumber | - 0 | 1 | Jack Daniels | 123 123 | - 1 | 1 | Jack Daniels | 456 456 | - 2 | 2 | John Beer | 111 111 | - 3 | 3 | John Smith | 222 222 | - 4 | 3 | John Smith | 333 333 | - 5 | 3 | John Smith | 444 444 | - - -Here Jack Daniels has 2 phonenumbers, John Beer has one whereas John Smith has 3 phonenumbers. You may notice how clumsy this result set is. Its hard to iterate over it as you would need some duplicate data checkings here and there. - -Doctrine hydration removes all duplicated data. It also performs many other things such as: - -# Custom indexing of result set elements -# Value casting and preparation -# Value assignment listening -# Makes multi-dimensional array out of the two-dimensional result set array, the number of dimensions is equal to the number of nested joins - -Now consider the DQL equivalent of the SQL query we used: - -$array = $conn->query('SELECT u.id, u.name, p.phonenumber FROM User u LEFT JOIN u.Phonenumber p', - array(), Doctrine::HYDRATE_ARRAY); - - -The structure of this hydrated array would look like: - - -array(0 => array('id' => 1, - 'name' => 'Jack Daniels', - 'Phonenumber' => - array(0 => array('phonenumber' => '123 123'), - 1 => array('phonenumber' => '456 456'))), - 1 => array('id' => 2, - 'name' => 'John Beer', - 'Phonenumber' => - array(0 => array('phonenumber' => '111 111'))), - 2 => array('id' => 3, - 'name' => 'John Smith', - 'Phonenumber' => - array(0 => array('phonenumber' => '111 111')), - 2 => array('phonenumber' => '222 222'), - 3 => array('phonenumber' => '333 333')))); - - -This structure also applies to the hydration of objects(records) which is the default hydration mode of Doctrine. The only differences are that the individual elements are represented as Doctrine_Record objects and the arrays converted into Doctrine_Collection objects. Whether dealing with arrays or objects you can: - -# Iterate over the results using //foreach// -# Access individual elements using array access brackets -# Get the number of elements using //count()// function -# Check if given element exists using //isset()// -# Unset given element using //unset()// - -You should always use array hydration when you only need to data for access-only purposes, whereas you should use the record hydration when you need to change the fetched data. - -The constant O(n) performance of the hydration algorithm is ensured by a smart identifier caching solution. - -+++ Field lazy-loading - -Whenever you fetch an object that has not all of its fields loaded from database then the state of this object is called proxy. Proxy objects can load the unloaded fields lazily. - -Lets say we have a User class with the following definition: - - -class User extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 20); - $this->hasColumn('password', 'string', 16); - $this->hasColumn('description', 'string'); - } -} - - -In the following example we fetch all the Users with the fields name and password loaded directly. Then we lazy-load a huge field called description for one user. - - -$users = Doctrine_Query::create()->select('u.name, u.password')->from('User u')->execute(); - -// the following lazy-loads the description fields and executes one additional database query -$users[0]->description; - - -Doctrine does the proxy evaluation based on loaded field count. It does not evaluate which fields are loaded on field-by-field basis. The reason for this is simple: performance. Field lazy-loading is very rarely needed in PHP world, hence introducing some kind of variable to check which fields are loaded would introduce unnecessary overhead to basic fetching. - -++ Arrays and objects - -Doctrine_Records and Doctrine_Collections provide methods to facilitate working with arrays: {{toArray()}}, {{fromArray()}} and {{synchronizeWithArray()}}. - -+++ toArray - -The {{toArray()}} method returns an array representation of your records or collections. It also accesses the relationships the objects may have. If you need to print a record for debugging purposes you can get an array representation of the object and print that. - - -print_r ($user->toArray()); // toArray(false) if you don't want to get the relations - - -+++ fromArray - -If you have an array of values you want to use to fill a record or even a collection, the {{fromArray()}} method simplifies this common task. - - -// If you have an array like this -$data = array( - 'name' => 'John', - 'age' => '25', - 'Emails' => array('john@mail.com', 'john@work.com') -); - -// you can populate a user record with an Emails relationship like this -$user = new User(); -$user->fromArray($data); -$user->Emails->count(); // --> 2 - - -+++ synchronizeWithArray - -{{synchronizeWithArray()}} allows you to... well, synchronize a record with an array. So if have an array representation of your model and modify a field, modify a relationship field or even delete or create a relationship, this changes will be applied to the record. - - -$user = Doctrine_Query::create() - ->from('User') - ->leftJoin('Groups') - ->where('id = ?') - ->fetchOne(array(1)); - -// Display this object on a cool javascript form that allows you to: - -$arrayUser['name'] = 'New name'; // modify a field -$arrayUser['Group'][0]['name'] = 'Renamed Group'; // modify a field on a relation -$arrayUser['Group'][] = array('name' => 'New Group'); // create a new relation -unset($arrayUser['Group'][1]); // even remove a relation - -// submit the form and on the next script use the same query to retrieve the record - -$user = Doctrine_Query::create() - ->from('User') - ->leftJoin('Groups') - ->where('id = ?') - ->fetchOne(array(1)); - -// sanitize the form input an get the data - -$user->synchronizeWithArray($arrayUser); -$user->save(); // all changes get applied to the user object - - -++ Overriding the constructor - -Sometimes you want to do some operations at the creation time of your objects. Doctrine doesn't allow you to override the Doctrine_Record::__construct() method but provides an alternative: - - -class User extends Doctrine_Record -{ - public function construct() - { - $this->name = 'Test Name'; - $this->do_something(); - } -} - - -The only drawback is that it doesn't provide a way to pass parameters to the constructor. diff --git a/manual/docs/en/working-with-objects/component-overview/collection.txt b/manual/docs/en/working-with-objects/component-overview/collection.txt deleted file mode 100644 index d3f5a12fa..000000000 --- a/manual/docs/en/working-with-objects/component-overview/collection.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/manual/docs/en/working-with-objects/component-overview/connection.txt b/manual/docs/en/working-with-objects/component-overview/connection.txt deleted file mode 100644 index 99a809136..000000000 --- a/manual/docs/en/working-with-objects/component-overview/connection.txt +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/manual/docs/en/working-with-objects/component-overview/manager.txt b/manual/docs/en/working-with-objects/component-overview/manager.txt deleted file mode 100644 index d226aee37..000000000 --- a/manual/docs/en/working-with-objects/component-overview/manager.txt +++ /dev/null @@ -1,59 +0,0 @@ -++++ Introduction - -{{Doctrine_Manager}} is the heart of every Doctrine based application. {{Doctrine_Manager}} handles all connections (database connections). - - -++++ Opening a new connection - -In order to get your first application started you first need to get an instance of Doctrine_Manager which handles all the connections (database connections). The second thing to do is to open a new connection. - - -// Doctrine_Manager controls all the connections - -$manager = Doctrine_Manager::getInstance(); - -// Doctrine_Connection -// a script may have multiple open connections -// (= multiple database connections) -$dbh = new PDO('dsn','username','password'); -$conn = $manager->openConnection(); - -// or if you want to use Doctrine Doctrine_Db and its -// performance monitoring capabilities - -$dsn = 'schema://username:password@dsn/dbname'; -$dbh = Doctrine_Db::getConnection($dsn); -$conn = $manager->openConnection(); - - - -++++ Managing connections - -Switching between connections in Doctrine is very easy, you just call {{Doctrine_Manager::setCurrentConnection()}} method. You can access the connection by calling {{Doctrine_Manager::getConnection()}} or {{Doctrine_Manager::getCurrentConnection()}} if you only want to get the current connection. - - -// Doctrine_Manager controls all the connections - -$manager = Doctrine_Manager::getInstance(); - -// open first connection - -$conn = $manager->openConnection(new PDO('dsn','username','password'), 'connection 1'); - -// open second connection - -$conn2 = $manager->openConnection(new PDO('dsn2','username2','password2'), 'connection 2'); - -$manager->getCurrentConnection(); // $conn2 - -$manager->setCurrentConnection('connection 1'); - -$manager->getCurrentConnection(); // $conn - -// iterating through connections - -foreach($manager as $conn) { - -} - - diff --git a/manual/docs/en/working-with-objects/component-overview/record.txt b/manual/docs/en/working-with-objects/component-overview/record.txt deleted file mode 100644 index d3f5a12fa..000000000 --- a/manual/docs/en/working-with-objects/component-overview/record.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/manual/docs/en/working-with-objects/component-overview/table.txt b/manual/docs/en/working-with-objects/component-overview/table.txt deleted file mode 100644 index d23b6537e..000000000 --- a/manual/docs/en/working-with-objects/component-overview/table.txt +++ /dev/null @@ -1,91 +0,0 @@ -++++ Introduction -++++ Getting table information - - -$table = $conn->getTable('User'); - -// getting column names - -$names = $table->getColumnNames(); - -// getting column information - -$columns = $table->getColumns(); - - - -++++ Finder methods - -{{Doctrine_Table}} provides basic finder methods. These finder methods are very fast and should be used if you only need to fetch data from one database table. If you need queries that use several components (database tables) use {{Doctrine_Connection::query()}}. - - -$table = $conn->getTable("User"); - -// find by primary key - -$user = $table->find(2); - -if($user !== false) - print $user->name; - - -// get all users -foreach($table->findAll() as $user) { - print $user->name; -} - -// finding by dql -foreach($table->findByDql("name LIKE '%John%'") as $user) { - print $user->created; -} - - - -++++ Custom table classes - -Adding custom table classes is very easy. Only thing you need to do is name the classes as {{[componentName]Table}} and make them inherit {{Doctrine_Table}}. - - - -// valid table object - -class UserTable extends Doctrine_Table { - -} - -// not valid [doesn't extend Doctrine_Table] -class GroupTable { } - - - -++++ Custom finders - -You can add custom finder methods to your custom table object. These finder methods may use fast {{Doctrine_Table}} finder methods or DQL API ({{Doctrine_Connection::query()}}). - - -class UserTable extends Doctrine_Table { - /** - * you can add your own finder methods here - */ - public function findByName($name) { - return $this->getConnection()->query("FROM User WHERE name LIKE '%$name%'"); - } -} -class User extends Doctrine_Record { } - -$conn = Doctrine_Manager::getInstance() - ->openConnection(new PDO("dsn","username","password")); - -// doctrine will now check if a class called UserTable exists -// and if it inherits Doctrine_Table - -$table = $conn->getTable("User"); - -print get_class($table); // UserTable - -$users = $table->findByName("Jack"); - - - - -++++ Getting relation objects diff --git a/manual/docs/en/working-with-objects/dealing-with-relations.txt b/manual/docs/en/working-with-objects/dealing-with-relations.txt deleted file mode 100644 index 09dd7e195..000000000 --- a/manual/docs/en/working-with-objects/dealing-with-relations.txt +++ /dev/null @@ -1,203 +0,0 @@ -+++ Creating related records - -Accessing related records in Doctrine is easy: you can use exactly the same getters and setters as for the record properties. - -You can use any of the three ways above, however the last one is the recommended one for array portability purposes. - - -$user->Email; - -$user->get('Email'); - -$user['Email']; - - -When accessing a one-to-one related record that doesn't exist, Doctrine automatically creates the object. So for example the following code is possible: - - -$user = new User(); -$user->name = 'some user'; - -$user->Email->address = 'some@one.info'; -// saves the user and the associated email -$user->save(); - - -When accessing one-to-many related records, Doctrine creates a Doctrine_Collection for the related component. Lets say we have users and phonenumbers and their relation is one-to-many. You can add phonenumbers easily as shown above: - - -$user = new User(); -$user->name = 'some user'; - -$user->Phonenumber[]->phonenumber = '123 123'; -$user->Phonenumber[]->phonenumber = '456 123'; -$user->Phonenumber[]->phonenumber = '123 777'; - -// saves the user and the associated phonenumbers -$user->save(); - - -Another way to easily create a link between two related components is by using Doctrine_Record::link(). It often happens that you have two existing records that you would like to relate (or link) to one another. In this case, if there is a relation defined between the involved record classes, you only need the identifiers of the related record(s): - - - -// We keep track of the new phone number identifiers - -$phoneIds = array(); - -// Some phone numbers are created... - -$phone1 = new Phonenumber(); -$phone1['phonenumber'] = '555 202 7890'; -$phone1->save(); - -$phoneIds[] = $phone1['id']; - -$phone2 = new Phonenumber(); -$phone2['phonenumber'] = '555 100 7890'; -$phone2->save(); - -$phoneIds[] = $phone2['id']; - -// Some user is created... - -$user = new User(); -$user['name'] = 'Werner Mollentze'; -$user->save(); - -// Let's link the phone numbers to the user, since the relation to Phonenumber exists for the User record... - -$user->link('Phonenumber', $phoneIds); - - - -If a relation to the User record class is defined for the Phonenumber record class, you may even do this: - - - -// Some user is created... - -$user = new User(); -$user['name'] = 'wernerm'; -$user->save(); - -// Some phone numbers are created and linked to the User on-the-fly... -// This is possible if a relation to User exists for the Phonenumber record - -$phone1 = new Phonenumber(); -$phone1['phonenumber'] = '555 202 7890'; -$phone1->save(); - -// Let's link this Phonenumber to our User... - -$phone1->link('User', array($user['id'])); - -// We create another phone number... - -$phone2 = new Phonenumber(); -$phone2['phonenumber'] = '555 100 7890'; -$phone2->save(); - -// Let's link this Phonenumber to our User too... - -$phone2->link('User', array($user['id'])); - - - -+++ Retrieving related records - -You can retrieve related records by the very same {{Doctrine_Record}} methods as in the previous subchapter. Please note that whenever you access a related component that isn't already loaded Doctrine uses one SQL SELECT statement for the fetching, hence the following example executes 4 SQL SELECTs. - - -$user = $conn->getTable('User')->find(5); - -print $user->Email['address']; - -print $user->Phonenumber[0]->phonenumber; - -print $user->Group[0]->name; - - -Much more efficient way of doing this is using DQL. The following example uses only one SQL query for the retrieval of related components. - - -$user = Doctrine_Query::create() - ->from('User u') - ->leftJoin('u.Email e') - ->leftJoin('u.Phonenumber p') - ->leftJoin('u.Group g') - ->execute(); - -print $user->Email['address']; - -print $user->Phonenumber[0]->phonenumber; - -print $user->Group[0]->name; - - - -+++ Updating related records - -You can update the related records by calling save for each related object / collection individually or by calling save on the object that owns the other objects. You can also call {{Doctrine_Connection::flush}} which saves all pending objects. - - -$user->Email['address'] = 'koskenkorva@drinkmore.info'; - -$user->Phonenumber[0]->phonenumber = '123123'; - -$user->save(); - -// saves the email and phonenumber - - - -+++ Deleting related records - -You can delete related records individually be calling {{delete()}} on a record or on a collection. - - -$user->Email->delete(); - -$user->Phonenumber[3]->delete(); - -// deleting user and all related objects: - -$user->delete(); - - -Usually in a typical web application the primary keys of the related objects that are to be deleted come from a form. In this case the most efficient way of deleting the related records is using DQL DELETE statement. Lets say we have once again users and phonenumbers with their relation being one-to-many. Deleting the given phonenumbers for given user id can be achieved as follows: - - -$deleted = Doctrine_Query::create() - ->delete() - ->from('Phonenumber') - ->addWhere('user_id = ?', array($userId)) - ->whereIn('id', $phonenumberIds); - ->execute(); -// print out the number of deleted phonenumbers -print $deleted; - - -Sometimes you may not want to delete the phonenumber records but to simply unlink the relations by setting the foreing key fields to null. This can ofcourse be achieved with DQL but perhaps to most elegant way of doing this is by using Doctrine_Record::unlink(). Please note that the unlink method is very smart. It not only sets the foreign fields for related phonenumbers to null but it also removes all given phonenumber references from the User object. - -Lets say we have a User who has 3 Phonenumbers (with identifiers 1, 2 and 3). Now unlinking the Phonenumbers 1 and 3 can be achieved as easily as: - - -$user->unlink('Phonenumber', array(1, 3)); - -$user->Phonenumber->count(); // 1 - - -+++ Working with related records - -++++ Testing the existance of a relation - -$obj = new Model(); -if(isset($obj->Relation())) { // returns false - ... -} -$obj->Relation = new Relation(); -if(isset($obj->Relation())) { // returns true - ... -} - \ No newline at end of file diff --git a/manual/images/doctrine-layers.jpg b/manual/images/doctrine-layers.jpg deleted file mode 100644 index 44c6cf0a08288147ad66b22dfc666e37a7c51186..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 59694 zcmeFa2V7Ij)+oM1uOdYhL_w-Z2|aYAgGiCykrE*S2~~<~E-h9D={?(gt%*#56HfD$GS zkpP;#;P!z@5MdSo-?)T=$iBu+0srqHG7}9564?IjU)2TUgyb@E!}wu*-7sEU>L!w0 z`i{;hG{Fx^h>6L{i%G~!Ah^U4^5RnR5>gOEdLQ`NL_zs{<((eAl^mo4{y~Xs{o{WwO9Bpr;%6W_qD&6z z`Vb613vDC%AeYmGnD`#(JVZxDMMX_TM@>z~NJ~S@xPyU?j$y|xX67Bt%)1!rh}YM@ zEzj>RjGmU3ejEMvZQHi9Y}>Yth2U&s*^0vWuOxtf3NcbaHqd=i7&k=12qR^L;roE7 zH24=V6~HAqjCcWt2^T47C}iXmlvLC-w4gcs8VG|(NWTSchhStdQW7!}a!Lv+a#A`; z5XeYMwvS1iT=j?}Gq?8{2@00T2l;9|ygQ7aIY~qXn}Vro%s`^b{{u@e_#(u!Ypj4mUz zEnEXG#ip0kb&jntLL?-BTQVX~loaIBL>BgmGm!xfyt$dlCC)^$5IA^d-26$B*J;q_ zY?Qjm4rgDf&wLaF1}OQZpSJ)el6Sgjn#uSfKYnN7uQ?F-!2-S;q9Y~d$q1=HOQyG! zAFi`q9_w7}$qGpw8?ju|+jcK2P8eZxB+uKu-djR_^UTG*>4;`Lq~x%v(z-wW=1UE# zzQ7d9hq^w}OV?VpbC$0P=RPi|qf<;w-=;iTDA$Pd#1%J<4y?hQc!G=VBBTq}Y~1g? zY}>|a-n!W1>*0H8e8p-47mXcvcWw=t2%Q_kL-#Z9W$@J_vRqk}>*P-him*PO?mGC) z_x6h9`!Vdf$F1G<*g=&$CUsLHOCF*6JrDQZcelE7lJ>;*0J;9V_tNuwgf|-TP~+N_ zlk=Mcb$CcsUr9nwK3%3e&X-+X*zIJ1RAJ4<(OJ}*DDIGX;Z+au?RD;Bg=w3^xVewH zJ2m+XljYuye-RB5_069Y^=^x@?BXL8n1ZXmcoiyR;OXyhBuvO#f*RJ(Sw7-Ma$@K3 zqZrE?sKgTE)SWlm};5Zpk)T!%&eLI)s zuzS6~3=c(x zd8G%Ax%Z)~%a*aNh_yz`#&udxnK}!2w%%#HJaoI<<)%+98Av-;hq`blrIF>#-u_z`{P)1OCDxHHp3-9d=P8gWM zX@)g~mXP8hx$=wSqDySNRGf|N-L{oyyp>K)YQc|8uCmo+(Ye}NJLtvNv6f0_xAxX~ zc6Ve2^6%r;pOhCrcIM{6Jp;<-pR{00$~~~hwjoMAD!R+(u6Kvzy~epVd*Y!7b}Bf8 zB_3K0Zdzc&L#a%7=;ahA9)erpoK+T+9tB;-+Dsqaiu7zf&|MbO{dRlMw>Br92zE*|d_v=Nv5lS&i*Zi@oQsPTdU1xjk z4L9@h4)R#I;h_;ZYr4tsyOrFLWwoQCc^13+TofkB!NP*b-iO z_Jbz|XEx#U%4he!%_zZ4Up>)Kmt$)fv51ux!xg+^@4x-B(2GLvAm=_c%Do1W8)lC5 zU7Pmh6QP=FXQ!{7(3A--;B-y*7ae#!f#_RQNx(zrZ3MXc-*+U+<>5BntYn%yBnBev zZhIt^&mSmT4j%k;AmE|a%eJPJ64Nhd7&B;O&YqjuiS2dQe$ffqu|?D-#x0;DG|Bco z|I6{Cc<5Z#vy(I*s`5iLrtH*nkggvc!pDbWDr6dGe0AL2yHCuyS6yl`FAI9f#IIGD z#_>+#GGw1eoqrEz^R(v0E7r{ixEqeynBJEci*V^#HyOx8aE^ zz^2u#PvfCish~ZTbQmta4-V?WLy_hT;t?y=)M9j!n*%RoXU5;JpL2+_c;ZF=;JkDr zdYLxubAD`y{E6V|`*=tjJDJhdBF+hmTP&1&@OB&f%TASX&_TaNyDo5ksBW>wLry@r zmpxOQYqly?O&ez$n$~jKKLt1Gk9U+`a%fjFvFYv!+dYB6Rz9yjF*l4A-hKOF!$R)^JlxSrOY_<+c8l&k8bi$5ApwQ`{uJA_$^-jv}SaK&lvWZtj~ zam%+bWxn7)&olosEdjonklgYwoHvS#4rmXDx7yUYu6A^iAi6sjj%& zf$e<}H%2QXmaJQo+3Y)upDOj&BH;U9YP{;W_MUIot2p-N5#`ofxO)Q&eVY>@=|Y=I z)niZAJE}Kcu7OOwtnd&fAHEvC^aS_eF>b)=@tpJKhxaSqxKBRgk7d>;>yXQoy~`c1 zPbT~J3VFQ1&6iFqr`ny69joDy6Wz zPRM0B#}?I>m8#WSUZVr3RuaB0Q{Cl88B1JM`0X! z?~NdS7KZaA=N#F3DIN-x<3zmy-702v7PlCBH}-aa`q|N8YpU0oO0%;w>D9Bh9^fJI zsuFB3E4F7^>-k#bQf9@pjYo~Md*)>SN^pZ%N2y$YTi3`-XD(hDA=g;8Yo~df)(Sv9 zOAX*#iS;Zce|P!auC@H>H@q|c{;ZcMYVJ;k-YCjlQ`liX+HY05xN-6B3lHUcqF4PF>+?BSa;c1gN zL5WCniP9y%)Us_m%)R=K?}^H{J$MMs+y5ZS7B&%gaOc5*@%z+0m96e4aCm4*Wl%*c zY+W)N^ryG5>ofzK2V$q+J_ge$Gdwgcgk8+U^o_h1x{}^Dzo2r=pLy9`TuJd{xZE~h z-QI!w%LN4|(22&CZ*AI|?QAZ`Dt)f1J3hv^UWfZK(ENCT)m&R+GET}W9D4+nHX1)o z|I*#odd_|MNt=RQk*8q(!Kd5Z?O*Y?Md=D|Pxk=RetKGdAPn(c z_!;5FAL~R(Q87qXO;?|cutI|%N)E!>4g82WJ|b?r7Tx?6{!;VqM|WTk9;M$1AcT=l z62f-k6;%Q~J-ALFeSA?Ev=X&oKqRtpk0--P5$Oq$v^zjQi3=$Io5ky`5T)06tTdDuT4#2vgoc)w(s1@CjLCPSB zuZem2fYq_6k)tb83*+PI2ta)uj1MXpgZ6XuFh=?+!U^;s+SllR9^Vh;?2hykb@o9z z`eA&&#i3U8^#jSf{*>KujMEmaBK&I@4fQ`v66J^VRQ2(34Em9%Bf$$;0ujG4^%rUU zbFm1C0H!^Z5fX}UB0xy@A9CdD=jeyj@^Ezh&Jmyog@|-T`Y4Mj!oPt;2I1d0RD^$H zTk#w2pVx$;4+;tD!4I^mZ<&1;`A=j2C)C5A2t_FIZ^b75YYG0lRE3GNqX%fp|8uJ0 zH-WxC2%!A`?Vba3(95Af1^kcdkN!lc@0IXx*&BUh__vnxpWh?>g<#)nZV_c91j-JSG-Pcbe=l{w$@~;l)|FF~k zN>`Ug@FNWM-ZRHc5NQGAR0`#k6C`1of-_>U3jw=tah`+yB{ z`#y^Qg#F5;DGKB2NG$FD+>-ta8Gb5flrKia@&9sJ|6Z%VO!HJ-j{E!iAzcVaW2Cd+ ze`1sWuL($~rJo)o;3E#?Vxpiy{}|H$2^t|Q`DfJ9(sI9`e|ix9|9{s0#o__|-v96h z@VkV6(E>!oWq+x>uMOib(6SQX@&03bkwzeXLI0bz08kXVU_1oN*Z=4)_>WEd9|`tv z-!K1Q-VE*dKeA)~mn8g)=kouBp83zq2Vno_bj|;oh=0)r{-P893-o_>-|Xe(@;|qK z{wv{r>ZAW}uTg#1O3Yeg}{xMhnx~dWr6O{n7$A3*#>lftp(*pBroZs^# zj?RRUdTS~BQ`+B`S^sE7`bS>BEdYOK^&h43GpFC;|B=yeD)HYr{l=&woTzA5rXlVV zkj`xF6F}PdLgMDZ*MH(30zWZq8_^{?DyN~X-35B0m$2^;NTg)@?%zw?VOSvgsfjLd zU|X?hh<;!@MxX)qZ-k46XiG+bNQg0)2q3T`gC9EvLOg&Atk%E<`-*uG7ylh2LBv}F z_Zy8g5hL;gLrn7v@I#OnuuS{Yi*%e2{HHeL-~CFZqxY!vLBI+>}I*uEtMkQ@Z+K z{JnlbQGm@RR}>nF_V)yF=rm0Tse>&7fCGMdM}I$zHWH2W0edbk00EhTPUb5y%@#2M zLkQ9Jbmann|K0MF`ulj8YFe6ttiBd5q40mj==-`Nf5A{Vdia?-y8eRO=8OdKkb!=> zzB;D*hn+AO4?==e-_XAhQ@de&f>k|GuHQ_`8$sr}og_HUcozin#&wyFKwruJ`}+P`gT|F)_9+otw! zo7%r^YX48$)Dl-^`@lL3g3Q1TBP`1pAXTCg#0e-rxF93Q4JbtX!0k(fyZ{CBKcV1) z)FBf{l8_*A9msGWfDrV>(-Do*HP$i)@H8Q3RkQ{{A<+QtKPpBDZ=XV{S|&fQS0OF1 zWB8|PjBn}`f&c_6q6))%VKXv!#^+F$p+^2gF1;JdgRH07Ovx{3P?1UV>N~TUsefqT&bC z2Y!&@-B)vBw6CZm;cZ!>HF2P$7o1>l3;{!CFGqqYFP9S%Xke7M=blt^bD><6xGkjh z#q_<@k!~oRU>~GOuz{&_u)DLI3$SbEQVf(2^z`yX`Z;m|J7~18e4r9HF>!eS6VPyO zE+UDayAn6?4OT8oeIqV)j1Q7aN>p6LSxi!fOG-vm0wIHt5EJIo$Dp~ikWO6Ua$Mk@ zT?CheguJ+Em)t-dIEHYlgt5^s}LKfTSqK#}zIvCnpCNlYmP|hyV%^ z-ymR28z_SI<@uI^2GZBr2jxXDu;n78=m?Z&eoEYcU7{Q=&fin@0%{*(nl8?8qzBRy z*yZ|yG7~3=wk5Np*LUJSE!>|7_4WTTsi)`nWPSaNkw0Yn(}aBqY8yDPjl}r-I0KuP zV?5uo@#WkwBP!dz)KG zOk7?JnBEhT)(6J-$AbPfQqV$O9Q_>s6=HpTc@2!SKcV_{HI%sh{ZTIR>e6zOsuFUN znsS;l8tUTWvNB@Q8sajVnwki4352u;ks%OK7Y*#r(9Xyo5oP{aL_#&m|70)?-Ywwf zA|fpb_3hzLXt|&)WF@6!#Ngs$;QAVF^-sco1e>8zpvg;qjb{L?%}*dTP_9T{fR&Jz z5tfiffLj*aa>5ca62cM)DR2Xvtdy{{q!_rx0Sxf6lEM;lGQyH#;=+>Rvf!2zmX-jw zqy)f$bP!_T2DAu*UmApiTT)6=LP1Sk1_X%9sLF{U5Yn>ZVrt?NQnFg=suJpIAO#ul zG6iUZ@8x%MDkySl$4Q`krI{? zlamo6x`2I9aa*ng5wqn=0=%^N7LAlJAr^w@0#Sh&00Ufrk&=}bBf3CL00SX`3yK9H z2?~wi0(#)e5nNe730y*6lAs6)E+H35P_zUW#04%fE+|+jaVZc=Z~?c#-NGPk>TKpejLo{ejn2R|oIH97B140AFKmH7;FEbs2Fv85t1?QBdbU2z9`l zG8msA(8Ci(Ek`fH}=&xe|S#C{@HW7718DQo^iX!2d%f@MCq3M1v)H09bqDKhjx(*^h&fv7wgkVNIgag-+)%3XLHF8UatV zpATU=WNBs1Mfn!!38;ac3NQq5boTYqH_;;4FhF3c#6_4h5#X;E(0eR*Y-tf%MRbg~ zxV{Dai~o$yUOvDI0cHf~C0)Q08^GrQ>=EGSMZkXoFpHBr0VW}6OIUmWg8<$|fL*s> zVIs{Ie2@UUc%p#;2nm5_FBeZ20{jBNmrwW;3`0l{1Nhb&d1bP9l(mf>VnSoC)nvH*bi7}09r^L;}t}-S>W35 zEC^H+aUT=q~&4Hp7f-E@4w%R>_K{(O<#UY6RUJ_pv z(QFD*H#X&R_V+olMM6gSBL_Bx3=j*%22SGRf%ZcpkOYK)6rh8UCUgiggiIkT$R60Y zxj~-5!Yu$g1)YH|LSfJi=oSCyWm!1e1Wt!jxf}u){E8m=)|O%oT=)`NK}Z&cVW9QLuQ}16T$u zA65o?273)_hIPRPVH2=<*cu5b2^|Rw$sQ7Z5;%!0i7JU6i7AO4i7SaWNifNIlItY5 zNs>siNs39Hk<^p4lYAhVB3S~4g0!Tpr29xkNM%XYNexM@Nsp2GkcN_8C5<6XBF!Z& zC#@rGCH+7;O}a`(LB>qRMJ7U~K&C@xM&?ZBO%_UajVzw*Az3lm3$j+SL9$O|IC6S& z4ss!Kd2(HHOLAB80P>6EG306FMdY>Q?c^im%M=t8tP}zi2nrnvD~jV3Cn>H`+@;8) zcuLVsF+{OMNlD2@DMYD6X-Mfv=|_2yGLABvvYN7ma)j~=6)hDfl?0U*l{FQb>MT_Z zRVGyxRSVS^)jIWdYCdXtYC~!l>LBU}>J;j7>L%(D>UA1M8UY$58dI9%G-qgT)8x|B z()7|S(9+U!)5_5vp+(W2roB!3i1rojAnht06Wswibvj!*f4b{*>2y!&y66_@>FN3D z57JxH`_W&g&!DfN@2CH=jd`2sHr;J5+pyabwiRz{**42S&A`W?%3#kB%n-xyn4yVb zdOP)Y{_X199k+*WPuO0zy>t5#BQv8oqamXw<2A-i#@CGFOq5LgOqxtCOy`-BnQEAZ zm`Ry=nAMq`na?q&FxN7Vuu!lFu;{WJX9;7;VR_5)X$R8|sU7A!0(T_rsNC^^m6VmA zRhQL+HG;K(wS#qS=boLaJCQrD?9AQSvU6qE?p+6WA$MKfmA9*X*BToan;dfe*lXFRceCtP*zLUg>h6Nw-5eww2RMv5PI4r3G;l2K*}F%3kJp~K zJvDo#_p(f4teLDO6_dVG6 zcHcU;0Jju*D5)L#8kqF5M zp@i-VH4BpibqiWJNw`ylPDEAYgh-aipeU>8VbQaqC8D!%UbrF5DRocky)?75zVs#O=hB-p2pJ!l zT$u?3FXAZT4x&?*Mb=36n(Qk%ayd0QtXzfMs=SQ6pL~J*oPvmgyF#YIxT1g}QZYqw zNQqm?QR#uw2W2khqssS{Kd9_eaa2iC`FN1$pv%FugJY_Ks>fBcRcF=2)O^&6)K=8x z)kD;uYLIGZYh2ZMtI4EkrWvobi zAr6HcdZ9NxW%|lqtsFH zsL#iBjwc>paW`~NcgK5Jc;tCfc^>sFLo=b>(JwH2F@cz7FCnjsULU;Wy>EGc^3n52 z^M(1^`Ih>zfXP&Y|9<}q{(~o!Pb8f95?~(iIFKPfPb&L^Lr z+IQ;AslgD{kO!f#P^Zx6SRU+o?8s^D(+|(koN+(XcvkFe)Y-*z7U#;(?>T?^{LlsM z3t1PpUG%xwc}d|?;$^bSsLOA!NM4D%g1hQ+^-Y*qSWMW)HRo$@!o|aHhvTmwyZ$yp zCgR==iW}$~9g!-L52F~Pf}@6_^`nb#a^1XobMcnLt=BP9F^RD>vHr0iZXdo~8pj)V zBW@$!ExtWLEg|m?$DJ#8R_?moZMk>wUT)%^#IVG*`>6ZxA80=)PU26BNv23Xkvy7W zo>G@8o0^fvo)(t2nT}5X@X+|-iws0YMkYsQL>5Vwf7V2{ZT7nyjhxb4k=zG)ta)LN zphy0XCi9QxcNFLqJbx_vIJc0m@JjuML={cd`6_&MaP`ttucy<`T%Qd+cX-}YV_DPo;>e4)wR*L$UTVFpsZ*`1 zex>xP;AbbanV(Y@Ytx|h87YTx$0n0}7_qyfQ!ybm%TDhD+N z8$OzR>=|+%ni}>U-WWMQNR42*H~bo9HnZ{PL5aoQ~G21x}e3>?q;vURDa&mBDE*TXmsVDKISi%9hs^mui#}wXYA|)Q=e`0yoJjkQA!`R8^ zvm~#S`dQW}6TT$pg6EXJEz%z~&h0df250f^V&j+5WEXJpGegWLKd#v?*gCXu{$@(y zuPkf*bW-lm2j%|4^FLtuw*zer4osW9&&s!O%B{7#`eet6e@ibG|8D6&gwf{z6h>SA zQy6U}GD`VSXWW^pHn`*BJ+^Z>ap6aDJw9v?t-wQbFW285{n9!oJg(50xcOxusP1KA zkoC5uF+3EC==c7d-fw=cG6)Y1gsEq`+H(Hb3I8E8ZnkF6IytAtD^z;o9juQ41I#BD* z(Q-=szx~-c0x%d?V`z>hIYLDo#n{xLYe`OSna+`V zzmBPrLbu6@|om+Hkfo%^>3f%BoG&)=ny$3vnRcKa*;?c+1P{SOb#QG4gs zr6+JXR28b#ucO29>dT?SPx8;|IF+eNj+J5cO8QK)vL-R^bc>**&4p zik#aFBjQx_>o(@bxFdtHBe_MMNH5Ptk%QJ19Zbi&`Fhuc#g8*SojrC{wy>?F*!Oc* zVM&2j=b?Mo-ejE~*@K5>D^(_9qH}~^-LP4$Ht67)m!DY1xJwt(vbClq98R1%W|^xK z#4d}Ybk!(WYkIKRoz8LQ^+Ybbx-H&7@%3|CwzpXGVtA}1jVI0Hr zC|37QpMCFPflb~kSyz%AvSVTs;fH2Bw1#%dhV~^32XNt`a&YYNxF$cMN@KytvcD(o zCT0dbBSmX-c{ahYO*CF%|JY9Z#7-pzIrM{ouxlmab+jAC+=%zDu0>XX)A058RaCEf zX1woR4W2TcFKe6e>*=!;xmlwZvqt-5a52RpivRS#&+&meM@3nURo=>=JN&{ z<4q5hOYLhWI*h|A@_J(rvR@~MSi6?Bci?8bq!LbA<)B5-JcY@%`Ua!gH+tf#N_)*6 zB3izLXejdr9>+ro8*^)#EDh2QLQ{`%x&kpt#UnZ4tlbUWzSlx=vPbqPsrAP+q<FfQWL>d*YJ=%>&i;BD#wWP#plh_a1GWsvy(+e zKMhg}Ctjn|Q3-!8c(!j}25X!58@Bh@{rCC~O< z2(jXhu@`&tj54DpK9_+N(X?7UZK5A^?v>=Y4C3+o_dOHkq^NiWcO%-%!h;ntEt@G- zSFQHyw6@=CujDU{yTv~?Q8D1YYxr@sLTqn}1jB3dR`l-1;Oh}-wW)5g@hRBk9M8tG zOV`Y0KEG-%O4dF8^i5v3|F!~f2e=%q9aH*B>1m(wuzsgM{L^mOI0%e zx37fo9e?a=Rc^Ca-|_Qy4oJ2~HFw($SfX+;K}e++S64d0X$?$u0Ui}bI$+Fq*vUB; z3O~op;S@A5^r0aoV)asPP(VZZO#1Di1j1KC?39D%{OT=_78mYhka#UrCtcI)&87K? zx5OuOQd_5UdU#_Wmk`>mum$rLE}%WyJd$WyG+1FL+fdMLWLF7Ayps(3D7XDyLAMkK z9_p)h=lP&_vGsVB_k#K31dueGXkP%oW4851wjv~-10qj=7fD@s&C z1wNacxN?X3xwgEGu43(KvSR4r7(=-F!~Xu7wD)~Y*}8jf*kE$G6}2X;K8B}9Nxs#Y z5g84a+q`Knw|{U6W83TzfipL_(_L{wd?I$ft3E^KT6uX+X(1y2;u24?K?$!`^Q&;K z;>FcuxZ66_zbT1Tt$%d4!ME!q1q8A-3ENK#+4T#U3?5pQ4|XpNrU zP)rrxeS=11r}t{-@GGg-hjMX81)ZEEb_bF+KGf#T?+K1>WD##-@p{r5Jg>=tb!~I~ z;=@Ch8~x%^!otw2<_YtF!LI&gz1zu!2=-Hl=@Sk#gyu`Poe+ij4Nlm-o}Az8REEF6 z*;_c|a2#q}Z6A4gA$P`aMr+~l#gxCXv$E+rIO!#S2sbqI6`MgD%CO0tLSzi@zTPu_|rqvi@L(t zgB$gg`tGI$9fj+2Su&;Z$h&j24r=YWB71D5W#r(9P!ZyqV9Uvu5SvX~4j z%^ER}hsJhB7tKj%-=CO|EiFZLv^a_+XQ#bq7MOLqr&k)va?HfvlTulQa{5CIwT6{` z+FJTukHXE6Lc@oBeRkUJJ2qcD%2wNz;}WA2Z?)Ho2RGH?>d%qlf*aw(T;dXcUsTNS zFf`aLxGL;n-AG11z47kAIT3!>f>L_Q4#x}cQzUH*MRa3VEWA|_wVMM^d(rGZR8=}3 zUE(i|=7zbBo*Ri1N!=6_$c(xAcw#=dK%2H6AX-0kR#`oHGDuRukYZwoK>QYl1t%7^9!X2Zi;;6|<*&}*Vv~LB$V)pZ3%mH5d zX1CR98NVzW+N>OPopxbl$=QxsA;F~6P2QLw`5tXvZoy&w)JTm;U0&b1^&>|==})V9 zhBS?)#kr>q*!81gPxwy6dUqXX-RX-eE>LS#6S%G}wG!D?h`v_1ID5~)VYd3hmt<;z z#Pz(k;`EU@CG6#j&J^W1h0xP&g$fBvXF8PaD-buHQu~iB%jqPN*^)g#zdIL;~$4-MO@EZJ~^WUvTM z1QvW_VBTTlu><(DL@9Q%SS2bk3WrukGcHTcqo7anT&!1Af^ZS@(-Y1ZH&v;2*l8?g)C3jrG-TQJ+Nm&QXIVV7`O&Z~l} z@V|xlyC(h}o0GJjN>c=X-=ul)sS_*p($md7FB&=akscak$!Cgw!Tj0iXw3Da%*Ah{ zkMNfS^O|TLm=7;w@Oa^4@$ok$a~{6)50fAr=^2tHo8sbX<1{Pt z9gDiICbTA`uRd%kQWRITTg2hW=!yB>28GSqW8-^_PLU)_C{OKN$>oXo@MdR zGMTgn9UCQ%qjqXdCixw+9&kVB0Jm6n=k7A|#8#`1H*D4Y&UCiem1d=hM_$exElf@d z5_(ha*|>Qx!3S5?D&qI#iJ=v5V9pSNo+X<~Lin-NLVlFtMFSO@4fsVX-k_Bnz7>b) zZs88j6uL|d+4=_rC@gU=wR|O5 zwO3!m7)B%Zjavki$7E$pS(vkj=IqHy%STRH*P?tmL|@YxD?Tcmn3QVV9gJWMu1Zh8 zCc$`c+aWc1PHt8A?D~h6lWXC(a%$hViTYjUJ#Ve+eQ;02e(Mo)Yo8e2Qk}ci&XiY* zwzJ-#UNw9WdbL$5A)%+IQbnsO%&6tVt(>~#315u;P=0{Sw3fP|ou?-q-|%sB$OK(4Own{cDnnPjyaM5I`IR!%7XdBg?EBt z>toiIZpyUuHX%iFURcD$#-yp33*JZTyy4ePLQmH78dUgfkEOX0lRh$glPhrK$&zt*yKRq~od-{?s@ z#^Li_wNp`6+Ph)~n`xPu^u4*Y*LT(PEwUEg)*HDiV|QZ8>SjfBza@X1B3XpS(CU(909G{woa9{OLE(&jowP^^xHFK+|&^#mcwYSHB$)z^k2VabLL?*1j zxTD4!aIwok#XX{If1cxmS)HR%9bD9TksG$UI(xkVhuzr=f~VT5Pz35ua!sGKI8R-~!J+ z)xPczb(pQItL2R%X-N(>A0KTQ^cS%?(zYk5@C;mZxMYc|_|aX_AWnqRQgqBrQ{U^?jsPZI|MOrEMN!;QV1n3fnyHb-2~7v3F;w@n8J7^SUKTiHz0m z*gBRgr;%Jres)ErOeAdhtN}yKjW1tHIHb%RNC;bI z$^Iu@-7c^A)}fUi5o0T=izMJ8fc^=e@hd8gjQoP|1{f9}? zNJJB*_i9+SQ6z2w54A~Im4h!%o>19iXPz|$S6WKNImej}J?V&Dy)KnY@P!LiqOiAz z4$WCRjLNqB=Lhsv_P%rI?&aY$W;51M9)B9qesgS%p|sd>?Na5^r4e+xFE%+PTKpJK zm786??2l>a)=sCx*ZstwcL##1@4+ix;XGQU!iB67w2Na8wav}$?cZ%>H&S>KdER_f z@cF}~p4c5XB45_6;!+{fA-j7!@$a`sl%&Kw;=3hAQ@6sgI) zD7)hb(GdnYV%~hUdF_7!Rq@um(ZLYwG}P4 z=@}e?M?>VCiX%D#*&NsA*n%no6~+4|lgBrLV_J5r$hvoj+%IYIe=o8au5JcYYmGZQ zSvyct`TCqmX@l7qkLEP(C<7JKE60Y`<9LRi>(RkR5f9g}Oq!4L-b_uc;~`1+*!c6G zdi$GF-7wz1$9XMXd}7T4Ut};}z!rVhiZeJ0?HJ%apES0>U<)R>ahPJu_<>0jg^CPuoZ|;226{xxK<^U<0^T;NRTs~HY z;n3IuO>NQYzBaVAVEC$_2ZHgjVY~om1_ns}NAIHtDRHTjYTQLmwfKP*+ zI-3x5>8*WWGhf@HOM6G4@KTt&+^JgZlDk%MQCaJS&bhR!EhjCjTLhV!_|7F|eTv@P zh`h$_)@hhNGzX$bS;gLzo)fbRb+A3|W7|Ddo=qF*F;;LaW_L6-Ry9PGKIu)PX87<~ zst1u(vITK3ye+tHfF+(-P>oSrMb=4l)iL(IXv>L!?py2X9${$?cg^1i3p8KnI&%Z8 zI4sJS1i~fAm?&E?ERv}isS8&&o zi?e$cu`0%#>p89F~j}g@RsVA_vt8W`mcD{`dKVR}`k0rx?#Rs!f zu5@!AS*ShN0vLVV9$@S}4_WeSZ+6b{hO=t3xW@)$eTJ_*EJ)9uis`epXhKC;cK$Kd8hTk2}B9j{|hADA4@(_VO+oTZxT zcEoKh*+w_xxcLc8hSrV4GjxMx@|UzPMH`7Za&j)KY&&v|Rz_YzSkG{Q@}9?>@T@>5 zvYlJm<;gqx^Bv3HypJ?@)M)cmh}ChGjWL~a`}_=ShODBl86H~vypR9Vf@EV>Dqnj{ z$(n<4f=<*z11m*0jhh9xrRfHvR#b$Bu2;3ilOSa5WPi!Zsd;-AjJM4iHZ9BqD>E>$ zviEq~sVAd5I(edoG>gj@c;}AiKO+m1jd8H<=+HB@?70^D*y?Sh@8*0pMcrw3GK=;J z8-r8H*^}`l2^%@e$(h#f4BI;$&#t{Z;=NlV%f(dcwWl*(i;yHm6s=#_G_F(e+D9^d znl_H5p}nLh3Iy{jrs+S zW%M$0&8SJaAx_fAYe&*Mz-rOIq$a9%_fA`_cY2g9 z6*IXLp~lT0&RK18o^-xHE;7;tUo%2XT#D~kF>@EjDBihOJTM-mxfH5gSmynb?)pHj zs32CH^;Mp9greyXnbuwMn(h-%7PO*RZ@f(nrHt%X8M}BmTT8nB zOJLM3ca_^!$ih|={SfaNX<4{`mfKRo6%XN~rTX$8G?@+|^DC{;T~>jrt{7Uq&mnj2 zc$1*369(`QOPKk&1=6?WsTUrEnXFw~J8y5yZF&F93;pbcwJyy_&RBW)_Ki~SFR~v# zePn=x{ri0VN>cE|7`NvpcX|{lbhaUzmr&VUmAAOBTkW%Sj8jr2(PWTby6U5o{KaB= zgbnI0KYx)i>3G$tc7gc?-O;SuPMvf9Cs7}-b{cNJFlTBUUlU%QTYsbatQ%t$SiN$p z^Pb&4#*-n^{pZQ5Z}+>%>)$C)kE6Iam82Ws>Q}t{;&|{)3zLKIyyE3Zk8q!f?`Ung zXPAwfX*b~;qt%s5^i9$xh%dk@0wQbRnQSCA}UxjC~^N{&~5if53( z++M?e-q$3b7E2e_4Tb5e2njx^=&GAsA2Q8)W)cT_O19WKr~ z8eOy5>l5M>qU9bGSsn2CHOKKU-aFJ+tMXn{_vch{AHqX#?jL98{Im)>vSi^jmHvpS z(3^|8*aPT|CFf+Vckiv-%?o=qCA)0T;12s_zth2Xl%7NAA6~$jD~G!mgUP_iC?{%Z z_X*Z1T+uMaNyf$AkJ*`u6t`_J7%y$QoN2vFW%r5B6bHS6F*hj8>{LH}2q} z>nzyG(F?tQRLEn&cWr;);a5FYng3_TOd0lhBX>D1%L~fdoMVo)j_8HCU3f7;nYH^0 zPY{>3CBIvr*^s2R0L41n{)X#1DXrYGKbb=v5>n7Pb}#Vgb-7t9>rqpqJRa`z#?$1s znFliGH}A+~mhSjH%YQ}J<=h=HvJ#z_8^5&pYNm*C-8wu>DZFd7*Sb)WGxf76;)`=* z@$T^|*BHyXuELI^*Vn{UZXwTi+hHHa1bw!^UOqLGK9d#XK9#?%#9E}mcV?pz<0m}g zu(Z!Tt=2&?)T_TPWGviZR(9kHKkGDi>6O7-*yiM}p&LROtJnI#_jsRhUeC=kTZ*BM zLrea;6P?wf!k>#QbU-+$YL-8Kmzyh+g0vVE_H#M9OJcgFv_Z+Jig8mw;IR8;Jfz8x z7K(Nc2zb}CS|+kI!){LPPu^Ie*i8K(FhxV#!m#iO_{zAIAnNqqh{KV4R0Y~6X+oVh za@)B#p0=GTNzyuYwwLy1yaiRHb@`9DO0VAQ&V zn(^Q~;+h{f5+2F1@5=60&T8R$4W5YF<@uV2kQIf(r$@VVrKl7H_S($nC7h}p6;T^7 zC~Fz3KBraoq;lKG$^9QjCh8eKW|O~(Tn=qoKv2AycR8N~zgiks!;#EmwwMwxF!J_E z*0{I3mm!Mcc57wD%1+5(L0Guzn2;ct33RYdr{e(xAwZ+;<=J5e6)S^nm)w^ z={KqC8OF~e84uQKi*B0)>doP8Y0CZ^bA!jk^uVMfVdJp8PCvqJ*f?t6f$`_(8S}|F zDj!VRJGLV?3X5B%4B>Tj%12|m6&jr_qV|v8))hJQj59O$;bqGC4F`r9p9Wd&m;AaQ`B}eoEstYQ_60`{4U^Hs^$ z%Az;lSn=)Bs_0&zh;sxwS(Df3n8+@NN!m2KDH%pM%k_~Fdae)3&ybu<*n-V$N1j2w zha9#-vJp%wqo2V}yJF6VsNVy^(?uSYot@S>hP@E!!?7WQ%8}e@B~>_DO}*Zlek4^;gVy!ej5<##be56iQcY` zd7lTOu%L$1u`Q-53+Bpn>sQ|ge3^T#vV?7|o;bj{n#D;GQtP3x5ip#%Ry{GWc#C19 zJ>s15$KpLWg?YnGhsC+ILzi&J>p*HY+wjnyRRLVyTEHfsIv$dC{?JsKa|wHWBN|L( zHx+PEV33N>|K!?hUQ=Bcstdkpj=PJ8bd5mYVEILIR>*N+sG1jO(D9G~9!hzL9nC() zwzA{V+}}L@Czs=Mv(aj~AhoeK-Hnx1C5}?_?|bW51bt~0o~S)DGnKZwGA+?ynZ_%l z_)aIqaQFj{+V$%Cgp27(Ux(gPd8oKrAzOi z^d1!uAt1dsDGAa<5&|S7@omqH=bUlo-h0a2`_4P>{sXMN*=w)8>Q{ch@2deaX*+Xl z+ggVD1RT8|yp2d-zOcQ0s4vF%u*zslV>Y4M5cfmblvlEJvQ&_gSJa7yrpzE7WtXx} zyZN&mw4(T`8616rvbX$wO`jY~Zml=TzV*tZr0!)H-#o!;)7h^7b?04o>DZ&dWfv^Lt=h&hy{Vh;noe< z)u*p6h7wCND6yeHrfO3E5Rma57f(|fAtV2YVC9L}Hn~{@c=Nm!!_7y#5EJ)9k1W4C z2Kdd~-o?JA*&+i@%~TVxsC-*FbeZ4NKe++i2QsZ|Y)j<(xUJR}Yv;9(@ZLpC*cj~v zU-%59iyxX)D73sr7M{C~Ieim<(OYMPyPm1aYz8GaeR4=T7R5N1Wu4ytll>(bJ!y5n zYZ%^$V#3tLYwt77>f`mIF=K*Gx?__X)zh<`)knh)!G$3|1%IIu-Dtw_o{025;fF|F z#)M_ukt_O0^qh|+J;Kn;INkFZTjvhPP=-u+Q?=+c?9-&USo?+L41&aU zo8u}iqtj~ju=n%A_I259g_T`rDw%o3by9gB-tASNj87)Wzi@?PZUDaZd>@40af+yJ zR%}i+F0id0J-y1HYEhvTZe)EYM3_h<@WuA>{qVQ7|wuOHs}lKi*moly_AFIx+pKmzAA|4 z2NBL3MgH^pa4kgFNf6%s)~DYB5|KdK^sfh!=-5u)NZHgZ@oIqp&NS;CSr(dl>zdVl zeK6&oRvM|H6p2<|MWVu+|LuwuF<4P8LxZJ(aYjGBq!uJol-&!}fs>ZS?}2Xlx@7@k zR3?ZZ<{6WLBrDxcE9cm=+8!OXZ>z$!pjB?R--xgq3 z=cFsk^FHD%u6&8XAisQFHe0C}GBba^lk1vzOQ$M99;J8W!LiHg31Jwsf_0O($z19M zko!jO7Nd8ET7*;^Z#DE#-|sB5R^`m+%|-~XjORBdZuuS~4$EEe6;;7#3&gN2y%C7D z-K3*f;Z7y%nst|$wayH(`c|;`YQ)fZhNai@0*c+`eHS0slINM%-D{*Wvk{g<3W>dS z<&sXP`eE%d%nr82j1Cxx*pvyY zoTdSGZUA2wzIZPNfn^NZd*#}Zc1fK6>D17oI(NLTH}~=cXU(Rm{xFXObUc1i!%N(> zXIqRz@-N+;fyQrcY`Xfp@{G0z78iKM_Q@NE$=o;`cY-g?eT{jKX?J&=S-j85?t;^U z*vYs{m@+QiJB3`$uCF+cuBi)buM;rb`!OX^aM}M$TF;aughFtV{@FB)q zayt`G<8+HMijEt@7_ocU75Zd6ZE*{%am#a4CFg@2PK3%2oH$cABD!gnDQKGVAbeFp zFd=M`=^jO$I<^nd?FjVS^QTX`FMoG7LMgi-{FC(_3G%TSQx~$*9I+JZ4gewnK`fQo zZAasK0?;qm`R{7^M~i>wLH_r@rc`_HdAmNele0`I+F4MWe!9@Ld70cYVKMsl z>|t*jkyPDSQBGNS*$MUtCmad{Vqa{>x?#OPl1<6j2?|`H6Tv6S2ag#=&I`w^EX^4H zJKyBJG8ZsB8vbmhND_2%_Y0NHw=cF%(ph6pa+z(X@zcxczUa4Yp)=I*OXu()28s0t z=$9mte>g?UT#L+6ifA+C=<-M{?khv zz{(9dVL7lwCraNX_1=BJ^?TypFR;=-Xl{e?W_10!TFfWU`!5!AkV+AvU#QyjKAi^+ za8m+;jLmZCGy`1W^C*Cam2eOuuthMS06?jL!Wl6`L{B|nygfiGE&%7eJ`#Xj&GYY_ z(x1nclaLgGc7tUF;9Y{DzfkS<1hzAJ|4&s8!Bzw`oA{|iPM*>yyoP7PD(-pEHE<}g z>F;HsMW5El^`kfh&A@b$)ljdh>(6=1>Egqy=KuA->pvKgDaw7jlQ+-itG?*eBg<*j zy$DsM4%S%+&lUU4%=sCM^9RkGKkv4`yJvpA8$@w}>rVj8JXF7}i1n~%=ymmiwY$~) z>c|h%=vS%+_C1NRSq*#r76qX1~t} zB=gq!{TEv_x93_owmJ{qDhkQH8T76^cCZcK{{Qy@L!r=lo5ulBZmv(|pU(YS-}s8A z_*~gL-v_#8r|34~F$=o8p`da_;@*5wnVPrG#<+Zq7)%ncz#?>Yco>I2k` zA{6fdP|nIM#M(Mwvf7=;YjbqBHzK4I_YggJ+!omku{t+RDPAJTc#C2R=e7vuZGhTb zT1l3hMvTfM_|Bk7BL}nJwK`^bVFvl{)##hrgjx(ZN^4#}(*f!UzHMEL^cR%Q%TN6r4voAA4LN7Yg}r7tHu-a%iWJpLry0MFhE)F;SqOflF* z!Px+%Bm1{d*Ix+tK%XF5IW|=6@kpaRX{Gq%S?}2`nn&<*5Meu4doQAV&J+=|wlj%q z+!-?rnN((`)?-mi&wN-PGvdrf8MdLOI`lA2@OIbAmQaSd0=wyx2wkYb=s>%KY5uh8 z8u{Lw0IPNxU{~`XQVIz&@)8DhiJb%#!C$;%U~cvfUlgWppAKjZdrICdq#mO^vK>d`X?`fHiph08R}gceM(tV6r>|T zYWB5+gT3L2wMp}-b7oCA#7P?6PMxCSe$w$f!J44EG?<4zGNwlbles)e@ z?5w&540%%{(z%%p0mZUmcSy9NL+tr()0zL1aFC9S;8)l>VT$<1l4jZ#Qn@QO@o9ZlE`= zQ;4ohKrg{fNxVx)OF;3$Ia97Hv3){@eV|lXr|3uJGtgT)AsrR{nPEGP70> z^&6rm`dF$3s&4`INp6Z`)p>PJ0s~ztA4WTVZpxQZE1L$j2m%{cw}5kbUhy8fSb9su z1|Re?EGKMCi?(Z{PW4UP6g8;NiP{W)T3SYAZpfdh&2;-=z%7Q1=RW9|HT>g8QDk*q zJF@gX2W^o3*kCS>uP3UIH=hPFvx?>HzBpT#Tzp?yCzsBRma)0=Y~d1Y0TXNzcY6ClD4gkuv<`IhH1gPw^gt?UPsIEK~6>hepu zUpk&V)XCFfkeS6%vpZ1JLe`#AUfQ;P3(}^WTeYdjI9E#-UThq6N*crIk9cT`Tfi|7 zn}&No$PWbG^E1E(8aH+`BnuytLbF;&U%pQ~!8ytNl+@>qK?qE&k4x)JND))G>Z09U z7zJ)&y~1fjhdmc4D8cSC7j$o0X4(TZoASahRMU#01dyVm2ju47i>zxeroK?MYy*Ok zgji6;_fjSO0~o$gbKmm$CtuZ7Me$Gxz>2>_C*%j4g<$>@Gu<_PH}= z#uTE8WNLQE24@GVV(u~?NEKMEytC3LsRlQn5ff~C#8F7_$2RveyRJ4V78kF|CM@$5 zkLsRqT7F7S5ItmYs|yz9CZ4Gl!70u$Xni@_l=>zm{>+$%Kbcj(X$XIuEQnG+<<4U- zAoqCIDBunvS^V9jqfgOn92$>^~Xb%WTM$WI3l20=A~Ro=!Vkd~8>n@cF>OTSv**R9ixiELB{q5ag|(36a!0DUUmBR_EmX> z`zcmG-DnfNdncfKIZF2QA^ARZ`OR9*<2{!e=?e4R9rzFU#e;61hSVX?XtP_|v|n!L zrSA|7=Uq%&GuI>44b;q@z&GNbw2XP|OC9FP8jTe5L+Q%AJ6umsF}QWzO)Zn1Lw&*4 z_01&+bCFno`{9Fiko{+&=571ZQ}t)e#hi>?Kc`x|!;K~i z(a&)wXEXv{y-+REd~nC_)>~*Qx2L&0!4-0^UQr(LP=Mv}B5(-N4pZEruVh5`U{q=q= z5|j*+HxTQz;|UMHB7GOWB7F^)S4b|ofOsw`g8umIH)6=o-iWVa$ghsvV_DsEmNlbN zV5IQ+OK9CxZw_X6Yz?)ZnbBVmD>?R_uYM<0IqJGlw<|~S_U8j|f@{zZ(Hg}^kx5fe zR*x7Fs|&&AnAdZt3=%d*F~rPekaiP}cB)@`_g~Ovg_S)ddq=iTnXI z$h<(<=T8~_1z)J#yT*v?H|7fWqE?9r!vhWuMFiC6Ly~E0TTac}a*#kv|B-PP#bD;FG8S`Zv zU{6yW+c+cW)zv*Zs-C(0zBlTE8Y@BA4=+0Uwu$#&Sfe`UacU=J=g|eFf&Rt9ne`V7 zqDt4iOgizANw(0om)2v;W!~&97M#gzE?9%$NsbL9$Ltc@bA#zeZ^Cavv*J0&dv)w_ zYtlHP6Wlt((Z~K8O%YeVNM))o3*?6SLB-X#>4pc$scyCdec>w*il%*2NPGdbDWulI zpDEFD$}GnWswpW*Tgc}6{)NIqB;+j@Y$q#RQTX#TA4k}QSKN>K`*#Bc)f$ofwbJ#? z!;9mbnu7X68;GHm9R@Q{dDNfT(geQ8sFxAJ5tDH`uF9RV)a z8hwg_y4qMVK4LM^wCgua)=tGNURUslA4D9$#H6#73&k@5*6l8P?_7g<+;?%k7^saBS9+1@!Ju-pcl$0KST32aT zHEW0a*yjx^AnKvkHBZf(G$&Tr_!oDL?$`51!9kCQ$<6NzQI*V+E`?Kt=*;p`Ve(vl z$>jYt;$!2o=qU%*%T88nHLk+VW|AK%`5kd&OSuWO;X->jN%&C086}wCFc4}Z^W_7f zsf&TOi9#ZheK$XC=4Fip`Sz{}cQ+c=?_Br0O04ueNWATQ-`CRZ@gP*yl$7TLzJvXg z=}8049jI9r>9e)`SisM5JbaaEw>R z9r0RA^~xw%vvoKpp&{9^Gv?sFeyQHqN~oerct~`E1hE5ONfraJ2o%C>dlcLn@EZC z*wll7V;%CkbL_BPHXoloNX!xCUK&S~X&6i~lmwcH1|vPUmqQ+$el#8iO@UI(h*_yp zQQqqSNgk~9kal!mZyTOuX|Q`BdBe)l|R z(8smr72BOlJDnk=kEgRpA`0?N-whdtx6`x+Km6Hny1b zEsiA5F7rOTvi80)4-f|^xYLXxJ*G8C5WVlUQ9CqDVF52g_8s--7r#(RUYo!wmOb~x zS9k=2RB2XS4H022Yx7p!!{zY)(m?AxMEUFG!UJ}nQlu8#Qo0*$s;?-%mTgF(o6>{q z%9JAS!0n`0(R~+He`*@-sh>%;eoSFy^d3V>vBCzM*!0Pjm2>J{ABpJ!ZTPPi>dTs6 zsMfkpgD~PIfEZJPXt%5&)?;#EL{+7529ZobeVE$sw zHDYw|nJgyU3n(O0a{hG z93s8vY)x&~Ow%2%1*u%guaBF{I(8)yK3hrQHJsqiXj)7;~Aqvn~l_baIM zTox7Zbq0wD84#0dZKWjU2`Smq0H`iEu}~Dht6SK@f^z;shYK!F z0&DtS(Q*VSzUuAW=czVXIcgPkB+BXV@u+i#VGyhgmRuHH$)KWu3{Fbpj@(29kR&ZeI;29%LSSF4iG_9?Ck9%$X!Izf5MZQeOMfvT z9)i30Dd)1`V-)iX)2<`nQ?4CVTmk|`gW#V$p$;~lgs!JQJE>J-3L=!ET-ZhWLiO57?oNd~N1spfGvS>B zCvTnlVH^6@?fX4R?)=LvXO~rOZhan>zRKMJxpwpcwL`oF2@tEJ5pkf;7puNdg<=%b z03>vUDV{Bte7AV{B_7cOlbI072Mj^Gy8stIeH24e?hgF{=t^ z6coo`z0G-n4r)$E*Ip3qht_u}s z91ml08Vy7Fr1oLw+k906_~QVd!9=#0Yhqa39ToB87pglVis#4AQo?*gY#YAwA^iOg z-=BlQ{YDV%u4tL8c#ZL&6}(kDv{6wR@UH28ebuxYdWn3p{;h8kzXi0=0HO)-w1)B! zw0kK=KbBqtK%Z@zwFPhsU!8IH^u}W6 zd=)FQszvx1R1U`GHRVFZOFlAKWIw&y`5ro_uH#$y z2`;2~Hf+6DxX6y(esn`}T~L9gUn_{{iA6tZOFd>A>%2k3oZiK)DfT4l@_ur7fJ_fn z#@2otzGkhzAMVmJA{@|G1qi~`=Js`aCS^&u*6axIPN>)v+4B04YMKOjlkFs_a9c7) zc`1~+)rr#WB>uS1(64YAJ)R=ESuWyiJtXq!VU6A723o9>@6!~Yt!;>wyxFNNx@8SP zo-;dh-E8yE6rF3GR4`M*;tKRiSt@mLsDWqN0`@vn#Gva277XlRjf%;ic$SgJ+IOem z3;`S4h?lpE?dEK7v%%%dA;kW>#Ff;Fnh3iJi-yxDYkNx}hU?<+Rei(3U`vRmBD;2E zHa#Ud%!$<(AdXy{m{}9oB}esI^m;c5td(L+f0aG(L6(0xs^26uQxiiu2omlT=i4u$%`s-$vfx}43@{&ikQJn zmYp9Zc7QC}j-BhI6MZ_r-R)%3)o%`OYkG1!NkR1X7#+=eX=&OAzOdZtB$+{Fruw+! z+=5s9qYa12rUdJiAD2Ss-9YSMsD|uTO0o(Lo?UW(wP`NnXsZM4XqqcbxWmpiO_3@>L*b4AHs}rRX;*2|hRo z(~**MGB!~#dH<;_`D90&(c^b&G-5!Y5kbEA<4-Tjz?07QSZbT9&J!qagqd(^*tbuZ z9>a>Mnj+^~>h*dalgGH@V+zla^A9h+>pJwp+NU_SM<7SWsg(uYbxHg`x+s4Ph4_m<2Q_#p9-jTE$$VD*Au~7Sz3Z? zegO(@g(H>B=&mP|U#LR5(Vbo9s$n7W>DMq9Mbp59GaUS6gCJq$HD27vx>2gA_V5zL zP~`p>s)3R0d^Ee9QAdhosArPbdHXQtu>^K{SKKfT32C4KPHeR!6XAf(UfhHsCk#N33Ee4SUhL%vZ*;CW$H>ey}FD*d|> z0iascrU-oj8ymnUFjjHz>`*!#Lj1(Kj8s3~9IYeU;|eFn=C#$tcayCF9XdV+hX z&2B#~)f^)lR*pXqEt-d}dkjAA*5`KR?0n}J-pU{dAD4eCYxRZ;q5jDYbX6v-vWVO7 z3)QohF#iH|Se~!yjwX&#Y#tul(71S*x_v12R;JPd>hg)lEe%ibMp`ahcH^DlHk%@U zy=3(Z4<>-fARLuf`gb^7o!arV{%e)p{rd~5lnQ_oJ}CCR%jg>_>^o~woF0)`mDoSl zmJP#KLe|ZZd6|V{3ZhD5Xf5-~?1L=5O(LZE;6hl3aWYmEG)I|05s=YH1-`u`N zTQi}eekLEvkO>*Ex?(l#bocE*jm?8dR|lJgLkwn-{GU512auPKL-+FeaoSHMwXaS@ zT&JGAjSp!~9;_K&!Sh-uaS3nMPWfeR+jF8Q=65cfLi})q*TgVsCr|?Q!q@LOlcoR- zq9oAVg@+c{@3~K1p*-iyQ0+u(hnpuM$VUcM~ zCtKbi%I=%vml{26PdQwQ#O?>fuTEZ0x)DVX24qj~ga9n{mX^Yy4k^5+K)BUZVcNDmm9T~$4}iD=-3?1jVwH3wU|pACfF=^ zr^*-HQ)LeJ=Z&)5tIoNtFl>6u#%IymXK<#H*J$oa218bGZWPkO#TC^Gb-^N&R0^d_ zB!RfR_b*2SdhgnHprx{fieYk$v;lRn@yjJC!>S?PdG(>qydbc@%;mT#+7eTF*PI%! z55+rof0ViXneWs1hkfQlJXf5wd*+NsojqrSNVrjnF8g&qcKolru-Cs(u>nl0(LS0+Kiwc9jX3|)l?VMC#9Y8C z@*5v;B1pa<3L%CM=JWfG)Ka)EDv#Ie5-;y6^ebM9DwiA8W^;nhmG~?n?{M30Hz4i;Nmx163#x|rCJZp5xg2M|UfYH%?2RGz!^9i3f z#g$Sj`oB=A?IQ7Dj-I7Y=A2vqd+pz*4`Q(6$pK3UjEtxDRW0WV%iF;={A?ak#?MZw z6t$W)+q`(odF4`?f51rt2E7p~aXZNO2$PlwoE5eiJO<+%eO}F{*SNH<#htwP;Suu( z^eY{G6;!gSj!gJ5+hU6_X{C4l%a~?8wW((asrXio;CWNXwi5 zrKi4rdCb4sr~LO0W6x8#)_Rb&6|3XTgBKT--{t6Dy#dqC1_|$gqXh4$*)lxfPpGRF z`VH^mTb2`z@Hdfy;bp{fkK*K6Kay!<5G?~xIZ zs7t>cxv9RZh+3?4{MQ^i9i4kRw~q?U{f>0?hvvWW%}PhgT4Kka!6dzg;MI7D_8!2G z-y!(L3S~VU^3%)Ws7>*yX>o0KdkOW)^@{yMHSi8t52F#3%r8{y?~Mr@pqJHHbLTHq z*|ES9DrF`se4!doM{up|iY~VR2wWvD*cU1TQKJ7Bs!AD(YX1hL+qan#qB2h@gX{qB zGIu4#WKAIBaNguoQAn~8a&?Q+vh=lD1P^A5c!3o`e2EyIC;N6`6%m#caNqonxHMoL zvIL;WNFpv~Ie^khN=`$5v<4RA8XzZXBk(I6?+D}wg6K8GuNn)A#T_vJTeNkK2V-^& zyJCvlF}Gz=np~{{l^1`!I&7%0`+5I$Q# z92cQBJPwJ;x$asHMIEWpr-Q}uoUGu$*7?=w>VcSj0?Q*F?iUDf=kM{T8m(-jxb`Zt^lSW%LeNlPe;Il z%GWfWaXpn;t^YSF@-LL>Kd!$3@JKxCx2Oq?0O;pySje{ckF@f=h5Y~YYf3@0K$T_4 zN`bFtHE91%miyZLpA|c<-%;#-@x6Ty&iWfC!1wbZi!kc$IGE2%w6m(nH z1yO!zh*HK9VV`S3Hpmav%u*?DrEgr@X=p5aFIIJ^-d@Kp(+-GF7|_ig>yW!H%hP-A zy(2?A%$2eI$l)RGlBSpF&r7T!H(3`Wldhczoj)7*a3#=P6I=L^h82k9RxdVZH78b0|2sKYeBAx`(l&!)cIMvus zEt9#>?Nye77$H{&lfXuhp$|shDwW4F5CpLQmyrit7w*t6@P&d`ZNB{hME|<}E4%Bj z#JQ6GJrBgX=z32zKs`2bC-cn^>;FPMR{I_5@y{8E{^@C2(Wy)J?qyL4wuE_tA06TO z$@R()%Si?YVoG#J;OG!I(-8G&KILX4JPUdG2-LuNK;=W8&$B zzc=lE-X_;T$=6J5D$$4x5h*$PVxzn%M7cGOgBw2m2lCoco5c>0_GGX8hxFK7)saQp zBg;`Nn78unE49c$dK6JH`Ak@L8PX_ejM+CY_3jlGXx@HS%tkokZHsdVi@fr-dfoY= zZTe2`bzBD6UeQ4R$V=?zk5ry~3618-3CIc~s4tk<$x79L^+qdo7GHj%2LOv;u1*%0 zmaf#*c*c*~fapRzmXJ6RWeQGYCg*&Xxn`sCWssc5WFhVY$JCv(+EAaIq6-#A zy^boVOFINtAc7EBT_ENJF(*T)Ri1Axyde0<+d5R7-6pemE=8~wW_!> ziu@%m?m(03?~uHI&ad)M&!n=4M!3gOw=`){N$rN?aX|~$U23Y91=x38Scj(vuYM>h4c8>%Q zW4oiu0yY7mkVRt^@3Y)Bo&Hg#v}g2W z+sWL8n;W@2$B%~}O1Q*%L76inmaYngEH}}sy>^v`+;1H5y+~_%uBcGyldi}ASzmEF%~c@ z=@*iF_=J$hgac8w`-u|W)uW3GK$`6`Te*8|2nFLCxLZO zBBbs-T6!QYSg1UI8i>q*8p-+?cEDk}pWCT7FY0ThKH#(*{Z<~%KZOKqSz6L=DL>{1q!B=} zZpi?dlm-7EeB>-#59i3Tp_up3aZWN9km>{ZZU*tSdi$p(iA_x0C@?Kep{guABDgJw zkO&MNUrHPTMKG$X?PKJ_bMM)P zHb(2@ej7sJJI!}HtLL=8QA4fl!=&fnw9h^>_SfXw@}YI;{ioyfXT}EVNw!I}wHb$% zCIed0tirs$o+mKzdgB!d!kCwyN)qJ`t8b}Jz?^9(>VtJbQ_gN~Uiu1u4Ym1|%J*&K z_$!;xSC#u8Emr=1FskqRVInIvV3;|1X}HwFv-rM!a?qRiL;VAEk_8tY7GD#e?kM4U zv?p%cbaruHg6EhGAqK5389XW__ihKkmH2Zpl}oi&(?mQJL!F1|EW}6f?`J37e&c%Q zqaU)QE@jrYvS&A$$!pKAGphA%PRUe&_{^IamkPTAM%$xzNB4c)-i6W+I-Lqw$~K;$ z>2tp~wDU1@(ZMdCxZ^}4DK5@{w=p_a)`AE;4w>ohQPl2AVyD)6RbJpdRgqjcp_q;E z{UQG+dlqo_vf6^aJ(WiEEh>klSgQD&SFVtj&==@tm&PUcz)0=2$ojjnqUBt-nG2Kx z;CV&cg&g&q;-Vc5K0GrKp2+loY*)sOIwB@Z(ga5Gu#R41GWDYa1t^_k`ao`zc?NED zQYY;#hi+UNf%M8+uI_0Knwm?Y8$#6SH#yZHkET~6$iOah~b!evYKtk5Csayspzh|2CV-tK^en7o6W`cbGjDEtqV;xw11WvnZFaZ0Yx~S8V@0M{Vi{%brh0?O ztMa+Uc8L6tmxY}SXFEj-6zge(b2W~=mcvqupZ^Tx+>SW)@*PWljh^p#cWGY5i>cl8 zCM9HEYFP7+rjkKOs7KvZ&8c26HBemP#dww73RhgxY}CV5?Ax+60DWD_yV$!EER%eK#@ym%Fn zl4@IA@^LCKGY$TQs$lbz$nz$fdbJ!TH@|CQy)3Tc-AD4dJk|2dwGZk%jb-RVf7Ha9 z+7NWj-3c@-ss#cn*$f`~46IuN4{r?Y{>HWV-8S+E7Qeyfe!cF$Tc2|XLOfcqU)xwb_)T>TK);)>K5q#+SjPlJPIsS5C z$<-~9PtNl7Rz>EkV=mkS?F=VQkCySftkQH!VsFGwc1k9n-epu2lsCeEq0$IfGKSwH zyzfCN)z&9#hx-eIv|k{R;FNcsRZoGC25!@RPX6at_(oBIT56M&@i*z}ee?*%y!ZXs zy}qW~i}nWRR{atOWk-183lT68IE!eZ&;DiKQB?!wnbFRH|*D(|!R zvs}W@Y;z{f!i@<;@RdoMmri#BJ*`@db;{6YN77NE82Kk5CM&&LCsv-SJ z+e<<(<$Q%Ne;`%iI*5hio(>ZtgQsBM+ICM|208DpOsII`0a#QIa}hi-SgU0$s?H#}W2f%!CTsi52b z%WbQz`7r2d2ZAwX-9a!!ZS(X_YUkTx$9BUJ_)F*b$(s(!BRoOA`R=Q|)h9OdjJZ4) zKGsk0Ny6VRP|#4v`2=t}?L}B!%RPTYlnr9I z1n_p6uoEFJ&K)z3NA)JvGq~hY zFWAe2iTxit=1252ruo4DG=&qiln&~z^EgfW;Ga0r|4wND@(r-}pKdUJn;?WkzKhvk zp~YyP|>6V-QnjOOt+%NqnAE}fl0m&SqUA|B$P7X*aJpL~w%I^fs zf4qqJ7FX@pqkF8>IMA*81Lc8=z;?MQR>s^MP-1%3SHqtJ*;8-C;JyYR{Ga{xWcln7 z4q8Y3)j4G>;vvsLF z_CK(Q_kX9OCy6lz+t@{f3GD1MCU^sQ&%8_2@tE9QYsU Je#Do_{{v0xxsLz< diff --git a/manual/images/relational-bounds.jpg b/manual/images/relational-bounds.jpg deleted file mode 100644 index 73fb4bd3e5072ca8e535ac611d225d990a0af163..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40849 zcmeFa2_RKp*D!vrd7h~xWGwT=HD$=`lFW06>zcV-WXKTBWQb6RGLH$B63LXJQWS-f zF+`bX?tkB_@i#rs_rCA{{hsIfeuuNq+H0@9_u6Z(v&VJz#l69OfEaYOkXjIohzQ~U ze-LhvYFabM%^8C9^&ue$f+!$z7!yPcAQLya$`VJ^J zZ@eFpl#q~9kdRc6l;MWUC`iaCNJ~Hv@io{F-mVdSOP`4K8u2$6`V8{IUt}=iue4-8 zmjlN6qZ}}S@8tj`AcB2M111LK^ObkX>h0tp9qiQ52 z_Zgxi_#mef_?Wmp=oCalK|w)DK|@JN!$?g<&B#hmLqpHHlbM;7nRzE84dMFw*!KL^ zh0#(|)6&s0(9tol(9zMc;2k=a?I?`@Oai!v5F-Vo4P7IK@jyh3Fk(g+?j0y96|Nbk z0=OiF5iY7YEti}zFQqtI{m+IvFi6%3HvnW3VTXyA10gWV6C(Xtj zf0-SfW<%(?s#8r}0mJiJf|qhn-%4(NHL{R*yXE!hqPg?2Gb#CZ9(9i`$!c4;1fEST zsBZ1~xXcI<5dm&V2t1LKks=5z?1eLt01kY4m`NogFS6h{XfS>`BgN-9h>c2AH(^Ej zNzd|=;Ta$oKs0s&CUSN-X`0FSqldn;@aG%|{$K&u3(*i0@??ZmpheR}B>#S?YOez* ze>X*4|3s6=J&R4HL&I+|#uLt6w&>=ekc+h{GS{BnW4*l<_dMg%)MFe(Z2M~K^pUo; zx85@9JAFhKrke})=XLg&e~NAFsP^)@ki$&hSw8*NtmaEq$iP$U8oor6XYn`qKhu`v zjiyF*g<-r~yIW=2>!#1jb}zWUv)#S9l^5}>$iKcU)g^$;p|5K?ue#=?Sxv%AGk@EO z5u!(HfnOf>~Gm(#}knT;@aJxbCS$fr57suLqm`CYnC5B^6^1~eZh40 zvwEkT*Xx+BF!=zR*oFP;nr9~ltShlqvkKwbhaSX8p6thPPFnA_k@N^G9P9qlDfz6t ze4-0ewGeY1$*)+rHl27h^J0>Xjeam&Dx%r*PE6$|^l{;LlioLqJp&6SEHHh-fSLM& zkOwt(V{7FTfw$up+HL5>iP|O~dw4C8^<2ahZg}eMo(wCHdXdvp&^=&boTwXYvsE+F z&HiX1BQhYn$#QSYHJO^qqJTJ*N@L|0-A7UjmsdGERy0xKpKMp|S+QhZ@hiUG68rcv zDz0zOq{^F*W^p~JzE8Gm2D;^)Q?^XV{iC}V-w!7|qDxBj2+qF?rL(Wcge@bUq0NkL zZk6I7i^bF}H1+j~E9PVV{fF+CER;RYzVBIL?~&PE_joNINU!9K8kJ&%RNd8p#4$LYnWLH-*Osw!z$ zt|Z?sbIUH6W)yQvD*aUKkZg&v8Gm)`T)(vw4%*+lDaakZw+#nf<%*xNcsI8-=sYD8 z6=9j%8uo%;uIYvyo#w$xUR#bs@HmHaarB1D1Es9g(^{?Tk+1dLtFP%CezAdFWWuiOEi6Jk9)aj_WY((SOMRQ?z^`? z`<=WH?l*itQ0zSRE$?D_{V*2}GBpou9&Lp0@t1rvb2VM@=7YT-cGEkfE^EJi^TN_* znwE^aqWANbF==W5MB8nITu`O+r}uurIkAj`8Y5m`KWKVQWHvoyh-;93{ZT7<>RTLi zU4g$&GxGU@@b2q**Y2?IzTdmnv@~sWe11Pv&z>MlCOu8wKb)(+9FFNU<>n`DU{0;x zvC_0PdxX>8W$V<0bO1x2Wv`G=K(5jWTF!SDmZHX{QA_4&k3QDa#bxK;dDz>O2CW$i zZ+uai5*g>DJgE0>Yxzg~x0_k%%;Q;g^{afX$+DA^h}tLkwnMoNfHntM2gRH?alZSb@-9- z z>s&NzcZxvX--6?yMa=-=l*e01fg3K1&a72AUXhtR2>S&kO zjl_y^vk&2Osn;zc*V`0T_5G9M)yj#NFV#`i(!VzzqVmWs4Pg!9s?FObV=%GhN4+R{ zxH&3LAiEotHX+P;+K&9o{%x{mmYzdFDnzAg_(=I-tYmTxFE~Fo5bxD>9LQECo)hFk zX7#vinwW3elIJVr%XP1cl5C|6(66+>Unp2|uVGRW2G?wY$$fATMa^KQwDbXaGJ$t2 ziO7R>xUNOB^MU%U0o`&R;dvdtqI+wQSL+StEuK>f_4mA+RNm^H*%(-+xm@=wtiEKy zWvVt}<7WA1%$C0R+aMgY>R{hLu#vXQ@o-X~>9%2V5&d|Aurf{-utc^hTvbG?!hr^h3uJ?PoA&x8%wvRN7CkW#8OwV@>w~ zf>y?JADAKCVsE+EoACjNUj_FTH@%1otNgA4WWhN9@2U zsswp?avwuu{oF9#N<45e2_9~=HwxqA=Ix@yV`i!)D#xRuOr^M2!$95C%21Qr$J5Qv zpWDz(?GRF(n@3b!T-C?N6D=;TVXDDxcnE1?$_>&G7uP(@!_DLB@9(1^E*=;dDCU5t z5<_9U@PvNihFFXb8tWf?2qY#7B8WNpJMn;Qwp0Iw9e{OmL-{LHQ7U?%gOx!NUla4e zf+4k-p@R!r3xoA?0HD4O2J04r@%DG{G)DU=isR`)w6D?sIKICd$^-2$hQgv9{4v;X zaVQo2{6X?AKV|2Raona=6#p7VMfsOWy7{BMRIylx;2()P;Jtt)5b+yRf0D*OE*3r! zz_h2btfZni0l=sGmmK-|JNTouJRMxVa|Gyt5YaAZtg?in_&1Qip!hcq6~(`?t@sW1 zk88pJ>xKsP;19IwTV~&j{D-ms9qQo^3Wb;WH?hHgmEgZhRhXb0Jb^0z=TyUQ3iSO& z0P_Erdk@S(E9V9(;6JK8`h!A!uY`Ze*616gBSW+^Yv5D`G3-n{IebUUpCsm@6jn0 zzx9oHk$>wk@i4wre^ClN$=6|os`Sqzif?g$JI?vqKmJh{{-X!_O&?DAy~75%eecD8 z!hYq_)D7d}K#=youcZH^3_r=)%?~5$@PAp>zpd3@hIy(^?g4)OXeT_<7>)A(cU1ZR zS^@F3^wWz3e1wi%LJTPMk1qWmpk?Kx{)ifZkpBh!(~I!G|E~R$;sNd6f4BntwuFD8 z0itlZUn=jbV*CkOP7=J{zt|efJ{=vMN zx5IyA!~9Q`@K4^${})>3Kb8-`{^vB!|6CFOLS%Y(}c|d z21px+17&V1R;$hzKzk@gOig5qEY5A)demrY_)ueZ^eAlJ*@VNx)kJ_Ztm@ zfD!$HA*8ti{1D^=%vt{MA|A&F|6vgBzY~Vf8!sYo5kbTRAKs`4f|v;IFAgCTSObBJ za@$@7xZ6_0mj+)#yrB*ifsTTJ!OIWehz@SwUuy<$vIG$feYRt>0vpCI zu3y6mtdaS7x}ng1=AMWAKy=tI`H&LA02*Hh$W<$RFvaW2%415rgr>CrI%P z{R=UrD+U{)>gne4O;YsRg$Mg`+h`Dz+zIXM5a8(#K+0oab^H&=@vE8y^snU9jxOpL zPYm`a;WBQgucrMy07QWfW4!UQru4`77zFtHp?_8!Do>zDzr)fvV*G(Z{SHqJs@V0n zJzm4wxHoE)YGUEHM8{KV>_x6Gj9R!(y8_d-p zh#pcUOs5>dG>RKCgj~VY${*Z*1jq+aF#iJzZb%(6fu!&W5^|uw20&o;=jGt-hBVeP z2JjSq1gh$-fuGtu1^4f#SojZJAXP1spGUrs7T9O_!wJ#1i5b2Ccq+nVNYyz-oZvU{ z|Kn-Yw^)SfnwH-$^Cgfs_S^Ifp9rMor-l8NH-4)1E%ig{-aqk(FPAZfFiG5=--4KU z9Q}1dA{<`MST_LSCy+mtd3%OK7?p3&Z^^ema)E)*faqU*HA3|E6LY|Sm_x8Z407-h z$D1ia!2Hq20dD}v?T7|*IVGMi_v?AM-JFzoED-t<`abGtS2vvyEZQXGuqi6U110YS ztRcA-gA{_ie7w;94&15_f&nr1d@=Z6G|NIiS`24e11S?aD36W%k1Fuo%j!h`xBwQ z{$G=Nd3{gT&)*pRqilbeupfQ`C=M*DFacN;*eQ4B{g#!#oAaN<#fK28{2M76d>!`3 zOyNU*A@%w8Dc2vrh;Q$7BIVllIc^MHY3Al(9Tn^mwA_z%vOGyG8NJmxz+<;aV??-@ea7#%`Ngj{{ zpt^>n8jzxdma3|jBwQ0AjX8frj*cpX$QbPGazT57lf;cr`KBcuS=KZ2}& z3X+tP`x-=82{8e!8qgUaJOcTzg_M$!laUsYmXMc`Ah>{iS-9l3D@nj?yHWs;fN#@C zi{N9)5?oMJPz-2ms4U;_1XQO8PyrDc z5m^yA5qS|H8aP}8E-3<+5`jyLfa(QAa9I(c3!qh(1R4Sq1n3R|s1eWtpfErW4oFC= zOUlb?N@&7mWHlr;!N07!rkaeDysA1vRZ?A*hx>bjqClui@MeRm1U3Hyk5pF&7WB?; zo*=-_SX+%7si`glmzR+dl@tSY{)12l*wgotN@UNw*`DZWqc0{M&whS5)n$mC$Ej3NmKZz&~*bv8eJU?|r-%y};!-L=Z zR^@Nq-`~%_CGfWd{+7Vs68KvJe@o#1Aqo7Louj?Mlspj3y>UY{mSFT_Z)j|wg*>E5 zSahM$IppSzAp$D`Uf%v#{BX$9%9@+}Ianv41UuefOW6VC=c8|;h2IT@z)*=BKW4(i zUoWukvDCf2iqIvhW5~_@E#RMgGNOF2U_TRP28W6} zz^?$z=NaGy)<%f&b`C6FXa}%1M1tRYdBcu{wYi!Tv3c%TKW5Pq07O z>jkusI>slMu=~lq549gGO~}h}>!1TY(f{5NbsHV&w-!v6T|2CeJszdvAtQ&jn`@v z*!&K_a{J-ucHE-BRpS40#Glyui4PI5u7bvbPl3_g=0MB92ZW%yy`9_$OGj?rzsxv( zO5wj4?WYv*;I>`^fH`*yVzC#47&=%W;_0Ul2{ScBd?XWuz`obpAxd+w&5@+;Qrze#RD&qpBupd15!6Op-<2Zv;?gKiym?qEsPnq3&sWGhY7~~LYz%}gSdvcmAH%e1Mw8`DhU}0GYL0|D9Hg59TGDV6p1fMILQT)G?GG+ zJ0#5{T_l4fGbCH2w4@xQ!lVkMNK#8u7t%n|Go&e``J}f=TS#A%j*>2sk&&^H36jZ@ z>5y5Gxsx3yyFhl8teos2*-NrvvPE)o@?GS@(tu?JbZ5(Y8Z4>Q#+7&uxIx#vVofBOIT{_(zx=y;!^py1c z^s4lB^da;q^i}j7^ivF!3<3=53=Rz84CxH_7v)VP#^KW;JIG zVohhQWBtHJ%qGBwWbhH_Pq=yHUHNcUSK2*c59m*aQk zPvvjrUltG)un;&aP%SVnxKj`*7$R6A*uRfnFZ;@<~9#I-mRncRjC8C33Y+{GRqQt7jK8y2-TZ>;5 zZx!E?KuCB>HsJdU(UA0v8 zvzmk&R_(UhvbutLnEFEvVhwGLXpQHZOqynzX`1h~c(h!!O0;IQ5!%PKAL@|m=;>V4 z=|S#6qL4+%8C_Z3Fx_T78a)%eG`*oiLWi)2YV?Wpb@h|<`w#OU_C8!~02v?+k__G% z3L5$v-ZvsMGBipz8Z(9)hZ?taI1pwYhb^^`ecYO|s4C5yX)*N4jkVZG&u|*sd zaZPcZa#MFpbDMS7anEvJ_Au}$@W6Rmc$Rxncpde+=gs8p;oXek!~|hp`Uv}+@%iAZ z;G66_gVn?4`@#Hd{qFj+fWg$$fPDd{0|t*NA4@;B5@;S+6~q|i9rQF4u+|QT@QzaJBBw#@J5`97(JnVqA-#w(j)R<ffw)WS)NlQpOI zoH}u8__X%vk~4H?uxEPC9yptIj^v!%x##Dl&R;pd73~z=79$ap60>mub)hX59(y?! z7v~)JJYFU~Gl49@JE8lc%EiJ&#>9}s;UxW}JD0dGMPFJ-woiVNBAt?zN|hRr`r-1S z%XhEvT}imIk>;BAI$bTjJcA?Se8%!sr>mWr2QzPE?a7MCTD#_U?ag)V>vysRvQu)% za*pMU<(lWV=E>z1<+JC<18z=M9IfcC)T?Z)lB>FLi~m-}ZRXq2cVKsd@61%YR)4r_b@$~x-FuBS z2WoEL7rS3jySFyIjS|H}*AIHoa;#YJT3L*Yfz0 z)}y9Y)zCf8QoF4KPJDdOqvXNYIFpUXVI(;?e&_l5k6nwN?%A9Sj8 zHgsupJ$i+F)&BbM>zCbT-EVr1^n7^Z^k)36=iAxdW4-HrC;CbIqu(*SOL@=nK6_yQ zK=}um4|RhYgHMM{hWdt4!=Fa{Mm9!IjnR&!eB}CAG%h(_JE1l4V$x=E^pnr0^{F${ zjMEvP_kF(g<=~g6GnO->v)EbO+=cmF^92ji3yq70i|?1bme!Y}S9YxwuF9>pu34;o zTo2qJ-?+TFf3s#wZ>t~Y1uTDm9BhXl3v3^3M@B+ILP|nLN=ima25xE!GBOHk8Y(Jk zDk>U=?NjW&KDIr-bzz{7qotwU$-uDlzjLtNXChW&7&r;;$H8{$;9xs2tOchU;x9bI z_=|*;n1~DpeLdKYh=};-&|hurh+xF{gYC%3iGf4p2O}b8B!Ni5$#$wnWXulWWIGng zi`U6nw-1&Zlwxz7;loDF@~camBxYBl{2CD&f=M}5GCNG2{F^$5CXN2b z?k)2!vwiGy!}IvV?a%?IleZ7J`;+tSi5e&P8qSpLn~d549j%-)n#SUBEjv5mgZdhCDK3l3}hGX}~j zHyUwJ#>IL2Bt-lAf%x|H)rEAA@?z^xSOaOcWs&fP*x2+|i|a!r!b62uR6g$AXh)5# z);8VPvVT9GD3Iro-+&5JyeVDcf8&u;uorKyxIsKa?9zkYp>pdk#h0UH)^lU+dap~% zzlhway>t6+w3`E>;EU0&G^G~hz0qZyo^wUrhtD9=nakp8EbpEDWGlScDsEA*Dp!ny zq&!rvZB&Y+q6%mH<_H3u9bgzcW$^fm2Eh>qGNBk$EwRSYk}AR#AwQu zG7p9@MNU>NYO-Fxm*;WZiqH zG$X#9)jncOMcl2M(Ouz8k(*0Fzhv%?qz)Ft`^Xw0ohimE6Ei2mMa+zCJ+#l7o$Xw0SXL+EAcW^ed--aU z{&CkS&y4~__#U19(u+s5B_F>pe-rCy$Wy+Y7*>8ey3&^ZS*BUfru_@+XK`iYUEOQ3 zPh}N_yHayIS|?ge_J2G>Vdpktc|BI|iEu)3F)7md00cKJKQteIDZoQ7{h7E;*O#fO z29Nf1n?mO}Rx9xQ@ z^F5l=vw;3M^Sq2trK%&VDY}5uX=7wAKXUbKZm`f&5US=CD$%Cot@qyO-3NJHPV$%X`IUMxSKD9ic12NG%+#4J+(5`TzE2plm?mW{(yvn(d5{e63 zU#9$0SzXxARA*1r_`X`)z3!nTO^Q11EA6YQwJ!Jy%M{x;)M7D_b|ba;t#(-6d({ZE zXqa$`6_aaPI;Ys_OPedj^yc${mllr4m$Q{WNG@RO1w`js+#t6=WryxvupRIG3((q1Q@TK{cu`^untz;WEpS8B) zAXs$1fVd1M-!)N|obvBgz`#y2Irb6X{A zsDoVr7`+#pydIv$N9wwMLf!&i^1RqMt2ncnIw8}Vj*c3jbX z{8`UAH!D@SlAUw1V`24awXI{*dp$e52ikfV9##*1&`sSBUcEvN290Z)_SJ&D>y{<_ zFGIUVV|||12$Z9Xcl+r@qJ3E#E@XC0NcrL*bacg+wuq+@tCpNc?sZ3KhhJE$TUb&) zTecWycfvkCwSZOLZ(T9stz&7|Uv>rc;DE+IZMb)UX1f9hJ@L!OL4DZPMPzgl4tjn> zt!m54vT@{es&%CnFG|ZwHD4&%gVXHgMmY|Wryo5Yv2UV#P4CERgrU7!r}TNg#C@X+ zS6)FkHlnbBD_PO=Eq2V=z3<)!^RT9y%;hKFpgr0HmWAXk&!)j) zYR!#-362Vjw*!~Y_^sNGp?q6=HYvj@-knvy5T+2K^11x;O87i$h$#;G(6MU2<-wJ%)!Z!It}?Sc;jLo4 zpv1q{di_)Qmsg9yvjwe_A@4JV=GW`X1UH5kr)DY7UivVf);`)LfoeKTdICK<8)BCe z@p!<5HKeR3L-F>Q!Riwnv`;3oux~PDDNSkUnV%a^J3}yU@`|5zIlmqM3C!8lmgw4g ztvQ!u?}(4=8?$4(W5wQk9TPP+BFi0TA40?h5tU-Oq7f?ti3NS5vvVz0&esJ~ayNQ5 z>Qd(!%d*-fSJmF#T6(pT&KzP~xvLJ-KQFvgXRwm9kzsaW++6wKE5)kSE;n@XRpvG+ zcZI-Lh@IS-VTE#^B3aNvP2>yScT-pt6mY z(OtRcG)Y|NxXSx9p15}il9)^$tSp(q7#o~qb*Z0E78nWMt+NNzRIj@PFuav z%00i~`ht$L8w(2+=KE3xQhV&P!cD3-Dx({{6ucDXRAgH6N-;;5#CI{~HMUw>UAYs0 ziO5P;r9y<9hw=_GP;}LW^0ekB;kIM${|RvZtI6%KtUV zv`y5@R2=p(YfNg31#kDW+G!UNt_=N3)I;2{5R87v|<8jZ@tpk?8Tn9=rSFA z0ypPcy;$TL(i`sR&hlb`Iz7x-FQU*^W4UH?>d8KPV|g*BgkFv2P0q0=e>tjNmD7nml-w@K$`B!WqMt{kWM?eD3cGge z63gu9tYf(~r{&Aq+pFLt(J=Cq(xYAaA5%X!Pf(rfbYtpuESKf_!g14hPUX>tMe5rY zyWqTtwo;Xg;jTD{EzGQ5n)daZyF2_h#n;qd=PGB353GgWU3;JPxxRK0Zf?L`#g)dD zT0d8Pf&8$taZKl?ccDm@SBQ_Wp)O_AfjO}3C9*>zjLeu|*;;S8N`>2I$(LSU8Y%cp4)zLj8QqlWU3x}xEYTXjRmY49+?(%-Sr$s9yR(YWgL9B_J?6u+j1DyOm)kfH!4i^A0_1-nJCNaf7>8) zd3H@4#iuhP?O#C5NJoyN7E7Ipkg;gh7Rf` zMGq0l{YW04T~<2RX$lM)jxowQDG z4=R8w53q!1SCjP>50&+;2DUGCgfFe3bH$4jdvml&T)nSElJqm=bn{6?1h-E+7Gr=E z9z>@xk1vU4Ygf8C_cFU@=iNCOpR3GcgKt%YwLAS|q$@f-%NEx6O&WK1^PS-rEMt-= zR-Q8ROcRI^C}XSOKV3CBqjmJ8kt<4eKO^7eZbv0e^(POYelQiIFI_ch>m6KIumJ4Fq)=`Qgm1&oWV;KilYVx;X|6y?nyEH&Dy|^u>5ixspJ;Lvvy8 z%98WCPZ#uCyItDcjS(%S-&4(Q@oM)=w937m!$uJnhG`V2 z*w1_e!&efBg+ujcRYc5abAbY-A^Mlov|=0zY~MxH$+D%qXy8j$d>|WZmNkS}sW7ut zyf->dckO8BG><}spxJ&By~XT@XJlFI2TY}iC$a06#hk-W!Vll;-Lx?9ljl=+a^VuJg>ehbLSgYr)cBaVJ(uV!Z(1` zHf580-MrnOrEMs0UoM(($67Zo>$ReX;U?U9$3SttJlZqudb~ROj&x2VY+U;?eBL*( zHVPYOM75O?A0H~S492wA_}MVCM%X* zukCbAL&Sm2hV>Uq<}doL9N2K?x3izBFx5)RcCAsWvYudL>kX)S+@;8t&`RR0T_7mD z(@YGE+E}%Q{&GnM9Af=vBk;eB_dmAKgM0OVn}OHAXQ04WK@}tN#rPuc0a$mmklQJ0 z>7rfpcM?<_F)OS%D6J9)wIk2&3|tw|*+SNTu-I~Mo$Iud_%i$8;zm-$!}5*S@uRu5 z4gkpr{eNyXdfyHo`^{2P81`5o!{F@@QS2f?P zHW`piufMDRcyg3I{#xZ(*%Ig5bw91CN8oz?NeSr-_C720?H>GZtj4?6UKZC)5T0)_ zNzW2j<>=|2wUz2{*p+f{mPE@)clPL)`j&Ut%cFe6_9nb6($;L(I&Ib}E@x-z42zpN zW)@|q91Ipcjva32!^XaBeEH%_uT=`kqPbuqLNVEDlXsRytv~H#Ij7}HPVr3fv(ZoI zjI1(Lgw+FeqGcKAwMxpH>ig{MNBka2o}3>vpxSjS4C%luEv?3SZlpHqUUrJ^oSAn^ zD*uqy1dBz#t94oZa)LJ>BSUGNdi7glmPGku4<(xy?U+iuMnARQi`)PBJinC{zj0y_ ze801OWRY!A53EhtY39D#i|3`w6jdSmRDMRSsXY2bi!7~Tc2t&+dh|vol5}s?X-gUe za>sh9eU`@#1zXf}jW(k>Gy=ux9{XjxJGx$HmpEHuc>s&N|CK^r(!3 z-!4Mjww1MHFB8&tciRURis)F~EAl?V1Ibw4eeV>7#B(}W^ZL7zSnkBLOY@mODAQ4l zTxuF3I=IJ3ho*uK?4aaqTnE3e5|@R8lN=Y6q|xr zT`2Al_Z{&9CT(SgSrkLHJ~Y}6F9gpYUp;#`_zR~Fr{xXr>ls=NuEr|2cKbcxWho3M z9il25^Pn?~h~PfeZ(7MSEy-#KIg-<_-sk;rb=BXFuS(y8kKHV- zw4S??f3dMN>wz5?MAJ0LH5zI^GLm=hY6pTTZ)WwZK~%S}T(|l8qlr6`hhyUf!rdEX zoV7UjwZa;a^@t$~n`!UeF*c7?f*v`aeCcA@9YewWN{iK^ypd>R_*@hfO`_+$7_jkH z2o?e(+E4{Jr~|Vqv8t6bE^__Z-s$I<~T}jAno;a%zv3S!S7H*&RWV`Tor}G0h zxVrXe-$j0x6uIeDjS_KQq>@)pS9WH}Mngo~lZ>VUX`d3iVDm-VS9gY!Z;6T*w1erp z6@5ED>E8e?q&=S$s>;ie$ zQkmP?iInzWDcP|XTDEwcN8bsG*VjM zkG;o9L;t@1lS8I%vcI8>f4I&4)ckR=C2W%JAPzd# zf1b-Jlxy^ksoyd-|A>%{|`)oqSLE+2Q<{Yx6~{fGJaSd6O<&Wh7;IJ=7=TJ`>SQjVUHjc;&Nv1Kf!|6tmq5*Hg|s$Vt#p!!v& z1@~cHe&tFX=+)_W!9BkARa*ukspsT^YIx6vXyBl;hm77MS{jA>)GD(J!&a-=C4_c` z%2k$NagZSIu&v=(ChN)ez(=Y~PZ*P(;`R^Iygr}zHh4q&(?-V3N<)xM_1x&|r*rBg zGf((D4Nou9S`z83@AhB!YEen9kUznucCPGfdrx8`ACm^31mbZuf1Nr*?=32eq0Ouq z=F7yhgLbSnnUN6%YL)%4hxPe7Bl{Lc4bEGn4BW~{+9;K1<2$Ar%aeNW%$YK%+I6cd`Gno+PwOhFl(^K-+-<=)oP+V0ORXB*-9f*t7M*(x_&d^7DegdVUbJY zk?&71@7%}>ud<0rVbqj9&vGW-R7{9$lC@+hoD6NgZe{g+UuO^-y*Q(gC``wcZtQ23-#D@qpUSBjHPctld1Phlk+MXM9aH|6 zU0rOW?(CyyQV(m-4|Lfb8usdHT1sE_xo|zmOzakURb@@eV2QNdNzKOVy87+Y~ro&h~^Em#~jz10pzxeb&*1B*N zc*ur?_(mGWn+cQ<1s>Ft;T_yt-S+WoN{K=7}O$n*l4MkQJWR5>AB&ZsF_BwC*!fP+NnxP zn{<*Q-f4e6Kl`_y@MdzpU1AY%TOIrED9Yq$g;t&vGye-(JLzmTczya)H!?UWCftVH z_k>UGV-wfifj&Lm?QA~AlX%$hWMO1iD&slQAI)~N|!S4v9M-#_}xR4z6uIF5#aj*DH8Rbt22~r8<@b z?kC7S@N|{&6v^y?4P+=kQ>m{=zRqao!7?jr@v4rYf(>$-P=?yWmGgT>^MW*)w^sVa zCHf9faaFb(8H|lyxEYmg8Xfagrs55$<-n)xw`CfqwHng0DrD641;Ez00!yRt3_{q z-lIi_W{3Oc4aG{PMkijA3Y=iQp%uT3;DGd2u$B;bF$=fB_GV{U8idy_a z>UpQN=J`Gf^cgmv2WiiZD}}J5%}haY^&asma}_%u%G@apeNvd7?s4YBGcU%|rYE&% zUw_+=7rj>#0g;UDtIs9OP zYm|QVkU!XVn8rZ@T>D;ykzSIovqzMD{>k*`+pfLb))jW4mjN;eGgyz1@o z%~2erzPVmJtuhFH{&91XSE1GPtNGSHH;VkaWLK>IQDtSc1qbcw+2VeiH$CuKdl3h{ zfAZ`_n9Euz%c6Yi4(t`N_??N=!8eo+w4XMQQ)X4|m?95XJ6(6N>Zml&Fs0sE0fT%+ zE}Rt&ha0n%SxnfULWw89R zvW0Ec&zriVoH&!Wp6D%Tc8Lh^3BHc$=3n7CT_*ha9t#e#KV!DKKVe^((eR?rBSn?& zAsiI=u>Dco@<8Kl=~&H?L^v(G0L8{z@WFZIwF)R@GeJUI^HQR4&~&HD=S07Q)DOJe z6-<|EJOd>w<85Bq>*ge0>hrZ;=~-3rptI$uXp};H671SA8r+DuvY~UvVLyYy{_;zs z$Mq#g#e@))Y_fJ-@5qWq?d;jw2HLMQRUuFD(JvRAO?}a|nm}_pjNTJ|MZB@9?9)y!jM|>3N+PGi%uD{ef z^HliF>O^fJs`_c@LfdmwZ!@2xFGey7;}}~SR^n#`1+w8gI=uPi{Y5p+-I$bp)H>+` z%$zOLV-&6{wv|t_a?z<-D@Hx$ygVCmb1koFkE)Aq032BVEMhigmh zlnf5-TG(JBTDhCEE27}AV#dMDq09QCeKxM;{C8`^*^F}~Lk!RIzjJ>z%Hvr!Gj?bJ ze&XV#`ujYb;O9DbtOebs8A*WFYH^Sw`*3^D6YNX%N3N&bB>UMc6I#XJ@aGB@+Z1qG z9a=D9x<1Jw*s`E~Cc>cmx%{xXx#sA!o$=t&A=IUVgYV@g_V$ZEYG0~%S-lDB=zV`) z!*lpzL`G63ae2D2EBh@ByCRF5)kW9Gu8-vJuMp&36s*9xUk#4$+Gxvo)7@e~Fyf zv=l|M8a+ltv~L}$;yl+5YoqVhlQC+nxgz6*#G8p631_pW zd@(U_Fb+<9Twd^Q3sW+&7(wk4%YI+ueXzY@jM3eyJ6x7*qbzMf&D1*AqfSiU$1Iu7 zwO1~MK2oPxyX*0KAxwQu^ArLOl*+4bHDD~RW4XnpPVXcKzk<>|-bln|O;D&@lbRE6 zeF=9~etpai@Dr68m9LBrcyV$qA!UxrL>Hb6V2Cy4rnhK2u0N?i$_+utkz;PusV8i9LiZAvd%87m3M6=9u_~zO{3}4 zzByN`Fr6S1$W)p?`QquQsW_RN<;{U)Q_RLa{{!k=*~UY&aNlJgy=DRX=MJKZbq6hI z?nb;RL6-E{G|*Pv3_n)FQNAt-OKcsZpM})X7N`UgM7I|TxBKtZgv(`OpOGDZ9@d#>Y-J2AVrhXFsPtF+8-c=p3(@mcz?W70~njEs`C3YLl9LnX`++jhcDU4o|7r zLq*$pQ*Gk+CMc>27-cQgF@D&>Iz$;|3yrr1+gwVD=oxWrV3#zjsyA6 zW{c^8xfRKMErA0^oaAuO8Lrk%d0$a)vbJmyxb%m>`YRmHj}(z)a;j8 z6Dg^W&7nGp9(<2<+E`VVU%0i#*(KTQ3=XWbIM0(Nzhbt0n%LruiaHR?ApDs0E;rWr zaluuC=}`G2i#Ib4QNT~D!M6fG*LQ9nIzy>(p1$Pu)-&@6>E7o^*IfIBH)1SQT<;D> z?nA10b_puKxKP9OWv|LSJdSJODJq|LbASAri~5+7$bq#NNFKz(vSabt=(Y^Q7q_W% zFnFDi=t0#rsMKa2&U&Pz@=^0}rY-%WVQg&bheg>l-1DDo9XLzQHeQ@KnY^-HI{yUr~`WzEjJx(%y(Lv}FjBR!Q_l$03Nl=!92$~WbKB&+bE zdX#}Qr?eFA8ZG^^at*Ep$D0#~_ zKRoZ_(+E$U-TMF9yY8^2vTYwMAS%)YG!jD*l_qTjMKcP7DhNm~Q939JsECYk#zvPA z5CSTMDkT)9C%S-8*=O&w z*IIk6-|x3hXskEjL9;4FTz8f9CUKD0DZT&h1y-eojht8fCxwPlK_w&9JF? zD?!zoySj^BAHQ9+D9{GQFrS4niPu+nxS8kWfj$sQckI1JJ|w@`yYkJk%f-DqQl~{L z#;p6LJ%d$s%8Ivzc^&)Cq+?s+?f>0q~Ev??;$PtX--1YL`uI%_$t# zoouK$Y59xV_!rUZAB9XKN7%b#JmSiSBxQ&$*h1z9 zP?z?GXLZ=NguQ9^`N-zeZf}1PhkvF~eoJgj*k+yEd4?q6I7@%5hl=B_0@Xd3f-d7@ z!PprJl>?aL+mlzh2)mnYO+$<(NliI#-HRo<2rb*&6yk2Pb~g((G92!m7QQqvrlY3X ziE%|ruSv)+oU_uWTlmB!=C$$CeYNC+-QGMuf8fYQMuw5G>s5P(uB?_*D&{M1E} z+Wp!k&c&q(-Gl1A_%wG82HN@{Q; zrNRpig6W883w?@e9+REoBcxZ|+J_L_YX%vVb3dy(XfCU~O*bXj&qQ@1#-+&2%Wk3L zsjZNmd9K{<){Y+yZc9L_E24@$ojXd;!`6^f#k#29D{a%>>Jitib23NA4u)npx9r3! z8x;g84AYSCnM`gF!`c(40j&?4KKk}B6iW#Up*!8LXAwWJqj9C^#O;+OYQ$j2N3}VW zYtN*!vlUNhl(iM=9$zbF&E-S%2llDS!ddeI)NyX?tLrHOQDUQ(dV%Gi;4#8Q)>>nG0$g(!Hb!J$eFH$NBZ|a? zDTt!DOr@)Rrm8;8yYD#eEjj{u+}?HVM<=|P>c`Y1^CP-73RqAJ;E-EepJPxMZ=n2y zk@;%NUNhHEm&TU5;R$x@&=c&;EP?MAZM#M_lXsgzr{T|K7u0a+8MZi`2(Xacw4hv8Et}79rk=_N3=dE$$assd=BuA zP3BE2R^{X%eV7}xk?#Ec;^ie7w(3eO?}%BtDRO&YkLH}BzO;xAy%}t)YdCb zypWf+T+xc4e+8X zoCy)8N9mA=@-RS@m6_MVu|np!t27e|KD)Q@;VN&ovKMrtnpw4*6ejaYokwgd+!Z99 z40tb&U##cA#oY@cR{YzDZB*>w1b_ppyG>d#?mnwrH=sXY#}7_54Fi?=$qbr^`s?TC zWQ64J!DZL2+!kmj_(nrBY8-^gDH3E7PRg6gG-Ban#U%vs1H8`2(@PbB!2*o|Q^_6A z(lBtb-rmZevdJq^W-Xzew|pYJ^vjH3qB8j9%lZToB4M|_NSa$Ha6jR#DXKR309Ey1 zj9ZqgfKr^?<}pQ8we0lLmV1UxNgXhP#|W^|j6q zYX)3*1(0xq{wW=)9ZE?>Yi{1cxRJQ=ZUZX~KDv=5-b7@9h9*f83ylDBy?I!bJOjFg zU2{5Rg%7cam-mY^&h<1a3=H0I+$Z;mrmf9FJ#U=zox2{Xxq#a%L9)nyti-qQHe`%8}w4Oi{3~)T5-#6w!Uwh2%$(*lrt8( zsGzT6${Jh@=0nVZ`$qR`%QO|Sjyj!(YVxfWF(>wy$Vm}k4$TsLNT5Ek`x?iMAs>sA?qU8NA`4q1z8}x#H;ugX#8F zE%UzDJra}B>d{-QfcX*c_Z+|>_UZxYA+jbl6z)H)Hu>_#CM7Rq?2Vy0X!%F2Xyg&3 zvk)Wlo-1m!%O8KWrNwI{$`%yXUT$0Dddh(MQ#Y*}@#8q`0PmwppI`0u6OZnEYQAx< zGhrzAssmyRQ>4ANM?{Sb#ptk2$=m@ay-|MivBiMpOebgHL(>Vu1tCY?Yjf>5B?JjP+?F<=SJqwGR>`CC~5d*|nKg zUt}Rb_a(Zm-KdhdY>O7f)5wd!!;|~WEPmo4mUQFl8C!DLH=9Z?Lc{4j{mJ519$phR z#tc8(-r2~|;-b|n)uXh~tZPc^jO&}T=pi8>MnGkjhsWX&k;+_ zXisb#Qjdh1`P_MCcItggf3l!5ITs3C;@Q0Jh&~S!-~TW}4yng9f(?o?*RZ@yYmbQ7bnlF`^OL)bW(Tm##>Kwk90N?Y~`|J1&Z53xe8 zad=Qsu*@}6N4Y$}nYx`0Pui0#?G`P8y_NPc$Lg6>6$6>nAGX4P*_YjT7}DNg+GkHf ziw+LApjjBuMJ4^z>?CWZ--4F3ca-LOCDQkvod-wkjm?hdXraRe9c}|K|EoopuN<4F zWY!&*C2elbwALZoEz(g!Oy};+N%2)A`69<5CJq^B(y^%gxF+eScQ`yZ#C;#!_7SX? z?vq?4E!ozTmtbh94I+S1s6LQVLJNkkzldE`wtNnlWl#-nJ@ps&fS*+IkuMXwzMP=6 z?(wVx8NKADf_01Q*v^CEUhuR&u*pQ;xiT?tsN@=a`H4@4E%z-KZ)DgXDzQ|QTJL%@ z-&g0j`1cVpuDH6CoX2txY@|-hYz9g_6?eZ+DH~z)A>^{u%c(@#3?Jfrb0BF#Nqp>D zqOyM8?S^#3bV6w2(%~U1S|0HdjLd`P@WG{6SgG$d zKgF{sG;v+(jsr_w8|qBL4bLiWS|i?Q=MW^XkT{<-^uBvT(vN(I7?TgV9~O4hnAp9j z@-T?)K1|O`@gS;?Y5Jczk^9JGo%G7HTxvnW{;lM@veeM7lPK8?vlVcrc4*MCnUz{? zaM%>vMus`4r&?7S_)G*zDSVQ#{gvZ|kRFeeT|H}G4ovt#fsskZ#3f`d#TTZ1Wmup>sF%(015=N$`K0SmO)x{wG}77uN4jxUw(W*gxUQz5>DjH}kWv zzy|-#R`x|8`8%!AR-xhi)-uCTrxOvR$`Vj1X-iIcQb3fxXqvp2iiSE2f}H?=fS>Vd zg(j&%cbw4l7u}=LE{GmJB>Kau%}O*PPljf~X*tk+(RwkTcj^}YF9C#1@1QwX%_-T} zjYEm7nD0u_X@y8e2JWcn^54MYq4WO>JpPIb@QZ;sW*P0V@4G2FkdU_}O8^nbqjR<0 zO{C`f!ub$zei6J(y7Z-)MqmnP0<0nu8krsh2I3v!zM+W+TVtGsn}ZF=D^zl2&T)E| z(I3#_PSJ^v!J~x8B*x(hCSZx8!zHu5TOG#pK}IzT99@gF_uJrqoY&ItOF5_XA+i;V zbGbu87!6E((B8TPr0WBPNHm>---A;;+xHeoxNyH&OSmc98gtV}W-;C`Jp<&)I*&CN z9&3Z1@w?o2VEXUV%g;m;@UwRDE8^cDY4$&7Nk^uS3a0M>#%W+>aHW4~Zdnm5DCT^o zW)9bI9XIqV+qCMS;bVGK6~^WO{9la0NGE-%1lOaLU%4pBiqUm=mk;b~PiTB)GbP*S z6dBKH*|vAi7Ln;~;_;t-iwlC%CwR;{hA;;7^iU73y$yEI@F7>It475{rjFH2_W57O z;|c#QRoUd!ufAw$8yxZ}t`aKSA($&Zwx8jrQDwfFE}s6<&@*GqC0XZ`0s?zrj~=^i zm;(hE$WwsA#2j{%50MyWjj|5%9NOdg5Oo>Ud?+6>Xb50Jmb*a{k4L@e?HpgI)U{y+ zJmEvGgHeIZNsMhq`Ex9I;n85XYkFut&~5U0%tag6r2C> zf`&XR3P)G{wz6+~_RSi<`Pn}eL3Z5{%_zTMgQ8YjfOy?R@1So`NX4EuCsvJ)Wq!=2 c34+rP*6!^Wqa@FC2ZsOp=fnQ>t)ioU1-_*m2LJ#7 diff --git a/manual/index.php b/manual/index.php deleted file mode 100644 index ae4ce5816..000000000 --- a/manual/index.php +++ /dev/null @@ -1,284 +0,0 @@ - $conn, - 'tableName' => 'cache' - ); - - $this->_cache = new Doctrine_Cache_Db($options); - - try { - $this->_cache->createTable(); - } catch (Doctrine_Connection_Exception $e) { - if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { - $this->_cache = null; - } - } - - } catch (Exception $e) { - $this->_cache = null; - } - } - - /** - * Fetches a cache record from cache. - * - * @param $id string the id of the cache record - * @return string fetched cache record, or false on failure - */ - public function fetch($id) - { - if ($this->_cache !== null) { - try { - return $this->_cache->fetch($id); - } catch (Exception $e) { - return false; - } - } - - return false; - } - - /** - * Saves a cache record to cache. - * - * @param $data mixed the data to be saved to cache - * @param $id string the id of the cache record - * @return bool True on success, false on failure - */ - public function save($data, $id) - { - if ($this->_cache !== null) { - try { - return $this->_cache->save($data, $id); - } catch (Exception $e) { - return false; - } - } - - return false; - } - - /** - * Deletes all cached records from cache. - * - * @return True on success, false on failure - */ - public function deleteAll() - { - if ($this->_cache !== null) { - try { - return $this->_cache->deleteAll(); - } catch (Exception $e) { - return false; - } - } - - return false; - } -} - -// Temporary directory used by cache and LaTeX to Pdf conversion -$tempDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tmp'; - -// The file where cached data is saved -$cacheFile = $tempDir . DIRECTORY_SEPARATOR . 'cache.sq3'; - -$cache = new Cache($cacheFile); - -// Fetch the revision of cached data -$cacheRev = $cache->fetch('revision'); - -// Check the revision of documentation files -$revision = getSvnRevision('.'); - -// Is current SVN revision greater than the revision of cached data? -if ($revision > $cacheRev) { - $cache->deleteAll(); // cached data is not valid anymore - $cache->save($revision, 'revision'); -} - -// Load table of contents from cache -$toc = $cache->fetch('toc'); - -// If table of contents was not cached, parse it from documentation files -if ( ! $toc instanceof Sensei_Doc_Toc) { - $toc = new Sensei_Doc_Toc('docs/en.txt'); - $cache->save($toc, 'toc'); -} - -// Which format to output docs -if (isset($_GET['format'])) { - $format = ucfirst(strtolower($_GET['format'])); - - switch ($format) { - case 'Xhtml': - case 'Latex': - case 'Pdf': - break; - default: - $format = 'Xhtml'; // default if invalid format is specified - break; - } - -} else { - $format = 'Xhtml'; // default if no format is specified -} - -$rendererClass = 'Sensei_Doc_Renderer_' . $format; -$renderer = new $rendererClass($toc); - -$renderer->setOptions(array( - 'title' => 'Doctrine Manual', - 'author' => 'Konsta Vesterinen', - 'version' => 'Rev. ' . $revision, - 'subject' => 'Object relational mapping', - 'keywords' => 'PHP, ORM, object relational mapping, Doctrine, database' -)); - -$cacheId = $format; - -switch ($format) { - case 'Latex': - $renderer->setOption('template', file_get_contents('templates/latex.tpl.php')); - - $headers = array( - 'Content-Type: application/latex', - 'Content-Disposition: attachment; filename=doctrine-manual.tex' - ); - break; - - case 'Pdf': - $renderer->setOption('template', file_get_contents('templates/latex.tpl.php')); - - $renderer->setOptions(array( - 'temp_dir' => $tempDir, - 'pdflatex_path' => '/usr/bin/pdflatex', - 'lock' => true - )); - - $headers = array( - 'Content-Type: application/pdf', - 'Content-Disposition: attachment; filename=doctrine-manual.pdf' - ); - break; - - case 'Xhtml': - default: - $renderer->setOption('template', file_get_contents('templates/xhtml.tpl.php')); - - $viewIndex = true; - - if (isset($_GET['one-page'])) { - $viewIndex = false; - } - - if (isset($_GET['chapter'])) { - $section = $toc->findByPath($_GET['chapter']); - - if ($section && $section->getLevel() === 1) { - $title = $renderer->getOption('title') . ' - Chapter ' - . $section->getIndex() . ' ' . $section->getName(); - - $renderer->setOptions(array( - 'section' => $section, - 'url_prefix' => '?chapter=', - 'title' => $title - )); - - $cacheId .= '-' . $section->getPath(); - $viewIndex = false; - } - } - break; - -} - -if (isset($viewIndex) && $viewIndex) { - - $title = $renderer->getOption('title'); - include 'templates/index.tpl.php'; - -} else { - $output = $cache->fetch($cacheId); - - if ($output === false) { - try { - $output = $renderer->render(); - } catch (Exception $e) { - die($e->getMessage()); - } - $cache->save($output, $cacheId); - } - - if (isset($headers)) { - foreach ($headers as $header) { - header($header); - } - } - - // buffer output - ob_start(); - echo $output; - ob_end_flush(); - -} - diff --git a/manual/lib/.htaccess b/manual/lib/.htaccess deleted file mode 100644 index 3418e55a6..000000000 --- a/manual/lib/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/manual/lib/Text/Wiki/Doc.php b/manual/lib/Text/Wiki/Doc.php deleted file mode 100644 index 8e58a335d..000000000 --- a/manual/lib/Text/Wiki/Doc.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Default.php,v 1.1 2006/03/01 16:58:17 justinpatrin Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -require_once('Text/Wiki.php'); - -/** - * This is the parser for the documentation - * - * @category Text - * @package Text_Wiki - * @author Janne Vanhala - * @author Justin Patrin - */ -class Text_Wiki_Doc extends Text_Wiki { - - var $rules = array( - 'Prefilter', - 'Delimiter', - 'Code', - 'Raw', - 'Heading', - 'Horiz', - 'Break', - 'Blockquote', - 'List', - 'Deflist', - 'Table', - 'Image', - 'Phplookup', - 'Newline', - 'Paragraph', - 'Url', - 'Doclink', - 'Colortext', - 'Strong', - 'Bold', - 'Emphasis', - 'Italic', - 'Underline', - 'Tt', - 'Superscript', - 'Subscript', - 'Revise', - 'Tighten' - ); - - function Text_Wiki_Doc($rules = null) { - parent::Text_Wiki($rules); - - $this->addPath('parse', $this->fixPath(dirname(__FILE__)) . 'Parse/Doc'); - $this->addPath('render', $this->fixPath(dirname(__FILE__)) . 'Render/'); - - $this->setRenderConf('Xhtml', 'Url', 'target', ''); - $this->setRenderConf('Xhtml', 'charset', 'UTF-8'); - } - -} diff --git a/manual/lib/Text/Wiki/Parse/Doc/Code.php b/manual/lib/Text/Wiki/Parse/Doc/Code.php deleted file mode 100644 index fd9b2cb91..000000000 --- a/manual/lib/Text/Wiki/Parse/Doc/Code.php +++ /dev/null @@ -1,97 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Code.php,v 1.11 2007/06/09 23:11:25 justinpatrin Exp $ -* -*/ - -/** -* -* Parses for text marked as a code example block. -* -* This class implements a Text_Wiki_Parse to find sections marked as code -* examples. Blocks are marked as the string on a line by itself, -* followed by the inline code example, and terminated with the string -* on a line by itself. The code example is run through the -* native PHP highlight_string() function to colorize it, then surrounded -* with
...
tags when rendered as XHTML. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Code extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to find source text matching this - * rule. - * - * @access public - * - * @var string - * - */ - var $regex = ';^]*)?>(?:\s*)(.*?)(?:\s*)
(\s|$);msi'; - - /** - * - * Generates a token entry for the matched text. Token options are: - * - * 'text' => The full matched text, not including the tags. - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A delimited token number to be used as a placeholder in - * the source text. - * - */ - - function process(&$matches) - { - // are there additional attribute arguments? - $args = trim($matches[1]); - - if ($args == '') { - $options = array( - 'text' => $matches[2], - 'attr' => array('type' => '') - ); - } else { - // get the attributes... - $attr = $this->getAttrs($args); - - // ... and make sure we have a 'type' - if ( ! isset($attr['type'])) { - $attr['type'] = ''; - } - - // retain the options - $options = array( - 'text' => $matches[2], - 'attr' => $attr - ); - } - - return $this->wiki->addToken($this->rule, $options) . $matches[3]; - } -} -?> diff --git a/manual/lib/Text/Wiki/Parse/Doc/Doclink.php b/manual/lib/Text/Wiki/Parse/Doc/Doclink.php deleted file mode 100644 index a110b6c4b..000000000 --- a/manual/lib/Text/Wiki/Parse/Doc/Doclink.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @license LGPL - * @version $Id$ - * - */ -class Text_Wiki_Parse_Doclink extends Text_Wiki_Parse { - - var $conf = array( - 'toc' => null - ); - - var $regex = '/\[doc ([a-z0-9-]+(?::[a-z0-9-]+)*)(?: ([^\n\]]*))?]/'; - - function process(&$matches) - { - $toc = $this->getConf('toc'); - - if ($toc instanceof Sensei_Doc_Toc) { - $section = $toc->findByPath($matches[1]); - } - - if (isset($section)) { - $options = array(); - - $options['path'] = $matches[1]; - - if (isset($matches[2])) { - $options['text'] = $matches[2]; - $options['text'] = str_replace(':index', $section->getIndex(), $options['text']); - $options['text'] = str_replace(':name', $section->getName(), $options['text']); - $options['text'] = str_replace(':fullname', $section->getName(true), $options['text']); - } else { - $options['text'] = $section->getIndex(); - } - - return $this->wiki->addToken($this->rule, $options); - - } else { - return $matches[0]; - } - - } -} diff --git a/manual/lib/Text/Wiki/Parse/Doc/Prefilter.php b/manual/lib/Text/Wiki/Parse/Doc/Prefilter.php deleted file mode 100644 index f3baeaae2..000000000 --- a/manual/lib/Text/Wiki/Parse/Doc/Prefilter.php +++ /dev/null @@ -1,93 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Prefilter.php,v 1.4 2006/12/08 08:30:37 justinpatrin Exp $ -* -*/ - -/** -* -* "Pre-filter" the source text. -* -* Convert DOS and Mac line endings to Unix, concat lines ending in a -* backslash \ with the next line, convert tabs to 4-spaces, add newlines -* to the top and end of the source text, compress 3 or more newlines to -* 2 newlines. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse { - - - /** - * - * Simple parsing method. - * - * @access public - * - */ - - function parse() - { - // convert DOS line endings - $this->wiki->source = str_replace("\r\n", "\n", - $this->wiki->source); - - // convert Macintosh line endings - $this->wiki->source = str_replace("\r", "\n", - $this->wiki->source); - - // concat lines ending in a backslash - $this->wiki->source = str_replace("\\\n", "", - $this->wiki->source); - - // convert tabs to four-spaces - $this->wiki->source = str_replace("\t", " ", - $this->wiki->source); - - // remove trailing spaces - $this->wiki->source = preg_replace('/ +\n/', "\n", $this->wiki->source); - - // add extra newlines before and after code tags to prevent xhtml - // validation errors - $this->wiki->source = preg_replace( - ';^(]*)?>(?:.*?)(?:\s|$));msi', - "\n$1\n\n", $this->wiki->source); - - // add extra newlines at the top and end; this - // seems to help many rules. - $this->wiki->source = "\n" . $this->wiki->source . "\n\n"; - - $this->wiki->source = str_replace("\n----\n","\n\n----\n\n", - $this->wiki->source); - $this->wiki->source = preg_replace("/\n(\\+{1,6})(.*)\n/m", - "\n\n\\1 \\2\n\n", - $this->wiki->source); - - // finally, compress all instances of 3 or more newlines - // down to two newlines. - $find = "/\n{3,}/m"; - $replace = "\n\n"; - $this->wiki->source = preg_replace($find, $replace, - $this->wiki->source); - } - -} -?> \ No newline at end of file diff --git a/manual/lib/Text/Wiki/Parse/Doc/Table.php b/manual/lib/Text/Wiki/Parse/Doc/Table.php deleted file mode 100644 index 355624d5e..000000000 --- a/manual/lib/Text/Wiki/Parse/Doc/Table.php +++ /dev/null @@ -1,255 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Table.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* Parses for table markup. -* -* This class implements a Text_Wiki_Parse to find source text marked as a -* set of table rows, where a line start and ends with double-pipes (||) -* and uses double-pipes to separate table cells. The rows must be on -* sequential lines (no blank lines between them) -- a blank line -* indicates the beginning of a new table. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Table extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to parse the source text and find - * matches conforming to this rule. Used by the parse() method. - * - * @access public - * - * @var string - * - * @see parse() - * - */ - - var $regex = '/\n((\|\|).*)(\n)(?!(\|\|))/Us'; - - - /** - * - * Generates a replacement for the matched text. - * - * Token options are: - * - * 'type' => - * 'table_start' : the start of a bullet list - * 'table_end' : the end of a bullet list - * 'row_start' : the start of a number list - * 'row_end' : the end of a number list - * 'cell_start' : the start of item text (bullet or number) - * 'cell_end' : the end of item text (bullet or number) - * - * 'cols' => the number of columns in the table (for 'table_start') - * - * 'rows' => the number of rows in the table (for 'table_start') - * - * 'span' => column span (for 'cell_start') - * - * 'attr' => column attribute flag (for 'cell_start') - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A series of text and delimited tokens marking the different - * table elements and cell text. - * - */ - - function process(&$matches) - { - // our eventual return value - $return = ''; - - // the number of columns in the table - $num_cols = 0; - - // the number of rows in the table - $num_rows = 0; - - // the maximum content lengths in the column cells - $col_widths = array(); - - // the maximum row length of the table - $table_width = 0; - - // rows are separated by newlines in the matched text - $rows = explode("\n", $matches[1]); - - // loop through each row - foreach ($rows as $row) { - - // increase the row count - $num_rows ++; - - $row_length = 0; - - // start a new row - $return .= $this->wiki->addToken( - $this->rule, - array('type' => 'row_start') - ); - - // cells are separated by double-pipes - $cell = explode("||", $row); - - // get the number of cells (columns) in this row - $last = count($cell) - 1; - - // is this more than the current column count? - // (we decrease by 1 because we never use cell zero) - if ($last - 1 > $num_cols) { - // increase the column count - $num_cols = $last - 1; - } - - // by default, cells span only one column (their own) - $span = 1; - - // ignore cell zero, and ignore the "last" cell; cell zero - // is before the first double-pipe, and the "last" cell is - // after the last double-pipe. both are always empty. - for ($i = 1; $i < $last; $i ++) { - - // if there is no content at all, then it's an instance - // of two sets of || next to each other, indicating a - // span. - if ($cell[$i] == '') { - - // add to the span and loop to the next cell - $span += 1; - continue; - - } else { - - // this cell has content. - - // find any special "attr"ibute cell markers - if (substr($cell[$i], 0, 2) == '> ') { - // right-align - $attr = 'right'; - $cell[$i] = substr($cell[$i], 2); - } elseif (substr($cell[$i], 0, 2) == '= ') { - // center-align - $attr = 'center'; - $cell[$i] = substr($cell[$i], 2); - } elseif (substr($cell[$i], 0, 2) == '< ') { - // left-align - $attr = 'left'; - $cell[$i] = substr($cell[$i], 2); - } elseif (substr($cell[$i], 0, 2) == '~ ') { - $attr = 'header'; - $cell[$i] = substr($cell[$i], 2); - } else { - $attr = null; - } - - $content = trim($cell[$i]); - - // content length of this cell - $cell_length = strlen($content); - - // add content length to row length - $row_length += $cell_length; - - // update column width if this cell's length is greater than - // old column width - if ( ! isset($col_widths[$i]) || $cell_length > $col_widths[$i]) { - $col_widths[$i] = $cell_length; - } - - // start a new cell... - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => 'cell_start', - 'attr' => $attr, - 'span' => $span - ) - ); - - // ...add the content... - $return .= $content; - - // ...and end the cell. - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => 'cell_end', - 'attr' => $attr, - 'span' => $span - ) - ); - - // reset the span. - $span = 1; - } - - } - - // update table width if the row was wider than previous rows - if ($row_length > $table_width) { - $table_width = $row_length; - } - - // end the row - $return .= $this->wiki->addToken( - $this->rule, - array('type' => 'row_end') - ); - - } - - // wrap the return value in start and end tokens - $return = - $this->wiki->addToken( - $this->rule, - array( - 'type' => 'table_start', - 'rows' => $num_rows, - 'cols' => $num_cols, - 'table_width' => $table_width, - 'col_widths' => $col_widths - ) - ) - . $return . - $this->wiki->addToken( - $this->rule, - array( - 'type' => 'table_end' - ) - ); - - // we're done! - return "\n$return\n\n"; - } -} -?> \ No newline at end of file diff --git a/manual/lib/Text/Wiki/Render/Latex.php b/manual/lib/Text/Wiki/Render/Latex.php deleted file mode 100644 index 134cf7714..000000000 --- a/manual/lib/Text/Wiki/Render/Latex.php +++ /dev/null @@ -1,88 +0,0 @@ - -* -* @package Text_Wiki -* -* @todo [http://google.com] becomes 1 with a LaTeX footnote in subscript. -* This should be a normal LaTeX footnote associated with the -* previous word? -* -* @todo parse "..." to be ``...'' -* -* @todo parse '...' to be `...' -* -* @todo move escape_latex to a static function, move escaping to the -* individual .php files they are associated with -* -* @todo allow the user to add conf items to do things like -* + A custom document header -* + Custom page headings -* + Include packages -* + Set Title, Author, Date -* + Include a title page -* + Not output Document Head/Foot (maybe combinding many pages?) -* -*/ - -class Text_Wiki_Render_Latex extends Text_Wiki_Render { - - function escape_latex ($txt) { - $txt = str_replace("\\", "\\\\", $txt); - $txt = str_replace('#', '\#', $txt); - $txt = str_replace('$', '\$', $txt); - $txt = str_replace('%', '\%', $txt); - $txt = str_replace('^', '\^', $txt); - $txt = str_replace('&', '\&', $txt); - $txt = str_replace('_', '\_', $txt); - $txt = str_replace('{', '\{', $txt); - $txt = str_replace('}', '\}', $txt); - $txt = str_replace('<', '\textless{}', $txt); - $txt = str_replace('>', '\textgreater{}', $txt); - - // Typeset things a bit prettier than normas - $txt = str_replace('~', '$\sim$', $txt); - $txt = str_replace('...', '\ldots', $txt); - - return $txt; - } - - function escape($tok, $ele) { - if (isset($tok[$ele])) { - $tok[$ele] = $this->escape_latex($tok[$ele]); - } - - return $tok; - } - - function pre() - { - foreach ($this->wiki->tokens as $k => $tok) { - if ($tok[0] == 'Code' || $tok[0] == 'Phplookup') { - continue; - } - - $tok[1] = $this->escape($tok[1], 'text'); - $tok[1] = $this->escape($tok[1], 'page'); - $tok[1] = $this->escape($tok[1], 'href'); - - $this->wiki->tokens[$k] = $tok; - } - - $this->wiki->source = $this->escape_latex($this->wiki->source); - - return ''; - } - - function post() - { - return ''; - } - -} diff --git a/manual/lib/Text/Wiki/Render/Latex/Code.php b/manual/lib/Text/Wiki/Render/Latex/Code.php deleted file mode 100644 index a65527201..000000000 --- a/manual/lib/Text/Wiki/Render/Latex/Code.php +++ /dev/null @@ -1,44 +0,0 @@ -"; // diff --git a/manual/lib/Text/Wiki/Render/Latex/Doclink.php b/manual/lib/Text/Wiki/Render/Latex/Doclink.php deleted file mode 100644 index f6ef7e88f..000000000 --- a/manual/lib/Text/Wiki/Render/Latex/Doclink.php +++ /dev/null @@ -1,8 +0,0 @@ -= $level) { - array_pop($label); - } - $label[] = Sensei_Doc_Section::convertNameToPath($text); - - switch ($level) { - case '1': - return '\chapter{'; - case '2': - return '\section{'; - case '3': - return '\subsection{'; - case '4': - return '\subsubsection{'; - case '5': - return '\paragraph{'; - case '6': - return '\subparagraph{'; - } - } - - - if ($type == 'end') { - return "}\n\label{" . implode(':', $label) . "}\n"; - } - } -} -?> diff --git a/manual/lib/Text/Wiki/Render/Latex/List.php b/manual/lib/Text/Wiki/Render/Latex/List.php deleted file mode 100644 index 440054605..000000000 --- a/manual/lib/Text/Wiki/Render/Latex/List.php +++ /dev/null @@ -1,77 +0,0 @@ - diff --git a/manual/lib/Text/Wiki/Render/Latex/Phplookup.php b/manual/lib/Text/Wiki/Render/Latex/Phplookup.php deleted file mode 100644 index bbca7cdf4..000000000 --- a/manual/lib/Text/Wiki/Render/Latex/Phplookup.php +++ /dev/null @@ -1,38 +0,0 @@ -wiki->formatObj[$this->format]; - - // toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces) - $q = $formatObj->escape_latex($this->urlEncode($q)); - $text = $formatObj->escape_latex($text); - - return '\texttt{' . $text . '}\footnote{\url{http://php.net/' . $q . '}}'; - } -} -?> diff --git a/manual/lib/Text/Wiki/Render/Latex/Table.php b/manual/lib/Text/Wiki/Render/Latex/Table.php deleted file mode 100644 index 2f182627e..000000000 --- a/manual/lib/Text/Wiki/Render/Latex/Table.php +++ /dev/null @@ -1,140 +0,0 @@ - null, - 'css_tr' => null, - 'css_th' => null, - 'css_td' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - // make nice variable names (type, attr, span) - extract($options); - - switch ($type) - { - case 'table_start': - $this->cell_count = $cols; - - $max_width = 60; - - $available_width = $max_width; - if (count($col_widths) > 0) { - $avg_width = $available_width / (float) count($col_widths); - } - $calc_col_widths = array(); - - while (count($col_widths) > 0) { - - $found_thinner = false; - - foreach ($col_widths as $k => $col_width) { - if ($col_width <= $avg_width) { - $found_thinner = true; - $available_width -= $col_width; - $calc_col_widths[$k] = $col_width / (float) $max_width; - unset($col_widths[$k]); - } - } - - if (count($col_widths) > 0) { - $avg_width = $available_width / (float) count($col_widths); - } - - if ( ! $found_thinner) { - foreach ($col_widths as $k => $col_width) { - $calc_col_widths[$k] = $avg_width / (float) $max_width; - unset($col_widths[$k]); - } - } - } - - $tbl_start = '{\centering \begingroup' . "\n" - . '\setlength{\newtblsparewidth}{\linewidth-' . 2 * ($cols + 1) . '\tabcolsep}' . "\n" - . '\begin{longtable}{|'; - - for ($a=0; $a < $this->cell_count; $a++) { - $tbl_start .= 'p{' . round($calc_col_widths[$a + 1], 4) . '\newtblsparewidth}|'; - } - $tbl_start .= "}\n"; - - return $tbl_start; - - case 'table_end': - return "\\hline\n\\end{longtable}\n\\endgroup}\n\n"; - - case 'caption_start': - return "\\caption{"; - - case 'caption_end': - return "}\n"; - - case 'row_start': - $this->is_spanning = false; - $this->cell_id = 0; - return "\\hline\n"; - - case 'row_end': - return "\\\\\n"; - - case 'cell_start': - if ($span > 1) { - $col_spec = ''; - if ($this->cell_id == 0) { - $col_spec = '|'; - } - $col_spec .= 'l|'; - - $this->cell_id += $span; - $this->is_spanning = true; - - return '\multicolumn{' . $span . '}{' . $col_spec . '}{'; - } - - $this->cell_id += 1; - - if ($attr === 'header') { - return '\bfseries '; - } else { - return ''; - } - - case 'cell_end': - $out = ''; - if ($this->is_spanning) { - $this->is_spanning = false; - $out = '}'; - } - - if ($this->cell_id != $this->cell_count) { - $out .= ' & '; - } - - return $out; - - default: - return ''; - - } - } -} -?> diff --git a/manual/lib/Text/Wiki/Render/Latex/Url.php b/manual/lib/Text/Wiki/Render/Latex/Url.php deleted file mode 100644 index a82ede91e..000000000 --- a/manual/lib/Text/Wiki/Render/Latex/Url.php +++ /dev/null @@ -1,44 +0,0 @@ - false, - 'images' => true, - 'img_ext' => array('jpg', 'jpeg', 'gif', 'png') - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - // create local variables from the options array (text, - // href, type) - extract($options); - - if ($options['type'] == 'start') { - return ''; - } else if ($options['type'] == 'end') { - return '\url{' . $href . '}'; - } else { - if ($text === $href) { - return '\url{' . $href . '}'; - } - return $text . '\footnote{\url{' . $href . '}}'; - } - } -} -?> diff --git a/manual/lib/Text/Wiki/Render/Xhtml/Blockquote.php b/manual/lib/Text/Wiki/Render/Xhtml/Blockquote.php deleted file mode 100644 index 60df55ce1..000000000 --- a/manual/lib/Text/Wiki/Render/Xhtml/Blockquote.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Blockquote.php,v 1.9 2007/05/26 18:25:23 mic Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders a blockquote in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Blockquote extends Text_Wiki_Render { - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - $type = $options['type']; - $level = $options['level']; - - // set up indenting so that the results look nice; we do this - // in two steps to avoid str_pad mathematics. ;-) - $pad = str_pad('', $level, "\t"); - $pad = str_replace("\t", ' ', $pad); - - // pick the css type - $css = $this->formatConf(' class="%s"', 'css'); - - if (isset($options['css'])) { - $css = ' class="' . $options['css']. '"'; - } - // starting - if ($type == 'start') { - $output = $pad; - if ($level > 1) { - $output .= '

'; - } - $output .= "

"; - - return $output; - } - - // ending - if ($type == 'end') { - $output = $pad . "

\n"; - if ($level > 1) { - $output .= '

'; - } - return $output; - } - } -} -?> diff --git a/manual/lib/Text/Wiki/Render/Xhtml/Code.php b/manual/lib/Text/Wiki/Render/Xhtml/Code.php deleted file mode 100644 index 049113e19..000000000 --- a/manual/lib/Text/Wiki/Render/Xhtml/Code.php +++ /dev/null @@ -1,116 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Code.php,v 1.13 2006/02/10 23:07:03 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ -require_once('highlight.php'); -/** - * This class renders code blocks in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render { - - var $conf = array( - 'css' => null, // class for

-        'css_code' => null, // class for generic 
-        'css_php'  => null, // class for PHP 
-        'css_html' => null, // class for HTML 
-        'css_filename' => null, // class for optional filename 
- 'code_begin_callback' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - $text = $options['text']; - $attr = $options['attr']; - $type = strtolower($attr['type']); - - $css = $this->formatConf(' class="%s"', 'css'); - $css_code = $this->formatConf(' class="%s"', 'css_code'); - $css_php = $this->formatConf(' class="%s"', 'css_php'); - $css_html = $this->formatConf(' class="%s"', 'css_html'); - $css_filename = $this->formatConf(' class="%s"', 'css_filename'); - - if ($type == 'php') { - if (substr($options['text'], 0, 5) != '"; // ...
tags) - $h = new PHP_Highlight(true); - $h->loadString($text); - $text = @$h->toHtml(true); - - $text = str_replace(' ', ' ', $text); - - $text = str_replace('
', "
", $text);
-            $text = str_replace('
', "
", $text); - - } elseif ($type == 'html' || $type == 'xhtml') { - - // HTML code example: - // add opening and closing tags, - // convert tabs to four spaces, - // convert entities. - $text = str_replace("\t", " ", $text); - $text = "\n$text\n"; - $text = $this->textEncode($text); - $text = "$text
"; - - } else { - // generic code example: - // convert tabs to four spaces, - // convert entities. - $text = str_replace("\t", " ", $text); - $text = $this->textEncode($text); - $text = "$text
"; - } - - if ($css_filename && isset($attr['filename'])) { - $text = "" . - $attr['filename'] . '' . $text; - } - - $callback = $this->getConf('code_begin_callback'); - if ($callback) { - $text = call_user_func($callback) . $text; - } - - return "\n$text\n\n"; - } -} -?> diff --git a/manual/lib/Text/Wiki/Render/Xhtml/Doclink.php b/manual/lib/Text/Wiki/Render/Xhtml/Doclink.php deleted file mode 100644 index a08c53265..000000000 --- a/manual/lib/Text/Wiki/Render/Xhtml/Doclink.php +++ /dev/null @@ -1,29 +0,0 @@ - null, - 'css' => null - ); - - function token($options) - { - $callback = $this->getConf('url_callback'); - - if ($callback) { - $href = call_user_func($callback, $options['path']); - } else { - $href = $options['path']; - } - - if ($this->getConf('css')) { - $css = ' class="' . $this->getConf('css') . '"'; - } else { - $css = ''; - } - - $output = '' . $options['text'] . ''; - - return $output; - } -} diff --git a/manual/lib/highlight.php b/manual/lib/highlight.php deleted file mode 100644 index ad984b37e..000000000 --- a/manual/lib/highlight.php +++ /dev/null @@ -1,568 +0,0 @@ - Formatted HTML - * * toHtmlComment => Formatted HTML, specifically for comments on messageboards - * * toList => Ordered lists - * * toArray => Associative array - * - * Highlighting can be inline (with styles), or the same as - * highlight_file() where colors are taken from php.ini. - * - * @author Aidan Lister - * @author Based on an idea by Matthew Harris - * @version 1.3.0 - * @link http://aidanlister.com/repos/v/PHP_Highlight.php - */ -if ( ! defined('T_ML_COMMENT')) { - define('T_ML_COMMENT', T_COMMENT); -} else { - define('T_DOC_COMMENT', T_ML_COMMENT); -} -class PHP_Highlight -{ - /** - * Hold highlight colors - * - * Contains an associative array of token types and colours. - * By default, it contains the colours as specified by php.ini - * - * For example, to change the colour of strings, use something - * simular to $h->highlight['string'] = 'blue'; - * - * @var array - * @access public - */ - var $highlight; - - /** - * Things to be replaced for formatting or otherwise reasons - * - * The first element contains the match array, the second the replace - * array. - * - * @var array - * @access public - */ - var $replace = array( - 0 => array("\t", ' '), - 1 => array('    ', ' ')); - - /** - * Format of the link to the PHP manual page - * - * @var string - * @access public - */ - var $manual = '%s'; - - /** - * Format of the span tag to be wrapped around each token - * - * @var string - * @access public - */ - var $span; - - /** - * Hold the source - * - * @var string - * @access private - */ - var $_source = false; - - /** - * Hold plaintext keys - * - * An array of lines which are plaintext - * - * @var array - * @access private - */ - var $_plaintextkeys = array(); - - - /** - * Constructor - * - * Populates highlight array - * - * @param bool $inline If inline styles rather than colors are to be used - * @param bool $plaintext Do not format code outside PHP tags - */ - function PHP_Highlight($inline = false) - { - // Inline - if ($inline === false) { - // Default colours from php.ini - /** - $this->highlight = array( - 'string' => ini_get('highlight.string'), - 'comment' => ini_get('highlight.comment'), - 'keyword' => ini_get('highlight.keyword'), - 'bg' => ini_get('highlight.bg'), - 'default' => ini_get('highlight.default'), - 'html' => ini_get('highlight.html') - ); - */ - $this->highlight = array( - 'string' => "#cb0864", - 'comment' => "#888888", - 'keyword' => "#118994", - 'bg' => "#222222", - 'default' => "#000000", - 'html' => ini_get('highlight.html') - ); - $this->span = '%s'; - } else { - // Basic styles - $this->highlight = array( - 'string' => 'string', - 'comment' => 'comment', - 'keyword' => 'keyword', - 'bg' => 'bg', - 'default' => 'default', - 'html' => 'html' - ); - $this->span = '%s'; - } - } - - - /** - * Load a file - * - * @access public - * @param string $file The file to load - * @return bool Returns TRUE - */ - function loadFile($file) - { - $this->_source = file_get_contents($file); - return true; - } - - - /** - * Load a string - * - * @access public - * @param string $string The string to load - * @return bool Returns TRUE - */ - function loadString($string) - { - $this->_source = $string; - return true; - } - - - /** - * Parse the loaded string into an array - * Source is returned with the element key corresponding to the line number - * - * @access public - * @param bool $funcref Reference functions to the PHP manual - * @param bool $blocks Whether to ignore processing plaintext - * @return array An array of highlighted source code - */ - function toArray($funcref = true, $blocks = false) - { - // Ensure source has been loaded - if ($this->_source == false) { - return false; - } - - // Init - $tokens = token_get_all($this->_source); - $manual = $this->manual; - $span = $this->span; - $i = 0; - $out = array(); - $out[$i] = ''; - - // Loop through each token - foreach ($tokens as $j => $token) { - // Single char - if (is_string($token)) { - // Skip token2color check for speed - $out[$i] .= sprintf($span, $this->highlight['keyword'], htmlspecialchars($token)); - - // Heredocs behave strangely - list($tb) = isset($tokens[$j - 1]) ? $tokens[$j - 1] : false; - if ($tb === T_END_HEREDOC) { - $out[++$i] = ''; - } - - continue; - } - - // Proper token - list ($token, $value) = $token; - - // Make the value safe - $value = htmlspecialchars($value); - $value = str_replace($this->replace[0], $this->replace[1], $value); - - // Process - if ($value === "\n") { - // End this line and start the next - $out[++$i] = ''; - } else { - // Function linking - if ($funcref === true && $token === T_STRING) { - // Look ahead 1, look ahead 2, and look behind 3 - if ((isset($tokens[$j + 1]) && $tokens[$j + 1] === '(' || - isset($tokens[$j + 2]) && $tokens[$j + 2] === '(') && - isset($tokens[$j - 3][0]) && $tokens[$j - 3][0] !== T_FUNCTION - && function_exists($value)) { - - // Insert the manual link - $value = sprintf($manual, $value, $value); - } - } - - // Explode token block - $lines = explode("\n", $value); - foreach ($lines as $jj => $line) { - $line = trim($line); - if ($line !== '') { - // This next line is helpful for debugging - //$out[$i] .= token_name($token); - - // Check for plaintext - if ($blocks === true && $token === T_INLINE_HTML) { - $this->_plaintextkeys[] = $i; - $out[$i] .= $line; - } else { - $out[$i] .= sprintf($span, $this->_token2color($token), $line); - } - } - - - // Start a new line - if (isset($lines[$jj + 1])) { - $out[++$i] = ''; - } - } - } - } - - return $out; - } - - - /** - * Convert the source to an ordered list. - * Each line is wrapped in
  • tags. - * - * @access public - * @param bool $return Return rather than print the results - * @param bool $funcref Reference functions to the PHP manual - * @param bool $blocks Whether to use code blocks around plaintext - * @return string A HTML ordered list - */ - function toList($return = false, $funcref = true, $blocks = true) - { - // Ensure source has been loaded - if ($this->_source == false) { - return false; - } - - // Format list - $source = $this->toArray($funcref, $blocks); - $out = "
      \n"; - foreach ($source as $i => $line) { - $out .= "
    1. "; - - // Some extra juggling for lines which are not code - if (empty($line)) { - $out .= ' '; - } elseif ($blocks === true && in_array($i, $this->_plaintextkeys)) { - $out .= $line; - } else { - $out .= "$line"; - } - - $out .= "
    2. \n"; - } - $out .= "
    \n"; - - if ($return === true) { - return $out; - } else { - echo $out; - } - } - - - /** - * Convert the source to formatted HTML. - * Each line ends with
    . - * - * @access public - * @param bool $return Return rather than print the results - * @param bool $linenum Display line numbers - * @param string $format Specify format of line numbers displayed - * @param bool $funcref Reference functions to the PHP manual - * @return string A HTML block of code - */ - function toHtml($return = false, $linenum = false, $format = null, $funcref = true) - { - // Ensure source has been loaded - if ($this->_source == false) { - return false; - } - - // Line numbering - if ($linenum === true && $format === null) { - $format = '%02d '; - } - - // Format code - $source = $this->toArray($funcref); - $out = "
    ";
    -        foreach ($source as $i => $line) {
    -            if ($linenum === true) {
    -                $out .= sprintf($format, $i);
    -            }
    - 
    -            $out .= $line;
    -            $out .= "\n";
    -        }
    -        $out .= "
    \n"; - - if ($return === true) { - return $out; - } else { - echo $out; - } - } - - - /** - * Convert the source to formatted HTML blocks. - * Each line ends with
    . - * - * This method ensures only PHP is between blocks. - * - * @access public - * @param bool $return Return rather than print the results - * @param bool $linenum Display line numbers - * @param string $format Specify format of line numbers displayed - * @param bool $reset Reset the line numbering each block - * @param bool $funcref Reference functions to the PHP manual - * @return string A HTML block of code - */ - function toHtmlBlocks($return = false, $linenum = false, $format = null, $reset = true, $funcref = true) - { - // Ensure source has been loaded - if ($this->_source == false) { - return false; - } - - // Default line numbering - if ($linenum === true && $format === null) { - $format = '%03d '; - } - - // Init - $source = $this->toArray($funcref, true); - $out = ''; - $wasplain = true; - $k = 0; - - // Loop through each line and decide which block to use - foreach ($source as $i => $line) { - // Empty line - if (empty($line)) { - if ($wasplain === true) { - $out .= ' '; - } else { - if (in_array($i+1, $this->_plaintextkeys)) { - $out .= "\n"; - - // Reset line numbers - if ($reset === true) { - $k = 0; - } - } else { - $out .= ' '; - // Add line number - if ($linenum === true) { - $out .= sprintf($format, ++$k); - } - } - } - - // Plain text - } elseif (in_array($i, $this->_plaintextkeys)) { - if ($wasplain === false) { - $out .= "\n"; - - // Reset line numbers - if ($reset === true) { - $k = 0; - } - } - - $wasplain = true; - $out .= str_replace(' ', ' ', $line); - - // Code - } else { - if ($wasplain === true) { - $out .= "\n"; - } - $wasplain = false; - - $out .= ' '; - // Add line number - if ($linenum === true) { - $out .= sprintf($format, ++$k); - } - $out .= $line; - } - - $out .= "
    \n"; - } - - // Add final code tag - if ($wasplain === false) { - $out .= "
    \n"; - } - - // Output method - if ($return === true) { - return $out; - } else { - echo $out; - } - } - - - /** - * Assign a color based on the name of a token - * - * @access private - * @param int $token The token - * @return string The color of the token - */ - function _token2color($token) - { - - switch ($token): - case T_CONSTANT_ENCAPSED_STRING: - return $this->highlight['string']; - break; - - case T_INLINE_HTML: - return $this->highlight['html']; - break; - - case T_COMMENT: - case T_DOC_COMMENT: - //case T_ML_COMMENT: - return $this->highlight['comment']; - break; - - case T_ABSTRACT: - case T_ARRAY: - case T_ARRAY_CAST: - case T_AS: - case T_BOOLEAN_AND: - case T_BOOLEAN_OR: - case T_BOOL_CAST: - case T_BREAK: - case T_CASE: - case T_CATCH: - case T_CLASS: - case T_CLONE: - case T_CONCAT_EQUAL: - case T_CONTINUE: - case T_DEFAULT: - case T_DOUBLE_ARROW: - case T_DOUBLE_CAST: - case T_ECHO: - case T_ELSE: - case T_ELSEIF: - case T_EMPTY: - case T_ENDDECLARE: - case T_ENDFOR: - case T_ENDFOREACH: - case T_ENDIF: - case T_ENDSWITCH: - case T_ENDWHILE: - case T_END_HEREDOC: - case T_EXIT: - case T_EXTENDS: - case T_FINAL: - case T_FOREACH: - case T_FUNCTION: - case T_GLOBAL: - case T_IF: - case T_INC: - case T_INCLUDE: - case T_INCLUDE_ONCE: - case T_INSTANCEOF: - case T_INT_CAST: - case T_ISSET: - case T_IS_EQUAL: - case T_IS_IDENTICAL: - case T_IS_NOT_IDENTICAL: - case T_IS_SMALLER_OR_EQUAL: - case T_NEW: - case T_OBJECT_CAST: - case T_OBJECT_OPERATOR: - case T_PAAMAYIM_NEKUDOTAYIM: - case T_PRIVATE: - case T_PROTECTED: - case T_PUBLIC: - case T_REQUIRE: - case T_REQUIRE_ONCE: - case T_RETURN: - case T_SL: - case T_SL_EQUAL: - case T_SR: - case T_SR_EQUAL: - case T_START_HEREDOC: - case T_STATIC: - case T_STRING_CAST: - case T_THROW: - case T_TRY: - case T_UNSET_CAST: - case T_VAR: - case T_WHILE: - return $this->highlight['keyword']; - break; - - case T_CLOSE_TAG: - case T_OPEN_TAG: - case T_OPEN_TAG_WITH_ECHO: - default: - return $this->highlight['default']; - - endswitch; - } - -} - -?> diff --git a/manual/scripts/mootools.v1.11.js b/manual/scripts/mootools.v1.11.js deleted file mode 100644 index 136aa9ab7..000000000 --- a/manual/scripts/mootools.v1.11.js +++ /dev/null @@ -1,3 +0,0 @@ -//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006 Valerio Proietti, , MIT Style License. - -eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if( ! ''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('m 7X={7Y:\'1.11\'};h $3q(R){c(R!=6N)};h $q(R){k( ! $3q(R))c P;k(R.2R)c\'W\';m q=3Q R;k(q==\'2a\'&&R.7W){1C(R.4Z){Q 1:c\'W\';Q 3:c(/\\S/).2e(R.6u)?\'7V\':\'7T\'}}k(q==\'2a\'||q==\'h\'){1C(R.5u){Q 1r:c\'15\';Q 4F:c\'53\';Q 1f:c\'4o\'}k(3Q R.H==\'3U\'){k(R.1V)c\'7U\';k(R.6o)c\'M\'}}c q};h $21(){m 3h={};G(m i=0;i-1:7.2B(23)>-1},7m:h(){c 7.2q(/([.*+?^${}()|[\\]\\/\\\\])/g,\'\\\\$1\')}});1r.N({3A:h(15){k(7.H<3)c P;k(7.H==4&&7[3]==0&&!15)c\'88\';m 2G=[];G(m i=0;i<3;i++){m 2W=(7[i]-0).8u(16);2G.14((2W.H==1)?\'0\'+2W:2W)}c 15?2G:\'#\'+2G.1W(\'\')},4b:h(15){k(7.H!=3)c P;m 1Q=[];G(m i=0;i<3;i++){1Q.14(36((7[i].H==1)?7[i]+7[i]:7[i],16))}c 15?1Q:\'1Q(\'+1Q.1W(\',\')+\')\'}});4q.N({1M:h(u){m B=7;u=$21({\'J\':B,\'r\':P,\'M\':1d,\'1v\':P,\'2x\':P,\'3s\':P},u);k($33(u.M)&&$q(u.M)!=\'15\')u.M=[u.M];c h(r){m U;k(u.r){r=r||C.r;U=[(u.r===12)?r:V u.r(r)];k(u.M)U.N(u.M)}T U=u.M||M;m 25=h(){c B.2O($49(u.J,B),U)};k(u.1v)c 8t(25,u.1v);k(u.2x)c 8s(25,u.2x);k(u.3s)4U{c 25()}4T(8q){c P};c 25()}},8r:h(U,J){c 7.1M({\'M\':U,\'J\':J})},3s:h(U,J){c 7.1M({\'M\':U,\'J\':J,\'3s\':12})()},J:h(J,U){c 7.1M({\'J\':J,\'M\':U})},8w:h(J,U){c 7.1M({\'J\':J,\'r\':12,\'M\':U})},1v:h(1v,J,U){c 7.1M({\'1v\':1v,\'J\':J,\'M\':U})()},2x:h(7l,J,U){c 7.1M({\'2x\':7l,\'J\':J,\'M\':U})()}});7c.N({3p:h(){c 36(7)},72:h(){c 4G(7)},6Q:h(2y,1L){c 1z.2y(1L,1z.1L(2y,7))},4W:h(3e){3e=1z.8x(10,3e||0);c 1z.4W(7*3e)/3e},8D:h(B){G(m i=0;i<7;i++)B(i)}});m v=V 1f({1O:h(o,1e){k($q(o)==\'23\'){k(C.1I&&1e&&(1e.1q||1e.q)){m 1q=(1e.1q)?\' 1q="\'+1e.1q+\'"\':\'\';m q=(1e.q)?\' q="\'+1e.q+\'"\':\'\';4S 1e.1q;4S 1e.q;o=\'<\'+o+1q+q+\'>\'}o=F.7a(o)}o=$(o);c( ! 1e||!o)?o:o.2r(1e)}});m 1m=V 1f({1O:h(I){c(I)?$N(I,7):7}});1m.N=h(1e){G(m 1j 1g 1e){7.1c[1j]=1e[1j];7[1j]=$2P.3w(1j)}};h $(o){k( ! o)c 1d;k(o.2R)c 1s.2U(o);k([C,F].Y(o))c o;m q=$q(o);k(q==\'23\'){o=F.3m(o);q=(o)?\'W\':P}k(q!=\'W\')c 1d;k(o.2R)c 1s.2U(o);k([\'2a\',\'8B\'].Y(o.3l.3L()))c o;$N(o,v.1c);o.2R=h(){};c 1s.2U(o)};F.3k=F.2n;h $$(){m I=[];G(m i=0,j=M.H;i0&&3D<13)7.1h=\'f\'+3D}7.1h=7.1h||4L.ak(7.3M).3L()}T k(7.q.2e(/(5p|aj|ah)/)){7.ai={\'x\':r.4X||r.5S+F.1F.3d,\'y\':r.4Y||r.5T+F.1F.3f};7.9Q={\'x\':r.4X?r.4X-C.5F:r.5S,\'y\':r.4Y?r.4Y-C.6i:r.5T};7.9D=(r.5N==3)||(r.90==2);1C(7.q){Q\'4d\':7.1n=r.1n||r.9E;1i;Q\'4a\':7.1n=r.1n||r.5k}7.73()}c 7},1U:h(){c 7.3N().3O()},3N:h(){k(7.r.3N)7.r.3N();T 7.r.8Z=12;c 7},3O:h(){k(7.r.3O)7.r.3O();T 7.r.8Y=P;c 7}});1E.3o={1n:h(){k(7.1n&&7.1n.4Z==3)7.1n=7.1n.1Y},70:h(){4U{1E.3o.1n.1H(7)}4T(e){7.1n=7.1Z}}};1E.1c.73=(C.52)?1E.3o.70:1E.3o.1n;1E.1k=V 2s({\'93\':13,\'97\':38,\'95\':40,\'2l\':37,\'5i\':39,\'8L\':27,\'8G\':32,\'8M\':8,\'8S\':9,\'4S\':46});v.1P.1T={1G:h(q,B){7.$K=7.$K||{};7.$K[q]=7.$K[q]||{\'1k\':[],\'1o\':[]};k(7.$K[q].1k.Y(B))c 7;7.$K[q].1k.14(B);m 3P=q;m 1p=v.1T[q];k(1p){k(1p.5l)1p.5l.1H(7,B);k(1p.2c)B=1p.2c;k(1p.q)3P=1p.q}k( ! 7.4R)B=B.1M({\'J\':7,\'r\':12});7.$K[q].1o.14(B);c(v.4h.Y(3P))?7.2E(3P,B):7},3V:h(q,B){k( ! 7.$K||!7.$K[q])c 7;m 3R=7.$K[q].1k.2B(B);k(3R==-1)c 7;m 1h=7.$K[q].1k.3K(3R,1)[0];m O=7.$K[q].1o.3K(3R,1)[0];m 1p=v.1T[q];k(1p){k(1p.2F)1p.2F.1H(7,B);k(1p.q)q=1p.q}c(v.4h.Y(q))?7.6X(q,O):7},51:h(2g){c v.3J(7,\'1G\',2g)},3F:h(q){k( ! 7.$K)c 7;k( ! q){G(m 3G 1g 7.$K)7.3F(3G);7.$K=1d}T k(7.$K[q]){7.$K[q].1k.1t(h(B){7.3V(q,B)},7);7.$K[q]=1d}c 7},26:h(q,U,1v){k(7.$K&&7.$K[q]){7.$K[q].1k.1t(h(B){B.1M({\'J\':7,\'1v\':1v,\'M\':U})()},7)}c 7},6H:h(19,q){k( ! 19.$K)c 7;k( ! q){G(m 3G 1g 19.$K)7.6H(19,3G)}T k(19.$K[q]){19.$K[q].1k.1t(h(B){7.1G(q,B)},7)}c 7}};C.N(v.1P.1T);F.N(v.1P.1T);v.N(v.1P.1T);v.1T=V 2s({\'6v\':{q:\'4d\',2c:h(r){r=V 1E(r);k(r.1n!=7&&!7.4i(r.1n))7.26(\'6v\',r)}},\'6x\':{q:\'4a\',2c:h(r){r=V 1E(r);k(r.1n!=7&&!7.4i(r.1n))7.26(\'6x\',r)}},\'2S\':{q:(C.52)?\'4e\':\'2S\'}});v.4h=[\'5p\',\'9v\',\'9t\',\'9r\',\'2S\',\'4e\',\'4d\',\'4a\',\'9w\',\'6V\',\'9x\',\'9B\',\'6D\',\'4f\',\'6L\',\'9A\',\'9y\',\'9z\',\'9p\',\'5J\',\'9o\',\'9f\',\'9g\',\'9e\',\'9d\',\'9b\',\'2M\'];4q.N({6s:h(J,U){c 7.1M({\'J\':J,\'M\':U,\'r\':1E})}});1m.N({9c:h(1R){c V 1m(7.1X(h(o){c(v.2Y(o)==1R)}))},6P:h(17,1w){m I=7.1X(h(o){c(o.17&&o.17.Y(17,\' \'))});c(1w)?I:V 1m(I)},6O:h(2u,1w){m I=7.1X(h(o){c(o.2u==2u)});c(1w)?I:V 1m(I)},6M:h(1q,4l,O,1w){m I=7.1X(h(o){m 1l=v.3I(o,1q);k( ! 1l)c P;k( ! 4l)c 12;1C(4l){Q\'=\':c(1l==O);Q\'*=\':c(1l.Y(O));Q\'^=\':c(1l.4u(0,O.H)==O);Q\'$=\':c(1l.4u(1l.H-O.H)==O);Q\'!=\':c(1l!=O);Q\'~=\':c 1l.Y(O,\' \')}c P});c(1w)?I:V 1m(I)}});h $E(1b,1X){c($(1X)||F).5R(1b)};h $9i(1b,1X){c($(1X)||F).3k(1b)};$$.20={\'53\':/^(\\w*|\\*)(?:#([\\w-]+)|\\.([\\w-]+))?(?:\\[(\\w+)(?:([!*^$]?=)["\']?([^"\'\\]]*)["\']?)?])?$/,\'2h\':{5o:h(X,1N,L,i){m 1y=[1N.9m?\'5a:\':\'\',L[1]];k(L[2])1y.14(\'[@2u="\',L[2],\'"]\');k(L[3])1y.14(\'[Y(5c(" ", @4o, " "), " \',L[3],\' ")]\');k(L[4]){k(L[5]&&L[6]){1C(L[5]){Q\'*=\':1y.14(\'[Y(@\',L[4],\', "\',L[6],\'")]\');1i;Q\'^=\':1y.14(\'[9l-9j(@\',L[4],\', "\',L[6],\'")]\');1i;Q\'$=\':1y.14(\'[9k(@\',L[4],\', 23-H(@\',L[4],\') - \',L[6].H,\' + 1) = "\',L[6],\'"]\');1i;Q\'=\':1y.14(\'[@\',L[4],\'="\',L[6],\'"]\');1i;Q\'!=\':1y.14(\'[@\',L[4],\'!="\',L[6],\'"]\')}}T{1y.14(\'[@\',L[4],\']\')}}X.14(1y.1W(\'\'));c X},55:h(X,1N,1w){m I=[];m 2h=F.6l(\'.//\'+X.1W(\'//\'),1N,$$.20.6S,91.9n,1d);G(m i=0,j=2h.9h;i<\\/2Q>\');$(\'54\').8K=h(){k(7.3W==\'7j\')31()}}}T{C.2E("6D",31);F.2E("8I",31)}}};C.8H=h(B){c 7.1G(\'5n\',B)};C.N({76:h(){k(7.3S)c 7.9s;k(7.5B)c F.45.6G;c F.1F.6G},7k:h(){k(7.3S)c 7.9C;k(7.5B)c F.45.6q;c F.1F.6q},7d:h(){k(7.1I)c 1z.1L(F.1F.5s,F.1F.47);k(7.2C)c F.45.47;c F.1F.47},6C:h(){k(7.1I)c 1z.1L(F.1F.4m,F.1F.48);k(7.2C)c F.45.48;c F.1F.48},6w:h(){c 7.5F||F.1F.3d},6A:h(){c 7.6i||F.1F.3f},4s:h(){c{\'2A\':{\'x\':7.76(),\'y\':7.7k()},\'4k\':{\'x\':7.7d(),\'y\':7.6C()},\'2M\':{\'x\':7.6w(),\'y\':7.6A()}}},2z:h(){c{\'x\':0,\'y\':0}}});m 2H={};2H.4z=V 1f({u:{4J:1f.2j,42:1f.2j,6k:1f.2j,7f:h(p){c-(1z.9u(1z.9a*p)-1)/2},2m:99,8P:\'4t\',4Q:12,5x:50},1O:h(u){7.W=7.W||1d;7.7h(u);k(7.u.1O)7.u.1O.1H(7)},5v:h(){m 28=$28();k(28<7.28+7.u.2m){7.6t=7.u.7f((28-7.28)/7.u.2m);7.4P();7.5r()}T{7.1U(12);7.2r(7.1A);7.26(\'42\',7.W,10);7.7n()}},2r:h(1A){7.2T=1A;7.5r();c 7},4P:h(){7.2T=7.4x(7.19,7.1A)},4x:h(19,1A){c(1A-19)*7.6t+19},1u:h(19,1A){k( ! 7.u.4Q)7.1U();T k(7.1K)c 7;7.19=19;7.1A=1A;7.5J=7.1A-7.19;7.28=$28();7.1K=7.5v.2x(1z.4W(7i/7.u.5x),7);7.26(\'4J\',7.W);c 7},1U:h(44){k( ! 7.1K)c 7;7.1K=$4C(7.1K);k( ! 44)7.26(\'6k\',7.W);c 7},1p:h(19,1A){c 7.1u(19,1A)},au:h(44){c 7.1U(44)}});2H.4z.6r(V 6p,V 1T,V 6n);2H.6W=2H.4z.N({u:{1x:[],5g:{\'x\':0,\'y\':0},69:12},1O:h(W,u){7.2T=[];7.W=$(W);7.4B={\'1U\':7.1U.J(7,P)};7.1B(u);k(7.u.69){7.1G(\'4J\',h(){F.1G(\'2S\',7.4B.1U)}.J(7));7.1G(\'42\',h(){F.3V(\'2S\',7.4B.1U)}.J(7))}},4P:h(){G(m i=0;i<2;i++)7.2T[i]=7.4x(7.19[i],7.1A[i])},2k:h(x,y){k(7.1K&&7.u.4Q)c 7;m o=7.W.4s();m 1o={\'x\':x,\'y\':y};G(m z 1g o.2A){m 1L=o.4k[z]-o.2A[z];k($33(1o[z]))1o[z]=($q(1o[z])==\'3U\')?1o[z].6Q(0,1L):1L;T 1o[z]=o.2M[z];1o[z]+=7.u.5g[z]}c 7.1u([o.2M.x,o.2M.y],[1o.x,1o.y])},ad:h(){c 7.2k(P,0)},8A:h(){c 7.2k(P,\'5Q\')},7z:h(){c 7.2k(0,P)},7w:h(){c 7.2k(\'5Q\',P)},5k:h(o){m 1B=7.W.2z(7.u.1x);m 1Z=$(o).2z(7.u.1x);c 7.2k(1Z.x-1B.x,1Z.y-1B.y)},5r:h(){7.W.2k(7.2T[0],7.2T[1])}});m 7q=V 2s({u:{43:P,3Z:P,2m:P,4N:P},2r:h(1h,O,u){u=$21(7.u,u);O=8E(O);k(u.43)O+=\'; 43=\'+u.43;k(u.3Z)O+=\'; 3Z=\'+u.3Z;k(u.2m){m 3X=V 5P();3X.8o(3X.5H()+u.2m*24*60*60*7i);O+=\'; 8z=\'+3X.8y()}k(u.4N)O+=\'; 4N\';F.2v=1h+\'=\'+O;c $N(u,{\'1h\':1h,\'O\':O})},8C:h(1h){m O=F.2v.1D(\'(?:^|;)\\\\s*\'+1h.7m()+\'=([^;]*)\');c O?8v(O[1]):P},2F:h(2v,u){k($q(2v)==\'2a\')7.2r(2v.1h,\'\',$21(2v,{2m:-1}));T 7.2r(2v,\'\',$21(u,{2m:-1}))}});m 87=2H.6W.N({1O:h(u){7.1B(C,u);7.2X=(7.u.2X)?$$(7.u.2X):$$(F.2X);m 2K=C.2K.41.1D(/^[^#]*/)[0]+\'#\';7.2X.1t(h(2L){k(2L.41.2B(2K)!=0)c;m 2b=2L.41.4u(2K.H);k(2b&&$(2b))7.77(2L,2b)},7);k( ! C.3S)7.1G(\'42\',h(){C.2K.7O=7.2b})},77:h(2L,2b){2L.1G(\'5p\',h(r){7.2b=2b;7.5k(2b);r.1U()}.6s(7))}});',62,658,'|||||||this|||||return|||||function|||if||var||el||type|event||property|options|Element||||||fn|window|||document|for|length|elements|bind|events|param|arguments|extend|value|false|case|obj||else|args|new|element|items|contains||||true||push|array||className|result|from|style|selector|prototype|null|props|Class|in|key|break|prop|keys|current|Elements|relatedTarget|values|custom|name|Array|Garbage|each|start|delay|nocash|overflown|temp|Math|to|parent|switch|match|Event|documentElement|addEvent|call|ie|opacity|timer|max|create|context|initialize|Methods|rgb|tag|properties|Events|stop|item|join|filter|parentNode|target|shared|merge|text|string||returns|fireEvent||time|index|object|anchor|map|top|test|iterable|source|xpath|tmp|empty|scrollTo|left|duration|getElementsByTagName|previous|border|replace|set|Abstract|chains|id|cookie|method|periodical|min|getPosition|size|indexOf|webkit|getStyle|addListener|remove|hex|Fx|results|len|location|link|scroll|Styles|apply|native|script|htmlElement|mousewheel|now|collect|inject|bit|links|getTag|walk|next|domReady||chk|width|val|parseInt||||klass|unique|option|scrollLeft|precision|scrollTop|HTMLElement|mix|proto|mp|getElementsBySelector|tagName|getElementById|getElements|fix|toInt|defined|included|attempt|Listeners|Properties|setProperty|generic|every|visibility|currentStyle|rgbToHex|brother|trash|fKey|regex|removeEvents|evType|forEach|getProperty|setMany|splice|toLowerCase|code|stopPropagation|preventDefault|realType|typeof|pos|webkit419|loaded|number|removeEvent|readyState|date|src|path||href|onComplete|domain|end|body||scrollWidth|scrollHeight|pick|mouseout|hexToRgb|innerText|mouseover|DOMMouseScroll|unload|charAt|NativeEvents|hasChild|cssText|scrollSize|operator|offsetHeight|merged|class|camelCase|Function|include|getSize|px|substr|newArray|random|compute|getMany|Base|appendChild|bound|clear|default|on|RegExp|parseFloat|pairs|hasClass|onStart|clean|String|first|secure|padding|setNow|wait|addEventListener|delete|catch|try|insertBefore|round|pageX|pageY|nodeType||addEvents|gecko|regexp|ie_ready|getItems|split|trim|found|node|xhtml|flag|concat|color|position|Dom|offset|while|right|bottom|toElement|add|height|domready|getParam|click|firstChild|increase|offsetWidth|picked|constructor|step|Bottom|fps|before|appendText|direction|opera|wheelDelta|Left|after|pageXOffset|where|getTime|Top|change|Multi|elementsProperty|styleSheet|which|Right|Date|full|getElement|clientX|clientY|childNodes|argument|borderShort|checked|disabled|multiple||selected|getLast|PropertiesIFlag|Merge|removeClass|setOpacity|setStyles|hidden|wheelStops|addClass|getNext|removeEventListener|pp|extended|visible|shift|contents|pageYOffset|zoom|onCancel|evaluate|continue|Options|callee|Chain|clientHeight|implement|bindWithEvent|delta|nodeValue|mouseenter|getScrollLeft|mouseleave|toUpperCase|setStyle|getScrollTop|slice|getScrollHeight|load|hyphenate|ie6|clientWidth|cloneEvents|defaultView|params|setProperties|beforeunload|filterByAttribute|undefined|filterById|filterByClass|limit|copy|resolver|prefix|innerHTML|keydown|Scroll|removeListener|textContent|setHTML|relatedTargetGecko|capitalize|toFloat|fixRelatedTarget|head|Width|getWidth|useLink|sel|0px|createElement|margin|Number|getScrollWidth|fixStyle|transition|removeChild|setOptions|1000|complete|getHeight|interval|escapeRegExp|callChain|normal|Style|Cookie|Sibling|alpha|100|hasLayout|getPropertyValue|toRight|getComputedStyle|Color|toLeft|getStyles|boolean|Object|iframe|DOMElement|khtml|getBoxObjectFor|taintEnabled|webkit420|execCommand|BackgroundImageCache|associate|getRandom|some|hash|chain|clearChain|navigator|all|whitespace|collection|textnode|nodeName|MooTools|version|floor|clearTimeout|XMLHttpRequest|ie7|ActiveXObject|Document|clearInterval|Window|SmoothScroll|transparent|adopt|clone|cloneNode|injectTop|injectInside|injectBefore|injectAfter|replaceWith|replaceChild|cssFloat|zIndex|styleFloat|float|createTextNode|toggleClass|setTime|styles|err|pass|setInterval|setTimeout|toString|decodeURIComponent|bindAsEventListener|pow|toGMTString|expires|toBottom|embed|get|times|encodeURIComponent|colSpan|space|onDomReady|DOMContentLoaded|getPrevious|onreadystatechange|esc|backspace|1999|http|unit|www|w3|tab|org|defer|write|do|getElementsByClassName|returnValue|cancelBubble|button|XPathResult|protocol|enter|void|down|javascript|up|https|500|PI|contextmenu|filterByTag|abort|error|reset|select|snapshotLength|ES|with|substring|starts|namespaceURI|UNORDERED_NODE_SNAPSHOT_TYPE|submit|blur|snapshotItem|mousedown|innerWidth|mouseup|cos|dblclick|mousemove|keypress|move|focus|resize|keyup|innerHeight|rightClick|fromElement|lastChild|accesskey|getParent|rowSpan|rowspan|getChildren|accessKey|getLeft|maxlength|maxLength|tabIndex|client|tabindex|getCoordinates|colspan|attributes|setText|setAttribute|getProperties|removeAttribute|getTop|getText|offsetParent|borderColor|htmlFor|borderStyle|borderWidth|getAttribute|readonly|readOnly|detail|keyCode|120|wheel|toTop|metaKey|getFirst|111|menu|page|mouse|fromCharCode|offsetLeft|meta|altKey|detachEvent||offsetTop|attachEvent|frameBorder|frameborder|clearTimer|CollectGarbage|ctrlKey|alt|control|shiftKey|srcElement|removeProperty'.split('|'),0,{})) diff --git a/manual/scripts/toc.js b/manual/scripts/toc.js deleted file mode 100644 index 5c8eeb969..000000000 --- a/manual/scripts/toc.js +++ /dev/null @@ -1,71 +0,0 @@ -function initializeTocToggles() -{ - var container = new Element('div', { - 'id': 'toc-toggles' - }); - - container.injectTop($('table-of-contents')); - $('table-of-contents').setStyle('padding-top', '0'); - - var hideToggle = new Element('a', { - 'href': 'javascript:void(0);', - 'events': { - 'click': function() { - var toc = $E('ul', 'table-of-contents'); - - if (toc.getStyle('display') == 'none') { - this.setHTML(tocHideText); - toc.setStyle('display', 'block'); - stickyToggle.setStyle('display', 'inline'); - Cookie.set('hidetoc', 0, {duration: 1000}); - } else { - this.setHTML(tocShowText); - toc.setStyle('display', 'none'); - stickyToggle.setStyle('display', 'none'); - Cookie.set('hidetoc', 1, {duration: 1000}); - } - } - } - }); - - var stickyToggle = new Element('a', { - 'href': 'javascript:void(0);', - 'events': { - 'click': function() { - var wrap = $('wrap'); - - if ( ! wrap.hasClass('sticky-toc')) { - this.setHTML(tocUnstickyText); - wrap.addClass('sticky-toc'); - hideToggle.setStyle('display', 'none'); - Cookie.set('stickytoc', 1, {duration: 1000}); - } else { - this.setHTML(tocStickyText); - wrap.removeClass('sticky-toc'); - hideToggle.setStyle('display', 'inline'); - Cookie.set('stickytoc', 0, {duration: 1000}); - } - } - } - }); - - hideToggle.setHTML(tocHideText); - hideToggle.injectInside(container); - - stickyToggle.setHTML(tocStickyText); - stickyToggle.injectInside(container); - - if (Cookie.get('hidetoc') == 1) { - hideToggle.fireEvent('click'); - stickyToggle.setStyle('display', 'none'); - } - - if (Cookie.get('stickytoc') == 1) { - stickyToggle.fireEvent('click'); - hideToggle.setStyle('display', 'none'); - } -} - -window.addEvent('domready', function() { - initializeTocToggles(); -}); diff --git a/manual/scripts/tree.js b/manual/scripts/tree.js deleted file mode 100644 index a98fd6e6b..000000000 --- a/manual/scripts/tree.js +++ /dev/null @@ -1,33 +0,0 @@ -function initializeTrees(symbolClosed, symbolOpen) -{ - $$('ul.tree li').each(function(listItem) { - - var subTree = listItem.getChildren().filterByTag('ul')[0]; - - if (subTree) { - - var expander = new Element('a', { - 'class': 'expander', - 'href': 'javascript:void(0);', - 'events': { - 'click': function() { - if (subTree.hasClass('closed')) { - subTree.removeClass('closed'); - this.setHTML(symbolOpen); - } else { - subTree.addClass('closed'); - this.setHTML(symbolClosed); - } - } - } - }); - - expander.setHTML(subTree.hasClass('closed') ? symbolClosed : symbolOpen); - expander.injectTop(listItem); - } - }); -} - -window.addEvent('domready', function() { - initializeTrees('+', '-'); -}); diff --git a/manual/styles/basic.css b/manual/styles/basic.css deleted file mode 100644 index cd2e1f9f1..000000000 --- a/manual/styles/basic.css +++ /dev/null @@ -1,283 +0,0 @@ -body, html { - margin: 0; - padding: 0; - font-family: "Bitstream Vera Sans", "Verdana", sans-serif; - font-size: medium; - background: white; - color: black; -} - -h1, h2, h3, h4, h5, h6 { - font-family: "Nimbus Sans L", "Arial", sans-serif; - border-bottom: 1px solid #aaaaaa; - line-height: 1.5em; - padding-bottom: 0.1em; -} - -h1 { - font-size: 2em; - margin-bottom: 1em; - margin-top: 0; -} - -h2 { - font-size: 1.5em; - text-align: left; - margin: 0.67em 0; -} - -h3 { - font-size: 1.17em; - margin: 1em 0; -} - -h4 { - font-size: 1em; - margin: 1.33em 0; -} - -.chapter + .chapter { - margin-top: 3em; -} - -p, ul, ol, dl { - line-height: 1.5em; - text-align: justify; - font-size: small; -} - -p.caption { - font-style: italic; -} - -dd { - margin-bottom: 0.5em; -} - -table { - border: 1px solid #aaaaaa; - border-collapse: collapse; - margin: 0.5em 0; - color: black; - background-color: #f9f9f9; - line-height: 1.5em; - font-size: small; -} - -td, th { - padding: 0.2em; - border: 1px solid #aaaaaa; -} - -th { - color: black; - background-color: #f2f2f2; -} - -*:link, *:visited { - color: #bb0000; - background-color: inherit; - text-decoration: none; - border-bottom: 1px dotted #bbbbbb; -} - -*:visited { - color: #660000; -} - -*:link:hover, *:visited:hover { - color: #555555; - background-color: #eeeeee; - text-decoration: none; -} - -h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { - text-decoration: none !important; - color: black !important; - border-bottom: none !important; - background-color: white !important; -} - - -/*** Code blocks and highlighting**********************************************/ - -pre, code, tt { - font-family: "Bitstream Vera Sans Mono", "Courier New" monospace; - font-size: small; -} - -pre { - font-weight: bold; - padding: 1em; - margin: 1em 0; - line-height: 1.2em; - color: black; - background-color: #f7f7f7; - border: 1px solid #d7d7d7; - - /* Pup's Box Flow Hack, Rev 2 */ - overflow/**/: auto; - \height: 1%; -} - -/* This rule applies only to Firefox */ -pre, x:-moz-any-link { - /* overflow: auto causes artefacts */ - overflow: hidden; - - /* prevents text to be hidden by wrapping it */ - white-space: -moz-pre-wrap !important; -} - -pre .default { - color: #000000; - font-weight: bold; - background-color: inherit; -} - -pre .keyword { - color: #778899; - font-weight: bold; - background-color: inherit; -} - -pre .string { - color: #bb8844; - font-weight: normal; - background-color: inherit; -} - -pre .comment { - color: #999988; - font-style: italic; - font-weight: bold; - background-color: inherit; -} - -/** Page layout ***************************************************************/ - -#sidebar { - float: right; - margin: 1em; - padding: 0; -} - -#wrap { - margin: 0; - padding: 0; -} - -#content { - padding: 1em; -} - -/** Tree specific styles ******************************************************/ - -ul.tree, ul.tree ul { - list-style-type: none; - padding-left: 2em; - text-align: left; - margin: 0; - font-size: 1em; -} - -ul.tree { - margin-top: 1em; -} - -.tree a { - text-decoration: none; - margin: 0; - padding: 0; -} - -.tree .expander { - color: black; - background-color: inherit; - display: block; - float: left; - margin: 0; - border: none; - margin-left: -1.5em; - padding: 0; - text-align: center; - width: 1em; -} - -.tree .expander:link, -.tree .expander:visited, -.tree .expander:active, -.tree .expander:hover { - color: black; - background-color: inherit; - text-decoration: none; -} - -.tree ul.closed { - display: none; -} - -/** Table of Contents *********************************************************/ - -#table-of-contents { - border: 1px solid #d9d9d3; - color: black; - background-color: #F7F7F0; - padding: 1em; - margin: 0; -} - -#table-of-contents p, -#table-of-contents ul.tree { - font-size: small; -} - -#table-of-contents p { - margin-bottom: 0; -} - -#table-of-contents h1 { - display: block; - font-size: 1.5em; - margin-right: 0.5em; - margin-bottom: 0; - text-align: left; - border: none; -} - -#toc-toggles { - margin: 0; - padding: 0; - text-align: right; - font-size: small; -} - -#toc-toggles a { - margin-left: 0.5em; -} - -/** Sticky Table of Contents **************************************************/ - -div#wrap.sticky-toc #sidebar { - /* Netscape 4, IE 4.x-5.0/Win and other lesser browsers will use this */ - position: absolute; - top: 0; - right: 0; - bottom: 0; - width: 25%; - overflow: auto; -} - -div#wrap.sticky-toc > #sidebar { - /* used by Opera 5+, Netscape6+/Mozilla, Konqueror, Safari, OmniWeb 4.5+, - iCab, ICEbrowser */ - position: fixed; -} - -.sticky-toc #content { - position: absolute; - top: 0; - left: 0; - right: 25%; - padding-right: 2em; -} diff --git a/manual/styles/iefix.css b/manual/styles/iefix.css deleted file mode 100644 index c6ee16318..000000000 --- a/manual/styles/iefix.css +++ /dev/null @@ -1,15 +0,0 @@ -.tree .expander { - margin-left: -0.60em; -} - -pre { - word-wrap: break-word; -} - - -div#wrap.sticky-toc #sidebar { - /* IE5.5+/Win - this is more specific than the IE 5.0 version */ - top: expression(eval(document.documentElement.scrollTop)); - height: expression(eval(document.documentElement.clientHeight - 32)); -} - diff --git a/manual/styles/print.css b/manual/styles/print.css deleted file mode 100644 index 4394ded96..000000000 --- a/manual/styles/print.css +++ /dev/null @@ -1,129 +0,0 @@ -@page { - size: a4 portrait; - margin: 20mm; - padding: 5mm 0; - border-top: thin solid black; - border-bottom: thin solid black; - @top-left { - font-size: 10pt; - vertical-align: bottom; - margin: 2mm - } - @top-right { - font-size: 10pt; - vertical-align: bottom; - margin: 2mm - } - @bottom { - font-size: 10pt; - content: counter(page); - vertical-align: top; - text-align: outside; - margin: 2mm - } -} - -@page :left { - @top-left { - content: "Doctrine Manual"; - } - @top-right { - content: ""; - } -} - -@page :right { - @top-right { - content: "Doctrine Manual"; - } - @top-left { - content: ""; - } -} - -* { - text-decoration: none; -} - -html, body { - font-family: "Helvetica", "Arial", sans-serif; - font-size: 11pt; - padding: 0; - margin: 0; -} - -.chapter, #table-of-contents { - page-break-after: always; -} - -h1, h2, h3, h4, h5, h6 { - page-break-after: avoid; -} - -h1 { - text-align: center; -} - -p, ul, ol, dl { - text-align: justify; - line-height: 1.2em; - hyphens: auto; -} - -ul { - list-style-type: square; -} - -tt { - font-family: "Bitstream Vera Sans Mono", monospace; - font-size: 10pt; -} - -pre { - background-color: #eeeeee; -} - -table { - border: thin solid black; - border-collapse: collapse; -} - -td, th { - border: thin solid black; - padding: 0.5em; -} - -.expander { - display: none; -} - -a { - text-decoration: none; - font: inherit; - color: inherit; -} - -#toc-toggles { - display: none; -} - -#table-of-contents ul { - list-style-type: none; - font-weight: bold; -} - -#table-of-contents ul, #table-of-contents li { - margin-left: 0; -} - -#table-of-contents ul ul { - margin-left: 1em; - font-weight: normal; -} - -/* add page numbers to TOC */ - -#table-of-contents ul a::after { - content: leader('.') target-counter(attr(href), page); -} - diff --git a/manual/templates/.htaccess b/manual/templates/.htaccess deleted file mode 100644 index 3418e55a6..000000000 --- a/manual/templates/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/manual/templates/index.tpl.php b/manual/templates/index.tpl.php deleted file mode 100644 index 95d2c5735..000000000 --- a/manual/templates/index.tpl.php +++ /dev/null @@ -1,37 +0,0 @@ - - - - - -<?php echo $title; ?> - - - - - - - - - -
    - -
    - -

    - -

    There are several different versions of this manual available online: -

    -

    - - -
    - -
    - - - diff --git a/manual/templates/latex.tpl.php b/manual/templates/latex.tpl.php deleted file mode 100644 index 13b1f313a..000000000 --- a/manual/templates/latex.tpl.php +++ /dev/null @@ -1,107 +0,0 @@ -\documentclass[11pt,a4paper]{book} - -\usepackage{ifpdf} -\ifpdf -\usepackage{thumbpdf} -\pdfcompresslevel=9 -\fi - -\usepackage[latin1]{inputenc} -\usepackage[margin=2cm, twoside, bindingoffset=1cm]{geometry} -\usepackage{fancyhdr} -\usepackage{url} -\usepackage{calc} -\usepackage{longtable} -\usepackage{listings} -\usepackage{color} - -\usepackage[ - pdftex, - colorlinks, - bookmarks, - pdftitle={%TITLE%}, - pdfauthor={%AUTHOR%}, - pdfsubject={%SUBJECT%}, - pdfkeywords={%KEYWORDS%}]{hyperref} - -\pdfadjustspacing=1 - -\newdimen\newtblsparewidth - -\pagestyle{fancy} -\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}} -\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} -\fancyhf{} -\fancyhead[LE]{\nouppercase{\bfseries\leftmark}} -\fancyhead[RO]{\nouppercase{\bfseries\rightmark}} -\fancyhead[RE, LO]{\bfseries{%TITLE%}} -\fancyfoot[RO, LE]{\bfseries\thepage} -\renewcommand{\headrulewidth}{0.5pt} -\renewcommand{\footrulewidth}{0.5pt} -\addtolength{\headheight}{2.5pt} -\fancypagestyle{plain}{ - \fancyhead{} - \fancyfoot{} - \renewcommand{\headrulewidth}{0pt} - \renewcommand{\footrulewidth}{0pt} -} - -\definecolor{light-gray}{gray}{0.97} -\definecolor{keyword}{rgb}{0.47, 0.53, 0.6} -\definecolor{string}{rgb}{0.73, 0.53, 0.27} -\definecolor{comment}{rgb}{0.6, 0.6, 0.53} - -\lstset{ - columns=fixed, - basicstyle=\footnotesize\ttfamily, - identifierstyle=\color{black}, - keywordstyle=\color{keyword}, - stringstyle=\color{string}, - commentstyle=\color{comment}\itshape, - backgroundcolor=\color{light-gray}, - frame=single, - framerule=0pt, - breaklines, - showstringspaces=false -} - -\lstdefinelanguage{PHP} - {morekeywords={ - % Case-sensitive keywords: - abstract,and,as,break,case,catch,class,const,continue,default,die,do,echo, - else,elseif,endfor,endforeach,endswitch,endwhile,extends,for,global,final, - foreach,function,if,implements,import,include,include_once,instanceof, - interface,list,namespace,new,or,print,private,protected,public,require, - require_once,return,static,switch,throw,try,var,while,xor, - % Case-insensitive keywords: - true,True,TRUE,false,False,FALSE,null,Null,NULL}, - morekeywords=[2]{ - array,bool,boolean,double,float,int,integer,object,real,string,unset}, - otherkeywords={-,.,~,^,@,;,:,\%,|,=,+,!,?,&,<,>}, - sensitive=true, - morecomment=[l]{//}, % C++ line comment - morecomment=[l]{\#}, % Bash line comment - morecomment=[s]{/*}{*/}, % C block comment - morestring=[b]{'}, % single-quoted string - morestring=[b]{"} % double-quoted string - } - - -\setcounter{tocdepth}{5} -\setcounter{secnumdepth}{5} - -\title{%TITLE%} -\author{%AUTHOR%} -\date{%VERSION%\\ \today} - -\begin{document} - -\maketitle -\tableofcontents - -\setlength{\parindent}{0pt} -\setlength{\parskip}{1.5ex plus 0.7ex minus 0.6ex} - -%CONTENT% - -\end{document} diff --git a/manual/templates/xhtml.tpl.php b/manual/templates/xhtml.tpl.php deleted file mode 100644 index 5fff596d1..000000000 --- a/manual/templates/xhtml.tpl.php +++ /dev/null @@ -1,62 +0,0 @@ - - - - - -%TITLE% - - - - - - - - - - - - - - - - - - - -
    - - - -
    - -%CONTENT% - -
    - -
    - - - - diff --git a/manual/tmp/.htaccess b/manual/tmp/.htaccess deleted file mode 100644 index 3418e55a6..000000000 --- a/manual/tmp/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/package.php b/package.php deleted file mode 100644 index 8213b1958..000000000 --- a/package.php +++ /dev/null @@ -1,94 +0,0 @@ - 'svn', - 'changelogoldtonew' => false, - 'simpleoutput' => true, - 'baseinstalldir' => '/', - 'packagedirectory' => $path, - 'packageFile' => $packageFile, - 'clearcontents' => false, - // What to ignore - 'ignore' => array( - $path . DIRECTORY_SEPARATOR . 'vendor/', - $path . DIRECTORY_SEPARATOR . 'package*.*', - $path . DIRECTORY_SEPARATOR . 'tests_old/', - $path . DIRECTORY_SEPARATOR . 'tests/', - $path . DIRECTORY_SEPARATOR . 'tools/' - ), - // What to include in package - 'include' => array( - $path . DIRECTORY_SEPARATOR . 'lib/', - $path . DIRECTORY_SEPARATOR . 'manual/', - $path . DIRECTORY_SEPARATOR . 'vendor/', - $path . DIRECTORY_SEPARATOR . 'README', - $path . DIRECTORY_SEPARATOR . 'CHANGELOG', - $path . DIRECTORY_SEPARATOR . 'LICENSE', - $path . DIRECTORY_SEPARATOR . 'COPYRIGHT' - ), - // Dir roles - 'dir_roles' => array( - 'lib' => 'php', - 'manual' => 'doc', - 'vendor' => 'php' - ), - // File roles - 'exceptions' => array( - 'README' => 'doc', - 'CHANGELOG' => 'doc', - 'LICENSE' => 'doc', - 'COPYRIGHT' => 'doc' - ) - ); - - $package = &PEAR_packageFileManager2::importOptions($packageFile, $options); - $package->setPackageType('php'); - - $package->clearDeps(); - $package->setPhpDep('5.2.3'); - $package->setPearInstallerDep('1.4.0b1'); - $package->addPackageDepWithChannel('required', 'PEAR', 'pear.php.net', '1.3.6'); - - $package->addRelease(); - $package->generateContents(); - $package->setReleaseVersion($version); - $package->setAPIVersion($version); - $package->setReleaseStability($state); - $package->setAPIStability($state); - $package->setNotes($notes); - $package->setSummary($summary); - $package->setDescription($description); - $package->addGlobalReplacement('package-info', '@package_version@', 'version'); - - if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { - $package->writepackageFile(); - } else { - $package->debugpackageFile(); - } -} \ No newline at end of file diff --git a/package.xml b/package.xml deleted file mode 100644 index fa6fdbb37..000000000 --- a/package.xml +++ /dev/null @@ -1,1190 +0,0 @@ - - - Doctrine - pear.phpdoctrine.org - PHP5 Database ORM - Doctrine is an ORM (object relational mapper) for PHP 5.2.x+ that sits on top of -a powerful DBAL (database abstraction layer). One of its key features is the -ability to optionally write database queries in an OO (object oriented) -SQL-dialect called DQL inspired by Hibernates HQL. This provides developers with -a powerful alternative to SQL that maintains a maximum of flexibility without -requiring needless code duplication. - - Konsta Vesterinen - zYne- - kvesteri@cc.hut.fi - yes - - - Jonathan H. Wage - jwage - jonwage@gmail.com - yes - - 2008-02-13 - - - 1.0.0 - 1.0.0 - - - beta - beta - - LGPL license - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5.2.3 - - - 1.4.0b1 - - - PEAR - pear.php.net - 1.3.6 - - - - - - - - 1.0.0 - 1.0.0 - - - beta - beta - - 2008-02-13 - LGPL license - - - - - - 0.9 - 0.9 - - - beta - beta - - 2008-02-06 - MIT license - barfoo - - - diff --git a/package_Core.php b/package_Core.php deleted file mode 100644 index 05262b325..000000000 --- a/package_Core.php +++ /dev/null @@ -1,95 +0,0 @@ - 'svn', - 'changelogoldtonew' => false, - 'simpleoutput' => true, - 'baseinstalldir' => '/', - 'packagedirectory' => './', - 'packagefile' => $packagefile, - 'clearcontents' => false, - 'include' => array( - 'manual/', - 'tests/', - 'lib/Doctrine.php', - 'lib/Doctrine/Builder/', - 'lib/Doctrine/Cli.php', - 'lib/Doctrine/Compiler/', - 'lib/Doctrine/Configurable/', - 'lib/Doctrine/Cli.php', - 'lib/Doctrine/Data/', - 'lib/Doctrine/Exception/', - 'lib/Doctrine/Event/', - 'lib/Doctrine/EventListener/', - 'lib/Doctrine/File/', - 'lib/Doctrine/FileFinder/', - 'lib/Doctrine/Formatter/', - 'lib/Doctrine/Inflector/', - 'lib/Doctrine/Lib.php', - 'lib/Doctrine/Locator/', - 'lib/Doctrine/Log/', - 'lib/Doctrine/Null/', - 'lib/Doctrine/Overloadable/', - 'lib/Doctrine/Parser/', - 'lib/Doctrine/Task/', - 'lib/Doctrine/Util/', - ), - 'dir_roles' => array( - 'lib' => 'php', - 'manual' => 'doc', - 'tests' => 'test', - ), - 'exceptions' => array( - 'README' => 'doc', - 'CHANGELOG' => 'doc', - 'LICENSE' => 'doc', - 'COPYRIGHT' => 'doc' - ) -); - -$package = &PEAR_PackageFileManager2::importOptions($packagefile, $options); -$package->setPackageType('php'); - -$package->clearDeps(); -$package->setPhpDep('5.2.3'); -$package->setPearInstallerDep('1.4.0b1'); -$package->addPackageDepWithChannel('required', 'PEAR', 'pear.php.net', '1.3.6'); - -$package->addRelease(); -$package->generateContents(); -$package->setReleaseVersion($version_release); -$package->setAPIVersion($version_api); -$package->setReleaseStability($state); -$package->setAPIStability($state); -$package->setNotes($notes); -$package->setSummary($summary); -$package->setDescription($description); -$package->addGlobalReplacement('package-info', '@package_version@', 'version'); - -if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { - $package->writePackageFile(); -} else { - $package->debugPackageFile(); -} diff --git a/package_Core.xml b/package_Core.xml deleted file mode 100644 index 62f94f818..000000000 --- a/package_Core.xml +++ /dev/null @@ -1,905 +0,0 @@ - - - Doctrine_Core - pear.php.net - PHP5 Database Interface Core Package - Doctrine_Core is the core package for the Doctrine DBAL/ORM. It contains various -helper classes that are necessary for both the DBAL and the ORM. - - Konsta Vesterinen - zYne- - kvesteri@cc.hut.fi - yes - - 2008-02-06 - - - 0.9 - 0.9 - - - beta - beta - - MIT license - barfoo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5.2.3 - - - 1.4.0b1 - - - PEAR - pear.php.net - 1.3.6 - - - - - - - - 0.9 - 0.9 - - - beta - beta - - 2008-02-06 - MIT license - barfoo - - - diff --git a/package_DBAL.php b/package_DBAL.php deleted file mode 100644 index 8c5300a32..000000000 --- a/package_DBAL.php +++ /dev/null @@ -1,71 +0,0 @@ - 'svn', - 'changelogoldtonew' => false, - 'simpleoutput' => true, - 'baseinstalldir' => '/', - 'packagedirectory' => './', - 'packagefile' => $packagefile, - 'clearcontents' => false, - 'include' => array( - 'lib/Doctrine/Connection/', - 'lib/Doctrine/DataDict/', - 'lib/Doctrine/Export/', - 'lib/Doctrine/Import/', - 'lib/Doctrine/Manager/', - 'lib/Doctrine/Sequences/', - 'lib/Doctrine/Transaction/', - ), - 'dir_roles' => array( - 'lib' => 'php', - ), - 'exceptions' => array( - ) -); - -$package = &PEAR_PackageFileManager2::importOptions($packagefile, $options); -$package->setPackageType('php'); - -$package->clearDeps(); -$package->setPhpDep('5.2.3'); -$package->setPearInstallerDep('1.4.0b1'); -$package->addPackageDepWithChannel('required', 'PEAR', 'pear.php.net', '1.3.6'); - -$package->addRelease(); -$package->generateContents(); -$package->setReleaseVersion($version_release); -$package->setAPIVersion($version_api); -$package->setReleaseStability($state); -$package->setAPIStability($state); -$package->setNotes($notes); -$package->setSummary($summary); -$package->setDescription($description); -$package->addGlobalReplacement('package-info', '@package_version@', 'version'); - -if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { - $package->writePackageFile(); -} else { - $package->debugPackageFile(); -} diff --git a/package_DBAL.xml b/package_DBAL.xml deleted file mode 100644 index db80e8d03..000000000 --- a/package_DBAL.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - Doctrine_DBAL - pear.php.net - PHP5 Database DBAL - Doctrine_DBAL is a DBAL (database abstraction layer) for PHP 5.2.x+ . - - Konsta Vesterinen - zYne- - kvesteri@cc.hut.fi - yes - - 2008-02-06 - - - 0.9 - 0.9 - - - beta - beta - - MIT license - barfoo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5.2.3 - - - 1.4.0b1 - - - PEAR - pear.php.net - 1.3.6 - - - - - - - - 0.9 - 0.9 - - - beta - beta - - 2008-02-06 - MIT license - barfoo - - - diff --git a/package_ORM.php b/package_ORM.php deleted file mode 100644 index edaed4abb..000000000 --- a/package_ORM.php +++ /dev/null @@ -1,89 +0,0 @@ - 'svn', - 'changelogoldtonew' => false, - 'simpleoutput' => true, - 'baseinstalldir' => '/', - 'packagedirectory' => './', - 'packagefile' => $packagefile, - 'clearcontents' => false, - 'include' => array( - 'models/', - 'lib/Doctrine/Adapter/', - 'lib/Doctrine/Auditlog/', - 'lib/Doctrine/Cache/', - 'lib/Doctrine/Collection/', - 'lib/Doctrine/Hook/', - 'lib/Doctrine/Hydrator/', - 'lib/Doctrine/I18n/', - 'lib/Doctrine/Locking/', - 'lib/Doctrine/Mapper/', - 'lib/Doctrine/Migration/', - 'lib/Doctrine/Node/', - 'lib/Doctrine/Query/', - 'lib/Doctrine/RawSql/', - 'lib/Doctrine/Search/', - 'lib/Doctrine/Table/', - 'lib/Doctrine/Template/', - 'lib/Doctrine/Tree/', - 'lib/Doctrine/Validator/', - 'lib/Doctrine/View/', - ), - 'dir_roles' => array( - 'lib' => 'php', - 'models' => 'doc', - ), - 'exceptions' => array( - ) -); - -$package = &PEAR_PackageFileManager2::importOptions($packagefile, $options); -$package->setPackageType('php'); - -$package->clearDeps(); -$package->setPhpDep('5.2.3'); -$package->setPearInstallerDep('1.4.0b1'); -$package->addPackageDepWithChannel('required', 'PEAR', 'pear.php.net', '1.3.6'); - -$package->addRelease(); -$package->generateContents(); -$package->setReleaseVersion($version_release); -$package->setAPIVersion($version_api); -$package->setReleaseStability($state); -$package->setAPIStability($state); -$package->setNotes($notes); -$package->setSummary($summary); -$package->setDescription($description); -$package->addGlobalReplacement('package-info', '@package_version@', 'version'); - -if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { - $package->writePackageFile(); -} else { - $package->debugPackageFile(); -} diff --git a/package_ORM.xml b/package_ORM.xml deleted file mode 100644 index 92138add3..000000000 --- a/package_ORM.xml +++ /dev/null @@ -1,481 +0,0 @@ - - - Doctrine_ORM - pear.php.net - PHP5 Database ORM - Doctrine_ORM is an ORM (object relational mapper) for PHP 5.2.x+. One of its key -features is the ability to optionally write database queries in an OO -(object oriented) SQL-dialect called DQL inspired by Hibernates HQL. This -provides developers with a powerful alternative to SQL that maintains a maximum -of flexibility without requiring needless code duplication. - - Konsta Vesterinen - zYne- - kvesteri@cc.hut.fi - yes - - 2008-02-06 - - - 0.9 - 0.9 - - - beta - beta - - MIT license - barfoo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5.2.3 - - - 1.4.0b1 - - - PEAR - pear.php.net - 1.3.6 - - - - - - - - 0.9 - 0.9 - - - beta - beta - - 2008-02-06 - MIT license - barfoo - - - diff --git a/svn2cl.xsl b/svn2cl.xsl deleted file mode 100644 index 146842848..000000000 --- a/svn2cl.xsl +++ /dev/null @@ -1,463 +0,0 @@ - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &newl; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &newl; - - - - - &space;&space; - - - - &newl; - &newl; - - - - - - - &newl; - - - - - &space;&space; - - - - &newl;&newl; - - - - - - :&space; - - - - - [r - - ]&space; - - - - - - - - &newl; - - - - - - - - - - - - - &newl; - - &tab;*&space; - - - - - - - - - - - - - - &space; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ,&space; - - - - - - - - - - - - - - ,&space; - - - - - - - - - - - - - - - - - - - - - - - - - - - . - - - - - - - - - - - - - - - - - - - &tab;&space;&space; - - - - - - - - - - &newl; - - - - - - - - - - - - - - - - - - - - - - &newl;&tab;&space;&space; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &newl;&newl; - - - - - - - - - - - - - - - - - - - - &newl; - - - - - - - - diff --git a/tests_old/AccessTestCase.php b/tests_old/AccessTestCase.php deleted file mode 100644 index 8b8f616cf..000000000 --- a/tests_old/AccessTestCase.php +++ /dev/null @@ -1,125 +0,0 @@ -. - */ - -/** - * Doctrine_Access_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Access_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('Entity', 'User'); - parent::prepareTables(); - } - - public function testUnset() - { - - } - public function testIsset() - { - $user = new User(); - - $this->assertTrue(!isset($user->name)); - $this->assertFalse(isset($user->unknown)); - - $this->assertTrue(!isset($user['name'])); - $this->assertFalse(isset($user['unknown'])); - - $coll = new Doctrine_Collection('User'); - - $this->assertFalse(isset($coll[0])); - // test repeated call - $this->assertFalse(isset($coll[0])); - $coll[0]; - - $this->assertTrue(isset($coll[0])); - // test repeated call - $this->assertTrue(isset($coll[0])); - } - - public function testOffsetMethods() - { - $user = new User(); - $this->assertEqual($user['name'], null); - - $user['name'] = 'Jack'; - $this->assertEqual($user['name'], 'Jack'); - - $user->save(); - - $user = $this->connection->getRepository('User')->find($user->identifier()); - $this->assertEqual($user->name, 'Jack'); - - $user['name'] = 'Jack'; - $this->assertEqual($user['name'], 'Jack'); - $user['name'] = 'zYne'; - $this->assertEqual($user['name'], 'zYne'); - } - - public function testOverload() - { - $user = new User(); - $this->assertEqual($user->name,null); - - $user->name = 'Jack'; - - $this->assertEqual($user->name, 'Jack'); - - $user->save(); - - $user = $this->connection->getRepository('User')->find($user->identifier()); - $this->assertEqual($user->name, 'Jack'); - - $user->name = 'Jack'; - $this->assertEqual($user->name, 'Jack'); - $user->name = 'zYne'; - $this->assertEqual($user->name, 'zYne'); - } - - public function testSet() { - $user = new User(); - $this->assertEqual($user->get('name'),null); - - $user->set('name', 'Jack'); - $this->assertEqual($user->get('name'), 'Jack'); - - $user->save(); - - $user = $this->connection->getRepository('User')->find($user->identifier()); - - $this->assertEqual($user->get('name'), 'Jack'); - - $user->set('name', 'Jack'); - $this->assertEqual($user->get('name'), 'Jack'); - } -} diff --git a/tests_old/AuditLogTestCase.php b/tests_old/AuditLogTestCase.php deleted file mode 100644 index 7f6a85cc4..000000000 --- a/tests_old/AuditLogTestCase.php +++ /dev/null @@ -1,101 +0,0 @@ -. - */ - -/** - * Doctrine_AuditLog_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_AuditLog_TestCase extends Doctrine_UnitTestCase -{ - - public function prepareData() - { } - - public function prepareTables() - { - $this->profiler = new Doctrine_Connection_Profiler(); - $this->conn->addListener($this->profiler); - $this->tables = array('VersioningTest'); - - parent::prepareTables(); - } - - public function testVersioningListenerListensAllManipulationOperations() - { - $entity = new VersioningTest(); - - $entity->name = 'zYne'; - $entity->save(); - $this->assertEqual($entity->version, 1); - - $entity->name = 'zYne 2'; - $entity->save(); - $this->assertEqual($entity->name, 'zYne 2'); - - $this->conn->clear(); - - $entity = $this->conn->getTable('VersioningTest')->find(1); - - $this->assertEqual($entity->name, 'zYne 2'); - $this->assertEqual($entity->version, 2); - - $entity->delete(); - $this->assertEqual($entity->version, 3); - - $entity->revert(2); - - $this->assertEqual($entity->name, 'zYne 2'); - $this->assertEqual($entity->version, 2); - - $entity->revert(1); - - $this->assertEqual($entity->name, 'zYne'); - $this->assertEqual($entity->version, 1); - - } - - public function testRevertThrowsExceptionForTransientRecords() - { - $entity = new VersioningTest(); - - try { - $entity->revert(1); - $this->fail(); - } catch (Doctrine_Record_Exception $e) { - $this->pass(); - } - } - - public function testReturnFalseIfVersionTableExists() - { - //$entity = new VersioningTest(); - //$entity_table = $entity->getTable(); - //$auditLog = new Doctrine_AuditLog(array("table" => $entity_table)); - //$this->assertFalse($auditLog->buildDefinition($entity_table)); - } -} diff --git a/tests_old/BatchIteratorTestCase.php b/tests_old/BatchIteratorTestCase.php deleted file mode 100644 index da8186904..000000000 --- a/tests_old/BatchIteratorTestCase.php +++ /dev/null @@ -1,87 +0,0 @@ -. - */ - -/** - * Doctrine_BatchIterator_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_BatchIterator_TestCase extends Doctrine_UnitTestCase { - public function prepareTables() { - $this->tables = array("Entity", "User", "Group", "Address", "Email", "Phonenumber"); - parent::prepareTables(); - } - - public function testIterator() { - $graph = new Doctrine_Query($this->connection); - $entities = $graph->query("FROM Entity"); - $i = 0; - foreach($entities as $entity) { - $this->assertEqual(gettype($entity->name),"string"); - $i++; - } - $this->assertTrue($i == $entities->count()); - - $user = $graph->query("FROM User"); - foreach($user[1]->Group as $group) { - $this->assertTrue(is_string($group->name)); - } - - $user = new User(); - $user->name = "tester"; - - $user->Address[0]->address = "street 1"; - $user->Address[1]->address = "street 2"; - - $this->assertEqual($user->name, "tester"); - $this->assertEqual($user->Address[0]->address, "street 1"); - $this->assertEqual($user->Address[1]->address, "street 2"); - - foreach($user->Address as $address) { - $a[] = $address->address; - } - $this->assertEqual($a, array("street 1", "street 2")); - - $user->save(); - - $user = $user->getTable()->find($user->obtainIdentifier()); - $this->assertEqual($user->name, "tester"); - $this->assertEqual($user->Address[0]->address, "street 1"); - $this->assertEqual($user->Address[1]->address, "street 2"); - - $user = $user->getTable()->find($user->obtainIdentifier()); - $a = array(); - foreach($user->Address as $address) { - $a[] = $address->address; - } - $this->assertEqual($a, array("street 1", "street 2")); - - - $user = $graph->query("FROM User"); - } - -} diff --git a/tests_old/Cache/ApcTestCase.php b/tests_old/Cache/ApcTestCase.php deleted file mode 100644 index ff6e71750..000000000 --- a/tests_old/Cache/ApcTestCase.php +++ /dev/null @@ -1,37 +0,0 @@ -. - */ - -/** - * Doctrine_Cache_Apc_TestCase - * - * @package Doctrine - * @subpackage Doctrine_Cache - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Cache_Apc_TestCase extends Doctrine_UnitTestCase -{ - -} diff --git a/tests_old/Cache/MemcacheTestCase.php b/tests_old/Cache/MemcacheTestCase.php deleted file mode 100644 index b507c5774..000000000 --- a/tests_old/Cache/MemcacheTestCase.php +++ /dev/null @@ -1,51 +0,0 @@ -. - */ - -/** - * Doctrine_Cache_Memcache_TestCase - * - * @package Doctrine - * @subpackage Doctrine_Cache - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Cache_Memcache_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { } - public function prepareData() - { } -} -class Doctrine_Cache_Memcache_Mock extends Doctrine_Cache_Memcache -{ -} - -if ( ! class_exists('Memcache')) -{ - class Memcache - { - - } -} diff --git a/tests_old/Cache/SqliteTestCase.php b/tests_old/Cache/SqliteTestCase.php deleted file mode 100644 index b23a18ebe..000000000 --- a/tests_old/Cache/SqliteTestCase.php +++ /dev/null @@ -1,40 +0,0 @@ -. - */ - -/** - * Doctrine_Cache_Sqlite_TestCase - * - * @package Doctrine - * @subpackage Doctrine_Cache - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Cache_Sqlite_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { } - public function prepareData() - { } -} diff --git a/tests_old/CacheFileTestCase.php b/tests_old/CacheFileTestCase.php deleted file mode 100644 index 55c521515..000000000 --- a/tests_old/CacheFileTestCase.php +++ /dev/null @@ -1,59 +0,0 @@ -manager->setAttribute(Doctrine::ATTR_CACHE, Doctrine::CACHE_FILE); - } - public function testStore() { - $this->cache->store($this->old); - $this->assertTrue($this->cache->exists(4)); - - $record = $this->cache->fetch(4); - $this->assertTrue($record instanceof Doctrine_Entity); - $this->assertTrue($record->obtainIdentifier() == $this->old->obtainIdentifier()); - - $this->assertTrue($this->cache->getTable() == $this->objTable); - } - public function testGetFetched() { - $this->assertTrue(is_array($this->cache->getFetched())); - } - public function testGetFileName() { - $this->assertEqual($this->manager->getRoot().DIRECTORY_SEPARATOR."cache".DIRECTORY_SEPARATOR."entity".DIRECTORY_SEPARATOR."4.cache", $this->cache->getFileName(4)); - } - public function testGetStats() { - $this->assertTrue(gettype($this->cache->getStats()) == "array"); - } - public function testDestructor() { - $this->objTable->setAttribute(Doctrine::ATTR_CACHE_TTL,1); - $this->objTable->setAttribute(Doctrine::ATTR_CACHE_SIZE,5); - $this->cache->__destruct(); - $this->assertTrue($this->cache->count() == 5); - - $this->objTable->setAttribute(Doctrine::ATTR_CACHE_TTL,1); - $this->objTable->setAttribute(Doctrine::ATTR_CACHE_SIZE,1); - $this->cache->__destruct(); - $this->assertTrue($this->cache->count() == 1); - - } - public function testDeleteMultiple() { - $this->objTable->find(5); - $this->objTable->find(6); - - $deleted = $this->cache->deleteMultiple(array(5,6)); - $this->assertTrue($deleted == 2); - } - public function testDeleteAll() { - $this->cache->deleteAll(); - $this->assertTrue($this->cache->count() == 0); - } - public function testExists() { - $this->assertFalse($this->cache->exists(313213123)); - $this->assertTrue($this->cache->exists(4)); - } - public function testGetFactory() { - $this->assertTrue($this->cache->getTable() == $this->objTable); - } - -} diff --git a/tests_old/CacheQuerySqliteTestCase.php b/tests_old/CacheQuerySqliteTestCase.php deleted file mode 100644 index 355da49e1..000000000 --- a/tests_old/CacheQuerySqliteTestCase.php +++ /dev/null @@ -1,39 +0,0 @@ -connection->getAttribute(Doctrine::ATTR_CACHE_DIR); - - if(file_exists($dir.DIRECTORY_SEPARATOR."stats.cache")) - unlink($dir.DIRECTORY_SEPARATOR."stats.cache"); - - $this->cache = new Doctrine_Cache_Query_Sqlite($this->connection); - $this->cache->deleteAll(); - } - public function testStore() { - - $this->cache->store("SELECT * FROM user", array(array('name' => 'Jack Daniels')), 60); - $this->assertEqual($this->cache->count(), 1); - - $this->cache->store("SELECT * FROM group", array(array('name' => 'Drinkers club')), 60); - - $md5 = md5("SELECT * FROM user"); - $result = $this->cache->fetch($md5); - $this->assertEqual($result, array(array('name' => 'Jack Daniels'))); - - $md5 = md5("SELECT * FROM group"); - $result = $this->cache->fetch($md5); - $this->assertEqual($result, array(array('name' => 'Drinkers club'))); - - $this->assertEqual($this->cache->count(), 2); - - $this->cache->delete($md5); - $this->assertEqual($this->cache->count(), 1); - - $this->cache->deleteAll(); - $this->assertEqual($this->cache->count(), 0); - } -} diff --git a/tests_old/CacheSqliteTestCase.php b/tests_old/CacheSqliteTestCase.php deleted file mode 100644 index c9749e366..000000000 --- a/tests_old/CacheSqliteTestCase.php +++ /dev/null @@ -1,109 +0,0 @@ -manager->setAttribute(Doctrine::ATTR_CACHE,Doctrine::CACHE_NONE); - $dir = $this->connection->getAttribute(Doctrine::ATTR_CACHE_DIR); - - if(file_exists($dir.DIRECTORY_SEPARATOR."stats.cache")) - unlink($dir.DIRECTORY_SEPARATOR."stats.cache"); - - $this->cache = new Doctrine_Cache_Sqlite($this->objTable); - $this->cache->deleteAll(); - } - - public function testStore() { - // does not store proxy objects - $this->assertFalse($this->cache->store($this->objTable->getProxy(4))); - - $this->assertTrue($this->cache->store($this->objTable->find(4))); - - $record = $this->cache->fetch(4); - $this->assertTrue($record instanceof Doctrine_Entity); - - foreach($this->old as $name => $value) { - $this->assertEqual($record->get($name), $value); - } - $this->assertEqual($record->obtainIdentifier(), $this->old->obtainIdentifier()); - - } - public function testFetchMultiple() { - $this->assertFalse($this->cache->fetchMultiple(array(5,6))); - $this->cache->store($this->objTable->find(5)); - - $array = $this->cache->fetchMultiple(array(5,6)); - $this->assertEqual(gettype($array), "array"); - $this->assertEqual(count($array), 1); - $this->assertTrue($array[0] instanceof Doctrine_Entity); - } - public function testDeleteMultiple() { - $this->assertEqual($this->cache->deleteMultiple(array()),0); - $this->cache->store($this->objTable->find(5)); - $this->cache->store($this->objTable->find(6)); - - $count = $this->cache->deleteMultiple(array(5,6)); - - $this->assertEqual($count,2); - $this->cache->store($this->objTable->find(6)); - $count = $this->cache->deleteMultiple(array(5,6)); - $this->assertEqual($count,1); - } - public function testDelete() { - $this->cache->store($this->objTable->find(5)); - $this->assertTrue($this->cache->fetch(5) instanceof Doctrine_Entity); - - $this->assertEqual($this->cache->delete(5),true); - $this->assertFalse($this->cache->fetch(5)); - - $this->assertFalse($this->cache->delete(0)); - } - - public function testFetch() { - $this->assertFalse($this->cache->fetch(3)); - - } - public function testCount() { - $this->assertEqual($this->cache->count(), 0); - $this->cache->store($this->objTable->find(5)); - $this->assertEqual($this->cache->count(), 1); - } - public function testSaveStats() { - $this->assertFalse($this->cache->saveStats()); - $this->cache->store($this->objTable->find(5)); - $this->cache->store($this->objTable->find(6)); - $this->cache->store($this->objTable->find(7)); - $this->cache->fetchMultiple(array(5,6,7)); - - $this->assertTrue($this->cache->saveStats()); - $this->assertTrue(gettype($this->cache->getStats()), "array"); - $this->assertEqual($this->cache->getStats(),array(5 => 1, 6 => 1, 7 => 1)); - - $this->cache->fetchMultiple(array(5,6,7)); - $this->cache->fetch(5); - $this->cache->fetch(7); - $this->assertTrue($this->cache->saveStats()); - $this->assertEqual($this->cache->getStats(),array(5 => 3, 6 => 2, 7 => 3)); - } - public function testClean() { - $this->cache->store($this->objTable->find(4)); - $this->cache->store($this->objTable->find(5)); - $this->cache->store($this->objTable->find(6)); - $this->cache->store($this->objTable->find(7)); - $this->cache->store($this->objTable->find(8)); - $this->cache->store($this->objTable->find(9)); - $this->assertEqual($this->cache->count(), 6); - $this->cache->fetch(5); - $this->cache->fetch(7); - $this->cache->fetchMultiple(array(5,6,7)); - $this->cache->fetchMultiple(array(5,6,7)); - $this->cache->fetchMultiple(array(5,6,7)); - $this->cache->fetchMultiple(array(4,5,6,7,8,9)); - $this->assertTrue($this->cache->saveStats()); - - $this->manager->setAttribute(Doctrine::ATTR_CACHE_SIZE, 3); - $this->assertEqual($this->cache->clean(), 3); - - } -} diff --git a/tests_old/CacheTestCase.php b/tests_old/CacheTestCase.php deleted file mode 100644 index bf54fd9a8..000000000 --- a/tests_old/CacheTestCase.php +++ /dev/null @@ -1,178 +0,0 @@ -. - */ - -/** - * Doctrine_Cache_TestCase - * - * @package Doctrine - * @subpackage Doctrine_Cache - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase -{ - protected $cache; - - public function prepareTables() - { } - public function prepareData() - { } - /** - public function testAdapterQueryAddsQueriesToCacheStack() - { - $this->dbh->query('SELECT * FROM user'); - - $this->assertEqual($this->cache->getAll(), array('main' => array('SELECT * FROM user'))); - } - */ - public function testAdapterQueryChecksCache() - { - $query = 'SELECT * FROM user'; - - $resultSet = array(array('name' => 'John'), array('name' => 'Arnold')); - - $this->cache->getDriver()->save(md5(serialize($query)), $resultSet); - - $count = $this->dbh->getAdapter()->count(); - - $stmt = $this->dbh->query($query); - $data = $stmt->fetchAll(Doctrine::FETCH_ASSOC); - - $this->assertEqual($data, $resultSet); - $this->assertEqual($this->dbh->getAdapter()->count(), $count); - } - public function testAdapterStatementExecuteChecksCache() - { - $query = 'SELECT * FROM user WHERE id = ?'; - $params = array(1); - $resultSet = array(array('name' => 'John'), array('name' => 'Arnold')); - - $this->cache->getDriver()->save(md5(serialize(array($query, $params))), $resultSet); - - $count = $this->dbh->getAdapter()->count(); - - $stmt = $this->dbh->prepare($query); - $stmt->execute($params); - $data = $stmt->fetchAll(Doctrine::FETCH_ASSOC); - - $this->assertEqual($data, $resultSet); - $this->assertEqual($this->dbh->getAdapter()->count(), $count); - } - public function testFetchAdvancesCacheDataPointer() - { - $query = 'SELECT * FROM user WHERE id = ?'; - $count = $this->dbh->getAdapter()->count(); - $params = array(1); - $stmt = $this->dbh->prepare($query); - $stmt->execute($params); - - $row1 = $stmt->fetch(); - $row2 = $stmt->fetch(); - - $this->assertEqual($row1, array('name' => 'John')); - $this->assertEqual($row2, array('name' => 'Arnold')); - - $this->assertEqual($this->dbh->getAdapter()->count(), $count); - } - - public function testAdapterStatementExecuteAddsQueriesToCacheStack() - { - $stmt = $this->dbh->prepare('SELECT * FROM user'); - - $stmt->execute(); - - $this->assertEqual($this->cache->getAll(), array('main' => array('SELECT * FROM user'))); - } - public function testAdapterStatementFetchCallsCacheFetch() - { - $stmt = $this->dbh->prepare('SELECT * FROM user'); - - $stmt->execute(); - - $a = $stmt->fetchAll(); - } - public function testAdapterStatementExecuteAddsQueriesToCache() - { - $this->cache->setOption('savePropability', 1); - - $driver = $this->cache->getDriver(); - - $driver->deleteAll(); - - $this->assertEqual($driver->count(), 0); - - $stmt = $this->dbh->prepare('SELECT * FROM user WHERE id = ?'); - - $stmt->execute(array(1)); - - $this->assertEqual($driver->count(), 1); - } - public function testAppendStatsWritesQueriesToStatsFile() - { - $this->cache->setOption('addStatsPropability', 1); - - $data = array(1,2,3); - - $this->cache->add('SELECT * FROM user'); - $this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1))); - - $this->cache->appendStats(); - - $stats = $this->cache->readStats(); - - $this->assertEqual($stats[0], 'SELECT * FROM user'); - $this->assertEqual($stats[1], array('SELECT * FROM user WHERE id = ?', array(1))); - } - public function testCleanRemovesDriver() - { - $this->cache->setOption('cleanPropability', 1); - - $this->cache->add('SELECT * FROM user'); - $this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1))); - - $this->cache->appendStats(); - - $stats = $this->cache->readStats(); - - $this->assertEqual($stats[0], 'SELECT * FROM user'); - $this->assertEqual($stats[1], array('SELECT * FROM user WHERE id = ?', array(1))); - } - - public function setUp() - { - parent::setUp(); - - if ( ! isset($this->cache)) { - $this->cache = new Doctrine_Cache('Array'); - $this->cache->setOption('cacheFile', false); - $this->cache->setOption('savePropability', 0); - - $this->dbh->setAdapter(new Doctrine_Adapter_Mock()); - $this->dbh->addListener($this->cache); - } - - $this->cache->reset(); - } -} diff --git a/tests_old/CascadingDeleteTestCase.php b/tests_old/CascadingDeleteTestCase.php deleted file mode 100644 index 8a689664c..000000000 --- a/tests_old/CascadingDeleteTestCase.php +++ /dev/null @@ -1,91 +0,0 @@ -. - */ - -/** - * Doctrine_CascadingDelete_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_CascadingDelete_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - public function testCascadingDeleteEmulation() - { - $r = new ForeignKeyTest; - $r->name = 'Parent'; - $r->Children[0]->name = 'Child 1'; - $this->assertEqual($r->id, null); - $this->assertEqual($r->Children[0]->id, null); - $r->save(); - - $this->assertEqual($r->id, 1); - $this->assertEqual($r->Children[0]->id, 2); - - - $this->connection->clear(); - - $r = $this->connection->query('FROM ForeignKeyTest'); - - $this->assertEqual($r->count(), 2); - - // should delete the first child - $r[0]->delete(); - - $this->connection->clear(); - - $r = $this->connection->query('FROM ForeignKeyTest'); - - $this->assertEqual($r->count(), 0); - } - public function testCascadingDeleteEmulation2() - { - $r = new ForeignKeyTest; - $r->name = 'Parent'; - $r->Children[0]->name = 'Child 1'; - $r->Children[0]->Children[0]->name = 'Child 1 Child 1'; - $r->Children[1]->name = 'Child 2'; - $r->save(); - - $this->connection->clear(); - - $r = $this->connection->query('FROM ForeignKeyTest'); - - $this->assertEqual($r->count(), 4); - - // should delete the children recursively - $r[0]->delete(); - - $this->connection->clear(); - - $r = $this->connection->query('FROM ForeignKeyTest'); - - $this->assertEqual($r->count(), 0); - } -} diff --git a/tests_old/ClassTableInheritanceTestCase.php b/tests_old/ClassTableInheritanceTestCase.php deleted file mode 100644 index 5103fdd4a..000000000 --- a/tests_old/ClassTableInheritanceTestCase.php +++ /dev/null @@ -1,280 +0,0 @@ -. - */ - -/** - * Doctrine_ClassTableInheritance_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_ClassTableInheritance_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { } - public function prepareData() - { } - - public function testClassTableInheritanceIsTheDefaultInheritanceType() - { - $class = new CTITest(); - - $table = $class->getTable(); - - $this->assertEqual($table->getOption('joinedParents'), - array('CTITestParent4', 'CTITestParent3', 'CTITestParent2', 'CTITestParent1')); - } - - public function testExportGeneratesAllInheritedTables() - { - $sql = $this->conn->export->exportClassesSql(array('CTITest', 'CTITestOneToManyRelated')); - - $this->assertEqual($sql[0], 'CREATE TABLE c_t_i_test_parent4 (id INTEGER, age INTEGER, PRIMARY KEY(id))'); - $this->assertEqual($sql[1], 'CREATE TABLE c_t_i_test_parent3 (id INTEGER, added INTEGER, PRIMARY KEY(id))'); - $this->assertEqual($sql[2], 'CREATE TABLE c_t_i_test_parent2 (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(200), verified INTEGER)'); - - foreach ($sql as $query) { - $this->conn->exec($query); - } - } - - public function testInheritedPropertiesGetOwnerFlags() - { - $class = new CTITest(); - - $table = $class->getTable(); - - $columns = $table->getColumns(); - - $this->assertEqual($columns['verified']['owner'], 'CTITestParent2'); - $this->assertEqual($columns['name']['owner'], 'CTITestParent2'); - $this->assertEqual($columns['added']['owner'], 'CTITestParent3'); - } - - public function testNewlyCreatedRecordsHaveInheritedPropertiesInitialized() - { - $profiler = new Doctrine_Connection_Profiler(); - - $this->conn->addListener($profiler); - - $record = new CTITest(); - - $this->assertEqual($record->toArray(), array('id' => null, - 'age' => null, - 'name' => null, - 'verified' => null, - 'added' => null)); - - $record->age = 13; - $record->name = 'Jack Daniels'; - $record->verified = true; - $record->added = time(); - $record->save(); - - // pop the commit event - $p = $profiler->pop(); - var_dump($p->getQuery()); - $this->assertEqual($profiler->pop()->getQuery(), 'INSERT INTO c_t_i_test_parent4 (age, id) VALUES (?, ?)'); - // pop the prepare event - $profiler->pop(); - $this->assertEqual($profiler->pop()->getQuery(), 'INSERT INTO c_t_i_test_parent3 (added, id) VALUES (?, ?)'); - // pop the prepare event - $profiler->pop(); - $this->assertEqual($profiler->pop()->getQuery(), 'INSERT INTO c_t_i_test_parent2 (name, verified) VALUES (?, ?)'); - $this->conn->addListener(new Doctrine_EventListener()); - } - - public function testParentalJoinsAreAddedAutomaticallyWithDql() - { - $q = new Doctrine_Query(); - $q->from('CTITest c')->where('c.id = 1'); - - $this->assertEqual($q->getSql(), 'SELECT c.id AS c__id, c3.added AS c__added, c2.name AS c__name, c2.verified AS c__verified, c.age AS c__age FROM c_t_i_test_parent4 c LEFT JOIN c_t_i_test_parent2 c2 ON c.id = c2.id LEFT JOIN c_t_i_test_parent3 c3 ON c.id = c3.id WHERE c.id = 1'); - - $record = $q->fetchOne(); - - $this->assertEqual($record->id, 1); - $this->assertEqual($record->name, 'Jack Daniels'); - $this->assertEqual($record->verified, true); - $this->assertTrue(isset($record->added)); - $this->assertEqual($record->age, 13); - } - - public function testReferenfingParentColumnsUsesProperAliases() - { - $q = new Doctrine_Query(); - $q->from('CTITest c')->where("c.name = 'Jack'"); - - $this->assertEqual($q->getSql(), "SELECT c.id AS c__id, c3.added AS c__added, c2.name AS c__name, c2.verified AS c__verified, c.age AS c__age FROM c_t_i_test_parent4 c LEFT JOIN c_t_i_test_parent2 c2 ON c.id = c2.id LEFT JOIN c_t_i_test_parent3 c3 ON c.id = c3.id WHERE c2.name = 'Jack'"); - - $q = new Doctrine_Query(); - $q->from('CTITest c')->where("name = 'Jack'"); - - $this->assertEqual($q->getSql(), "SELECT c.id AS c__id, c3.added AS c__added, c2.name AS c__name, c2.verified AS c__verified, c.age AS c__age FROM c_t_i_test_parent4 c LEFT JOIN c_t_i_test_parent2 c2 ON c.id = c2.id LEFT JOIN c_t_i_test_parent3 c3 ON c.id = c3.id WHERE c2.name = 'Jack'"); - } - - public function testFetchingCtiRecordsSupportsLimitSubqueryAlgorithm() - { - $record = new CTITestOneToManyRelated; - $record->name = 'Someone'; - $record->cti_id = 1; - $record->save(); - - $this->conn->clear(); - - $q = new Doctrine_Query(); - $q->from('CTITestOneToManyRelated c')->leftJoin('c.CTITest c2')->where('c.id = 1')->limit(1); - - $record = $q->fetchOne(); - - $this->assertEqual($record->name, 'Someone'); - $this->assertEqual($record->cti_id, 1); - - $cti = $record->CTITest[0]; - - $this->assertEqual($cti->id, 1); - $this->assertEqual($cti->name, 'Jack Daniels'); - $this->assertEqual($cti->verified, true); - $this->assertTrue(isset($cti->added)); - $this->assertEqual($cti->age, 13); - } - - public function testUpdatingCtiRecordsUpdatesAllParentTables() - { - $this->conn->clear(); - - $profiler = new Doctrine_Connection_Profiler(); - $this->conn->addListener($profiler); - - $record = $this->conn->getRepository('CTITest')->find(1); - - $record->age = 11; - $record->name = 'Jack'; - $record->verified = false; - $record->added = 0; - - $record->save(); - - // pop the commit event - $profiler->pop(); - $this->assertEqual($profiler->pop()->getQuery(), 'UPDATE c_t_i_test_parent4 SET age = ? WHERE id = ?'); - // pop the prepare event - $profiler->pop(); - $this->assertEqual($profiler->pop()->getQuery(), 'UPDATE c_t_i_test_parent3 SET added = ? WHERE id = ?'); - // pop the prepare event - $profiler->pop(); - $this->assertEqual($profiler->pop()->getQuery(), 'UPDATE c_t_i_test_parent2 SET name = ?, verified = ? WHERE id = ?'); - $this->conn->addListener(new Doctrine_EventListener()); - } - - public function testUpdateOperationIsPersistent() - { - $this->conn->clear(); - - $record = $this->conn->getRepository('CTITest')->find(1); - - $this->assertEqual($record->id, 1); - $this->assertEqual($record->name, 'Jack'); - $this->assertEqual($record->verified, false); - $this->assertEqual($record->added, 0); - $this->assertEqual($record->age, 11); - } - - public function testDeleteIssuesQueriesOnAllJoinedTables() - { - $this->conn->clear(); - - $profiler = new Doctrine_Connection_Profiler(); - $this->conn->addListener($profiler); - - $record = $this->conn->getRepository('CTITest')->find(1); - - $record->delete(); - - // pop the commit event - $profiler->pop(); - $this->assertEqual($profiler->pop()->getQuery(), 'DELETE FROM c_t_i_test_parent4 WHERE id = ?'); - // pop the prepare event - $profiler->pop(); - $this->assertEqual($profiler->pop()->getQuery(), 'DELETE FROM c_t_i_test_parent3 WHERE id = ?'); - // pop the prepare event - $profiler->pop(); - $this->assertEqual($profiler->pop()->getQuery(), 'DELETE FROM c_t_i_test_parent2 WHERE id = ?'); - $this->conn->addListener(new Doctrine_EventListener()); - } -} -class CTITestParent1 extends Doctrine_Entity -{ - public function setTableDefinition() - { - $this->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, array( - 'CTITestParent1' => 1, 'CTITestParent2' => 2, - 'CTITestParent3' => 3, 'CTITestParent4' => 4, - 'CTITest' => 5)); - $this->hasColumn('name', 'string', 200); - } -} -class CTITestParent2 extends CTITestParent1 -{ - public function setTableDefinition() - { - $this->hasColumn('verified', 'boolean', 1); - } -} -class CTITestParent3 extends CTITestParent2 -{ - public function setTableDefinition() - { - $this->hasColumn('added', 'integer'); - } -} -class CTITestParent4 extends CTITestParent3 -{ - public function setTableDefinition() - { - $this->hasColumn('age', 'integer', 4); - } -} -class CTITest extends CTITestParent4 -{ - public function setTableDefinition() - { - $this->hasColumn('age2', 'integer', 4); - } -} - -class CTITestOneToManyRelated extends Doctrine_Entity -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('cti_id', 'integer'); - } - - public function setUp() - { - $this->hasMany('CTITest', array('local' => 'cti_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/Collection/SnapshotTestCase.php b/tests_old/Collection/SnapshotTestCase.php deleted file mode 100644 index 31dd96a26..000000000 --- a/tests_old/Collection/SnapshotTestCase.php +++ /dev/null @@ -1,143 +0,0 @@ -. - */ - -/** - * Doctrine_Collection_Snapshot_TestCase - * - * This test case is used for testing the snapshot functionality - * of the Doctrine_Collection - * - * Snapshots are used for counting the diff between original and changed - * state of the collection. - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Collection_Snapshot_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('Entity', 'User', 'Group', 'Groupuser', 'Account', 'Album', 'Phonenumber', 'Email', 'Book'); - - parent::prepareTables(); - } - - public function testDiffForSimpleCollection() - { - $q = Doctrine_Query::create()->from('User u')->orderby('u.id'); - - $coll = $q->execute(); - $this->assertEqual($coll->count(), 8); - - unset($coll[0]); - unset($coll[1]); - - $coll[]->name = 'new user'; - - $this->assertEqual($coll->count(), 7); - $this->assertEqual(count($coll->getSnapshot()), 8); - - $count = $this->conn->count(); - - $coll->save(); - - $this->connection->clear(); - $coll = Doctrine_Query::create()->from('User u')->execute(); - $this->assertEqual($coll->count(), 7); - } - - public function testDiffForOneToManyRelatedCollection() - { - $q = new Doctrine_Query(); - $q->from('User u LEFT JOIN u.Phonenumber p') - ->where('u.id = 8'); - - $coll = $q->execute(); - - $this->assertEqual($coll->count(), 1); - - $this->assertEqual($coll[0]->Phonenumber->count(), 3); - $this->assertTrue($coll[0]->Phonenumber instanceof Doctrine_Collection); - - unset($coll[0]->Phonenumber[0]); - $coll[0]->Phonenumber->remove(2); - - $this->assertEqual(count($coll[0]->Phonenumber->getSnapshot()), 3); - $coll[0]->save(); - - $this->assertEqual($coll[0]->Phonenumber->count(), 1); - - $this->connection->clear(); - - $q = new Doctrine_Query(); - $q = Doctrine_Query::create()->from('User u LEFT JOIN u.Phonenumber p')->where('u.id = 8'); - - $coll = $q->execute(); - - $this->assertEqual($coll[0]->Phonenumber->count(), 1); - - } - - public function testDiffForManyToManyRelatedCollection() - { - $user = new User(); - $user->name = 'zYne'; - $user->Group[0]->name = 'PHP'; - $user->Group[1]->name = 'Web'; - $user->save(); - - $this->connection->clear(); - - $users = Doctrine_Query::create()->from('User u LEFT JOIN u.Group g') - ->where('u.id = ' . $user->id)->execute(); - - $this->assertEqual($users[0]->Group[0]->name, 'PHP'); - $this->assertEqual($users[0]->Group[1]->name, 'Web'); - $this->assertEqual(count($user->Group->getSnapshot()), 2); - unset($user->Group[0]); - - $user->save(); - $this->assertEqual(count($user->Group), 1); - - $this->assertEqual(count($user->Group->getSnapshot()), 1); - unset($user->Group[1]); - $this->assertEqual(count($user->Group->getSnapshot()), 1); - - $count = count($this->conn); - $user->save(); - - $this->assertEqual(count($user->Group->getSnapshot()), 0); - - $this->conn->clear(); - - $users = Doctrine_Query::create()->from('User u LEFT JOIN u.Group g') - ->where('u.id = ' . $user->id)->execute(); - - $this->assertEqual(count($user->Group), 0); - - } - -} diff --git a/tests_old/CollectionOffsetTestCase.php b/tests_old/CollectionOffsetTestCase.php deleted file mode 100644 index 2a6afaac1..000000000 --- a/tests_old/CollectionOffsetTestCase.php +++ /dev/null @@ -1,77 +0,0 @@ -connection->query("FROM User-o"); - $this->assertTrue($users instanceof Doctrine_Collection_Offset); - - $this->assertEqual(count($users), 5); - $users[5]; - - $this->assertEqual($users[5]->getState(), Doctrine_Entity::STATE_CLEAN); - $users[5]; - - $this->connection->setAttribute(Doctrine::ATTR_COLL_LIMIT, 3); - - $users = $this->connection->query("FROM User-o"); - $this->assertEqual(count($users), 3); - $this->assertEqual($users[0]->getState(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($users[1]->getState(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($users[2]->getState(), Doctrine_Entity::STATE_CLEAN); - // indexes 0,1,2 in use - - $users[7]; - $this->assertEqual(count($users), 5); - $this->assertFalse($users->contains(3)); - $this->assertFalse($users->contains(4)); - $this->assertFalse($users->contains(5)); - $this->assertTrue($users->contains(6)); - $this->assertTrue($users->contains(7)); - - $this->assertEqual($users[6]->getState(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($users[7]->getState(), Doctrine_Entity::STATE_CLEAN); - - - $users[5]; - $this->assertEqual(count($users), 8); - $this->assertEqual($users[3]->getState(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($users[4]->getState(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($users[5]->getState(), Doctrine_Entity::STATE_CLEAN); - - - $this->connection->setAttribute(Doctrine::ATTR_COLL_LIMIT, 1); - $idFieldNames = (array)$this->objTable->getIdentifier(); - $users = $this->connection->query("FROM User-b, User.Phonenumber-o WHERE User.".$idFieldNames[0]." = 5"); - - $this->assertEqual(count($users), 1); - - $coll = $users[0]->Phonenumber; - $this->assertEqual(count($coll), 3); - $coll[1]; - - $this->assertEqual(count($coll), 3); - $this->assertEqual($coll[1]->phonenumber, "456 456"); - - } - - public function testGetIterator() { - $this->connection->setAttribute(Doctrine::ATTR_COLL_LIMIT, 4); - $coll = $this->connection->query("FROM User-o"); - - foreach($coll as $user) { - } - $this->assertEqual($coll->count(), 8); - $this->assertEqual($coll[3]->getState(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($coll[6]->getState(), Doctrine_Entity::STATE_CLEAN); - - $this->connection->setAttribute(Doctrine::ATTR_COLL_LIMIT, 3); - - $coll = $this->connection->query("FROM User-o"); - - foreach($coll as $user) { - } - $this->assertEqual($coll->count(), 8); - $this->assertEqual($coll[3]->getState(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($coll[6]->getState(), Doctrine_Entity::STATE_CLEAN); - } -} diff --git a/tests_old/CollectionTestCase.php b/tests_old/CollectionTestCase.php deleted file mode 100644 index c592d646d..000000000 --- a/tests_old/CollectionTestCase.php +++ /dev/null @@ -1,332 +0,0 @@ -. - */ - -/** - * Doctrine_Collection_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Collection_TestCase extends Doctrine_UnitTestCase -{ - /** - public function testLoadRelatedForAssociation() - { - $coll = $this->connection->query('FROM User'); - - $this->assertEqual($coll->count(), 8); - - $coll[0]->Group[1]->name = 'Actors House 2'; - - $coll[0]->Group[2]->name = 'Actors House 3'; - - $coll[2]->Group[0]->name = 'Actors House 4'; - $coll[2]->Group[1]->name = 'Actors House 5'; - $coll[2]->Group[2]->name = 'Actors House 6'; - - $coll[5]->Group[0]->name = 'Actors House 7'; - $coll[5]->Group[1]->name = 'Actors House 8'; - $coll[5]->Group[2]->name = 'Actors House 9'; - - $coll->save(); - - $this->connection->clear(); - - $coll = $this->connection->query('FROM User'); - - $this->assertEqual($coll->count(), 8); - $this->assertEqual($coll[0]->Group->count(), 2); - $this->assertEqual($coll[1]->Group->count(), 1); - $this->assertEqual($coll[2]->Group->count(), 3); - $this->assertEqual($coll[5]->Group->count(), 3); - - $this->connection->clear(); - - $coll = $this->connection->query('FROM User'); - - $this->assertEqual($coll->count(), 8); - - $count = $this->dbh->count(); - - $coll->loadRelated('Group'); - $this->assertEqual(($count + 1), $this->dbh->count()); - $this->assertEqual($coll[0]->Group->count(), 2); - $this->assertEqual(($count + 1), $this->dbh->count()); - $this->assertEqual($coll[1]->Group->count(), 1); - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->assertEqual($coll[2]->Group->count(), 3); - - $this->assertEqual(($count + 1), $this->dbh->count()); - $this->assertEqual($coll[5]->Group->count(), 3); - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->connection->clear(); - } - public function testOffsetGetWithNullArgumentReturnsNewRecord() - { - $coll = new Doctrine_Collection('User'); - $this->assertEqual($coll->count(), 0); - - $coll[]->name = 'zYne'; - - $this->assertEqual($coll->count(), 1); - $this->assertEqual($coll[0]->name, 'zYne'); - } - - - public function testLoadRelatedForNormalAssociation() - { - $resource = new Doctrine_Collection('Resource'); - $resource[0]->name = 'resource 1'; - $resource[0]->Type[0]->type = 'type 1'; - $resource[0]->Type[1]->type = 'type 2'; - $resource[1]->name = 'resource 2'; - $resource[1]->Type[0]->type = 'type 3'; - $resource[1]->Type[1]->type = 'type 4'; - - $resource->save(); - - $this->connection->clear(); - - $resources = $this->connection->query('FROM Resource'); - - $count = $this->dbh->count(); - $resources->loadRelated('Type'); - - $this->assertEqual(($count + 1), $this->dbh->count()); - $this->assertEqual($resources[0]->name, 'resource 1'); - $this->assertEqual($resource[0]->Type[0]->type, 'type 1'); - $this->assertEqual($resource[0]->Type[1]->type, 'type 2'); - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->assertEqual($resource[1]->name, 'resource 2'); - $this->assertEqual($resource[1]->Type[0]->type, 'type 3'); - $this->assertEqual($resource[1]->Type[1]->type, 'type 4'); - $this->assertEqual(($count + 1), $this->dbh->count()); - } - */ - public function testAdd() - { - $coll = new Doctrine_Collection($this->objTable); - $coll->add(new User()); - $this->assertEqual($coll->count(),1); - $coll->add(new User()); - $this->assertTrue($coll->count(),2); - - $this->assertEqual($coll->getKeys(), array(0,1)); - - $coll[2] = new User(); - - $this->assertTrue($coll->count(),3); - $this->assertEqual($coll->getKeys(), array(0,1,2)); - } - - - public function testLoadRelated() - { - $coll = $this->connection->query('FROM User(id)'); - - $q = $coll->loadRelated(); - - $this->assertTrue($q instanceof Doctrine_Query); - - $q->addFrom('User.Group'); - - $coll2 = $q->execute($coll->getPrimaryKeys()); - $this->assertEqual($coll2->count(), $coll->count()); - - $count = $this->dbh->count(); - $coll[0]->Group[0]; - $this->assertEqual($count, $this->dbh->count()); - } - public function testLoadRelatedForLocalKeyRelation() - { - $coll = $this->connection->query('FROM User'); - - $this->assertEqual($coll->count(), 8); - - $count = $this->dbh->count(); - $coll->loadRelated('Email'); - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->assertEqual($coll[0]->Email->address, 'zYne@example.com'); - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->assertEqual($coll[2]->Email->address, 'caine@example.com'); - - $this->assertEqual($coll[3]->Email->address, 'kitano@example.com'); - - $this->assertEqual($coll[4]->Email->address, 'stallone@example.com'); - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->connection->clear(); - } - public function testLoadRelatedForForeignKey() - { - $coll = $this->connection->query("FROM User"); - $this->assertEqual($coll->count(), 8); - - $count = $this->dbh->count(); - $coll->loadRelated("Phonenumber"); - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->assertEqual($coll[0]->Phonenumber[0]->phonenumber, "123 123"); - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $coll[0]->Phonenumber[1]->phonenumber; - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->assertEqual($coll[4]->Phonenumber[0]->phonenumber, "111 555 333"); - $this->assertEqual($coll[4]["Phonenumber"][1]->phonenumber, "123 213"); - $this->assertEqual($coll[4]["Phonenumber"][2]->phonenumber, "444 555"); - - $this->assertEqual($coll[5]->Phonenumber[0]->phonenumber, "111 222 333"); - - - $this->assertEqual($coll[6]->Phonenumber[0]->phonenumber, "111 222 333"); - $this->assertEqual($coll[6]["Phonenumber"][1]->phonenumber, "222 123"); - $this->assertEqual($coll[6]["Phonenumber"][2]->phonenumber, "123 456"); - - $this->assertEqual(($count + 1), $this->dbh->count()); - - $this->connection->clear(); - } - public function testCount() - { - $coll = new Doctrine_Collection($this->connection->getTable('User')); - $this->assertEqual($coll->count(), 0); - $coll[0]; - $this->assertEqual($coll->count(), 1); - } - public function testExpand() - { - $users = $this->connection->query("FROM User.Phonenumber WHERE User.Phonenumber.phonenumber LIKE '%123%'"); - - $this->assertTrue($users instanceof Doctrine_Collection_Batch); - $this->assertTrue($users[1] instanceof User); - $this->assertTrue($users[1]->Phonenumber instanceof Doctrine_Collection_Lazy); - $data = $users[1]->Phonenumber->getData(); - - $coll = $users[1]->Phonenumber; - - $this->assertEqual(count($data), 1); - - foreach($coll as $record) { - $record->phonenumber; - } - - $coll[1]; - - $this->assertEqual(count($coll), 3); - - $this->assertEqual($coll[2]->state(), Doctrine_Entity::STATE_PROXY); - - - - $coll->setKeyField('id'); - $user = $this->connection->getTable("User")->find(4); - - } - public function testGenerator() - { - $coll = new Doctrine_Collection($this->objTable); - $coll->setKeyField('name'); - - $user = new User(); - $user->name = "name"; - $coll->add($user); - - $this->assertEqual($coll["name"], $user); - - - $this->connection->getTable("email")->setAttribute(Doctrine::ATTR_COLL_KEY,"address"); - $emails = $this->connection->getTable("email")->findAll(); - foreach($emails as $k => $v) { - $this->assertTrue(gettype($k), "string"); - } - - } - public function testFetchCollectionWithIdAsIndex() - { - $user = new User(); - $user->attribute(Doctrine::ATTR_COLL_KEY, 'id'); - - $users = $user->getTable()->findAll(); - $this->assertFalse($users->contains(0)); - $this->assertEqual($users->count(), 8); - - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_TCLEAN); - $this->assertEqual($users[4]->state(), Doctrine_Entity::STATE_CLEAN); - } - public function testFetchCollectionWithNameAsIndex() - { - $user = new User(); - $user->attribute(Doctrine::ATTR_COLL_KEY, 'name'); - - $users = $user->getTable()->findAll(); - $this->assertFalse($users->contains(0)); - $this->assertEqual($users->count(), 8); - - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_TCLEAN); - $this->assertEqual($users['zYne']->state(), Doctrine_Entity::STATE_CLEAN); - } - public function testFetchMultipleCollections() - { - $this->connection->clear(); - - $user = new User(); - $user->attribute(Doctrine::ATTR_COLL_KEY, 'id'); - $phonenumber = new Phonenumber(); - $phonenumber->attribute(Doctrine::ATTR_COLL_KEY, 'id'); - - - $q = new Doctrine_Query(); - $users = $q->from('User.Phonenumber')->execute(); - $this->assertFalse($users->contains(0)); - $this->assertEqual($users->count(), 8); - - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_TCLEAN); - $this->assertEqual($users[2]->state(), Doctrine_Entity::STATE_TCLEAN); - $this->assertEqual($users[3]->state(), Doctrine_Entity::STATE_TCLEAN); - $this->assertEqual($users[4]->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($users[4]->name, 'zYne'); - - $this->assertEqual($users[4]->Phonenumber[0]->exists(), false); - $this->assertEqual($users[4]->Phonenumber[0]->state(), Doctrine_Entity::STATE_TDIRTY); - $this->assertEqual($users[4]->Phonenumber[1]->exists(), false); - $this->assertEqual($users[4]->Phonenumber[2]->state(), Doctrine_Entity::STATE_CLEAN); - } - -} diff --git a/tests_old/ColumnAggregationInheritanceTestCase.php b/tests_old/ColumnAggregationInheritanceTestCase.php deleted file mode 100644 index 3873aec24..000000000 --- a/tests_old/ColumnAggregationInheritanceTestCase.php +++ /dev/null @@ -1,74 +0,0 @@ -. - */ - -/** - * Doctrine_ColumnAggregationInheritance_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @author Bjarte Stien Karlsen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_ColumnAggregationInheritance_TestCase extends Doctrine_UnitTestCase -{ - protected $otherEntity = null; - - /*public function prepareTables() - { - - }*/ - - public function prepareData() - { - //we create a test entity that is not a user and not a group - $entity = new Group(); - $entity->name='Other Entity'; - $entity->save(); - } - - public function testSubclassReturnedIfInheritanceMatches() - { - $q = new Doctrine_Query(); - //echo $q->from('Entity e')->getSql(); - $group = $q->from('Entity e')->execute()->getFirst(); - $this->assertTrue($group instanceOf Group); - } - public function testStringColumnInheritance() - { - $q = new Doctrine_Query(); - $q->select('g.name')->from('Group g'); - $this->assertEqual($q->getSql(), "SELECT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 1)"); - } - - public function testSubclassFieldSetWhenCreatingNewSubclassedRecord() - { - $child = new User(); - $child->name = 'Pedro'; - $this->assertTrue(isset($child->type)); - - $child->save(); - $this->assertEqual($child->type, '0'); - } -} diff --git a/tests_old/ColumnAliasTestCase.php b/tests_old/ColumnAliasTestCase.php deleted file mode 100644 index 59fb81001..000000000 --- a/tests_old/ColumnAliasTestCase.php +++ /dev/null @@ -1,155 +0,0 @@ -. - */ - -/** - * Doctrine_ColumnAlias_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_ColumnAlias_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { - $book1 = new Book(); - $book1->name = 'Das Boot'; - $book1->save(); - - $record1 = new ColumnAliasTest(); - $record1->alias1 = 'first'; - $record1->alias2 = 123; - $record1->anotherField = 'camelCase'; - $record1->bookId = $book1->id; - $record1->save(); - - $record2 = new ColumnAliasTest(); - $record2->alias1 = 'one'; - $record2->alias2 = 456; - $record2->anotherField = 'KoQ'; - $record2->save(); - - $record2->anotherField = 'foo'; - } - - public function prepareTables() - { - $this->tables = array('ColumnAliasTest', 'Book'); - - parent::prepareTables(); - } - - public function testAliasesAreSupportedForJoins() - { - $q = new Doctrine_Query(); - $q->select('c.*, b.name')->from('ColumnAliasTest c') - ->innerJoin('c.book b') - ->where('c.anotherField = ?', 'camelCase'); - $result = $q->execute(); - $this->assertTrue(isset($result[0]->book)); - $this->assertEqual($result[0]->book->name, 'Das Boot'); - } - - public function testAliasesAreSupportedForArrayFetching() - { - $q = new Doctrine_Query(); - $q->select('c.*, b.name')->from('ColumnAliasTest c') - ->innerJoin('c.book b') - ->where('c.anotherField = ?', 'camelCase') - ->setHydrationMode(Doctrine::HYDRATE_ARRAY); - $result = $q->execute(); - $this->assertEqual($result[0]['alias1'], 'first'); - $this->assertEqual($result[0]['alias2'], 123); - $this->assertEqual($result[0]['anotherField'], 'camelCase'); - $this->assertTrue(isset($result[0]['book'])); - $this->assertEqual($result[0]['book']['name'], 'Das Boot'); - } - - public function testAliasesAreSupportedForRecordPropertyAccessors() - { - $record = new ColumnAliasTest; - try { - $record->alias1 = 'someone'; - $record->alias2 = 187; - - $this->assertEqual($record->alias1, 'someone'); - $this->assertEqual($record->alias2, 187); - } catch (Doctrine_Record_Exception $e) { - $this->fail(); - } - } - - public function testAliasesAreSupportedForDqlSelectPart() - { - $q = new Doctrine_Query(); - $q->select('c.alias1, c.alias2, c.anotherField')->from('ColumnAliasTest c'); - $coll = $q->execute(); - - $this->assertEqual($coll[0]->alias1, 'first'); - $this->assertEqual($coll[0]->alias2, 123); - $this->assertEqual($coll[0]->anotherField, 'camelCase'); - } - - public function testAliasesAreSupportedForDqlWherePart() - { - $q = new Doctrine_Query(); - - $q->select('c.alias1, c.alias2, c.anotherField') - ->from('ColumnAliasTest c') - ->where('c.anotherField = ?'); - - $coll = $q->execute(array('KoQ')); - - $this->assertEqual($coll[0]->alias1, 'one'); - $this->assertEqual($coll[0]->alias2, 456); - $this->assertEqual($coll[0]->anotherField, 'KoQ'); - } - - public function testAliasesAreSupportedForDqlAggregateFunctions() - { - $q = new Doctrine_Query(); - - $q->select('MAX(c.alias2)')->from('ColumnAliasTest c'); - - $coll = $q->execute(); - - $this->assertEqual($coll[0]->MAX, 456); - } - - public function testAliasesAreSupportedForDqlHavingPart() - { - $q = new Doctrine_Query(); - - $q->select('c.alias2') - ->from('ColumnAliasTest c') - ->groupby('c.id') - ->having('c.alias2 > 123'); - - $coll = $q->execute(); - - $this->assertEqual($coll[0]->alias2, 456); - } -} - diff --git a/tests_old/CompositePrimaryKeyTestCase.php b/tests_old/CompositePrimaryKeyTestCase.php deleted file mode 100644 index ca9668902..000000000 --- a/tests_old/CompositePrimaryKeyTestCase.php +++ /dev/null @@ -1,13 +0,0 @@ -tables = array(); - $this->tables[] = "CPK_Test"; - $this->tables[] = "CPK_Test2"; - $this->tables[] = "CPK_Association"; - - parent::prepareTables(); - } -} diff --git a/tests_old/ConfigurableTestCase.php b/tests_old/ConfigurableTestCase.php deleted file mode 100644 index 7ba88785d..000000000 --- a/tests_old/ConfigurableTestCase.php +++ /dev/null @@ -1,180 +0,0 @@ -assertEqual($this->manager->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT), '%s_idx'); - } - public function testGetSequenceNameFormatAttribute() { - // default sequence name format is %_seq - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT), '%s_seq'); - } - public function testSetIndexNameFormatAttribute() { - $this->manager->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%_index'); - - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT), '%_index'); - } - public function testSetSequenceNameFormatAttribute() { - $this->manager->setAttribute(Doctrine::ATTR_SEQNAME_FORMAT, '%_sequence'); - - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT), '%_sequence'); - } - public function testExceptionIsThrownWhenSettingIndexNameFormatAttributeAtTableLevel() { - try { - $this->connection->getTable('Entity')->setAttribute(Doctrine::ATTR_IDXNAME_FORMAT, '%s_idx'); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } - public function testExceptionIsThrownWhenSettingSequenceNameFormatAttributeAtTableLevel() { - try { - $this->connection->getTable('Entity')->setAttribute(Doctrine::ATTR_SEQNAME_FORMAT, '%s_seq'); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } - public function testSettingFieldCaseIsSuccesfulWithZero() { - try { - $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, 0); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - } - public function testSettingFieldCaseIsSuccesfulWithCaseConstants() { - try { - $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, CASE_LOWER); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - } - public function testSettingFieldCaseIsSuccesfulWithCaseConstants2() { - try { - $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, CASE_UPPER); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - } - public function testExceptionIsThrownWhenSettingFieldCaseToNotZeroOneOrTwo() { - try { - $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, -1); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } - public function testExceptionIsThrownWhenSettingFieldCaseToNotZeroOneOrTwo2() { - try { - $this->connection->setAttribute(Doctrine::ATTR_FIELD_CASE, 5); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } - public function testDefaultQuoteIdentifierAttributeValueIsFalse() { - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER), false); - } - public function testQuoteIdentifierAttributeAcceptsBooleans() { - $this->manager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER), true); - $this->manager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - } - public function testDefaultSequenceColumnNameAttributeValueIsId() { - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQCOL_NAME), 'id'); - } - public function testSequenceColumnNameAttributeAcceptsStrings() { - $this->manager->setAttribute(Doctrine::ATTR_SEQCOL_NAME, 'sequence'); - - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_SEQCOL_NAME), 'sequence'); - } - public function testValidatorAttributeAcceptsBooleans() { - $this->manager->setAttribute(Doctrine::ATTR_VLD, true); - - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_VLD), true); - } - public function testAutoLengthValidationAttributeAcceptsBooleans() { - $this->manager->setAttribute(Doctrine::ATTR_AUTO_LENGTH_VLD, true); - - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_AUTO_LENGTH_VLD), true); - } - public function testAutoTypeValidationAttributeAcceptsBooleans() { - $this->manager->setAttribute(Doctrine::ATTR_AUTO_TYPE_VLD, true); - - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_AUTO_TYPE_VLD), true); - } - public function testDefaultPortabilityAttributeValueIsAll() { - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_PORTABILITY), Doctrine::PORTABILITY_ALL); - } - public function testPortabilityAttributeAcceptsPortabilityConstants() { - $this->manager->setAttribute(Doctrine::ATTR_PORTABILITY, Doctrine::PORTABILITY_RTRIM | Doctrine::PORTABILITY_FIX_CASE); - - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_PORTABILITY), - Doctrine::PORTABILITY_RTRIM | Doctrine::PORTABILITY_FIX_CASE); - } - public function testDefaultListenerIsDoctrineEventListener() { - $this->assertTrue($this->manager->getAttribute(Doctrine::ATTR_LISTENER) instanceof Doctrine_EventListener); - } - public function testListenerAttributeAcceptsEventListenerObjects() { - $this->manager->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_Debugger()); - - $this->assertTrue($this->manager->getAttribute(Doctrine::ATTR_LISTENER) instanceof Doctrine_EventListener_Debugger); - } - public function testCollectionKeyAttributeAcceptsValidColumnName() { - try { - $this->connection->getTable('User')->setAttribute(Doctrine::ATTR_COLL_KEY, 'name'); - - $this->pass(); - } catch(Exception $e) { - $this->fail(); - } - } - public function testSettingInvalidColumnNameToCollectionKeyAttributeThrowsException() { - try { - $this->connection->getTable('User')->setAttribute(Doctrine::ATTR_COLL_KEY, 'unknown'); - - $this->fail(); - } catch(Exception $e) { - $this->pass(); - } - } - public function testSettingCollectionKeyAttributeOnOtherThanTableLevelThrowsException() { - try { - $this->connection->setAttribute(Doctrine::ATTR_COLL_KEY, 'name'); - - $this->fail(); - } catch(Exception $e) { - $this->pass(); - } - } - public function testSetAttribute() { - $table = $this->connection->getTable("User"); - /** - $this->manager->setAttribute(Doctrine::ATTR_CACHE_TTL,100); - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_TTL),100); - - $this->manager->setAttribute(Doctrine::ATTR_CACHE_SIZE,1); - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_SIZE),1); - - $this->manager->setAttribute(Doctrine::ATTR_CACHE_DIR,"%ROOT%".DIRECTORY_SEPARATOR."cache"); - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_DIR),$this->manager->getRoot().DIRECTORY_SEPARATOR."cache"); - */ - $this->manager->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_LAZY); - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_FETCHMODE),Doctrine::FETCH_LAZY); - - $this->manager->setAttribute(Doctrine::ATTR_BATCH_SIZE, 5); - $this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_BATCH_SIZE),5); - - } - public function testGetAttributes() { - $this->assertTrue(is_array($this->manager->getAttributes())); - } -} diff --git a/tests_old/Connection/FirebirdTestCase.php b/tests_old/Connection/FirebirdTestCase.php deleted file mode 100644 index 2c77ce1a3..000000000 --- a/tests_old/Connection/FirebirdTestCase.php +++ /dev/null @@ -1,60 +0,0 @@ -exc->processErrorInfo(array(0,0, 'no such table: test1')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - public function testNoSuchIndexErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'no such index: test1')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOT_FOUND); - } - public function testUniquePrimaryKeyErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'PRIMARY KEY must be unique')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testIsNotUniqueErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'is not unique')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testColumnsNotUniqueErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'columns name, id are not unique')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testUniquenessConstraintErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'uniqueness constraint failed')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testNotNullConstraintErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'may not be NULL')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT_NOT_NULL); - } - public function testNoSuchFieldErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'no such column: column1')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - public function testColumnNotPresentInTablesErrorIsSupported2() { - $this->exc->processErrorInfo(array(0,0, 'column not present in both tables')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - public function testNearSyntaxErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, "near \"SELECT FROM\": syntax error")); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - public function testValueCountOnRowErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, '3 values for 2 columns')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_VALUE_COUNT_ON_ROW); - } - */ -} diff --git a/tests_old/Connection/InformixTestCase.php b/tests_old/Connection/InformixTestCase.php deleted file mode 100644 index 274c42638..000000000 --- a/tests_old/Connection/InformixTestCase.php +++ /dev/null @@ -1,4 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_Mssql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_Mssql_TestCase extends Doctrine_UnitTestCase { - public function testAlreadyExistsErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 2714, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - public function testAlreadyExistsErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1913, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - public function testValueCountOnRowErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 110, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_VALUE_COUNT_ON_ROW); - } - public function testNoSuchFieldErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 155, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - public function testNoSuchFieldErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 207, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - public function testNoSuchTableErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 208, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - public function testNoSuchTableErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 3701, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - public function testSyntaxErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 170, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - public function testInvalidNumberErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 245, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID_NUMBER); - } - public function testNotNullConstraintErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 515, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT_NOT_NULL); - } - public function testConstraintErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 547, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testConstraintErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 2627, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testDivZeroErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 8134, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_DIVZERO); - } -} diff --git a/tests_old/Connection/MysqlTestCase.php b/tests_old/Connection/MysqlTestCase.php deleted file mode 100644 index aca2dea13..000000000 --- a/tests_old/Connection/MysqlTestCase.php +++ /dev/null @@ -1,153 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_Mysql_TestCase extends Doctrine_UnitTestCase { - public function testQuoteIdentifier() { - $id = $this->connection->quoteIdentifier('identifier', false); - $this->assertEqual($id, '`identifier`'); - } - public function testNotLockedErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1100, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOT_LOCKED); - } - public function testNotFoundErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1091, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOT_FOUND); - } - public function testSyntaxErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1064, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - public function testNoSuchDbErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1049, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHDB); - } - public function testNoSuchFieldErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1054, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - public function testNoSuchTableErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1051, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - public function testNoSuchTableErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1146, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - public function testConstraintErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1048, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testConstraintErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1216, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testConstraintErrorIsSupported3() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1217, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testNoDbSelectedErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1046, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NODBSELECTED); - } - public function testAccessViolationErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1142, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ACCESS_VIOLATION); - } - public function testAccessViolationErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1044, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ACCESS_VIOLATION); - } - public function testCannotDropErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1008, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CANNOT_DROP); - } - public function testCannotCreateErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1004, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CANNOT_CREATE); - } - public function testCannotCreateErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1005, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CANNOT_CREATE); - } - public function testCannotCreateErrorIsSupported3() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1006, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CANNOT_CREATE); - } - public function testAlreadyExistsErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1007, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - public function testAlreadyExistsErrorIsSupported2() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1022, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - public function testAlreadyExistsErrorIsSupported3() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1050, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - public function testAlreadyExistsErrorIsSupported4() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1061, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - public function testAlreadyExistsErrorIsSupported5() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1062, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - public function testValueCountOnRowErrorIsSupported() { - $this->assertTrue($this->exc->processErrorInfo(array(0, 1136, ''))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_VALUE_COUNT_ON_ROW); - } -} diff --git a/tests_old/Connection/OracleTestCase.php b/tests_old/Connection/OracleTestCase.php deleted file mode 100644 index 85bce1308..000000000 --- a/tests_old/Connection/OracleTestCase.php +++ /dev/null @@ -1,124 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_Oracle_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_Oracle_TestCase extends Doctrine_UnitTestCase { - public function testNoSuchTableErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 942, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - public function testSyntaxErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 900, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - public function testSyntaxErrorIsSupported2() { - $this->exc->processErrorInfo(array(0, 921, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - public function testSyntaxErrorIsSupported3() { - $this->exc->processErrorInfo(array(0, 923, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - public function testNoSuchFieldErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 904, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - public function testConstraintErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 1, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testConstraintErrorIsSupported2() { - $this->exc->processErrorInfo(array(0, 2291, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testConstraintErrorIsSupported3() { - $this->exc->processErrorInfo(array(0, 2449, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testConstraintErrorIsSupported4() { - $this->exc->processErrorInfo(array(0, 2292, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testNoSuchTableErrorIsSupported4() { - $this->exc->processErrorInfo(array(0, 2289, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - public function testInvalidNumberErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 1722, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID_NUMBER); - } - public function testDivZeroErrorIsSupported1() { - $this->exc->processErrorInfo(array(0, 1476, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_DIVZERO); - } - public function testNotFoundErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 1418, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOT_FOUND); - } - public function testNotNullConstraintErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 1400, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT_NOT_NULL); - } - public function testNotNullConstraintErrorIsSupported2() { - $this->exc->processErrorInfo(array(0, 1407, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT_NOT_NULL); - } - public function testInvalidErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 1401, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID); - } - public function testAlreadyExistsErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 955, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - public function testValueCountOnRowErrorIsSupported() { - $this->exc->processErrorInfo(array(0, 913, '')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_VALUE_COUNT_ON_ROW); - } -} diff --git a/tests_old/Connection/PgsqlTestCase.php b/tests_old/Connection/PgsqlTestCase.php deleted file mode 100644 index 0c13d8128..000000000 --- a/tests_old/Connection/PgsqlTestCase.php +++ /dev/null @@ -1,217 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_Pgsql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_Pgsql_TestCase extends Doctrine_UnitTestCase -{ - - public function testNoSuchTableErrorIsSupported() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'table test does not exist'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - - public function testNoSuchTableErrorIsSupported2() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'relation does not exist'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - - public function testNoSuchTableErrorIsSupported3() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'sequence does not exist'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - - public function testNoSuchTableErrorIsSupported4() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'class xx not found'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - - public function testSyntaxErrorIsSupported() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'parser: parse error at or near'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - - public function testSyntaxErrorIsSupported2() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'syntax error at'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - - public function testSyntaxErrorIsSupported3() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'column reference r.r is ambiguous'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - - public function testInvalidNumberErrorIsSupported() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'pg_atoi: error in somewhere: can\'t parse '))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID_NUMBER); - } - - public function testInvalidNumberErrorIsSupported2() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'value unknown is out of range for type bigint'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID_NUMBER); - } - - public function testInvalidNumberErrorIsSupported3() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'integer out of range'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID_NUMBER); - } - - public function testInvalidNumberErrorIsSupported4() - { - $this->assertTrue($this->exc->processErrorInfo(array(0, 0, 'invalid input syntax for type integer'))); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID_NUMBER); - } - - public function testNoSuchFieldErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'column name (of relation xx) does not exist')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - - public function testNoSuchFieldErrorIsSupported2() - { - $this->exc->processErrorInfo(array(0, 0, 'attribute xx not found')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - - public function testNoSuchFieldErrorIsSupported3() - { - $this->exc->processErrorInfo(array(0, 0, 'relation xx does not have attribute')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - - public function testNoSuchFieldErrorIsSupported4() - { - $this->exc->processErrorInfo(array(0, 0, 'column xx specified in USING clause does not exist in left table')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - - public function testNoSuchFieldErrorIsSupported5() - { - $this->exc->processErrorInfo(array(0, 0, 'column xx specified in USING clause does not exist in right table')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - - public function testNotFoundErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'index xx does not exist/')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOT_FOUND); - } - - public function testNotNullConstraintErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'violates not-null constraint')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT_NOT_NULL); - } - - public function testConstraintErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'referential integrity violation')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - - public function testConstraintErrorIsSupported2() - { - $this->exc->processErrorInfo(array(0, 0, 'violates xx constraint')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - - public function testInvalidErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'value too long for type character')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID); - } - - public function testAlreadyExistsErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'relation xx already exists')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS); - } - - public function testDivZeroErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'division by zero')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_DIVZERO); - } - - public function testDivZeroErrorIsSupported2() - { - $this->exc->processErrorInfo(array(0, 0, 'divide by zero')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_DIVZERO); - } - - public function testAccessViolationErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'permission denied')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ACCESS_VIOLATION); - } - - public function testValueCountOnRowErrorIsSupported() - { - $this->exc->processErrorInfo(array(0, 0, 'more expressions than target columns')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_VALUE_COUNT_ON_ROW); - } -} diff --git a/tests_old/Connection/ProfilerTestCase.php b/tests_old/Connection/ProfilerTestCase.php deleted file mode 100644 index c23c491ba..000000000 --- a/tests_old/Connection/ProfilerTestCase.php +++ /dev/null @@ -1,183 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_Profiler_TestCase - * - * @package Doctrine - * @subpackage Doctrine_Db - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_Profiler_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - {} - public function prepareData() - {} - public function setUp() - {} - - public function testQuery() - { - $this->conn = Doctrine_Manager::getInstance()->openConnection(array('sqlite::memory:')); - - $this->profiler = new Doctrine_Connection_Profiler(); - - $this->conn->setListener($this->profiler); - - $this->conn->exec('CREATE TABLE test (id INT)'); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'CREATE TABLE test (id INT)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::CONN_EXEC); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->conn->count(), 1); - } - - public function testPrepareAndExecute() - { - - $stmt = $this->conn->prepare('INSERT INTO test (id) VALUES (?)'); - $event = $this->profiler->lastEvent(); - - $this->assertEqual($event->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::CONN_PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $stmt->execute(array(1)); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::STMT_EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->conn->count(), 2); - } - - public function testMultiplePrepareAndExecute() - { - - $stmt = $this->conn->prepare('INSERT INTO test (id) VALUES (?)'); - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::CONN_PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $stmt2 = $this->conn->prepare('INSERT INTO test (id) VALUES (?)'); - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::CONN_PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - /** TODO: strange errors here - $stmt->execute(array(1)); - $stmt2->execute(array(1)); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->conn->count(), 4); - */ - } - - public function testExecuteStatementMultipleTimes() - { - try { - $stmt = $this->conn->prepare('INSERT INTO test (id) VALUES (?)'); - $stmt->execute(array(1)); - $stmt->execute(array(1)); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::STMT_EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::STMT_EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } - - public function testTransactionRollback() - { - try { - $this->conn->beginTransaction(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::TX_BEGIN); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - try { - $this->conn->rollback(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::TX_ROLLBACK); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } - - public function testTransactionCommit() - { - try { - $this->conn->beginTransaction(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::TX_BEGIN); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - try { - $this->conn->commit(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - $this->conn->rollback(); - } - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Event::TX_COMMIT); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } -} diff --git a/tests_old/Connection/SqliteTestCase.php b/tests_old/Connection/SqliteTestCase.php deleted file mode 100644 index a1afde98d..000000000 --- a/tests_old/Connection/SqliteTestCase.php +++ /dev/null @@ -1,89 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_Sqlite_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_Sqlite_TestCase extends Doctrine_UnitTestCase { - public function testNoSuchTableErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'no such table: test1')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE); - } - public function testNoSuchIndexErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'no such index: test1')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOT_FOUND); - } - public function testUniquePrimaryKeyErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'PRIMARY KEY must be unique')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testIsNotUniqueErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'is not unique')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testColumnsNotUniqueErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'columns name, id are not unique')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testUniquenessConstraintErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'uniqueness constraint failed')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT); - } - public function testNotNullConstraintErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'may not be NULL')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT_NOT_NULL); - } - public function testNoSuchFieldErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, 'no such column: column1')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - public function testColumnNotPresentInTablesErrorIsSupported2() { - $this->exc->processErrorInfo(array(0,0, 'column not present in both tables')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD); - } - public function testNearSyntaxErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, "near \"SELECT FROM\": syntax error")); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_SYNTAX); - } - public function testValueCountOnRowErrorIsSupported() { - $this->exc->processErrorInfo(array(0,0, '3 values for 2 columns')); - - $this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_VALUE_COUNT_ON_ROW); - } -} diff --git a/tests_old/Connection/UnitOfWork.php b/tests_old/Connection/UnitOfWork.php deleted file mode 100644 index 32bbd3d7d..000000000 --- a/tests_old/Connection/UnitOfWork.php +++ /dev/null @@ -1,215 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_UnitOfWork_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_UnitOfWork_TestCase extends Doctrine_UnitTestCase -{ - public function testFlush() - { - $uow = $this->connection->unitOfWork; - - $user = $this->connection->getTable('User')->find(4); - $this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id)); - - $user = $this->connection->create('Email'); - $user = $this->connection->create('User'); - $record = $this->connection->create('Phonenumber'); - - $user->Email->address = 'example@drinkmore.info'; - $this->assertTrue($user->email_id instanceof Email); - - $user->name = 'Example user'; - $user->Group[0]->name = 'Example group 1'; - $user->Group[1]->name = 'Example group 2'; - - $user->Phonenumber[0]->phonenumber = '123 123'; - - $user->Phonenumber[1]->phonenumber = '321 2132'; - $user->Phonenumber[2]->phonenumber = '123 123'; - $user->Phonenumber[3]->phonenumber = '321 2132'; - - - - $this->assertTrue($user->Phonenumber[0]->entity_id instanceof User); - $this->assertTrue($user->Phonenumber[2]->entity_id instanceof User); - - $uow->saveAll(); - - $this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id)); - - $this->assertEqual(count($user->Group), 2); - $user2 = $user; - - $user = $this->objTable->find($user->id); - - $this->assertEqual($user->id, $user2->id); - - $this->assertTrue(is_numeric($user->id)); - $this->assertTrue(is_numeric($user->email_id)); - - $this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id)); - $this->assertTrue($user->Phonenumber->count(), 4); - $this->assertEqual($user->Group->count(), 2); - - - $user = $this->objTable->find(5); - - $pf = $this->connection->getTable('Phonenumber'); - - $this->assertTrue($user->Phonenumber instanceof Doctrine_Collection); - $this->assertTrue($user->Phonenumber->count() == 3); - - $coll = new Doctrine_Collection($pf); - - $user->Phonenumber = $coll; - $this->assertTrue($user->Phonenumber->count() == 0); - - $uow->saveAll(); - unset($user); - $user = $this->objTable->find(5); - - $this->assertEqual($user->Phonenumber->count(), 0); - - // ADDING REFERENCES - - $user->Phonenumber[0]->phonenumber = '123 123'; - $this->assertTrue(is_numeric($user->Phonenumber[0]->entity_id)); - - $user->Phonenumber[1]->phonenumber = '123 123'; - $uow->saveAll(); - - - $this->assertEqual($user->Phonenumber->count(), 2); - - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 2); - - $user->Phonenumber[3]->phonenumber = '123 123'; - $uow->saveAll(); - - $this->assertEqual($user->Phonenumber->count(), 3); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 3); - - // DELETING REFERENCES - - $user->Phonenumber->delete(); - - $this->assertEqual($user->Phonenumber->count(), 0); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 0); - - // ADDING REFERENCES WITH STRING KEYS - - $user->Phonenumber['home']->phonenumber = '123 123'; - $user->Phonenumber['work']->phonenumber = '444 444'; - - $this->assertEqual($user->Phonenumber->count(), 2); - $uow->saveAll(); - - $this->assertEqual($user->Phonenumber->count(), 2); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 2); - - // REPLACING ONE-TO-MANY REFERENCE - - unset($coll); - $coll = new Doctrine_Collection($pf); - $coll[0]->phonenumber = '123 123'; - $coll['home']->phonenumber = '444 444'; - $coll['work']->phonenumber = '444 444'; - - - - - $user->Phonenumber = $coll; - $uow->saveAll(); - $this->assertEqual($user->Phonenumber->count(), 3); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 3); - - - // ONE-TO-ONE REFERENCES - - $user->Email->address = 'drinker@drinkmore.info'; - $this->assertTrue($user->Email instanceof Email); - $uow->saveAll(); - $this->assertTrue($user->Email instanceof Email); - $user = $this->objTable->find(5); - $this->assertEqual($user->Email->address, 'drinker@drinkmore.info'); - $id = $user->Email->id; - - // REPLACING ONE-TO-ONE REFERENCES - - $email = $this->connection->create('Email'); - $email->address = 'absolutist@nottodrink.com'; - $user->Email = $email; - - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->address, 'absolutist@nottodrink.com'); - $uow->saveAll(); - unset($user); - - $user = $this->objTable->find(5); - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->address, 'absolutist@nottodrink.com'); - - $emails = $this->connection->query("FROM Email WHERE Email.id = $id"); - //$this->assertEqual(count($emails),0); - } - - public function testTransactions() - { - $uow = $this->connection->unitOfWork; - $this->connection->beginTransaction(); - $this->assertEqual($this->connection->transaction->getState(),Doctrine_Transaction::STATE_ACTIVE); - $this->connection->commit(); - $this->assertEqual($this->connection->transaction->getState(),Doctrine_Transaction::STATE_SLEEP); - - $this->connection->beginTransaction(); - - $user = $this->objTable->find(6); - - $user->name = 'Jack Daniels'; - $uow->saveAll(); - $this->connection->commit(); - - $user = $this->objTable->find(6); - $this->assertEqual($user->name, 'Jack Daniels'); - - } - - -} diff --git a/tests_old/ConnectionTestCase.php b/tests_old/ConnectionTestCase.php deleted file mode 100644 index 8656d7aff..000000000 --- a/tests_old/ConnectionTestCase.php +++ /dev/null @@ -1,240 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase -{ - - public function testUnknownModule() - { - try { - $this->connection->unknown; - $this->fail(); - } catch(Doctrine_Connection_Exception $e) { - $this->pass(); - } - } - - public function testGetModule() - { - $this->assertTrue($this->connection->unitOfWork instanceof Doctrine_Connection_UnitOfWork); - //$this->assertTrue($this->connection->dataDict instanceof Doctrine_DataDict); - $this->assertTrue($this->connection->expression instanceof Doctrine_Expression_Driver); - $this->assertTrue($this->connection->transaction instanceof Doctrine_Transaction); - $this->assertTrue($this->connection->export instanceof Doctrine_Export); - } - - public function testFetchAll() - { - $this->conn->exec('DROP TABLE entity'); - $this->conn->exec('CREATE TABLE entity (id INT, name TEXT)'); - - $this->conn->exec("INSERT INTO entity (id, name) VALUES (1, 'zYne')"); - $this->conn->exec("INSERT INTO entity (id, name) VALUES (2, 'John')"); - - $a = $this->conn->fetchAll('SELECT * FROM entity'); - - - $this->assertEqual($a, array ( - 0 => - array ( - 'id' => '1', - 'name' => 'zYne', - ), - 1 => - array ( - 'id' => '2', - 'name' => 'John', - ), - )); - } - - public function testFetchOne() - { - $c = $this->conn->fetchOne('SELECT COUNT(1) FROM entity'); - - $this->assertEqual($c, 2); - - $c = $this->conn->fetchOne('SELECT COUNT(1) FROM entity WHERE id = ?', array(1)); - - $this->assertEqual($c, 1); - } - - - public function testFetchColumn() - { - $a = $this->conn->fetchColumn('SELECT * FROM entity'); - - $this->assertEqual($a, array ( - 0 => '1', - 1 => '2', - )); - - $a = $this->conn->fetchColumn('SELECT * FROM entity WHERE id = ?', array(1)); - - $this->assertEqual($a, array ( - 0 => '1', - )); - } - - public function testFetchArray() - { - $a = $this->conn->fetchArray('SELECT * FROM entity'); - - $this->assertEqual($a, array ( - 0 => '1', - 1 => 'zYne', - )); - - $a = $this->conn->fetchArray('SELECT * FROM entity WHERE id = ?', array(1)); - - $this->assertEqual($a, array ( - 0 => '1', - 1 => 'zYne', - )); - } - - public function testFetchRow() - { - $c = $this->conn->fetchRow('SELECT * FROM entity'); - - $this->assertEqual($c, array ( - 'id' => '1', - 'name' => 'zYne', - )); - - $c = $this->conn->fetchRow('SELECT * FROM entity WHERE id = ?', array(1)); - - $this->assertEqual($c, array ( - 'id' => '1', - 'name' => 'zYne', - )); - } - - public function testFetchPairs() - { - $this->conn->exec('DROP TABLE entity'); - } - - public function testGetManager() - { - $this->assertTrue($this->connection->getManager() === $this->manager); - } - - public function testDelete() - { - //$user = $this->connection->create('User'); - //$this->connection->unitOfWork->delete($user); - //$this->assertEqual($user->state(),Doctrine_Entity::STATE_TCLEAN); - } - - public function testGetTable() - { - $table = $this->connection->getClassMetadata('Group'); - $this->assertTrue($table instanceof Doctrine_ClassMetadata); - try { - $table = $this->connection->getClassMetadata('Unknown'); - $f = false; - } catch(Doctrine_Exception $e) { - $f = true; - } - $this->assertTrue($f); - } - - public function testCreate() - { - $email = $this->connection->create('Email'); - $this->assertTrue($email instanceof Email); - } - - public function testGetDbh() - { - $this->assertTrue($this->connection->getDbh() instanceof PDO); - } - - public function testCount() - { - $this->assertTrue(is_integer(count($this->connection))); - } - - public function testGetIterator() - { - $this->assertTrue($this->connection->getIterator() instanceof ArrayIterator); - } - - public function testGetState() - { - $this->assertEqual($this->connection->transaction->getState(),Doctrine_Transaction::STATE_SLEEP); - $this->assertEqual(Doctrine_Lib::getConnectionStateAsString($this->connection->transaction->getState()), 'open'); - } - - public function testRollback() - { - $this->connection->beginTransaction(); - $this->assertEqual($this->connection->transaction->getTransactionLevel(),1); - $this->assertEqual($this->connection->transaction->getState(), Doctrine_Transaction::STATE_ACTIVE); - $this->connection->rollback(); - $this->assertEqual($this->connection->transaction->getState(), Doctrine_Transaction::STATE_SLEEP); - $this->assertEqual($this->connection->transaction->getTransactionLevel(),0); - } - - public function testNestedTransactions() - { - $this->assertEqual($this->connection->transaction->getTransactionLevel(),0); - $this->connection->beginTransaction(); - $this->assertEqual($this->connection->transaction->getTransactionLevel(),1); - $this->assertEqual($this->connection->transaction->getState(), Doctrine_Transaction::STATE_ACTIVE); - $this->connection->beginTransaction(); - $this->assertEqual($this->connection->transaction->getState(), Doctrine_Transaction::STATE_BUSY); - $this->assertEqual($this->connection->transaction->getTransactionLevel(),2); - $this->connection->commit(); - $this->assertEqual($this->connection->transaction->getState(), Doctrine_Transaction::STATE_ACTIVE); - $this->assertEqual($this->connection->transaction->getTransactionLevel(),1); - $this->connection->commit(); - $this->assertEqual($this->connection->transaction->getState(), Doctrine_Transaction::STATE_SLEEP); - $this->assertEqual($this->connection->transaction->getTransactionLevel(),0); - } - - public function testSqliteDsn() - { - $conn = Doctrine_Manager::connection('sqlite:foo.sq3'); - - try { - $conn->connect(); - - $conn->close(); - $this->pass(); - } catch (Doctrine_Exception $e) { - $this->fail(); - } - unlink('foo.sq3'); - } -} diff --git a/tests_old/ConnectionTransactionTestCase.php b/tests_old/ConnectionTransactionTestCase.php deleted file mode 100644 index 13b6c71ac..000000000 --- a/tests_old/ConnectionTransactionTestCase.php +++ /dev/null @@ -1,182 +0,0 @@ -messages[] = $m; - } - public function pop() { - return array_pop($this->messages); - } - public function clear() { - $this->messages = array(); - } - public function getAll() { - return $this->messages; - } -} - -class Doctrine_Connection_Transaction_TestCase extends Doctrine_UnitTestCase { - public function prepareData() { } - public function testInsert() { - $count = count($this->dbh); - - - $listener = new Transaction_TestLogger(); - - $user = new User(); - $user->getTable()->getConnection()->setListener($listener); - - $this->connection->beginTransaction(); - - $user->name = 'John'; - - $user->save(); - - $this->assertEqual($listener->pop(), 'onSave'); - $this->assertEqual($listener->pop(), 'onInsert'); - $this->assertEqual($listener->pop(), 'onPreInsert'); - $this->assertEqual($listener->pop(), 'onPreSave'); - $this->assertEqual($listener->pop(), 'onSetProperty'); - $this->assertEqual($listener->pop(), 'onTransactionBegin'); - $this->assertEqual($listener->pop(), 'onPreTransactionBegin'); - - $this->assertEqual($user->id, 1); - - $this->assertTrue($count < count($this->dbh)); - - $this->connection->commit(); - - $this->assertEqual($listener->pop(), 'onTransactionCommit'); - $this->assertEqual($listener->pop(), 'onPreTransactionCommit'); - } - public function testInsertMultiple() { - $count = count($this->dbh); - - - $listener = new Transaction_TestLogger(); - - $users = new Doctrine_Collection('User'); - $users->getTable()->getConnection()->setListener($listener); - - $this->connection->beginTransaction(); - - $users[0]->name = 'Arnold'; - $users[1]->name = 'Vincent'; - - $users[0]->save(); - $users[1]->save(); - - - $this->assertEqual($listener->pop(), 'onSave'); - $this->assertEqual($listener->pop(), 'onInsert'); - $this->assertEqual($listener->pop(), 'onPreInsert'); - $this->assertEqual($listener->pop(), 'onPreSave'); - $this->assertEqual($listener->pop(), 'onSave'); - $this->assertEqual($listener->pop(), 'onInsert'); - $this->assertEqual($listener->pop(), 'onPreInsert'); - $this->assertEqual($listener->pop(), 'onPreSave'); - - $this->assertEqual($users[0]->id, 2); - - $this->assertEqual($users[1]->id, 3); - - $this->assertTrue($count < count($this->dbh)); - - $this->connection->commit(); - - $this->assertEqual($listener->pop(), 'onTransactionCommit'); - $this->assertEqual($listener->pop(), 'onPreTransactionCommit'); - } - public function testUpdate() { - $count = count($this->dbh); - - - $user = $this->connection->getTable('User')->find(1); - - $listener = new Transaction_TestLogger(); - $user->getTable()->getConnection()->setListener($listener); - $this->connection->beginTransaction(); - - $user->name = 'Jack'; - - $user->save(); - - $this->assertEqual($listener->pop(), 'onSave'); - $this->assertEqual($listener->pop(), 'onUpdate'); - $this->assertEqual($listener->pop(), 'onPreUpdate'); - $this->assertEqual($listener->pop(), 'onPreSave'); - $this->assertEqual($listener->pop(), 'onSetProperty'); - $this->assertEqual($listener->pop(), 'onTransactionBegin'); - $this->assertEqual($listener->pop(), 'onPreTransactionBegin'); - - $this->assertEqual($user->id, 1); - - $this->assertTrue($count < count($this->dbh)); - - $this->connection->commit(); - - $this->assertEqual($listener->pop(), 'onTransactionCommit'); - $this->assertEqual($listener->pop(), 'onPreTransactionCommit'); - } - public function testUpdateMultiple() { - $count = count($this->dbh); - - $listener = new Transaction_TestLogger(); - - $users = $this->connection->query('FROM User'); - $users->getTable()->getConnection()->setListener($listener); - - $this->connection->beginTransaction(); - - $users[1]->name = 'Arnold'; - $users[2]->name = 'Vincent'; - - $users[1]->save(); - $users[2]->save(); - - - $this->assertEqual($listener->pop(), 'onSave'); - $this->assertEqual($listener->pop(), 'onUpdate'); - $this->assertEqual($listener->pop(), 'onPreUpdate'); - $this->assertEqual($listener->pop(), 'onPreSave'); - $this->assertEqual($listener->pop(), 'onSave'); - $this->assertEqual($listener->pop(), 'onUpdate'); - $this->assertEqual($listener->pop(), 'onPreUpdate'); - $this->assertEqual($listener->pop(), 'onPreSave'); - - $this->assertEqual($users[1]->id, 2); - - $this->assertEqual($users[2]->id, 3); - - $this->assertTrue($count < count($this->dbh)); - - $this->connection->commit(); - - $this->assertEqual($listener->pop(), 'onTransactionCommit'); - $this->assertEqual($listener->pop(), 'onPreTransactionCommit'); - } - public function testDelete() { - $count = count($this->dbh); - - $listener = new Transaction_TestLogger(); - $listener->clear(); - $users = $this->connection->query('FROM User'); - $users->getTable()->getConnection()->setListener($listener); - - $this->connection->beginTransaction(); - - $users->delete(); - - $this->assertEqual($listener->pop(), 'onDelete'); - - $this->assertTrue($count, count($this->dbh)); - - $this->connection->commit(); - - $this->assertTrue(($count + 1), count($this->dbh)); - - $this->assertEqual($listener->pop(), 'onTransactionCommit'); - $this->assertEqual($listener->pop(), 'onPreTransactionCommit'); - } -} diff --git a/tests_old/CtiColumnAggregationTestCase.php b/tests_old/CtiColumnAggregationTestCase.php deleted file mode 100644 index 7996b49e8..000000000 --- a/tests_old/CtiColumnAggregationTestCase.php +++ /dev/null @@ -1,100 +0,0 @@ -. - */ - -/** - * Doctrine_CtiColumnAggregation_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_CtiColumnAggregation_TestCase extends Doctrine_UnitTestCase -{ - -} -abstract class CTICAAbstractBase extends Doctrine_Entity -{ } -class CTICATestParent1 extends CTICAAbstractBase -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 200); - } -} -class CTICATestParent2 extends CTICATestParent1 -{ - public function setTableDefinition() - { - parent::setTableDefinition(); - - $this->hasColumn('verified', 'boolean', 1); - $this->hasColumn('type', 'integer', 2); - - $this->setSubclasses(array( - 'CTICATest' => array('type' => 1), - 'CTICATest2' => array('type' => 2) - )); - - } -} -class CTICATestParent3 extends CTICATestParent2 -{ - public function setTableDefinition() - { - $this->hasColumn('added', 'integer'); - } -} -class CTICATestParent4 extends CTICATestParent3 -{ - public function setTableDefinition() - { - $this->hasColumn('age', 'integer', 4); - } -} -class CTICATest extends CTICATestParent4 -{ - -} -class CTICATest2 extends CTICATestParent2 -{ - public function setTableDefinition() - { - $this->hasColumn('updated', 'integer'); - } -} - -class CTICATestOneToManyRelated extends Doctrine_Entity -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('cti_id', 'integer'); - } - - public function setUp() - { - $this->hasMany('CTICATestParent1', array('local' => 'cti_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/CustomPrimaryKeyTestCase.php b/tests_old/CustomPrimaryKeyTestCase.php deleted file mode 100644 index d944877b4..000000000 --- a/tests_old/CustomPrimaryKeyTestCase.php +++ /dev/null @@ -1,60 +0,0 @@ -. - */ - -/** - * Doctrine_CustomPrimaryKey_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_CustomPrimaryKey_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('CustomPK'); - - parent::prepareTables(); - } - public function testOperations() - { - $c = new CustomPK(); - $this->assertTrue($c instanceof Doctrine_Entity); - - $c->name = 'custom pk test'; - $this->assertEqual($c->identifier(), array()); - - $c->save(); - $this->assertEqual($c->identifier(), array('uid' => 1)); - $this->connection->clear(); - - $c = $this->connection->getRepository('CustomPK')->find(1); - - $this->assertEqual($c->identifier(), array('uid' => 1)); - } -} diff --git a/tests_old/CustomResultSetOrderTestCase.php b/tests_old/CustomResultSetOrderTestCase.php deleted file mode 100644 index edc113cf6..000000000 --- a/tests_old/CustomResultSetOrderTestCase.php +++ /dev/null @@ -1,178 +0,0 @@ -. - */ - -/** - * Doctrine_CustomResultSetOrder_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase { - - /** - * Prepares the data under test. - * - * 1st category: 3 Boards - * 2nd category: 1 Board - * 3rd category: 0 boards - * - */ - public function prepareData() { - $cat1 = new CategoryWithPosition(); - $cat1->position = 0; - $cat1->name = "First"; - - $cat2 = new CategoryWithPosition(); - $cat2->position = 0; // same 'priority' as the first - $cat2->name = "Second"; - - $cat3 = new CategoryWithPosition(); - $cat3->position = 1; - $cat3->name = "Third"; - - $board1 = new BoardWithPosition(); - $board1->position = 0; - - $board2 = new BoardWithPosition(); - $board2->position = 1; - - $board3 = new BoardWithPosition(); - $board3->position = 2; - - // The first category gets 3 boards! - $cat1->Boards[0] = $board1; - $cat1->Boards[1] = $board2; - $cat1->Boards[2] = $board3; - - $board4 = new BoardWithPosition(); - $board4->position = 0; - - // The second category gets 1 board! - $cat2->Boards[0] = $board4; - - $this->connection->unitOfWork->saveAll(); - } - - /** - * Prepares the tables. - */ - public function prepareTables() { - $this->tables[] = "CategoryWithPosition"; - $this->tables[] = "BoardWithPosition"; - parent::prepareTables(); - } - - /** - * Checks whether the boards are correctly assigned to the categories. - * - * The 'evil' result set that confuses the object population is displayed below. - * - * catId | catPos | catName | boardPos | board.category_id - * 1 | 0 | First | 0 | 1 - * 2 | 0 | Second | 0 | 2 <-- The split that confuses the object population - * 1 | 0 | First | 1 | 1 - * 1 | 0 | First | 2 | 1 - * 3 | 2 | Third | NULL - */ - public function testQueryWithOrdering2() { - $q = new Doctrine_Query($this->connection); - - $categories = $q->select('c.*, b.*') - ->from('CategoryWithPosition c') - ->leftJoin('c.Boards b') - ->orderBy('c.position ASC, b.position ASC') - ->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertEqual(3, count($categories), 'Some categories were doubled!'); - - // Check each category - foreach ($categories as $category) { - switch ($category['name']) { - case 'First': - // The first category should have 3 boards, right? - // It has only 1! The other two slipped to the 2nd category! - $this->assertEqual(3, count($category['Boards'])); - break; - case 'Second': - // The second category should have 1 board, but it got 3 now - $this->assertEqual(1, count($category['Boards']));; - break; - case 'Third': - // The third has no boards as expected. - //print $category->Boards[0]->position; - $this->assertEqual(0, count($category['Boards'])); - break; - } - - } - } - - /** - * Checks whether the boards are correctly assigned to the categories. - * - * The 'evil' result set that confuses the object population is displayed below. - * - * catId | catPos | catName | boardPos | board.category_id - * 1 | 0 | First | 0 | 1 - * 2 | 0 | Second | 0 | 2 <-- The split that confuses the object population - * 1 | 0 | First | 1 | 1 - * 1 | 0 | First | 2 | 1 - * 3 | 2 | Third | NULL - */ - public function testQueryWithOrdering() { - $q = new Doctrine_Query($this->connection); - $categories = $q->select('c.*, b.*') - ->from('CategoryWithPosition c') - ->leftJoin('c.Boards b') - ->orderBy('c.position ASC, b.position ASC') - ->execute(); - - $this->assertEqual(3, $categories->count(), 'Some categories were doubled!'); - - // Check each category - foreach ($categories as $category) { - - switch ($category->name) { - case 'First': - // The first category should have 3 boards - - $this->assertEqual(3, $category->Boards->count()); - break; - case 'Second': - // The second category should have 1 board - - $this->assertEqual(1, $category->Boards->count()); - break; - case 'Third': - // The third has no boards as expected. - //print $category->Boards[0]->position; - $this->assertTrue(!isset($category->Boards)); - break; - } - - } - } -} diff --git a/tests_old/CustomResultSetOrderTestCaseTestCase.php b/tests_old/CustomResultSetOrderTestCaseTestCase.php deleted file mode 100644 index 1ecf5d6e4..000000000 --- a/tests_old/CustomResultSetOrderTestCaseTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_CustomResultSetOrderTestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_CustomResultSetOrderTestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/DBTestCase.php b/tests_old/DBTestCase.php deleted file mode 100644 index 896d1b080..000000000 --- a/tests_old/DBTestCase.php +++ /dev/null @@ -1,420 +0,0 @@ -. - */ - -/** - * Doctrine_Db_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Db_TestCase extends Doctrine_UnitTestCase -{ - - public function prepareData() - { } - - public function prepareTables() - { } - - public function init() - { } - - public function testInitialize() - { - $this->conn = Doctrine_Manager::getInstance()->openConnection(array('sqlite::memory:')); - $this->conn->exec('CREATE TABLE entity (id INTEGER, name TEXT)'); - - $this->conn->exec("INSERT INTO entity (id, name) VALUES (1, 'zYne')"); - $this->conn->exec("INSERT INTO entity (id, name) VALUES (2, 'John')"); - - - $this->assertEqual($this->conn->getAttribute(Doctrine::ATTR_DRIVER_NAME), 'sqlite'); - } - - public function testAddValidEventListener() - { - $this->conn->setListener(new Doctrine_EventListener()); - - $this->assertTrue($this->conn->getListener() instanceof Doctrine_EventListener); - try { - $ret = $this->conn->addListener(new Doctrine_Connection_TestLogger()); - $this->pass(); - $this->assertTrue($ret instanceof Doctrine_Connection); - } catch(Doctrine_EventListener_Exception $e) { - $this->fail(); - } - $this->assertTrue($this->conn->getListener() instanceof Doctrine_EventListener_Chain); - $this->assertTrue($this->conn->getListener()->get(0) instanceof Doctrine_Connection_TestLogger); - - try { - $ret = $this->conn->addListener(new Doctrine_Connection_TestValidListener()); - $this->pass(); - $this->assertTrue($ret instanceof Doctrine_Connection); - } catch(Doctrine_EventListener_Exception $e) { - $this->fail(); - } - $this->assertTrue($this->conn->getListener() instanceof Doctrine_EventListener_Chain); - $this->assertTrue($this->conn->getListener()->get(0) instanceof Doctrine_Connection_TestLogger); - $this->assertTrue($this->conn->getListener()->get(1) instanceof Doctrine_Connection_TestValidListener); - - try { - $ret = $this->conn->addListener(new Doctrine_EventListener_Chain(), 'chain'); - $this->pass(); - $this->assertTrue($ret instanceof Doctrine_Connection); - } catch(Doctrine_EventListener_Exception $e) { - $this->fail(); - } - $this->assertTrue($this->conn->getListener() instanceof Doctrine_EventListener_Chain); - $this->assertTrue($this->conn->getListener()->get(0) instanceof Doctrine_Connection_TestLogger); - $this->assertTrue($this->conn->getListener()->get(1) instanceof Doctrine_Connection_TestValidListener); - $this->assertTrue($this->conn->getListener()->get('chain') instanceof Doctrine_EventListener_Chain); - - // replacing - - try { - $ret = $this->conn->addListener(new Doctrine_EventListener_Chain(), 'chain'); - $this->pass(); - $this->assertTrue($ret instanceof Doctrine_Connection); - } catch(Doctrine_EventListener_Exception $e) { - $this->fail(); - } - $this->assertTrue($this->conn->getListener() instanceof Doctrine_EventListener_Chain); - $this->assertTrue($this->conn->getListener()->get(0) instanceof Doctrine_Connection_TestLogger); - $this->assertTrue($this->conn->getListener()->get(1) instanceof Doctrine_Connection_TestValidListener); - $this->assertTrue($this->conn->getListener()->get('chain') instanceof Doctrine_EventListener_Chain); - } - - public function testListeningEventsWithSingleListener() - { - $this->conn->setListener(new Doctrine_Connection_TestLogger()); - $listener = $this->conn->getListener(); - $stmt = $this->conn->prepare('INSERT INTO entity (id) VALUES(?)'); - - $this->assertEqual($listener->pop(), 'postPrepare'); - $this->assertEqual($listener->pop(), 'prePrepare'); - - $stmt->execute(array(1)); - - $this->assertEqual($listener->pop(), 'postStmtExecute'); - $this->assertEqual($listener->pop(), 'preStmtExecute'); - - $this->conn->exec('DELETE FROM entity'); - - $this->assertEqual($listener->pop(), 'postExec'); - $this->assertEqual($listener->pop(), 'preExec'); - - $this->conn->beginTransaction(); - - $this->assertEqual($listener->pop(), 'postTransactionBegin'); - $this->assertEqual($listener->pop(), 'preTransactionBegin'); - - $this->conn->exec('INSERT INTO entity (id) VALUES (1)'); - - $this->assertEqual($listener->pop(), 'postExec'); - $this->assertEqual($listener->pop(), 'preExec'); - - $this->conn->commit(); - - $this->assertEqual($listener->pop(), 'postTransactionCommit'); - $this->assertEqual($listener->pop(), 'preTransactionCommit'); - } - - public function testListeningQueryEventsWithListenerChain() - { - $this->conn->exec('DROP TABLE entity'); - - $this->conn->addListener(new Doctrine_Connection_TestLogger()); - $this->conn->addListener(new Doctrine_Connection_TestLogger()); - - $this->conn->exec('CREATE TABLE entity (id INT)'); - - $listener = $this->conn->getListener()->get(0); - $listener2 = $this->conn->getListener()->get(1); - $this->assertEqual($listener->pop(), 'postExec'); - $this->assertEqual($listener->pop(), 'preExec'); - - $this->assertEqual($listener2->pop(), 'postExec'); - $this->assertEqual($listener2->pop(), 'preExec'); - } - - public function testListeningPrepareEventsWithListenerChain() - { - - $stmt = $this->conn->prepare('INSERT INTO entity (id) VALUES(?)'); - $listener = $this->conn->getListener()->get(0); - $listener2 = $this->conn->getListener()->get(1); - $this->assertEqual($listener->pop(), 'postPrepare'); - $this->assertEqual($listener->pop(), 'prePrepare'); - - $this->assertEqual($listener2->pop(), 'postPrepare'); - $this->assertEqual($listener2->pop(), 'prePrepare'); - - $stmt->execute(array(1)); - - $this->assertEqual($listener->pop(), 'postStmtExecute'); - $this->assertEqual($listener->pop(), 'preStmtExecute'); - - $this->assertEqual($listener2->pop(), 'postStmtExecute'); - $this->assertEqual($listener2->pop(), 'preStmtExecute'); - } - - public function testListeningErrorHandlingMethodsOnExec() - { - $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false); - $listener = $this->conn->getListener()->get(0); - $this->conn->exec('DELETE FROM unknown'); - - $this->assertEqual($listener->pop(), 'postError'); - $this->assertEqual($listener->pop(), 'preError'); - - $this->assertEqual($listener->pop(), 'preExec'); - } - - public function testListeningErrorHandlingMethodsOnQuery() - { - $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false); - $listener = $this->conn->getListener()->get(0); - $this->conn->execute('DELETE FROM unknown'); - - $this->assertEqual($listener->pop(), 'postError'); - $this->assertEqual($listener->pop(), 'preError'); - - $this->assertEqual($listener->pop(), 'preQuery'); - } - - public function testListeningErrorHandlingMethodsOnPrepare() - { - $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false); - $listener = $this->conn->getListener()->get(0); - - $this->conn->prepare('INSERT INTO unknown (id) VALUES (?)'); - - $this->assertEqual($listener->pop(), 'postError'); - $this->assertEqual($listener->pop(), 'preError'); - - $this->assertEqual($listener->pop(), 'prePrepare'); - } - - public function testListeningErrorHandlingMethodsOnStatementExecute() - { - $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false); - $listener = $this->conn->getListener()->get(0); - - $stmt = $this->conn->prepare('INSERT INTO entity (id) VALUES (?)'); - - $stmt->execute(array(1, 2, 3)); - - $this->assertEqual($listener->pop(), 'postError'); - $this->assertEqual($listener->pop(), 'preError'); - - $this->assertEqual($listener->pop(), 'preStmtExecute'); - $this->assertEqual($listener->pop(), 'postPrepare'); - $this->assertEqual($listener->pop(), 'prePrepare'); - } - - public function testListeningExecEventsWithListenerChain() - { - $this->conn->exec('DELETE FROM entity'); - $listener = $this->conn->getListener()->get(0); - $listener2 = $this->conn->getListener()->get(1); - $this->assertEqual($listener->pop(), 'postExec'); - $this->assertEqual($listener->pop(), 'preExec'); - - $this->assertEqual($listener2->pop(), 'postExec'); - $this->assertEqual($listener2->pop(), 'preExec'); - } - - public function testListeningTransactionEventsWithListenerChain() - { - $this->conn->beginTransaction(); - $listener = $this->conn->getListener()->get(0); - $listener2 = $this->conn->getListener()->get(1); - $this->assertEqual($listener->pop(), 'postTransactionBegin'); - $this->assertEqual($listener->pop(), 'preTransactionBegin'); - - $this->assertEqual($listener2->pop(), 'postTransactionBegin'); - $this->assertEqual($listener2->pop(), 'preTransactionBegin'); - - $this->conn->exec('INSERT INTO entity (id) VALUES (1)'); - - $this->conn->commit(); - - $this->assertEqual($listener->pop(), 'postTransactionCommit'); - $this->assertEqual($listener->pop(), 'preTransactionCommit'); - - $this->assertEqual($listener->pop(), 'postExec'); - $this->assertEqual($listener->pop(), 'preExec'); - - $this->conn->exec('DROP TABLE entity'); - } - - public function testSetValidEventListener() - { - try { - $this->conn->setListener(new Doctrine_Connection_TestLogger()); - $this->pass(); - } catch(Doctrine_EventListener_Exception $e) { - $this->fail(); - } - $this->assertTrue($this->conn->getListener() instanceof Doctrine_Connection_TestLogger); - try { - $this->conn->setListener(new Doctrine_Connection_TestValidListener()); - $this->pass(); - } catch(Doctrine_EventListener_Exception $e) { - $this->fail(); - } - $this->assertTrue($this->conn->getListener() instanceof Doctrine_Connection_TestValidListener); - try { - $this->conn->setListener(new Doctrine_EventListener_Chain()); - $this->pass(); - - } catch(Doctrine_EventListener_Exception $e) { - $this->fail(); - } - $this->assertTrue($this->conn->getListener() instanceof Doctrine_EventListener_Chain); - try { - $this->conn->setListener(new Doctrine_EventListener()); - $this->pass(); - } catch(Doctrine_EventListener_Exception $e) { - $this->fail(); - } - $this->assertTrue($this->conn->getListener() instanceof Doctrine_EventListener); - } - - public function testSetInvalidEventListener() - { - try { - $this->conn->setListener(new Doctrine_Connection_TestInvalidListener()); - $this->fail(); - } catch(Doctrine_EventListener_Exception $e) { - $this->pass(); - } - } - public function testInvalidDSN() - { - $manager = Doctrine_Manager::getInstance(); - try { - $this->conn = $manager->openConnection(''); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - try { - $this->conn = $manager->openConnection('unknown'); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - try { - $this->conn = $manager->openConnection(0); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } - public function testInvalidScheme() - { - $manager = Doctrine_Manager::getInstance(); - try { - $this->conn = $manager->openConnection('unknown://:memory:'); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } - public function testInvalidHost() - { - $manager = Doctrine_Manager::getInstance(); - try { - $this->conn = $manager->openConnection('mysql://user:password@'); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } - public function testInvalidDatabase() - { - $manager = Doctrine_Manager::getInstance(); - try { - $this->conn = $manager->openConnection('mysql://user:password@host/'); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } - - /** - public function testGetConnectionPdoLikeDSN() - { - $this->conn = Doctrine_Manager::openConnection(array('mysql:host=localhost;dbname=test', 'root', 'password')); - $this->assertEqual($this->conn->getOption('dsn'), 'mysql:host=localhost;dbname=test'); - $this->assertEqual($this->conn->getOption('username'), 'root'); - $this->assertEqual($this->conn->getOption('password'), 'password'); - - - $this->conn = Doctrine_Connection::getConnection('sqlite::memory:'); - - $this->assertEqual($this->conn->getOption('dsn'), 'sqlite::memory:'); - $this->assertEqual($this->conn->getOption('username'), false); - $this->assertEqual($this->conn->getOption('password'), false); - } - public function testDriverName() - { - - } - - public function testGetConnectionWithPearLikeDSN() - { - $this->conn = Doctrine_Connection::getConnection('mysql://zYne:password@localhost/test'); - $this->assertEqual($this->conn->getOption('dsn'), 'mysql:host=localhost;dbname=test'); - $this->assertEqual($this->conn->getOption('username'), 'zYne'); - $this->assertEqual($this->conn->getOption('password'), 'password'); - - - $this->conn = Doctrine_Connection::getConnection('sqlite://:memory:'); - - $this->assertEqual($this->conn->getOption('dsn'), 'sqlite::memory:'); - $this->assertEqual($this->conn->getOption('username'), false); - $this->assertEqual($this->conn->getOption('password'), false); - } - */ -} - -class Doctrine_Connection_TestLogger implements Doctrine_Overloadable { - private $messages = array(); - - public function __call($m, $a) { - $this->messages[] = $m; - } - public function pop() { - return array_pop($this->messages); - } - public function getAll() { - return $this->messages; - } -} -class Doctrine_Connection_TestValidListener extends Doctrine_EventListener { } -class Doctrine_Connection_TestInvalidListener { } diff --git a/tests_old/Data/ExportTestCase.php b/tests_old/Data/ExportTestCase.php deleted file mode 100644 index be49149c8..000000000 --- a/tests_old/Data/ExportTestCase.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -/** - * Doctrine_Data_Export_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Data_Export_TestCase extends Doctrine_UnitTestCase -{ -} diff --git a/tests_old/Data/ImportTestCase.php b/tests_old/Data/ImportTestCase.php deleted file mode 100644 index 793d544f0..000000000 --- a/tests_old/Data/ImportTestCase.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -/** - * Doctrine_Data_Import_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Data_Import_TestCase extends Doctrine_UnitTestCase -{ -} diff --git a/tests_old/DataDict/FirebirdTestCase.php b/tests_old/DataDict/FirebirdTestCase.php deleted file mode 100644 index d73cfc749..000000000 --- a/tests_old/DataDict/FirebirdTestCase.php +++ /dev/null @@ -1,279 +0,0 @@ -. - */ - -/** - * Doctrine_DataDict_Firebird_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase -{ - public function testGetCharsetFieldDeclarationReturnsValidSql() - { - $this->assertEqual($this->dataDict->getCharsetFieldDeclaration('UTF-8'), 'CHARACTER SET UTF-8'); - } - public function testGetCollationFieldDeclarationReturnsValidSql() - { - $this->assertEqual($this->dataDict->getCollationFieldDeclaration('xx'), 'COLLATE xx'); - } - public function testGetPortableDeclarationForUnknownDbTypeThrowsException() - { - try { - $this->dataDict->getPortableDeclaration(array('type' => 'unknown')); - $this->fail(); - } catch(Doctrine_DataDict_Exception $e) { - $this->pass(); - } - } - public function testGetPortableDeclarationSupportsNativeDateType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'date')); - - $this->assertEqual($type, array('type' => array('date'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeTimestampType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp')); - - $this->assertEqual($type, array('type' => array('timestamp'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeTimeType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'time')); - - $this->assertEqual($type, array('type' => array('time'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeFloatType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeDoubleType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'double')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeDoublePrecisionType() { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'double precision')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeDfloatType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'd_float')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeDecimalType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeNumericType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'numeric')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeBlobType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'blob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeVarcharType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar')); - - $this->assertEqual($type, array('type' => array('string'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeCharType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'char')); - - $this->assertEqual($type, array('type' => array('string'), - 'length' => null, - 'unsigned' => null, - 'fixed' => true)); - } - public function testGetPortableDeclarationSupportsNativeCstringType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'cstring')); - - $this->assertEqual($type, array('type' => array('string'), - 'length' => null, - 'unsigned' => null, - 'fixed' => true)); - } - public function testGetPortableDeclarationSupportsNativeBigintType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'bigint')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeQuadType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'quad')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetNativeDefinitionSupportsIntegerType() - { - $a = array('type' => 'integer', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); - - $a['length'] = 4; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); - - $a['length'] = 2; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); - } - - public function testGetNativeDefinitionSupportsFloatType() - { - $a = array('type' => 'float', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE PRECISION'); - } - public function testGetNativeDefinitionSupportsBooleanType() - { - $a = array('type' => 'boolean', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT'); - } - public function testGetNativeDefinitionSupportsDateType() - { - $a = array('type' => 'date', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); - } - public function testGetNativeDefinitionSupportsTimestampType() - { - $a = array('type' => 'timestamp', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIMESTAMP'); - } - public function testGetNativeDefinitionSupportsTimeType() - { - $a = array('type' => 'time', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME'); - } - public function testGetNativeDefinitionSupportsClobType() - { - $a = array('type' => 'clob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB SUB_TYPE 1'); - } - public function testGetNativeDefinitionSupportsBlobType() - { - $a = array('type' => 'blob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB SUB_TYPE 0'); - } - public function testGetNativeDefinitionSupportsCharType() - { - $a = array('type' => 'char', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); - } - public function testGetNativeDefinitionSupportsVarcharType() - { - $a = array('type' => 'varchar', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); - } - public function testGetNativeDefinitionSupportsArrayType() - { - $a = array('type' => 'array', 'length' => 40); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); - } - public function testGetNativeDefinitionSupportsStringType() - { - $a = array('type' => 'string'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)'); - } - public function testGetNativeDefinitionSupportsArrayType2() - { - $a = array('type' => 'array'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)'); - } - public function testGetNativeDefinitionSupportsObjectType() - { - $a = array('type' => 'object'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(16777215)'); - } -} diff --git a/tests_old/DataDict/InformixTestCase.php b/tests_old/DataDict/InformixTestCase.php deleted file mode 100644 index 8022b734c..000000000 --- a/tests_old/DataDict/InformixTestCase.php +++ /dev/null @@ -1,36 +0,0 @@ -. - */ - -/** - * Doctrine_DataDict_Informix_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataDict_Informix_TestCase extends Doctrine_UnitTestCase -{ - -} diff --git a/tests_old/DataDict/MssqlTestCase.php b/tests_old/DataDict/MssqlTestCase.php deleted file mode 100644 index d39eb4b9a..000000000 --- a/tests_old/DataDict/MssqlTestCase.php +++ /dev/null @@ -1,249 +0,0 @@ -. - */ - -/** - * Doctrine_DataDict_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataDict_Mssql_TestCase extends Doctrine_UnitTestCase -{ - public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() - { - try { - $this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type')); - $this->fail(); - } catch(Doctrine_DataDict_Exception $e) { - $this->pass(); - } - } - public function testGetPortableDeclarationSupportsNativeBitType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'bit')); - - $this->assertEqual($type, array('type' => array('boolean'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeStringTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'text')); - - $this->assertEqual($type, array('type' => array('string', 'clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'char', 'length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => true)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar', 'length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => false)); - } - public function testGetPortableDeclarationSupportsNativeBlobTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'image')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'varbinary')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeIntegerTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'int')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'int', 'length' => 1)); - - $this->assertEqual($type, array('type' => array('integer', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeTimestampType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'datetime')); - - $this->assertEqual($type, array('type' => array('timestamp'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeDecimalTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'money')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeFloatTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'real')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'numeric')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetNativeDefinitionSupportsIntegerType() - { - $a = array('type' => 'integer', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); - - $a['length'] = 4; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); - - $a['length'] = 2; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); - } - - public function testGetNativeDefinitionSupportsFloatType() - { - $a = array('type' => 'float', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'FLOAT'); - } - public function testGetNativeDefinitionSupportsBooleanType() - { - $a = array('type' => 'boolean', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIT'); - } - public function testGetNativeDefinitionSupportsDateType() - { - $a = array('type' => 'date', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); - } - public function testGetNativeDefinitionSupportsTimestampType() - { - $a = array('type' => 'timestamp', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(19)'); - } - public function testGetNativeDefinitionSupportsTimeType() - { - $a = array('type' => 'time', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(8)'); - } - public function testGetNativeDefinitionSupportsClobType() - { - $a = array('type' => 'clob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDefinitionSupportsBlobType() - { - $a = array('type' => 'blob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'IMAGE'); - } - public function testGetNativeDefinitionSupportsCharType() - { - $a = array('type' => 'char', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); - } - public function testGetNativeDefinitionSupportsVarcharType() - { - $a = array('type' => 'varchar', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); - } - public function testGetNativeDefinitionSupportsArrayType() - { - $a = array('type' => 'array', 'length' => 40); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); - } - public function testGetNativeDefinitionSupportsStringType() - { - $a = array('type' => 'string'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDefinitionSupportsArrayType2() - { - $a = array('type' => 'array'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDefinitionSupportsObjectType() - { - $a = array('type' => 'object'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } -} diff --git a/tests_old/DataDict/MysqlTestCase.php b/tests_old/DataDict/MysqlTestCase.php deleted file mode 100644 index df5b07ced..000000000 --- a/tests_old/DataDict/MysqlTestCase.php +++ /dev/null @@ -1,353 +0,0 @@ -. - */ - -/** - * Doctrine_DataDict_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataDict_Mysql_TestCase extends Doctrine_UnitTestCase { - public function testGetCharsetFieldDeclarationReturnsValidSql() - { - $this->assertEqual($this->dataDict->getCharsetFieldDeclaration('UTF-8'), 'CHARACTER SET UTF-8'); - } - public function testGetCollationFieldDeclarationReturnsValidSql() - { - $this->assertEqual($this->dataDict->getCollationFieldDeclaration('xx'), 'COLLATE xx'); - } - public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() - { - try { - $this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type')); - $this->fail(); - } catch(Doctrine_DataDict_Exception $e) { - $this->pass(); - } - } - public function testGetPortableDeclarationSupportsNativeIntegerTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'tinyint')); - - - $this->assertEqual($type, array('type' => array('integer', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => null)); - $type = $this->dataDict->getPortableDeclaration(array('type' => 'smallint unsigned')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => 2, - 'unsigned' => true, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'mediumint unsigned')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => 3, - 'unsigned' => true, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'int unsigned')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => 4, - 'unsigned' => true, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'integer unsigned')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => 4, - 'unsigned' => true, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'bigint unsigned')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => 8, - 'unsigned' => true, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeStringTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'text')); - - $this->assertEqual($type, array('type' => array('string', 'clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => false)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'longtext')); - - $this->assertEqual($type, array('type' => array('string', 'clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => false)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'mediumtext')); - - $this->assertEqual($type, array('type' => array('string', 'clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => false)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'tinytext')); - - $this->assertEqual($type, array('type' => array('string', 'clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => false)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'char(1)')); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => true)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar(1)')); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => false)); - } - public function testGetPortableDeclarationSupportsNativeFloatTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'real unsigned')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => true, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'double')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - - public function testGetPortableDeclarationSupportsNativeDateType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'date')); - - $this->assertEqual($type, array('type' => array('date'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeDecimalTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'unknown')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'numeric')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - - public function testGetPortableDeclarationSupportsNativeTimestampTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp')); - - $this->assertEqual($type, array('type' => array('timestamp'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'datetime')); - - $this->assertEqual($type, array('type' => array('timestamp'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeYearType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'year')); - - - $this->assertEqual($type, array('type' => array('integer', 'date'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeBlobTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'blob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'mediumblob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'tinyblob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'longblob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - - public function testGetNativeDefinitionSupportsIntegerType() - { - $a = array('type' => 'integer', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT'); - - $a['length'] = 4; - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'INT'); - - $a['length'] = 2; - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'SMALLINT'); - } - - public function testGetNativeDeclarationSupportsFloatType() - { - $a = array('type' => 'float', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DOUBLE'); - } - public function testGetNativeDeclarationSupportsBooleanType() - { - $a = array('type' => 'boolean', 'fixed' => false); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TINYINT(1)'); - } - public function testGetNativeDeclarationSupportsDateType() - { - $a = array('type' => 'date', 'fixed' => false); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATE'); - } - public function testGetNativeDeclarationSupportsTimestampType() - { - $a = array('type' => 'timestamp', 'fixed' => false); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'DATETIME'); - } - public function testGetNativeDeclarationSupportsTimeType() - { - $a = array('type' => 'time', 'fixed' => false); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TIME'); - } - public function testGetNativeDeclarationSupportsClobType() - { - $a = array('type' => 'clob'); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGTEXT'); - } - public function testGetNativeDeclarationSupportsBlobType() - { - $a = array('type' => 'blob'); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'LONGBLOB'); - } - public function testGetNativeDeclarationSupportsCharType() - { - $a = array('type' => 'char', 'length' => 10); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'CHAR(10)'); - } - public function testGetNativeDeclarationSupportsVarcharType() - { - $a = array('type' => 'varchar', 'length' => 10); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(10)'); - } - public function testGetNativeDeclarationSupportsArrayType() - { - $a = array('type' => 'array', 'length' => 40); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'VARCHAR(40)'); - } - public function testGetNativeDeclarationSupportsStringType() - { - $a = array('type' => 'string'); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDeclarationSupportsStringTypeWithLongLength() - { - $a = array('type' => 'string', 'length' => 2000); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDeclarationSupportsArrayType2() - { - $a = array('type' => 'array'); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDeclarationSupportsObjectType() - { - $a = array('type' => 'object'); - - $this->assertEqual($this->dataDict->GetNativeDeclaration($a), 'TEXT'); - } - -} diff --git a/tests_old/DataDict/OracleTestCase.php b/tests_old/DataDict/OracleTestCase.php deleted file mode 100644 index 952a71d41..000000000 --- a/tests_old/DataDict/OracleTestCase.php +++ /dev/null @@ -1,293 +0,0 @@ -. - */ - -/** - * Doctrine_DataDict_Oracle_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataDict_Oracle_TestCase extends Doctrine_UnitTestCase { - public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() - { - try { - $this->dataDict->getPortableDeclaration(array('data_type' => 'some_unknown_type')); - $this->fail(); - } catch(Doctrine_DataDict_Exception $e) { - $this->pass(); - } - } - public function testGetPortableDeclarationSupportsNativeFloatType() - { - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'float')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeIntegerTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'integer')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'pls_integer', 'data_length' => 1)); - - $this->assertEqual($type, array('type' => array('integer', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'binary_integer', 'data_length' => 1)); - - $this->assertEqual($type, array('type' => array('integer', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeStringTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'varchar')); - - $this->assertEqual($type, array('type' => array('string'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'varchar2', 'data_length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => false)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'nvarchar2', 'data_length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => false)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'char', 'data_length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => true)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'nchar', 'data_length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => true)); - } - public function testGetPortableDeclarationSupportsNativeNumberType() - { - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'number')); - - $this->assertEqual($type, array('type' => array('integer'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'number', 'data_length' => 1)); - - $this->assertEqual($type, array('type' => array('integer', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => null)); - - } - public function testGetPortableDeclarationSupportsNativeTimestampType() - { - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'date')); - - $this->assertEqual($type, array('type' => array('timestamp'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'timestamp')); - - $this->assertEqual($type, array('type' => array('timestamp'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeClobTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'clob')); - - $this->assertEqual($type, array('type' => array('clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'long')); - - $this->assertEqual($type, array('type' => array('string', 'clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'nclob')); - - $this->assertEqual($type, array('type' => array('clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - } - public function testGetPortableDeclarationSupportsNativeBlobTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'blob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'long raw')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'long raw')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('data_type' => 'raw')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetNativeDefinitionSupportsIntegerType() - { - $a = array('type' => 'integer', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(20)'); - - $a['length'] = 4; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(4)'); - - $a['length'] = 2; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(2)'); - } - - public function testGetNativeDefinitionSupportsFloatType() - { - $a = array('type' => 'float', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER'); - } - public function testGetNativeDefinitionSupportsBooleanType() - { - $a = array('type' => 'boolean', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'NUMBER(1)'); - } - public function testGetNativeDefinitionSupportsDateType() - { - $a = array('type' => 'date', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); - } - public function testGetNativeDefinitionSupportsTimestampType() - { - $a = array('type' => 'timestamp', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); - } - public function testGetNativeDefinitionSupportsTimeType() - { - $a = array('type' => 'time', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); - } - public function testGetNativeDefinitionSupportsClobType() - { - $a = array('type' => 'clob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CLOB'); - } - public function testGetNativeDefinitionSupportsBlobType() - { - $a = array('type' => 'blob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BLOB'); - } - public function testGetNativeDefinitionSupportsCharType() - { - $a = array('type' => 'char', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); - } - public function testGetNativeDefinitionSupportsVarcharType() - { - $a = array('type' => 'varchar', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(10)'); - } - public function testGetNativeDefinitionSupportsArrayType() - { - $a = array('type' => 'array', 'length' => 40); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(40)'); - } - public function testGetNativeDefinitionSupportsStringType() - { - $a = array('type' => 'string'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)'); - } - public function testGetNativeDefinitionSupportsArrayType2() - { - $a = array('type' => 'array'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)'); - } - public function testGetNativeDefinitionSupportsObjectType() - { - $a = array('type' => 'object'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR2(16777215)'); - } -} diff --git a/tests_old/DataDict/PgsqlTestCase.php b/tests_old/DataDict/PgsqlTestCase.php deleted file mode 100644 index 8acf5d705..000000000 --- a/tests_old/DataDict/PgsqlTestCase.php +++ /dev/null @@ -1,358 +0,0 @@ -. - */ - -/** - * Doctrine_DataDict_Oracle_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_UnitTestCase -{ - public function getDeclaration($type) - { - return $this->dataDict->getPortableDeclaration(array('type' => $type, 'name' => 'colname', 'length' => 2, 'fixed' => true)); - } - public function testGetPortableDeclarationForUnknownNativeTypeThrowsException() - { - try { - $this->dataDict->getPortableDeclaration(array('type' => 'some_unknown_type')); - $this->fail(); - } catch(Doctrine_DataDict_Exception $e) { - $this->pass(); - } - } - public function testGetPortableDeclarationSupportsNativeBlobTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'blob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'tinyblob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'mediumblob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'longblob')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'bytea')); - - $this->assertEqual($type, array('type' => array('blob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'oid')); - - $this->assertEqual($type, array('type' => array('blob', 'clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeTimestampTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'timestamp')); - - $this->assertEqual($type, array('type' => array('timestamp'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'datetime')); - - $this->assertEqual($type, array('type' => array('timestamp'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeDecimalTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'decimal')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'money')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'numeric')); - - $this->assertEqual($type, array('type' => array('decimal'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeFloatTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'float')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'double')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'real')); - - $this->assertEqual($type, array('type' => array('float'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeYearType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'year')); - - $this->assertEqual($type, array('type' => array('integer', 'date'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeDateType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'date')); - - $this->assertEqual($type, array('type' => array('date'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeTimeType() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'time')); - - $this->assertEqual($type, array('type' => array('time'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeStringTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'text')); - - $this->assertEqual($type, array('type' => array('string', 'clob'), - 'length' => null, - 'unsigned' => null, - 'fixed' => null)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'interval')); - - $this->assertEqual($type, array('type' => array('string'), - 'length' => null, - 'unsigned' => null, - 'fixed' => false)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'varchar', 'length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => false)); - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'unknown', 'length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => true)); - - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'char', 'length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => true)); - - - $type = $this->dataDict->getPortableDeclaration(array('type' => 'bpchar', 'length' => 1)); - - $this->assertEqual($type, array('type' => array('string', 'boolean'), - 'length' => 1, - 'unsigned' => null, - 'fixed' => true)); - - } - public function testGetPortableDeclarationSupportsNativeIntegerTypes() - { - $type = $this->dataDict->getPortableDeclaration(array('type' => 'smallint')); - - $this->assertEqual($this->getDeclaration('smallint'), array('type' => array('integer', 'boolean'), 'length' => 2, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('int2'), array('type' => array('integer', 'boolean'), 'length' => 2, 'unsigned' => false, 'fixed' => null)); - - $this->assertEqual($this->getDeclaration('int'), array('type' => array('integer'), 'length' => 4, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('int4'), array('type' => array('integer'), 'length' => 4, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('integer'), array('type' => array('integer'), 'length' => 4, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('serial'), array('type' => array('integer'), 'length' => 4, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('serial4'), array('type' => array('integer'), 'length' => 4, 'unsigned' => false, 'fixed' => null)); - - $this->assertEqual($this->getDeclaration('bigint'), array('type' => array('integer'), 'length' => 8, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('int8'), array('type' => array('integer'), 'length' => 8, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('bigserial'), array('type' => array('integer'), 'length' => 8, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('serial8'), array('type' => array('integer'), 'length' => 8, 'unsigned' => false, 'fixed' => null)); - } - public function testGetPortableDeclarationSupportsNativeBooleanTypes() - { - $this->assertEqual($this->getDeclaration('bool'), array('type' => array('boolean'), 'length' => 1, 'unsigned' => false, 'fixed' => null)); - $this->assertEqual($this->getDeclaration('boolean'), array('type' => array('boolean'), 'length' => 1, 'unsigned' => false, 'fixed' => null)); - } - - public function testGetNativeDefinitionSupportsIntegerType() - { - $a = array('type' => 'integer', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGINT'); - - $a['length'] = 4; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INT'); - - $a['length'] = 2; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SMALLINT'); - } - public function testGetNativeDefinitionSupportsIntegerTypeWithAutoinc() - { - $a = array('type' => 'integer', 'length' => 20, 'fixed' => false, 'autoincrement' => true); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BIGSERIAL'); - - $a['length'] = 4; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SERIAL'); - - $a['length'] = 2; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'SERIAL'); - } - public function testGetNativeDefinitionSupportsFloatType() - { - $a = array('type' => 'float', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'FLOAT'); - } - public function testGetNativeDefinitionSupportsBooleanType() - { - $a = array('type' => 'boolean', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BOOLEAN'); - } - public function testGetNativeDefinitionSupportsDateType() - { - $a = array('type' => 'date', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); - } - public function testGetNativeDefinitionSupportsTimestampType() - { - $a = array('type' => 'timestamp', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIMESTAMP without time zone'); - } - public function testGetNativeDefinitionSupportsTimeType() - { - $a = array('type' => 'time', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME without time zone'); - } - public function testGetNativeDefinitionSupportsClobType() - { - $a = array('type' => 'clob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDefinitionSupportsBlobType() - { - $a = array('type' => 'blob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'BYTEA'); - } - public function testGetNativeDefinitionSupportsCharType() - { - $a = array('type' => 'char', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); - } - public function testGetNativeDefinitionSupportsVarcharType() - { - $a = array('type' => 'varchar', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); - } - public function testGetNativeDefinitionSupportsArrayType() - { - $a = array('type' => 'array', 'length' => 40); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); - } - public function testGetNativeDefinitionSupportsStringType() - { - $a = array('type' => 'string'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDefinitionSupportsArrayType2() - { - $a = array('type' => 'array'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDefinitionSupportsObjectType() - { - $a = array('type' => 'object'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } -} diff --git a/tests_old/DataDict/SqliteTestCase.php b/tests_old/DataDict/SqliteTestCase.php deleted file mode 100644 index d12a778aa..000000000 --- a/tests_old/DataDict/SqliteTestCase.php +++ /dev/null @@ -1,165 +0,0 @@ -. - */ - -/** - * Doctrine_DataDict_Sqlite_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase -{ - public function testBooleanMapsToBooleanType() - { - $this->assertDeclarationType('boolean', 'boolean'); - } - public function testIntegersMapToIntegerType() - { - $this->assertDeclarationType('tinyint', array('integer', 'boolean')); - $this->assertDeclarationType('smallint', 'integer'); - $this->assertDeclarationType('mediumint', 'integer'); - $this->assertDeclarationType('int', 'integer'); - $this->assertDeclarationType('integer', 'integer'); - $this->assertDeclarationType('serial', 'integer'); - $this->assertDeclarationType('bigint', 'integer'); - $this->assertDeclarationType('bigserial', 'integer'); - } - public function testBlobsMapToBlobType() - { - $this->assertDeclarationType('tinyblob', 'blob'); - $this->assertDeclarationType('mediumblob', 'blob'); - $this->assertDeclarationType('longblob', 'blob'); - $this->assertDeclarationType('blob', 'blob'); - } - public function testDecimalMapsToDecimal() - { - $this->assertDeclarationType('decimal', 'decimal'); - $this->assertDeclarationType('numeric', 'decimal'); - } - public function testFloatRealAndDoubleMapToFloat() - { - $this->assertDeclarationType('float', 'float'); - $this->assertDeclarationType('double', 'float'); - $this->assertDeclarationType('real', 'float'); - } - public function testYearMapsToIntegerAndDate() - { - $this->assertDeclarationType('year', array('integer','date')); - } - public function testGetNativeDefinitionSupportsIntegerType() - { - $a = array('type' => 'integer', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER'); - - $a['length'] = 4; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER'); - - $a['length'] = 2; - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER'); - } - - public function testGetNativeDefinitionSupportsFloatType() - { - $a = array('type' => 'float', 'length' => 20, 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DOUBLE'); - } - public function testGetNativeDefinitionSupportsBooleanType() - { - $a = array('type' => 'boolean', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'INTEGER'); - } - public function testGetNativeDefinitionSupportsDateType() - { - $a = array('type' => 'date', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATE'); - } - public function testGetNativeDefinitionSupportsTimestampType() - { - $a = array('type' => 'timestamp', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'DATETIME'); - } - public function testGetNativeDefinitionSupportsTimeType() - { - $a = array('type' => 'time', 'fixed' => false); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TIME'); - } - public function testGetNativeDefinitionSupportsClobType() - { - $a = array('type' => 'clob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGTEXT'); - } - public function testGetNativeDefinitionSupportsBlobType() - { - $a = array('type' => 'blob'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'LONGBLOB'); - } - public function testGetNativeDefinitionSupportsCharType() - { - $a = array('type' => 'char', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'CHAR(10)'); - } - public function testGetNativeDefinitionSupportsVarcharType() - { - $a = array('type' => 'varchar', 'length' => 10); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(10)'); - } - public function testGetNativeDefinitionSupportsArrayType() - { - $a = array('type' => 'array', 'length' => 40); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'VARCHAR(40)'); - } - public function testGetNativeDefinitionSupportsStringType() - { - $a = array('type' => 'string'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDefinitionSupportsArrayType2() - { - $a = array('type' => 'array'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } - public function testGetNativeDefinitionSupportsObjectType() - { - $a = array('type' => 'object'); - - $this->assertEqual($this->dataDict->getNativeDeclaration($a), 'TEXT'); - } -} diff --git a/tests_old/DataDictSqliteTestCase.php b/tests_old/DataDictSqliteTestCase.php deleted file mode 100644 index 3cbeac525..000000000 --- a/tests_old/DataDictSqliteTestCase.php +++ /dev/null @@ -1,63 +0,0 @@ -dbh->query("CREATE TABLE test (col_null NULL, - col_int INTEGER NOT NULL, - col_real REAL, - col_text TEXT DEFAULT 'default' NOT NULL, - col_blob BLOB)"); - - $this->dict = new Doctrine_DataDict_Sqlite($this->dbh); - $this->columns = $this->dict->listTableColumns('test'); - } - public function testListTables() { - $result = $this->dict->listTables(); - - } - public function testIntegerType() { - $this->assertEqual($this->columns['col_int']->isUnique(), false); - $this->assertEqual($this->columns['col_int']->isNotNull(), true); - $this->assertEqual($this->columns['col_int']->defaultValue(), null); - $this->assertEqual($this->columns['col_int']->isPrimaryKey(), false); - $this->assertEqual($this->columns['col_int']->getType(), 'INTEGER'); - $this->assertEqual($this->columns['col_int']->getName(), 'col_int'); - } - public function testNullType() { - $this->assertEqual($this->columns['col_null']->isUnique(), false); - $this->assertEqual($this->columns['col_null']->isNotNull(), false); - $this->assertEqual($this->columns['col_null']->defaultValue(), null); - $this->assertEqual($this->columns['col_null']->isPrimaryKey(), false); - $this->assertEqual($this->columns['col_null']->getType(), 'numeric'); - $this->assertEqual($this->columns['col_null']->getName(), 'col_null'); - } - public function testTextType() { - $this->assertEqual($this->columns['col_text']->isUnique(), false); - $this->assertEqual($this->columns['col_text']->isNotNull(), true); - $this->assertEqual($this->columns['col_text']->defaultValue(), 'default'); - $this->assertEqual($this->columns['col_text']->isPrimaryKey(), false); - $this->assertEqual($this->columns['col_text']->getType(), 'TEXT'); - $this->assertEqual($this->columns['col_text']->getName(), 'col_text'); - } - public function testBlobType() { - $this->assertEqual($this->columns['col_blob']->isUnique(), false); - $this->assertEqual($this->columns['col_blob']->isNotNull(), false); - $this->assertEqual($this->columns['col_blob']->defaultValue(), null); - $this->assertEqual($this->columns['col_blob']->isPrimaryKey(), false); - $this->assertEqual($this->columns['col_blob']->getType(), 'BLOB'); - $this->assertEqual($this->columns['col_blob']->getName(), 'col_blob'); - } - public function testRealType() { - $this->assertEqual($this->columns['col_real']->isUnique(), false); - $this->assertEqual($this->columns['col_real']->isNotNull(), false); - $this->assertEqual($this->columns['col_real']->defaultValue(), null); - $this->assertEqual($this->columns['col_real']->isPrimaryKey(), false); - $this->assertEqual($this->columns['col_real']->getType(), 'REAL'); - $this->assertEqual($this->columns['col_real']->getName(), 'col_real'); - } -} -*/ diff --git a/tests_old/DataDictTestCase.php b/tests_old/DataDictTestCase.php deleted file mode 100644 index f80f421be..000000000 --- a/tests_old/DataDictTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_DataDict_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataDict_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/DataType/BooleanTestCase.php b/tests_old/DataType/BooleanTestCase.php deleted file mode 100644 index 89efbfc99..000000000 --- a/tests_old/DataType/BooleanTestCase.php +++ /dev/null @@ -1,118 +0,0 @@ -. - */ - -/** - * Doctrine_DataType_Boolean_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataType_Boolean_TestCase extends Doctrine_UnitTestCase { - public function prepareData() { } - public function prepareTables() { - $this->tables = array("BooleanTest"); - parent::prepareTables(); - } - - public function testSetFalse() { - $test = new BooleanTest(); - $test->is_working = false; - - $this->assertIdentical($test->is_working, false); - $this->assertEqual($test->state(), Doctrine_Entity::STATE_TDIRTY); - $test->save(); - - $test->refresh(); - $this->assertIdentical($test->is_working, false); - } - - public function testSetTrue() { - $test = new BooleanTest(); - $test->is_working = true; - $this->assertIdentical($test->is_working, true); - $test->save(); - - $test->refresh(); - $this->assertIdentical($test->is_working, true); - - $this->connection->clear(); - - $test = $test->getRepository()->find($test->id); - $this->assertIdentical($test->is_working, true); - } - public function testNormalQuerying() { - $query = new Doctrine_Query($this->connection); - $ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = 0'); - $this->assertEqual(count($ret), 1); - - $query = new Doctrine_Query($this->connection); - $ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = 1'); - - $this->assertEqual(count($ret), 1); - } - public function testPreparedQueries() { - $query = new Doctrine_Query($this->connection); - $ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = ?', array(false)); - $this->assertEqual(count($ret), 1); - - $query = new Doctrine_Query($this->connection); - $ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = ?', array(true)); - $this->assertEqual(count($ret), 1); - } - public function testFetchingWithSmartConversion() { - $query = new Doctrine_Query($this->connection); - $ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = false'); - $this->assertEqual(count($ret), 1); - - $query = new Doctrine_Query($this->connection); - $ret = $query->query('FROM BooleanTest WHERE BooleanTest.is_working = true'); - - $this->assertEqual(count($ret), 1); - } - - public function testSavingNullValue() { - $test = new BooleanTest(); - $this->is_working = null; - - $this->assertIdentical($this->is_working, null); - $this->assertEqual($test->state(), Doctrine_Entity::STATE_TDIRTY); - $test->save(); - - $test->refresh(); - $this->assertIdentical($test->is_working, null); - - $test = new BooleanTest(); - $this->is_working_notnull = null; - - $this->assertIdentical($this->is_working_notnull, null); - $this->assertEqual($test->state(), Doctrine_Entity::STATE_TDIRTY); - $test->save(); - - $test->refresh(); - $this->assertIdentical($test->is_working_notnull, false); - } - -} diff --git a/tests_old/DataType/EnumTestCase.php b/tests_old/DataType/EnumTestCase.php deleted file mode 100644 index 1a5fe6af2..000000000 --- a/tests_old/DataType/EnumTestCase.php +++ /dev/null @@ -1,213 +0,0 @@ -. - */ - -/** - * Doctrine_DataType_Enum_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_DataType_Enum_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array("EnumTest", "EnumTest2", "EnumTest3"); - parent::prepareTables(); - } - - public function testParameterConversion() - { - $test = new EnumTest(); - $test->status = 'open'; - $this->assertEqual($test->status, 'open'); - $test->save(); - - try { - $query = new Doctrine_Query($this->connection); - $ret = $query->query("FROM EnumTest WHERE EnumTest.status = 'open'"); - $this->assertEqual(count($ret), 1); - } catch (Exception $e) { - $this->fail(); - } - } - - public function testParameterConversionInCount() - { - try { - $query = new Doctrine_Query($this->connection); - $ret = $query->parseQuery("FROM EnumTest WHERE EnumTest.status = 'open'") - ->count(); - $this->assertEqual($ret, 1); - } catch (Exception $e) { - $this->fail(); - } - - try { - $query = new Doctrine_Query($this->connection); - $ret = $query->parseQuery("FROM EnumTest WHERE EnumTest.status = 'open'") - ->count(array('open')); - $this->assertEqual($ret, 1); - } catch (Exception $e) { - $this->fail(); - } - - - } - - public function testInAndNotIn() - { - try { - $query = new Doctrine_Query($this->connection); - $ret = $query->query("FROM EnumTest WHERE EnumTest.status IN ('open')"); - $this->assertEqual(count($ret), 1); - } catch (Exception $e) { - $this->fail(); - } - - try { - $query = new Doctrine_Query($this->connection); - $ret = $query->query("FROM EnumTest WHERE EnumTest.status NOT IN ('verified', 'closed')"); - $this->assertEqual(count($ret), 1); - } catch (Exception $e) { - $this->fail(); - } - } - - public function testExpressionComposition() - { - try { - $query = new Doctrine_Query($this->connection); - $ret = $query->query("FROM EnumTest e WHERE e.id > 0 AND (e.status != 'closed' OR e.status = 'verified')"); - $this->assertEqual(count($ret), 1); - } catch (Exception $e) { - $this->fail(); - } - } - - public function testNotEqual() - { - try { - $query = new Doctrine_Query($this->connection); - $ret = $query->query("FROM EnumTest WHERE EnumTest.status != 'closed'"); - $this->assertEqual(count($ret), 1); - } catch (Exception $e) { - $this->fail(); - } - } - - public function testEnumType() - { - - $enum = new EnumTest(); - $enum->status = 'open'; - $this->assertEqual($enum->status, 'open'); - $enum->save(); - $this->assertEqual($enum->status, 'open'); - $enum->refresh(); - $this->assertEqual($enum->status, 'open'); - - $enum->status = 'closed'; - - $this->assertEqual($enum->status, 'closed'); - - $enum->save(); - $this->assertEqual($enum->status, 'closed'); - $this->assertTrue(is_numeric($enum->id)); - $enum->refresh(); - $this->assertEqual($enum->status, 'closed'); - } - - public function testEnumTypeWithCaseConversion() - { - $this->conn->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER); - - $enum = new EnumTest(); - - $enum->status = 'open'; - $this->assertEqual($enum->status, 'open'); - - $enum->save(); - $this->assertEqual($enum->status, 'open'); - - $enum->refresh(); - $this->assertEqual($enum->status, 'open'); - - $enum->status = 'closed'; - - $this->assertEqual($enum->status, 'closed'); - - $enum->save(); - $this->assertEqual($enum->status, 'closed'); - - $enum->refresh(); - $this->assertEqual($enum->status, 'closed'); - - $this->conn->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); - } - - public function testFailingRefresh() - { - $enum = $this->connection->getRepository('EnumTest')->find(1); - - $this->conn->exec('DELETE FROM enum_test WHERE id = 1'); - - try { - $enum->refresh(); - - $this->fail(); - } catch(Doctrine_Record_Exception $e) { - $this->pass(); - } - } - - public function testEnumFetchArray() { - $q = new Doctrine_Query(); - $q->select('e.*') - ->from('EnumTest e') - ->limit(1); - $ret = $q->execute(array(), Doctrine::FETCH_ARRAY); - - if (is_numeric($ret[0]['status'])) { - $this->fail(); - } - } - - public function testLiteralEnumValueConversionSupportsJoins() - { - - $q = new Doctrine_Query($this->connection); - $q->addSelect('e.*') - ->addSelect('e3.*') - ->from('EnumTest e') - ->leftjoin('e.Enum3 e3') - ->where("e.status = 'verified'") - ->execute(); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.status AS e__status, e.text AS e__text, e2.text AS e2__text FROM enum_test e LEFT JOIN enum_test3 e2 ON e.text = e2.text WHERE e.status = 1"); - } -} diff --git a/tests_old/Db/ProfilerTestCase.php b/tests_old/Db/ProfilerTestCase.php deleted file mode 100644 index 97ed8aed4..000000000 --- a/tests_old/Db/ProfilerTestCase.php +++ /dev/null @@ -1,176 +0,0 @@ -. - */ - -/** - * Doctrine_Connection_Profiler_TestCase - * - * @package Doctrine - * @subpackage Doctrine_Db - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Connection_Profiler_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - {} - public function prepareData() - {} - - public function testQuery() - { - $this->conn = Doctrine_Manager::getInstance()->openConnection(array('sqlite::memory:')); - - $this->profiler = new Doctrine_Connection_Profiler(); - - $this->conn->setListener($this->profiler); - - $this->conn->exec('CREATE TABLE test (id INT)'); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'CREATE TABLE test (id INT)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::EXEC); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->conn->count(), 1); - } - public function testPrepareAndExecute() - { - - $stmt = $this->conn->prepare('INSERT INTO test (id) VALUES (?)'); - $event = $this->profiler->lastEvent(); - - $this->assertEqual($event->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $stmt->execute(array(1)); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->conn->count(), 2); - } - public function testMultiplePrepareAndExecute() - { - - $stmt = $this->conn->prepare('INSERT INTO test (id) VALUES (?)'); - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $stmt2 = $this->conn->prepare('INSERT INTO test (id) VALUES (?)'); - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $stmt->execute(array(1)); - $stmt2->execute(array(1)); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->conn->count(), 4); - - } - public function testExecuteStatementMultipleTimes() - { - try { - $stmt = $this->conn->prepare('INSERT INTO test (id) VALUES (?)'); - $stmt->execute(array(1)); - $stmt->execute(array(1)); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } - public function testTransactionRollback() - { - try { - $this->conn->beginTransaction(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::BEGIN); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - try { - $this->conn->rollback(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::ROLLBACK); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } - public function testTransactionCommit() - { - try { - $this->conn->beginTransaction(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::BEGIN); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - try { - $this->conn->commit(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - $this->conn->rollback(); - } - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::COMMIT); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } -} diff --git a/tests_old/DbProfilerTestCase.php b/tests_old/DbProfilerTestCase.php deleted file mode 100644 index a952c1eb9..000000000 --- a/tests_old/DbProfilerTestCase.php +++ /dev/null @@ -1,137 +0,0 @@ -dbh = Doctrine_Db2::getConnection('sqlite::memory:'); - - $this->profiler = new Doctrine_Db_Profiler(); - - $this->dbh->setListener($this->profiler); - - $this->dbh->query('CREATE TABLE test (id INT)'); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'CREATE TABLE test (id INT)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::QUERY); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->dbh->count(), 1); - } - public function testPrepareAndExecute() { - - $stmt = $this->dbh->prepare('INSERT INTO test (id) VALUES (?)'); - $event = $this->profiler->lastEvent(); - - $this->assertEqual($event->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $stmt->execute(array(1)); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->dbh->count(), 2); - } - public function testMultiplePrepareAndExecute() { - - $stmt = $this->dbh->prepare('INSERT INTO test (id) VALUES (?)'); - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $stmt2 = $this->dbh->prepare('INSERT INTO test (id) VALUES (?)'); - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::PREPARE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $stmt->execute(array(1)); - $stmt2->execute(array(1)); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->dbh->count(), 4); - } - public function testExecuteStatementMultipleTimes() { - try { - $stmt = $this->dbh->prepare('INSERT INTO test (id) VALUES (?)'); - $stmt->execute(array(1)); - $stmt->execute(array(1)); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::EXECUTE); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } - public function testTransactionRollback() { - try { - $this->dbh->beginTransaction(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::BEGIN); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - try { - $this->dbh->rollback(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::ROLLBACK); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } - public function testTransactionCommit() { - try { - $this->dbh->beginTransaction(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - } - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::BEGIN); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - - try { - $this->dbh->commit(); - $this->pass(); - } catch(Doctrine_Db_Exception $e) { - $this->fail($e->__toString()); - $this->dbh->rollback(); - } - - $this->assertEqual($this->profiler->lastEvent()->getQuery(), null); - $this->assertTrue($this->profiler->lastEvent()->hasEnded()); - $this->assertEqual($this->profiler->lastEvent()->getType(), Doctrine_Db_Event::COMMIT); - $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); - } -} diff --git a/tests_old/DoctrineTest.php b/tests_old/DoctrineTest.php deleted file mode 100644 index 83f63ecef..000000000 --- a/tests_old/DoctrineTest.php +++ /dev/null @@ -1,256 +0,0 @@ -. - */ - -/** - * Doctrine_UnitTestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @author Bjarte S. Karlsen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -require_once dirname(__FILE__) . '/DoctrineTest/UnitTestCase.php'; -require_once dirname(__FILE__) . '/DoctrineTest/GroupTest.php'; -require_once dirname(__FILE__) . '/DoctrineTest/Doctrine_UnitTestCase.php'; -require_once dirname(__FILE__) . '/DoctrineTest/Reporter.php'; - -class DoctrineTest -{ - - protected $testGroup; // the default test group - protected $groups; - - public function __construct() - { - $this->requireModels(); - $this->testGroup = new GroupTest('Doctrine Framework Unit Tests', 'main'); - } - - /** - * Add a test to be run. - * - * This is a thin wrapper around GroupTest that also store the testcase in - * this class so that it is easier to create custom groups - * - * @param UnitTestCase A test case - */ - public function addTestCase($testCase){ - $this->groups[$testCase->getName()] = $testCase; - $this->testGroup->addTestCase($testCase); - } - - /** - * Run the tests - * - * This method will run the tests with the correct Reporter. It will run - * grouped tests if asked to and filter results. It also has support for - * running coverage report. - * - */ - public function run(){ - $testGroup = $this->testGroup; - if (PHP_SAPI === 'cli') { - require_once(dirname(__FILE__) . '/DoctrineTest/Reporter/Cli.php'); - $reporter = new DoctrineTest_Reporter_Cli(); - $argv = $_SERVER['argv']; - array_shift($argv); - $options = $this->parseOptions($argv); - } else { - require_once(dirname(__FILE__) . '/DoctrineTest/Reporter/Html.php'); - $options = $_GET; - if(isset($options["filter"])){ - $options["filter"] = explode(",", $options["filter"]); - } - if(isset($options["group"])){ - $options["group"] = explode(",", $options["group"]); - } - $reporter = new DoctrineTest_Reporter_Html(); - } - - //replace global group with custom group if we have group option set - if (isset($options['group'])) { - $testGroup = new GroupTest('Doctrine Framework Custom test', 'custom'); - foreach($options['group'] as $group) { - if (isset($this->groups[$group])) { - $testGroup->addTestCase($this->groups[$group]); - } else if (class_exists($group)) { - $testGroup->addTestCase(new $group); - } else { - die($group . " is not a valid group or doctrine test class\n "); - } - } - } - - $filter = ''; - if (isset($options['filter'])) { - $filter = $options['filter']; - } - - //show help text - if (isset($options['help'])) { - echo "Doctrine test runner help\n"; - echo "===========================\n"; - echo " To run all tests simply run this script without arguments. \n"; - echo "\n Flags:\n"; - echo " -coverage will generate coverage report data that can be viewed with the cc.php script in this folder. NB! This takes time. You need xdebug to run this\n"; - echo " -group Use this option to run just a group of tests or tests with a given classname. Groups are currently defined as the variable name they are called in this script.\n"; - echo " -filter case insensitive strings that will be applied to the className of the tests. A test_classname must contain all of these strings to be run\n"; - echo "\nAvailable groups:\n tickets, transaction, driver, data_dict, sequence, export, import, expression, core, relation, data_types, utility, db, event_listener, query_tests, record, cache\n"; - die(); - } - - //generate coverage report - if (isset($options['coverage'])) { - - /* - * The below code will not work for me (meus). It would be nice if - * somebody could give it a try. Just replace this block of code - * with the one below - * - define('PHPCOVERAGE_HOME', dirname(dirname(__FILE__)) . '/vendor/spikephpcoverage'); - require_once PHPCOVERAGE_HOME . '/CoverageRecorder.php'; - require_once PHPCOVERAGE_HOME . '/reporter/HtmlCoverageReporter.php'; - - $covReporter = new HtmlCoverageReporter('Doctrine Code Coverage Report', '', 'coverage2'); - - $includePaths = array('../lib'); - $excludePaths = array(); - $cov = new CoverageRecorder($includePaths, $excludePaths, $covReporter); - - $cov->startInstrumentation(); - $testGroup->run($reporter, $filter); - $cov->stopInstrumentation(); - - $cov->generateReport(); - $covReporter->printTextSummary(); - */ - xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); - $testGroup->run($reporter, $filter); - $result['coverage'] = xdebug_get_code_coverage(); - xdebug_stop_code_coverage(); - file_put_contents(dirname(__FILE__) . '/coverage/coverage.txt', serialize($result)); - require_once dirname(__FILE__) . '/DoctrineTest/Coverage.php'; - $coverageGeneration = new DoctrineTest_Coverage(); - $coverageGeneration->generateReport(); - return; - // */ - - } - $testGroup->run($reporter, $filter); - } - - - /** - * Require all the models needed in the tests - * - */ - public function requireModels() - { - $models = new DirectoryIterator(dirname(__FILE__) . '/models/'); - foreach($models as $key => $file) { - if ($file->isFile() && ! $file->isDot()) { - $e = explode('.', $file->getFileName()); - if (end($e) === 'php') { - require_once $file->getPathname(); - } - } - } - } - - /** - * Parse Options from cli into an associative array - * - * @param array $array An argv array from cli - * @return array An array with options - */ - public function parseOptions($array) { - $currentName=''; - $options=array(); - foreach($array as $name) { - if (strpos($name,'-')===0) { - $name=str_replace('-','',$name); - $currentName=$name; - if ( ! isset($options[$currentName])) { - $options[$currentName]=array(); - } - } else { - $values=$options[$currentName]; - array_push($values,$name); - $options[$currentName]=$values; - } - } - return $options; - } - - /** - * Autoload test cases - * - * Will create test case if it does not exist - * - * @param string $class The name of the class to autoload - * @return boolean True - */ - public static function autoload($class) { - if (strpos($class, 'TestCase') === false) { - return false; - } - - $e = explode('_', $class); - $count = count($e); - - $prefix = array_shift($e); - - if ($prefix !== 'Doctrine') { - return false; - } - - $dir = array_shift($e); - - $file = $dir . '_' . substr(implode('_', $e), 0, -(strlen('_TestCase'))) . 'TestCase.php'; - - if ( $count > 3) { - $file = str_replace('_', DIRECTORY_SEPARATOR, $file); - } else { - $file = str_replace('_', '', $file); - } - - // create a test case file if it doesn't exist - - if ( ! file_exists($file)) { - $contents = file_get_contents('template.tpl'); - $contents = sprintf($contents, $class, $class); - - if ( ! file_exists($dir)) { - mkdir($dir, 0777); - } - - file_put_contents($file, $contents); - } - require_once($file); - - return true; - } -} diff --git a/tests_old/DoctrineTest/Coverage.php b/tests_old/DoctrineTest/Coverage.php deleted file mode 100644 index 893d46164..000000000 --- a/tests_old/DoctrineTest/Coverage.php +++ /dev/null @@ -1,340 +0,0 @@ -. - */ - -/** - * Doctrine_UnitTestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @author Bjarte S. Karlsen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class DoctrineTest_Coverage -{ - - const COVERED = 1; - const MAYBE = -2; - const NOTCOVERED = -1; - - private $covered; - private $totallines = 0; - private $totalcovered = 0; - private $totalmaybe = 0; - private $totalnotcovered = 0; - private $result; - - /* - * Create a new Coverage object. We read data from a fixed file. - */ - public function __construct() - { - $this->result = unserialize(file_get_contents($this->getCoverageDir() . "coverage.txt")); - $this->sortBy ="percentage"; // default sort - } - - /** - * Get the directory to store coverage report in - * - * @return string The path to store the coverage in - */ - public function getCoverageDir(){ - $dir = Doctrine::getPath() . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "tests" . DIRECTORY_SEPARATOR . "coverage" . DIRECTORY_SEPARATOR; - return $dir; - } - - /* - * Show a summary of all files in Doctrine and their coverage data - * - */ - public function showSummary() - { - if ( isset($_GET['order'])){ - $this->sortBy = $_GET['order']; - } - - if ( ! isset($this->result['data'])){ - die("Impropper coverage report. Please regenerate"); - } - - $coveredArray = $this->result["data"]; - //lets sort it. - uasort($coveredArray, array($this,"sortArray")); - - //and flip if it perhaps? - if (isset($_GET["flip"]) && $_GET["flip"] == "true"){ - $coveredArray = array_reverse($coveredArray, true); - } - - $totals = $this->result["totals"]; - - echo 'TOTAL' , - $totals['percentage'] , '%' , - $totals['lines'] , '' , - $totals['covered'] , '', - $totals['maybe'] , '', - $totals['notcovered'] , ''; - - foreach($coveredArray as $class => $info){ - - echo ''; - if ( $info['type'] == "covered") { - echo '', $class , ''; - }else{ - echo $class; - } - echo '' . $info['percentage'] . ' % ' . $info['total'] . '' . $info['covered'] . '' . $info['maybe'] . '' . $info['notcovered']. ''; - } - } - - - /** - * Return the revision the coverage was made against - * - *@param int The revision number - */ - public function getRevision(){ - return $this->result["revision"]; - } - - /** - * Generate the report. - * - * This method will analyze the coverage data and create a data array that - * contains information about each of the classes in Doctrine/lib. It will - * also generate html files for each file that has coverage data with - * information about what lines that are covered. - * - * - * @uses generateCoverageInfoCoveredFile - * @uses saveFile - * @uses generateCoverageInfoNotCoveredFile - * @uses getCoverageDir - * @uses calculateTotalPercentage - * - */ - public function generateReport(){ - $svn_info = explode(" ", exec("svn info | grep Revision")); - $this->result["revision"] = $svn_info[1]; - - //loop through all files and generate coverage files for them - $it = new RecursiveDirectoryIterator(Doctrine::getPath()); - $notCoveredArray = array(); - foreach (new RecursiveIteratorIterator($it) as $file){ - - if(strpos($file->getPathname(), "config.php")){ - continue; - } - - if (strpos($file->getPathname(), ".svn")){ - continue; - } - - $class = $this->getClassNameFromFileName($file->getPathname()); - - if (strpos($class, '_Interface')) { - continue; - } - - if ( ! class_exists($class)){ - continue; - } - if (isset($this->result['coverage'][$file->getPathname()])){ - $coverageInfo[$class] = $this->generateCoverageInfoCoveredFile($file->getPathname()); - $this->saveFile($file->getPathname()); - }else{ - $coverageInfo[$class] = $this->generateCoverageInfoNotCoveredFile($class); - } - } - $this->result["totals"] = array( - "lines" => $this->totallines, - "notcovered" => $this->totalnotcovered, - "covered" => $this->totalcovered, - "maybe" => $this->totalmaybe, - "percentage" => $this->calculateTotalPercentage()); - - $this->result["data"] = $coverageInfo; - - file_put_contents($this->getCoverageDir() . "coverage.txt", serialize($this->result)); - return true; - - } - - /** - * - * Return the name of a class from its filename. - * - * This method simply removes the Doctrine Path and raplces _ with / and - * removes .php to get the classname for a file - * - * @param string $fileName The name of the file - * @return string The name of the class - */ - public function getClassNameFromFileName($fileName){ - $path = Doctrine::getPath() . DIRECTORY_SEPARATOR; - $class = str_replace($path, "", $fileName); - $class = str_replace(DIRECTORY_SEPARATOR, "_", $class); - $class = substr($class, 0,-4); - return $class; - } - - /** - * Calculate total coverage percentage - * - *@return double The percetage as a double - */ - public function calculateTotalPercentage(){ - return round((($this->totalcovered + $this->totalmaybe) / $this->totallines) * 100, 2); - } - - /** - * Generate Coverage for a class that is not in the coverage report. - * - * This method will simply check if the method has no lines that should be - * tested or not. Then it will return data to be stored for later use. - * - * @param string $class The name of a class - * @return array An associative array with coverage information - */ - public function generateCoverageInfoNotCoveredFile($class){ - try{ - $refClass = new ReflectionClass($class); - } catch (Exception $e){ - echo $e->getMessage(); - } - $lines = 0; - $methodLines = 0; - foreach ($refClass->getMethods() as $refMethod){ - if ($refMethod->getDeclaringClass() != $refClass){ - continue; - } - $methodLines = $refMethod->getEndLine() - $refMethod->getStartLine(); - $lines += $methodLines; - } - $this->totallines += $lines; - $this->totalnotcovered += $lines; - if ($lines == 0){ - return array("covered" => 0, "maybe" => 0, "notcovered"=>$lines, "total" => $lines, "percentage" => 100, "type" => "notcovered"); - } else { - return array("covered" => 0, "maybe" => 0, "notcovered"=>$lines, "total" => $lines, "percentage" => 0, "type" => "notcovered"); - } - } - - - /* - * Save a html report for the given filename - * - * @param string $fileName The name of the file - */ - public function saveFile($fileName) - { - $className = $this->getClassNameFromFileName($fileName); - $title = "Coverage for " . $className; - - $html = ' - - ' . $title . ' - - -

    ' . $title . '

    Back to coverage report

    '; - $coveredLines = $this->result["coverage"][$fileName]; - $fileArray = file($fileName); - - $html .= '' . "\n"; - foreach ($fileArray as $num => $line){ - $linenum = $num+1; - $html .= '' . "\n"; - $class ="normal"; - if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == self::COVERED){ - $class = "covered"; - } else if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == self::NOTCOVERED) { - $class ="red"; - } else if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == self::MAYBE) { - $class ="orange"; - } - - $line = str_replace(" ", " ", htmlspecialchars($line)); - $html .= '' . "\n"; - } - $html .='
    ' . $linenum . '' . $line . '
    '; - file_put_contents($this->getCoverageDir() . $className . ".html",$html); - } - - /* - * Generate coverage data for tested file - * - *@return array An array of coverage data - */ - public function generateCoverageInfoCoveredFile($file) - { - $lines = $this->result["coverage"][$file]; - - $total = count($lines) -1; //we have to remove one since it always reports the last line as a hit - $covered = 0; - $maybe = 0; - $notcovered = 0; - foreach ($lines as $result){ - switch($result){ - case self::COVERED: - $covered++; - break; - case self::NOTCOVERED: - $notcovered++; - break; - case self::MAYBE: - $maybe++; - break; - } - } - $covered--; //again we have to remove that last line. - $this->totallines += $total; - $this->totalcovered += $covered; - $this->totalnotcovered += $notcovered; - $this->totalmaybe += $maybe; - - if ($total === 0) { - $total = 1; - } - $percentage = round((($covered + $maybe) / $total) * 100, 2); - return array("covered" => $covered, "maybe" => $maybe, "notcovered"=>$notcovered, "total" => $total, "percentage" => $percentage, "type" => "covered"); - } - - /* - * Uasort function to sort the array by key - * - */ - public function sortArray($a, $b) - { - if ($a[$this->sortBy] == $b[$this->sortBy]) { - return 0; - } - return ( $a[$this->sortBy] < $b[$this->sortBy]) ? 1 : -1; - } -} diff --git a/tests_old/DoctrineTest/Doctrine_UnitTestCase.php b/tests_old/DoctrineTest/Doctrine_UnitTestCase.php deleted file mode 100644 index 4299675ff..000000000 --- a/tests_old/DoctrineTest/Doctrine_UnitTestCase.php +++ /dev/null @@ -1,312 +0,0 @@ -. - */ - -/** - * Doctrine_UnitTestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_UnitTestCase extends UnitTestCase -{ - protected $manager; - protected $connection; - protected $objTable; - protected $new; - protected $old; - protected $dbh; - protected $listener; - - protected $users; - protected $valueHolder; - protected $tables = array(); - protected $unitOfWork; - protected $driverName = false; - protected $generic = false; - protected $conn; - protected $adapter; - protected $export; - protected $expr; - protected $dataDict; - protected $transaction; - protected $_name; - - - protected $init = false; - - public function getName(){ - return $this->_name; - } - - public function init() - { - $this->_name = get_class($this); - - $this->manager = Doctrine_Manager::getInstance(); - $this->manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL); - - $this->tables = array_merge($this->tables, - array('Entity', - 'EntityReference', - 'Email', - 'Phonenumber', - 'Groupuser', - 'Album', - 'Book', - 'Song', - 'Element', - 'Error', - 'Description', - 'Address', - 'Account', - 'Task', - 'Resource', - 'Assignment', - 'ResourceType', - 'ResourceReference') - ); - - - $class = get_class($this); - $e = explode('_', $class); - - - if ( ! $this->driverName) { - $this->driverName = 'main'; - - switch($e[1]) { - case 'Export': - case 'Import': - case 'Transaction': - case 'DataDict': - case 'Sequence': - $this->driverName = 'Sqlite'; - break; - } - - $module = $e[1]; - - if(count($e) > 3) { - $driver = $e[2]; - switch($e[2]) { - case 'Firebird': - case 'Informix': - case 'Mysql': - case 'Mssql': - case 'Oracle': - case 'Pgsql': - case 'Sqlite': - $this->driverName = $e[2]; - break; - } - } - } - - try { - $this->conn = $this->connection = $this->manager->getConnection($this->driverName); - $this->manager->setCurrentConnection($this->driverName); - - $this->connection->evictTables(); - $this->dbh = $this->adapter = $this->connection->getDbh(); - $this->listener = $this->manager->getAttribute(Doctrine::ATTR_LISTENER); - - $this->manager->setAttribute(Doctrine::ATTR_LISTENER, $this->listener); - - } catch (Doctrine_Manager_Exception $e) { - if($this->driverName == 'main') { - $this->dbh = new PDO('sqlite::memory:'); - $this->dbh->sqliteCreateFunction('trim', 'trim', 1); - } else { - $this->dbh = $this->adapter = new Doctrine_Adapter_Mock($this->driverName); - } - - $this->conn = $this->connection = $this->manager->openConnection($this->dbh, $this->driverName); - - if ($this->driverName !== 'main') { - $exc = 'Doctrine_Connection_' . ucwords($this->driverName) . '_Exception'; - - $this->exc = new $exc(); - - } else { - } - - $this->listener = new Doctrine_EventListener(); - $this->manager->setAttribute(Doctrine::ATTR_LISTENER, $this->listener); - } - - if ($this->driverName !== 'main') { - if (isset($module)) { - switch($module) { - case 'Export': - case 'Import': - case 'Transaction': - case 'Sequence': - case 'Expression': - $lower = strtolower($module); - - $this->$lower = $this->connection->$lower; - break; - case 'DataDict': - $this->dataDict = $this->connection->dataDict; - break; - } - } - } - - $this->unitOfWork = $this->connection->unitOfWork; - $this->connection->setListener(new Doctrine_EventListener()); - $this->query = new Doctrine_Query($this->connection); - - if ($this->driverName === 'main') { - $this->prepareTables(); - $this->prepareData(); - } - } - - public function prepareTables() { - foreach ($this->tables as $name) { - $table = $this->connection->getMetadata($name); - $query = 'DROP TABLE ' . $table->getTableName(); - try { - $this->conn->exec($query); - } catch (Doctrine_Connection_Exception $e) {} - } - //echo "exporting : " . var_dump($this->tables); - //echo "

    "; - $this->conn->export->exportClasses($this->tables); - $this->objTable = $this->connection->getRepository('User'); - } - - public function prepareData() - { - $groups = new Doctrine_Collection('Group'); - - $groups[0]->name = 'Drama Actors'; - - $groups[1]->name = 'Quality Actors'; - - - $groups[2]->name = 'Action Actors'; - $groups[2]['Phonenumber'][0]->phonenumber = '123 123'; - $groups->save(); - - $users = new Doctrine_Collection('User'); - - - $users[0]->name = 'zYne'; - $users[0]['Email']->address = 'zYne@example.com'; - $users[0]['Phonenumber'][0]->phonenumber = '123 123'; - - $users[1]->name = 'Arnold Schwarzenegger'; - $users[1]->Email->address = 'arnold@example.com'; - $users[1]['Phonenumber'][0]->phonenumber = '123 123'; - $users[1]['Phonenumber'][1]->phonenumber = '456 456'; - $users[1]->Phonenumber[2]->phonenumber = '789 789'; - $users[1]->Group[0] = $groups[2]; - - $users[2]->name = 'Michael Caine'; - $users[2]->Email->address = 'caine@example.com'; - $users[2]->Phonenumber[0]->phonenumber = '123 123'; - - $users[3]->name = 'Takeshi Kitano'; - $users[3]->Email->address = 'kitano@example.com'; - $users[3]->Phonenumber[0]->phonenumber = '111 222 333'; - - $users[4]->name = 'Sylvester Stallone'; - $users[4]->Email->address = 'stallone@example.com'; - $users[4]->Phonenumber[0]->phonenumber = '111 555 333'; - $users[4]['Phonenumber'][1]->phonenumber = '123 213'; - $users[4]['Phonenumber'][2]->phonenumber = '444 555'; - - $users[5]->name = 'Kurt Russell'; - $users[5]->Email->address = 'russell@example.com'; - $users[5]->Phonenumber[0]->phonenumber = '111 222 333'; - - $users[6]->name = 'Jean Reno'; - $users[6]->Email->address = 'reno@example.com'; - $users[6]->Phonenumber[0]->phonenumber = '111 222 333'; - $users[6]['Phonenumber'][1]->phonenumber = '222 123'; - $users[6]['Phonenumber'][2]->phonenumber = '123 456'; - - $users[7]->name = 'Edward Furlong'; - $users[7]->Email->address = 'furlong@example.com'; - $users[7]->Phonenumber[0]->phonenumber = '111 567 333'; - - $this->users = $users; - $this->users->save(); - } - - public function getConnection() - { - return $this->connection; - } - - public function assertDeclarationType($type, $type2) - { - $dec = $this->getDeclaration($type); - - if ( ! is_array($type2)) { - $type2 = array($type2); - } - - $this->assertEqual($dec['type'], $type2); - } - - public function getDeclaration($type) - { - return $this->dataDict->getPortableDeclaration(array('type' => $type, 'name' => 'colname', 'length' => 1, 'fixed' => true)); - } - - public function clearCache() - { - foreach($this->tables as $name) { - $table = $this->connection->getTable($name); - $table->getCache()->deleteAll(); - } - } - - public function setUp() - { - if ( ! $this->init) { - $this->init(); - } - - if (isset($this->objTable)) { - $this->objTable->clear(); - } - - $this->init = true; - } - - public function tearDown() - { - /*foreach ($this->tables as $table) { - foreach ($this->conn->getMapper($table)->getRepository() as $obj) { - $obj->free(); - } - }*/ - } -} diff --git a/tests_old/DoctrineTest/GroupTest.php b/tests_old/DoctrineTest/GroupTest.php deleted file mode 100644 index 600887782..000000000 --- a/tests_old/DoctrineTest/GroupTest.php +++ /dev/null @@ -1,77 +0,0 @@ -_title = $title; - $this->_name = $name; - } - - public function getName(){ - return $this->_name; - } - - public function addTestCase(UnitTestCase $testCase) - { - if($testCase instanceOf GroupTest) { - $this->_testCases = array_merge($this->_testCases, $testCase->getTestCases()); - } else { - $this->_testCases[get_class($testCase)] = $testCase; - } - } - - public function shouldBeRun($testCase, $filter){ - if ( ! is_array($filter)) { - return true; - } - foreach($filter as $subFilter) { - $name = strtolower(get_class($testCase)); - $pos = strpos($name, strtolower($subFilter)); - //it can be 0 so we have to use === to see if false - if ($pos === false) { - return false; - } - } - return true; - } - public function run(DoctrineTest_Reporter $reporter = null, $filter = null) - { - $reporter->paintHeader($this->_title); - foreach ($this->_testCases as $k => $testCase) { - if ( ! $this->shouldBeRun($testCase, $filter)) { - continue; - } - try{ - $testCase->run(); - } catch(Exception $e) { - $this->_failed += 1; - $this->_messages[] = 'Unexpected exception thrown with message [' . $e->getMessage() . '] in ' . $e->getFile() . ' on line ' . $e->getLine(); - } - $this->_passed += $testCase->getPassCount(); - $this->_failed += $testCase->getFailCount(); - $this->_messages = array_merge($this->_messages, $testCase->getMessages()); - - $this->_testCases[$k] = null; - echo $reporter->getProgressIndicator(); - set_time_limit(900); - } - $reporter->setTestCase($this); - - $reporter->paintFooter(); - } - - - public function getTestCaseCount() - { - return count($this->_testCases); - } - - public function getTestCases(){ - return $this->_testCases; - } -} - diff --git a/tests_old/DoctrineTest/Reporter.php b/tests_old/DoctrineTest/Reporter.php deleted file mode 100644 index b849ce97a..000000000 --- a/tests_old/DoctrineTest/Reporter.php +++ /dev/null @@ -1,12 +0,0 @@ -_test = $test; - } -} - diff --git a/tests_old/DoctrineTest/Reporter/Cli.php b/tests_old/DoctrineTest/Reporter/Cli.php deleted file mode 100644 index 8d764776f..000000000 --- a/tests_old/DoctrineTest/Reporter/Cli.php +++ /dev/null @@ -1,23 +0,0 @@ -_test->getMessages() as $message) { - print $message . "\n"; - } - echo "====================\n"; - print "Tested: " . $this->_test->getTestCaseCount() . ' test cases' ."\n"; - print "Successes: " . $this->_test->getPassCount() . " passes. \n"; - print "Failures: " . $this->_test->getFailCount() . " fails. \n"; - } - - - public function getProgressIndicator(){ - return "."; - } -} diff --git a/tests_old/DoctrineTest/Reporter/Html.php b/tests_old/DoctrineTest/Reporter/Html.php deleted file mode 100644 index 0f5964b76..000000000 --- a/tests_old/DoctrineTest/Reporter/Html.php +++ /dev/null @@ -1,83 +0,0 @@ - - - - Doctrine Unit Tests - - - - - -
    -

    - -paintSummary(); - $this->paintMessages(); - $this->paintSummary(); - print '
    '; - } - - public function paintMessages() - { - print '
    '; - foreach ($this->_test->getMessages() as $message) { - print "

    $message

    "; - } - print '
    '; - } - - public function paintSummary() - { - $color = ($this->_test->getFailCount() > 0 ? 'red' : 'green'); - print '
    '; - print $this->_test->getTestCaseCount() . ' test cases. '; - print '' . $this->_test->getPassCount() . ' passes and '; - print '' . $this->_test->getFailCount() . ' fails.'; - print '
    '; - } - - public function getProgressIndicator() {} - } diff --git a/tests_old/DoctrineTest/UnitTestCase.php b/tests_old/DoctrineTest/UnitTestCase.php deleted file mode 100644 index 04f8be14e..000000000 --- a/tests_old/DoctrineTest/UnitTestCase.php +++ /dev/null @@ -1,140 +0,0 @@ -_passed++; - } else { - $seperator = "
    "; - if(PHP_SAPI === "cli"){ - $seperator = "\n"; - } - if(is_array($value)){ - $value = var_export($value, true); - } - if(is_array($value2)){ - $value2 = var_export($value2, true); - } - - $message = "$seperator Value1: $value $seperator != $seperator Value2: $value2 $seperator"; - - $this->_fail($message); - } - } - - public function assertIdentical($value, $value2) - { - if ($value === $value2) { - $this->_passed++; - } else { - $this->_fail(); - } - } - - public function assertNotEqual($value, $value2) - { - if ($value != $value2) { - $this->_passed++; - } else { - $this->_fail(); - } - } - public function assertTrue($expr) - { - if ($expr) { - $this->_passed++; - } else { - $this->_fail(); - } - } - public function assertFalse($expr) - { - if ( ! $expr) { - $this->_passed++; - } else { - $this->_fail(); - } - } - - public function assertNull($expr) - { - if (is_null($expr)) { - $this->pass(); - } else { - $this->fail(); - } - } - - public function assertNotNull($expr) - { - if (is_null($expr)) { - $this->fail(); - } else { - $this->pass(); - } - } - - public function pass() - { - $this->_passed++; - } - public function fail($message = "") - { - $this->_fail($message); - } - public function _fail($message = "") - { - $trace = debug_backtrace(); - array_shift($trace); - - - foreach ($trace as $stack) { - if (substr($stack['function'], 0, 4) === 'test') { - $class = new ReflectionClass($stack['class']); - - if ( ! isset($line)) { - $line = $stack['line']; - } - - $errorMessage = $class->getName() . ' : method ' . $stack['function'] . ' failed on line ' . $line; - $this->_messages[] = $errorMessage . " " . $message; - break; - } - $line = $stack['line']; - } - $this->_failed++; - } - public function run(DoctrineTest_Reporter $reporter = null, $filter = null) - { - foreach (get_class_methods($this) as $method) { - if (substr($method, 0, 4) === 'test') { - $this->setUp(); - $this->$method(); - $this->tearDown(); - } - } - } - - public function setUp() {} - public function tearDown() {} - - public function getMessages() - { - return $this->_messages; - } - public function getFailCount() - { - return $this->_failed; - } - public function getPassCount() - { - return $this->_passed; - } -} diff --git a/tests_old/DriverTestCase.php b/tests_old/DriverTestCase.php deleted file mode 100644 index d9e3933df..000000000 --- a/tests_old/DriverTestCase.php +++ /dev/null @@ -1,199 +0,0 @@ -name = $name; - } - public function getName() - { - return $this->name; - } - public function pop() - { - return array_pop($this->queries); - } - public function forceException($name, $message = '', $code = 0) - { - $this->exception = array($name, $message, $code); - } - public function prepare($query) - { - return new AdapterStatementMock($this, $query); - } - public function addQuery($query) - { - $this->queries[] = $query; - } - public function query($query) { - $this->queries[] = $query; - - $e = $this->exception; - - if( ! empty($e)) { - $name = $e[0]; - - $this->exception = array(); - - throw new $name($e[1], $e[2]); - } - - return new AdapterStatementMock($this, $query); - } - public function getAll() { - return $this->queries; - } - public function quote($input) { - return "'" . addslashes($input) . "'"; - } - public function exec($statement) { - $this->queries[] = $statement; - - $e = $this->exception; - - if( ! empty($e)) { - $name = $e[0]; - - $this->exception = array(); - - throw new $name($e[1], $e[2]); - } - - return 0; - } - public function forceLastInsertIdFail($fail = true) - { - if ($fail) { - $this->lastInsertIdFail = true; - } else { - $this->lastInsertIdFail = false; - } - } - public function lastInsertId() - { - $this->queries[] = 'LAST_INSERT_ID()'; - if ($this->lastInsertIdFail) { - return null; - } else { - return 1; - } - } - public function beginTransaction(){ - $this->queries[] = 'BEGIN TRANSACTION'; - } - public function commit(){ - $this->queries[] = 'COMMIT'; - } - public function rollBack() - { - $this->queries[] = 'ROLLBACK'; - } - public function errorCode(){ } - public function errorInfo(){ } - public function getAttribute($attribute) { - if($attribute == PDO::ATTR_DRIVER_NAME) - return strtolower($this->name); - } - public function setAttribute($attribute, $value) { - - } -} -class AdapterStatementMock { - - private $mock; - - private $query; - - public function __construct(AdapterMock $mock, $query) { - $this->mock = $mock; - $this->query = $query; - } - public function fetch($fetchMode) { - return array(); - } - public function fetchAll($fetchMode) { - return array(); - } - public function execute() { - $this->mock->addQuery($this->query); - return true; - } - public function fetchColumn($colnum = 0) { - return 0; - } -} - -class Doctrine_Driver_UnitTestCase extends UnitTestCase { - protected $driverName = false; - protected $generic = false; - protected $manager; - protected $conn; - protected $adapter; - protected $export; - protected $dataDict; - protected $transaction; - - public function __construct($driverName, $generic = false) { - - $this->driverName = $driverName; - $this->generic = $generic; - } - public function assertDeclarationType($type, $type2) { - $dec = $this->getDeclaration($type); - if( ! is_array($type2)) - $type2 = array($type2); - $this->assertEqual($dec[0], $type2); - } - public function getDeclaration($type) { - return $this->dataDict->getPortableDeclaration(array('type' => $type, 'name' => 'colname', 'length' => 1, 'fixed' => true)); - } - public function setDriverName($driverName) { - $this->driverName = $driverName; - } - public function init() { - $this->adapter = new AdapterMock($this->driverName); - $this->manager = Doctrine_Manager::getInstance(); - $this->manager->setDefaultAttributes(); - $this->conn = $this->manager->openConnection($this->adapter); - - if( ! $this->generic) { - $this->export = $this->conn->export; - - $name = $this->adapter->getName(); - - if($this->adapter->getName() == 'oci') - $name = 'Oracle'; - - $tx = 'Doctrine_Transaction_' . ucwords($name); - $dataDict = 'Doctrine_DataDict_' . ucwords($name); - - $exc = 'Doctrine_Connection_' . ucwords($name) . '_Exception'; - - $this->exc = new $exc(); - if(class_exists($tx)) - $this->transaction = new $tx($this->conn); - if(class_exists($dataDict)) { - $this->dataDict = new $dataDict($this->conn); - } - //$this->dataDict = $this->conn->dataDict; - } else { - $this->export = new Doctrine_Export($this->conn); - $this->transaction = new Doctrine_Transaction($this->conn); - } - } - - public function setUp() { - static $init = false; - if( ! $init) { - $this->init(); - $init = true; - } - } -} diff --git a/tests_old/EventListener/ChainTestCase.php b/tests_old/EventListener/ChainTestCase.php deleted file mode 100644 index 9bf94a2a8..000000000 --- a/tests_old/EventListener/ChainTestCase.php +++ /dev/null @@ -1,50 +0,0 @@ -. - */ - -/** - * Doctrine_EventListener_Chain_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_EventListener_Chain_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('EventListenerChainTest'); - parent::prepareTables(); - } - public function testAccessorInvokerChain() - { - $e = new EventListenerChainTest; - $e->name = "something"; - - } - -} - diff --git a/tests_old/EventListenerTestCase.php b/tests_old/EventListenerTestCase.php deleted file mode 100644 index 0c21775d8..000000000 --- a/tests_old/EventListenerTestCase.php +++ /dev/null @@ -1,199 +0,0 @@ -. - */ - -/** - * Doctrine_EventListener_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_EventListener_TestCase extends Doctrine_UnitTestCase { - private $logger; - - - public function prepareData() - { } - public function prepareTables() { - $this->tables = array('EventListenerTest'); - parent::prepareTables(); - } - - public function testSetListener() { - $this->logger = new Doctrine_EventListener_TestLogger(); - - $e = new EventListenerTest; - - $e->getTable()->setListener($this->logger); - - $e->name = 'listener'; - $e->save(); - - $this->assertEqual($e->getTable()->getListener(), $this->logger); - } - - /** - public function testOnLoad() { - $this->logger->clear(); - $this->assertEqual($this->connection->getTable('EventListenerTest')->getListener(), $this->logger); - $this->connection->clear(); - - $e = $this->connection->getTable('EventListenerTest')->find(1); - - - $this->assertEqual($e->getTable()->getListener(), $this->logger); - - $this->assertEqual($this->logger->pop(), 'onLoad'); - $this->assertEqual($this->logger->pop(), 'onPreLoad'); - } - - public function testOnCreate() { - $e = new EventListenerTest; - - - $e->setListener($this->logger); - $this->logger->clear(); - $e = new EventListenerTest; - - $this->assertEqual($this->logger->pop(), 'onCreate'); - $this->assertEqual($this->logger->pop(), 'onPreCreate'); - $this->assertEqual($this->logger->count(), 0); - } - public function testOnSleepAndOnWakeUp() { - $e = new EventListenerTest; - - $this->logger->clear(); - - $s = serialize($e); - - $this->assertEqual($this->logger->pop(), 'onSleep'); - $this->assertEqual($this->logger->count(), 0); - - $e = unserialize($s); - - $this->assertEqual($this->logger->pop(), 'onWakeUp'); - $this->assertEqual($this->logger->count(), 0); - } - public function testTransaction() { - $e = new EventListenerTest(); - $e->name = "test 1"; - - $this->logger->clear(); - - $e->save(); - - $this->assertEqual($this->logger->pop(), 'onSave'); - $this->assertEqual($this->logger->pop(), 'onInsert'); - $this->assertEqual($this->logger->pop(), 'onPreInsert'); - $this->assertEqual($this->logger->pop(), 'onPreSave'); - - $e->name = "test 2"; - - $e->save(); - - $this->assertEqual($this->logger->pop(), 'onSave'); - $this->assertEqual($this->logger->pop(), 'onUpdate'); - $this->assertEqual($this->logger->pop(), 'onPreUpdate'); - $this->assertEqual($this->logger->pop(), 'onPreSave'); - - $this->logger->clear(); - - $e->delete(); - - $this->assertEqual($this->logger->pop(), 'onDelete'); - $this->assertEqual($this->logger->pop(), 'onPreDelete'); - } - public function testTransactionWithConnectionListener() { - $e = new EventListenerTest(); - $e->getTable()->getConnection()->setListener($this->logger); - - $e->name = "test 2"; - - $this->logger->clear(); - - $e->save(); - - $this->assertEqual($this->logger->pop(), 'onTransactionCommit'); - $this->assertEqual($this->logger->pop(), 'onPreTransactionCommit'); - $this->assertEqual($this->logger->pop(), 'onSave'); - $this->assertEqual($this->logger->pop(), 'onInsert'); - $this->assertEqual($this->logger->pop(), 'onPreInsert'); - $this->assertEqual($this->logger->pop(), 'onPreSave'); - - $this->assertEqual($this->logger->pop(), 'onTransactionBegin'); - $this->assertEqual($this->logger->pop(), 'onPreTransactionBegin'); - - $e->name = "test 1"; - - $e->save(); - - $this->assertEqual($this->logger->pop(), 'onTransactionCommit'); - $this->assertEqual($this->logger->pop(), 'onPreTransactionCommit'); - $this->assertEqual($this->logger->pop(), 'onSave'); - $this->assertEqual($this->logger->pop(), 'onUpdate'); - $this->assertEqual($this->logger->pop(), 'onPreUpdate'); - $this->assertEqual($this->logger->pop(), 'onPreSave'); - - $this->assertEqual($this->logger->pop(), 'onTransactionBegin'); - $this->assertEqual($this->logger->pop(), 'onPreTransactionBegin'); - - $this->logger->clear(); - - $e->delete(); - - $this->assertEqual($this->logger->pop(), 'onTransactionCommit'); - $this->assertEqual($this->logger->pop(), 'onPreTransactionCommit'); - $this->assertEqual($this->logger->pop(), 'onDelete'); - - $this->assertEqual($this->logger->pop(), 'onPreDelete'); - $this->assertEqual($this->logger->pop(), 'onTransactionBegin'); - $this->assertEqual($this->logger->pop(), 'onPreTransactionBegin'); - - $this->connection->setListener(new Doctrine_EventListener()); - } - */ -} - -class Doctrine_EventListener_TestLogger implements Doctrine_Overloadable, Countable { - private $messages = array(); - - public function __call($m, $a) { - - $this->messages[] = $m; - } - public function pop() { - return array_pop($this->messages); - } - public function clear() { - $this->messages = array(); - } - public function getAll() { - return $this->messages; - } - public function count() { - return count($this->messages); - } -} - diff --git a/tests_old/Export/CheckConstraintTestCase.php b/tests_old/Export/CheckConstraintTestCase.php deleted file mode 100644 index 5070111ba..000000000 --- a/tests_old/Export/CheckConstraintTestCase.php +++ /dev/null @@ -1,56 +0,0 @@ -. - */ - -/** - * Doctrine_Export_CheckConstraint_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_CheckConstraint_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - - public function testCheckConstraints() - { - $e = $this->conn->export; - - $sql = $e->exportClassesSql(array('CheckConstraintTest')); - - $this->assertEqual($sql[0], 'CREATE TABLE check_constraint_test (id INTEGER PRIMARY KEY AUTOINCREMENT, price DECIMAL(2,2), discounted_price DECIMAL(2,2)), CHECK (price >= 100), CHECK (price <= 5000), CHECK (price > discounted_price))'); - - try { - $dbh = new PDO('sqlite::memory:'); - $dbh->exec($sql[0]); - $this->pass(); - } catch (PDOException $e) { - $this->fail(); - } - } -} diff --git a/tests_old/Export/FirebirdTestCase.php b/tests_old/Export/FirebirdTestCase.php deleted file mode 100644 index 6cb87a040..000000000 --- a/tests_old/Export/FirebirdTestCase.php +++ /dev/null @@ -1,86 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Firebird_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Firebird_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateDatabaseDoesNotExecuteSql() - { - try { - $this->export->createDatabase('db'); - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testDropDatabaseDoesNotExecuteSql() - { - try { - $this->export->dropDatabase('db'); - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableSupportsAutoincPks() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true)); - - $this->export->createTable($name, $fields); - - $this->assertEqual($this->adapter->pop(), 'CREATE TRIGGER mytable_AUTOINCREMENT_PK FOR mytable ACTIVE BEFORE INSERT POSITION 0 AS BEGIN IF (NEW.id IS NULL OR NEW.id = 0) THEN NEW.id = GEN_ID(mytable_seq, 1) END'); - } - public function testCreateTableSupportsDefaultAttribute() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10, 'default' => 'def'), - 'type' => array('type' => 'integer', 'length' => 3, 'default' => 12) - ); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT \'def\', type INT DEFAULT 12, PRIMARY KEY(name, type))'); - } - public function testCreateTableSupportsMultiplePks() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10), - 'type' => array('type' => 'integer', 'length' => 3)); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type INT DEFAULT NULL, PRIMARY KEY(name, type))'); - } -} diff --git a/tests_old/Export/InformixTestCase.php b/tests_old/Export/InformixTestCase.php deleted file mode 100644 index 7bec0c4d8..000000000 --- a/tests_old/Export/InformixTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Informix_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Informix_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Export/MssqlTestCase.php b/tests_old/Export/MssqlTestCase.php deleted file mode 100644 index 8b5c6b215..000000000 --- a/tests_old/Export/MssqlTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Mssql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Mssql_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Export/MysqlTestCase.php b/tests_old/Export/MysqlTestCase.php deleted file mode 100644 index d4c8930d6..000000000 --- a/tests_old/Export/MysqlTestCase.php +++ /dev/null @@ -1,347 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { } - public function prepareData() - { } - - public function testAlterTableThrowsExceptionWithoutValidTableName() - { - try { - $this->export->alterTable(0, array(), array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableExecutesSql() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1)); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT UNSIGNED DEFAULT NULL) ENGINE = MYISAM'); - } - public function testCreateTableSupportsDefaultTableType() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1)); - - $this->export->createTable($name, $fields); - - // INNODB is the default type - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT UNSIGNED DEFAULT NULL) ENGINE = INNODB'); - } - public function testCreateTableSupportsMultiplePks() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10), - 'type' => array('type' => 'integer', 'length' => 3)); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type MEDIUMINT DEFAULT NULL, PRIMARY KEY(name, type)) ENGINE = INNODB'); - } - public function testCreateTableSupportsAutoincPks() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true)); - $options = array('primary' => array('id'), - 'type' => 'INNODB'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(id)) ENGINE = INNODB'); - } - public function testCreateTableSupportsCharType() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'char', 'length' => 3)); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(3) DEFAULT NULL) ENGINE = MYISAM'); - } - public function testCreateTableSupportsCharType2() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'char')); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(255) DEFAULT NULL) ENGINE = MYISAM'); - } - public function testCreateTableSupportsVarcharType() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'varchar', 'length' => '100')); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id VARCHAR(100) DEFAULT NULL) ENGINE = MYISAM'); - } - public function testCreateTableSupportsIntegerType() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'length' => '10')); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id BIGINT DEFAULT NULL) ENGINE = MYISAM'); - } - public function testCreateTableSupportsBlobType() - { - $name = 'mytable'; - - $fields = array('content' => array('type' => 'blob')); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (content LONGBLOB) ENGINE = MYISAM'); - } - public function testCreateTableSupportsBlobType2() - { - $name = 'mytable'; - - $fields = array('content' => array('type' => 'blob', 'length' => 2000)); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (content BLOB) ENGINE = MYISAM'); - } - - public function testCreateTableSupportsBooleanType() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'boolean')); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id TINYINT(1) DEFAULT NULL) ENGINE = MYISAM'); - } - public function testCreateTableSupportsForeignKeys() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'boolean', 'primary' => true), - 'foreignKey' => array('type' => 'integer') - ); - $options = array('type' => 'INNODB', - 'foreignKeys' => array(array('local' => 'foreignKey', - 'foreign' => 'id', - 'foreignTable' => 'sometable')) - ); - - - $sql = $this->export->createTableSql($name, $fields, $options); - - $this->assertEqual($sql[0], 'CREATE TABLE mytable (id TINYINT(1) DEFAULT NULL, foreignKey INT DEFAULT NULL, INDEX foreignKey_idx (foreignKey)) ENGINE = INNODB'); - $this->assertEqual($sql[1], 'ALTER TABLE mytable ADD FOREIGN KEY (foreignKey) REFERENCES sometable(id)'); - } - public function testForeignKeyIdentifierQuoting() - { - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - $name = 'mytable'; - - $fields = array('id' => array('type' => 'boolean', 'primary' => true), - 'foreignKey' => array('type' => 'integer') - ); - $options = array('type' => 'INNODB', - 'foreignKeys' => array(array('local' => 'foreignKey', - 'foreign' => 'id', - 'foreignTable' => 'sometable')) - ); - - - $sql = $this->export->createTableSql($name, $fields, $options); - - $this->assertEqual($sql[0], 'CREATE TABLE `mytable` (`id` TINYINT(1) DEFAULT NULL, `foreignKey` INT DEFAULT NULL, INDEX `foreignKey_idx` (`foreignKey`)) ENGINE = INNODB'); - $this->assertEqual($sql[1], 'ALTER TABLE `mytable` ADD FOREIGN KEY (`foreignKey`) REFERENCES `sometable`(`id`)'); - - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - } - public function testIndexIdentifierQuoting() - { - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'name' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - 'indexes' => array('myindex' => array('fields' => array('id', 'name'))) - ); - - $this->export->createTable('sometable', $fields, $options); - - //this was the old line, but it looks like the table is created first - //and then the index so i replaced it with the ones below - //$this->assertEqual($var, 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id, name))'); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE `sometable` (`id` INT UNSIGNED AUTO_INCREMENT, `name` VARCHAR(4) DEFAULT NULL, INDEX `myindex_idx` (`id`, `name`), PRIMARY KEY(`id`)) ENGINE = INNODB'); - - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - } - public function testCreateTableDoesNotAutoAddIndexesWhenIndexForFkFieldAlreadyExists() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'boolean', 'primary' => true), - 'foreignKey' => array('type' => 'integer') - ); - $options = array('type' => 'INNODB', - 'foreignKeys' => array(array('local' => 'foreignKey', - 'foreign' => 'id', - 'foreignTable' => 'sometable')), - 'indexes' => array('myindex' => array('fields' => array('foreignKey'))), - ); - - - $sql = $this->export->createTableSql($name, $fields, $options); - $this->assertEqual($sql[0], 'CREATE TABLE mytable (id TINYINT(1) DEFAULT NULL, foreignKey INT DEFAULT NULL, INDEX myindex_idx (foreignKey)) ENGINE = INNODB'); - $this->assertEqual($sql[1], 'ALTER TABLE mytable ADD FOREIGN KEY (foreignKey) REFERENCES sometable(id)'); - } - public function testCreateDatabaseExecutesSql() - { - $this->export->createDatabase('db'); - - $this->assertEqual($this->adapter->pop(), 'CREATE DATABASE db'); - } - public function testDropDatabaseExecutesSql() - { - $this->export->dropDatabase('db'); - - $this->assertEqual($this->adapter->pop(), 'DROP DATABASE db'); - } - - public function testDropIndexExecutesSql() - { - $this->export->dropIndex('sometable', 'relevancy'); - - $this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy_idx ON sometable'); - } - public function testUnknownIndexSortingAttributeThrowsException() - { - $fields = array('id' => array('sorting' => 'ASC'), - 'name' => array('sorting' => 'unknown')); - - try { - $this->export->getIndexFieldDeclarationList($fields); - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testIndexDeclarationsSupportSortingAndLengthAttributes() - { - $fields = array('id' => array('sorting' => 'ASC', 'length' => 10), - 'name' => array('sorting' => 'DESC', 'length' => 1)); - - $this->assertEqual($this->export->getIndexFieldDeclarationList($fields), 'id(10) ASC, name(1) DESC'); - } - public function testCreateTableSupportsIndexesUsingSingleFieldString() - { - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'name' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - 'indexes' => array('myindex' => array( - 'fields' => 'name')) - ); - - $this->export->createTable('sometable', $fields, $options); - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(4) DEFAULT NULL, INDEX myindex_idx (name), PRIMARY KEY(id)) ENGINE = INNODB'); - } - public function testCreateTableSupportsIndexesWithCustomSorting() - { - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'name' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - 'indexes' => array('myindex' => array( - 'fields' => array( - 'id' => array('sorting' => 'ASC'), - 'name' => array('sorting' => 'DESC') - ) - )) - ); - - $this->export->createTable('sometable', $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, name VARCHAR(4) DEFAULT NULL, INDEX myindex_idx (id ASC, name DESC), PRIMARY KEY(id)) ENGINE = INNODB'); - } - public function testCreateTableSupportsFulltextIndexes() - { - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'content' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - 'indexes' => array('myindex' => array( - 'fields' => array( - 'content' => array('sorting' => 'DESC') - ), - 'type' => 'fulltext', - )), - 'type' => 'MYISAM', - ); - - $this->export->createTable('sometable', $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INT UNSIGNED AUTO_INCREMENT, content VARCHAR(4) DEFAULT NULL, FULLTEXT INDEX myindex_idx (content DESC), PRIMARY KEY(id)) ENGINE = MYISAM'); - } -} diff --git a/tests_old/Export/OracleTestCase.php b/tests_old/Export/OracleTestCase.php deleted file mode 100644 index 44dbd88bf..000000000 --- a/tests_old/Export/OracleTestCase.php +++ /dev/null @@ -1,153 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Oracle_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateSequenceExecutesSql() - { - $sequenceName = 'sequence'; - $start = 1; - $query = 'CREATE SEQUENCE ' . $sequenceName . '_seq START WITH ' . $start . ' INCREMENT BY 1 NOCACHE'; - - $this->export->createSequence($sequenceName, $start); - - $this->assertEqual($this->adapter->pop(), $query); - } - - public function testDropSequenceExecutesSql() - { - $sequenceName = 'sequence'; - - $query = 'DROP SEQUENCE ' . $sequenceName; - - $this->export->dropSequence($sequenceName); - - $this->assertEqual($this->adapter->pop(), $query . '_seq'); - } - public function testCreateTableExecutesSql() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer')); - $options = array('type' => 'MYISAM'); - - $this->export->createTable($name, $fields); - - $this->assertEqual($this->adapter->pop(), 'COMMIT'); - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT DEFAULT NULL)'); - $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); - } - public function testCreateTableSupportsDefaultAttribute() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10, 'default' => 'def'), - 'type' => array('type' => 'integer', 'length' => 3, 'default' => 12) - ); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - - $this->assertEqual($this->adapter->pop(), 'COMMIT'); - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT \'def\', type NUMBER(3) DEFAULT 12, PRIMARY KEY(name, type))'); - $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); - } - public function testCreateTableSupportsMultiplePks() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10), - 'type' => array('type' => 'integer', 'length' => 3)); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - - $this->assertEqual($this->adapter->pop(), 'COMMIT'); - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type NUMBER(3) DEFAULT NULL, PRIMARY KEY(name, type))'); - $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); - } - public function testCreateTableSupportsAutoincPks() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'autoincrement' => true)); - - - $this->export->createTable($name, $fields); - - $this->assertEqual($this->adapter->pop(), 'COMMIT'); - $this->assertEqual(substr($this->adapter->pop(),0, 14), 'CREATE TRIGGER'); - $this->assertEqual($this->adapter->pop(), 'CREATE SEQUENCE MYTABLE_seq START WITH 1 INCREMENT BY 1 NOCACHE'); - $this->assertEqual($this->adapter->pop(), 'ALTER TABLE MYTABLE ADD CONSTRAINT MYTABLE_AI_PK_idx PRIMARY KEY (id)'); - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT DEFAULT NULL)'); - $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); - } - - public function testCreateTableSupportsCharType() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'char', 'length' => 3)); - - $this->export->createTable($name, $fields); - - $this->adapter->pop(); - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id CHAR(3) DEFAULT NULL)'); - } - public function testCreateTableSupportsUniqueConstraint() - { - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'name' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - ); - - $sql = $this->export->createTableSql('sometable', $fields, $options); - - $this->assertEqual($sql[0], 'CREATE TABLE sometable (id INT DEFAULT NULL UNIQUE, name VARCHAR2(4) DEFAULT NULL, PRIMARY KEY(id))'); - } - public function testCreateTableSupportsIndexes() - { - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'name' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - 'indexes' => array('myindex' => array('fields' => array('id', 'name'))) - ); - - $sql = $this->export->createTableSql('sometable', $fields, $options); - - $this->assertEqual($sql[0], 'CREATE TABLE sometable (id INT DEFAULT NULL UNIQUE, name VARCHAR2(4) DEFAULT NULL, PRIMARY KEY(id), INDEX myindex (id, name))'); - } -} diff --git a/tests_old/Export/PgsqlTestCase.php b/tests_old/Export/PgsqlTestCase.php deleted file mode 100644 index 1178d89fb..000000000 --- a/tests_old/Export/PgsqlTestCase.php +++ /dev/null @@ -1,144 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateDatabaseExecutesSql() - { - $this->export->createDatabase('db'); - $this->assertEqual($this->adapter->pop(), 'CREATE DATABASE db'); - } - public function testDropDatabaseExecutesSql() - { - $this->export->dropDatabase('db'); - - $this->assertEqual($this->adapter->pop(), 'DROP DATABASE db'); - } - public function testCreateTableSupportsAutoincPks() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true)); - $options = array('primary' => array('id')); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id SERIAL, PRIMARY KEY(id))'); - } - public function testQuoteAutoincPks() - { - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true)); - $options = array('primary' => array('id')); - - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE "mytable" ("id" SERIAL, PRIMARY KEY("id"))'); - - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10), - 'type' => array('type' => 'integer', 'length' => 3)); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE "mytable" ("name" CHAR(10) DEFAULT NULL, "type" INT DEFAULT NULL, PRIMARY KEY("name", "type"))'); - - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - } - public function testForeignKeyIdentifierQuoting() - { - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - $name = 'mytable'; - - $fields = array('id' => array('type' => 'boolean', 'primary' => true), - 'foreignKey' => array('type' => 'integer') - ); - $options = array('foreignKeys' => array(array('local' => 'foreignKey', - 'foreign' => 'id', - 'foreignTable' => 'sometable')) - ); - - - $sql = $this->export->createTableSql($name, $fields, $options); - - $this->assertEqual($sql[0], 'CREATE TABLE "mytable" ("id" BOOLEAN DEFAULT NULL, "foreignKey" INT DEFAULT NULL)'); - $this->assertEqual($sql[1], 'ALTER TABLE "mytable" ADD FOREIGN KEY ("foreignKey") REFERENCES "sometable"("id") NOT DEFERRABLE INITIALLY IMMEDIATE'); - - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - } - public function testCreateTableSupportsDefaultAttribute() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10, 'default' => 'def'), - 'type' => array('type' => 'integer', 'length' => 3, 'default' => 12) - ); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT \'def\', type INT DEFAULT 12, PRIMARY KEY(name, type))'); - } - public function testCreateTableSupportsMultiplePks() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10), - 'type' => array('type' => 'integer', 'length' => 3)); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type INT DEFAULT NULL, PRIMARY KEY(name, type))'); - } - public function testExportSql() - { - $sql = $this->export->exportClassesSql(array("FooRecord", "FooReferenceRecord", "FooLocallyOwned", "FooForeignlyOwned", "FooForeignlyOwnedWithPK", "FooBarRecord", "BarRecord")); - //dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); - - $this->assertEqual($sql, array ( 0 => 'CREATE TABLE foo_reference (foo1 BIGINT DEFAULT NULL, foo2 BIGINT DEFAULT NULL, PRIMARY KEY(foo1, foo2))', - 1 => 'CREATE TABLE foo_locally_owned (id BIGSERIAL, name VARCHAR(200) DEFAULT NULL, PRIMARY KEY(id))', - 2 => 'CREATE TABLE foo_foreignly_owned_with_pk (id BIGSERIAL, name VARCHAR(200) DEFAULT NULL, PRIMARY KEY(id))', - 3 => 'CREATE TABLE foo_foreignly_owned (id BIGSERIAL, name VARCHAR(200) DEFAULT NULL, fooid BIGINT DEFAULT NULL, PRIMARY KEY(id))', - 4 => 'CREATE TABLE foo_bar_record (fooid BIGINT DEFAULT NULL, barid BIGINT DEFAULT NULL, PRIMARY KEY(fooid, barid))', - 5 => 'CREATE TABLE foo (id BIGSERIAL, name VARCHAR(200) NOT NULL, parent_id BIGINT DEFAULT NULL, local_foo BIGINT DEFAULT NULL, PRIMARY KEY(id))', - 6 => 'CREATE TABLE bar (id BIGSERIAL, name VARCHAR(200) DEFAULT NULL, PRIMARY KEY(id))', - 7 => 'ALTER TABLE foo_reference ADD FOREIGN KEY (foo1) REFERENCES foo(id) NOT DEFERRABLE INITIALLY IMMEDIATE', - 8 => 'ALTER TABLE foo_bar_record ADD FOREIGN KEY (fooId) REFERENCES foo(id) NOT DEFERRABLE INITIALLY IMMEDIATE', - 9 => 'ALTER TABLE foo ADD FOREIGN KEY (parent_id) REFERENCES foo(id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE', - 10 => 'ALTER TABLE foo ADD FOREIGN KEY (local_foo) REFERENCES foo_locally_owned(id) ON DELETE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE', - )); - } -} diff --git a/tests_old/Export/RecordTestCase.php b/tests_old/Export/RecordTestCase.php deleted file mode 100644 index e4c9dfd67..000000000 --- a/tests_old/Export/RecordTestCase.php +++ /dev/null @@ -1,107 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Record_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Record_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { } - public function prepareData() - { } - public function setUp() { - $this->driverName = 'mysql'; - if ( ! $this->init) { - $this->init(); - } - - $this->init = true; - } - - public function testExportSupportsForeignKeys() - { - $sql = $this->conn->export->exportClassesSql(array('ForeignKeyTest')); - - $this->assertEqual($sql[0], 'CREATE TABLE foreign_key_test (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, code INT DEFAULT NULL, content TEXT DEFAULT NULL, parent_id BIGINT DEFAULT NULL, INDEX parent_id_idx (parent_id), PRIMARY KEY(id)) ENGINE = INNODB'); - if (isset($sql[1])) { - $this->assertEqual($sql[1], 'ALTER TABLE foreign_key_test ADD FOREIGN KEY (parent_id) REFERENCES foreign_key_test(id) ON UPDATE RESTRICT ON DELETE CASCADE'); - } else { - $this->fail('$sql should contain ALTER TABLE statement'); - } - } - - public function testExportSupportsIndexes() - { - $sql = $this->conn->export->exportClassesSql(array('MysqlIndexTestRecord')); - - $this->assertEqual($sql[0], 'CREATE TABLE mysql_index_test_record (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, code INT DEFAULT NULL, content TEXT DEFAULT NULL, FULLTEXT INDEX content_idx (content), UNIQUE INDEX namecode_idx (name, code), PRIMARY KEY(id)) ENGINE = MYISAM'); - } - - public function testRecordDefinitionsSupportTableOptions() - { - $sql = $this->conn->export->exportClassesSql(array('MysqlTestRecord')); - - $this->assertEqual($sql[0], 'CREATE TABLE mysql_test_record (name TEXT DEFAULT NULL, code BIGINT DEFAULT NULL, PRIMARY KEY(name, code)) ENGINE = INNODB'); - } - - public function testExportSupportsForeignKeysWithoutAttributes() - { - $sql = $this->conn->export->exportClassesSql(array('ForeignKeyTest')); - - $this->assertEqual($sql[0], 'CREATE TABLE foreign_key_test (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, code INT DEFAULT NULL, content TEXT DEFAULT NULL, parent_id BIGINT DEFAULT NULL, INDEX parent_id_idx (parent_id), PRIMARY KEY(id)) ENGINE = INNODB'); - if (isset($sql[1])) { - $this->assertEqual($sql[1], 'ALTER TABLE foreign_key_test ADD FOREIGN KEY (parent_id) REFERENCES foreign_key_test(id) ON UPDATE RESTRICT ON DELETE CASCADE'); - } else { - $this->fail('$sql should contain ALTER TABLE statement'); - } - } - - public function testExportSupportsForeignKeysForManyToManyRelations() - { - $sql = $this->conn->export->exportClassesSql(array('MysqlUser')); - - $this->assertEqual($sql[0], 'CREATE TABLE mysql_user (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, PRIMARY KEY(id)) ENGINE = INNODB'); - - $sql = $this->conn->export->exportClassesSql(array('MysqlGroup')); - - $this->assertEqual($sql[0], 'CREATE TABLE mysql_group (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, PRIMARY KEY(id)) ENGINE = INNODB'); - } - - public function testExportModelFromDirectory() - { - Doctrine::createTablesFromModels(dirname(__FILE__) . DIRECTORY_SEPARATOR .'..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'export'); - $this->assertEqual($this->adapter->pop(), 'COMMIT'); - $this->assertEqual($this->adapter->pop(), 'ALTER TABLE cms__category_languages ADD FOREIGN KEY (category_id) REFERENCES cms__category(id) ON DELETE CASCADE'); - $this->assertTrue($this->adapter->pop(), 'CREATE TABLE cms__category_languages (id BIGINT AUTO_INCREMENT, name TEXT DEFAULT NULL, category_id BIGINT DEFAULT NULL, language_id BIGINT DEFAULT NULL, INDEX index_category_idx (category_id), INDEX index_language_idx (language_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB'); - $this->assertTrue($this->adapter->pop(), 'CREATE TABLE cms__category (id BIGINT AUTO_INCREMENT, created DATETIME DEFAULT NULL, parent BIGINT DEFAULT NULL, position MEDIUMINT DEFAULT NULL, active BIGINT DEFAULT NULL, INDEX index_parent_idx (parent), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB'); - $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); - } - -} diff --git a/tests_old/Export/ReporterTestCase.php b/tests_old/Export/ReporterTestCase.php deleted file mode 100644 index bc8705e94..000000000 --- a/tests_old/Export/ReporterTestCase.php +++ /dev/null @@ -1,10 +0,0 @@ -export->export('BadLyNamed__Class'); - - // Class name is not valid. Double underscores are not allowed - - $this->assertEqual($reporter->pop(), array(E_WARNING, 'Badly named class.')); - } -} diff --git a/tests_old/Export/SchemaTestCase.php b/tests_old/Export/SchemaTestCase.php deleted file mode 100644 index 354559214..000000000 --- a/tests_old/Export/SchemaTestCase.php +++ /dev/null @@ -1,61 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Schema_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Schema_TestCase extends Doctrine_UnitTestCase -{ - public $tables = array('Entity', - 'EntityReference', - 'EntityAddress', - 'Email', - 'Phonenumber', - 'Groupuser', - 'Group', - 'User', - 'Album', - 'Song', - 'Element', - 'Error', - 'Description', - 'Address', - 'Account', - 'Task', - 'Resource', - 'Assignment', - 'ResourceType', - 'ResourceReference'); - - public function testYmlExport() - { - $export = new Doctrine_Export_Schema(); - $export->exportSchema('schema-export.yml', 'yml', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'models', $this->tables); - } -} \ No newline at end of file diff --git a/tests_old/Export/SqliteTestCase.php b/tests_old/Export/SqliteTestCase.php deleted file mode 100644 index 87cb92f21..000000000 --- a/tests_old/Export/SqliteTestCase.php +++ /dev/null @@ -1,173 +0,0 @@ -. - */ - -/** - * Doctrine_Export_Sqlite_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateDatabaseDoesNotExecuteSqlAndCreatesSqliteFile() - { - $this->export->createDatabase('sqlite.db'); - - $this->assertTrue(file_exists('sqlite.db')); - } - public function testDropDatabaseDoesNotExecuteSqlAndDeletesSqliteFile() - { - $this->export->dropDatabase('sqlite.db'); - - $this->assertFalse(file_exists('sqlite.db')); - } - public function testCreateTableSupportsAutoincPks() - { - $name = 'mytable'; - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true)); - - $this->export->createTable($name, $fields); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INTEGER PRIMARY KEY AUTOINCREMENT)'); - } - public function testCreateTableSupportsDefaultAttribute() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10, 'default' => 'def'), - 'type' => array('type' => 'integer', 'length' => 3, 'default' => 12) - ); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT \'def\', type INTEGER DEFAULT 12, PRIMARY KEY(name, type))'); - } - public function testCreateTableSupportsMultiplePks() - { - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10), - 'type' => array('type' => 'integer', 'length' => 3)); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT NULL, type INTEGER DEFAULT NULL, PRIMARY KEY(name, type))'); - } - public function testCreateTableSupportsIndexes() - { - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'name' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - 'indexes' => array('myindex' => array('fields' => array('id', 'name'))) - ); - - $this->export->createTable('sometable', $fields, $options); - - //this was the old line, but it looks like the table is created first - //and then the index so i replaced it with the ones below - //$this->assertEqual($var, 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id, name))'); - - $this->assertEqual($this->adapter->pop(),"CREATE INDEX myindex_idx ON sometable (id, name)"); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4) DEFAULT NULL)'); - } - public function testIdentifierQuoting() - { - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'name' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - 'indexes' => array('myindex' => array('fields' => array('id', 'name'))) - ); - - $this->export->createTable('sometable', $fields, $options); - - //this was the old line, but it looks like the table is created first - //and then the index so i replaced it with the ones below - //$this->assertEqual($var, 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id, name))'); - - $this->assertEqual($this->adapter->pop(),'CREATE INDEX "myindex_idx" ON "sometable" ("id", "name")'); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE "sometable" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" VARCHAR(4) DEFAULT NULL)'); - - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - } - public function testQuoteMultiplePks() - { - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - $name = 'mytable'; - $fields = array('name' => array('type' => 'char', 'length' => 10), - 'type' => array('type' => 'integer', 'length' => 3)); - - $options = array('primary' => array('name', 'type')); - $this->export->createTable($name, $fields, $options); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE "mytable" ("name" CHAR(10) DEFAULT NULL, "type" INTEGER DEFAULT NULL, PRIMARY KEY("name", "type"))'); - - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - } - public function testUnknownIndexSortingAttributeThrowsException() - { - $fields = array('id' => array('sorting' => 'ASC'), - 'name' => array('sorting' => 'unknown')); - - try { - $this->export->getIndexFieldDeclarationList($fields); - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableSupportsIndexesWithCustomSorting() - { - $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true, 'unique' => true), - 'name' => array('type' => 'string', 'length' => 4), - ); - - $options = array('primary' => array('id'), - 'indexes' => array('myindex' => array( - 'fields' => array( - 'id' => array('sorting' => 'ASC'), - 'name' => array('sorting' => 'DESC') - ) - )) - ); - - $this->export->createTable('sometable', $fields, $options); - - $this->assertEqual($this->adapter->pop(),"CREATE INDEX myindex_idx ON sometable (id ASC, name DESC)"); - - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4) DEFAULT NULL)'); - - } -} \ No newline at end of file diff --git a/tests_old/ExportTestCase.php b/tests_old/ExportTestCase.php deleted file mode 100644 index de5609710..000000000 --- a/tests_old/ExportTestCase.php +++ /dev/null @@ -1,88 +0,0 @@ -. - */ - -/** - * Doctrine_Export_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Export_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateTableThrowsExceptionWithoutValidTableName() - { - try { - $this->export->createTable(0, array(), array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testCreateTableThrowsExceptionWithEmptyFieldsArray() - { - try { - $this->export->createTable('sometable', array(), array()); - - $this->fail(); - } catch(Doctrine_Export_Exception $e) { - $this->pass(); - } - } - public function testDropConstraintExecutesSql() - { - $this->export->dropConstraint('sometable', 'relevancy'); - - $this->assertEqual($this->adapter->pop(), 'ALTER TABLE sometable DROP CONSTRAINT relevancy'); - } - public function testCreateIndexExecutesSql() - { - $this->export->createIndex('sometable', 'relevancy', array('fields' => array('title' => array(), 'content' => array()))); - - $this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy_idx ON sometable (title, content)'); - } - - public function testDropIndexExecutesSql() - { - $this->export->dropIndex('sometable', 'relevancy'); - - $this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy_idx'); - } - public function testDropTableExecutesSql() - { - $this->export->dropTable('sometable'); - - $this->assertEqual($this->adapter->pop(), 'DROP TABLE sometable'); - } - public function testRecordIsExportedProperly() - { - - } - public function testExport() - { - - } -} diff --git a/tests_old/Expression/DriverTestCase.php b/tests_old/Expression/DriverTestCase.php deleted file mode 100644 index 450b39734..000000000 --- a/tests_old/Expression/DriverTestCase.php +++ /dev/null @@ -1,171 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_Driver_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_Driver_TestCase extends Doctrine_UnitTestCase { - - /** - * AGGREGATE FUNCTIONS - */ - public function testAvgReturnsValidSql() { - $this->expr = new Doctrine_Expression_Mock(); - - $this->assertEqual($this->expr->avg('id'), 'AVG(id)'); - } - public function testCountReturnsValidSql() { - $this->assertEqual($this->expr->count('id'), 'COUNT(id)'); - } - public function testMaxReturnsValidSql() { - $this->assertEqual($this->expr->max('id'), 'MAX(id)'); - } - public function testMinReturnsValidSql() { - $this->assertEqual($this->expr->min('id'), 'MIN(id)'); - } - public function testSumReturnsValidSql() { - $this->assertEqual($this->expr->sum('id'), 'SUM(id)'); - } - - public function testRegexpImplementedOnlyAtDriverLevel() { - try { - $this->expr->regexp('[abc]'); - $this->fail(); - } catch(Doctrine_Expression_Exception $e) { - $this->pass(); - } - } - public function testSoundexImplementedOnlyAtDriverLevel() { - try { - $this->expr->soundex('arnold'); - $this->fail(); - } catch(Doctrine_Expression_Exception $e) { - $this->pass(); - } - } - - /** - * TIME FUNCTIONS - */ - public function testNowReturnsValidSql() { - $this->assertEqual($this->expr->now(), 'NOW()'); - } - - /** - * STRING FUNCTIONS - */ - public function testUpperReturnsValidSql() { - $this->assertEqual($this->expr->upper('id', 3), 'UPPER(id)'); - } - public function testLowerReturnsValidSql() { - $this->assertEqual($this->expr->lower('id'), 'LOWER(id)'); - } - public function testLengthReturnsValidSql() { - $this->assertEqual($this->expr->length('id'), 'LENGTH(id)'); - } - public function testLtrimReturnsValidSql() { - $this->assertEqual($this->expr->ltrim('id'), 'LTRIM(id)'); - } - public function testLocateReturnsValidSql() { - $this->assertEqual($this->expr->locate('id', 3), 'LOCATE(id, 3)'); - } - public function testConcatReturnsValidSql() { - $this->assertEqual($this->expr->concat('id', 'type'), 'id || type'); - } - public function testSubstringReturnsValidSql() { - $this->assertEqual($this->expr->substring('id', 3), 'SUBSTRING(id FROM 3)'); - - $this->assertEqual($this->expr->substring('id', 3, 2), 'SUBSTRING(id FROM 3 FOR 2)'); - } - - /** - * MATH FUNCTIONS - */ - public function testRoundReturnsValidSql() { - $this->assertEqual($this->expr->round(2.3), 'ROUND(2.3, 0)'); - - $this->assertEqual($this->expr->round(2.3, 1), 'ROUND(2.3, 1)'); - } - public function testModReturnsValidSql() { - $this->assertEqual($this->expr->mod(2, 3), 'MOD(2, 3)'); - } - public function testSubReturnsValidSql() { - $this->assertEqual($this->expr->sub(array(2, 3)), '(2 - 3)'); - } - public function testMulReturnsValidSql() { - $this->assertEqual($this->expr->mul(array(2, 3)), '(2 * 3)'); - } - public function testAddReturnsValidSql() { - $this->assertEqual($this->expr->add(array(2, 3)), '(2 + 3)'); - } - public function testDivReturnsValidSql() { - $this->assertEqual($this->expr->div(array(2, 3)), '(2 / 3)'); - } - - /** - * ASSERT OPERATORS - */ - public function testEqReturnsValidSql() { - $this->assertEqual($this->expr->eq(1, 1), '1 = 1'); - } - public function testNeqReturnsValidSql() { - $this->assertEqual($this->expr->neq(1, 2), '1 <> 2'); - } - public function testGtReturnsValidSql() { - $this->assertEqual($this->expr->gt(2, 1), '2 > 1'); - } - public function testGteReturnsValidSql() { - $this->assertEqual($this->expr->gte(1, 1), '1 >= 1'); - } - public function testLtReturnsValidSql() { - $this->assertEqual($this->expr->lt(1, 2), '1 < 2'); - } - public function testLteReturnsValidSql() { - $this->assertEqual($this->expr->lte(1, 1), '1 <= 1'); - } - - /** - * WHERE OPERATORS - */ - public function testNotReturnsValidSql() { - $this->assertEqual($this->expr->not('id'), 'NOT(id)'); - } - public function testInReturnsValidSql() { - $this->assertEqual($this->expr->in('id', array(1, 2)), 'id IN (1, 2)'); - } - public function testIsNullReturnsValidSql() { - $this->assertEqual($this->expr->isNull('type'), 'type IS NULL'); - } - public function testIsNotNullReturnsValidSql() { - $this->assertEqual($this->expr->isNotNull('type'), 'type IS NOT NULL'); - } - public function testBetweenReturnsValidSql() { - $this->assertEqual($this->expr->between('age', 12, 14), 'age BETWEEN 12 AND 14'); - } -} diff --git a/tests_old/Expression/FirebirdTestCase.php b/tests_old/Expression/FirebirdTestCase.php deleted file mode 100644 index 2b8e43e56..000000000 --- a/tests_old/Expression/FirebirdTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_Firebird_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_Firebird_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Expression/InformixTestCase.php b/tests_old/Expression/InformixTestCase.php deleted file mode 100644 index f78faef3e..000000000 --- a/tests_old/Expression/InformixTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_Informix_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_Informix_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Expression/MssqlTestCase.php b/tests_old/Expression/MssqlTestCase.php deleted file mode 100644 index 0343cc0c3..000000000 --- a/tests_old/Expression/MssqlTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_Mssql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_Mssql_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Expression/MysqlTestCase.php b/tests_old/Expression/MysqlTestCase.php deleted file mode 100644 index 993940dfb..000000000 --- a/tests_old/Expression/MysqlTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_Mysql_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Expression/OracleTestCase.php b/tests_old/Expression/OracleTestCase.php deleted file mode 100644 index a26d856c3..000000000 --- a/tests_old/Expression/OracleTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_Oracle_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_Oracle_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Expression/PgsqlTestCase.php b/tests_old/Expression/PgsqlTestCase.php deleted file mode 100644 index 996142c37..000000000 --- a/tests_old/Expression/PgsqlTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_Pgsql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_Pgsql_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Expression/SqliteTestCase.php b/tests_old/Expression/SqliteTestCase.php deleted file mode 100644 index d6508aa26..000000000 --- a/tests_old/Expression/SqliteTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_Sqlite_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_Sqlite_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/ExpressionTestCase.php b/tests_old/ExpressionTestCase.php deleted file mode 100644 index a51075a83..000000000 --- a/tests_old/ExpressionTestCase.php +++ /dev/null @@ -1,62 +0,0 @@ -. - */ - -/** - * Doctrine_Expression_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Expression_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { - } - - public function testSavingWithAnExpression() - { - $e = new Doctrine_Expression("'some' || 'one'"); - $this->assertEqual($e->getSql(), "'some' || 'one'"); - - $u = new User(); - $u->name = $e; - $u->save(); - $u->refresh(); - $this->assertEqual($u->name, 'someone'); - } - - public function testExpressionParserSupportsNumericalClauses() - { - $e = new Doctrine_Expression('1 + 2'); - $this->assertEqual($e->getSql(), '1 + 2'); - } - - public function testExpressionParserSupportsFunctionComposition() - { - $e = new Doctrine_Expression("SUBSTRING('some' || 'one', 0, 3)"); - $this->assertEqual($e->getSql(), "SUBSTR('some' || 'one', 0, 3)"); - } -} diff --git a/tests_old/ForeignKeyTestCase.php b/tests_old/ForeignKeyTestCase.php deleted file mode 100644 index 49f864e82..000000000 --- a/tests_old/ForeignKeyTestCase.php +++ /dev/null @@ -1,56 +0,0 @@ -. - */ - -/** - * Doctrine_ForeignKey_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_ForeignKey_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - - - public function testExportingForeignKeysSupportsAssociationTables() - { - $this->dbh = new Doctrine_Adapter_Mock('mysql'); - $this->conn = $this->manager->openConnection($this->dbh); - - $sql = $this->conn->export->exportClassesSql(array('ClientModel', 'ClientToAddressModel', 'AddressModel')); - - $this->assertEqual($sql, array ( - 0 => 'CREATE TABLE clients_to_addresses (client_id BIGINT, address_id BIGINT, INDEX client_id_idx (client_id), INDEX address_id_idx (address_id), PRIMARY KEY(client_id, address_id)) ENGINE = INNODB', - 1 => 'CREATE TABLE clients (id INT UNSIGNED NOT NULL AUTO_INCREMENT, short_name VARCHAR(32) NOT NULL UNIQUE, PRIMARY KEY(id)) ENGINE = INNODB', - 2 => 'CREATE TABLE addresses (id BIGINT AUTO_INCREMENT, address1 VARCHAR(255) NOT NULL, address2 VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, state VARCHAR(10) NOT NULL, zip VARCHAR(15) NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB', - 3 => 'ALTER TABLE clients_to_addresses ADD CONSTRAINT FOREIGN KEY (client_id) REFERENCES clients(id) ON DELETE CASCADE', - 4 => 'ALTER TABLE clients_to_addresses ADD CONSTRAINT FOREIGN KEY (address_id) REFERENCES addresses(id) ON DELETE CASCADE', - )); - } -} diff --git a/tests_old/HookTestCase.php b/tests_old/HookTestCase.php deleted file mode 100644 index 0e2d1a053..000000000 --- a/tests_old/HookTestCase.php +++ /dev/null @@ -1,172 +0,0 @@ -. - */ - -/** - * Doctrine_Hook_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase -{ - - public function testWordLikeParserSupportsHyphens() - { - $parser = new Doctrine_Hook_WordLike(); - - $parser->parse('u', 'name', "'some guy' OR zYne"); - - $this->assertEqual($parser->getCondition(), '(u.name LIKE ? OR u.name LIKE ?)'); - $this->assertEqual($parser->getParams(), array('%some guy%', '%zYne%')); - } - - public function testHookOrderbyAcceptsArray() - { - $hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p'); - - $a['orderby'] = array('u.name ASC'); - - $hook->hookOrderBy($a['orderby']); - $this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) ORDER BY e.name ASC'); - } - - public function testHookOrderbyAcceptsDescendingOrder() - { - $hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p'); - - $a['orderby'] = array('u.name DESC'); - - $hook->hookOrderBy($a['orderby']); - $this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) ORDER BY e.name DESC'); - } - - public function testHookOrderbyDoesntAcceptUnknownColumn() - { - $hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p'); - - $a['orderby'] = array('u.unknown DESC'); - - $hook->hookOrderBy($a['orderby']); - $this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)'); - } - - public function testHookOrderbyAcceptsMultipleParameters() - { - $hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p'); - - $a['orderby'] = array('u.name ASC', 'u.id DESC'); - - $hook->hookOrderBy($a['orderby']); - $this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) ORDER BY e.name ASC, e.id DESC'); - - $users = $hook->getQuery()->execute(); - } - - public function testHookWhereAcceptsArrays() - { - $hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p'); - - $a['where'] = array('u.name' => 'Jack Daniels', - 'u.loginname' => 'TheMan'); - - $hook->hookWhere($a['where']); - $this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.name LIKE ? OR e.name LIKE ?) AND e.loginname LIKE ? AND (e.type = 0)'); - $this->assertEqual($hook->getQuery()->getParams(), array('%Jack%', '%Daniels%', '%TheMan%')); - } - - public function testHookWhereSupportsIntegerTypes() - { - $hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p'); - - $a['where'] = array('u.id' => 10000); - - $hook->hookWhere($a['where']); - $this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE e.id = ? AND (e.type = 0)'); - $this->assertEqual($hook->getQuery()->getParams(), array(10000)); - } - - public function testHookWhereDoesntAcceptUnknownColumn() - { - $hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p'); - - $a['where'] = array('u.unknown' => 'Jack Daniels'); - - $hook->hookWhere($a['where']); - - $this->assertEqual($hook->getQuery()->getSql(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)'); - } - - public function testEqualParserUsesEqualOperator() - { - $parser = new Doctrine_Hook_Equal(); - - $parser->parse('u', 'name', 'zYne'); - - $this->assertEqual($parser->getCondition(), 'u.name = ?'); - $this->assertEqual($parser->getParams(), array('zYne')); - } - - public function testWordLikeParserUsesLikeOperator() - { - $parser = new Doctrine_Hook_WordLike(); - - $parser->parse('u', 'name', 'zYne'); - - $this->assertEqual($parser->getCondition(), 'u.name LIKE ?'); - $this->assertEqual($parser->getParams(), array('%zYne%')); - } - - public function testIntegerParserSupportsIntervals() - { - $parser = new Doctrine_Hook_Integer(); - - $parser->parse('m', 'year', '1998-2000'); - - $this->assertEqual($parser->getCondition(), '(m.year > ? AND m.year < ?)'); - $this->assertEqual($parser->getParams(), array('1998', '2000')); - } - - public function testIntegerParserSupportsEqualOperator() - { - $parser = new Doctrine_Hook_Integer(); - - $parser->parse('m', 'year', '1998'); - - $this->assertEqual($parser->getCondition(), 'm.year = ?'); - $this->assertEqual($parser->getParams(), array('1998')); - } - - public function testIntegerParserSupportsNestingConditions() - { - $parser = new Doctrine_Hook_Integer(); - - $parser->parse('m', 'year', '1998-2000 OR 2001'); - - $this->assertEqual($parser->getCondition(), '((m.year > ? AND m.year < ?) OR m.year = ?)'); - $this->assertEqual($parser->getParams(), array('1998', '2000', '2001')); - } - -} diff --git a/tests_old/Hydrate/FetchModeTestCase.php b/tests_old/Hydrate/FetchModeTestCase.php deleted file mode 100644 index 0cfd789e2..000000000 --- a/tests_old/Hydrate/FetchModeTestCase.php +++ /dev/null @@ -1,177 +0,0 @@ -. - */ - -/** - * Doctrine_Hydrate_FetchMode_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Hydrate_FetchMode_TestCase extends Doctrine_UnitTestCase -{ - - public function testFetchArraySupportsOneToManyRelations() - { - $q = new Doctrine_Query(); - - $q->select('u.*, p.*')->from('User u')->innerJoin('u.Phonenumber p')->where("u.name = 'zYne'");; - - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertTrue(is_array($users)); - - $this->assertEqual(count($users), 1); - } - - public function testFetchArraySupportsOneToManyRelations2() - { - $q = new Doctrine_Query(); - - $q->select('u.*, p.*')->from('User u')->innerJoin('u.Phonenumber p'); - - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertTrue(is_array($users)); - - $this->assertEqual(count($users), 8); - } - - public function testFetchArraySupportsOneToManyRelations3() - { - $q = new Doctrine_Query(); - - $q->select('u.*, p.*')->from('User u')->innerJoin('u.Phonenumber p')->where("u.name = 'Jean Reno'"); - - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertTrue(is_array($users)); - - $this->assertEqual(count($users), 1); - $this->assertEqual(count($users[0]['Phonenumber']), 3); - } - - public function testFetchArraySupportsOneToOneRelations() - { - $q = new Doctrine_Query(); - - $q->select('u.*, e.*')->from('User u')->innerJoin('u.Email e'); - - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertEqual(count($users), 8); - $this->assertEqual($users[0]['Email']['address'], 'zYne@example.com'); - } - - public function testFetchArraySupportsOneToOneRelations2() - { - $q = new Doctrine_Query(); - - $q->select('u.*, e.*')->from('User u')->innerJoin('u.Email e')->where("u.name = 'zYne'"); - - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertEqual(count($users), 1); - $this->assertEqual($users[0]['Email']['address'], 'zYne@example.com'); - } - - public function testFetchRecordSupportsOneToOneRelations() - { - $q = new Doctrine_Query(); - - $q->select('u.*, e.*')->from('User u')->innerJoin('u.Email e'); - $count = count($this->conn); - $users = $q->execute(array(), Doctrine::FETCH_RECORD); - - $this->assertEqual(count($users), 8); - - $this->assertEqual($users[0]['Email']['address'], 'zYne@example.com'); - $this->assertTrue($users[0] instanceof User); - $this->assertTrue($users instanceof Doctrine_Collection); - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($users[0]->id, 4); - - $this->assertTrue($users[0]['Email'] instanceof Email); - $this->assertEqual($users[0]['email_id'], 1); - - $this->assertEqual(count($this->conn), $count + 1); - } - - public function testFetchRecordSupportsOneToManyRelations() - { - $q = new Doctrine_Query(); - - $q->select('u.*, p.*')->from('User u')->innerJoin('u.Phonenumber p'); - $users = $q->execute(array(), Doctrine::FETCH_RECORD); - - $this->assertEqual(count($users), 8); - $this->assertTrue($users[0] instanceof User); - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertTrue($users instanceof Doctrine_Collection); - $this->assertTrue($users[0]->Phonenumber instanceof Doctrine_Collection); - } - - public function testFetchRecordSupportsSimpleFetching() - { - $q = new Doctrine_Query(); - - $q->select('u.*')->from('User u'); - $count = $this->conn->count(); - $users = $q->execute(array(), Doctrine::FETCH_RECORD); - - $this->assertEqual(count($users), 8); - $this->assertTrue($users[0] instanceof User); - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_CLEAN); - - - $this->assertEqual($this->conn->count(), $count + 1); - } - - public function testFetchArrayNull() - { - $u = new User(); - $u->name = "fetch_array_test"; - $u->created = null; - $u->save(); - - $q = new Doctrine_Query(); - $q->select('u.*')->from('User u')->where('u.id = ?'); - $users = $q->execute(array($u->id), Doctrine::HYDRATE_ARRAY); - $this->assertEqual($users[0]['created'], null); - } - - public function testHydrateNone() - { - $u = new User(); - $u->name = "fetch_array_test"; - $u->created = null; - $u->save(); - - $q = new Doctrine_Query(); - $q->select('COUNT(u.id) num')->from('User u')->where('u.id = ?'); - $res = $q->execute(array($u->id), Doctrine::HYDRATE_NONE); - $this->assertEqual(1, $res[0][0]); - } -} diff --git a/tests_old/HydrateTestCase.php b/tests_old/HydrateTestCase.php deleted file mode 100644 index cd786a567..000000000 --- a/tests_old/HydrateTestCase.php +++ /dev/null @@ -1,108 +0,0 @@ -. - */ - -/** - * Doctrine_Hydrate_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Hydrate_TestCase extends Doctrine_UnitTestCase -{ - protected $testData1 = array( - array( - 'e' => array('id' => 1, 'name' => 'zYne'), - 'p' => array('id' => 1, 'phonenumber' => '123 123', 'user_id' => 1) - ), - array( - 'e' => array('id' => 2, 'name' => 'John'), - 'p' => array('id' => 2, 'phonenumber' => '222 222', 'user_id' => 2) - ), - array( - 'e' => array('id' => 2, 'name' => 'John'), - 'p' => array('id' => 3, 'phonenumber' => '343 343', 'user_id' => 2) - ), - array( - 'e' => array('id' => 3, 'name' => 'Arnold'), - 'p' => array('id' => 4, 'phonenumber' => '333 333', 'user_id' => 3) - ), - array( - 'e' => array('id' => 4, 'name' => 'Arnold'), - 'p' => array('id' => null, 'phonenumber' => null, 'user_id' => null) - ) - ); - public function prepareData() - { } - - public function testHydrateHooks() - { - $user = new User(); - $listener = new HydrationListener; - $user->getClassMetadata()->addRecordListener($listener); - - $user->name = 'zYne'; - $user->save(); - - $this->conn->clear(); - - $user = Doctrine_Query::create()->from('User u')->fetchOne(); - - $this->assertEqual($user->name, 'ZYNE'); - $this->assertEqual($user->password, 'DEFAULT PASS'); - - $user->getClassMetadata()->removeRecordListeners(); - } -} -class HydrationListener extends Doctrine_Record_Listener -{ - public function preHydrate(Doctrine_Event $event) - { - $data = $event->data; - $data['password'] = 'default pass'; - - $event->data = $data; - } - public function postHydrate(Doctrine_Event $event) - { - foreach ($event->data as $key => $value) { - $event->data[$key] = strtoupper($value); - } - } -} -class Doctrine_Hydrate_Mock extends Doctrine_Hydrator_Abstract -{ - protected $data; - - public function setData($data) - { - $this->data = $data; - } - - public function hydrateResultSet($parserResult) - { - return true; - } -} diff --git a/tests_old/I18nTestCase.php b/tests_old/I18nTestCase.php deleted file mode 100644 index 6d6f76033..000000000 --- a/tests_old/I18nTestCase.php +++ /dev/null @@ -1,138 +0,0 @@ -. - */ - -/** - * Doctrine_I18n_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_I18n_TestCase extends Doctrine_UnitTestCase -{ - - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array(); - - parent::prepareTables(); - } - - public function testTranslationTableGetsExported() - { - $this->conn->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL); - - $this->assertTrue(Doctrine::EXPORT_ALL & Doctrine::EXPORT_TABLES); - $this->assertTrue(Doctrine::EXPORT_ALL & Doctrine::EXPORT_CONSTRAINTS); - $this->assertTrue(Doctrine::EXPORT_ALL & Doctrine::EXPORT_PLUGINS); - - $sql = $this->conn->export->exportClassesSql(array('I18nTest')); - - foreach ($sql as $query) { - $this->conn->exec($query); - } - } - - public function testTranslatedColumnsAreRemovedFromMainComponent() - { - $i = new I18nTest(); - - $columns = $i->getTable()->getColumns(); - - $this->assertFalse(isset($columns['title'])); - $this->assertFalse(isset($columns['name'])); - } - - public function testTranslationTableIsInitializedProperly() - { - $i = new I18nTest(); - $i->id = 1; - - $i->Translation['EN']->name = 'some name'; - $i->Translation['EN']->title = 'some title'; - $this->assertEqual($i->Translation->getTable()->getComponentName(), 'I18nTestTranslation'); - - - $i->Translation['FI']->name = 'joku nimi'; - $i->Translation['FI']->title = 'joku otsikko'; - $i->Translation['FI']->lang = 'FI'; - - $i->save(); - - $this->conn->clear(); - - $t = Doctrine_Query::create()->from('I18nTestTranslation')->fetchOne(); - - $this->assertEqual($t->name, 'some name'); - $this->assertEqual($t->title, 'some title'); - $this->assertEqual($t->lang, 'EN'); - - } - - public function testUpdatingI18nItems() - { - $i = Doctrine_Query::create()->query('FROM I18nTest')->getFirst(); - - $i->Translation['EN']->name = 'updated name'; - $i->Translation['EN']->title = 'updated title'; - - $i->Translation->save(); - - $this->assertEqual($t->name, 'updated name'); - $this->assertEqual($t->title, 'updated title'); - } - - public function testDataFetching() - { - $i = Doctrine_Query::create()->from('I18nTest i')->innerJoin('i.Translation t INDEXBY t.lang')->orderby('t.lang')->fetchOne(array(), Doctrine::HYDRATE_ARRAY); - - $this->assertEqual($i['Translation']['EN']['name'], 'some name'); - $this->assertEqual($i['Translation']['EN']['title'], 'some title'); - $this->assertEqual($i['Translation']['EN']['lang'], 'EN'); - - $this->assertEqual($i['Translation']['FI']['name'], 'joku nimi'); - $this->assertEqual($i['Translation']['FI']['title'], 'joku otsikko'); - $this->assertEqual($i['Translation']['FI']['lang'], 'FI'); - } - - public function testIndexByLangIsAttachedToNewlyCreatedCollections() - { - $coll = new Doctrine_Collection('I18nTestTranslation'); - - $coll['EN']['name'] = 'some name'; - - $this->assertEqual($coll['EN']->lang, 'EN'); - } - - public function testIndexByLangIsAttachedToFetchedCollections() - { - $coll = Doctrine_Query::create()->from('I18nTestTranslation')->execute(); - - $this->assertTrue($coll['FI']->exists()); - } -} diff --git a/tests_old/Import/BuilderTestCase.php b/tests_old/Import/BuilderTestCase.php deleted file mode 100644 index 110541093..000000000 --- a/tests_old/Import/BuilderTestCase.php +++ /dev/null @@ -1,44 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Builder_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Builder_TestCase extends Doctrine_UnitTestCase -{ - public function testBuildingOfRecord() - { - $table = $this->conn->getTable('Phonenumber'); - - $builder = new Doctrine_Builder_Record(); - - $rel = $builder->buildRelationDefinition($table->getRelations()); - - } -} diff --git a/tests_old/Import/FirebirdTestCase.php b/tests_old/Import/FirebirdTestCase.php deleted file mode 100644 index 4765238ab..000000000 --- a/tests_old/Import/FirebirdTestCase.php +++ /dev/null @@ -1,77 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Firebird_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Firebird_TestCase extends Doctrine_UnitTestCase -{ - public function testListTablesExecutesSql() - { - $this->import->listTables(); - - $this->assertEqual($this->adapter->pop(), 'SELECT RDB$RELATION_NAME FROM RDB$RELATIONS WHERE RDB$SYSTEM_FLAG=0 AND RDB$VIEW_BLR IS NULL'); - } - public function testListTableFieldsExecutesSql() - { - $this->import->listTableFields('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT RDB\$FIELD_NAME FROM RDB\$RELATION_FIELDS WHERE UPPER(RDB\$RELATION_NAME) = 'TABLE'"); - } - public function testListUsersExecutesSql() - { - $this->import->listUsers(); - - $this->assertEqual($this->adapter->pop(), "SELECT DISTINCT RDB\$USER FROM RDB\$USER_PRIVILEGES"); - } - public function testListViewsExecutesSql() - { - $this->import->listViews(); - - $this->assertEqual($this->adapter->pop(), "SELECT DISTINCT RDB\$VIEW_NAME FROM RDB\$VIEW_RELATIONS"); - } - public function testListFunctionsExecutesSql() - { - $this->import->listFunctions('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT RDB\$FUNCTION_NAME FROM RDB\$FUNCTIONS WHERE RDB\$SYSTEM_FLAG IS NULL"); - } - public function testListTableViewsExecutesSql() - { - $this->import->listTableViews('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT DISTINCT RDB\$VIEW_NAME FROM RDB\$VIEW_RELATIONS WHERE UPPER(RDB\$RELATION_NAME) = 'TABLE'"); - } - public function testListTableTriggersExecutesSql() - { - $this->import->listTableTriggers('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT RDB\$TRIGGER_NAME FROM RDB\$TRIGGERS WHERE RDB\$SYSTEM_FLAG IS NULL OR RDB\$SYSTEM_FLAG = 0 WHERE UPPER(RDB\$RELATION_NAME) = 'TABLE'"); - } -} diff --git a/tests_old/Import/InformixTestCase.php b/tests_old/Import/InformixTestCase.php deleted file mode 100644 index f2b716147..000000000 --- a/tests_old/Import/InformixTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Informix_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Informix_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Import/MssqlTestCase.php b/tests_old/Import/MssqlTestCase.php deleted file mode 100644 index 2cbd1ef01..000000000 --- a/tests_old/Import/MssqlTestCase.php +++ /dev/null @@ -1,72 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Mssql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Mssql_TestCase extends Doctrine_UnitTestCase -{ - public function testListSequencesExecutesSql() - { - $this->import->listSequences('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT name FROM sysobjects WHERE xtype = 'U'"); - } - public function testListTableColumnsExecutesSql() - { - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - $this->import->listTableColumns('table'); - - $this->assertEqual($this->adapter->pop(), "EXEC sp_columns @table_name = table"); - } - public function testListTablesExecutesSql() - { - $this->import->listTables(); - - $this->assertEqual($this->adapter->pop(), "SELECT name FROM sysobjects WHERE type = 'U' AND name <> 'dtproperties' ORDER BY name"); - } - public function testListTriggersExecutesSql() - { - $this->import->listTriggers(); - - $this->assertEqual($this->adapter->pop(), "SELECT name FROM sysobjects WHERE xtype = 'TR'"); - } - public function testListTableTriggersExecutesSql() - { - $this->import->listTableTriggers('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT name FROM sysobjects WHERE xtype = 'TR' AND object_name(parent_obj) = 'table'"); - } - public function testListViewsExecutesSql() - { - $this->import->listViews(); - - $this->assertEqual($this->adapter->pop(), "SELECT name FROM sysobjects WHERE xtype = 'V'"); - } -} diff --git a/tests_old/Import/MysqlTestCase.php b/tests_old/Import/MysqlTestCase.php deleted file mode 100644 index 6c8624d73..000000000 --- a/tests_old/Import/MysqlTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Mysql_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Import/OracleTestCase.php b/tests_old/Import/OracleTestCase.php deleted file mode 100644 index e91beb9fd..000000000 --- a/tests_old/Import/OracleTestCase.php +++ /dev/null @@ -1,105 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Oracle_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Oracle_TestCase extends Doctrine_UnitTestCase -{ - public function testListSequencesExecutesSql() - { - $this->conn->setAttribute(Doctrine::ATTR_EMULATE_DATABASE, true); - - $this->import->listSequences('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT sequence_name FROM sys.user_sequences"); - } - public function testListTableColumnsExecutesSql() - { - $this->import->listTableColumns('table'); - - $q = "SELECT column_name, data_type, data_length, nullable, data_default, data_scale, data_precision FROM all_tab_columns WHERE table_name = 'TABLE' ORDER BY column_name"; - - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListTableIndexesExecutesSql() - { - $this->import->listTableIndexes('table'); - - $q = 'SELECT index_name name FROM user_indexes' - . " WHERE table_name = 'table' OR table_name = 'TABLE'" - . " AND generated = 'N'"; - - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListTablesExecutesSql() - { - $this->import->listTables(); - - $q = 'SELECT table_name FROM sys.user_tables'; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListDatabasesExecutesSql() - { - $this->import->listDatabases(); - - $q = 'SELECT username FROM sys.dba_users'; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListUsersExecutesSql() - { - $this->import->listUsers(); - - $q = 'SELECT username FROM sys.dba_users'; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListViewsExecutesSql() - { - $this->import->listViews(); - - $q = 'SELECT view_name FROM sys.user_views'; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListFunctionsExecutesSql() - { - $this->import->listFunctions(); - - $q = "SELECT name FROM sys.user_source WHERE line = 1 AND type = 'FUNCTION'"; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListTableConstraintsExecutesSql() - { - $this->import->listTableConstraints('table'); - - $q = "SELECT index_name name FROM user_constraints" - . " WHERE table_name = 'table' OR table_name = 'TABLE'"; - - $this->assertEqual($this->adapter->pop(), $q); - } -} diff --git a/tests_old/Import/PgsqlTestCase.php b/tests_old/Import/PgsqlTestCase.php deleted file mode 100644 index 172ec5793..000000000 --- a/tests_old/Import/PgsqlTestCase.php +++ /dev/null @@ -1,169 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Pgsql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Pgsql_TestCase extends Doctrine_UnitTestCase -{ - public function testListSequencesExecutesSql() - { - $this->import->listSequences('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT - relname - FROM - pg_class - WHERE relkind = 'S' AND relnamespace IN - (SELECT oid FROM pg_namespace - WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema')"); - } - public function testListTableColumnsExecutesSql() - { - $this->import->listTableColumns('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT - a.attnum, - a.attname AS field, - t.typname AS type, - format_type(a.atttypid, a.atttypmod) AS complete_type, - a.attnotnull AS isnotnull, - (SELECT 't' - FROM pg_index - WHERE c.oid = pg_index.indrelid - AND pg_index.indkey[0] = a.attnum - AND pg_index.indisprimary = 't' - ) AS pri, - (SELECT pg_attrdef.adsrc - FROM pg_attrdef - WHERE c.oid = pg_attrdef.adrelid - AND pg_attrdef.adnum=a.attnum - ) AS default - FROM pg_attribute a, pg_class c, pg_type t - WHERE c.relname = 'table' - AND a.attnum > 0 - AND a.attrelid = c.oid - AND a.atttypid = t.oid - ORDER BY a.attnum"); - } - public function testListTableIndexesExecutesSql() - { - $this->import->listTableIndexes('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT - relname - FROM - pg_class - WHERE oid IN ( - SELECT indexrelid - FROM pg_index, pg_class - WHERE pg_class.relname = 'table' - AND pg_class.oid=pg_index.indrelid - AND indisunique != 't' - AND indisprimary != 't' - )"); - } - public function testListTablesExecutesSql() - { - $this->import->listTables(); - - $q = "SELECT - c.relname AS table_name - FROM pg_class c, pg_user u - WHERE c.relowner = u.usesysid - AND c.relkind = 'r' - AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) - AND c.relname !~ '^(pg_|sql_)' - UNION - SELECT c.relname AS table_name - FROM pg_class c - WHERE c.relkind = 'r' - AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) - AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) - AND c.relname !~ '^pg_'"; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListDatabasesExecutesSql() - { - $this->import->listDatabases(); - - $q = 'SELECT datname FROM pg_database'; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListUsersExecutesSql() - { - $this->import->listUsers(); - - $q = 'SELECT usename FROM pg_user'; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListViewsExecutesSql() - { - $this->import->listViews(); - - $q = 'SELECT viewname FROM pg_views'; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListFunctionsExecutesSql() - { - $this->import->listFunctions(); - - $q = "SELECT - proname - FROM - pg_proc pr, - pg_type tp - WHERE - tp.oid = pr.prorettype - AND pr.proisagg = FALSE - AND tp.typname <> 'trigger' - AND pr.pronamespace IN - (SELECT oid FROM pg_namespace - WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema'"; - $this->assertEqual($this->adapter->pop(), $q); - } - public function testListTableConstraintsExecutesSql() - { - $this->import->listTableConstraints('table'); - - - $q = "SELECT - relname - FROM - pg_class - WHERE oid IN ( - SELECT indexrelid - FROM pg_index, pg_class - WHERE pg_class.relname = 'table' - AND pg_class.oid = pg_index.indrelid - AND (indisunique = 't' OR indisprimary = 't') - )"; - $this->assertEqual($this->adapter->pop(), $q); - } -} diff --git a/tests_old/Import/SchemaTestCase.php b/tests_old/Import/SchemaTestCase.php deleted file mode 100644 index c7f64a524..000000000 --- a/tests_old/Import/SchemaTestCase.php +++ /dev/null @@ -1,104 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Schema_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Schema_TestCase extends Doctrine_UnitTestCase -{ - public $buildSchema; - public $schema; - - public function testYmlImport() - { - $import = new Doctrine_Import_Schema(); - $import->importSchema('schema.yml', 'yml', 'classes'); - - if ( ! file_exists('classes/User.php')) { - $this->fail(); - } - - if ( ! file_exists('classes/Profile.php')) { - $this->fail(); - } - } - - public function testBuildSchema() - { - $schema = new Doctrine_Import_Schema(); - $array = $schema->buildSchema('schema.yml', 'yml'); - - $model = $array['User']; - - $this->assertTrue(array_key_exists('connection', $model)); - $this->assertTrue(array_key_exists('className', $model)); - $this->assertTrue(array_key_exists('tableName', $model)); - $this->assertTrue(array_key_exists('columns', $model) && is_array($model['columns'])); - $this->assertTrue(array_key_exists('relations', $model) && is_array($model['relations'])); - $this->assertTrue(array_key_exists('indexes', $model) && is_array($model['indexes'])); - $this->assertTrue(array_key_exists('attributes', $model) && is_array($model['attributes'])); - $this->assertTrue(array_key_exists('templates', $model) && is_array($model['columns'])); - $this->assertTrue(array_key_exists('actAs', $model) && is_array($model['actAs'])); - $this->assertTrue(array_key_exists('options', $model) && is_array($model['options'])); - $this->assertTrue(array_key_exists('package', $model)); - } - - public function testSchemaRelationshipCompletion() - { - $this->buildSchema = new Doctrine_Import_Schema(); - $this->schema = $this->buildSchema->buildSchema('schema.yml', 'yml'); - - foreach ($this->schema as $name => $properties) { - foreach ($properties['relations'] as $alias => $relation) { - if ( ! $this->_verifyMultiDirectionalRelationship($name, $alias, $relation)) { - $this->fail(); - - return false; - } - } - } - - $this->pass(); - } - - protected function _verifyMultiDirectionalRelationship($class, $relationAlias, $relation) - { - $foreignClass = $relation['class']; - $foreignAlias = isset($relation['foreignAlias']) ? $relation['foreignAlias']:$class; - - $foreignClassRelations = $this->schema[$foreignClass]['relations']; - - // Check to see if the foreign class has the opposite end defined for the class/foreignAlias - if (isset($foreignClassRelations[$foreignAlias])) { - return true; - } else { - return false; - } - } -} \ No newline at end of file diff --git a/tests_old/Import/SqliteTestCase.php b/tests_old/Import/SqliteTestCase.php deleted file mode 100644 index f548046b4..000000000 --- a/tests_old/Import/SqliteTestCase.php +++ /dev/null @@ -1,61 +0,0 @@ -. - */ - -/** - * Doctrine_Import_Sqlite_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_Sqlite_TestCase extends Doctrine_UnitTestCase -{ - public function testListSequencesExecutesSql() - { - $this->import->listSequences('table'); - - $this->assertEqual($this->adapter->pop(), "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL ORDER BY name"); - } - public function testListTableColumnsExecutesSql() - { - $this->import->listTableColumns('table'); - - $this->assertEqual($this->adapter->pop(), "PRAGMA table_info(table)"); - } - public function testListTableIndexesExecutesSql() - { - $this->import->listTableIndexes('table'); - - $this->assertEqual($this->adapter->pop(), "PRAGMA index_list(table)"); - } - public function testListTablesExecutesSql() - { - $this->import->listTables(); - - $q = "SELECT name FROM sqlite_master WHERE type = 'table' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name"; - - $this->assertEqual($this->adapter->pop(), $q); - } -} diff --git a/tests_old/ImportTestCase.php b/tests_old/ImportTestCase.php deleted file mode 100644 index ae0c0da5a..000000000 --- a/tests_old/ImportTestCase.php +++ /dev/null @@ -1,52 +0,0 @@ -. - */ - -/** - * Doctrine_Import_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Import_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { } - public function prepareData() - { } - - public function testImport() - { - $this->dbh = new PDO('sqlite::memory:'); - - $this->dbh->exec('CREATE TABLE import_test_user (id INTEGER PRIMARY KEY, name TEXT)'); - - $this->conn = Doctrine_Manager::connection($this->dbh); - - $this->conn->import->import('Import/_files'); - - $this->assertTrue(file_exists('Import/_files/ImportTestUser.php')); - } -} diff --git a/tests_old/Inheritance/JoinedTestCase.php b/tests_old/Inheritance/JoinedTestCase.php deleted file mode 100644 index 4fbfa05c3..000000000 --- a/tests_old/Inheritance/JoinedTestCase.php +++ /dev/null @@ -1,232 +0,0 @@ -tables[] = 'CTI_User'; - $this->tables[] = 'CTI_Manager'; - $this->tables[] = 'CTI_Customer'; - $this->tables[] = 'CTI_SuperManager'; - - parent::prepareTables(); - } - - public function setUp() - { - parent::setUp(); - $this->prepareTables(); - } - - public function testMetadataSetup() - { - $suManagerTable = $this->conn->getMetadata('CTI_SuperManager'); - $userTable = $this->conn->getMetadata('CTI_User'); - $customerTable = $this->conn->getMetadata('CTI_Customer'); - $managerTable = $this->conn->getMetadata('CTI_Manager'); - $this->assertTrue($suManagerTable !== $userTable); - $this->assertTrue($suManagerTable !== $customerTable); - $this->assertTrue($userTable !== $customerTable); - $this->assertTrue($managerTable !== $suManagerTable); - - // expected column counts - $this->assertEqual(6, count($suManagerTable->getColumns())); - $this->assertEqual(4, count($userTable->getColumns())); - $this->assertEqual(5, count($managerTable->getColumns())); - $this->assertEqual(5, count($customerTable->getColumns())); - - // expected table names - $this->assertEqual('cti_user', $userTable->getTableName()); - $this->assertEqual('cti_manager', $managerTable->getTableName()); - $this->assertEqual('cti_customer', $customerTable->getTableName()); - $this->assertEqual('cti_supermanager', $suManagerTable->getTableName()); - - // expected joined parents option - $this->assertEqual(array(), $userTable->getParentClasses()); - $this->assertEqual(array('CTI_User'), $managerTable->getParentClasses()); - $this->assertEqual(array('CTI_User'), $customerTable->getParentClasses()); - $this->assertEqual(array('CTI_Manager', 'CTI_User'), $suManagerTable->getParentClasses()); - - // check inheritance map - $this->assertEqual(array(1 => 'CTI_User', 2 => 'CTI_Manager', - 3 => 'CTI_Customer', 4 => 'CTI_SuperManager'), $userTable->getInheritanceOption('discriminatorMap')); - - } - - protected function _createManager() - { - $manager = new CTI_Manager(); - $manager->salary = 80000; - $manager->name = 'John Smith'; - try { - $manager->save(); - $this->pass(); - return $manager; - } catch (Exception $e) { - $this->fail("Inserting record in class table inheritance failed: " . $e->getMessage()); - } - } - - protected function _createSuperManager() - { - $manager = new CTI_SuperManager(); - $manager->salary = 1000000; - $manager->name = 'Bill Gates'; - $manager->gosutitle = 'BillyBoy'; - try { - $manager->save(); - $this->pass(); - return $manager; - } catch (Exception $e) { - $this->fail("Inserting record in class table inheritance failed: " . $e->getMessage()); - } - - } - - public function testSaveInsertsDataAcrossJoinedTablesTransparently() - { - $manager = $this->_createManager(); - $this->assertEqual(1, $manager->id); - $this->assertEqual(80000, $manager->salary); - $this->assertEqual('John Smith', $manager->name); - $this->assertTrue($manager instanceof CTI_Manager); - - $superManager = $this->_createSuperManager(); - $this->assertEqual(2, $superManager->id); - $this->assertEqual(1000000, $superManager->salary); - $this->assertEqual('Bill Gates', $superManager->name); - $this->assertEqual('BillyBoy', $superManager->gosutitle); - $this->assertTrue($superManager instanceof CTI_SuperManager); - } - - public function testUpdateUpdatesOnlyChangedFields() - { - $manager = $this->_createManager(); - try { - $manager->salary = 12; - $manager->save(); - $this->pass(); - } catch (Exception $e) { - $this->fail("Update failed [{$e->getMessage()}]."); - } - - } - - public function testUpdateUpdatesDataAcrossJoinedTablesTransparently() - { - $manager = $this->_createManager(); - $manager->salary = 90000; // he got a pay rise... - $manager->name = 'John Locke'; // he got married ... - try { - $manager->save(); - $this->pass(); - } catch (Exception $e) { - $this->fail("Updating record in class table inheritance failed: " . $e->getMessage()); - } - $this->assertEqual(1, $manager->id); - $this->assertEqual(90000, $manager->salary); - $this->assertEqual('John Locke', $manager->name); - $this->assertTrue($manager instanceof CTI_Manager); - - - $superManager = $this->_createSuperManager(); - $superManager->salary = 0; // he got fired... - $superManager->name = 'Bill Clinton'; // he got married ... again - $superManager->gosutitle = 'Billy the Kid'; // ... and went mad - try { - $superManager->save(); - $this->pass(); - } catch (Exception $e) { - $this->fail("Updating record in class table inheritance failed: " . $e->getMessage()); - } - $this->assertEqual(2, $superManager->id); - $this->assertEqual(0, $superManager->salary); - $this->assertEqual('Bill Clinton', $superManager->name); - $this->assertEqual('Billy the Kid', $superManager->gosutitle); - $this->assertTrue($superManager instanceof CTI_SuperManager); - } - - public function testDqlQueryJoinsTransparentlyAcrossParents() - { - $this->_createManager(); - $this->conn->clear('CTI_Manager'); - - $query = $this->conn->createQuery(); - $query->parseQuery("SELECT m.* FROM CTI_Manager m"); - $manager = $query->execute()->getFirst(); - - $this->assertTrue($manager instanceof CTI_Manager); - $this->assertEqual(1, $manager->id); - $this->assertEqual(80000, $manager->salary); - $this->assertEqual('John Smith', $manager->name); - } - - public function testQueryingBaseClassOuterJoinsSubClassesAndReturnsSubclassInstances() - { - $this->_createManager(); - $this->conn->clear('CTI_Manager'); - $this->conn->clear('CTI_User'); - - $query = $this->conn->createQuery(); - $query->parseQuery("SELECT u.* FROM CTI_User u"); - //echo $query->getSql(); - $user = $query->execute()->getFirst(); - - $this->assertTrue($user instanceof CTI_Manager); - $this->assertEqual(1, $user->id); - $this->assertEqual(80000, $user->salary); - $this->assertEqual('John Smith', $user->name); - } -} - - -class CTI_User extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, array( - 'discriminatorColumn' => 'dtype', - 'discriminatorMap' => array(1 => 'CTI_User', 2 => 'CTI_Manager', - 3 => 'CTI_Customer', 4 => 'CTI_SuperManager') - )); - $class->setSubclasses(array('CTI_Manager', 'CTI_Customer', 'CTI_SuperManager')); - $class->setTableName('cti_user'); - $class->setColumn('cti_id as id', 'integer', 4, array('primary' => true, 'autoincrement' => true)); - $class->setColumn('cti_foo as foo', 'integer', 4); - $class->setColumn('cti_name as name', 'string', 50, array('notnull' => true)); - $class->setColumn('dtype', 'integer', 2); - } -} - -class CTI_Manager extends CTI_User -{ - protected $name; - - public static function initMetadata($class) - { - $class->setTableName('cti_manager'); - $class->setSubclasses(array('CTI_SuperManager')); - $class->setColumn('ctim_salary as salary', 'varchar', 50, array()); - } -} - -class CTI_Customer extends CTI_User -{ - public static function initMetadata($class) - { - $class->setTableName('cti_customer'); - $class->setColumn('ctic_bonuspoints as bonuspoints', 'varchar', 50, array()); - } -} - -class CTI_SuperManager extends CTI_Manager -{ - public static function initMetadata($class) - { - $class->setTableName('cti_supermanager'); - $class->setColumn('ctism_gosutitle as gosutitle', 'varchar', 50, array()); - } -} diff --git a/tests_old/Inheritance/SingleTableTestCase.php b/tests_old/Inheritance/SingleTableTestCase.php deleted file mode 100644 index 3619832b5..000000000 --- a/tests_old/Inheritance/SingleTableTestCase.php +++ /dev/null @@ -1,110 +0,0 @@ -tables[] = 'STI_User'; - $this->tables[] = 'STI_Manager'; - $this->tables[] = 'STI_Customer'; - $this->tables[] = 'STI_SuperManager'; - parent::prepareTables(); - } - - public function testMetadataSetup() - { - $userClass = $this->conn->getClassMetadata('STI_User'); - $superManagerClass = $this->conn->getClassMetadata('STI_SuperManager'); - $managerClass = $this->conn->getClassMetadata('STI_Manager'); - $customerClass = $this->conn->getClassMetadata('STI_Customer'); - - $this->assertEqual(4, count($userClass->getMappedColumns())); - $this->assertEqual('sti_entity', $userClass->getTableName()); - $this->assertEqual('sti_entity', $managerClass->getTableName()); - - // check inheritance map - $this->assertEqual(array(1 => 'STI_User', - 2 => 'STI_Manager', - 3 => 'STI_Customer', - 4 => 'STI_SuperManager'), $userClass->getInheritanceOption('discriminatorMap')); - - //var_dump($superManagerTable->getComponentName()); - } - - public function testSave() - { - $manager = new STI_Manager(); - $manager->salary = 80000; - $manager->name = 'John Smith'; - try { - $manager->save(); - $this->assertEqual(1, $manager->id); - $this->assertEqual(80000, $manager->salary); - $this->assertEqual('John Smith', $manager->name); - $this->assertEqual(2, $manager->type); - } catch (Exception $e) { - $this->fail("Saving record in single table inheritance failed: " . $e->getMessage()); - } - } - - public function testQuery() - { - //$this->_createManager(); - $query = $this->conn->createQuery(); - $query->select("m.*")->from("STI_Manager m"); - //echo $query->getSql(); - //$managers = $query->execute(); - - } -} - - -class STI_User extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setInheritanceType(Doctrine::INHERITANCE_TYPE_SINGLE_TABLE, array( - 'discriminatorColumn' => 'type', - 'discriminatorMap' => array( - 1 => 'STI_User', - 2 => 'STI_Manager', - 3 => 'STI_Customer', - 4 => 'STI_SuperManager')) - ); - $class->setSubclasses(array('STI_Manager', 'STI_Customer', 'STI_SuperManager')); - $class->setTableName('sti_entity'); - $class->setColumn('sti_id as id', 'integer', 4, array('primary' => true, 'autoincrement' => true)); - $class->setColumn('sti_foo as foo', 'integer', 4); - $class->setColumn('sti_name as name', 'varchar', 50); - $class->setColumn('type', 'integer', 4); - } -} - -class STI_Manager extends STI_User -{ - public static function initMetadata($class) - { - $class->setSubclasses(array('STI_SuperManager')); - $class->setColumn('stim_salary as salary', 'varchar', 50, array()); - } -} - -class STI_Customer extends STI_User -{ - public static function initMetadata($class) - { - $class->setColumn('stic_bonuspoints as bonuspoints', 'varchar', 50, array()); - } -} - -class STI_SuperManager extends STI_Manager -{ - public static function initMetadata($class) - { - $class->setColumn('stism_gosutitle as gosutitle', 'varchar', 50, array()); - } -} diff --git a/tests_old/Inheritance/TablePerClassTestCase.php b/tests_old/Inheritance/TablePerClassTestCase.php deleted file mode 100644 index 0d837f3c0..000000000 --- a/tests_old/Inheritance/TablePerClassTestCase.php +++ /dev/null @@ -1,108 +0,0 @@ -prepareTables(); - } - - public function prepareTables() - { - $this->tables[] = 'CCTI_User'; - $this->tables[] = 'CCTI_Manager'; - $this->tables[] = 'CCTI_Customer'; - $this->tables[] = 'CCTI_SuperManager'; - parent::prepareTables(); - } - - public function testMetadataTableSetup() - { - $supMngrTable = $this->conn->getClassMetadata('CCTI_SuperManager'); - $usrTable = $this->conn->getClassMetadata('CCTI_User'); - $mngrTable = $this->conn->getClassMetadata('CCTI_Manager'); - $customerTable = $this->conn->getClassMetadata('CCTI_Customer'); - - $this->assertEqual(3, count($usrTable->getColumns())); - $this->assertEqual(4, count($mngrTable->getColumns())); - $this->assertEqual(4, count($customerTable->getColumns())); - $this->assertEqual(5, count($supMngrTable->getColumns())); - - $this->assertEqual('ccti_user', $usrTable->getTableName()); - $this->assertEqual('ccti_manager', $mngrTable->getTableName()); - $this->assertEqual('ccti_customer', $customerTable->getTableName()); - $this->assertEqual('ccti_supermanager', $supMngrTable->getTableName()); - - //var_dump($mngrTable->getColumns()); - } - - public function testSave() - { - $manager = new CCTI_Manager(); - $manager->salary = 80000; - $manager->name = 'John Smith'; - try { - $manager->save(); - $this->assertEqual(1, $manager->id); - $this->assertEqual(80000, $manager->salary); - $this->assertEqual('John Smith', $manager->name); - } catch (Exception $e) { - $this->fail("Saving record in concrete table inheritance failed: " . $e->getMessage()); - } - } - - public function testQuery() - { - //$manager = $this->conn->query("FROM CCTI_Manager")->getFirst(); - //var_dump($manager); - } -} - - -class CCTI_User extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setInheritanceType(Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS); - $class->setTableName('ccti_user'); - $class->setSubclasses(array('CCTI_Manager', 'CCTI_Customer', 'CCTI_SuperManager')); - $class->setColumn('ccti_id as id', 'integer', 4, array ('primary' => true, 'autoincrement' => true)); - $class->setColumn('ccti_foo as foo', 'integer', 4); - $class->setColumn('ccti_name as name', 'varchar', 50, array ()); - } -} - -class CCTI_Manager extends CCTI_User -{ - public static function initMetadata($class) - { - $class->setTableName('ccti_manager'); - $class->setSubclasses(array('CCTI_SuperManager')); - $class->setColumn('ccti_salary as salary', 'varchar', 50, array()); - } -} - -class CCTI_Customer extends CCTI_User -{ - public static function initMetadata($class) - { - $class->setTableName('ccti_customer'); - $class->setColumn('ccti_bonuspoints as bonuspoints', 'varchar', 50, array()); - } -} - -class CCTI_SuperManager extends CCTI_Manager -{ - public static function initMetadata($class) - { - $class->setTableName('ccti_supermanager'); - $class->setColumn('ccti_gosutitle as gosutitle', 'varchar', 50, array()); - } -} diff --git a/tests_old/IntegrityActionTestCase.php b/tests_old/IntegrityActionTestCase.php deleted file mode 100644 index 67a6b8b24..000000000 --- a/tests_old/IntegrityActionTestCase.php +++ /dev/null @@ -1,71 +0,0 @@ -. - */ - -/** - * Doctrine_IntegrityAction_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_IntegrityAction_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('CascadeDeleteTest', 'CascadeDeleteRelatedTest', 'CascadeDeleteRelatedTest2'); - - parent::prepareTables(); - } - public function testIntegrityActionsAreAddedIntoGlobalActionsArray() - { - $c = new CascadeDeleteTest; - $c2 = new CascadeDeleteRelatedTest; - - $expected = array('CascadeDeleteRelatedTest' => 'CASCADE'); - $this->assertEqual($this->manager->getDeleteActions('CascadeDeleteTest'), $expected); - - $expected = array('CascadeDeleteRelatedTest' => 'SET NULL'); - $this->assertEqual($this->manager->getUpdateActions('CascadeDeleteTest'), $expected); - } - public function testOnDeleteCascadeEmulation() - { - $c = new CascadeDeleteTest; - $c->name = 'c 1'; - $c->Related[]->name = 'r 1'; - $c->Related[]->name = 'r 2'; - $c->Related[0]->Related[]->name = 'r r 1'; - $c->Related[1]->Related[]->name = 'r r 2'; - - $c->save(); - - $this->connection->clear(); - - $c = $this->conn->queryOne('FROM CascadeDeleteTest c WHERE c.id = 1'); - - $c->delete(); - } -} diff --git a/tests_old/ManagerTestCase.php b/tests_old/ManagerTestCase.php deleted file mode 100644 index 9d70168fc..000000000 --- a/tests_old/ManagerTestCase.php +++ /dev/null @@ -1,130 +0,0 @@ -. - */ - -/** - * Doctrine_Manager_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Manager_TestCase extends Doctrine_UnitTestCase { - public function testGetInstance() { - $this->assertTrue(Doctrine_Manager::getInstance() instanceOf Doctrine_Manager); - } - public function testOpenConnection() { - $this->assertTrue($this->connection instanceOf Doctrine_Connection); - } - public function testGetIterator() { - $this->assertTrue($this->manager->getIterator() instanceof ArrayIterator); - } - public function testCount() { - $this->assertTrue(is_integer(count($this->manager))); - } - public function testGetCurrentConnection() { - $this->assertTrue($this->manager->getCurrentConnection() === $this->connection); - } - public function testGetConnections() { - $this->assertTrue(is_integer(count($this->manager->getConnections()))); - } - public function testClassifyTableize() { - $name = "Forum_Category"; - $this->assertEqual(Doctrine::tableize($name), "forum__category"); - $this->assertEqual(Doctrine::classify(Doctrine::tableize($name)), $name); - - - } - public function testDsnParser() - { - $mysql = 'mysql://user:pass@localhost/dbname'; - - // This is what is specified in the manul - // I think it should be this for parse_url() to work - // sqlite://full/unix/path/to/file.db - // It expects only // since it thinks it is parsing a url - // The problem after that is that the dns is not valid when being passed to PDO - $sqlite = 'sqlite:////full/unix/path/to/file.db'; - $sqlitewin = 'sqlite:///c:/full/windows/path/to/file.db'; - - $manager = Doctrine_Manager::getInstance(); - - try { - $res = $manager->parseDsn($mysql); - $expectedMysqlDsn = array( - "scheme" => "mysql", - "host" => "localhost", - "user" => "user", - "pass" => "pass", - "path" => "/dbname", - "dsn" => "mysql:host=localhost;dbname=dbname", - "port" => NULL, - "query" => NULL, - "fragment" => NULL, - "database" => "dbname"); - $this->assertEqual($expectedMysqlDsn, $res); - } catch (Exception $e) { - $this->fail($e->getMessage()); - } - - try { - $expectedDsn = array( - "scheme" => "sqlite", - "host" => null, - "user" => null, - "pass" => null, - "path" => "/full/unix/path/to/file.db", - "dsn" => "sqlite:/full/unix/path/to/file.db", - "port" => NULL, - "query" => NULL, - "fragment" => NULL, - "database" => "/full/unix/path/to/file.db"); - - $res = $manager->parseDsn($sqlite); - $this->assertEqual($expectedDsn, $res); - } catch (Exception $e) { - $this->fail($e->getMessage()); - } - - try { - $expectedDsn = array( - "scheme" => "sqlite", - "host" => null, - "path" => "c:/full/windows/path/to/file.db", - "dsn" => "sqlite:c:/full/windows/path/to/file.db", - "port" => NULL, - "user" => null, - "pass" => null, - "query" => NULL, - "fragment" => NULL, - "database" => "c:/full/windows/path/to/file.db"); - $res = $manager->parseDsn($sqlitewin); - $this->assertEqual($expectedDsn, $res); - } catch (Exception $e) { - $this->fail($e->getMessage()); - } - } - public function prepareData() { } - public function prepareTables() { } -} diff --git a/tests_old/Metadata/FactoryTestCase.php b/tests_old/Metadata/FactoryTestCase.php deleted file mode 100644 index 95c09dfbc..000000000 --- a/tests_old/Metadata/FactoryTestCase.php +++ /dev/null @@ -1,249 +0,0 @@ -tables[] = 'Metadata_User'; - $this->tables[] = 'Metadata_Manager'; - $this->tables[] = 'Metadata_Customer'; - $this->tables[] = 'Metadata_SuperManager'; - parent::prepareTables(); - } - - public function setUp() - { - parent::setUp(); - $this->prepareTables(); - } - - public function testMetadataSetupOnClassTableInheritanceHierarchy() - { - $userClass = $this->conn->getClassMetadata('Metadata_User'); - $this->assertTrue($userClass instanceof Doctrine_ClassMetadata); - $this->assertEqual('cti_user', $userClass->getTableName()); - $this->assertEqual(4, count($userClass->getMappedColumns())); - $this->assertIdentical(array(), $userClass->getParentClasses()); - $this->assertEqual('type', $userClass->getInheritanceOption('discriminatorColumn')); - $this->assertIdentical(array( - 1 => 'CTI_User', - 2 => 'CTI_Manager', - 3 => 'CTI_Customer', - 4 => 'CTI_SuperManager'), $userClass->getInheritanceOption('discriminatorMap')); - - - $managerClass = $this->conn->getMetadata('Metadata_Manager'); - $this->assertTrue($managerClass instanceof Doctrine_ClassMetadata); - $this->assertIdentical(array('Metadata_User'), $managerClass->getParentClasses()); - $this->assertEqual('cti_manager', $managerClass->getTableName()); - $this->assertEqual(5, count($managerClass->getMappedColumns())); - $this->assertEqual('type', $managerClass->getInheritanceOption('discriminatorColumn')); - $this->assertIdentical(array( - 1 => 'CTI_User', - 2 => 'CTI_Manager', - 3 => 'CTI_Customer', - 4 => 'CTI_SuperManager'), $managerClass->getInheritanceOption('discriminatorMap')); - - - $suManagerClass = $this->conn->getMetadata('Metadata_SuperManager'); - $this->assertTrue($suManagerClass instanceof Doctrine_ClassMetadata); - $this->assertIdentical(array('Metadata_Manager', 'Metadata_User'), $suManagerClass->getParentClasses()); - $this->assertEqual('cti_supermanager', $suManagerClass->getTableName()); - $this->assertEqual(6, count($suManagerClass->getMappedColumns())); - $this->assertEqual('type', $suManagerClass->getInheritanceOption('discriminatorColumn')); - $this->assertIdentical(array( - 1 => 'CTI_User', - 2 => 'CTI_Manager', - 3 => 'CTI_Customer', - 4 => 'CTI_SuperManager'), $suManagerClass->getInheritanceOption('discriminatorMap')); - - //var_dump($suManagerClass->getColumns()); - } - - public function testExportableFormatOfClassInClassTableInheritanceHierarchy() - { - $userClass = $this->conn->getClassMetadata('Metadata_User'); - $userClassExportableFormat = $userClass->getExportableFormat(); - $this->assertEqual(4, count($userClassExportableFormat['columns'])); - $this->assertTrue(isset($userClassExportableFormat['columns']['cti_id'])); - $this->assertTrue(isset($userClassExportableFormat['columns']['cti_id']['primary'])); - $this->assertTrue(isset($userClassExportableFormat['columns']['cti_id']['autoincrement'])); - $this->assertTrue(isset($userClassExportableFormat['columns']['cti_foo'])); - $this->assertTrue(isset($userClassExportableFormat['columns']['cti_name'])); - $this->assertTrue(isset($userClassExportableFormat['columns']['type'])); - - $managerClass = $this->conn->getClassMetadata('Metadata_Manager'); - $managerClassExportableFormat = $managerClass->getExportableFormat(); - $this->assertEqual(2, count($managerClassExportableFormat['columns'])); - $this->assertTrue(isset($managerClassExportableFormat['columns']['cti_id'])); - $this->assertTrue(isset($managerClassExportableFormat['columns']['cti_id']['primary'])); - $this->assertFalse(isset($managerClassExportableFormat['columns']['cti_id']['autoincrement'])); - - $customerClass = $this->conn->getClassMetadata('Metadata_Customer'); - $customerClassExportableFormat = $customerClass->getExportableFormat(); - $this->assertEqual(2, count($customerClassExportableFormat['columns'])); - $this->assertTrue(isset($customerClassExportableFormat['columns']['cti_id'])); - $this->assertTrue(isset($customerClassExportableFormat['columns']['cti_id']['primary'])); - $this->assertFalse(isset($customerClassExportableFormat['columns']['cti_id']['autoincrement'])); - - $superManagerClass = $this->conn->getClassMetadata('Metadata_SuperManager'); - $superManagerClassExportableFormat = $superManagerClass->getExportableFormat(); - $this->assertEqual(2, count($superManagerClassExportableFormat['columns'])); - $this->assertTrue(isset($superManagerClassExportableFormat['columns']['cti_id'])); - $this->assertTrue(isset($superManagerClassExportableFormat['columns']['cti_id']['primary'])); - $this->assertFalse(isset($superManagerClassExportableFormat['columns']['cti_id']['autoincrement'])); - } - - public function testMetadataSetupOnSingleTableInheritanceHierarchy() - { - $userClass = $this->conn->getClassMetadata('Metadata_STI_User'); - $this->assertTrue($userClass instanceof Doctrine_ClassMetadata); - $this->assertEqual('cti_user', $userClass->getTableName()); - $this->assertEqual(4, count($userClass->getMappedColumns())); - $this->assertIdentical(array(), $userClass->getParentClasses()); - $this->assertEqual('type', $userClass->getInheritanceOption('discriminatorColumn')); - $this->assertIdentical(array( - 1 => 'CTI_User', - 2 => 'CTI_Manager', - 3 => 'CTI_Customer', - 4 => 'CTI_SuperManager'), $userClass->getInheritanceOption('discriminatorMap')); - - $managerClass = $this->conn->getClassMetadata('Metadata_STI_Manager'); - $this->assertTrue($managerClass instanceof Doctrine_ClassMetadata); - $this->assertIdentical(array('Metadata_STI_User'), $managerClass->getParentClasses()); - $this->assertEqual('cti_user', $managerClass->getTableName()); - $this->assertEqual(5, count($managerClass->getMappedColumns())); - $this->assertEqual('type', $managerClass->getInheritanceOption('discriminatorColumn')); - $this->assertIdentical(array( - 1 => 'CTI_User', - 2 => 'CTI_Manager', - 3 => 'CTI_Customer', - 4 => 'CTI_SuperManager'), $managerClass->getInheritanceOption('discriminatorMap')); - - - $suManagerClass = $this->conn->getClassMetadata('Metadata_STI_SuperManager'); - $this->assertTrue($suManagerClass instanceof Doctrine_ClassMetadata); - $this->assertIdentical(array('Metadata_STI_Manager', 'Metadata_STI_User'), $suManagerClass->getParentClasses()); - $this->assertEqual('cti_user', $suManagerClass->getTableName()); - $this->assertEqual(6, count($suManagerClass->getMappedColumns())); - $this->assertEqual('type', $suManagerClass->getInheritanceOption('discriminatorColumn')); - $this->assertIdentical(array( - 1 => 'CTI_User', - 2 => 'CTI_Manager', - 3 => 'CTI_Customer', - 4 => 'CTI_SuperManager'), $suManagerClass->getInheritanceOption('discriminatorMap')); - - //var_dump($suManagerClass->getColumns()); - } -} - - -class Metadata_User extends Doctrine_Entity -{ - public static function initMetadata(Doctrine_ClassMetadata $class) - { - $class->setTableName('cti_user'); - $class->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, - array('discriminatorColumn' => 'type', - 'discriminatorMap' => array( - 1 => 'CTI_User', - 2 => 'CTI_Manager', - 3 => 'CTI_Customer', - 4 => 'CTI_SuperManager') - ) - ); - $class->setSubclasses(array('Metadata_Manager', 'Metadata_Customer', 'Metadata_SuperManager')); - $class->mapColumn('cti_id as id', 'integer', 4, array('primary' => true, 'autoincrement' => true)); - $class->mapColumn('cti_foo as foo', 'integer', 4); - $class->mapColumn('cti_name as name', 'string', 50); - $class->mapColumn('type', 'integer', 1); - - //$class->setNamedQuery('findByName', 'SELECT u.* FROM User u WHERE u.name = ?'); - } -} - -class Metadata_Manager extends Metadata_User -{ - public static function initMetadata(Doctrine_ClassMetadata $class) - { - $class->setTableName('cti_manager'); - $class->setSubclasses(array('Metadata_SuperManager')); - $class->mapColumn('ctim_salary as salary', 'varchar', 50, array()); - } -} - -class Metadata_Customer extends Metadata_User -{ - public static function initMetadata(Doctrine_ClassMetadata $class) - { - $class->setTableName('cti_customer'); - $class->mapColumn('ctic_bonuspoints as bonuspoints', 'varchar', 50, array()); - } -} - -class Metadata_SuperManager extends Metadata_Manager -{ - public static function initMetadata(Doctrine_ClassMetadata $class) - { - $class->setTableName('cti_supermanager'); - $class->mapColumn('ctism_gosutitle as gosutitle', 'varchar', 50, array()); - } -} - - - -class Metadata_STI_User extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('cti_user'); - $class->setInheritanceType(Doctrine::INHERITANCE_TYPE_SINGLE_TABLE, - array('discriminatorColumn' => 'type', - 'discriminatorMap' => array( - 1 => 'CTI_User', - 2 => 'CTI_Manager', - 3 => 'CTI_Customer', - 4 => 'CTI_SuperManager') - ) - ); - $class->setSubclasses(array('Metadata_STI_Manager', 'Metadata_STI_Customer', 'Metadata_STI_SuperManager')); - $class->mapColumn('cti_id as id', 'integer', 4, array('primary' => true, 'autoincrement' => true)); - $class->mapColumn('cti_foo as foo', 'integer', 4); - $class->mapColumn('cti_name as name', 'string', 50); - $class->mapColumn('type', 'integer', 1); - - //$class->setNamedQuery('findByName', 'SELECT u.* FROM User u WHERE u.name = ?'); - } -} - -class Metadata_STI_Manager extends Metadata_STI_User -{ - public static function initMetadata($class) - { - $class->setTableName('cti_manager'); - $class->setSubclasses(array('Metadata_STI_SuperManager')); - $class->mapColumn('ctim_salary as salary', 'varchar', 50, array()); - } -} - -class Metadata_STI_Customer extends Metadata_STI_User -{ - public static function initMetadata($class) - { - $class->setTableName('cti_customer'); - $class->mapColumn('ctic_bonuspoints as bonuspoints', 'varchar', 50, array()); - } -} - -class Metadata_STI_SuperManager extends Metadata_STI_Manager -{ - public static function initMetadata($class) - { - $class->setTableName('cti_supermanager'); - $class->mapColumn('ctism_gosutitle as gosutitle', 'varchar', 50, array()); - } -} - diff --git a/tests_old/Migration/MysqlTestCase.php b/tests_old/Migration/MysqlTestCase.php deleted file mode 100644 index c23f6ea52..000000000 --- a/tests_old/Migration/MysqlTestCase.php +++ /dev/null @@ -1,80 +0,0 @@ -. - */ - -/** - * Doctrine_Migration_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Migration_Mysql_TestCase extends Doctrine_UnitTestCase -{ - protected $serverExists = false; - - public function setUp() - { - parent::setUp(); - - try { - $dsn = 'mysql://doctrine_tester:d0cTrynR0x!@localhost/doctrine_unit_test'; - $this->conn = $this->manager->openConnection($dsn, 'unit_test', true); - $this->conn->connect(); - $this->serverExists = true; - } catch (Exception $e){ - $this->serverExists = false; - } - } - - public function testMigration() - { - if ($this->serverExists){ - // Clean up any left over tables from broken test runs. - try { - $this->conn->export->dropTable('migration_test'); - $this->conn->export->dropTable('migration_version'); - } catch(Exception $e) { } - - // New migration for the 'migration_classes' directory - $migration = new Doctrine_Migration('mysql_migration_classes'); - - // Make sure the current version is 0 - $this->assertEqual($migration->getCurrentVersion(), 0); - - // migrate to version latest version - $migration->migrate($migration->getLatestVersion()); - // Make sure the current version is latest version - $this->assertEqual($migration->getCurrentVersion(), $migration->getLatestVersion()); - - // now migrate back to original version - $migration->migrate(0); - - // Make sure the current version is 0 - $this->assertEqual($migration->getCurrentVersion(), 0); - } else { - $this->fail('server does not exist.'); - } - } -} \ No newline at end of file diff --git a/tests_old/MigrationTestCase.php b/tests_old/MigrationTestCase.php deleted file mode 100644 index aa3c16c79..000000000 --- a/tests_old/MigrationTestCase.php +++ /dev/null @@ -1,54 +0,0 @@ -. - */ - -/** - * Doctrine_Migration_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Migration_TestCase extends Doctrine_UnitTestCase -{ - public function testMigration() - { - // New migration for the 'migration_classes' directory - $migration = new Doctrine_Migration('migration_classes'); - - // Make sure the current version is 0 - $this->assertEqual($migration->getCurrentVersion(), 0); - - // migrate to version latest version - $migration->migrate($migration->getLatestVersion()); - // Make sure the current version is latest version - $this->assertEqual($migration->getCurrentVersion(), $migration->getLatestVersion()); - - // now migrate back to original version - $migration->migrate(0); - - // Make sure the current version is 0 - $this->assertEqual($migration->getCurrentVersion(), 0); - } -} \ No newline at end of file diff --git a/tests_old/NestedSet/LoadInSetUpTestCase.php b/tests_old/NestedSet/LoadInSetUpTestCase.php deleted file mode 100644 index acd9228d5..000000000 --- a/tests_old/NestedSet/LoadInSetUpTestCase.php +++ /dev/null @@ -1,57 +0,0 @@ -. - */ - -/** - * Doctrine_NestedSet_LoadInSetUp_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_NestedSet_LoadInSetUp_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = 'CategoryNestedSet'; - parent::prepareTables(); - } - - public function testNestedSet() - { - $category = new CategoryNestedSet(); - - if ( ! $category->getTable()->hasColumn('lft')) { - $this->fail(); - } - - if ( ! $category->getTable()->hasColumn('rgt')) { - $this->fail(); - } - - if ( ! $category->getTable()->hasColumn('level')) { - $this->fail(); - } - } -} \ No newline at end of file diff --git a/tests_old/NestedSet/SingleRootTestCase.php b/tests_old/NestedSet/SingleRootTestCase.php deleted file mode 100644 index d763f8bef..000000000 --- a/tests_old/NestedSet/SingleRootTestCase.php +++ /dev/null @@ -1,94 +0,0 @@ -. - */ - -/** - * Doctrine_Record_State_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_NestedSet_SingleRoot_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = 'NestedSetTest_SingleRootNode'; - parent::prepareTables(); - } - - public function prepareData() - { - $node = new NestedSetTest_SingleRootNode(); - $node->name = 'root'; - $treeMngr = $this->conn->getMapper('NestedSetTest_SingleRootNode')->getTree(); - $treeMngr->createRoot($node); - - $node2 = new NestedSetTest_SingleRootNode(); - $node2->name = 'node2'; - $node2->getNode()->insertAsLastChildOf($node); - - $node3 = new NestedSetTest_SingleRootNode(); - $node3->name = 'node3'; - $node3->getNode()->insertAsLastChildOf($node2); - } - - public function testLftRgtValues() - { - $treeMngr = $this->conn->getMapper('NestedSetTest_SingleRootNode')->getTree(); - $root = $treeMngr->fetchRoot(); - $this->assertEqual(1, $root['lft']); - $this->assertEqual(6, $root['rgt']); - } - - public function testGetDescendants() - { - $treeMngr = $this->conn->getMapper('NestedSetTest_SingleRootNode')->getTree(); - $root = $treeMngr->fetchRoot(); - $desc = $root->getNode()->getDescendants(); - $this->assertTrue($desc !== false); - $this->assertEqual(2, count($desc)); - $this->assertEqual('node2', $desc[0]['name']); - $this->assertEqual(1, $desc[0]['level']); - } - - public function testGetNumberChildren() - { - $treeMngr = $this->conn->getMapper('NestedSetTest_SingleRootNode')->getTree(); - $root = $treeMngr->fetchRoot(); - $this->assertEqual(1, $root->getNode()->getNumberChildren()); - } - - public function testGetAncestors() - { - $node = $this->conn->query("SELECT n.* FROM NestedSetTest_SingleRootNode n WHERE n.name = ?", - array('node2'))->getFirst(); - $anc = $node->getNode()->getAncestors(); - $this->assertTrue($anc !== false); - $this->assertEqual(1, count($anc)); - $this->assertEqual('root', $anc[0]['name']); - $this->assertEqual(0, $anc[0]['level']); - } - -} diff --git a/tests_old/NewCoreTestCase.php b/tests_old/NewCoreTestCase.php deleted file mode 100644 index 926baf9e4..000000000 --- a/tests_old/NewCoreTestCase.php +++ /dev/null @@ -1,48 +0,0 @@ -. - */ - -/** - * Doctrine_NewCore_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_NewCore_TestCase extends Doctrine_UnitTestCase -{ - public function testFromParser() - { - $q = new Doctrine_Query(); - - $q->load('User u', true); - - $this->assertEqual($q->getQueryPart('from'), array('entity e')); - $this->assertEqual(count($q->getAliasMap()), 1); - - $q->load('u.Phonenumber p', false); - - $this->assertEqual($q->getQueryPart('from'), array('entity e', 'p' => 'LEFT JOIN phonenumber p ON e.id = p.entity_id')); - } -} diff --git a/tests_old/OneTableOneClassInheritanceTestCase.php b/tests_old/OneTableOneClassInheritanceTestCase.php deleted file mode 100644 index c1da7386c..000000000 --- a/tests_old/OneTableOneClassInheritanceTestCase.php +++ /dev/null @@ -1,46 +0,0 @@ -. - */ - -/** - * Doctrine_OneTableOneClassInheritance_TestCase - * - * @package Doctrine - * @author Bjarte Stien Karlsen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_OneTableOneClassInheritance_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - public function testTableExporting() - { - $sql = $this->conn->export->exportClassesSql(array('ConcreteInheritanceTestParent', - 'ConcreteInheritanceTestChild')); - $this->assertEqual($sql[0], 'CREATE TABLE concrete_inheritance_test_parent (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(2147483647))'); - $this->assertEqual($sql[1], 'CREATE TABLE concrete_inheritance_test_child (id INTEGER PRIMARY KEY AUTOINCREMENT, age INTEGER, name VARCHAR(2147483647))'); - } -} diff --git a/tests_old/ParserTestCase.php b/tests_old/ParserTestCase.php deleted file mode 100644 index 009ba3516..000000000 --- a/tests_old/ParserTestCase.php +++ /dev/null @@ -1,99 +0,0 @@ -. - */ - -/** - * Doctrine_Parser_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Parser_TestCase extends Doctrine_UnitTestCase -{ - public function testGetParserInstance() - { - $instance = Doctrine_Parser::getParser('Yml'); - - if ($instance instanceof Doctrine_Parser_Yml) { - $this->pass(); - } else { - $this->fail(); - } - } - - public function testFacadeLoadAndDump() - { - Doctrine_Parser::dump(array('test' => 'good job', 'test2' => true, array('testing' => false)), 'yml', 'test.yml'); - $array = Doctrine_Parser::load('test.yml', 'yml'); - - $this->assertEqual($array, array('test' => 'good job', 'test2' => true, array('testing' => false))); - } - - public function testParserSupportsEmbeddingPhpSyntax() - { - $parser = Doctrine_Parser::getParser('Yml'); - $yml = "--- -test: good job -test2: true -testing: -w00t: not now -"; - $data = $parser->doLoad($yml); - - $array = $parser->loadData($data); - - $this->assertEqual($array, array('test' => 'good job', 'test2' => true, 'testing' => false, 'w00t' => 'not now')); - } - - public function testParserWritingToDisk() - { - $parser = Doctrine_Parser::getParser('Yml'); - $parser->doDump('test', 'test.yml'); - - $this->assertEqual('test', file_get_contents('test.yml')); - } - - public function testParserReturningLoadedData() - { - $parser = Doctrine_Parser::getParser('Yml'); - $result = $parser->doDump('test'); - - $this->assertEqual('test', $result); - } - - public function testLoadFromString() - { - $yml = "--- -test: good job -test2: true -testing: -w00t: not now -"; - - $array = Doctrine_Parser::load($yml, 'yml'); - - $this->assertEqual($array, array('test' => 'good job', 'test2' => true, 'testing' => false, 'w00t' => 'not now')); - } -} diff --git a/tests_old/PessimisticLockingTestCase.php b/tests_old/PessimisticLockingTestCase.php deleted file mode 100644 index 1c8c59a7f..000000000 --- a/tests_old/PessimisticLockingTestCase.php +++ /dev/null @@ -1,112 +0,0 @@ -. - */ - -/** - * Doctrine_Boolean_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_PessimisticLocking_TestCase extends Doctrine_UnitTestCase { - private $lockingManager; - - /** - * Sets up everything for the lock testing - * - * Creates a locking manager and a test record to work with. - */ - public function testInitData() { - $this->lockingManager = new Doctrine_Locking_Manager_Pessimistic($this->connection); - - // Create sample data to test on - $entry1 = new Forum_Entry(); - $entry1->author = 'Bart Simpson'; - $entry1->topic = 'I love donuts!'; - $entry1->save(); - } - - /** - * Tests the basic locking mechanism - * - * Currently tested: successful lock, failed lock, release lock - */ - public function testLock() { - $entries = $this->connection->query("FROM Forum_Entry WHERE Forum_Entry.author = 'Bart Simpson'"); - - // Test successful lock - $gotLock = $this->lockingManager->getLock($entries[0], 'romanb'); - $this->assertTrue($gotLock); - - // Test failed lock (another user already got a lock on the entry) - $gotLock = $this->lockingManager->getLock($entries[0], 'konstav'); - $this->assertFalse($gotLock); - - // Test release lock - $released = $this->lockingManager->releaseLock($entries[0], 'romanb'); - $this->assertTrue($released); - } - - /** - * Tests the release mechanism of aged locks - * This test implicitly tests getLock(). - */ - public function testReleaseAgedLocks() { - $entries = $this->connection->query("FROM Forum_Entry WHERE Forum_Entry.author = 'Bart Simpson'"); - $this->lockingManager->getLock($entries[0], 'romanb'); - $released = $this->lockingManager->releaseAgedLocks(-1); // age -1 seconds => release all - $this->assertEqual(1, $released); - - // A second call should return false (no locks left) - $released = $this->lockingManager->releaseAgedLocks(-1); - $this->assertEqual(0, $released); - - // Test with further parameters - $this->lockingManager->getLock($entries[0], 'romanb'); - $released = $this->lockingManager->releaseAgedLocks(-1, 'User'); // shouldnt release anything - $this->assertEqual(0, $released); - $released = $this->lockingManager->releaseAgedLocks(-1, 'Forum_Entry'); // should release the lock - $this->assertEqual(1, $released); - - $this->lockingManager->getLock($entries[0], 'romanb'); - $released = $this->lockingManager->releaseAgedLocks(-1, 'Forum_Entry', 'zyne'); // shouldnt release anything - $this->assertEqual(0, $released); - $released = $this->lockingManager->releaseAgedLocks(-1, 'Forum_Entry', 'romanb'); // should release the lock - $this->assertEqual(1, $released); - } - - /** - * Tests the retrieving of a lock's owner. - * This test implicitly tests getLock(). - * - * @param Doctrine_Entity $lockedRecord - */ - public function testGetLockOwner() { - $entries = $this->connection->query("FROM Forum_Entry WHERE Forum_Entry.author = 'Bart Simpson'"); - $gotLock = $this->lockingManager->getLock($entries[0], 'romanb'); - $this->assertEqual('romanb', $this->lockingManager->getLockOwner($entries[0])); - } -} - diff --git a/tests_old/PluginTestCase.php b/tests_old/PluginTestCase.php deleted file mode 100644 index 7a58041c1..000000000 --- a/tests_old/PluginTestCase.php +++ /dev/null @@ -1,115 +0,0 @@ -. - */ - -/** - * Doctrine_Plugin_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Plugin_TestCase extends Doctrine_UnitTestCase -{ - - public function prepareData() - { } - - public function prepareTables() - { } - - public function testNestedPluginsGetExportedRecursively() - { - - - $sql = $this->conn->export->exportClassesSql(array('Wiki')); - - $this->assertEqual($sql[0], 'CREATE TABLE wiki_translation_version (title VARCHAR(255), content VARCHAR(2147483647), lang CHAR(2), id INTEGER, version INTEGER, PRIMARY KEY(lang, id, version))'); - $this->assertEqual($sql[1], 'CREATE TABLE wiki_translation_index (keyword VARCHAR(200), field VARCHAR(50), position INTEGER, lang CHAR(2), id INTEGER, PRIMARY KEY(keyword, field, position, lang, id))'); - $this->assertEqual($sql[2], 'CREATE TABLE wiki_translation (title VARCHAR(255), content VARCHAR(2147483647), lang CHAR(2), id INTEGER, version INTEGER, PRIMARY KEY(lang, id))'); - $this->assertEqual($sql[3], 'CREATE TABLE wiki (id INTEGER PRIMARY KEY AUTOINCREMENT, created_at DATETIME, updated_at DATETIME)'); - - foreach ($sql as $query) { - $this->conn->exec($query); - } - - } - - public function testCreatingNewRecordsInvokesAllPlugins() - { - $wiki = new Wiki(); - $wiki->state(Doctrine_Entity::STATE_TDIRTY); - $wiki->save(); - - $fi = $wiki->Translation['FI']; - $fi->title = 'Michael Jeffrey Jordan'; - $fi->content = "Michael Jeffrey Jordan (s. 17. helmikuuta 1963, Brooklyn, New York) on yhdysvaltalainen entinen NBA-koripalloilija, jota pidetään yleisesti kaikkien aikojen parhaana pelaajana."; - - $fi->save(); - $this->assertEqual($fi->version, 1); - - $fi->title = 'Micheal Jordan'; - $fi->save(); - - $this->assertEqual($fi->version, 2); - } - - public function testSavingUnmodifiedRecordsDoesNotInvokeTimestampableListener() - { - $this->conn->clear(); - - $wiki = Doctrine_Query::create()->from('Wiki w')->where('w.id = 1')->fetchOne(); - - $wiki->save(); - - $this->assertEqual($wiki->Translation['FI']->version, 2); - } -} -class Wiki extends Doctrine_Entity -{ - public function setTableDefinition() - { - $this->hasColumn('title', 'string', 255); - $this->hasColumn('content', 'string'); - } - - public function setUp() - { - $options = array('fields' => array('title', 'content')); - $auditLog = new Doctrine_Template_Versionable($options); - $search = new Doctrine_Template_Searchable($options); - $slug = new Doctrine_Template_Sluggable($options); - $i18n = new Doctrine_Template_I18n($options); - - - $i18n->addChild($auditLog) - ->addChild($search) - ->addChild($slug); - - $this->actAs($i18n); - - $this->actAs('Timestampable'); - - } -} diff --git a/tests_old/Query/AggregateValueTestCase.php b/tests_old/Query/AggregateValueTestCase.php deleted file mode 100644 index d52807800..000000000 --- a/tests_old/Query/AggregateValueTestCase.php +++ /dev/null @@ -1,222 +0,0 @@ -. - */ - -/** - * Doctrine_Query_AggregateValue_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_AggregateValue_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() { - $this->tables = array('User', 'Phonenumber', 'QueryTest_Item'); - parent::prepareTables(); - } - - public function prepareData() {} - - public function testInitData() - { - $users = new Doctrine_Collection('User'); - - $users[0]->name = 'John'; - $users[0]->Phonenumber[0]->phonenumber = '123 123'; - $users[0]->Phonenumber[1]->phonenumber = '222 222'; - $users[0]->Phonenumber[2]->phonenumber = '333 333'; - - $users[1]->name = 'John'; - $users[2]->name = 'James'; - $users[2]->Phonenumber[0]->phonenumber = '222 344'; - $users[2]->Phonenumber[1]->phonenumber = '222 344'; - $users[3]->name = 'James'; - $users[3]->Phonenumber[0]->phonenumber = '123 123'; - - $users->save(); - } - - public function testRecordSupportsValueMapping() - { - $record = new User(); - - try { - $record->get('count'); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - - $record->mapValue('count', 3); - - try { - $i = $record->get('count'); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertEqual($i, 3); - } - - public function testAggregateValueIsMappedToNewRecordOnEmptyResultSet() - { - $this->connection->clear(); - - $q = new Doctrine_Query(); - - $q->select('COUNT(u.id) count')->from('User u'); - $this->assertEqual($q->getSql(), "SELECT COUNT(e.id) AS e__0 FROM entity e WHERE (e.type = 0)"); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 1); - - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_TCLEAN); - } - - public function testAggregateValueIsMappedToRecord() - { - $q = new Doctrine_Query(); - - $q->select('u.name, COUNT(u.id) count')->from('User u')->groupby('u.name'); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 2); - - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_PROXY); - $this->assertEqual($users[1]->state(), Doctrine_Entity::STATE_PROXY); - - $this->assertEqual($users[0]->count, 2); - $this->assertEqual($users[1]->count, 2); - } - - public function testAggregateOrder() - { - $q = new Doctrine_Query(); - - $q->select('u.name, COUNT(u.id) count')->from('User u')->groupby('u.name')->orderby('count'); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 2); - - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_PROXY); - $this->assertEqual($users[1]->state(), Doctrine_Entity::STATE_PROXY); - - $this->assertEqual($users[0]->count, 2); - $this->assertEqual($users[1]->count, 2); - } - - public function testAggregateValueMappingSupportsLeftJoins() - { - $q = new Doctrine_Query(); - - $q->select('u.name, COUNT(p.id) count')->from('User u')->leftJoin('u.Phonenumber p')->groupby('u.id'); - - $users = $q->execute(); - - $this->assertEqual(count($users), 4); - - $this->assertEqual($users[0]['Phonenumber'][0]['count'], 3); - $this->assertEqual($users[1]['Phonenumber'][0]['count'], 0); - $this->assertEqual($users[2]['Phonenumber'][0]['count'], 2); - $this->assertEqual($users[3]['Phonenumber'][0]['count'], 1); - } - - public function testAggregateValueMappingSupportsLeftJoins2() - { - $q = new Doctrine_Query(); - - $q->select('MAX(u.name)')->from('User u')->leftJoin('u.Phonenumber p')->groupby('u.id'); - - $this->assertEqual($q->getQuery(), 'SELECT MAX(e.name) AS e__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id'); - $users = $q->execute(); - - $this->assertEqual($users->count(), 4); - } - - public function testAggregateValueMappingSupportsMultipleValues() - { - $q = new Doctrine_Query(); - - $q->select('u.name, COUNT(p.id) count, MAX(p.id) max')->from('User u')->innerJoin('u.Phonenumber p')->groupby('u.id'); - - $users = $q->execute(); - $this->assertEqual($users[0]->Phonenumber[0]->max, 3); - $this->assertEqual($users[0]->Phonenumber[0]->count, 3); - } - public function testAggregateValueMappingSupportsInnerJoins() - { - $q = new Doctrine_Query(); - - $q->select('u.name, COUNT(p.id) count')->from('User u')->innerJoin('u.Phonenumber p')->groupby('u.id'); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 3); - - $this->assertEqual($users[0]->Phonenumber[0]->count, 3); - $this->assertEqual($users[1]->Phonenumber[0]->count, 2); - $this->assertEqual($users[2]->Phonenumber[0]->count, 1); - } - public function testAggregateFunctionParser() - { - $q = new Doctrine_Query(); - $func = $q->from('QueryTest_Item i')->parseFunctionExpression('SUM(i.price)'); - - $this->assertEqual($func, 'SUM(i.price)'); - } - public function testAggregateFunctionParser2() - { - $q = new Doctrine_Query(); - $func = $q->from('QueryTest_Item i')->parseFunctionExpression('SUM(i.price * i.quantity)'); - - $this->assertEqual($func, 'SUM(i.price * i.quantity)'); - } - public function testAggregateFunctionParser3() - { - $q = new Doctrine_Query(); - $func = $q->from('QueryTest_Item i')->parseFunctionExpression('MOD(i.price, i.quantity)'); - - $this->assertEqual($func, 'MOD(i.price, i.quantity)'); - } - public function testAggregateFunctionParser4() - { - $q = new Doctrine_Query(); - $func = $q->from('QueryTest_Item i')->parseFunctionExpression('CONCAT(i.price, i.quantity)'); - - $this->assertEqual($func, 'CONCAT(i.price, i.quantity)'); - } - public function testAggregateFunctionParsingSupportsMultipleComponentReferences() - { - $q = new Doctrine_Query(); - $q->select('SUM(i.price * i.quantity)') - ->from('QueryTest_Item i'); - - $this->assertEqual($q->getQuery(), "SELECT SUM(q.price * q.quantity) AS q__0 FROM query_test__item q"); - } - - -} diff --git a/tests_old/Query/ApplyInheritanceTestCase.php b/tests_old/Query/ApplyInheritanceTestCase.php deleted file mode 100644 index a3071e757..000000000 --- a/tests_old/Query/ApplyInheritanceTestCase.php +++ /dev/null @@ -1,57 +0,0 @@ -. - */ - -/** - * Doctrine_Query_ApplyInheritance_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_ApplyInheritance_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { - - } - - public function prepareTables() - { - $this->tables = array('InheritanceDeal', 'InheritanceEntityUser', 'InheritanceUser'); - - parent::prepareTables(); - } - - public function testApplyInheritance() - { - $query = new Doctrine_Query(); - $query->from('InheritanceDeal deal, deal.Users usrs'); - $query->where('usrs.id = 1'); - - $sql = 'SELECT i.id AS i__id, i.name AS i__name, i2.id AS i2__id, i2.username AS i2__username FROM inheritance_deal i LEFT JOIN inheritance_entity_user i3 ON i.id = i3.entity_id LEFT JOIN inheritance_user i2 ON i2.id = i3.user_id WHERE i2.id = 1 AND (i3.type = 1 OR i3.type IS NULL)'; - - $this->assertEqual($sql, $query->getSql()); - } -} diff --git a/tests_old/Query/CacheTestCase.php b/tests_old/Query/CacheTestCase.php deleted file mode 100644 index 126b7e114..000000000 --- a/tests_old/Query/CacheTestCase.php +++ /dev/null @@ -1,151 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Cache_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Cache_TestCase extends Doctrine_UnitTestCase -{ - - public function testQueryCacheAddsQueryIntoCache() - { - $cache = new Doctrine_Cache_Array(); - $q = new Doctrine_Query(); - $q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p')->where('u.name = ?', 'walhala') - ->useQueryCache($cache); - - $coll = $q->execute(); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 0); - - $coll = $q->execute(); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 0); - } - - public function testQueryCacheWorksWithGlobalConfiguration() - { - $cache = new Doctrine_Cache_Array(); - Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cache); - - $q = new Doctrine_Query(); - $q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p'); - - $coll = $q->execute(); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 8); - - $coll = $q->execute(); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 8); - } - - public function testResultSetCacheAddsResultSetsIntoCache() - { - $q = new Doctrine_Query(); - - $cache = new Doctrine_Cache_Array(); - $q->useCache($cache)->select('u.name')->from('User u'); - $coll = $q->execute(); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 8); - - $coll = $q->execute(); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 8); - } - - public function testResultSetCacheSupportsQueriesWithJoins() - { - $q = new Doctrine_Query(); - - $cache = new Doctrine_Cache_Array(); - $q->useCache($cache); - $q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p'); - $coll = $q->execute(); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 8); - - $coll = $q->execute(); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 8); - } - - public function testResultSetCacheSupportsPreparedStatements() - { - $q = new Doctrine_Query(); - - $cache = new Doctrine_Cache_Array(); - $q->useCache($cache); - $q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p') - ->where('u.id = ?'); - - $coll = $q->execute(array(5)); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 1); - - $coll = $q->execute(array(5)); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 1); - } - - public function testUseCacheSupportsBooleanTrueAsParameter() - { - $q = new Doctrine_Query(); - - $cache = new Doctrine_Cache_Array(); - $this->conn->setAttribute(Doctrine::ATTR_CACHE, $cache); - - $q->useCache(true); - $q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p') - ->where('u.id = ?'); - - $coll = $q->execute(array(5)); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 1); - - $coll = $q->execute(array(5)); - - $this->assertEqual($cache->count(), 1); - $this->assertEqual(count($coll), 1); - - $this->conn->setAttribute(Doctrine::ATTR_CACHE, null); - } -} diff --git a/tests_old/Query/CheckTestCase.php b/tests_old/Query/CheckTestCase.php deleted file mode 100644 index c5302e88c..000000000 --- a/tests_old/Query/CheckTestCase.php +++ /dev/null @@ -1,69 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Check_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Check_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - public function testCheckParserSupportsStandardFunctions() - { - $q = new Doctrine_Query_Check('User'); - - $q->parse('LENGTH(name) > 6'); - - $this->assertEqual($q->getSql(), 'LENGTH(name) > 6'); - } - public function testCheckParserThrowsExceptionForUnknownOperator() - { - $q = new Doctrine_Query_Check('User'); - - try { - $q->parse('LENGTH(name) ? 6'); - $this->fail(); - } catch(Doctrine_Query_Exception $e) { - $this->pass(); - } - } - public function testCheckParserThrowsExceptionForUnknownFunction() - { - $q = new Doctrine_Query_Check('User'); - - try { - $q->parse('SomeUnknownFunction(name) = 6'); - $this->fail(); - } catch(Doctrine_Exception $e) { - $this->pass(); - } - } -} diff --git a/tests_old/Query/ComponentAliasTestCase.php b/tests_old/Query/ComponentAliasTestCase.php deleted file mode 100644 index a352c34cd..000000000 --- a/tests_old/Query/ComponentAliasTestCase.php +++ /dev/null @@ -1,123 +0,0 @@ -. - */ - -/** - * Doctrine_Query_ComponentAlias_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_ComponentAlias_TestCase extends Doctrine_UnitTestCase -{ - - public function testQueryWithSingleAlias() - { - $this->connection->clear(); - $q = new Doctrine_Query(); - - $q->from('User u, u.Phonenumber'); - - $users = $q->execute(); - - $count = count($this->conn); - - $this->assertEqual($users->count(), 8); - $this->assertTrue($users[0]->Phonenumber instanceof Doctrine_Collection); - $this->assertEqual($q->getQuery(), - "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)"); - $this->assertEqual($count, count($this->conn)); - } - - public function testQueryWithNestedAliases() - { - $this->connection->clear(); - $q = new Doctrine_Query(); - - $q->from('User u, u.Group g, g.Phonenumber'); - - $users = $q->execute(); - - $count = count($this->conn); - - $this->assertEqual($users->count(), 8); - $this->assertTrue($users[0]->Phonenumber instanceof Doctrine_Collection); - $this->assertEqual($q->getQuery(), - "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, e2.id AS e2__id, e2.name AS e2__name, e2.loginname AS e2__loginname, e2.password AS e2__password, e2.type AS e2__type, e2.created AS e2__created, e2.updated AS e2__updated, e2.email_id AS e2__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id LEFT JOIN phonenumber p ON e2.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - $this->assertEqual(($count + 1), count($this->conn)); - } - public function testQueryWithNestedAliasesAndArrayFetching() - { - $this->connection->clear(); - $q = new Doctrine_Query(); - - $q->from('User u, u.Group g, g.Phonenumber'); - - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $count = count($this->conn); - - $this->assertEqual(count($users), 8); - $this->assertEqual(count($users[7]['Group']), 0); - $this->assertEqual(count($users[1]['Group']), 1); - } - - public function testQueryWithMultipleNestedAliases() - { - $this->connection->clear(); - $q = new Doctrine_Query(); - - $q->from('User u, u.Phonenumber, u.Group g, g.Phonenumber')->where('u.id IN (5,6)'); - - $users = $q->execute(); - - $count = count($this->conn); - - - $this->assertTrue($users[0]->Phonenumber instanceof Doctrine_Collection); - $this->assertEqual($q->getQuery(), - "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id, e2.id AS e2__id, e2.name AS e2__name, e2.loginname AS e2__loginname, e2.password AS e2__password, e2.type AS e2__type, e2.created AS e2__created, e2.updated AS e2__updated, e2.email_id AS e2__email_id, p2.id AS p2__id, p2.phonenumber AS p2__phonenumber, p2.entity_id AS p2__entity_id FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id LEFT JOIN phonenumber p2 ON e2.id = p2.entity_id WHERE e.id IN (5, 6) AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - $this->assertEqual(count($users), 2); - $this->assertEqual(count($users[0]['Group']), 1); - $this->assertEqual(count($users[0]['Group'][0]['Phonenumber']), 1); - $this->assertEqual(count($users[1]['Group']), 0); - - $this->assertEqual($count, count($this->conn)); - } - - public function testQueryWithMultipleNestedAliasesAndArrayFetching() - { - $q = new Doctrine_Query(); - $q->from('User u, u.Phonenumber, u.Group g, g.Phonenumber')->where('u.id IN (5,6)'); - - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertEqual(count($users), 2); - $this->assertEqual(count($users[0]['Group']), 1); - $this->assertEqual(count($users[0]['Group'][0]['Phonenumber']), 1); - $this->assertEqual(count($users[1]['Group']), 0); - } - -} diff --git a/tests_old/Query/ConditionTestCase.php b/tests_old/Query/ConditionTestCase.php deleted file mode 100644 index d24da4cfe..000000000 --- a/tests_old/Query/ConditionTestCase.php +++ /dev/null @@ -1,122 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Condition_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Condition_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() { } - public function prepareTables() { } - - /** @todo belongs in TokenizerTestCase? */ - public function testBracktExplode() - { - $tokenizer = new Doctrine_Query_Tokenizer(); - $str = "item OR item || item"; - $parts = $tokenizer->bracketExplode($str, array(' \|\| ', ' OR '), "(", ")"); - - $this->assertEqual($parts, array('item','item','item')); - - } - public function testConditionParser() - { - $query = new Doctrine_Query($this->connection); - - $query->select('User.id')->from("User")->where("User.name LIKE 'z%' || User.name LIKE 's%'"); - - $sql = "SELECT e.id AS e__id FROM entity e WHERE (e.name LIKE 'z%' OR e.name LIKE 's%') AND (e.type = 0)"; - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(User.name LIKE 'z%') || (User.name LIKE 's%')"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("((User.name LIKE 'z%') || (User.name LIKE 's%'))"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(((User.name LIKE 'z%') || (User.name LIKE 's%')))"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(((User.name LIKE 'z%') || User.name LIKE 's%'))"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(User.name LIKE 'z%') || User.name LIKE 's%' && User.name LIKE 'a%'"); - - $sql = "SELECT e.id AS e__id FROM entity e WHERE ((e.name LIKE 'z%' OR e.name LIKE 's%') AND e.name LIKE 'a%') AND (e.type = 0)"; - - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(((User.name LIKE 'z%') || User.name LIKE 's%')) && User.name LIKE 'a%'"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("((((User.name LIKE 'z%') || User.name LIKE 's%')) && User.name LIKE 'a%')"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(((((User.name LIKE 'z%') || User.name LIKE 's%')) && User.name LIKE 'a%'))"); - $this->assertEqual($query->getQuery(), $sql); - - } - - public function testConditionParser2() - { - $query = new Doctrine_Query($this->connection); - - $query->select('User.id')->from("User")->where("User.name LIKE 'z%' || User.name LIKE 's%'"); - - $sql = "SELECT e.id AS e__id FROM entity e WHERE (e.name LIKE 'z%' OR e.name LIKE 's%') AND (e.type = 0)"; - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(User.name LIKE 'z%') OR (User.name LIKE 's%')"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("((User.name LIKE 'z%') OR (User.name LIKE 's%'))"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(((User.name LIKE 'z%') OR (User.name LIKE 's%')))"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(((User.name LIKE 'z%') OR User.name LIKE 's%'))"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(User.name LIKE 'z%') OR User.name LIKE 's%' AND User.name LIKE 'a%'"); - - $sql = "SELECT e.id AS e__id FROM entity e WHERE ((e.name LIKE 'z%' OR e.name LIKE 's%') AND e.name LIKE 'a%') AND (e.type = 0)"; - - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(((User.name LIKE 'z%') OR User.name LIKE 's%')) AND User.name LIKE 'a%'"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("((((User.name LIKE 'z%') OR User.name LIKE 's%')) AND User.name LIKE 'a%')"); - $this->assertEqual($query->getQuery(), $sql); - - $query->where("(((((User.name LIKE 'z%') OR User.name LIKE 's%')) AND User.name LIKE 'a%'))"); - $this->assertEqual($query->getQuery(), $sql); - } -} diff --git a/tests_old/Query/DeleteTestCase.php b/tests_old/Query/DeleteTestCase.php deleted file mode 100644 index 53f30001a..000000000 --- a/tests_old/Query/DeleteTestCase.php +++ /dev/null @@ -1,106 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Delete_TestCase - * This test case is used for testing DQL DELETE queries - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Delete_TestCase extends Doctrine_UnitTestCase -{ - public function testDeleteAllWithColumnAggregationInheritance() - { - $q = new Doctrine_Query(); - - $q->parseQuery('DELETE FROM User'); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE (type = 0)'); - - $q = new Doctrine_Query(); - - $q->delete()->from('User'); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE (type = 0)'); - } - public function testDeleteAll() - { - $q = new Doctrine_Query(); - - $q->parseQuery('DELETE FROM Entity'); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE (type = 2 OR type = 1 OR type = 0)'); - - $q = new Doctrine_Query(); - - $q->delete()->from('Entity'); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE (type = 2 OR type = 1 OR type = 0)'); - } - public function testDeleteWithCondition() - { - $q = new Doctrine_Query(); - - $q->parseQuery('DELETE FROM Entity WHERE id = 3'); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE id = 3 AND (type = 2 OR type = 1 OR type = 0)'); - - $q = new Doctrine_Query(); - - $q->delete()->from('Entity')->where('id = 3'); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE id = 3 AND (type = 2 OR type = 1 OR type = 0)'); - } - public function testDeleteWithLimit() - { - $q = new Doctrine_Query(); - - $q->parseQuery('DELETE FROM Entity LIMIT 20'); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE (type = 2 OR type = 1 OR type = 0) LIMIT 20'); - - $q = new Doctrine_Query(); - - $q->delete()->from('Entity')->limit(20); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE (type = 2 OR type = 1 OR type = 0) LIMIT 20'); - } - public function testDeleteWithLimitAndOffset() - { - $q = new Doctrine_Query(); - - $q->parseQuery('DELETE FROM Entity LIMIT 10 OFFSET 20'); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE (type = 2 OR type = 1 OR type = 0) LIMIT 10 OFFSET 20'); - - $q = new Doctrine_Query(); - - $q->delete()->from('Entity')->limit(10)->offset(20); - - $this->assertEqual($q->getQuery(), 'DELETE FROM entity WHERE (type = 2 OR type = 1 OR type = 0) LIMIT 10 OFFSET 20'); - } -} diff --git a/tests_old/Query/DriverTestCase.php b/tests_old/Query/DriverTestCase.php deleted file mode 100644 index 6fc7f2e55..000000000 --- a/tests_old/Query/DriverTestCase.php +++ /dev/null @@ -1,104 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Driver_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Driver_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - - public function testLimitQueriesForPgsql() - { - $this->dbh = new Doctrine_Adapter_Mock('pgsql'); - - $conn = $this->manager->openConnection($this->dbh); - - $q = new Doctrine_Query($conn); - - $q->from('User u')->limit(5); - - $this->assertEqual($q->getSql(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE (e.type = 0) LIMIT 5'); - } - - public function testLimitQueriesForSqlite() - { - $this->dbh = new Doctrine_Adapter_Mock('sqlite'); - - $conn = $this->manager->openConnection($this->dbh); - - $q = new Doctrine_Query($conn); - - $q->from('User u')->limit(5); - - $this->assertEqual($q->getSql(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE (e.type = 0) LIMIT 5'); - } - - public function testLimitQueriesForMysql() - { - $this->dbh = new Doctrine_Adapter_Mock('mysql'); - - $conn = $this->manager->openConnection($this->dbh); - - $q = new Doctrine_Query($conn); - - $q->from('User u')->limit(5); - - $this->assertEqual($q->getSql(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE (e.type = 0) LIMIT 5'); - } - - public function testLimitQueriesForOracle() - { - $this->dbh = new Doctrine_Adapter_Mock('oracle'); - - $conn = $this->manager->openConnection($this->dbh); - - $q = new Doctrine_Query($conn); - - $q->from('User u')->limit(5); - - $this->assertEqual($q->getSql(), 'SELECT a.* FROM (SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE (e.type = 0)) a WHERE ROWNUM <= 5'); - } - - public function testLimitOffsetQueriesForOracle() - { - $this->dbh = new Doctrine_Adapter_Mock('oracle'); - - $conn = $this->manager->openConnection($this->dbh); - - $q = new Doctrine_Query($conn); - - $q->from('User u')->limit(5)->offset(2); - - $this->assertEqual($q->getSql(), 'SELECT * FROM (SELECT a.*, ROWNUM dctrn_rownum FROM (SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE (e.type = 0)) a WHERE ROWNUM <= 7) WHERE dctrn_rownum >= 3'); - } -} diff --git a/tests_old/Query/ExpressionTestCase.php b/tests_old/Query/ExpressionTestCase.php deleted file mode 100644 index 6df16654c..000000000 --- a/tests_old/Query/ExpressionTestCase.php +++ /dev/null @@ -1,113 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Expression_TestCase - * - * @package Doctrine - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @author Konsta Vesterinen - * @version $Revision$ - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - */ -class Doctrine_Query_Expression_TestCase extends Doctrine_UnitTestCase -{ - - public function testUnknownExpressionInSelectClauseThrowsException() - { - $q = new Doctrine_Query(); - - try { - $q->parseQuery('SELECT SOMEUNKNOWNFUNC(u.name, " ", u.loginname) FROM User u'); - - $q->getQuery(); - $this->fail(); - } catch(Doctrine_Query_Exception $e) { - $this->pass(); - } - } - - public function testUnknownColumnWithinFunctionInSelectClauseThrowsException() - { - $q = new Doctrine_Query(); - - try { - $q->parseQuery('SELECT CONCAT(u.name, u.unknown) FROM User u'); - - $q->execute(); - $this->fail(); - } catch(Doctrine_Query_Exception $e) { - $this->pass(); - } - } - - public function testConcatIsSupportedInSelectClause() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT CONCAT(u.name, u.loginname) FROM User u'); - - $this->assertEqual($q->getQuery(), 'SELECT e.name || e.loginname AS e__0 FROM entity e WHERE (e.type = 0)'); - } - - public function testConcatInSelectClauseSupportsLiteralStrings() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT CONCAT(u.name, 'The Man') FROM User u"); - - $this->assertEqual($q->getQuery(), "SELECT e.name || 'The Man' AS e__0 FROM entity e WHERE (e.type = 0)"); - } - - public function testConcatInSelectClauseSupportsMoreThanTwoArgs() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT CONCAT(u.name, 'The Man', u.loginname) FROM User u"); - - $this->assertEqual($q->getQuery(), "SELECT e.name || 'The Man' || e.loginname AS e__0 FROM entity e WHERE (e.type = 0)"); - } - - public function testNonPortableFunctionsAreSupported() - { - $query = new Doctrine_Query(); - // we are using stored procedure here, so adjust portability settings - $this->conn->setAttribute(Doctrine::ATTR_PORTABILITY, Doctrine::PORTABILITY_ALL ^ Doctrine::PORTABILITY_EXPR); - - $lat = '13.23'; - $lon = '33.23'; - $radius = '33'; - - $query->select("l.*, i18n.*, GeoDistKM(l.lat, l.lon, $lat, $lon) distance") - ->from('Location l, l.LocationI18n i18n') - ->where('l.id <> ? AND i18n.culture = ?', array(1, 'en')) - ->having("distance < $radius") - ->orderby('distance ASC') - ->groupby('l.id') - ->limit(5); - - $this->assertEqual($query->getSql(), "SELECT l.id AS l__id, l.lat AS l__lat, l.lon AS l__lon, l2.name AS l2__name, l2.id AS l2__id, l2.culture AS l2__culture, GeoDistKM(l.lat, l.lon, 13.23, 33.23) AS l__0 FROM location l LEFT JOIN location_i18n l2 ON l.id = l2.id WHERE l.id IN (SELECT DISTINCT l3.id FROM location l3 LEFT JOIN location_i18n l4 ON l3.id = l4.id WHERE (l3.id <> ? AND l4.culture = ?) GROUP BY l3.id HAVING l__0 < 33 ORDER BY l__0 ASC LIMIT 5) AND (l.id <> ? AND l2.culture = ?) GROUP BY l.id HAVING l__0 < 33 ORDER BY l__0 ASC"); - - $this->conn->setAttribute(Doctrine::ATTR_PORTABILITY, Doctrine::PORTABILITY_ALL); - } -} diff --git a/tests_old/Query/FromTestCase.php b/tests_old/Query/FromTestCase.php deleted file mode 100644 index 75ca6287b..000000000 --- a/tests_old/Query/FromTestCase.php +++ /dev/null @@ -1,119 +0,0 @@ -. - */ - -/** - * Doctrine_Query_From_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function testCount() - { - $count = Doctrine_Query::create()->from('User')->count(); - - $this->assertEqual($count, 0); - } - public function testLeftJoin() - { - $q = new Doctrine_Query(); - - $q->from('User u LEFT JOIN u.Group'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, e2.id AS e2__id, e2.name AS e2__name, e2.loginname AS e2__loginname, e2.password AS e2__password, e2.type AS e2__type, e2.created AS e2__created, e2.updated AS e2__updated, e2.email_id AS e2__email_id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - - public function testDefaultJoinIsLeftJoin() - { - $q = new Doctrine_Query(); - - $q->from('User u JOIN u.Group'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, e2.id AS e2__id, e2.name AS e2__name, e2.loginname AS e2__loginname, e2.password AS e2__password, e2.type AS e2__type, e2.created AS e2__created, e2.updated AS e2__updated, e2.email_id AS e2__email_id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - - public function testInnerJoin() - { - $q = new Doctrine_Query(); - - $q->from('User u INNER JOIN u.Group'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, e2.id AS e2__id, e2.name AS e2__name, e2.loginname AS e2__loginname, e2.password AS e2__password, e2.type AS e2__type, e2.created AS e2__created, e2.updated AS e2__updated, e2.email_id AS e2__email_id FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - - public function testMultipleLeftJoin() - { - $q = new Doctrine_Query(); - - $q->from('User u LEFT JOIN u.Group LEFT JOIN u.Phonenumber'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, e2.id AS e2__id, e2.name AS e2__name, e2.loginname AS e2__loginname, e2.password AS e2__password, e2.type AS e2__type, e2.created AS e2__created, e2.updated AS e2__updated, e2.email_id AS e2__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - public function testMultipleLeftJoin2() - { - $q = new Doctrine_Query(); - - $q->from('User u LEFT JOIN u.Group LEFT JOIN u.Phonenumber'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, e2.id AS e2__id, e2.name AS e2__name, e2.loginname AS e2__loginname, e2.password AS e2__password, e2.type AS e2__type, e2.created AS e2__created, e2.updated AS e2__updated, e2.email_id AS e2__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - public function testMultipleInnerJoin() - { - $q = new Doctrine_Query(); - - $q->select('u.name')->from('User u INNER JOIN u.Group INNER JOIN u.Phonenumber'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id INNER JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - public function testMultipleInnerJoin2() - { - $q = new Doctrine_Query(); - - $q->select('u.name')->from('User u INNER JOIN u.Group, u.Phonenumber'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id INNER JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - public function testMixingOfJoins() - { - $q = new Doctrine_Query(); - - $q->select('u.name, g.name, p.phonenumber')->from('User u INNER JOIN u.Group g LEFT JOIN u.Phonenumber p'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e2.id AS e2__id, e2.name AS e2__name, p.id AS p__id, p.phonenumber AS p__phonenumber FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - public function testMixingOfJoins2() - { - $q = new Doctrine_Query(); - - $q->select('u.name, g.name, p.phonenumber')->from('User u INNER JOIN u.Group.Phonenumber p'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, p.id AS p__id, p.phonenumber AS p__phonenumber FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id LEFT JOIN phonenumber p ON e2.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } -} diff --git a/tests_old/Query/GroupbyTestCase.php b/tests_old/Query/GroupbyTestCase.php deleted file mode 100644 index a304d4a9f..000000000 --- a/tests_old/Query/GroupbyTestCase.php +++ /dev/null @@ -1,43 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Groupby_TestCase - * - * @package Doctrine - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @author Konsta Vesterinen - * @version $Revision$ - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - */ -class Doctrine_Query_Groupby_TestCase extends Doctrine_UnitTestCase -{ - public function testAggregateFunctionsInHavingReturnValidSql() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.name, COUNT(p.id) count FROM User u LEFT JOIN u.Phonenumber p GROUP BY count'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, COUNT(p.id) AS p__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY p__0'); - } -} diff --git a/tests_old/Query/HavingTestCase.php b/tests_old/Query/HavingTestCase.php deleted file mode 100644 index ca5f4dbb0..000000000 --- a/tests_old/Query/HavingTestCase.php +++ /dev/null @@ -1,75 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Having_TestCase - * - * @package Doctrine - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @author Konsta Vesterinen - * @version $Revision$ - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - */ -class Doctrine_Query_Having_TestCase extends Doctrine_UnitTestCase -{ - public function testAggregateFunctionsInHavingReturnValidSql() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p HAVING COUNT(p.id) > 2'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) HAVING COUNT(p.id) > 2'); - } - public function testAggregateFunctionsInHavingReturnValidSql2() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT u.name FROM User u LEFT JOIN u.Phonenumber p HAVING MAX(u.name) = 'zYne'"); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) HAVING MAX(e.name) = 'zYne'"); - } - - public function testMultipleAggregateFunctionsInHavingReturnValidSql() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p HAVING COUNT(p.id) = MAX(u.id)'); - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) HAVING COUNT(p.id) = MAX(e.id)"); - } - - public function testAggregateFunctionsInHavingSupportMultipleParameters() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT CONCAT(u.name, u.loginname) name FROM User u LEFT JOIN u.Phonenumber p HAVING name = 'xx'"); - } - - public function testReturnFuncIfNumeric() - { - $having = new Doctrine_Query_Having("test"); - $part = $having->load("1"); - $this->assertEqual("1",trim($part)); - - } - -} diff --git a/tests_old/Query/IdentifierQuotingTestCase.php b/tests_old/Query/IdentifierQuotingTestCase.php deleted file mode 100644 index f08e28bab..000000000 --- a/tests_old/Query/IdentifierQuotingTestCase.php +++ /dev/null @@ -1,103 +0,0 @@ -. - */ - -/** - * Doctrine_Query_IdentifierQuoting_TestCase - * - * This test case is used for testing DQL API quotes all identifiers properly - * if idenfitier quoting is turned on - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_IdentifierQuoting_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('Entity', 'Phonenumber'); - - parent::prepareTables(); - } - - public function prepareData() - { } - - public function testQuerySupportsIdentifierQuoting() - { - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); - - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT MAX(u.id), MIN(u.name) FROM User u'); - - $this->assertEqual($q->getQuery(), 'SELECT MAX("e"."id") AS "e__0", MIN("e"."name") AS "e__1" FROM "entity" "e" WHERE ("e"."type" = 0)'); - - $q->execute(); - } - - public function testQuerySupportsIdentifierQuotingInWherePart() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.name FROM User u WHERE u.id = 3'); - - $this->assertEqual($q->getQuery(), 'SELECT "e"."id" AS "e__id", "e"."name" AS "e__name" FROM "entity" "e" WHERE "e"."id" = 3 AND ("e"."type" = 0)'); - - $q->execute(); - } - - /** - public function testQuerySupportsIdentifierQuotingWorksWithinFunctions() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT u.name FROM User u WHERE TRIM(u.name) = 'zYne'"); - - $this->assertEqual($q->getQuery(), 'SELECT "e"."id" AS "e__id", "e"."name" AS "e__name" FROM "entity" "e" WHERE TRIM(u.name) = 3 AND ("e"."type" = 0)'); - } - */ - - public function testQuerySupportsIdentifierQuotingWithJoins() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p'); - - $this->assertEqual($q->getQuery(), 'SELECT "e"."id" AS "e__id", "e"."name" AS "e__name" FROM "entity" "e" LEFT JOIN "phonenumber" "p" ON "e"."id" = "p"."entity_id" WHERE ("e"."type" = 0)'); - - } - - public function testLimitSubqueryAlgorithmSupportsIdentifierQuoting() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.name FROM User u INNER JOIN u.Phonenumber p')->limit(5); - - $this->assertEqual($q->getQuery(), 'SELECT "e"."id" AS "e__id", "e"."name" AS "e__name" FROM "entity" "e" INNER JOIN "phonenumber" "p" ON "e"."id" = "p"."entity_id" WHERE "e"."id" IN (SELECT DISTINCT "e"."id" FROM "entity" "e2" INNER JOIN "phonenumber" "p2" ON "e"."id" = "p"."entity_id" WHERE ("e"."type" = 0) LIMIT 5) AND ("e"."type" = 0)'); - - $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); - } -} diff --git a/tests_old/Query/JoinCondition2TestCase.php b/tests_old/Query/JoinCondition2TestCase.php deleted file mode 100755 index 6530403a0..000000000 --- a/tests_old/Query/JoinCondition2TestCase.php +++ /dev/null @@ -1,126 +0,0 @@ -. - */ - -/** - * Doctrine_Query_JoinCondition2_TestCase - * - * @package Doctrine - * @author Guilherme Blanco - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_JoinCondition2_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('User', 'Groupuser'); - parent::prepareTables(); - } - - - public function prepareData() - { - $this->conn->clear('User'); - $this->conn->clear('Group'); - $this->conn->clear('Groupuser'); - - $zYne = new User(); - $zYne->name = 'zYne'; - $zYne->save(); - - $groups = new Doctrine_Collection('Group'); - $groups[0]->name = 'PHP Users'; - $groups[1]->name = 'Developers'; - //$groups->save(); - - $zYne->Group = $groups; - $zYne->save(); - - /*$q = new Doctrine_Query($this->connection); - $q->select('g.*')->from('Groupuser g'); - //echo $q->getSql(); - var_dump($q->execute(array(), Doctrine::HYDRATE_ARRAY)); - echo "

    ";*/ - - //$q = new Doctrine_Query($this->connection); - //$q->select('u.id, g.id')->from('User u')->leftJoin('u.Group g')->where('u.name = ?', 'zYne'); - //var_dump($q->execute(array(), Doctrine::HYDRATE_ARRAY)); - } - - public function testJoinConditionsArgumentsLeftJoins() - { - $q = new Doctrine_Query($this->connection); - - $q->select('u.id, g.id')->from('User u')->leftJoin('u.Group g WITH g.name = ?', 'Developers')->where('u.name = ?', 'zYne'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e2.id AS e2__id FROM entity e" - . " LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id" - . " AND e2.name = ? WHERE e.name = ? AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - - $rs = $q->execute(); - - // Should only find zYne - $this->assertEqual($rs->count(), 1); - - // Grab the number of runned queries - $queryCount = $this->connection->count(); - - // Only one Group fetched for zYne - $this->assertEqual($rs[0]->Group->count(), 1); - - // Check if it executed any other query - $bug = ($this->connection->count() - $queryCount); - - // Should return 0 (no more queries executed) - $this->assertEqual($bug, 0); - } - - public function testJoinCondifitionsArgumentsInnerJoins() - { - $q = new Doctrine_Query($this->connection); - - $q->select('u.id, g.id')->from('User u')->innerJoin('u.Group g WITH g.name = ?', 'Developers')->where('u.name = ?', 'zYne'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e2.id AS e2__id FROM entity e" - . " INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id" - . " AND e2.name = ? WHERE e.name = ? AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - - $rs = $q->execute(); - - // Should only find zYne - $this->assertEqual($rs->count(), 1); - - // Grab the number of runned queries - $queryCount = $this->connection->count(); - - // Only one Group fetched for zYne - $this->assertEqual($rs[0]->Group->count(), 1); - - // Check if it executed any other query - $bug = ($this->connection->count() - $queryCount); - - // Should return 0 (no more queries executed) - $this->assertEqual($bug, 0); - } -} diff --git a/tests_old/Query/JoinConditionTestCase.php b/tests_old/Query/JoinConditionTestCase.php deleted file mode 100644 index 482f6b615..000000000 --- a/tests_old/Query/JoinConditionTestCase.php +++ /dev/null @@ -1,71 +0,0 @@ -. - */ - -/** - * Doctrine_Query_JoinCondition_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_JoinCondition_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - public function testJoinConditionsAreSupportedForOneToManyLeftJoins() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT u.name, p.id FROM User u LEFT JOIN u.Phonenumber p ON p.phonenumber = '123 123'"); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, p.id AS p__id FROM entity e LEFT JOIN phonenumber p ON p.phonenumber = '123 123' WHERE (e.type = 0)"); - } - public function testJoinConditionsAreSupportedForOneToManyInnerJoins() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT u.name, p.id FROM User u INNER JOIN u.Phonenumber p ON p.phonenumber = '123 123'"); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, p.id AS p__id FROM entity e INNER JOIN phonenumber p ON p.phonenumber = '123 123' WHERE (e.type = 0)"); - } - public function testJoinConditionsAreSupportedForManyToManyLeftJoins() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT u.name, g.id FROM User u LEFT JOIN u.Group g ON g.id > 2"); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e2.id AS e2__id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id > 2 WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - public function testJoinConditionsAreSupportedForManyToManyInnerJoins() - { - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT u.name, g.id FROM User u INNER JOIN u.Group g ON g.id > 2"); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e2.id AS e2__id FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id > 2 WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } -} diff --git a/tests_old/Query/JoinTestCase.php b/tests_old/Query/JoinTestCase.php deleted file mode 100644 index 23d3f6e2c..000000000 --- a/tests_old/Query/JoinTestCase.php +++ /dev/null @@ -1,207 +0,0 @@ -. - */ - -/** - * Doctrine_Query_JoinCondition_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Join_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('Record_Country', 'Record_City', 'Record_District', 'Entity', - 'User', 'Group', 'Email', 'Phonenumber', 'Groupuser', 'Account'); - - parent::prepareTables(); - } - public function prepareData() - { - } - - public function testInitData() - { - $c = new Record_Country(); - - $c->name = 'Some country'; - - $c->City[0]->name = 'City 1'; - $c->City[1]->name = 'City 2'; - $c->City[2]->name = 'City 3'; - - $c->City[0]->District->name = 'District 1'; - $c->City[2]->District->name = 'District 2'; - $this->assertTrue($c->City[0]->get('district_id') === $c->City[0]->District); - - $c->save(); - - $this->connection->clear(); - } - - public function testQuerySupportsCustomJoins() - { - $q = new Doctrine_Query(); - - $q->select('c.*, c2.*, d.*') - ->from('Record_Country c')->innerJoin('c.City c2 ON c2.id = 2') - ->where('c.id = ?', array(1)); - - $this->assertEqual($q->getSql(), 'SELECT r.id AS r__id, r.name AS r__name, r2.id AS r2__id, r2.name AS r2__name, r2.country_id AS r2__country_id, r2.district_id AS r2__district_id FROM record__country r INNER JOIN record__city r2 ON r2.id = 2 WHERE r.id = ?'); - } - - public function testQuerySupportsCustomJoinsAndWithKeyword() - { - $q = new Doctrine_Query(); - - $q->select('c.*, c2.*, d.*') - ->from('Record_Country c')->innerJoin('c.City c2 WITH c2.id = 2') - ->where('c.id = ?', array(1)); - - $this->assertEqual($q->getSql(), 'SELECT r.id AS r__id, r.name AS r__name, r2.id AS r2__id, r2.name AS r2__name, r2.country_id AS r2__country_id, r2.district_id AS r2__district_id FROM record__country r INNER JOIN record__city r2 ON r.id = r2.country_id AND r2.id = 2 WHERE r.id = ?'); - } - - public function testRecordHydrationWorksWithDeeplyNestedStructuresAndArrayFetching() - { - $q = new Doctrine_Query(); - - $q->select('c.*, c2.*, d.*') - ->from('Record_Country c')->leftJoin('c.City c2')->leftJoin('c2.District d') - ->where('c.id = ?', array(1)); - - $countries = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $c = $countries[0]; - $this->assertEqual($c['City'][0]['name'], 'City 1'); - $this->assertEqual($c['City'][1]['name'], 'City 2'); - $this->assertEqual($c['City'][2]['name'], 'City 3'); - - $this->assertEqual($c['City'][0]['District']['name'], 'District 1'); - $this->assertEqual($c['City'][2]['District']['name'], 'District 2'); - } - - public function testRecordHydrationWorksWithDeeplyNestedStructures() - { - $q = new Doctrine_Query(); - - $q->select('c.*, c2.*, d.*') - ->from('Record_Country c')->leftJoin('c.City c2')->leftJoin('c2.District d') - ->where('c.id = ?', array(1)); - - $this->assertEqual($q->getQuery(), "SELECT r.id AS r__id, r.name AS r__name, r2.id AS r2__id, r2.name AS r2__name, r2.country_id AS r2__country_id, r2.district_id AS r2__district_id, r3.id AS r3__id, r3.name AS r3__name FROM record__country r LEFT JOIN record__city r2 ON r.id = r2.country_id LEFT JOIN record__district r3 ON r2.district_id = r3.id WHERE r.id = ?"); - - $countries = $q->execute(); - - $c = $countries[0]; - $this->assertEqual($c->City[0]->name, 'City 1'); - $this->assertEqual($c->City[1]->name, 'City 2'); - $this->assertEqual($c->City[2]->name, 'City 3'); - - $this->assertEqual($c->City[0]->District->name, 'District 1'); - $this->assertEqual($c->City[2]->District->name, 'District 2'); - } - - public function testManyToManyJoinUsesProperTableAliases() - { - $q = new Doctrine_Query(); - - $q->select('u.name')->from('User u INNER JOIN u.Group g'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))'); - } - - public function testSelfReferentialAssociationJoinsAreSupported() - { - $q = new Doctrine_Query(); - - $q->select('e.name')->from('Entity e INNER JOIN e.Entity e2'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e INNER JOIN entity_reference e3 ON e.id = e3.entity1 OR e.id = e3.entity2 INNER JOIN entity e2 ON (e2.id = e3.entity2 OR e2.id = e3.entity1) AND e2.id != e.id WHERE (e.type = 2 AND (e2.type = 2 OR e2.type IS NULL))'); - } - - public function testMultipleJoins() - { - $q = new Doctrine_Query(); - $q->select('u.id, g.id, e.id')->from('User u') - ->leftJoin('u.Group g')->leftJoin('g.Email e'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e2.id AS e2__id, e3.id AS e3__id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id LEFT JOIN email e3 ON e2.email_id = e3.id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))'); - try { - $q->execute(); - $this->pass(); - } catch (Doctrine_Exception $e) { - $this->fail(); - } - } - - public function testMultipleJoins2() - { - $q = new Doctrine_Query(); - $q->select('u.id, g.id, e.id')->from('Group g') - ->leftJoin('g.User u')->leftJoin('u.Account a'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e2.id AS e2__id FROM entity e LEFT JOIN groupuser g ON e.id = g.group_id LEFT JOIN entity e2 ON e2.id = g.user_id LEFT JOIN account a ON e2.id = a.entity_id WHERE (e.type = 1 AND (e2.type = 0 OR e2.type IS NULL))'); - try { - $q->execute(); - $this->pass(); - } catch (Doctrine_Exception $e) { - $this->fail(); - } - } - - public function testMapKeywordForQueryWithOneComponent() - { - $q = new Doctrine_Query(); - $coll = $q->from('Record_City c INDEXBY c.name')->fetchArray(); - - $this->assertTrue(isset($coll['City 1'])); - $this->assertTrue(isset($coll['City 2'])); - $this->assertTrue(isset($coll['City 3'])); - } - - public function testMapKeywordSupportsJoins() - { - $q = new Doctrine_Query(); - $country = $q->from('Record_Country c LEFT JOIN c.City c2 INDEXBY c2.name')->fetchOne(); - $coll = $country->City; - - $this->assertTrue(isset($coll['City 1'])); - $this->assertTrue(isset($coll['City 2'])); - $this->assertTrue(isset($coll['City 3'])); - } - - public function testMapKeywordThrowsExceptionOnNonExistentColumn() - { - try { - $q = new Doctrine_Query(); - $country = $q->from('Record_Country c LEFT JOIN c.City c2 INDEXBY c2.unknown')->fetchOne(); - - $this->fail(); - } catch (Doctrine_Query_Exception $e) { - $this->pass(); - } - } -} diff --git a/tests_old/Query/LimitTestCase.php b/tests_old/Query/LimitTestCase.php deleted file mode 100644 index 733a5293f..000000000 --- a/tests_old/Query/LimitTestCase.php +++ /dev/null @@ -1,304 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Limit_TestCase - * - * This test case is used for testing DQL LIMIT clause - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Limit_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = "Photo"; - $this->tables[] = "Tag"; - $this->tables[] = "Phototag"; - - parent::prepareTables(); - } - - public function testLimitWithOneToOneLeftJoin() - { - $q = new Doctrine_Query(); - $q->select('u.id, e.*')->from('User u, u.Email e')->limit(5); - - $users = $q->execute(); - $this->assertEqual($users->count(), 5); - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e2.id AS e2__id, e2.address AS e2__address FROM entity e LEFT JOIN email e2 ON e.email_id = e2.id WHERE (e.type = 0) LIMIT 5"); - - } - public function testLimitWithOneToOneInnerJoin() - { - $q = new Doctrine_Query(); - $q->select('u.id, e.*')->from('User u, u:Email e')->limit(5); - - $users = $q->execute(); - $this->assertEqual($users->count(), 5); - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e2.id AS e2__id, e2.address AS e2__address FROM entity e INNER JOIN email e2 ON e.email_id = e2.id WHERE (e.type = 0) LIMIT 5"); - } - - public function testLimitWithOneToManyLeftJoin() - { - $q = new Doctrine_Query(); - $q->select('u.id, p.*')->from('User u, u.Phonenumber p')->limit(5); - - $sql = $q->getQuery(); - - $this->assertEqual($q->getQuery(), - 'SELECT e.id AS e__id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE e.id IN (SELECT DISTINCT e2.id FROM entity e2 LEFT JOIN phonenumber p2 ON e2.id = p2.entity_id WHERE (e2.type = 0) LIMIT 5) AND (e.type = 0)'); - - $users = $q->execute(); - $count = $this->conn->count(); - $this->assertEqual($users->count(), 5); - $users[0]->Phonenumber[0]; - $this->assertEqual($count, $this->conn->count()); - - $q->offset(2); - - $users = $q->execute(); - $count = $this->conn->count(); - $this->assertEqual($users->count(), 5); - $users[3]->Phonenumber[0]; - $this->assertEqual($count, $this->conn->count()); - } - - public function testLimitWithOneToManyLeftJoinAndCondition() - { - $q = new Doctrine_Query(); - $q->select('User.name')->from('User')->where("User.Phonenumber.phonenumber LIKE '%123%'")->limit(5); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 5); - - $this->assertEqual($users[0]->name, 'zYne'); - $this->assertEqual($users[1]->name, 'Arnold Schwarzenegger'); - $this->assertEqual($users[2]->name, 'Michael Caine'); - $this->assertEqual($users[3]->name, 'Sylvester Stallone'); - $this->assertEqual($users[4]->name, 'Jean Reno'); - - $this->assertEqual($q->getQuery(), - "SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE e.id IN (SELECT DISTINCT e2.id FROM entity e2 LEFT JOIN phonenumber p2 ON e2.id = p2.entity_id WHERE p2.phonenumber LIKE '%123%' AND (e2.type = 0) LIMIT 5) AND p.phonenumber LIKE '%123%' AND (e.type = 0)"); - } - - - public function testLimitWithOneToManyLeftJoinAndOrderBy() - { - $q = new Doctrine_Query(); - $q->select('User.name')->from('User')->where("User.Phonenumber.phonenumber LIKE '%123%'")->orderby('User.Email.address')->limit(5); - - - $users = $q->execute(); - - $this->assertEqual($users[0]->name, 'Arnold Schwarzenegger'); - $this->assertEqual($users[1]->name, 'Michael Caine'); - $this->assertEqual($users[2]->name, 'Jean Reno'); - $this->assertEqual($users[3]->name, 'Sylvester Stallone'); - $this->assertEqual($users[4]->name, 'zYne'); - - $this->assertEqual($users->count(), 5); - } - - public function testLimitWithOneToManyInnerJoin() - { - $q = new Doctrine_Query(); - $q->select('u.id, p.*')->from('User u INNER JOIN u.Phonenumber p'); - $q->limit(5); - - - $sql = $q->getQuery(); - - $users = $q->execute(); - $count = $this->conn->count(); - $this->assertEqual($users->count(), 5); - $users[0]->Phonenumber[0]; - $this->assertEqual($count, $this->conn->count()); - - - $q->offset(2); - - $users = $q->execute(); - $count = $this->conn->count(); - $this->assertEqual($users->count(), 5); - $users[3]->Phonenumber[0]; - $this->assertEqual($count, $this->conn->count()); - - $this->assertEqual($q->getQuery(), - 'SELECT e.id AS e__id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id FROM entity e INNER JOIN phonenumber p ON e.id = p.entity_id WHERE e.id IN (SELECT DISTINCT e2.id FROM entity e2 INNER JOIN phonenumber p2 ON e2.id = p2.entity_id WHERE (e2.type = 0) LIMIT 5 OFFSET 2) AND (e.type = 0)'); - } - - public function testLimitWithPreparedQueries() - { - $q = new Doctrine_Query(); - $q->select('u.id, p.id')->from('User u LEFT JOIN u.Phonenumber p'); - $q->where('u.name = ?'); - $q->limit(5); - $users = $q->execute(array('zYne')); - - $this->assertEqual($users->count(), 1); - $count = $this->conn->count(); - $users[0]->Phonenumber[0]; - $this->assertEqual($count, $this->conn->count()); - - $this->assertEqual($q->getQuery(), - 'SELECT e.id AS e__id, p.id AS p__id FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE e.id IN (SELECT DISTINCT e2.id FROM entity e2 LEFT JOIN phonenumber p2 ON e2.id = p2.entity_id WHERE e2.name = ? AND (e2.type = 0) LIMIT 5) AND e.name = ? AND (e.type = 0)'); - - $q = new Doctrine_Query(); - $q->select('u.id, p.id')->from('User u LEFT JOIN u.Phonenumber p'); - $q->where("u.name LIKE ? || u.name LIKE ?"); - $q->limit(5); - - $users = $q->execute(array('%zYne%', '%Arnold%')); - $this->assertEqual($users->count(), 2); - - - $count = $this->conn->count(); - $users[0]->Phonenumber[0]; - $this->assertEqual($count, $this->conn->count()); - - $this->assertEqual($q->getQuery(), - "SELECT e.id AS e__id, p.id AS p__id FROM entity e LEFT JOIN phonenumber p ON" - . " e.id = p.entity_id WHERE e.id IN (SELECT DISTINCT e2.id FROM entity e2 LEFT JOIN phonenumber p2" - . " ON e2.id = p2.entity_id WHERE (e2.name LIKE ? OR e2.name LIKE ?) AND (e2.type = 0) LIMIT 5) AND " - . "(e.name LIKE ? OR e.name LIKE ?) AND (e.type = 0)"); - } - - public function testConnectionFlushing() - { - $q = new Doctrine_Query(); - $q->from('User.Phonenumber'); - $q->where('User.name = ?'); - $q->limit(5); - - $users = $q->execute(array('zYne')); - - $this->assertEqual($users->count(), 1); - //$this->connection->flush(); - } - public function testLimitWithManyToManyColumnAggInheritanceLeftJoin() - { - $q = new Doctrine_Query(); - $q->from('User.Group')->limit(5); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 5); - - $user = $this->objTable->find(5); - $user->Group[1]->name = "Tough guys inc."; - $user->Group[2]->name = "Terminators"; - - $user2 = $this->objTable->find(4); - $user2->Group = $user->Group; - - $user3 = $this->objTable->find(6); - $user3->Group = $user->Group; - - $this->assertEqual($user->Group[0]->name, "Action Actors"); - $this->assertEqual(count($user->Group), 3); - - $this->connection->unitOfWork->saveAll(); - - $this->assertEqual($user->Group[0]->name, "Action Actors"); - $this->assertEqual(count($user->Group), 3); - - - - $q = new Doctrine_Query(); - $q->from("User")->where("User.Group.id = ?")->orderby("User.id ASC")->limit(5); - - - $users = $q->execute(array($user->Group[1]->id)); - - $this->assertEqual($users->count(), 3); - - $this->connection->clear(); - $q = new Doctrine_Query(); - $q->from('User')->where('User.Group.id = ?')->orderby('User.id DESC'); - $users = $q->execute(array($user->Group[1]->id)); - - $this->assertEqual($users->count(), 3); - } - - public function testLimitAttribute() - { - $this->manager->setAttribute(Doctrine::ATTR_QUERY_LIMIT, Doctrine::LIMIT_ROWS); - - $this->connection->clear(); - $q = new Doctrine_Query(); - $q->from('User')->where('User.Group.name = ?')->orderby('User.id DESC')->limit(5); - $users = $q->execute(array('Tough guys inc.')); - - $this->assertEqual($users->count(), 3); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id WHERE e2.name = ? AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL)) ORDER BY e.id DESC LIMIT 5"); - $this->manager->setAttribute(Doctrine::ATTR_QUERY_LIMIT, Doctrine::LIMIT_RECORDS); - } - - public function testLimitWithManyToManyAndColumnAggregationInheritance() - { - $q = new Doctrine_Query(); - $q->from('User u, u.Group g')->where('g.id > 1')->orderby('u.name DESC')->limit(10); - - } - public function testLimitWithNormalManyToMany() - { - $coll = new Doctrine_Collection('Photo'); - $tag = new Tag(); - $tag->tag = "Some tag"; - $coll[0]->Tag[0] = $tag; - $coll[0]->name = "photo 1"; - $coll[1]->Tag[0] = $tag; - $coll[1]->name = "photo 2"; - $coll[2]->Tag[0] = $tag; - $coll[2]->name = "photo 3"; - $coll[3]->Tag[0]->tag = "Other tag"; - $coll[3]->name = "photo 4"; - $this->connection->unitOfWork->saveAll(); - - $q = new Doctrine_Query(); - $q->from('Photo')->where('Photo.Tag.id = ?')->orderby('Photo.id DESC')->limit(100); - - $photos = $q->execute(array(1)); - $this->assertEqual($photos->count(), 3); - $this->assertEqual($q->getQuery(), - "SELECT p.id AS p__id, p.name AS p__name FROM photo p LEFT JOIN phototag p2 ON p.id = p2.photo_id LEFT JOIN tag t ON t.id = p2.tag_id WHERE p.id IN (SELECT DISTINCT p3.id FROM photo p3 LEFT JOIN phototag p4 ON p3.id = p4.photo_id LEFT JOIN tag t2 ON t2.id = p4.tag_id WHERE t2.id = ? ORDER BY p3.id DESC LIMIT 100) AND t.id = ? ORDER BY p.id DESC"); - } - - public function testLimitNoticesOrderbyJoins() - { - $q = new Doctrine_Query(); - - $q->from('Photo p') - ->leftJoin('p.Tag t') - ->orderby('t.id DESC')->limit(10); - - $this->assertEqual($q->getSql(), "SELECT p.id AS p__id, p.name AS p__name, t.id AS t__id, t.tag AS t__tag FROM photo p LEFT JOIN phototag p2 ON p.id = p2.photo_id LEFT JOIN tag t ON t.id = p2.tag_id WHERE p.id IN (SELECT DISTINCT p3.id FROM photo p3 LEFT JOIN phototag p4 ON p3.id = p4.photo_id LEFT JOIN tag t2 ON t2.id = p4.tag_id ORDER BY t2.id DESC LIMIT 10) ORDER BY t.id DESC"); - } -} diff --git a/tests_old/Query/MultiJoin2TestCase.php b/tests_old/Query/MultiJoin2TestCase.php deleted file mode 100644 index 262cad655..000000000 --- a/tests_old/Query/MultiJoin2TestCase.php +++ /dev/null @@ -1,115 +0,0 @@ -. - */ - -/** - * Doctrine_Query_MultiJoin2_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_MultiJoin2_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('QueryTest_Category', 'QueryTest_Board', 'QueryTest_User', 'QueryTest_Entry'); - - parent::prepareTables(); - } - public function testInitializeData() - { - $query = new Doctrine_Query($this->connection); - - $cat = new QueryTest_Category(); - - $cat->rootCategoryId = 0; - $cat->parentCategoryId = 0; - $cat->name = "Cat1"; - $cat->position = 0; - $cat->save(); - - $board = new QueryTest_Board(); - $board->name = "B1"; - $board->categoryId = $cat->id; - $board->position = 0; - $board->save(); - - $author = new QueryTest_User(); - $author->username = "romanb"; - $author->save(); - - $lastEntry = new QueryTest_Entry(); - $lastEntry->authorId = $author->id; - $lastEntry->date = 1234; - $lastEntry->save(); - - } - - public function testMultipleJoinFetchingWithDeepJoins() - { - $query = new Doctrine_Query($this->connection); - $queryCount = $this->connection->count(); - try { - $categories = $query->select('c.*, subCats.*, b.*, le.*, a.*') - ->from('QueryTest_Category c') - ->leftJoin('c.subCategories subCats') - ->leftJoin('c.boards b') - ->leftJoin('b.lastEntry le') - ->leftJoin('le.author a') - ->where('c.parentCategoryId = 0') - ->orderBy('c.position ASC, subCats.position ASC, b.position ASC') - ->execute(); - // Test that accessing a loaded (but empty) relation doesnt trigger an extra query - $this->assertEqual($queryCount + 1, $this->connection->count()); - $this->assertEqual(0, count($categories[0]->subCategories)); - $categories[0]->subCategories; - $this->assertEqual($queryCount + 1, $this->connection->count()); - } catch (Doctrine_Exception $e) { - $this->fail($e->getMessage()); - } - } - - public function testMultipleJoinFetchingWithArrayFetching() - { - $query = new Doctrine_Query($this->connection); - $queryCount = $this->connection->count(); - try { - $categories = $query->select('c.*, subCats.*, b.*, le.*, a.*') - ->from('QueryTest_Category c') - ->leftJoin('c.subCategories subCats') - ->leftJoin('c.boards b') - ->leftJoin('b.lastEntry le') - ->leftJoin('le.author a') - ->where('c.parentCategoryId = 0') - ->orderBy('c.position ASC, subCats.position ASC, b.position ASC') - ->execute(array(), Doctrine::FETCH_ARRAY); - $this->pass(); - } catch (Doctrine_Exception $e) { - $this->fail($e->getMessage()); - } - } -} diff --git a/tests_old/Query/MultiJoinTestCase.php b/tests_old/Query/MultiJoinTestCase.php deleted file mode 100644 index 00f7d8d84..000000000 --- a/tests_old/Query/MultiJoinTestCase.php +++ /dev/null @@ -1,192 +0,0 @@ -. - */ - -/** - * Doctrine_Query_MultiJoin_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_MultiJoin_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = 'Book'; - $this->tables[] = 'Author'; - parent::prepareTables(); - } - public function testInitializeData() - { - - $query = new Doctrine_Query($this->connection); - - $user = $this->connection->getRepository('User')->find(4); - - - $album = $this->connection->create('Album'); - $album->Song[0]; - - $user->Album[0]->name = 'Damage Done'; - $user->Album[1]->name = 'Haven'; - - $user->Album[0]->Song[0]->title = 'Damage Done'; - $user->Album[0]->Song[1]->title = 'The Treason Wall'; - $user->Album[0]->Song[2]->title = 'Monochromatic Stains'; - - $this->assertEqual(count($user->Album[0]->Song), 3); - - - $user->Album[1]->Song[0]->title = 'Not Built To Last'; - $user->Album[1]->Song[1]->title = 'The Wonders At Your Feet'; - $user->Album[1]->Song[2]->title = 'Feast Of Burden'; - $user->Album[1]->Song[3]->title = 'Fabric'; - $this->assertEqual(count($user->Album[1]->Song), 4); - - $user->save(); - - $user = $this->objTable->find(4); - - $this->assertEqual(count($user->Album[0]->Song), 3); - $this->assertEqual(count($user->Album[1]->Song), 4); - - - $user = $this->connection->getRepository('User')->find(5); - - $user->Album[0]->name = 'Clayman'; - $user->Album[1]->name = 'Colony'; - $user->Album[1]->Song[0]->title = 'Colony'; - $user->Album[1]->Song[1]->title = 'Ordinary Story'; - - $user->save(); - - $this->assertEqual(count($user->Album[0]->Song), 0); - $this->assertEqual(count($user->Album[1]->Song), 2); - } - public function testMultipleOneToManyFetching() - { - $this->connection->clear(); - - $query = new Doctrine_Query(); - - $users = $query->query('FROM User.Album.Song, User.Phonenumber WHERE User.id IN (4,5)'); - - $this->assertEqual($users->count(), 2); - - $this->assertEqual($users[0]->id, 4); - - $this->assertEqual($users[0]->Album[0]->name, 'Damage Done'); - $this->assertEqual($users[0]->Album[0]->Song[0]->title, 'Damage Done'); - $this->assertEqual($users[0]->Album[0]->Song[1]->title, 'The Treason Wall'); - $this->assertEqual($users[0]->Album[0]->Song[2]->title, 'Monochromatic Stains'); - $this->assertEqual($users[0]->Album[1]->name, 'Haven'); - $this->assertEqual($users[0]->Album[1]->Song[0]->title, 'Not Built To Last'); - $this->assertEqual($users[0]->Album[1]->Song[1]->title, 'The Wonders At Your Feet'); - $this->assertEqual($users[0]->Album[1]->Song[2]->title, 'Feast Of Burden'); - $this->assertEqual($users[0]->Album[1]->Song[3]->title, 'Fabric'); - - $this->assertEqual($users[1]->id, 5); - $this->assertEqual($users[1]->Album[0]->name, 'Clayman'); - $this->assertEqual($users[1]->Album[1]->name, 'Colony'); - $this->assertEqual($users[1]->Album[1]->Song[0]->title, 'Colony'); - $this->assertEqual($users[1]->Album[1]->Song[1]->title, 'Ordinary Story'); - - $this->assertEqual($users[0]->Phonenumber[0]->phonenumber, '123 123'); - - $this->assertEqual($users[1]->Phonenumber[0]->phonenumber, '123 123'); - $this->assertEqual($users[1]->Phonenumber[1]->phonenumber, '456 456'); - $this->assertEqual($users[1]->Phonenumber[2]->phonenumber, '789 789'); - } - - public function testInitializeMoreData() - { - $user = $this->connection->getRepository('User')->find(4); - $user->Book[0]->name = 'The Prince'; - $user->Book[0]->Author[0]->name = 'Niccolo Machiavelli'; - $user->Book[0]->Author[1]->name = 'Someone'; - $user->Book[1]->name = 'The Art of War'; - $user->Book[1]->Author[0]->name = 'Someone'; - $user->Book[1]->Author[1]->name = 'Niccolo Machiavelli'; - - - $user->save(); - - $user = $this->connection->getRepository('User')->find(5); - $user->Book[0]->name = 'Zadig'; - $user->Book[0]->Author[0]->name = 'Voltaire'; - $user->Book[0]->Author[1]->name = 'Someone'; - $user->Book[1]->name = 'Candide'; - $user->Book[1]->Author[0]->name = 'Someone'; - $user->Book[1]->Author[1]->name = 'Voltaire'; - $user->save(); - - $this->connection->clear(); - } - public function testMultipleOneToManyFetching2() - { - $query = new Doctrine_Query(); - - $users = $query->query("FROM User.Album.Song, User.Book.Author WHERE User.id IN (4,5)"); - - $this->assertEqual($users->count(), 2); - - $this->assertEqual($users[0]->id, 4); - $this->assertEqual($users[0]->Album[0]->name, 'Damage Done'); - $this->assertEqual($users[0]->Album[0]->Song[0]->title, 'Damage Done'); - $this->assertEqual($users[0]->Album[0]->Song[1]->title, 'The Treason Wall'); - $this->assertEqual($users[0]->Album[0]->Song[2]->title, 'Monochromatic Stains'); - $this->assertEqual($users[0]->Album[1]->name, 'Haven'); - $this->assertEqual($users[0]->Album[1]->Song[0]->title, 'Not Built To Last'); - $this->assertEqual($users[0]->Album[1]->Song[1]->title, 'The Wonders At Your Feet'); - $this->assertEqual($users[0]->Album[1]->Song[2]->title, 'Feast Of Burden'); - $this->assertEqual($users[0]->Album[1]->Song[3]->title, 'Fabric'); - - $this->assertEqual($users[0]->Book[0]->Author[0]->name, 'Niccolo Machiavelli'); - $this->assertEqual($users[0]->Book[0]->Author[1]->name, 'Someone'); - $this->assertEqual($users[0]->Book[1]->name, 'The Art of War'); - $this->assertEqual($users[0]->Book[1]->Author[0]->name, 'Someone'); - $this->assertEqual($users[0]->Book[1]->Author[1]->name, 'Niccolo Machiavelli'); - - $this->assertEqual($users[1]->id, 5); - $this->assertEqual($users[1]->Album[0]->name, 'Clayman'); - $this->assertEqual($users[1]->Album[1]->name, 'Colony'); - $this->assertEqual($users[1]->Album[1]->Song[0]->title, 'Colony'); - $this->assertEqual($users[1]->Album[1]->Song[1]->title, 'Ordinary Story'); - - $this->assertEqual($users[1]->Book[0]->name, 'Zadig'); - $this->assertEqual($users[1]->Book[0]->Author[0]->name, 'Voltaire'); - $this->assertEqual($users[1]->Book[0]->Author[1]->name, 'Someone'); - $this->assertEqual($users[1]->Book[1]->name, 'Candide'); - $this->assertEqual($users[1]->Book[1]->Author[0]->name, 'Someone'); - $this->assertEqual($users[1]->Book[1]->Author[1]->name, 'Voltaire'); - } - - public function testMultipleOneToManyFetchingWithOrderBy() - { - $query = new Doctrine_Query(); - - $users = $query->query("FROM User.Album.Song WHERE User.id IN (4,5) ORDER BY User.Album.Song.title DESC"); - } -} diff --git a/tests_old/Query/MultipleAggregateValueTestCase.php b/tests_old/Query/MultipleAggregateValueTestCase.php deleted file mode 100644 index bf7cd7a43..000000000 --- a/tests_old/Query/MultipleAggregateValueTestCase.php +++ /dev/null @@ -1,101 +0,0 @@ -. - */ - -/** - * Doctrine_Query_MultipleAggregateValue_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @author Jonathan H. Wage - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_MultipleAggregateValue_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('User', 'Email', 'Album', 'Book'); - parent::prepareTables(); - } - - public function prepareData() - { - $user = new User(); - $user->name = 'jon'; - - $user->Album[0] = new Album(); - $user->Album[1] = new Album(); - $user->Album[2] = new Album(); - - $user->Book[0] = new Book(); - $user->Book[1] = new Book(); - $user->save(); - } - - public function testMultipleAggregateValues() - { - $query = new Doctrine_Query(); - $query->select('u.*, COUNT(DISTINCT b.id) num_books, COUNT(DISTINCT a.id) num_albums'); - $query->from('User u'); - $query->leftJoin('u.Album a, u.Book b'); - $query->where("u.name = 'jon'"); - $query->limit(1); - - $user = $query->execute()->getFirst(); - - try { - $name = $user->name; - $num_albums = $user->Album[0]->num_albums; - $num_books = $user->Book[0]->num_books; - } catch (Doctrine_Exception $e) { - $this->fail(); - } - - $this->assertEqual($num_albums, 3); - $this->assertEqual($num_books, 2); - } - - public function testMultipleAggregateValuesWithArrayFetching() - { - $query = new Doctrine_Query(); - $query->select('u.*, COUNT(DISTINCT b.id) num_books, COUNT(DISTINCT a.id) num_albums'); - $query->from('User u'); - $query->leftJoin('u.Album a, u.Book b'); - $query->where("u.name = 'jon'"); - $query->limit(1); - - $users = $query->execute(array(), Doctrine::FETCH_ARRAY); - - try { - $name = $users[0]['name']; - $num_albums = $users[0]['Album'][0]['num_albums']; - $num_books = $users[0]['Book'][0]['num_books']; - } catch (Doctrine_Exception $e) { - $this->fail(); - } - - $this->assertEqual($num_albums, 3); - $this->assertEqual($num_books, 2); - } -} diff --git a/tests_old/Query/MysqlSubqueryHavingTestCase.php b/tests_old/Query/MysqlSubqueryHavingTestCase.php deleted file mode 100644 index 3b7d9a7d8..000000000 --- a/tests_old/Query/MysqlSubqueryHavingTestCase.php +++ /dev/null @@ -1,73 +0,0 @@ -. - */ - -/** - * Doctrine_Query_MysqlSubquery_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_MysqlSubqueryHaving_TestCase extends Doctrine_UnitTestCase -{ - public function setUp() - { - $this->dbh = new Doctrine_Adapter_Mock('mysql'); - $this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); - } - - public function testGetLimitSubqueryWithHavingOnAggregateValues() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums DESC'); - $q->having('num_albums > 0'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->dbh->pop(); - - $this->assertEqual($this->dbh->pop(), 'SELECT DISTINCT e2.id, COUNT(DISTINCT a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id HAVING a2__0 > 0 ORDER BY a2__0 DESC LIMIT 5'); - } - - public function testGetLimitSubqueryWithHavingOnAggregateValuesIncorrectAlias() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums DESC'); - $q->having('num_albums > 0'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->dbh->pop(); - $this->assertEqual($this->dbh->pop(), 'SELECT DISTINCT e2.id, COUNT(a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id HAVING a2__0 > 0 ORDER BY a2__0 DESC LIMIT 5'); - } -} diff --git a/tests_old/Query/MysqlSubqueryTestCase.php b/tests_old/Query/MysqlSubqueryTestCase.php deleted file mode 100644 index 257f19a6c..000000000 --- a/tests_old/Query/MysqlSubqueryTestCase.php +++ /dev/null @@ -1,117 +0,0 @@ -. - */ - -/** - * Doctrine_Query_MysqlSubquery_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_MysqlSubquery_TestCase extends Doctrine_UnitTestCase -{ - public function setUp() - { - $this->dbh = new Doctrine_Adapter_Mock('mysql'); - $this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); - } - - public function testGetLimitSubquerSupportsOrderByWithAggregateValues() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->dbh->pop(); - - $this->assertEqual($this->dbh->pop(), 'SELECT DISTINCT e2.id, COUNT(DISTINCT a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id ORDER BY a2__0 LIMIT 5'); - } - public function testGetLimitSubquerySupportsOrderByWithAggregateValuesAndDescKeyword() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums DESC, u.name'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->dbh->pop(); - - $this->assertEqual($this->dbh->pop(), 'SELECT DISTINCT e2.id, COUNT(DISTINCT a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id ORDER BY a2__0 DESC, e2.name LIMIT 5'); - } - public function testGetLimitSubquerySupportsOrderByWithAggregateValuesAndColumns() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums, u.name'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->dbh->pop(); - - $this->assertEqual($this->dbh->pop(), 'SELECT DISTINCT e2.id, COUNT(DISTINCT a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id ORDER BY a2__0, e2.name LIMIT 5'); - } - public function testGetLimitSubquerySupportsOrderByAndHavingWithAggregateValues() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums DESC'); - $q->having('num_albums > 0'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->dbh->pop(); - - $this->assertEqual($this->dbh->pop(), 'SELECT DISTINCT e2.id, COUNT(DISTINCT a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id HAVING a2__0 > 0 ORDER BY a2__0 DESC LIMIT 5'); - } - public function testGetLimitSubquerySupportsHavingWithAggregateValues() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->having('num_albums > 0'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->dbh->pop(); - - $this->assertEqual($this->dbh->pop(), 'SELECT DISTINCT e2.id, COUNT(DISTINCT a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id HAVING a2__0 > 0 LIMIT 5'); - } -} diff --git a/tests_old/Query/OneToOneFetchingTestCase.php b/tests_old/Query/OneToOneFetchingTestCase.php deleted file mode 100644 index a386be936..000000000 --- a/tests_old/Query/OneToOneFetchingTestCase.php +++ /dev/null @@ -1,263 +0,0 @@ -. - */ - -/** - * Doctrine_Query_MultiJoin2_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_OneToOneFetching_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables[] = 'QueryTest_Category'; - $this->tables[] = 'QueryTest_Board'; - $this->tables[] = 'QueryTest_User'; - $this->tables[] = 'QueryTest_Entry'; - $this->tables[] = 'QueryTest_Rank'; - parent::prepareTables(); - } - public function testInitializeData() - { - $query = new Doctrine_Query($this->connection); - - $cat = new QueryTest_Category(); - - $cat->rootCategoryId = 0; - $cat->parentCategoryId = 0; - $cat->name = "Testcat"; - $cat->position = 0; - $cat->save(); - - $board = new QueryTest_Board(); - $board->name = "Testboard"; - $board->categoryId = $cat->id; - $board->position = 0; - $board->save(); - - $author = new QueryTest_User(); - $author->username = "romanbb"; - $author->save(); - - $lastEntry = new QueryTest_Entry(); - $lastEntry->authorId = $author->id; - $lastEntry->date = 1234; - $lastEntry->save(); - - // Set the last entry - $board->lastEntry = $lastEntry; - $board->save(); - - $visibleRank = new QueryTest_Rank(); - $visibleRank->title = "Freak"; - $visibleRank->color = "red"; - $visibleRank->icon = "freak.png"; - $visibleRank->save(); - - // grant him a rank - $author->visibleRank = $visibleRank; - $author->save(); - - } - - /** - * Tests that one-one relations are correctly loaded with array fetching - * when the related records EXIST. - * - * !!! Currently it produces a notice with: - * !!! Array to string conversion in Doctrine\Hydrate.php on line 937 - * - * !!! And shortly after exits with a fatal error: - * !!! Fatal error: Cannot create references to/from string offsets nor overloaded objects - * !!! in Doctrine\Hydrate.php on line 939 - */ - public function testOneToOneArrayFetchingWithExistingRelations() - { - $query = new Doctrine_Query($this->connection); - try { - $categories = $query->select("c.*, b.*, le.*, a.username, vr.title, vr.color, vr.icon") - ->from("QueryTest_Category c") - ->leftJoin("c.boards b") - ->leftJoin("b.lastEntry le") - ->leftJoin("le.author a") - ->leftJoin("a.visibleRank vr") - ->execute(array(), Doctrine::FETCH_ARRAY); - - // --> currently quits here with a fatal error! <-- - - // check boards/categories - $this->assertEqual(1, count($categories)); - $this->assertTrue(isset($categories[0]['boards'])); - $this->assertEqual(1, count($categories[0]['boards'])); - - // get the baord for inspection - $board = $categories[0]['boards'][0]; - - $this->assertTrue(isset($board['lastEntry'])); - - // lastentry should've 2 fields. one regular field, one relation. - //$this->assertEqual(2, count($board['lastEntry'])); - $this->assertEqual(1234, (int)$board['lastEntry']['date']); - $this->assertTrue(isset($board['lastEntry']['author'])); - - // author should've 2 fields. one regular field, one relation. - //$this->assertEqual(2, count($board['lastEntry']['author'])); - $this->assertEqual('romanbb', $board['lastEntry']['author']['username']); - $this->assertTrue(isset($board['lastEntry']['author']['visibleRank'])); - - // visibleRank should've 3 regular fields - //$this->assertEqual(3, count($board['lastEntry']['author']['visibleRank'])); - $this->assertEqual('Freak', $board['lastEntry']['author']['visibleRank']['title']); - $this->assertEqual('red', $board['lastEntry']['author']['visibleRank']['color']); - $this->assertEqual('freak.png', $board['lastEntry']['author']['visibleRank']['icon']); - - } catch (Doctrine_Exception $e) { - $this->fail(); - } - } - - /** - * Tests that one-one relations are correctly loaded with array fetching - * when the related records DONT EXIST. - */ - public function testOneToOneArrayFetchingWithEmptyRelations() - { - // temporarily remove the relation to fake a non-existant one - $board = $this->connection->query("FROM QueryTest_Board b WHERE b.name = ?", array('Testboard'))->getFirst(); - $lastEntryId = $board->lastEntryId; - $board->lastEntryId = 0; - $board->save(); - - $query = new Doctrine_Query($this->connection); - try { - $categories = $query->select("c.*, b.*, le.*, a.username, vr.title, vr.color, vr.icon") - ->from("QueryTest_Category c") - ->leftJoin("c.boards b") - ->leftJoin("b.lastEntry le") - ->leftJoin("le.author a") - ->leftJoin("a.visibleRank vr") - ->execute(array(), Doctrine::FETCH_ARRAY); - - - // check boards/categories - $this->assertEqual(1, count($categories)); - $this->assertTrue(isset($categories[0]['boards'])); - $this->assertEqual(1, count($categories[0]['boards'])); - - // get the board for inspection - $tmpBoard = $categories[0]['boards'][0]; - - $this->assertTrue( ! isset($tmpBoard['lastEntry'])); - - } catch (Doctrine_Exception $e) { - $this->fail(); - } - - $board->lastEntryId = $lastEntryId; - $board->save(); - } - - // Tests that one-one relations are correctly loaded with record fetching - // when the related records EXIST. - public function testOneToOneRecordFetchingWithExistingRelations() - { - $query = new Doctrine_Query($this->connection); - try { - $categories = $query->select("c.*, b.*, le.date, a.username, vr.title, vr.color, vr.icon") - ->from("QueryTest_Category c") - ->leftJoin("c.boards b") - ->leftJoin("b.lastEntry le") - ->leftJoin("le.author a") - ->leftJoin("a.visibleRank vr") - ->execute(); - - // check boards/categories - $this->assertEqual(1, count($categories)); - $this->assertEqual(1, count($categories[0]['boards'])); - - // get the baord for inspection - $board = $categories[0]['boards'][0]; - - $this->assertEqual(1234, (int)$board['lastEntry']['date']); - $this->assertTrue(isset($board['lastEntry']['author'])); - - $this->assertEqual('romanbb', $board['lastEntry']['author']['username']); - $this->assertTrue(isset($board['lastEntry']['author']['visibleRank'])); - - $this->assertEqual('Freak', $board['lastEntry']['author']['visibleRank']['title']); - $this->assertEqual('red', $board['lastEntry']['author']['visibleRank']['color']); - $this->assertEqual('freak.png', $board['lastEntry']['author']['visibleRank']['icon']); - - } catch (Doctrine_Exception $e) { - $this->fail(); - } - } - - - // Tests that one-one relations are correctly loaded with record fetching - // when the related records DONT EXIST. - - public function testOneToOneRecordFetchingWithEmptyRelations() - { - // temporarily remove the relation to fake a non-existant one - $board = $this->connection->query("FROM QueryTest_Board b WHERE b.name = ?", array('Testboard'))->getFirst(); - $lastEntryId = $board->lastEntryId; - $board->lastEntryId = 0; - $board->save(); - - $query = new Doctrine_Query($this->connection); - try { - $categories = $query->select("c.*, b.*, le.*, a.username, vr.title, vr.color, vr.icon") - ->from("QueryTest_Category c") - ->leftJoin("c.boards b") - ->leftJoin("b.lastEntry le") - ->leftJoin("le.author a") - ->leftJoin("a.visibleRank vr") - ->execute(); - - // check boards/categories - $this->assertEqual(1, count($categories)); - $this->assertTrue(isset($categories[0]['boards'])); - $this->assertEqual(1, count($categories[0]['boards'])); - - // get the board for inspection - $tmpBoard = $categories[0]['boards'][0]; - - $this->assertTrue( ! isset($tmpBoard['lastEntry'])); - - } catch (Doctrine_Exception $e) { - print $e; - $this->fail(); - } - - $board->lastEntryId = $lastEntryId; - //$board->save(); - } - -} diff --git a/tests_old/Query/OrderbyTestCase.php b/tests_old/Query/OrderbyTestCase.php deleted file mode 100644 index b6ddc134f..000000000 --- a/tests_old/Query/OrderbyTestCase.php +++ /dev/null @@ -1,67 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Orderby_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Orderby_TestCase extends Doctrine_UnitTestCase -{ - public function testOrderByRandomIsSupported() - { - $q = new Doctrine_Query(); - - $q->select('u.name, RANDOM() rand') - ->from('User u') - ->orderby('rand DESC'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, ((RANDOM() + 2147483648) / 4294967296) AS e__0 FROM entity e WHERE (e.type = 0) ORDER BY e__0 DESC'); - } - public function testOrderByAggregateValueIsSupported() - { - $q = new Doctrine_Query(); - - $q->select('u.name, COUNT(p.phonenumber) count') - ->from('User u') - ->leftJoin('u.Phonenumber p') - ->orderby('count DESC'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, COUNT(p.phonenumber) AS p__0 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) ORDER BY p__0 DESC'); - } - /* ticket #681 */ - public function testOrderByWithCoalesce() - { - $q = new Doctrine_Query(); - - $q->select('u.name') - ->from('User u') - ->orderby('COALESCE(u.id, u.name) DESC'); - // nonesese results expected, but query is syntatically ok. - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 0) ORDER BY COALESCE(e__id, e__name) DESC'); - } -} diff --git a/tests_old/Query/PgsqlSubqueryTestCase.php b/tests_old/Query/PgsqlSubqueryTestCase.php deleted file mode 100644 index 930e37274..000000000 --- a/tests_old/Query/PgsqlSubqueryTestCase.php +++ /dev/null @@ -1,73 +0,0 @@ -. - */ - -/** - * Doctrine_Query_PgsqlSubquery_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_PgsqlSubquery_TestCase extends Doctrine_UnitTestCase -{ - public function setUp() - { - $this->dbh = new Doctrine_Adapter_Mock('pgsql'); - $this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); - } - - public function testGetLimitSubqueryWithOrderByOnAggregateValues() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->assertEqual($this->dbh->pop(), 'SELECT e.id AS e__id, e.name AS e__name, COUNT(DISTINCT a.id) AS a__0 FROM entity e LEFT JOIN album a ON e.id = a.user_id WHERE e.id IN ' - . '(SELECT doctrine_subquery_alias.id FROM ' - . '(SELECT DISTINCT e2.id, COUNT(DISTINCT a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id ORDER BY a2__0 LIMIT 5) ' - . 'AS doctrine_subquery_alias) AND (e.type = 0) GROUP BY e.id ORDER BY a__0'); - - } - - public function testGetLimitSubqueryWithOrderByOnAggregateValuesAndColumns() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums, u.name'); - $q->groupby('u.id'); - $q->limit(5); - - $q->execute(); - - $this->assertEqual($this->dbh->pop(), 'SELECT e.id AS e__id, e.name AS e__name, COUNT(DISTINCT a.id) AS a__0 FROM entity e LEFT JOIN album a ON e.id = a.user_id WHERE e.id IN (SELECT doctrine_subquery_alias.id FROM (SELECT DISTINCT e2.id, e2.name, COUNT(DISTINCT a2.id) AS a2__0 FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id ORDER BY a2__0, e2.name LIMIT 5) AS doctrine_subquery_alias) AND (e.type = 0) GROUP BY e.id ORDER BY a__0, e.name'); - } - -} diff --git a/tests_old/Query/ReferenceModelTestCase.php b/tests_old/Query/ReferenceModelTestCase.php deleted file mode 100644 index b4c545918..000000000 --- a/tests_old/Query/ReferenceModelTestCase.php +++ /dev/null @@ -1,203 +0,0 @@ -. - */ - -/** - * Doctrine_Query_ReferenceModel_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_ReferenceModel_TestCase extends Doctrine_UnitTestCase { - public function prepareTables() { - $this->tables = array(); - $this->tables[] = "Forum_Category"; - $this->tables[] = "Forum_Entry"; - $this->tables[] = "Forum_Board"; - $this->tables[] = "Forum_Thread"; - - parent::prepareTables(); - $this->connection->clear(); - } - public function prepareData() - { } - - public function testInitializeData() { - $query = new Doctrine_Query($this->connection); - - $category = new Forum_Category(); - - $category->name = 'Root'; - $category->Subcategory[0]->name = 'Sub 1'; - $category->Subcategory[1]->name = 'Sub 2'; - $category->Subcategory[0]->Subcategory[0]->name = 'Sub 1 Sub 1'; - $category->Subcategory[0]->Subcategory[1]->name = 'Sub 1 Sub 2'; - $category->Subcategory[1]->Subcategory[0]->name = 'Sub 2 Sub 1'; - $category->Subcategory[1]->Subcategory[1]->name = 'Sub 2 Sub 2'; - - $this->connection->unitOfWork->saveAll(); - $this->connection->clear(); - - $category = $category->getRepository()->find($category->id); - - $this->assertEqual($category->name, 'Root'); - $this->assertEqual($category->Subcategory[0]->name, 'Sub 1'); - $this->assertEqual($category->Subcategory[1]->name, 'Sub 2'); - $this->assertEqual($category->Subcategory[0]->Subcategory[0]->name, 'Sub 1 Sub 1'); - $this->assertEqual($category->Subcategory[0]->Subcategory[1]->name, 'Sub 1 Sub 2'); - $this->assertEqual($category->Subcategory[1]->Subcategory[0]->name, 'Sub 2 Sub 1'); - $this->assertEqual($category->Subcategory[1]->Subcategory[1]->name, 'Sub 2 Sub 2'); - - $this->connection->clear(); - } - - public function testSelfReferencingWithNestedOrderBy() { - $query = new Doctrine_Query(); - - $query->from('Forum_Category.Subcategory.Subcategory'); - $query->orderby('Forum_Category.id ASC, Forum_Category.Subcategory.name DESC'); - - $coll = $query->execute(); - - $category = $coll[0]; - - $this->assertEqual($category->name, 'Root'); - $this->assertEqual($category->Subcategory[0]->name, 'Sub 2'); - $this->assertEqual($category->Subcategory[1]->name, 'Sub 1'); - $this->assertEqual($category->Subcategory[1]->Subcategory[0]->name, 'Sub 1 Sub 1'); - $this->assertEqual($category->Subcategory[1]->Subcategory[1]->name, 'Sub 1 Sub 2'); - $this->assertEqual($category->Subcategory[0]->Subcategory[0]->name, 'Sub 2 Sub 1'); - $this->assertEqual($category->Subcategory[0]->Subcategory[1]->name, 'Sub 2 Sub 2'); - - $this->connection->clear(); - } - - /** - public function testSelfReferencingWithDoubleNesting() { - $query = new Doctrine_Query(); - $category = new Forum_Category(); - - $query->from('Forum_Category.Subcategory.Subcategory'); - $coll = $query->execute(); - $category = $coll[0]; - - $count = count($this->dbh); - - $this->assertEqual($category->name, 'Root'); - - $this->assertEqual($count, count($this->dbh)); - $this->assertEqual($category->Subcategory[0]->name, 'Sub 1'); - $this->assertEqual($category->Subcategory[1]->name, 'Sub 2'); - - $this->assertEqual($count, count($this->dbh)); - $this->assertEqual($category->Subcategory[0]->Subcategory[0]->name, 'Sub 1 Sub 1'); - $this->assertEqual($category->Subcategory[0]->Subcategory[1]->name, 'Sub 1 Sub 2'); - $this->assertEqual($category->Subcategory[1]->Subcategory[0]->name, 'Sub 2 Sub 1'); - $this->assertEqual($category->Subcategory[1]->Subcategory[1]->name, 'Sub 2 Sub 2'); - $this->assertEqual($count, count($this->dbh)); - - $this->connection->clear(); - } - public function testSelfReferencingWithNestingAndConditions() { - $query = new Doctrine_Query(); - $query->from("Forum_Category.Parent.Parent")->where("Forum_Category.name LIKE 'Sub%Sub%'"); - $coll = $query->execute(); - - - $count = count($this->dbh); - $this->assertEqual($coll->count(), 4); - $this->assertEqual($coll[0]->name, 'Sub 1 Sub 1'); - $this->assertEqual($coll[1]->name, 'Sub 1 Sub 2'); - $this->assertEqual($coll[2]->name, 'Sub 2 Sub 1'); - $this->assertEqual($coll[3]->name, 'Sub 2 Sub 2'); - - $this->assertEqual($count, count($this->dbh)); - - $this->assertEqual($coll[0]->Parent->name, 'Sub 1'); - $this->assertEqual($coll[1]->Parent->name, 'Sub 1'); - $this->assertEqual($coll[2]->Parent->name, 'Sub 2'); - $this->assertEqual($coll[3]->Parent->name, 'Sub 2'); - - $this->assertEqual($count, count($this->dbh)); - - $this->assertEqual($coll[0]->Parent->Parent->name, 'Root'); - $this->assertEqual($coll[1]->Parent->Parent->name, 'Root'); - $this->assertEqual($coll[2]->Parent->Parent->name, 'Root'); - $this->assertEqual($coll[3]->Parent->Parent->name, 'Root'); - - $this->assertEqual($count, count($this->dbh)); - } - public function testSelfReferencingWithNestingAndMultipleConditions() { - $query = new Doctrine_Query(); - $query->from("Forum_Category.Parent, Forum_Category.Subcategory")->where("Forum_Category.name = 'Sub 1' || Forum_Category.name = 'Sub 2'"); - - - $coll = $query->execute(); - - $count = count($this->dbh); - - $this->assertEqual($coll->count(), 2); - $this->assertEqual($coll[0]->name, 'Sub 1'); - $this->assertEqual($coll[1]->name, 'Sub 2'); - - $this->assertEqual($count, count($this->dbh)); - - $this->assertEqual($coll[0]->Subcategory[0]->name, 'Sub 1 Sub 1'); - $this->assertEqual($coll[0]->Subcategory[1]->name, 'Sub 1 Sub 2'); - $this->assertEqual($coll[1]->Subcategory[0]->name, 'Sub 2 Sub 1'); - $this->assertEqual($coll[1]->Subcategory[1]->name, 'Sub 2 Sub 2'); - - $this->assertEqual($count, count($this->dbh)); - - $this->assertEqual($coll[0]->Parent->name, 'Root'); - $this->assertEqual($coll[1]->Parent->name, 'Root'); - - $this->assertEqual($count, count($this->dbh)); - - $this->connection->clear(); - } - public function testSelfReferencingWithIsNull() { - $query = new Doctrine_Query(); - $query->from('Forum_Category.Subcategory.Subcategory')->where('Forum_Category.parent_category_id IS NULL'); - $coll = $query->execute(); - $this->assertEqual($coll->count(), 1); - - $count = count($this->dbh); - $category = $coll[0]; - $this->assertEqual($category->name, 'Root'); - - $this->assertEqual($count, count($this->dbh)); - $this->assertEqual($category->Subcategory[0]->name, 'Sub 1'); - $this->assertEqual($category->Subcategory[1]->name, 'Sub 2'); - - $this->assertEqual($count, count($this->dbh)); - $this->assertEqual($category->Subcategory[0]->Subcategory[0]->name, 'Sub 1 Sub 1'); - $this->assertEqual($category->Subcategory[0]->Subcategory[1]->name, 'Sub 1 Sub 2'); - $this->assertEqual($category->Subcategory[1]->Subcategory[0]->name, 'Sub 2 Sub 1'); - $this->assertEqual($category->Subcategory[1]->Subcategory[1]->name, 'Sub 2 Sub 2'); - $this->assertEqual($count, count($this->dbh)); - } - */ -} diff --git a/tests_old/Query/RegistryTestCase.php b/tests_old/Query/RegistryTestCase.php deleted file mode 100644 index a1e85a72f..000000000 --- a/tests_old/Query/RegistryTestCase.php +++ /dev/null @@ -1,67 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Registry_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Registry_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('User'); - - parent::prepareTables(); - } - public function prepareData() - { } - - public function testAddingQueries() - { - $registry = new Doctrine_Query_Registry(); - - $registry->add('all-users', 'SELECT u.* FROM User u'); - - $this->assertEqual($registry->get('all-users')->getDql(), 'SELECT u.* FROM User u'); - } - - public function testAddingQueriesWithNamespaces() - { - $registry = new Doctrine_Query_Registry(); - - $registry->add('User.all', 'SELECT u.* FROM User u'); - - $this->assertEqual($registry->get('User.all')->getDql(), 'SELECT u.* FROM User u'); - - $this->manager->setQueryRegistry($registry); - - $user = new User(); - - $user->getEntityManager()->executeNamedQuery('User.all'); - } -} diff --git a/tests_old/Query/SelectExpressionTestCase.php b/tests_old/Query/SelectExpressionTestCase.php deleted file mode 100644 index 76b19d2d7..000000000 --- a/tests_old/Query/SelectExpressionTestCase.php +++ /dev/null @@ -1,113 +0,0 @@ -. - */ - -/** - * Doctrine_Query_SelectExpression_TestCase - * This test case is used for testing DQL SELECT expressions functionality - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_SelectExpression_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('User'); - parent::prepareTables(); - } - public function testAdditionExpression() - { - $query = new Doctrine_Query(); - $query->select('u.*, (u.id + u.id) addition'); - $query->from('User u'); - - try { - $users = $query->execute(); - $this->pass(); - } catch(Exception $e) { - $this->fail(); - } - } - - public function testSubtractionExpression() - { - $query = new Doctrine_Query(); - $query->select('u.*, (u.id - u.id) subtraction'); - $query->from('User u'); - - try { - $users = $query->execute(); - $this->pass(); - } catch(Exception $e) { - $this->fail(); - } - } - - public function testDivisionExpression() - { - $query = new Doctrine_Query(); - $query->select('u.*, (u.id/u.id) division'); - $query->from('User u'); - - try { - $users = $query->execute(); - $this->pass(); - } catch(Exception $e) { - $this->fail(); - } - } - - public function testMultiplicationExpression() - { - $query = new Doctrine_Query(); - $query->select('u.*, (u.id * u.id) multiplication'); - $query->from('User u'); - - try { - $users = $query->execute(); - $this->pass(); - } catch(Exception $e) { - $this->fail(); - } - } - - public function testOrderByExpression() - { - $query = new Doctrine_Query(); - $query->select('u.*, (u.id * u.id) multiplication'); - $query->from('User u'); - $query->orderby('multiplication asc'); - - try { - $users = $query->execute(); - $this->pass(); - } catch(Exception $e) { - $this->fail(); - } - } -} diff --git a/tests_old/Query/SelectTestCase.php b/tests_old/Query/SelectTestCase.php deleted file mode 100644 index 98ae042f5..000000000 --- a/tests_old/Query/SelectTestCase.php +++ /dev/null @@ -1,311 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Select_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() { - $this->tables = array('Email', 'Phonenumber', 'Entity', 'Groupuser'); - parent::prepareTables(); - } - - public function prepareData() { - - $groups = new Doctrine_Collection('Group'); - $groups[0]->name = 'Drama Actors'; - $groups[1]->name = 'Quality Actors'; - $groups[2]->name = 'Action Actors'; - $groups[2]['Phonenumber'][0]->phonenumber = '123 123'; - $groups->save(); - - $users = new Doctrine_Collection('User'); - - $users[0]->name = 'zYne'; - $users[0]['Email']->address = 'zYne@example.com'; - $users[0]['Phonenumber'][0]->phonenumber = '123 123'; - - $users[1]->name = 'Arnold Schwarzenegger'; - $users[1]->Email->address = 'arnold@example.com'; - $users[1]['Phonenumber'][0]->phonenumber = '123 123'; - $users[1]['Phonenumber'][1]->phonenumber = '456 456'; - $users[1]->Phonenumber[2]->phonenumber = '789 789'; - $users[1]->Group[0] = $groups[2]; - - $users[2]->name = 'Michael Caine'; - $users[2]->Email->address = 'caine@example.com'; - $users[2]->Phonenumber[0]->phonenumber = '123 123'; - - $users[3]->name = 'Takeshi Kitano'; - $users[3]->Email->address = 'kitano@example.com'; - $users[3]->Phonenumber[0]->phonenumber = '111 222 333'; - - $users[4]->name = 'Sylvester Stallone'; - $users[4]->Email->address = 'stallone@example.com'; - $users[4]->Phonenumber[0]->phonenumber = '111 555 333'; - $users[4]['Phonenumber'][1]->phonenumber = '123 213'; - $users[4]['Phonenumber'][2]->phonenumber = '444 555'; - - $users[5]->name = 'Kurt Russell'; - $users[5]->Email->address = 'russell@example.com'; - $users[5]->Phonenumber[0]->phonenumber = '111 222 333'; - - $users[6]->name = 'Jean Reno'; - $users[6]->Email->address = 'reno@example.com'; - $users[6]->Phonenumber[0]->phonenumber = '111 222 333'; - $users[6]['Phonenumber'][1]->phonenumber = '222 123'; - $users[6]['Phonenumber'][2]->phonenumber = '123 456'; - - $users[7]->name = 'Edward Furlong'; - $users[7]->Email->address = 'furlong@example.com'; - $users[7]->Phonenumber[0]->phonenumber = '111 567 333'; - - $users->save(); - } - - /* - public function testParseSelect() - { - $q = new Doctrine_Query(); - - $q->select('TRIM(u.name) name')->from('User u'); - - $q->execute(); - } - - public function testAggregateFunctionParsingSupportsMultipleComponentReferences() - { - $q = new Doctrine_Query(); - $q->select("CONCAT(u.name, ' ', e.address) value") - ->from('User u')->innerJoin('u.Email e'); - - $this->assertEqual($q->getQuery(), "SELECT CONCAT(e.name, ' ', e2.address) AS e__0 FROM entity e INNER JOIN email e2 ON e.email_id = e2.id WHERE (e.type = 0)"); - - $users = $q->execute(); - $this->assertEqual($users[0]->value, 'zYne zYne@example.com'); - } - - public function testSelectDistinctIsSupported() - { - $q = new Doctrine_Query(); - - $q->distinct()->select('u.name')->from('User u'); - - $this->assertEqual($q->getSql(), "SELECT DISTINCT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 0)"); - } - - public function testSelectDistinctIsSupported2() - { - $q = new Doctrine_Query(); - - $q->select('DISTINCT u.name')->from('User u'); - - $this->assertEqual($q->getSql(), "SELECT DISTINCT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 0)"); - } - - public function testAggregateFunctionWithDistinctKeyword() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT COUNT(DISTINCT u.name) FROM User u'); - - $this->assertEqual($q->getQuery(), 'SELECT COUNT(DISTINCT e.name) AS e__0 FROM entity e WHERE (e.type = 0)'); - } - - public function testAggregateFunction() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT COUNT(u.id) FROM User u'); - - $this->assertEqual($q->getQuery(), 'SELECT COUNT(e.id) AS e__0 FROM entity e WHERE (e.type = 0)'); - } - - public function testSelectPartSupportsMultipleAggregateFunctions() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT MAX(u.id), MIN(u.name) FROM User u'); - - $this->assertEqual($q->getQuery(), 'SELECT MAX(e.id) AS e__0, MIN(e.name) AS e__1 FROM entity e WHERE (e.type = 0)'); - } - - public function testMultipleAggregateFunctionsWithMultipleComponents() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT MAX(u.id), MIN(u.name), COUNT(p.id) FROM User u, u.Phonenumber p'); - - $this->assertEqual($q->getQuery(), 'SELECT MAX(e.id) AS e__0, MIN(e.name) AS e__1, COUNT(p.id) AS p__2 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)'); - } - - public function testEmptySelectPart() - { - $q = new Doctrine_Query(); - - try { - $q->select(null); - - $this->fail(); - } catch(Doctrine_Query_Exception $e) { - $this->pass(); - } - } - */ - public function testUnknownAggregateFunction() - { - $q = new Doctrine_Query(); - - try { - $q->parseQuery('SELECT UNKNOWN(u.id) FROM User u'); - - $q->getQuery(); - $this->fail(); - } catch(Doctrine_Query_Exception $e) { - $this->pass(); - } - } - /* - public function testAggregateFunctionValueHydration() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.id, u.name, COUNT(p.id) FROM User u LEFT JOIN u.Phonenumber p GROUP BY u.id'); - - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertEqual($users[0]['Phonenumber'][0]['COUNT'], 1); - - $this->assertEqual($users[1]['Phonenumber'][0]['COUNT'], 3); - $this->assertEqual($users[2]['Phonenumber'][0]['COUNT'], 1); - $this->assertEqual($users[3]['Phonenumber'][0]['COUNT'], 1); - $this->assertEqual($users[4]['Phonenumber'][0]['COUNT'], 3); - } - - public function testSingleComponentWithAsterisk() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.* FROM User u'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE (e.type = 0)'); - } - - public function testSingleComponentWithMultipleColumns() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.name, u.type FROM User u'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.type AS e__type FROM entity e WHERE (e.type = 0)'); - } - - public function testMultipleComponentsWithAsterisk() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.*, p.* FROM User u, u.Phonenumber p'); - - $this->assertEqual($q->getQuery(),'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)'); - } - - public function testMultipleComponentsWithMultipleColumns() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.id, u.name, p.id FROM User u, u.Phonenumber p'); - - $this->assertEqual($q->getQuery(),'SELECT e.id AS e__id, e.name AS e__name, p.id AS p__id FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)'); - } - - public function testAggregateFunctionValueHydrationWithAliases() - { - - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.id, COUNT(p.id) count FROM User u, u.Phonenumber p GROUP BY u.id'); - - $users = $q->execute(); - - $this->assertEqual($users[0]->Phonenumber[0]->count, 1); - $this->assertEqual($users[1]->Phonenumber[0]->count, 3); - $this->assertEqual($users[2]->Phonenumber[0]->count, 1); - $this->assertEqual($users[3]->Phonenumber[0]->count, 1); - $this->assertEqual($users[4]->Phonenumber[0]->count, 3); - } - - public function testMultipleAggregateFunctionValueHydrationWithAliases() - { - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.id, COUNT(p.id) count, MAX(p.phonenumber) max FROM User u, u.Phonenumber p GROUP BY u.id'); - - $users = $q->execute(); - $this->assertEqual($users[0]->Phonenumber[0]->count, 1); - $this->assertEqual($users[1]->Phonenumber[0]->count, 3); - $this->assertEqual($users[2]->Phonenumber[0]->count, 1); - $this->assertEqual($users[3]->Phonenumber[0]->count, 1); - $this->assertEqual($users[4]->Phonenumber[0]->count, 3); - - $this->assertEqual($users[0]->Phonenumber[0]->max, '123 123'); - $this->assertEqual($users[1]->Phonenumber[0]->max, '789 789'); - $this->assertEqual($users[2]->Phonenumber[0]->max, '123 123'); - $this->assertEqual($users[3]->Phonenumber[0]->max, '111 222 333'); - $this->assertEqual($users[4]->Phonenumber[0]->max, '444 555'); - } - - public function testMultipleAggregateFunctionValueHydrationWithAliasesAndCleanRecords() - { - $this->connection->clear(); - - $q = new Doctrine_Query(); - - $q->parseQuery('SELECT u.id, COUNT(p.id) count, MAX(p.phonenumber) max FROM User u, u.Phonenumber p GROUP BY u.id'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, COUNT(p.id) AS p__0, MAX(p.phonenumber) AS p__1 FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) GROUP BY e.id'); - - $users = $q->execute(); - - $this->assertEqual($users[0]->Phonenumber[0]->state(), Doctrine_Entity::STATE_TDIRTY); - - $this->assertEqual($users[0]->Phonenumber[0]->count, 1); - $this->assertEqual($users[1]->Phonenumber[0]->count, 3); - $this->assertEqual($users[2]->Phonenumber[0]->count, 1); - $this->assertEqual($users[3]->Phonenumber[0]->count, 1); - $this->assertEqual($users[4]->Phonenumber[0]->count, 3); - - $this->assertEqual($users[0]->Phonenumber[0]->max, '123 123'); - $this->assertEqual($users[1]->Phonenumber[0]->max, '789 789'); - $this->assertEqual($users[2]->Phonenumber[0]->max, '123 123'); - $this->assertEqual($users[3]->Phonenumber[0]->max, '111 222 333'); - $this->assertEqual($users[4]->Phonenumber[0]->max, '444 555'); - }*/ - -} diff --git a/tests_old/Query/ShortAliasesTestCase.php b/tests_old/Query/ShortAliasesTestCase.php deleted file mode 100644 index 6f49f25b0..000000000 --- a/tests_old/Query/ShortAliasesTestCase.php +++ /dev/null @@ -1,24 +0,0 @@ -select('u.name')->from('User u'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 0)'); - } - */ - public function testShortAliasesWithOneToManyLeftJoin() { - $q = new Doctrine_Query(); - - $q->select('u.name, p.id')->from('User u LEFT JOIN u.Phonenumber p'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, p.id AS p__id FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)'); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 8); - - } -} diff --git a/tests_old/Query/SubqueryTestCase.php b/tests_old/Query/SubqueryTestCase.php deleted file mode 100644 index 840beb6c3..000000000 --- a/tests_old/Query/SubqueryTestCase.php +++ /dev/null @@ -1,130 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Subquery_TestCase - * This test case is used for testing DQL subquery functionality - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase -{ - - public function testSubqueryWithWherePartAndInExpression() - { - $q = new Doctrine_Query(); - $q->from('User u')->where("u.id NOT IN (SELECT u2.id FROM User u2 WHERE u2.name = 'zYne')"); - - $this->assertEqual($q->getQuery(), - "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE e.id NOT IN (SELECT e2.id AS e2__id FROM entity e2 WHERE e2.name = 'zYne' AND (e.type = 0 AND (e2.type = 0 OR e2.type IS NULL))) AND (e.type = 0)"); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 7); - $this->assertEqual($users[0]->name, 'Arnold Schwarzenegger'); - } - - public function testSubqueryAllowsSelectingOfAnyField() - { - $q = new Doctrine_Query(); - $q->from('User u')->where('u.id NOT IN (SELECT g.user_id FROM Groupuser g)'); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE e.id NOT IN (SELECT g.user_id AS g__user_id FROM groupuser g WHERE (e.type = 0)) AND (e.type = 0)"); - } - - public function testSubqueryInSelectPart() - { - // ticket #307 - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT u.name, (SELECT COUNT(p.id) FROM Phonenumber p WHERE p.entity_id = u.id) pcount FROM User u WHERE u.name = 'zYne' LIMIT 1"); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, (SELECT COUNT(p.id) AS p__0 FROM phonenumber p WHERE p.entity_id = e.id AND (e.type = 0)) AS e__0 FROM entity e WHERE e.name = 'zYne' AND (e.type = 0) LIMIT 1"); - // test consequent call - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, (SELECT COUNT(p.id) AS p__0 FROM phonenumber p WHERE p.entity_id = e.id AND (e.type = 0)) AS e__0 FROM entity e WHERE e.name = 'zYne' AND (e.type = 0) LIMIT 1"); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 1); - - $this->assertEqual($users[0]->name, 'zYne'); - $this->assertEqual($users[0]->pcount, 1); - } - - public function testSubqueryInSelectPart2() - { - // ticket #307 - $q = new Doctrine_Query(); - - $q->parseQuery("SELECT u.name, (SELECT COUNT(w.id) FROM User w WHERE w.id = u.id) pcount FROM User u WHERE u.name = 'zYne' LIMIT 1"); - - $this->assertNotEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, (SELECT COUNT(e.id) AS e__0 FROM entity e WHERE e.id = e.id AND (e.type = 0)) AS e__0 FROM entity e WHERE e.name = 'zYne' AND (e.type = 0) LIMIT 1"); - - } - - public function testGetLimitSubqueryOrderBy2() - { - $q = new Doctrine_Query(); - $q->select('u.name, COUNT(DISTINCT a.id) num_albums'); - $q->from('User u, u.Album a'); - $q->orderby('num_albums'); - $q->groupby('u.id'); - - try { - // this causes getLimitSubquery() to be used, and it fails - $q->limit(5); - - $users = $q->execute(); - - $count = $users->count(); - } catch (Doctrine_Exception $e) { - $this->fail(); - } - - $this->assertEqual($q->getSql(), 'SELECT e.id AS e__id, e.name AS e__name, COUNT(DISTINCT a.id) AS a__0 FROM entity e LEFT JOIN album a ON e.id = a.user_id WHERE e.id IN (SELECT DISTINCT e2.id FROM entity e2 LEFT JOIN album a2 ON e2.id = a2.user_id WHERE (e2.type = 0) GROUP BY e2.id ORDER BY a__0 LIMIT 5) AND (e.type = 0) GROUP BY e.id ORDER BY a__0'); - } - - public function testAggregateFunctionsInOrderByAndHavingWithCount() - { - $q = new Doctrine_Query(); - - $q->select('u.*, COUNT(a.id) num_albums') - ->from('User u') - ->leftJoin('u.Album a') - ->orderby('num_albums desc') - ->groupby('u.id') - ->having('num_albums > 0') - ->limit(5); - - try { - $q->count(); - $this->pass(); - } catch (Doctrine_Exception $e) { - $this->fail(); - } - } -} diff --git a/tests_old/Query/UpdateTestCase.php b/tests_old/Query/UpdateTestCase.php deleted file mode 100644 index fde143d99..000000000 --- a/tests_old/Query/UpdateTestCase.php +++ /dev/null @@ -1,83 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Delete_TestCase - * This test case is used for testing DQL UPDATE queries - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Update_TestCase extends Doctrine_UnitTestCase -{ - - public function testUpdateAllWithColumnAggregationInheritance() - { - $q = new Doctrine_Query(); - - $q->parseQuery("UPDATE User u SET u.name = 'someone'"); - - $this->assertEqual($q->getQuery(), "UPDATE entity SET name = 'someone' WHERE (type = 0)"); - - $q = new Doctrine_Query(); - - $q->update('User u')->set('u.name', "'someone'"); - - $this->assertEqual($q->getQuery(), "UPDATE entity SET name = 'someone' WHERE (type = 0)"); - } - - public function testUpdateWorksWithMultipleColumns() - { - $q = new Doctrine_Query(); - - $q->parseQuery("UPDATE User u SET u.name = 'someone', u.email_id = 5"); - - $this->assertEqual($q->getQuery(), "UPDATE entity SET name = 'someone', email_id = 5 WHERE (type = 0)"); - - $q = new Doctrine_Query(); - - $q->update('User u')->set('u.name', "'someone'")->set('u.email_id', 5); - - $this->assertEqual($q->getQuery(), "UPDATE entity SET name = 'someone', email_id = 5 WHERE (type = 0)"); - } - - public function testUpdateSupportsConditions() - { - $q = new Doctrine_Query(); - - $q->parseQuery("UPDATE User u SET u.name = 'someone' WHERE u.id = 5"); - - $this->assertEqual($q->getQuery(), "UPDATE entity SET name = 'someone' WHERE id = 5 AND (type = 0)"); - } - public function testUpdateSupportsColumnReferencing() - { - $q = new Doctrine_Query(); - - $q->update('User u')->set('u.id', 'u.id + 1'); - - $this->assertEqual($q->getQuery(), "UPDATE entity SET id = id + 1 WHERE (type = 0)"); - } -} diff --git a/tests_old/Query/WhereTestCase.php b/tests_old/Query/WhereTestCase.php deleted file mode 100644 index 0a057ea7d..000000000 --- a/tests_old/Query/WhereTestCase.php +++ /dev/null @@ -1,327 +0,0 @@ -. - */ - -/** - * Doctrine_Query_Subquery_TestCase - * This test case is used for testing DQL WHERE part functionality - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('Entity', 'EnumTest', 'Groupuser', 'Account', 'Book'); - parent::prepareTables(); - } - - public function testDirectParameterSetting() - { - $this->connection->clear(); - - $user = new User(); - $user->name = 'someone'; - $user->save(); - - $q = new Doctrine_Query(); - - $q->from('User')->addWhere('User.id = ?', 1); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 1); - $this->assertEqual($users[0]->name, 'someone'); - } - - public function testFunctionalExpressionAreSupportedInWherePart() - { - $q = new Doctrine_Query(); - - $q->select('u.name')->from('User u')->addWhere('TRIM(u.name) = ?', 'someone'); - - $users = $q->execute(); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e WHERE TRIM(e.name) = ? AND (e.type = 0)'); - $this->assertEqual($users->count(), 1); - $this->assertEqual($users[0]->name, 'someone'); - } - - public function testArithmeticExpressionAreSupportedInWherePart() - { - $this->connection->clear(); - - $account = new Account(); - $account->amount = 1000; - $account->save(); - - $q = new Doctrine_Query(); - - $q->from('Account a')->addWhere('((a.amount + 5000) * a.amount + 3) < 10000000'); - - $accounts = $q->execute(); - - $this->assertEqual($q->getSql(), 'SELECT a.id AS a__id, a.entity_id AS a__entity_id, a.amount AS a__amount FROM account a WHERE ((a.amount + 5000) * a.amount + 3) < 10000000'); - $this->assertEqual($accounts->count(), 1); - $this->assertEqual($accounts[0]->amount, 1000); - } - - public function testDirectMultipleParameterSetting() - { - $user = new User(); - $user->name = 'someone.2'; - $user->save(); - - $q = new Doctrine_Query(); - - $q->from('User')->addWhere('User.id IN (?, ?)', array(1, 2)); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 2); - $this->assertEqual($users[0]->name, 'someone'); - $this->assertEqual($users[1]->name, 'someone.2'); - } - public function testDirectMultipleParameterSetting2() - { - $q = new Doctrine_Query(); - - $q->from('User')->where('User.id IN (?, ?)', array(1, 2)); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE e.id IN (?, ?) AND (e.type = 0)'); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 2); - $this->assertEqual($users[0]->name, 'someone'); - $this->assertEqual($users[1]->name, 'someone.2'); - - // the parameters and where part should be reseted - $q->where('User.id IN (?, ?)', array(1, 2)); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 2); - $this->assertEqual($users[0]->name, 'someone'); - $this->assertEqual($users[1]->name, 'someone.2'); - } - public function testNotInExpression() - { - $q = new Doctrine_Query(); - - $q->from('User u')->addWhere('u.id NOT IN (?)', array(1)); - $users = $q->execute(); - - $this->assertEqual($users->count(), 1); - $this->assertEqual($users[0]->name, 'someone.2'); - } - public function testExistsExpression() - { - $q = new Doctrine_Query(); - - $user = new User(); - $user->name = 'someone with a group'; - $user->Group[0]->name = 'some group'; - $user->save(); - - // find all users which have groups - try { - $q->from('User u')->where('EXISTS (SELECT g.id FROM Groupuser g WHERE g.user_id = u.id)'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $users = $q->execute(); - - $this->assertEqual($users->count(), 1); - $this->assertEqual($users[0]->name, 'someone with a group'); - } - - public function testNotExistsExpression() - { - $q = new Doctrine_Query(); - - // find all users which don't have groups - try { - $q->from('User u')->where('NOT EXISTS (SELECT Groupuser.id FROM Groupuser WHERE Groupuser.user_id = u.id)'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $users = $q->execute(); - $this->assertEqual($users->count(), 2); - $this->assertEqual($users[0]->name, 'someone'); - $this->assertEqual($users[1]->name, 'someone.2'); - } - public function testComponentAliases() - { - $q = new Doctrine_Query(); - - $q->from('User u')->addWhere('u.id IN (?, ?)', array(1,2)); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 2); - $this->assertEqual($users[0]->name, 'someone'); - $this->assertEqual($users[1]->name, 'someone.2'); - - } - public function testComponentAliases2() - { - $q = new Doctrine_Query(); - - $q->from('User u')->addWhere('u.name = ?', array('someone')); - - $users = $q->execute(); - - $this->assertEqual($users->count(), 1); - $this->assertEqual($users[0]->name, 'someone'); - } - public function testOperatorWithNoTrailingSpaces() - { - $q = new Doctrine_Query(); - - $q->select('User.id')->from('User')->where("User.name='someone'"); - - $users = $q->execute(); - $this->assertEqual($users->count(), 1); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id FROM entity e WHERE e.name = 'someone' AND (e.type = 0)"); - } - public function testOperatorWithNoTrailingSpaces2() - { - $q = new Doctrine_Query(); - - $q->select('User.id')->from('User')->where("User.name='foo.bar'"); - - $users = $q->execute(); - $this->assertEqual($users->count(), 0); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id FROM entity e WHERE e.name = 'foo.bar' AND (e.type = 0)"); - } - public function testOperatorWithSingleTrailingSpace() - { - $q = new Doctrine_Query(); - - $q->select('User.id')->from('User')->where("User.name= 'foo.bar'"); - - $users = $q->execute(); - $this->assertEqual($users->count(), 0); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id FROM entity e WHERE e.name = 'foo.bar' AND (e.type = 0)"); - } - public function testOperatorWithSingleTrailingSpace2() - { - $q = new Doctrine_Query(); - - $q->select('User.id')->from('User')->where("User.name ='foo.bar'"); - - $users = $q->execute(); - $this->assertEqual($users->count(), 0); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id FROM entity e WHERE e.name = 'foo.bar' AND (e.type = 0)"); - } - public function testDeepComponentReferencingIsSupported() - { - $q = new Doctrine_Query(); - - $q->select('u.id')->from('User u')->where("u.Group.name ='some group'"); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id WHERE e2.name = 'some group' AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - public function testDeepComponentReferencingIsSupported2() - { - $q = new Doctrine_Query(); - - $q->select('u.id')->from('User u')->addWhere("u.Group.name ='some group'"); - - $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id WHERE e2.name = 'some group' AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); - } - public function testEnumValuesWorkInPlaceholders() - { - $e = new EnumTest; - $e->status = 'verified'; - $e->save(); - - $q = new Doctrine_Query(); - - $q->select('e.*')->from('EnumTest e')->where('e.status = ?'); - - $q->getQuery(); - - $this->assertEqual(count($q->getEnumParams()), 1); - - $q->execute(array('verified')); - } - - public function testEnumValuesWorkWithMultiplePlaceholders() - { - $q = new Doctrine_Query(); - - $q->select('e.*')->from('EnumTest e')->where('e.id = ? AND e.status = ?'); - - $q->getQuery(); - - $p = $q->getEnumParams(); - $this->assertEqual(array_keys($p), array(0, 1)); - $this->assertTrue(empty($p[0])); - $q->execute(array(1, 'verified')); - } - - public function testEnumValuesWorkWithMultipleNamedPlaceholders() - { - $q = new Doctrine_Query(); - - $q->select('e.*')->from('EnumTest e')->where('e.id = :id AND e.status = :status'); - - $q->getQuery(); - - $p = $q->getEnumParams(); - $this->assertEqual(array_keys($p), array(':id', ':status')); - $this->assertTrue(empty($p[':id'])); - $q->execute(array(1, 'verified')); - } - - public function testLiteralValueAsInOperatorOperandIsSupported() - { - $q = new Doctrine_Query(); - - $q->select('u.id')->from('User u')->where('1 IN (1, 2)'); - - $this->assertEqual($q->getSql(), 'SELECT e.id AS e__id FROM entity e WHERE 1 IN (1, 2) AND (e.type = 0)'); - } - - public function testCorrelatedSubqueryWithInOperatorIsSupported() - { - $q = new Doctrine_Query(); - - $q->select('u.id')->from('User u')->where('u.name IN (SELECT u2.name FROM User u2 WHERE u2.id = u.id)'); - - $this->assertEqual($q->getSql(), 'SELECT e.id AS e__id FROM entity e WHERE e.name IN (SELECT e2.name AS e2__name FROM entity e2 WHERE e2.id = e.id AND (e.type = 0 AND (e2.type = 0 OR e2.type IS NULL))) AND (e.type = 0)'); - } -} diff --git a/tests_old/QueryTestCase.php b/tests_old/QueryTestCase.php deleted file mode 100644 index 8bc130b03..000000000 --- a/tests_old/QueryTestCase.php +++ /dev/null @@ -1,133 +0,0 @@ -. - */ - -/** - * Doctrine_Query_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Query_TestCase extends Doctrine_UnitTestCase -{ - - public function testGetQueryHookResetsTheManuallyAddedDqlParts() - { - $q = new MyQuery(); - - $q->from('User u'); - - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE e.id = 4 AND (e.type = 0)'); - - // test consequent calls - $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE e.id = 4 AND (e.type = 0)'); - } - - - public function testParseClauseSupportsArithmeticOperators() - { - $q = new Doctrine_Query(); - - $str = $q->parseClause('2 + 3'); - - $this->assertEqual($str, '2 + 3'); - - $str = $q->parseClause('2 + 3 - 5 * 6'); - - $this->assertEqual($str, '2 + 3 - 5 * 6'); - } - - public function testParseClauseSupportsArithmeticOperatorsWithFunctions() - { - $q = new Doctrine_Query(); - - $str = $q->parseClause('ACOS(2) + 3'); - - $this->assertEqual($str, 'ACOS(2) + 3'); - } - - public function testParseClauseSupportsArithmeticOperatorsWithParenthesis() - { - $q = new Doctrine_Query(); - - $str = $q->parseClause('(3 + 3)*3'); - - $this->assertEqual($str, '(3 + 3)*3'); - - $str = $q->parseClause('((3 + 3)*3 - 123) * 12 * (13 + 31)'); - - $this->assertEqual($str, '((3 + 3)*3 - 123) * 12 * (13 + 31)'); - } - - public function testParseClauseSupportsArithmeticOperatorsWithParenthesisAndFunctions() - { - $q = new Doctrine_Query(); - - $str = $q->parseClause('(3 + 3)*ACOS(3)'); - - $this->assertEqual($str, '(3 + 3)*ACOS(3)'); - - $str = $q->parseClause('((3 + 3)*3 - 123) * ACOS(12) * (13 + 31)'); - - $this->assertEqual($str, '((3 + 3)*3 - 123) * ACOS(12) * (13 + 31)'); - } - - public function testParseClauseSupportsComponentReferences() - { - $q = new Doctrine_Query(); - $q->from('User u')->leftJoin('u.Phonenumber p'); - $q->getQuery(); - //Doctrine::dump($q->getCachedForm(array('foo' => 'bar'))); - $this->assertEqual($q->parseClause("CONCAT('u.name', u.name)"), "'u.name' || e.name"); - } - - public function testUsingDuplicateClassAliasThrowsException() - { - $q = new Doctrine_Query(); - $q->from('User u')->leftJoin('u.Phonenumber u'); - try { - $q->getSqlQuery(); - $this->fail(); - } catch (Doctrine_Query_Exception $e) { - $this->pass(); - } - - $q = new Doctrine_Query(); - $q->parseDqlQuery('FROM User u, u.Phonenumber u'); - try { - $q->getSqlQuery(); - $this->fail(); - } catch (Doctrine_Query_Exception $e) { - $this->pass(); - } - } -} -class MyQuery extends Doctrine_Query -{ - public function preQuery() - { - $this->where('u.id = 4'); - } -} diff --git a/tests_old/RawSqlTestCase.php b/tests_old/RawSqlTestCase.php deleted file mode 100644 index cf1dcef37..000000000 --- a/tests_old/RawSqlTestCase.php +++ /dev/null @@ -1,298 +0,0 @@ -. - */ - -/** - * Doctrine_RawSql_TestCase - * This class tests the functinality of Doctrine_RawSql component - * - * @package Doctrine - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision: 1181 $ - * @author Konsta Vesterinen - */ -class Doctrine_RawSql_TestCase extends Doctrine_UnitTestCase -{ - public function testQueryParser() - { - $sql = 'SELECT {p.*} FROM photos p'; - $query = new Doctrine_RawSql($this->connection); - $query->parseQuery($sql); - - $this->assertEqual($query->getQueryPart('from'), array('photos p')); - - - $sql = 'SELECT {p.*} FROM (SELECT p.* FROM photos p LEFT JOIN photos_tags t ON t.photo_id = p.id WHERE t.tag_id = 65) p LEFT JOIN photos_tags t ON t.photo_id = p.id WHERE p.can_see = -1 AND t.tag_id = 62 LIMIT 200'; - $query->parseQuery($sql); - - $this->assertEqual($query->getQueryPart('from'), array('(SELECT p.* FROM photos p LEFT JOIN photos_tags t ON t.photo_id = p.id WHERE t.tag_id = 65) p LEFT JOIN photos_tags t ON t.photo_id = p.id')); - $this->assertEqual($query->getQueryPart('where'), array('p.can_see = -1 AND t.tag_id = 62')); - $this->assertEqual($query->getQueryPart('limit'), array(200)); - } - - public function testAsteriskOperator() - { - // Selecting with * - - $query = new Doctrine_RawSql($this->connection); - $query->parseQuery('SELECT {entity.*} FROM entity'); - $fields = $query->getFields(); - - $this->assertEqual($fields, array('entity.*')); - - $query->addComponent('entity', 'Entity'); - - $coll = $query->execute(); - - $this->assertEqual($coll->count(), 11); - } - - public function testLazyPropertyLoading() - { - $query = new Doctrine_RawSql($this->connection); - $this->connection->clear(); - - // selecting proxy objects (lazy property loading) - - $query->parseQuery('SELECT {entity.name}, {entity.id} FROM entity'); - $fields = $query->getFields(); - - $this->assertEqual($fields, array('entity.name', 'entity.id')); - $query->addComponent('entity', 'Entity'); - - $coll = $query->execute(); - - $this->assertEqual($coll->count(), 11); - - $this->assertEqual($coll[0]->state(), Doctrine_Entity::STATE_PROXY); - $this->assertEqual($coll[3]->state(), Doctrine_Entity::STATE_PROXY); - } - public function testSmartMapping() - { - $query = new Doctrine_RawSql($this->connection); - // smart component mapping (no need for additional addComponent call - - $query->parseQuery('SELECT {entity.name}, {entity.id} FROM entity'); - $fields = $query->getFields(); - - $this->assertEqual($fields, array('entity.name', 'entity.id')); - - $coll = $query->execute(); - - $this->assertEqual($coll->count(), 11); - - $this->assertEqual($coll[0]->state(), Doctrine_Entity::STATE_PROXY); - $this->assertEqual($coll[3]->state(), Doctrine_Entity::STATE_PROXY); - } - - public function testMultipleComponents() - { - $query = new Doctrine_RawSql($this->connection); - // multi component fetching - - $query->parseQuery('SELECT {entity.name}, {entity.id}, {phonenumber.*} FROM entity LEFT JOIN phonenumber ON phonenumber.entity_id = entity.id'); - - $query->addComponent('entity', 'Entity'); - - $query->addComponent('phonenumber', 'Entity.Phonenumber'); - - $coll = $query->execute(); - $this->assertEqual($coll->count(), 11); - - $count = $this->conn->count(); - - $coll[4]->Phonenumber[0]->phonenumber; - $this->assertEqual($count, $this->conn->count()); - - $coll[5]->Phonenumber[0]->phonenumber; - $this->assertEqual($count, $this->conn->count()); - } - - public function testAliasesAreSupportedInAddComponent() - { - $query = new Doctrine_RawSql(); - $query->parseQuery('SELECT {entity.name}, {entity.id}, {phonenumber.*} FROM entity LEFT JOIN phonenumber ON phonenumber.entity_id = entity.id'); - - $query->addComponent('entity', 'Entity e'); - $query->addComponent('phonenumber', 'e.Phonenumber'); - - $this->assertEqual(array_keys($query->getAliasMap()), array('e', 'e.Phonenumber')); - - $coll = $query->execute(); - $this->assertEqual($coll->count(), 11); - - $count = $this->conn->count(); - - $coll[4]['Phonenumber'][0]['phonenumber']; - $this->assertEqual($count, $this->conn->count()); - - $coll[5]['Phonenumber'][0]['phonenumber']; - $this->assertEqual($count, $this->conn->count()); - } - public function testPrimaryKeySelectForcing() - { - // forcing the select of primary key fields - - $query = new Doctrine_RawSql($this->connection); - - $query->parseQuery('SELECT {entity.name} FROM entity'); - - $coll = $query->execute(); - - $this->assertEqual($coll->count(), 11); - $this->assertTrue(is_numeric($coll[0]->id)); - $this->assertTrue(is_numeric($coll[3]->id)); - $this->assertTrue(is_numeric($coll[7]->id)); - } - - public function testConvenienceMethods() - { - - $query = new Doctrine_RawSql($this->connection); - $query->select('{entity.name}')->from('entity'); - $query->addComponent('entity', 'User'); - - $coll = $query->execute(); - - $this->assertEqual($coll->count(), 8); - $this->assertTrue(is_numeric($coll[0]->id)); - $this->assertTrue(is_numeric($coll[3]->id)); - $this->assertTrue(is_numeric($coll[7]->id)); - } - - public function testColumnAggregationInheritance() - { - // forcing the select of primary key fields - - $query = new Doctrine_RawSql($this->connection); - - $query->parseQuery('SELECT {entity.name} FROM entity'); - $query->addComponent('entity', 'User'); - $coll = $query->execute(); - - $this->assertEqual($coll->count(), 8); - $this->assertTrue(is_numeric($coll[0]->id)); - $this->assertTrue(is_numeric($coll[3]->id)); - $this->assertTrue(is_numeric($coll[7]->id)); - } - - public function testColumnAggregationInheritanceWithOrderBy() - { - // forcing the select of primary key fields - - $query = new Doctrine_RawSql($this->connection); - - $query->parseQuery('SELECT {entity.name} FROM entity ORDER BY entity.name'); - $query->addComponent('entity', 'User'); - - $this->assertEqual($query->getQuery(), "SELECT entity.name AS entity__name, entity.id AS entity__id FROM entity WHERE entity.type = 0 ORDER BY entity.name"); - - - $coll = $query->execute(); - - $this->assertEqual($coll->count(), 8); - $this->assertTrue(is_numeric($coll[0]->id)); - $this->assertTrue(is_numeric($coll[3]->id)); - $this->assertTrue(is_numeric($coll[7]->id)); - - } - - public function testQueryParser2() - { - $query = new Doctrine_RawSql(); - - $query->parseQuery("SELECT {entity.name} FROM (SELECT entity.name FROM entity WHERE entity.name = 'something') WHERE entity.id = 2 ORDER BY entity.name"); - - $this->assertEqual($query->getQuery(), - "SELECT entity.name AS entity__name, entity.id AS entity__id FROM (SELECT entity.name FROM entity WHERE entity.name = 'something') WHERE entity.id = 2 AND (entity.type = 2 OR entity.type = 1 OR entity.type = 0) ORDER BY entity.name"); - } - - public function testSelectingWithoutIdentifiersOnRootComponent() - { - $query = new Doctrine_RawSql(); - - $query->parseQuery('SELECT {entity.name}, {phonenumber.*} FROM entity LEFT JOIN phonenumber ON phonenumber.entity_id = entity.id LIMIT 3'); - $query->addComponent('entity', 'Entity'); - $query->addComponent('phonenumber', 'Entity.Phonenumber'); - $this->assertEqual($query->getSql(), 'SELECT entity.name AS entity__name, entity.id AS entity__id, phonenumber.id AS phonenumber__id, phonenumber.phonenumber AS phonenumber__phonenumber, phonenumber.entity_id AS phonenumber__entity_id FROM entity LEFT JOIN phonenumber ON phonenumber.entity_id = entity.id WHERE (entity.type = 2 OR entity.type = 1 OR entity.type = 0) LIMIT 3'); - $coll = $query->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertEqual(count($coll), 3); - } - - public function testSwitchingTheFieldOrder() - { - $query = new Doctrine_RawSql(); - - $query->parseQuery('SELECT {phonenumber.*}, {entity.name} FROM entity LEFT JOIN phonenumber ON phonenumber.entity_id = entity.id LIMIT 3'); - $query->addComponent('entity', 'Entity'); - $query->addComponent('phonenumber', 'Entity.Phonenumber'); - $this->assertEqual($query->getSql(), 'SELECT entity.name AS entity__name, entity.id AS entity__id, phonenumber.id AS phonenumber__id, phonenumber.phonenumber AS phonenumber__phonenumber, phonenumber.entity_id AS phonenumber__entity_id FROM entity LEFT JOIN phonenumber ON phonenumber.entity_id = entity.id WHERE (entity.type = 2 OR entity.type = 1 OR entity.type = 0) LIMIT 3'); - $coll = $query->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertEqual(count($coll), 3); - } - - public function testParseQueryPartShouldAddPartIfNotSelectAndAppend() - { - $query = new Doctrine_Rawsql(); - $query->parseQueryPart("test", "test", true); - $parts = $query->getParts(); - $this->assertTrue(isset($parts["test"])); - $this->assertTrue(is_array($parts["test"])); - $this->assertTrue(isset($parts["test"][0])); - $this->assertEqual("test", $parts["test"][0]); - } - - public function testParseQueryShouldExtractGroupBy() - { - $query = new Doctrine_RawSql(); - $query->parseQuery("having group"); - $parts = $query->getParts(); - $this->assertEqual($parts["having"][0], "group"); - } - - public function testThrowExceptionIfFieldNameIsOnWrongForm() - { - $query = new Doctrine_RawSql(); - $query->parseQueryPart("select", "{test}"); - try{ - $query->getQuery(); - $this->fail("Should throw exception"); - }catch(Doctrine_RawSql_Exception $exception){ - $this->assertEqual($exception->getMessage(), "All selected fields in Sql query must be in format tableAlias.fieldName"); - } - } - - public function testThrowExceptionIfAliasDoesNotExist() - { - $query = new Doctrine_RawSql(); - $query->parseQueryPart("select", "{test.test}"); - try{ - $query->getQuery(); - $this->fail("Should throw exception"); - }catch(Doctrine_RawSql_Exception $exception){ - $this->assertEqual($exception->getMessage(), "The associated component for table alias test couldn't be found."); - } - } -} diff --git a/tests_old/Record/FilterTestCase.php b/tests_old/Record/FilterTestCase.php deleted file mode 100644 index bda5cc956..000000000 --- a/tests_old/Record/FilterTestCase.php +++ /dev/null @@ -1,104 +0,0 @@ -. - */ - -/** - * Doctrine_Record_Filter_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Record_Filter_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('CompositeRecord', 'RelatedCompositeRecord'); - - parent::prepareTables(); - } - public function testStandardFiltersThrowsExceptionWhenGettingUnknownProperties() - { - $u = new User(); - - try { - $u->unknown; - - $this->fail(); - } catch (Doctrine_Record_Exception $e) { - $this->pass(); - } - } - - public function testStandardFiltersThrowsExceptionWhenSettingUnknownProperties() - { - $u = new User(); - - try { - $u->unknown = 'something'; - - $this->fail(); - } catch (Doctrine_Record_Exception $e) { - $this->pass(); - } - } - - public function testCompoundFilterSupportsAccessingRelatedComponentProperties() - { - $u = new CompositeRecord(); - - try { - $u->name = 'someone'; - $u->address = 'something'; - - $u->save(); - - $this->assertEqual($u->name, 'someone'); - $this->assertEqual($u->address, 'something'); - $this->assertEqual($u->Related->address, 'something'); - } catch (Doctrine_Record_Exception $e) { - $this->fail(); - } - } -} -class CompositeRecord extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setColumn('name', 'string'); - $class->hasOne('RelatedCompositeRecord as Related', array('local' => 'id', 'foreign' => 'foreign_id')); - - $class->unshiftFilter(new Doctrine_Record_Filter_Compound(array('Related'))); - } -} -class RelatedCompositeRecord extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setColumn('address', 'string'); - $class->setColumn('foreign_id', 'integer'); - } -} diff --git a/tests_old/Record/HookTestCase.php b/tests_old/Record/HookTestCase.php deleted file mode 100644 index c132dec48..000000000 --- a/tests_old/Record/HookTestCase.php +++ /dev/null @@ -1,103 +0,0 @@ -. - */ - -/** - * Doctrine_Record_Hook_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Record_Hook_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('RecordHookTest', 'SoftDeleteTest'); - - parent::prepareTables(); - } - - public function testInsertHooksGetInvoked() - { - $r = new RecordHookTest(); - - $r->name = 'record'; - $r->save(); - - $this->assertEqual($r->pop(), 'postSave'); - $this->assertEqual($r->pop(), 'postInsert'); - $this->assertEqual($r->pop(), 'preInsert'); - $this->assertEqual($r->pop(), 'preSave'); - } - - public function testUpdateHooksGetInvoked() - { - $records = Doctrine_Query::create()->from('RecordHookTest t')->where("t.name = 'record'")->execute(); - $r = $records[0]; - - $r->name = 'record 2'; - $r->save(); - - $this->assertEqual($r->pop(), 'postSave'); - $this->assertEqual($r->pop(), 'postUpdate'); - $this->assertEqual($r->pop(), 'preUpdate'); - $this->assertEqual($r->pop(), 'preSave'); - } - - public function testDeleteHooksGetInvoked() - { - $records = Doctrine_Query::create()->from('RecordHookTest t')->where("t.name = 'record 2'")->execute(); - $r = $records[0]; - - $r->delete(); - - $this->assertEqual($r->pop(), 'postDelete'); - $this->assertEqual($r->pop(), 'preDelete'); - } - - /*public function testSoftDelete() - { - $r = new SoftDeleteTest(); - $r->name = 'something'; - $r->something ='something'; - $r->save(); - - $this->assertEqual($r->name, 'something'); - $this->assertEqual($r->something, 'something'); - - $this->assertEqual($r->deleted, null); - $this->assertEqual($r->state(), Doctrine_Entity::STATE_CLEAN); - - try { - $r->delete(); - $this->assertEqual($r->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($r->deleted, true); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - }*/ -} diff --git a/tests_old/Record/InheritanceTestCase.php b/tests_old/Record/InheritanceTestCase.php deleted file mode 100644 index f6c4f6dca..000000000 --- a/tests_old/Record/InheritanceTestCase.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Record_Inheritance_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array_merge($this->tables, array('SymfonyRecord')); - parent::prepareTables(); - } - public function prepareData() - { - parent::prepareData(); - } - - public function testInit() - { - $record = new SymfonyRecord(); - $record['name'] = 'Test me'; - $record->save(); - } - - public function testInstantiatingRecordWithAbstractParents() - { - // load our record - $record = Doctrine_Query::create()->query( - 'SELECT * FROM SymfonyRecord r', array())->getFirst(); - - // did we get a record object? - $this->assertTrue($record instanceof SymfonyRecord); - $this->assertTrue($record->exists()); - - // does it have the appropriate parentage? - $this->assertTrue($record instanceof PluginSymfonyRecord); - $this->assertTrue($record instanceof BaseSymfonyRecord); - $this->assertTrue($record instanceof Doctrine_Entity); - - // does it have the expected data? - $this->assertEqual($record['name'], 'Test me'); - - - } -} diff --git a/tests_old/Record/LockTestCase.php b/tests_old/Record/LockTestCase.php deleted file mode 100644 index b061918cd..000000000 --- a/tests_old/Record/LockTestCase.php +++ /dev/null @@ -1,23 +0,0 @@ -tables[] = 'rec1'; - $this->tables[] = 'rec2'; - parent::prepareTables(); - } - - public function prepareData() { } - - public function testDeleteRecords() - { - $rec1 = new Rec1(); - $rec1->first_name = 'Some name'; - $rec1->Account = new Rec2(); - $rec1->Account->address = 'Some address'; - $rec1->save(); - - $rec1->delete(); - $this->pass(); - } -} diff --git a/tests_old/Record/SaveBlankRecordTestCase.php b/tests_old/Record/SaveBlankRecordTestCase.php deleted file mode 100644 index 65c891a74..000000000 --- a/tests_old/Record/SaveBlankRecordTestCase.php +++ /dev/null @@ -1,62 +0,0 @@ -. - */ - -/** - * Doctrine_Record_State_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Record_SaveBlankRecord_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = 'MyUserGroup'; - - parent::prepareTables(); - } - - public function prepareData() - { } - - public function testSaveBlankRecord() - { - $user = new User(); - $user->state('TDIRTY'); - $user->save(); - - $this->assertTrue(isset($user['id'])); - } - - public function testSaveBlankRecord2() - { - $myUserGroup = new MyUserGroup(); - $myUserGroup->state('TDIRTY'); - $myUserGroup->save(); - - $this->assertTrue(isset($user['id'])); - } -} diff --git a/tests_old/Record/SerializeUnserializeTestCase.php b/tests_old/Record/SerializeUnserializeTestCase.php deleted file mode 100644 index 1974781ed..000000000 --- a/tests_old/Record/SerializeUnserializeTestCase.php +++ /dev/null @@ -1,117 +0,0 @@ -. - */ - -/** - * Doctrine_Record_SerializeUnserialize_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Record_SerializeUnserialize_TestCase extends Doctrine_UnitTestCase -{ - - public function prepareTables() - { - $this->tables[] = 'SerializeTest'; - - parent::prepareTables(); - } - - public function prepareData() - { } - - public function testSerializeUnserialize() - { - $object = new SerializeTest(); - $object->booltest = true; - $object->integertest = 13; - $object->floattest = 0.13; - $object->stringtest = 'string'; - $object->arraytest = array(1, 2, 3); - $object->objecttest = new TestObject(13); - $object->enumtest = 'java'; - $object->blobtest = 'blobtest'; - $object->clobtest = 'clobtest'; - $object->gziptest = 'gziptest'; - $object->timestamptest = '2007-08-07 11:55:00'; - $object->timetest = '11:55:00'; - $object->datetest = '2007-08-07'; - - $object->save(); - - $object_before = clone($object); - $serialized = serialize($object); - $object_after = unserialize($serialized); - - $this->assertIdentical($object_before->booltest, $object_after->booltest); - $this->assertIdentical($object_before->integertest, $object_after->integertest); - $this->assertIdentical($object_before->floattest, $object_after->floattest); - $this->assertIdentical($object_before->stringtest, $object_after->stringtest); - $this->assertIdentical($object_before->arraytest, $object_after->arraytest); - - $this->assertIdentical($object_before->enumtest, $object_after->enumtest); - //$this->assertEqual($object_before->objecttest, $object_after->objecttest); - $this->assertIdentical($object_before->blobtest, $object_after->blobtest); - $this->assertIdentical($object_before->clobtest, $object_after->clobtest); - $this->assertIdentical($object_before->gziptest, $object_after->gziptest); - $this->assertIdentical($object_before->timestamptest, $object_after->timestamptest); - $this->assertIdentical($object_before->timetest, $object_after->timetest); - $this->assertIdentical($object_before->datetest, $object_after->datetest); - - } - - public function testSerializeUnserializeRecord() - { - $test = new TestRecord(); - $test->save(); - - $object = new SerializeTest(); - $object->objecttest = $test; - - $object->save(); - - $object_before = clone($object); - - $serialized = serialize($object); - $object_after = unserialize($serialized); - - $this->assertIdentical(get_class($object_after->objecttest), 'TestRecord'); - } - -} - -class TestObject -{ - - private $test_field; - - public function __construct($value) - { - $this->test_field = $value; - } - -} - diff --git a/tests_old/Record/StateTestCase.php b/tests_old/Record/StateTestCase.php deleted file mode 100644 index 73c9dbdbe..000000000 --- a/tests_old/Record/StateTestCase.php +++ /dev/null @@ -1,253 +0,0 @@ -. - */ - -/** - * Doctrine_Record_State_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('Entity'); - - parent::prepareTables(); - } - - public function prepareData() - { } - - public function testAssigningAutoincId() - { - $user = new User(); - - $this->assertEqual($user->id, null); - - $user->name = 'zYne'; - - $user->save(); - - $this->assertEqual($user->id, 1); - - $user->id = 2; - - $this->assertEqual($user->id, 2); - - $user->save(); - } - - /** - public function testAssignFieldsToProxies() - { - $user = new User(); - $user->name = 'someuser'; - $user->password = '123'; - $user->save(); - - $this->connection->clear(); - - $user = $this->connection->queryOne("SELECT u.name FROM User u WHERE u.name = 'someuser'"); - $this->assertEqual($user->name, 'someuser'); - - $user->name = 'someother'; - $this->assertEqual($user->name, 'someother'); - - $user->save(); - $this->assertEqual($user->name, 'someother'); - } - - public function testAssignUnknownState() - { - $user = new User(); - try { - $user->state(123123); - $this->fail(); - } catch(Doctrine_Record_State_Exception $e) { - $this->pass(); - } - $this->assertEqual($user->state(), Doctrine_Entity::STATE_TCLEAN); - try { - $user->state('some unknown state'); - $this->fail(); - } catch(Doctrine_Entity_State_Exception $e) { - $this->pass(); - } - $this->assertEqual($user->state(), Doctrine_Entity::STATE_TCLEAN); - } - - public function testAssignDirtyState() - { - $user = new User(); - - $user->state(Doctrine_Entity::STATE_DIRTY); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_DIRTY); - - $user->state('dirty'); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_DIRTY); - } - - public function testAssignCleanState() - { - $user = new User(); - - $user->state(Doctrine_Entity::STATE_CLEAN); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_CLEAN); - - $user->state('clean'); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_CLEAN); - } - - public function testAssignTransientCleanState() - { - $user = new User(); - - $user->state(Doctrine_Entity::STATE_TCLEAN); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_TCLEAN); - - $user->state('tclean'); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_TCLEAN); - } - - public function testAssignTransientDirtyState() - { - $user = new User(); - - $user->state(Doctrine_Entity::STATE_TDIRTY); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_TDIRTY); - - $user->state('tdirty'); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_TDIRTY); - } - - public function testAssignProxyState() - { - $user = new User(); - - $user->state(Doctrine_Entity::STATE_PROXY); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_PROXY); - - $user->state('proxy'); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_PROXY); - } - - public function testProxiesAreAutomaticallyUpdatedWithFetches() - { - $user = new User(); - $user->name = 'someuser'; - $user->password = '123'; - $user->save(); - - $this->connection->clear(); - - $user = $this->connection->queryOne("SELECT u.name FROM User u WHERE u.name = 'someuser'"); - - $this->assertEqual($user->state(), Doctrine_Entity::STATE_PROXY); - - $user2 = $this->connection->queryOne("FROM User u WHERE u.name = 'someuser'"); - - $this->assertEqual($user->getOID(), $user2->getOID()); - - $count = count($this->dbh); - - $this->assertEqual($user->password, '123'); - - $this->assertEqual($count, count($this->dbh)); - } - - public function testProxyToDirtyToProxy() { - - define('UNAME','someuser') ; - define('UPWD1','123') ; - define('UPWD2','456') ; - define('ULNAME','somelogin') ; - - $user = new User() ; - $user->name = UNAME ; - $user->password = UPWD1 ; - $user->loginname = ULNAME ; - $user->save() ; - - $this->assertEqual($user->name,UNAME) ; - $this->assertEqual($user->password,UPWD1) ; - $this->assertEqual($user->loginname,ULNAME) ; - - // to make sure it is saved correctly - $user1 = $this->connection->queryOne("FROM User u WHERE u.name = '" . UNAME . "'"); - $this->assertEqual($user1->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($user1->name,UNAME) ; - $this->assertEqual($user1->password,UPWD1) ; - $this->assertEqual($user1->loginname,ULNAME) ; - - $this->connection->clear() ; - //$this->clearCache() ; - - // now lets fetch partially the object - //$users = Doctrine_Query::create($this->connection)->select('u.name')->from('User u')->where("u.name='someuser'")->execute() ; - //$user2 = $users[0] ; - $user2 = $this->connection->queryOne("SELECT u.name FROM User u WHERE u.name = '" . UNAME . "'"); - - // the object should be in state proxy with only 'name' fetched ... - $this->assertEqual($user2->state(), Doctrine_Entity::STATE_PROXY); - $this->assertEqual($user2->name,UNAME) ; - $this->assertEqual($user2->password,null) ; - $this->assertEqual($user2->loginname,null) ; - - // lets edit the object - $user2->password = UPWD2 ; - - // now it should be dirty (but may be PDIRTY ... ?) - $this->assertEqual($user2->state(),Doctrine_Entity::STATE_DIRTY) ; - $this->assertEqual($user2->name,UNAME) ; - $this->assertEqual($user2->password,UPWD2) ; - $this->assertEqual($user2->loginname,null) ; - - // lets save - $user2->save() ; - - // the logic would suggest the object to go back to PROXY mode (becausse $user2->loginname is null aka not sync with DB) - $boolState = ($user2->loginname == null) && ($user2->state() === Doctrine_Entity::STATE_PROXY) ; - // this one will currently fail - $this->assertTrue($boolState) ; - // this will also currently fail (becausse it currently goes back to STATE_CLEAN, which shouldnt be the case) - //$this->assertEqual($user2->state(), Doctrine_Entity::STATE_PROXY); - $this->assertEqual($user2->name,UNAME) ; - $this->assertEqual($user2->password,UPWD2) ; - $this->assertEqual($user2->loginname,null) ; - } - */ -} diff --git a/tests_old/Record/SynchronizeTestCase.php b/tests_old/Record/SynchronizeTestCase.php deleted file mode 100644 index b4883afa7..000000000 --- a/tests_old/Record/SynchronizeTestCase.php +++ /dev/null @@ -1,121 +0,0 @@ -. - */ - -/** - * Doctrine_Record_State_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Record_Synchronize_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - parent::prepareTables(); - } - - public function prepareData() - { - $user = new User(); - $user->name = 'John'; - $user->Email->address = 'john@mail.com'; - $user->Phonenumber[0]->phonenumber = '555 123'; - $user->Phonenumber[1]->phonenumber = '555 448'; - $user->save(); - } - - public function testSynchronizeRecord() - { - $user = Doctrine_Query::create()->from('User u, u.Email, u.Phonenumber')->fetchOne(); - $userArray = $user->toArray(true); - $this->assertEqual($user->Phonenumber->count(), 2); - $this->assertEqual($user->Phonenumber[0]->phonenumber, '555 123'); - - // modify a Phonenumber - $userArray['Phonenumber'][0]['phonenumber'] = '555 321'; - - // delete a Phonenumber - array_pop($userArray['Phonenumber']); - - $user->synchronizeFromArray($userArray); - $this->assertEqual($user->Phonenumber->count(), 1); - $this->assertEqual($user->Phonenumber[0]->phonenumber, '555 321'); - - // change Email - $userArray['Email']['address'] = 'johndow@mail.com'; - $user->synchronizeFromArray($userArray); - $this->assertEqual($user->Email->address, 'johndow@mail.com'); - - $user->save(); - } - - public function testSynchronizeAfterSaveRecord() - { - $user = Doctrine_Query::create()->from('User u, u.Email, u.Phonenumber')->fetchOne(); - $this->assertEqual($user->Phonenumber->count(), 1); - $this->assertEqual($user->Phonenumber[0]->phonenumber, '555 321'); - $this->assertEqual($user->Email->address, 'johndow@mail.com'); - } - - public function testSynchronizeAddRecord() - { - $user = Doctrine_Query::create()->from('User u, u.Email, u.Phonenumber')->fetchOne(); - $userArray = $user->toArray(true); - $userArray['Phonenumber'][] = array('phonenumber' => '333 238'); - - $user->synchronizeFromArray($userArray); - $this->assertEqual($user->Phonenumber->count(), 2); - $this->assertEqual($user->Phonenumber[1]->phonenumber, '333 238'); - $user->save(); - } - - public function testSynchronizeAfterAddRecord() - { - $user = Doctrine_Query::create()->from('User u, u.Email, u.Phonenumber')->fetchOne(); - $this->assertEqual($user->Phonenumber->count(), 2); - $this->assertEqual($user->Phonenumber[1]->phonenumber, '333 238'); - } - - public function testSynchronizeRemoveRecord() - { - $user = Doctrine_Query::create()->from('User u, u.Email, u.Phonenumber')->fetchOne(); - $userArray = $user->toArray(true); - unset($userArray['Phonenumber']); - unset($userArray['Email']); - - $user->synchronizeFromArray($userArray); - $this->assertEqual($user->Phonenumber->count(), 0); - $this->assertTrue(!isset($user->Email)); - $user->save(); - } - - public function testSynchronizeAfterRemoveRecord() - { - $user = Doctrine_Query::create()->from('User u, u.Email, u.Phonenumber')->fetchOne(); - $this->assertTrue(!isset($user->Phonenumber)); - $this->assertTrue(!isset($user->Email)); - } -} diff --git a/tests_old/Record/ZeroValuesTestCase.php b/tests_old/Record/ZeroValuesTestCase.php deleted file mode 100644 index 172036f89..000000000 --- a/tests_old/Record/ZeroValuesTestCase.php +++ /dev/null @@ -1,79 +0,0 @@ -. - */ - -/** - * Doctrine_Record_State_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Record_ZeroValues_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = 'ZeroValueTest'; - - parent::prepareTables(); - } - - public function prepareData() - { - $user = new ZeroValueTest(); - $user['is_super_admin'] = 0; // set it to 0 and it should be 0 when we pull it back from the database - $user['username'] = 'jwage'; - $user['salt'] = 'test'; - $user['password'] = 'test'; - $user->save(); - } - - public function testZeroValuesMaintained() - { - $users = $this->dbh->query('SELECT * FROM zero_value_test')->fetchAll(PDO::FETCH_ASSOC); - - $this->assertIdentical($users[0]['is_super_admin'], '0'); - } - - public function testZeroValuesMaintained2() - { - $q = new Doctrine_Query(); - $q->from('ZeroValueTest'); - $users = $q->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertIdentical($users[0]['is_super_admin'], false); - // check for aggregate bug - $this->assertTrue( ! isset($users[0][0])); - } - - public function testZeroValuesMaintained3() - { - $q = new Doctrine_Query(); - $q->from('ZeroValueTest'); - $users = $q->execute(); - - $this->assertIdentical($users[0]['is_super_admin'], false); - } - -} diff --git a/tests_old/RecordFilterTestCase.php b/tests_old/RecordFilterTestCase.php deleted file mode 100644 index 2ff44ed30..000000000 --- a/tests_old/RecordFilterTestCase.php +++ /dev/null @@ -1,45 +0,0 @@ -name = "something"; - $e->password = "123"; - - - $this->assertEqual($e->get('name'), 'SOMETHING'); - // test repeated calls - $this->assertEqual($e->get('name'), 'SOMETHING'); - $this->assertEqual($e->id, null); - $this->assertEqual($e->rawGet('name'), 'something'); - $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); - - $e->save(); - - $this->assertEqual($e->id, 1); - $this->assertEqual($e->name, 'SOMETHING'); - $this->assertEqual($e->rawGet('name'), 'something'); - $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); - - $this->connection->clear(); - - $e->refresh(); - - $this->assertEqual($e->id, 1); - $this->assertEqual($e->name, 'SOMETHING'); - $this->assertEqual($e->rawGet('name'), 'something'); - $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); - - $this->connection->clear(); - - $e = $e->getTable()->find($e->id); - - $this->assertEqual($e->id, 1); - $this->assertEqual($e->name, 'SOMETHING'); - $this->assertEqual($e->rawGet('name'), 'something'); - $this->assertEqual($e->password, '202cb962ac59075b964b07152d234b70'); - - } -} diff --git a/tests_old/RecordTestCase.php b/tests_old/RecordTestCase.php deleted file mode 100644 index b58e71642..000000000 --- a/tests_old/RecordTestCase.php +++ /dev/null @@ -1,928 +0,0 @@ -. - */ - -/** - * Doctrine_Record_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Record_TestCase extends Doctrine_UnitTestCase -{ - - public function prepareTables() - { - $this->tables[] = 'enumTest'; - $this->tables[] = 'fieldNameTest'; - $this->tables[] = 'GzipTest'; - $this->tables[] = 'Book'; - $this->tables[] = 'EntityAddress'; - parent::prepareTables(); - } - - public function testOne2OneForeign() - { - $user = new User(); - $user->name = "Richard Linklater"; - - $rel = $user->getTable()->getRelation('Account'); - - $this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey); - - $account = $user->Account; - $account->amount = 1000; - $this->assertTrue($account instanceof Account); - $this->assertEqual($account->state(), Doctrine_Entity::STATE_TDIRTY); - $this->assertEqual($account->entity_id->getOid(), $user->getOid()); - $this->assertEqual($account->amount, 1000); - $this->assertEqual($user->name, "Richard Linklater"); - - $user->save(); - $this->assertEqual($account->entity_id, $user->id); - - $user->refresh(); - - $account = $user->Account; - $this->assertTrue($account instanceof Account); - $this->assertEqual($account->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($account->entity_id, $user->id); - $this->assertEqual($account->amount, 1000); - $this->assertEqual($user->name, "Richard Linklater"); - - - $user = new User(); - $user->name = 'John Rambo'; - $account = $user->Account; - $account->amount = 2000; - - $this->assertEqual($account->getTable()->getColumnNames(), array('id', 'entity_id', 'amount')); - $this->connection->unitOfWork->saveAll(); - $this->assertEqual($user->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertTrue($account instanceof Account); - - $this->assertEqual($account->getTable()->getColumnNames(), array('id', 'entity_id', 'amount')); - - $this->assertEqual($account->entity_id, $user->id); - $this->assertEqual($account->amount, 2000); - - - $user = $user->getRepository()->find($user->id); - $this->assertEqual($user->state(), Doctrine_Entity::STATE_CLEAN); - - - $account = $user->Account; - $this->assertTrue($account instanceof Account); - - $this->assertEqual($account->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($account->getTable()->getColumnNames(), array('id', 'entity_id', 'amount')); - - $this->assertEqual($account->entity_id, $user->id); - $this->assertEqual($account->amount, 2000); - $this->assertEqual($user->name, "John Rambo"); - - } - - public function testIssetForPrimaryKey() - { - $this->assertTrue(isset($this->users[0]->id)); - $this->assertTrue(isset($this->users[0]['id'])); - $this->assertTrue($this->users[0]->contains('id')); - - $user = new User(); - - $this->assertTrue(!isset($user->id)); - $this->assertTrue(!isset($user['id'])); - $this->assertTrue(!$user->contains('id')); - } - - public function testNotNullConstraint() - { - $null = new NotNullTest(); - - $null->name = null; - - $null->type = 1; - try { - $this->connection->beginTransaction(); - $null->save(); - $this->fail(); - } catch (Exception $e) { - $this->pass(); - $this->connection->rollback(); - } - - } - - public function testGzipType() - { - $gzip = new GzipTest(); - $gzip->gzip = "compressed"; - - $this->assertEqual($gzip->gzip, "compressed"); - $gzip->save(); - $this->assertEqual($gzip->gzip, "compressed"); - $gzip->refresh(); - $this->assertEqual($gzip->gzip, "compressed"); - - $this->connection->clear(); - $gzip = $gzip->getRepository()->find($gzip->id); - $this->assertEqual($gzip->gzip, "compressed"); - - $gzip->gzip = "compressed 2"; - - $this->assertEqual($gzip->gzip, "compressed 2"); - $gzip->save(); - $this->assertEqual($gzip->gzip, "compressed 2"); - $gzip->refresh(); - $this->assertEqual($gzip->gzip, "compressed 2"); - } - - public function testDefaultValues() - { - - $test = new FieldNameTest; - - $this->assertEqual($test->someColumn, 'some string'); - $this->assertEqual($test->someEnum, 'php'); - $this->assertEqual($test->someArray, array()); - $this->assertTrue(is_object($test->someObject)); - $this->assertEqual($test->someInt, 11); - } - - - public function testToArray() - { - $user = new User(); - - $a = $user->toArray(); - - $this->assertTrue(is_array($a)); - $this->assertTrue(array_key_exists('name', $a)); - - - $this->assertEqual($a['name'], null); - $this->assertTrue(array_key_exists('id', $a)); - $this->assertEqual($a['id'], null); - - $user->name = 'Someone'; - - $user->save(); - - $a = $user->toArray(); - - $this->assertTrue(is_array($a)); - $this->assertTrue(array_key_exists('name', $a)); - $this->assertEqual($a['name'], 'Someone'); - $this->assertTrue(array_key_exists('id', $a)); - $this->assertTrue(is_numeric($a['id'])); - - $user->refresh(); - - $a = $user->toArray(); - - $this->assertTrue(is_array($a)); - $this->assertTrue(array_key_exists('name', $a)); - $this->assertEqual($a['name'], 'Someone'); - $this->assertTrue(array_key_exists('id', $a)); - $this->assertTrue(is_numeric($a['id'])); - $this->connection->clear(); - $user = $user->getRepository()->find($user->id); - - $a = $user->toArray(); - - $this->assertTrue(is_array($a)); - $this->assertTrue(array_key_exists('name', $a)); - $this->assertEqual($a['name'], 'Someone'); - $this->assertTrue(array_key_exists('id', $a)); - $this->assertTrue(is_numeric($a['id'])); - } - - public function testReferences2() - { - $user = new User(); - $user->Phonenumber[0]->phonenumber = '123 123'; - $ref = $user->Phonenumber[0]->entity_id; - - $this->assertEqual($ref->getOid(), $user->getOid()); - } - - public function testUpdatingWithNullValue() - { - $user = $this->connection->getRepository('User')->find(5); - $user->name = null; - $this->assertEqual($user->name, null); - - $user->save(); - - $this->assertEqual($user->name, null); - - $this->connection->clear(); - - $user = $this->connection->getRepository('User')->find(5); - - $this->assertEqual($user->name, null); - - } - - public function testSerialize() - { - $user = $this->connection->getRepository("User")->find(4); - $str = serialize($user); - $user2 = unserialize($str); - - $this->assertTrue($user2 instanceof User); - $this->assertEqual($user2->identifier(), $user->identifier()); - } - - public function testCallback() - { - $user = new User(); - $user->name = " zYne "; - $user->call('trim', 'name'); - $this->assertEqual($user->name, 'zYne'); - $user->call('substr', 'name', 0, 1); - $this->assertEqual($user->name, 'z'); - } - - public function testCompositePK() { - $record = new EntityReference(); - $this->assertEqual((array)$record->getTable()->getIdentifier(), array("entity1","entity2")); - $this->assertEqual($record->getTable()->getIdentifierType(), Doctrine::IDENTIFIER_COMPOSITE); - $this->assertEqual($record->identifier(), array("entity1" => null, "entity2" => null)); - $this->assertEqual($record->state(), Doctrine_Entity::STATE_TCLEAN); - - $record->entity1 = 3; - $record->entity2 = 4; - $this->assertEqual($record->entity2, 4); - $this->assertEqual($record->entity1, 3); - $this->assertEqual($record->state(), Doctrine_Entity::STATE_TDIRTY); - $this->assertEqual($record->identifier(), array("entity1" => 3, "entity2" => 4)); - - $record->save(); - $this->assertEqual($record->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($record->entity2, 4); - $this->assertEqual($record->entity1, 3); - $this->assertEqual($record->identifier(), array("entity1" => 3, "entity2" => 4)); - - $record = $record->getRepository()->find($record->identifier()); - $this->assertEqual($record->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($record->entity2, 4); - $this->assertEqual($record->entity1, 3); - - $this->assertEqual($record->identifier(), array("entity1" => 3, "entity2" => 4)); - - $record->entity2 = 5; - $record->entity1 = 2; - $this->assertEqual($record->state(), Doctrine_Entity::STATE_DIRTY); - $this->assertEqual($record->entity2, 5); - $this->assertEqual($record->entity1, 2); - $this->assertEqual($record->identifier(), array("entity1" => 3, "entity2" => 4)); - - $record->save(); - $this->assertEqual($record->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($record->entity2, 5); - $this->assertEqual($record->entity1, 2); - $this->assertEqual($record->identifier(), array("entity1" => 2, "entity2" => 5)); - $record = $record->getRepository()->find($record->identifier()); - - $this->assertEqual($record->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($record->entity2, 5); - $this->assertEqual($record->entity1, 2); - $this->assertEqual($record->identifier(), array("entity1" => 2, "entity2" => 5)); - - $record->refresh(); - - $this->assertEqual($record->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($record->entity2, 5); - $this->assertEqual($record->entity1, 2); - $this->assertEqual($record->identifier(), array("entity1" => 2, "entity2" => 5)); - - $record = new EntityReference(); - $record->entity2 = 6; - $record->entity1 = 2; - $record->save(); - - $coll = $this->connection->query("FROM EntityReference"); - $this->assertTrue($coll[0] instanceof EntityReference); - $this->assertEqual($coll[0]->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertTrue($coll[1] instanceof EntityReference); - $this->assertEqual($coll[1]->state(), Doctrine_Entity::STATE_CLEAN); - - $coll = $this->connection->query("FROM EntityReference WHERE EntityReference.entity2 = 5"); - $this->assertEqual($coll->count(), 1); - } - - public function testManyToManyTreeStructure() - { - - $task = $this->connection->create("Task"); - - $task->name = "Task 1"; - $task->ResourceAlias[0]->name = "Resource 1"; - - $this->connection->unitOfWork->saveAll(); - - $this->assertTrue($task->ResourceAlias[0] instanceof Resource); - $this->assertEqual($task->ResourceAlias[0]->name, "Resource 1"); - $this->assertEqual($this->dbh->query("SELECT COUNT(*) FROM assignment")->fetch(PDO::FETCH_NUM),array(1)); - - $task = new Task(); - $this->assertTrue($task instanceof Task); - $this->assertEqual($task->state(), Doctrine_Entity::STATE_TCLEAN); - $this->assertTrue($task->Subtask[0] instanceof Task); - - //$this->assertEqual($task->Subtask[0]->state(), Doctrine_Entity::STATE_TDIRTY); - $this->assertTrue($task->ResourceAlias[0] instanceof Resource); - $this->assertEqual($task->ResourceAlias[0]->state(), Doctrine_Entity::STATE_TCLEAN); - - $task->name = "Task 1"; - $task->ResourceAlias[0]->name = "Resource 1"; - $task->Subtask[0]->name = "Subtask 1"; - - $this->assertEqual($task->name, "Task 1"); - $this->assertEqual($task->ResourceAlias[0]->name, "Resource 1"); - $this->assertEqual($task->ResourceAlias->count(), 1); - $this->assertEqual($task->Subtask[0]->name, "Subtask 1"); - - $this->connection->unitOfWork->saveAll(); - - $task = $task->getRepository()->find($task->identifier()); - - $this->assertEqual($task->name, "Task 1"); - $this->assertEqual($task->ResourceAlias[0]->name, "Resource 1"); - $this->assertEqual($task->ResourceAlias->count(), 1); - $this->assertEqual($task->Subtask[0]->name, "Subtask 1"); - } - - - public function testGet() - { - $user = new User(); - $user->name = "Jack Daniels"; - $this->assertEqual($user->name, "Jack Daniels"); - $this->assertEqual($user->created, null); - $this->assertEqual($user->updated, null); - $user->save(); - $id = $user->identifier(); - $user = $user->getRepository()->find($id); - $this->assertEqual($user->name, "Jack Daniels"); - $this->assertEqual($user->created, null); - $this->assertEqual($user->updated, null); - } - - public function testNewOperator() - { - $table = $this->connection->getClassMetadata("User"); - - $user = new User(); - $this->assertEqual(Doctrine_Lib::getRecordStateAsString($user->state()), Doctrine_Lib::getRecordStateAsString(Doctrine_Entity::STATE_TCLEAN)); - $user->name = "John Locke"; - - $this->assertTrue($user->name,"John Locke"); - $this->assertTrue($user->state() == Doctrine_Entity::STATE_TDIRTY); - $user->save(); - $this->assertTrue($user->state() == Doctrine_Entity::STATE_CLEAN); - $this->assertTrue($user->name,"John Locke"); - } - - public function testTreeStructure() - { - $e = new Element(); - - $fk = $e->getTable()->getRelation("Child"); - $this->assertTrue($fk instanceof Doctrine_Relation_ForeignKey); - $this->assertEqual($fk->getType(), Doctrine_Relation::MANY_AGGREGATE); - $this->assertEqual($fk->getForeign(), "parent_id"); - $this->assertEqual($fk->getLocal(), "id"); - - - - $e->name = "parent"; - $e->Child[0]->name = "child 1"; - $e->Child[1]->name = "child 2"; - - $e->Child[1]->Child[0]->name = "child 1's child 1"; - $e->Child[1]->Child[1]->name = "child 1's child 1"; - - $this->assertEqual($e->name,"parent"); - - $this->assertEqual($e->Child[0]->name,"child 1"); - $this->assertEqual($e->Child[1]->name,"child 2"); - $this->assertEqual($e->Child[1]->Child[0]->name,"child 1's child 1"); - $this->assertEqual($e->Child[1]->Child[1]->name,"child 1's child 1"); - - - - $this->connection->unitOfWork->saveAll(); - $elements = $this->connection->query("FROM Element"); - $this->assertEqual($elements->count(), 5); - - $e = $e->getRepository()->find(1); - $this->assertEqual($e->name,"parent"); - - $this->assertEqual($e->Child[0]->name,"child 1"); - - $c = $e->getRepository()->find(2); - $this->assertEqual($c->name, "child 1"); - - $this->assertEqual($e->Child[0]->parent_id, 1); - $this->assertEqual($e->Child[0]->Parent->identifier(), $e->identifier()); - - - $this->assertEqual($e->Child[1]->parent_id, 1); - $this->assertEqual($e->Child[1]->Child[0]->name,"child 1's child 1"); - $this->assertEqual($e->Child[1]->Child[1]->name,"child 1's child 1"); - $this->assertEqual($e->Child[1]->Child[0]->parent_id, 3); - $this->assertEqual($e->Child[1]->Child[1]->parent_id, 3); - - } - - public function testUniqueKeyComponent() - { - $e = new Error(); - $e->message = 'user error'; - $e->file_md5 = md5(0); - $e->code = 1; - - // ADDING NEW RECORD - $this->assertEqual($e->code,1); - $this->assertEqual($e->file_md5, md5(0)); - $this->assertEqual($e->message, 'user error'); - - $e2 = new Error(); - $e2->message = 'user error2'; - $e2->file_md5 = md5(1); - $e2->code = 2; - - $this->assertEqual($e2->code,2); - $this->assertEqual($e2->file_md5, md5(1)); - $this->assertEqual($e2->message, 'user error2'); - - - $fk = $e->getTable()->getRelation('Description'); - $this->assertTrue($fk instanceof Doctrine_Relation_ForeignKey); - $this->assertEqual($fk->getLocal(),'file_md5'); - $this->assertEqual($fk->getForeign(),'file_md5'); - $this->assertTrue($fk->getTable() instanceof Doctrine_ClassMetadata); - - $e->Description[0]->description = 'This is the 1st description'; - $e->Description[1]->description = 'This is the 2nd description'; - $this->assertEqual($e->Description[0]->description, 'This is the 1st description'); - $this->assertEqual($e->Description[1]->description, 'This is the 2nd description'); - $this->assertEqual($e->Description[0]->file_md5, $e->file_md5); - $this->assertEqual($e->Description[1]->file_md5, $e->file_md5); - - $this->assertEqual($e2->Description[0]->description, null); - $this->assertEqual($e2->Description[1]->description, null); - $this->assertEqual($e2->Description[0]->file_md5, $e2->file_md5); - $this->assertEqual($e2->Description[1]->file_md5, $e2->file_md5); - - $e->save(); - - $coll = $this->connection->query('FROM Error'); - $e = $coll[0]; - - - $this->assertEqual($e->code,1); - $this->assertEqual($e->file_md5, md5(0)); - $this->assertEqual($e->message, 'user error'); - - $this->assertTrue($e->Description instanceof Doctrine_Collection); - $this->assertTrue($e->Description[0] instanceof Description); - $this->assertTrue($e->Description[1] instanceof Description); - - $this->assertEqual($e->Description[0]->description, 'This is the 1st description'); - $this->assertEqual($e->Description[1]->description, 'This is the 2nd description'); - - // UPDATING - - $e->code = 2; - $e->message = 'changed message'; - $e->Description[0]->description = '1st changed description'; - $e->Description[1]->description = '2nd changed description'; - - - $this->assertEqual($e->code,2); - $this->assertEqual($e->message,'changed message'); - $this->assertEqual($e->Description[0]->description, '1st changed description'); - $this->assertEqual($e->Description[1]->description, '2nd changed description'); - - $e->save(); - $this->assertEqual($e->code,2); - $this->assertEqual($e->message,'changed message'); - $this->assertEqual($e->Description[0]->description, '1st changed description'); - $this->assertEqual($e->Description[1]->description, '2nd changed description'); - } - - public function testInsert() - { - $user = new User(); - $user->name = "John Locke"; - $user->save(); - - $this->assertTrue(is_numeric($user->id) && $user->id > 0); - - $this->assertTrue($user->getModified() == array()); - $this->assertTrue($user->state() == Doctrine_Entity::STATE_CLEAN); - - $user->delete(); - $this->assertEqual($user->state(), Doctrine_Entity::STATE_TCLEAN); - } - - public function testUpdate() - { - $user = $this->connection->getRepository("User")->find(4); - $user->set("name","Jack Daniels",true); - - - $user->save(); - //print $this->old->name; - - $this->assertEqual($user->getModified(), array()); - $this->assertEqual($user->name, "Jack Daniels"); - } - - public function testCopy() - { - $user = $this->connection->getRepository("User")->find(4); - $new = $user->copy(); - - $this->assertTrue($new instanceof Doctrine_Entity); - $this->assertTrue($new->state() == Doctrine_Entity::STATE_TDIRTY); - - $new = $user->copy(); - $new->save(); - $this->assertEqual($user->name, $new->name); - $this->assertTrue(is_numeric($new->id) && $new->id > 0); - $new->refresh(); - $this->assertEqual($user->name, $new->name); - $this->assertTrue(is_numeric($new->id) && $new->id > 0); - } - - public function testCopyAndModify() - { - $user = $this->connection->getRepository("User")->find(4); - $new = $user->copy(); - - $this->assertTrue($new instanceof Doctrine_Entity); - $this->assertTrue($new->state() == Doctrine_Entity::STATE_TDIRTY); - - $new->loginname = 'jackd'; - - $this->assertEqual($user->name, $new->name); - $this->assertEqual($new->loginname, 'jackd'); - - $new->save(); - $this->assertTrue(is_numeric($new->id) && $new->id > 0); - - $new->refresh(); - $this->assertEqual($user->name, $new->name); - $this->assertEqual($new->loginname, 'jackd'); - } - - public function testReferences() - { - $user = $this->connection->getRepository('User')->find(5); - - $this->assertTrue($user->Phonenumber instanceof Doctrine_Collection); - $this->assertEqual($user->Phonenumber->count(), 3); - - $coll = new Doctrine_Collection('Phonenumber'); - - $user->Phonenumber = $coll; - $this->assertEqual($user->Phonenumber->count(), 0); - $user->save(); - - $user->getEntityManager()->clear('User'); - - $user = $this->objTable->find(5); - - $this->assertEqual($user->Phonenumber->count(), 0); - $this->assertEqual(get_class($user->Phonenumber), 'Doctrine_Collection'); - - $user->Phonenumber[0]->phonenumber; - $this->assertEqual($user->Phonenumber->count(), 1); - - // ADDING REFERENCES - - $user->Phonenumber[0]->phonenumber = "123 123"; - - $this->assertEqual($user->Phonenumber->count(), 1); - $user->Phonenumber[1]->phonenumber = "123 123"; - $this->assertEqual($user->Phonenumber->count(), 2); - - $user->save(); - - - $this->assertEqual($user->Phonenumber->count(), 2); - - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 2); - - $user->Phonenumber[3]->phonenumber = "123 123"; - $user->save(); - - $this->assertEqual($user->Phonenumber->count(), 3); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 3); - - // DELETING REFERENCES - - $user->Phonenumber->delete(); - - $this->assertEqual($user->Phonenumber->count(), 0); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 0); - - // ADDING REFERENCES WITH STRING KEYS - - $user->Phonenumber["home"]->phonenumber = "123 123"; - $user->Phonenumber["work"]->phonenumber = "444 444"; - $user->save(); - - $this->assertEqual($user->Phonenumber->count(), 2); - unset($user); - $user = $this->objTable->find(5); - $this->assertEqual($user->Phonenumber->count(), 2); - - // REPLACING ONE-TO-MANY REFERENCE - unset($coll); - $coll = new Doctrine_Collection('Phonenumber'); - $coll[0]->phonenumber = "123 123"; - $coll["home"]->phonenumber = "444 444"; - $coll["work"]->phonenumber = "444 444"; - - $user->Phonenumber = $coll; - $user->save(); - $this->assertEqual($user->Phonenumber->count(), 3); - - $user = $this->objTable->find(5); - //$this->assertEqual($user->Phonenumber->count(), 3); - - - // ONE-TO-ONE REFERENCES - - $user->Email->address = "drinker@drinkmore.info"; - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->address, "drinker@drinkmore.info"); - - $user->save(); - - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->address, "drinker@drinkmore.info"); - $this->assertEqual($user->Email->id, $user->email_id); - - $user = $this->objTable->find(5); - - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->id, $user->email_id); - $this->assertEqual($user->Email->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($user->Email->address, "drinker@drinkmore.info"); - $id = $user->Email->id; - - // REPLACING ONE-TO-ONE REFERENCES - - $email = $this->connection->create("Email"); - $email->address = "absolutist@nottodrink.com"; - $user->Email = $email; - - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->address, "absolutist@nottodrink.com"); - $user->save(); - unset($user); - - $user = $this->objTable->find(5); - $this->assertTrue($user->Email instanceof Email); - $this->assertEqual($user->Email->address, "absolutist@nottodrink.com"); - - $emails = $this->connection->query("FROM Email WHERE Email.id = $id"); - //$this->assertEqual(count($emails),0); - - } - - public function testDeleteReference() - { - $user = $this->objTable->find(5); - $int = $user->Phonenumber->delete(); - - $this->assertTrue($user->Phonenumber->count() == 0); - } - - - public function testSaveAssociations() - { - $userMapper = $this->connection->getRepository('User'); - $user = $userMapper->find(5); - - - $userTable = $this->connection->getClassMetadata('User'); - /*echo get_class($rel1) . "
    "; - echo get_class($rel2) . "
    "; - echo get_class($userTable->getRelation('Group')); - echo "........
    "; - echo "local:" . $rel1->getLocal() . "---foreign:" . $rel1->getForeign() . "
    "; - echo "local:" . $rel2->getLocal() . "---foreign:" . $rel2->getForeign() . "
    "; - echo "........
    ";*/ - - $gf = $this->connection->getRepository("Group"); - //echo "start"; - $this->assertTrue($user->Group instanceof Doctrine_Collection); - //echo "end"; - /*$xrefMapper = $this->connection->getMapper('Groupuser'); - $xrefs = $xrefMapper->findAll(); - foreach ($xrefs as $xref) { - echo $xref->group_id . " -- ". $xref->user_id ."(state:".$xref->state().")
    "; - }*/ - - $this->assertEqual($user->Group->count(), 1); - $this->assertEqual($user->Group[0]->id, 3); - - - // ADDING ASSOCIATED REFERENCES - - $group1 = $gf->find(1); - $group2 = $gf->find(2); - $user->Group[1] = $group1; - $user->Group[2] = $group2; - - $this->assertEqual($user->Group->count(), 3); - - $user->save(); - - /*$xrefMapper = $this->connection->getMapper('Groupuser'); - $xrefs = $xrefMapper->findAll(); - foreach ($xrefs as $xref) { - echo $xref->group_id . " -- ". $xref->user_id ."(state:".$xref->state().")
    "; - }*/ - - $coll = $user->Group; - - - // UNSETTING ASSOCIATED REFERENCES - - unset($user); - $query = new Doctrine_Query($this->conn); - - $user = $this->objTable->find(5); - - //echo get_class($user->Group); - $this->assertEqual($user->Group->count(), 3); - $pks = $user->Group->getPrimaryKeys(); - $this->assertTrue(in_array(1, $pks)); - $this->assertTrue(in_array(2, $pks)); - $this->assertTrue(in_array(3, $pks)); - - $user->unlink('Group', array($group1->id, $group2->id)); - $this->assertEqual($user->Group->count(), 1); - - $user->save(); - unset($user); - - - // CHECKING THE PERSISTENCE OF UNSET ASSOCIATED REFERENCES - $this->connection->clear(); - $user = $this->objTable->find(5); - $this->assertEqual($user->Group->count(), 1); - $this->assertEqual($user->Group[0]->id, 3); - $this->assertEqual($gf->findAll()->count(), 3); - - - // REPLACING OLD ASSOCIATED REFERENCE - $user->unlink('Group', 3); // you MUST first unlink old relationship - $user->Group[1] = $group1; - $user->Group[0] = $group2; - $user->save(); - - $user = $this->objTable->find(5); - $this->assertEqual($user->Group->count(), 2); - $this->assertEqual($user->Group[0]->identifier(), $group2->identifier()); - $this->assertEqual($user->Group[1]->identifier(), $group1->identifier()); - - $user->unlink('Group'); - $user->save(); - $user->free(); - - $user = $this->objTable->find(5); - $this->assertEqual($user->Group->count(), 0); - - - // ACCESSING ASSOCIATION OBJECT PROPERTIES - - $user = new User(); - $this->assertTrue($user->getTable()->getRelation("Groupuser") instanceof Doctrine_Relation_ForeignKey); - - $this->assertTrue($user->Groupuser instanceof Doctrine_Collection); - $this->assertTrue($user->Groupuser[0] instanceof Groupuser); - - $user->name = "Jack Daniels"; - $user->Group[0]->name = "Group #1"; - $user->Group[1]->name = "Group #2"; - $t1 = time(); - $t2 = time(); - $user->Groupuser[0]->added = $t1; - $user->Groupuser[1]->added = $t2; - - $this->assertEqual($user->Groupuser[0]->added, $t1); - $this->assertEqual($user->Groupuser[1]->added, $t2); - - $user->save(); - - $user->refresh(); - $this->assertEqual($user->Groupuser[0]->added, $t1); - $this->assertEqual($user->Groupuser[1]->added, $t2); - - } - - - public function testCount() - { - $user = $this->connection->getRepository("User")->find(4); - - $this->assertTrue(is_integer($user->count())); - } - - public function testGetReference() - { - $user = $this->connection->getRepository("User")->find(4); - - $this->assertTrue($user->Email instanceof Doctrine_Entity); - $this->assertTrue($user->Phonenumber instanceof Doctrine_Collection); - $this->assertTrue($user->Group instanceof Doctrine_Collection); - - $this->assertTrue($user->Phonenumber->count() == 1); - } - public function testGetIterator() - { - $user = $this->connection->getRepository("User")->find(4); - $this->assertTrue($user->getIterator() instanceof ArrayIterator); - } - - public function testRefreshRelated() - { - $user = $this->connection->getRepository("User")->find(4); - $user->Address[0]->address = "Address #1"; - $user->Address[1]->address = "Address #2"; - $user->save(); - $this->assertEqual(count($user->Address), 2); - Doctrine_Query::create()->delete()->from('EntityAddress')->where('user_id = ? AND address_id = ?', array($user->id, $user->Address[1]->id))->execute(); - $user->refreshRelated('Address'); - $this->assertEqual(count($user->Address), 1); - Doctrine_Query::create()->delete()->from('EntityAddress')->where('user_id = ? AND address_id = ?', array($user->id, $user->Address[0]->id))->execute(); - $user->refreshRelated(); - $this->assertEqual(count($user->Address), 0); - - } - - public function testRefreshDeep() - { - $user = $this->connection->getRepository("User")->find(4); - $user->Address[0]->address = "Address #1"; - $user->Address[1]->address = "Address #2"; - $user->save(); - $this->assertEqual(count($user->Address), 2); - - Doctrine_Query::create()->delete()->from('EntityAddress')->where('user_id = ? AND address_id = ?', array($user->id, $user->Address[1]->id))->execute(); - $user->refresh(true); - $this->assertEqual(count($user->Address), 1); - - $address = $user->Address[0]; - Doctrine_Query::create()->delete()->from('EntityAddress')->where('user_id = ? AND address_id = ?', array($user->id, $user->Address[0]->id))->execute(); - $user->refresh(true); - $this->assertEqual(count($user->Address), 0); - - $entity_address = new EntityAddress(); - $entity_address->user_id = $user->id; - $entity_address->address_id = $address->id; - $entity_address->save(); - $this->assertNotEqual(count($user->Address), 1); - $user->refresh(true); - $this->assertEqual(count($user->Address), 1); - - } -} diff --git a/tests_old/Relation/AccessTestCase.php b/tests_old/Relation/AccessTestCase.php deleted file mode 100644 index 0dfe5419e..000000000 --- a/tests_old/Relation/AccessTestCase.php +++ /dev/null @@ -1,215 +0,0 @@ -name = "owner1"; - $o2 = new File_Owner(); - $o2->name = "owner2"; - - $f1 = new Data_File(); - $f1->filename = 'file1'; - $f2 = new Data_File(); - $f2->filename = 'file2'; - $f3 = new Data_File(); - $f3->filename = 'file3'; - - $o1->Data_File->filename = 'file4'; - - // multiple left join branches test - $us = array(); - $us[1] = new MyUser(); - $us[1]->name = "user1"; - $this->connection->unitOfWork->saveAll(); - // OneThings - $onethings_gs = array( - array(6,1) - ); - $count = 1; - foreach($onethings_gs as $onething_g) { - for($i=$count;$i<$count+$onething_g[0];$i++) { - $d = new MyOneThing(); - $d->name = "onething".$i; - if($onething_g[1]) { - $us[$onething_g[1]]->MyOneThing->add($d); - } - } - $count += $onething_g[0]; - } - // OtherThings - for($i=0;$i<6;$i++) { - $o = new MyOtherThing(); - $o->name = "otherthing".$i; - $us[1]->MyOtherThing->add($o); - } - // UserOneThings - /* Doctrine assigns the foreign keys automatically - $one_id_gs = array( - array(array(2,3,6,5,1), 1) - ); - foreach($one_id_gs as $one_ids) { - foreach($one_ids[0] as $oid) { - $od = new MyUserOneThing(); - $od->one_thing_id = $oid; - $od->user_id = $one_ids[1]; - } - } - // UserOtherThings - $oth_id_gs = array( - array(array(5,4), 1) - ); - foreach($oth_id_gs as $oth_ids) { - foreach($oth_ids[0] as $oid) { - $uo = new MyUserOtherThing(); - $uo->other_thing_id = $oid; - $uo->user_id = $oth_ids[1]; - } - } - */ - $this->connection->unitOfWork->saveAll(); - $this->connection->clear(); - } - - public function prepareTables() { - $this->tables += array("MyUser", - "MyOneThing", - "MyUserOneThing", - "MyOtherThing", - "MyUserOtherThing"); - parent::prepareTables(); - } - - public function testOneToOneAggregateRelationFetching() { - $coll = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'"); - $this->assertTrue(count($coll) == 1); - $this->assertTrue($coll[0] instanceof Doctrine_Entity); - - $this->assertEqual($coll[0]->id, 1); - } - public function testAccessOneToOneFromForeignSide() { - - $check = $this->connection->query("FROM File_Owner WHERE File_Owner.name = 'owner1'"); - $owner1 = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'"); - $owner2 = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner2'"); - $this->assertTrue(count($check) == 1); - - $this->assertTrue(count($owner2) == 1); - - $check = $check[0]; - $owner1 = $owner1[0]; - $owner2 = $owner2[0]; - $this->assertEqual($owner1->name, 'owner1'); - $this->assertEqual($owner1->id, 1); - - $check2 = $this->connection->query("FROM File_Owner WHERE File_Owner.id = ".$owner1->get('id')); - $this->assertEqual(1, count($check2)); - $check2 = $check2[0]; - $this->assertEqual('owner1', $check2->get('name')); - - $this->assertTrue(isset($owner1->Data_File)); - $this->assertFalse(isset($owner2->Data_File)); - $this->assertEqual(1, $check->get('id')); - $this->assertEqual(1, $owner1->get('id')); - $this->assertEqual($owner1->get('id'), $check->get('id')); - $this->assertEqual(2, $owner2->get('id')); - - } - - public function testAccessOneToOneFromLocalSide() { - $check = $this->connection->query("FROM Data_File WHERE Data_File.filename = 'file4'"); - $file1 = $this->connection->query("FROM Data_File.File_Owner WHERE Data_File.filename = 'file4'"); - $file2 = $this->connection->query("FROM Data_File.File_Owner WHERE Data_File.filename = 'file1'"); - $this->assertTrue(count($check) == 1); - $this->assertTrue(count($file1) == 1); - $this->assertTrue(count($file2) == 1); - - $check = $check[0]; - $file1 = $file1[0]; - $file2 = $file2[0]; - - $check2 = $this->connection->query("FROM Data_File WHERE Data_File.id = ".$file1->get('id')); - $this->assertEqual(1, count($check2)); - $check2 = $check2[0]; - $this->assertEqual('file4', $check2->get('filename')); - - $this->assertTrue(isset($file1->File_Owner)); - $this->assertFalse(isset($file2->File_Owner)); - $this->assertEqual(4, $check->get('id')); - $this->assertEqual(4, $file1->get('id')); - $this->assertEqual($file1->get('id'), $check->get('id')); - $this->assertEqual(1, $file2->get('id')); - - } - - public function testMultipleLeftJoinBranches() { - $query = "FROM MyUserOtherThing"; - $other = $this->connection->query($query); - $check1 = array(); - foreach($other as $oth) { - if( ! isset($check1[$oth->other_thing_id])) { - $check1[$oth->other_thing_id] = array(); - } - $check1[$oth->other_thing_id][$oth->id] = $oth; - } - $query = "FROM MyUserOneThing"; - $ones = $this->connection->query($query); - $check2 = array(); - foreach($ones as $one) { - if( ! isset($check2[$one->one_thing_id])) { - $check2[$one->one_thing_id] = array(); - } - $check2[$one->one_thing_id][$one->id] = $one; - } - - $query = "FROM MyUser, - MyUser.MyOneThing, - MyUser.MyOneThing.MyUserOneThing, - MyUser.MyOtherThing, - MyUser.MyOtherThing.MyUserOtherThing"; - $users = $this->connection->query($query); - foreach($users as $u) { - $this->assertEqual($u->MyOtherThing->count(), 6, "incorrect count of MyOtherThing"); - foreach($u->MyOtherThing as $o) { - $in_check = array_key_exists($o->id, $check1); - $wanted_user_thing_count = $in_check ? count($check1[$o->id]) : 0; - $this->assertEqual($o->MyUserOtherThing->count(), $wanted_user_thing_count, "incorrect count of MyUserOtherThing on MyOtherThing"); - foreach($o->MyUserOtherThing as $uo) { - $this->assertEqual($uo->other_thing_id, $o->id, "incorrectly assigned MyOtherThing.id on MyUserOtherThing"); - if($in_check) { - $wanted_user_thing_exists = array_key_exists($uo->id, $check1[$o->id]); - $this->assertTrue($wanted_user_thing_exists, "MyUserOtherThing incorrectly assigned to MyOtherThing."); - if($wanted_user_thing_exists) { - $this->assertEqual($uo->other_thing_id, $check1[$o->id][$uo->id]->user_id, "incorrect value of MyUserOtherThing.user_id"); - $this->assertEqual($uo->other_thing_id, $check1[$o->id][$uo->id]->other_thing_id, "incorrect value of MyUserOtherThing.other_thing_id"); - } - } - } - } - } - - $query = "FROM MyUser, - MyUser.MyOtherThing, - MyUser.MyOtherThing.MyUserOtherThing, - MyUser.MyOneThing, - MyUser.MyOneThing.MyUserOneThing"; - $users = $this->connection->query($query); - foreach($users as $u) { - $this->assertEqual($u->MyOneThing->count(), 6, "incorrect count of MyOneThing"); - foreach($u->MyOneThing as $o) { - $in_check = array_key_exists($o->id, $check2); - $wanted_user_thing_count = $in_check ? count($check2[$o->id]) : 0; - $this->assertEqual($o->MyUserOneThing->count(), $wanted_user_thing_count, "incorrect count of MyUserOneThing on MyOneThing"); - foreach($o->MyUserOneThing as $uo) { - $this->assertEqual($uo->one_thing_id, $o->id, "incorrectly assigned MyOneThing.id on MyUserOneThing"); - if($in_check) { - $wanted_user_thing_exists = array_key_exists($uo->id, $check2[$o->id]); - $this->assertTrue($wanted_user_thing_exists, "MyUserOneThing incorrectly assigned to MyOneThing."); - if($wanted_user_thing_exists) { - $this->assertEqual($uo->one_thing_id, $check2[$o->id][$uo->id]->user_id, "incorrect value of MyUserOneThing.user_id"); - $this->assertEqual($uo->one_thing_id, $check2[$o->id][$uo->id]->one_thing_id, "incorrect value of MyUserOneThing.one_thing_id"); - } - } - } - } - } - } -} diff --git a/tests_old/Relation/CircularSavingTestCase.php b/tests_old/Relation/CircularSavingTestCase.php deleted file mode 100644 index 41444b74a..000000000 --- a/tests_old/Relation/CircularSavingTestCase.php +++ /dev/null @@ -1,108 +0,0 @@ -. - */ - -/** - * Doctrine_Relation_CircularSaving_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @author Jan Schaefer - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Relation_CircularSaving_TestCase extends Doctrine_UnitTestCase -{ - - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('NestTest', 'NestReference'); - - parent::prepareTables(); - } - - public function testMultiplePrimaryKeys() - { - $r = new Doctrine_Collection('NestReference'); - $r[0]->parent_id = 1; - $r[0]->child_id = 2; - $r[1]->parent_id = 2; - $r[1]->child_id = 3; - $r->save(); - - $r->delete(); - $this->conn->clear(); - $q = new Doctrine_Query(); - $coll = $q->from('NestReference')->execute(); - $this->assertEqual(count($coll), 0); - } - - public function testCircularNonEqualSelfReferencingRelationSaving() - { - $n1 = new NestTest(); - $n1->set('name', 'node1'); - $n1->save(); - $n2 = new NestTest(); - $n2->set('name', 'node2'); - $n2->save(); - - $n1->get('Children')->add($n2); - $n1->save(); - $n2->get('Children')->add($n1); - $n2->save(); - - $q = new Doctrine_Query(); - $coll = $q->from('NestReference')->execute(); - - $this->assertEqual(count($coll), 2); - - $coll->delete(); - $this->conn->clear(); - - $q = new Doctrine_Query(); - $coll = $q->from('NestReference')->execute(); - $this->assertEqual(count($coll), 0); - } - - public function testCircularEqualSelfReferencingRelationSaving() - { - $n1 = new NestTest(); - $n1->set('name', 'node1'); - $n1->save(); - $n2 = new NestTest(); - $n2->set('name', 'node2'); - $n2->save(); - - $n1->get('Relatives')->add($n2); - $n1->save(); - $n2->get('Relatives')->add($n1); - $n2->save(); - - $q = new Doctrine_Query(); - $coll = $q->from('NestReference')->execute(array(), Doctrine::FETCH_ARRAY); - - $this->assertEqual(count($coll), 1); - } -} diff --git a/tests_old/Relation/ManyToMany2TestCase.php b/tests_old/Relation/ManyToMany2TestCase.php deleted file mode 100644 index 1fd238e14..000000000 --- a/tests_old/Relation/ManyToMany2TestCase.php +++ /dev/null @@ -1,135 +0,0 @@ -. - */ - -/** - * Doctrine_Relation_Parser_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Relation_ManyToMany2_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { - } - - public function prepareTables() - { - $this->tables = array('TestUser', 'TestMovie', 'TestMovieUserBookmark', 'TestMovieUserVote'); - parent::prepareTables(); - } - - public function testManyToManyCreateSelectAndUpdate() - { - $user = new TestUser(); - $user['name'] = 'tester'; - $user->save(); - - $data = new TestMovie(); - $data['name'] = 'movie'; - $data['User'] = $user; - $data['MovieBookmarks'][0] = $user; - $data['MovieVotes'][0] = $user; - $data->save(); //All ok here - - $this->conn->clear(); - - $q = new Doctrine_Query(); - $newdata = $q->select('m.*') - ->from('TestMovie m') - ->execute() - ->getFirst(); - $newdata['name'] = 'movie2'; - try { - $newdata->save(); //big failure here - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - - } - public function testManyToManyJoinsandSave() - { - $q = new Doctrine_Query(); - $newdata = $q->select('d.*, i.*, u.*, c.*') - ->from('TestMovie d, d.MovieBookmarks i, i.UserVotes u, u.User c') - ->execute() - ->getFirst(); - - $newdata['MovieBookmarks'][0]['UserVotes'][0]['User']['name'] = 'user2'; - try { - $newdata->save(); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - } - - public function testInitMoreData() - { - $user = new TestUser(); - $user->name = 'test user'; - $user->save(); - - $movie = new TestMovie(); - $movie->name = 'test movie'; - $movie->save(); - - $movie = new TestMovie(); - $movie->name = 'test movie 2'; - $movie->save(); - - $this->conn->clear(); - } - - public function testManyToManyDirectLinksUpdating() - { - $users = $this->conn->query("FROM TestUser u WHERE u.name = 'test user'"); - - $this->assertEqual($users->count(), 1); - - $movies = $this->conn->query("FROM TestMovie m WHERE m.name IN ('test movie', 'test movie 2')"); - - $this->assertEqual($movies->count(), 2); - - $profiler = new Doctrine_Connection_Profiler(); - - $this->conn->addListener($profiler); - - $this->assertEqual($users[0]->UserBookmarks->count(), 0); - $users[0]->UserBookmarks = $movies; - $this->assertEqual($users[0]->UserBookmarks->count(), 2); - - $users[0]->save(); - - $this->assertEqual($users[0]->UserBookmarks->count(), 2); - /** - foreach ($profiler->getAll() as $event) { - print $event->getQuery() . "
    "; - } - */ - } -} diff --git a/tests_old/Relation/ManyToManyTestCase.php b/tests_old/Relation/ManyToManyTestCase.php deleted file mode 100644 index afa29d7ca..000000000 --- a/tests_old/Relation/ManyToManyTestCase.php +++ /dev/null @@ -1,207 +0,0 @@ -getTable()->getRelation('RTC5'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertTrue($rel instanceof Doctrine_Relation_Association); - - $this->assertTrue($component->RTC5 instanceof Doctrine_Collection); - - try { - $rel = $component->getTable()->getRelation('JC3'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertEqual($rel->getLocal(), 'oid'); - } - - public function testJoinComponent() { - $component = new JC3(); - - try { - $rel = $component->getTable()->getRelation('M2MTest2'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertEqual($rel->getForeign(), 'oid'); - try { - $rel = $component->getTable()->getRelation('RTC4'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertEqual($rel->getForeign(), 'oid'); - } - - public function testManyToManyRelationFetchingWithAliasesAndCustomPKs2() { - $q = new Doctrine_Query(); - - try { - $q->from('M2MTest2 m INNER JOIN m.JC3'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - try { - $q->execute(); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - } - public function testManyToManyHasRelationWithAliases4() { - - try { - $component = new M2MTest(); - - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - } - - public function testManyToManyHasRelationWithAliases3() { - $component = new M2MTest(); - - try { - $rel = $component->getTable()->getRelation('RTC3'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertTrue($rel instanceof Doctrine_Relation_Association); - - $this->assertTrue($component->RTC3 instanceof Doctrine_Collection); - } - - - public function testManyToManyHasRelationWithAliases() { - $component = new M2MTest(); - - try { - $rel = $component->getTable()->getRelation('RTC1'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertTrue($rel instanceof Doctrine_Relation_Association); - - $this->assertTrue($component->RTC1 instanceof Doctrine_Collection); - } - - public function testManyToManyHasRelationWithAliases2() { - $component = new M2MTest(); - - try { - $rel = $component->getTable()->getRelation('RTC2'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertTrue($rel instanceof Doctrine_Relation_Association); - - $this->assertTrue($component->RTC1 instanceof Doctrine_Collection); - } - - - public function testManyToManyRelationSaving() { - $component = new M2MTest(); - - $component->RTC1[0]->name = '1'; - $component->RTC1[1]->name = '2'; - $component->name = '2'; - - $count = $this->dbh->count(); - - $component->save(); - - $this->assertEqual($this->dbh->count(), ($count + 5)); - - $this->assertEqual($component->RTC1->count(), 2); - - $component = $component->getTable()->find($component->id); - - $this->assertEqual($component->RTC1->count(), 2); - - // check that it doesn't matter saving the other M2M components as well - - $component->RTC2[0]->name = '1'; - $component->RTC2[1]->name = '2'; - - $count = $this->dbh->count(); - - $component->save(); - - $this->assertEqual($this->dbh->count(), ($count + 4)); - - $this->assertEqual($component->RTC2->count(), 2); - - $component = $component->getTable()->find($component->id); - - $this->assertEqual($component->RTC2->count(), 2); - - } - - public function testManyToManyRelationSaving2() { - $component = new M2MTest(); - - $component->RTC2[0]->name = '1'; - $component->RTC2[1]->name = '2'; - $component->name = '2'; - - $count = $this->dbh->count(); - - $component->save(); - - $this->assertEqual($this->dbh->count(), ($count + 5)); - - $this->assertEqual($component->RTC2->count(), 2); - - $component = $component->getTable()->find($component->id); - - $this->assertEqual($component->RTC2->count(), 2); - - // check that it doesn't matter saving the other M2M components as well - - $component->RTC1[0]->name = '1'; - $component->RTC1[1]->name = '2'; - - $count = $this->dbh->count(); - - $component->save(); - - $this->assertEqual($this->dbh->count(), ($count + 4)); - - $this->assertEqual($component->RTC1->count(), 2); - - $component = $component->getTable()->find($component->id); - - $this->assertEqual($component->RTC1->count(), 2); - } - - public function testManyToManySimpleUpdate() { - $component = $this->connection->getTable('M2MTest')->find(1); - - $this->assertEqual($component->name, 2); - - $component->name = 'changed name'; - - $component->save(); - - $this->assertEqual($component->name, 'changed name'); - } -} diff --git a/tests_old/Relation/NestTestCase.php b/tests_old/Relation/NestTestCase.php deleted file mode 100644 index eac03071c..000000000 --- a/tests_old/Relation/NestTestCase.php +++ /dev/null @@ -1,241 +0,0 @@ -. - */ - -/** - * Doctrine_Relation_Nest_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Relation_Nest_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('NestTest', 'NestReference', 'Entity', 'EntityReference'); - - parent::prepareTables(); - } - public function testInitJoinTableSelfReferencingInsertingData() - { - $e = new Entity(); - $e->name = "Entity test"; - - $this->assertTrue($e->Entity[0] instanceof Entity); - $this->assertTrue($e->Entity[1] instanceof Entity); - - $this->assertEqual($e->Entity[0]->state(), Doctrine_Entity::STATE_TCLEAN); - $this->assertEqual($e->Entity[1]->state(), Doctrine_Entity::STATE_TCLEAN); - - $e->Entity[0]->name = 'Friend 1'; - $e->Entity[1]->name = 'Friend 2'; - - $e->Entity[0]->Entity[0]->name = 'Friend 1 1'; - $e->Entity[0]->Entity[1]->name = 'Friend 1 2'; - - $e->Entity[1]->Entity[0]->name = 'Friend 2 1'; - $e->Entity[1]->Entity[1]->name = 'Friend 2 2'; - - $this->assertEqual($e->Entity[0]->name, 'Friend 1'); - $this->assertEqual($e->Entity[1]->name, 'Friend 2'); - - $this->assertEqual($e->Entity[0]->Entity[0]->name, 'Friend 1 1'); - $this->assertEqual($e->Entity[0]->Entity[1]->name, 'Friend 1 2'); - - $this->assertEqual($e->Entity[1]->Entity[0]->name, 'Friend 2 1'); - $this->assertEqual($e->Entity[1]->Entity[1]->name, 'Friend 2 2'); - - $this->assertEqual($e->Entity[0]->state(), Doctrine_Entity::STATE_TDIRTY); - $this->assertEqual($e->Entity[1]->state(), Doctrine_Entity::STATE_TDIRTY); - - $count = count($this->conn); - - $e->save(); - - $this->assertEqual(($count + 13), $this->conn->count()); - } - public function testNestRelationsFetchingData() - { - $this->connection->clear(); - - $e = $this->conn->queryOne('FROM Entity e LEFT JOIN e.Entity e2 LEFT JOIN e2.Entity e3 WHERE e.id = 1 ORDER BY e.name, e2.name, e3.name'); - $this->assertEqual($e->state(), Doctrine_Entity::STATE_CLEAN); - - $this->assertTrue($e->Entity[0] instanceof Entity); - $this->assertTrue($e->Entity[1] instanceof Entity); - - $this->assertEqual($e->Entity[0]->name, 'Friend 1'); - $this->assertEqual($e->Entity[1]->name, 'Friend 2'); - - $this->assertEqual($e->Entity[0]->Entity[0]->name, 'Entity test'); - $this->assertEqual($e->Entity[0]->Entity[1]->name, 'Friend 1 1'); - $this->assertEqual($e->Entity[0]->Entity[2]->name, 'Friend 1 2'); - - $this->assertEqual($e->Entity[0]->Entity[0]->name, 'Entity test'); - $this->assertEqual($e->Entity[1]->Entity[1]->name, 'Friend 2 1'); - $this->assertEqual($e->Entity[1]->Entity[2]->name, 'Friend 2 2'); - - $this->assertEqual($e->Entity[0]->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($e->Entity[1]->state(), Doctrine_Entity::STATE_CLEAN); - - $this->assertTrue(is_numeric($e->id)); - - $result = $this->conn->execute('SELECT * FROM entity_reference')->fetchAll(PDO::FETCH_ASSOC); - - $this->assertEqual(count($result), 6); - - //$stmt = $this->dbh->prepare($q); - - //$stmt->execute(array(18)); - //$result = $stmt->fetchAll(PDO::FETCH_ASSOC); - - //print_r($result); - - $this->connection->clear(); - - $e = $e->getRepository()->find($e->id); - - $count = count($this->conn); - - $this->assertTrue($e instanceof Entity); - - $this->assertTrue($e->Entity[0] instanceof Entity); - $this->assertTrue($e->Entity[1] instanceof Entity); - - $this->assertEqual($e->Entity[0]->name, "Friend 1"); - $this->assertEqual($e->Entity[1]->name, "Friend 2"); - - $this->assertEqual($e->Entity[0]->Entity[0]->name, "Entity test"); - $this->assertEqual($e->Entity[0]->Entity[1]->name, "Friend 1 1"); - - $this->assertEqual($e->Entity[1]->Entity[0]->name, "Entity test"); - $this->assertEqual($e->Entity[1]->Entity[1]->name, "Friend 2 1"); - - $this->assertEqual($e->Entity[0]->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($e->Entity[1]->state(), Doctrine_Entity::STATE_CLEAN); - - $coll = $this->connection->query("FROM Entity WHERE Entity.name = 'Friend 1'"); - $this->assertEqual($coll->count(), 1); - $this->assertEqual($coll[0]->state(), Doctrine_Entity::STATE_CLEAN); - - $this->assertEqual($coll[0]->name, "Friend 1"); - - $query = new Doctrine_Query($this->connection); - - $query->from('Entity e LEFT JOIN e.Entity e2')->where("e2.name = 'Friend 1 1'"); - - $coll = $query->execute(); - - $this->assertEqual($coll->count(), 1); - } - public function testNestRelationsParsing() - { - $nest = new NestTest(); - - $rel = $nest->getTable()->getRelation('Parents'); - - $this->assertTrue($rel instanceof Doctrine_Relation_Nest); - - $this->assertEqual($rel->getLocal(), 'child_id'); - $this->assertEqual($rel->getForeign(), 'parent_id'); - } - - public function testNestRelationsSaving() - { - $nest = new NestTest(); - $nest->name = 'n 1'; - $nest->Parents[0]->name = 'p 1'; - $nest->Parents[1]->name = 'p 2'; - $nest->Parents[2]->name = 'p 3'; - $nest->Children[0]->name = 'c 1'; - $nest->Children[0]->Children[0]->name = 'c c 1'; - $nest->Children[0]->Children[1]->name = 'c c 2'; - $nest->Children[1]->name = 'c 2'; - $nest->Children[1]->Parents[]->name = 'n 2'; - $nest->save(); - - $this->connection->clear(); - } - - public function testNestRelationsLoading() - { - $nest = $this->conn->queryOne('FROM NestTest n WHERE n.id = 1'); - - $this->assertEqual($nest->Parents->count(), 3); - $this->assertEqual($nest->Children->count(), 2); - $this->assertEqual($nest->Children[0]->Children->count(), 2); - $this->assertEqual($nest->Children[1]->Parents->count(), 2); - - $this->connection->clear(); - } - public function testEqualNestRelationsLoading() - { - $nest = $this->conn->queryOne('FROM NestTest n WHERE n.id = 1'); - - $this->assertEqual($nest->Relatives->count(), 5); - } - public function testNestRelationsQuerying() - { - $this->connection->clear(); - - $q = new Doctrine_Query(); - - $q->from('NestTest n')->innerJoin('n.Parents p')->where('n.id = 1'); - - $n = $q->execute(); - - $this->assertEqual($n[0]->Parents->count(), 3); - } - public function testNestRelationsQuerying2() - { - $this->connection->clear(); - - $q = new Doctrine_Query(); - - $q->from('NestTest n')->innerJoin('n.Children c')->where('n.id = 1'); - - $n = $q->execute(); - - $this->assertEqual($n[0]->Children->count(), 2); - } - - public function testEqualNestRelationsQuerying() - { - $this->connection->clear(); - - $q = new Doctrine_Query(); - - $q->from('NestTest n')->innerJoin('n.Relatives r')->where('n.id = 1'); - - $n = $q->execute(); - - $this->assertEqual($q->getSql(), 'SELECT n.id AS n__id, n.name AS n__name, n2.id AS n2__id, n2.name AS n2__name FROM nest_test n INNER JOIN nest_reference n3 ON n.id = n3.child_id OR n.id = n3.parent_id INNER JOIN nest_test n2 ON (n2.id = n3.parent_id OR n2.id = n3.child_id) AND n2.id != n.id WHERE n.id = 1'); - - $this->assertEqual($n[0]->Relatives->count(), 5); - } - -} diff --git a/tests_old/Relation/OneToManyTestCase.php b/tests_old/Relation/OneToManyTestCase.php deleted file mode 100644 index 8d06c3d0b..000000000 --- a/tests_old/Relation/OneToManyTestCase.php +++ /dev/null @@ -1,118 +0,0 @@ -. - */ - -/** - * Doctrine_Relation_OneToOne_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Relation_OneToMany_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('Entity', 'Phonenumber', 'Email', 'Policy', 'PolicyAsset', 'Role', 'Auth'); - - parent::prepareTables(); - } - public function testRelationParsing() - { - $table = $this->conn->getClassMetadata('Entity'); - - $rel = $table->getRelation('Phonenumber'); - - $this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey); - - $rel = $table->getRelation('Email'); - - $this->assertTrue($rel instanceof Doctrine_Relation_LocalKey); - } - - public function testRelationParsing2() - { - $table = $this->conn->getClassMetadata('Phonenumber'); - - $rel = $table->getRelation('Entity'); - - $this->assertTrue($rel instanceof Doctrine_Relation_LocalKey); - } - - public function testRelationParsing3() - { - $table = $this->conn->getClassMetadata('Policy'); - - $rel = $table->getRelation('PolicyAssets'); - - $this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey); - } - public function testRelationSaving() - { - $p = new Policy(); - $p->policy_number = '123'; - - $a = new PolicyAsset(); - $a->value = '123.13'; - - $p->PolicyAssets[] = $a; - $p->save(); - - $this->assertEqual($a->policy_number, '123'); - } - public function testRelationSaving2() - { - $e = new Entity(); - $e->name = 'test'; - $e->save(); - - $nr = new Phonenumber(); - $nr->phonenumber = '1234556'; - $nr->save(); - $nr->Entity = $e; - } - public function testRelationSaving3() - { - // create roles and user with role1 and role2 - $this->conn->beginTransaction(); - $role = new Role(); - $role->name = 'role1'; - $role->save(); - - $auth = new Auth(); - $auth->name = 'auth1'; - $auth->Role = $role; - $auth->save(); - - $this->conn->commit(); - - $this->conn->clear(); - - $auths = $this->conn->query('FROM Auth a LEFT JOIN a.Role r'); - - $this->assertEqual($auths[0]->Role->name, 'role1'); - } -} diff --git a/tests_old/Relation/OneToOneTestCase.php b/tests_old/Relation/OneToOneTestCase.php deleted file mode 100644 index 9328ba339..000000000 --- a/tests_old/Relation/OneToOneTestCase.php +++ /dev/null @@ -1,101 +0,0 @@ -. - */ - -/** - * Doctrine_Relation_OneToOne_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('gnatUser','gnatEmail','Email','Entity','Record_City', 'Record_Country', 'SelfRefTest'); - - parent::prepareTables(); - } - - public function testOneToOneAggregateRelationWithAliasesIsSupported() - { - $city = new Record_City(); - $country = $city->Country; - - $this->assertTrue($country instanceof Record_Country); - } - - public function testSelfReferentialOneToOneRelationsAreSupported() - { - $ref = new SelfRefTest(); - - $rel = $ref->getTable()->getRelation('createdBy'); - - $this->assertEqual($rel->getForeign(), 'id'); - $this->assertEqual($rel->getLocal(), 'created_by'); - - $ref->name = 'ref 1'; - $ref->createdBy->name = 'ref 2'; - - $ref->save(); - } - public function testSelfReferentialOneToOneRelationsAreSupported2() - { - $this->connection->clear(); - - $ref = $this->conn->queryOne("FROM SelfRefTest s WHERE s.name = 'ref 1'"); - $this->assertEqual($ref->name, 'ref 1'); - $this->assertEqual($ref->createdBy->name, 'ref 2'); - } - - public function testUnsetRelation() - { - $user = new User(); - $user->name = 'test'; - $email = new Email(); - $email->address = 'test@test.com'; - $user->Email = $email; - $user->save(); - $this->assertTrue($user->Email instanceOf Email); - $user->Email = Doctrine_Null::$INSTANCE; - $user->save(); - $this->assertTrue($user->Email === null); - } - - public function testSavingRelatedObjects() - { - $user = new gnatUser(); - $user->name = 'test'; - $email = new gnatEmail(); - $email->address = 'test3@test.com'; - $user->Email = $email; - $user->save(); - $this->assertTrue($user->Email instanceOf gnatEmail); - $this->assertEqual($user->foreign_id, $user->Email->id); - - } -} diff --git a/tests_old/Relation/ParserTestCase.php b/tests_old/Relation/ParserTestCase.php deleted file mode 100644 index f59a2f0f9..000000000 --- a/tests_old/Relation/ParserTestCase.php +++ /dev/null @@ -1,202 +0,0 @@ -. - */ - -/** - * Doctrine_Relation_Parser_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Relation_Parser_TestCase extends Doctrine_UnitTestCase -{ - public function testPendingRelations() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - - $p = array('type' => Doctrine_Relation::ONE, - 'local' => 'email_id'); - - $r->bind('Email', $p); - - $this->assertEqual($r->getPendingRelation('Email'), array('type' => Doctrine_Relation::ONE, - 'local' => 'email_id', - 'class' => 'Email', - 'alias' => 'Email' - )); - } - public function testBindThrowsExceptionIfTypeNotSet() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - - $p = array('local' => 'email_id'); - try { - $r->bind('Email', $p); - $this->fail('should throw exception'); - } catch(Doctrine_Relation_Exception $e) { - $this->pass(); - } - } - public function testRelationParserSupportsLocalColumnGuessing() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - - $d = $r->completeDefinition(array('class' => 'Phonenumber', - 'type' => Doctrine_Relation::MANY, - 'foreign' => 'entity_id')); - - $this->assertEqual($d['local'], 'id'); - } - public function testRelationParserSupportsLocalColumnGuessing2() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - - $d = $r->completeDefinition(array('class' => 'Email', - 'type' => Doctrine_Relation::ONE, - 'foreign' => 'id')); - - $this->assertEqual($d['local'], 'email_id'); - } - public function testRelationParserSupportsForeignColumnGuessing() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - - $d = $r->completeDefinition(array('class' => 'Phonenumber', - 'type' => Doctrine_Relation::MANY, - 'local' => 'id')); - - $this->assertEqual($d['foreign'], 'entity_id'); - } - public function testRelationParserSupportsForeignColumnGuessing2() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - - $d = $r->completeDefinition(array('class' => 'Email', - 'type' => Doctrine_Relation::ONE, - 'local' => 'email_id')); - - $this->assertEqual($d['foreign'], 'id'); - } - public function testRelationParserSupportsGuessingOfBothColumns() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - - $d = $r->completeDefinition(array('class' => 'Email', - 'type' => Doctrine_Relation::ONE)); - - $this->assertEqual($d['foreign'], 'id'); - $this->assertEqual($d['local'], 'email_id'); - } - - public function testRelationParserSupportsGuessingOfBothColumns2() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - - $d = $r->completeDefinition(array('class' => 'Phonenumber', - 'type' => Doctrine_Relation::MANY)); - - $this->assertEqual($d['foreign'], 'entity_id'); - $this->assertEqual($d['local'], 'id'); - } - - /*public function testRelationParserSupportsForeignColumnGuessingForAssociations() - { - $r = new Doctrine_Relation_Parser($this->conn->getTable('User')); - $d = $r->completeAssocDefinition(array('class' => 'Group', - 'type' => Doctrine_Relation::MANY, - 'local' => 'user_id', - 'refClass' => 'Groupuser')); - - $this->assertEqual($d['foreign'], 'group_id'); - } - public function testRelationParserSupportsLocalColumnGuessingForAssociations() - { - $r = new Doctrine_Relation_Parser($this->conn->getTable('User')); - - $d = $r->completeAssocDefinition(array('class' => 'Group', - 'type' => Doctrine_Relation::MANY, - 'foreign' => 'group_id', - 'refClass' => 'Groupuser')); - - $this->assertEqual($d['local'], 'user_id'); - }*/ - - public function testGetRelationReturnsForeignKeyObjectForOneToOneRelation() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - $p = array('type' => Doctrine_Relation::ONE, - 'local' => 'email_id'); - - $r->bind('Email', $p); - - $rel = $r->getRelation('Email'); - - $this->assertTrue($rel instanceof Doctrine_Relation_LocalKey); - } - - public function testGetRelationReturnsForeignKeyObjectForOneToManyRelation() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - $p = array('type' => Doctrine_Relation::MANY); - - $r->bind('Phonenumber', $p); - - $rel = $r->getRelation('Phonenumber'); - - $this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey); - } - - public function testGetRelationReturnsForeignKeyObjectForManytToManyRelation() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('User')); - $p = array('type' => Doctrine_Relation::MANY, 'refClass' => 'Groupuser'); - - $r->bind('Group', $p); - - $rel = $r->getRelation('Group'); - - $this->assertTrue($rel instanceof Doctrine_Relation_Association); - $rel = $r->getRelation('Groupuser'); - $this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey); - } - public function testGetRelationReturnsForeignKeyObjectForNestRelation() - { - $r = new Doctrine_Relation_Parser($this->conn->getClassMetadata('Entity')); - $p = array('type' => Doctrine_Relation::MANY, - 'refClass' => 'EntityReference', - 'local' => 'entity1', - 'foreign' => 'entity2'); - - $r->bind('Entity', $p); - - $rel = $r->getRelation('Entity'); - $this->assertTrue($rel instanceof Doctrine_Relation_Nest); - - $rel = $r->getRelation('EntityReference'); - $this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey); - } - - // TODO: BETTER ASSOCIATION TABLE GUESSING -} diff --git a/tests_old/RelationTestCase.php b/tests_old/RelationTestCase.php deleted file mode 100644 index dced15da7..000000000 --- a/tests_old/RelationTestCase.php +++ /dev/null @@ -1,166 +0,0 @@ -. - */ - -/** - * Doctrine_Relation_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Relation_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('RelationTest', 'RelationTestChild', 'Group', 'Groupuser', 'User', 'Email', 'Account', 'Phonenumber'); - - parent::prepareTables(); - } - - public function testInitData() - { - $user = new User(); - - $user->name = 'zYne'; - $user->Group[0]->name = 'Some Group'; - $user->Group[1]->name = 'Other Group'; - $user->Group[2]->name = 'Third Group'; - - $user->Phonenumber[0]->phonenumber = '123 123'; - $user->Phonenumber[1]->phonenumber = '234 234'; - $user->Phonenumber[2]->phonenumber = '456 456'; - - $user->Email->address = 'someone@some.where'; - - $user->save(); - } - - public function testUnlinkSupportsManyToManyRelations() - { - $users = Doctrine_Query::create()->from('User u')->where('u.name = ?', array('zYne'))->execute(); - - $user = $users[0]; - - $this->assertEqual($user->Group->count(), 3); - - $user->unlink('Group', array(2, 3, 4)); - - $this->assertEqual($user->Group->count(), 0); - - $this->conn->clear(); - - $groups = Doctrine_Query::create()->from('Group g')->execute(); - - $this->assertEqual($groups->count(), 3); - - $links = Doctrine_Query::create()->from('Groupuser gu')->execute(); - - $this->assertEqual($links->count(), 0); - } - - public function testUnlinkSupportsOneToManyRelations() - { - $this->conn->clear(); - - $users = Doctrine_Query::create()->from('User u')->where('u.name = ?', array('zYne'))->execute(); - - $user = $users[0]; - - $this->assertEqual($user->Phonenumber->count(), 3); - - $user->unlink('Phonenumber', array(1, 2, 3)); - - $this->assertEqual($user->Phonenumber->count(), 0); - - $this->conn->clear(); - - $phonenumber = Doctrine_Query::create()->from('Phonenumber p')->execute(); - - $this->assertEqual($phonenumber->count(), 3); - $this->assertEqual($phonenumber[0]->entity_id, null); - $this->assertEqual($phonenumber[1]->entity_id, null); - $this->assertEqual($phonenumber[2]->entity_id, null); - } - - public function testOneToManyTreeRelationWithConcreteInheritance() { - - $component = new RelationTestChild(); - - try { - $rel = $component->getTable()->getRelation('Children'); - - $this->pass(); - } catch(Doctrine_Exception $e) { - - $this->fail(); - } - $this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey); - - $this->assertTrue($component->Children instanceof Doctrine_Collection); - $this->assertTrue($component->Children[0] instanceof RelationTestChild); - } - - public function testOneToOneTreeRelationWithConcreteInheritance() { - $component = new RelationTestChild(); - - try { - $rel = $component->getTable()->getRelation('Parent'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - $this->assertTrue($rel instanceof Doctrine_Relation_LocalKey); - } - public function testManyToManyRelation() { - $user = new User(); - - // test that join table relations can be initialized even before the association have been initialized - try { - $user->Groupuser; - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - //$this->assertTrue($user->getTable()->getRelation('Groupuser') instanceof Doctrine_Relation_ForeignKey); - $this->assertTrue($user->getTable()->getRelation('Group') instanceof Doctrine_Relation_Association); - } - public function testOneToOneLocalKeyRelation() { - $user = new User(); - - $this->assertTrue($user->getTable()->getRelation('Email') instanceof Doctrine_Relation_LocalKey); - } - public function testOneToOneForeignKeyRelation() { - $user = new User(); - - $this->assertTrue($user->getTable()->getRelation('Account') instanceof Doctrine_Relation_ForeignKey); - } - public function testOneToManyForeignKeyRelation() { - $user = new User(); - - $this->assertTrue($user->getTable()->getRelation('Phonenumber') instanceof Doctrine_Relation_ForeignKey); - } -} diff --git a/tests_old/RepositoryTestCase.php b/tests_old/RepositoryTestCase.php deleted file mode 100644 index f891858c3..000000000 --- a/tests_old/RepositoryTestCase.php +++ /dev/null @@ -1,5 +0,0 @@ -. - */ - -/** - * Doctrine_Search_File_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Search_File_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - - public function testSearchFileAutoCreatesFileTable() - { - $this->_search = new Doctrine_Search_File(); - - $this->conn->export->exportClasses(array('FileIndex')); - } - - public function testIndexDirectoryIndexesAllFiles() - { - $this->_search->indexDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); - - $resultSet = $this->_search->search('dbms'); - - $this->assertEqual(count($resultSet), 1); - } -} diff --git a/tests_old/Search/IndexerTestCase.php b/tests_old/Search/IndexerTestCase.php deleted file mode 100644 index 6f4f7b122..000000000 --- a/tests_old/Search/IndexerTestCase.php +++ /dev/null @@ -1,68 +0,0 @@ -. - */ - -/** - * Doctrine_Search_Indexer_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Search_Indexer_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { - $this->tables = array('Doctrine_File', 'Doctrine_File_Index'); - - parent::prepareTables(); - } - - public function testIndexexCanRecursivelyIndexDirectories() - { - $profiler = new Doctrine_Connection_Profiler(); - $this->conn->addListener($profiler); - - $indexer = new Doctrine_Search_Indexer(); - - $indexer->indexDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); - } - - public function testIndexerAddsFiles() - { - $files = Doctrine_Query::create()->from('Doctrine_File')->execute(); - - $this->assertEqual($files->count(), 2); - } - - public function testSearchingFiles() - { - $files = Doctrine_Query::create()->select('DISTINCT i.file_id')->from('Doctrine_File_Index i') - ->where('i.keyword = ?', array('database'))->execute(array(), Doctrine_Hydrate::HYDRATE_ARRAY); - - $this->assertEqual(count($files), 11); - } -} diff --git a/tests_old/Search/QueryTestCase.php b/tests_old/Search/QueryTestCase.php deleted file mode 100644 index 744177102..000000000 --- a/tests_old/Search/QueryTestCase.php +++ /dev/null @@ -1,328 +0,0 @@ -. - */ - -/** - * Doctrine_Search_Query_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Search_Query_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('SearchTest', 'SearchTestIndex'); - - parent::prepareTables(); - } - public function prepareData() - { } - - public function testInitData() - { - $e = new SearchTest(); - - $e->title = 'Once there was an ORM framework'; - $e->content = 'There are many ORM frameworks, but nevertheless we decided to create one.'; - - $e->save(); - - $e = new SearchTest(); - - $e->title = 'Doctrine development continues'; - $e->content = 'The development has been going well so far.'; - - $e->save(); - } - - public function testParseClauseSupportsAndOperator() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('doctrine AND orm'); - - $sql = 'id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'AND id IN (SELECT id FROM search_test_index WHERE keyword = ?)'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsMixingOfOperatorsAndParenthesis() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('((doctrine OR orm) AND dbal) OR database'); - - $sql = '(id IN (SELECT id FROM search_test_index WHERE keyword = ? OR keyword = ?) AND id IN (SELECT id FROM search_test_index WHERE keyword = ?)) OR keyword = ?'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsMixingOfOperators3() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('doctrine OR orm AND dbal'); - - $sql = 'keyword = ? OR id IN (SELECT id FROM search_test_index WHERE keyword = ?) AND id IN (SELECT id FROM search_test_index WHERE keyword = ?)'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsMixingOfOperators() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('(doctrine OR orm) AND dbal'); - - $sql = 'id IN (SELECT id FROM search_test_index WHERE keyword = ? OR keyword = ?) AND id IN (SELECT id FROM search_test_index WHERE keyword = ?)'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsMixingOfOperators2() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('(doctrine OR orm) dbal'); - - $sql = 'id IN (SELECT id FROM search_test_index WHERE keyword = ? OR keyword = ?) AND id IN (SELECT id FROM search_test_index WHERE keyword = ?)'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsMixingOfOperatorsAndDeeplyNestedParenthesis() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('(((doctrine OR orm) AND dbal) OR database) AND rdbms'); - - $sql = '((id IN (SELECT id FROM search_test_index WHERE keyword = ? OR keyword = ?) AND id IN (SELECT id FROM search_test_index WHERE keyword = ?)) OR keyword = ?) AND id IN (SELECT id FROM search_test_index WHERE keyword = ?)'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsMixingOfOperatorsAndParenthesis2() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('rdbms (dbal OR database)'); - - $sql = 'id IN (SELECT id FROM search_test_index WHERE keyword = ?) AND id IN (SELECT id FROM search_test_index WHERE keyword = ? OR keyword = ?)'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsMixingOfOperatorsAndDeeplyNestedParenthesis2() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('rdbms (((doctrine OR orm) AND dbal) OR database)'); - - $sql = 'id IN (SELECT id FROM search_test_index WHERE keyword = ?) AND ((id IN (SELECT id FROM search_test_index WHERE keyword = ? OR keyword = ?) AND id IN (SELECT id FROM search_test_index WHERE keyword = ?)) OR keyword = ?)'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsNegationOperator() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('rdbms -doctrine'); - - $sql = 'id IN (SELECT id FROM search_test_index WHERE keyword = ?) AND ' - . 'id NOT IN (SELECT id FROM search_test_index WHERE keyword = ?)'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseOrOperator2() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('rdbms doctrine OR database'); - - $sql = 'id IN (SELECT id FROM search_test_index WHERE keyword = ?) AND ' - . 'id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'OR keyword = ?'; - - $this->assertEqual($ret, $sql); - } - - public function testParseClauseSupportsNegationOperatorWithOrOperator() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $ret = $q->parseClause('rdbms -doctrine OR database'); - - $sql = 'id IN (SELECT id FROM search_test_index WHERE keyword = ?) AND ' - . 'id NOT IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'OR keyword = ?'; - - $this->assertEqual($ret, $sql); - } - - public function testSearchSupportsAndOperator() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query('doctrine AND orm'); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index ' - . 'WHERE id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'AND id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getSql(), $sql); - } - - - public function testSearchSupportsOrOperator() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query('doctrine OR orm'); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index ' - . 'WHERE keyword = ? OR keyword = ? ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getSql(), $sql); - } - - - public function testQuerySupportsSingleWordquery() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query('doctrine'); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index WHERE keyword = ? GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getParams(), array('doctrine')); - $this->assertEqual($q->getSql(), $sql); - } - - public function testSearchSupportsMixingOfOperators() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query('(doctrine OR orm) AND dbal'); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index ' - . 'WHERE id IN (SELECT id FROM search_test_index WHERE keyword = ? OR keyword = ?) ' - . 'AND id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getParams(), array('doctrine', 'orm', 'dbal')); - $this->assertEqual($q->getSql(), $sql); - } - - public function testSearchSupportsSingleTermWithQuotes() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query("'doctrine orm'"); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index WHERE keyword = ? ' - . 'AND (position + 1) = (SELECT position FROM search_test_index WHERE keyword = ?) ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getParams(), array('doctrine', 'orm')); - $this->assertEqual($q->getSql(), $sql); - } - - public function testSearchSupportsSingleLongTermWithQuotes() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query("'doctrine orm dbal'"); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index WHERE keyword = ? ' - . 'AND (position + 1) = (SELECT position FROM search_test_index WHERE keyword = ?) ' - . 'AND (position + 2) = (SELECT position FROM search_test_index WHERE keyword = ?) ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getParams(), array('doctrine', 'orm', 'dbal')); - $this->assertEqual($q->getSql(), $sql); - } - - public function testQuerySupportsMultiWordquery() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query('doctrine orm'); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index ' - . 'WHERE id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'AND id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getSql(), $sql); - } - - public function testQuerySupportsMultiWordSearchAndSingleLetterWildcards() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query('doct?ine orm'); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index ' - . 'WHERE id IN (SELECT id FROM search_test_index WHERE keyword LIKE ?) ' - . 'AND id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getParams(), array('doct?ine', 'orm')); - $this->assertEqual($q->getSql(), $sql); - } - public function testQuerySupportsMultiWordSearchAndMultiLetterWildcards() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query('doc* orm'); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index ' - . 'WHERE id IN (SELECT id FROM search_test_index WHERE keyword LIKE ?) ' - . 'AND id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getParams(), array('doc%', 'orm')); - $this->assertEqual($q->getSql(), $sql); - } - public function testSearchSupportsMultipleTermsWithQuotes() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->query("doctrine 'orm database'"); - - $sql = 'SELECT COUNT(keyword) AS relevance, id ' - . 'FROM search_test_index ' - . 'WHERE id IN (SELECT id FROM search_test_index WHERE keyword = ?) ' - . 'AND id IN (SELECT id FROM search_test_index WHERE keyword = ? ' - . 'AND (position + 1) = (SELECT position FROM search_test_index WHERE keyword = ?)) ' - . 'GROUP BY id ORDER BY relevance DESC'; - - $this->assertEqual($q->getParams(), array('doctrine', 'orm', 'database')); - $this->assertEqual($q->getSql(), $sql); - } - - public function testSearchReturnsFalseForEmptyStrings() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $result = $q->query(' '); - - $this->assertFalse($result); - } - -} diff --git a/tests_old/Search/QueryWeightTestCase.php b/tests_old/Search/QueryWeightTestCase.php deleted file mode 100644 index 353834aa8..000000000 --- a/tests_old/Search/QueryWeightTestCase.php +++ /dev/null @@ -1,129 +0,0 @@ -. - */ - -/** - * Doctrine_Search_QueryWeight_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Search_QueryWeight_TestCase extends Doctrine_UnitTestCase -{ - public function testQuerySupportsMultiWordOrOperatorSearchWithQuotes() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->search("doctrine^2 OR 'dbal database'"); - - $sql = 'SELECT foreign_id, SUM(relevancy) AS relevancy_sum ' - . 'FROM (SELECT COUNT(keyword) * 2 AS relevancy, foreign_id ' - . 'FROM search_index ' - . 'WHERE keyword = ? ' - . 'GROUP BY foreign_id ' - . 'UNION ' - . 'SELECT COUNT(keyword) AS relevancy, foreign_id ' - . 'FROM search_index) AS query_alias ' - . 'WHERE keyword = ? AND (position + 1) = (SELECT position FROM search_index WHERE keyword = ?) ' - . 'GROUP BY foreign_id) ' - . 'GROUP BY foreign_id ' - . 'ORDER BY relevancy_sum'; - - $this->assertEqual($q->getSql(), $sql); - } - - public function testSearchSupportsMixingOfOperatorsParenthesisAndWeights() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->search('(doctrine^2 OR orm) AND dbal'); - - $sql = "SELECT foreign_id, SUM(relevancy) AS relevancy_sum FROM - (SELECT COUNT(keyword) * 2 AS relevancy, foreign_id - FROM search_index - WHERE keyword = 'doctrine' - GROUP BY foreign_id - UNION - SELECT COUNT(keyword) * 2 AS relevancy, foreign_id - FROM search_index - WHERE keyword = 'orm' - GROUP BY foreign_id - INTERSECT - SELECT COUNT(keyword) AS relevancy, foreign_id - FROM search_index) AS query_alias - WHERE keyword = 'dbal' - GROUP BY foreign_id) - GROUP BY foreign_id - ORDER BY relevancy_sum"; - - $this->assertEqual($q->getSql(), $sql); - } - - public function testQuerySupportsMultiWordAndOperatorSearchWithQuotesAndWeights() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->search("doctrine^2 'dbal database'"); - - $sql = "SELECT foreign_id, SUM(relevancy) AS relevancy_sum FROM - (SELECT COUNT(keyword) * 2 AS relevancy, foreign_id - FROM search_index - WHERE keyword = 'doctrine' - GROUP BY foreign_id - INTERSECT - SELECT COUNT(keyword) AS relevancy, foreign_id - FROM search_index) AS query_alias - WHERE keyword = 'dbal' AND (position + 1) = (SELECT position FROM search_index WHERE keyword = 'database') - GROUP BY foreign_id) - GROUP BY foreign_id - ORDER BY relevancy_sum"; - - $this->assertEqual($q->getSql(), $sql); - } - - public function testQuerySupportsMultiWordNegationOperatorSearchWithQuotesWeights() - { - $q = new Doctrine_Search_Query('SearchTestIndex'); - $q->search("doctrine^2 'dbal database' -rdbms"); - - $sql = "SELECT foreign_id, SUM(relevancy) AS relevancy_sum FROM - (SELECT COUNT(keyword) * 2 AS relevancy, foreign_id - FROM search_index - WHERE keyword = 'doctrine' - GROUP BY foreign_id - INTERSECT - SELECT COUNT(keyword) AS relevancy, foreign_id - FROM search_index) AS query_alias - WHERE keyword = 'dbal' AND (position + 1) = (SELECT position FROM search_index WHERE keyword = 'database') - GROUP BY foreign_id - EXCEPT - SELECT COUNT(keyword) AS relevancy, foreign_id - FROM search_index) AS query_alias - WHERE keyword != 'rdbms' - GROUP BY foreign_id - ) - GROUP BY foreign_id - ORDER BY relevancy_sum"; - - $this->assertEqual($q->getSql(), $sql); - } -} diff --git a/tests_old/Search/_files/content.html b/tests_old/Search/_files/content.html deleted file mode 100644 index e5461086a..000000000 --- a/tests_old/Search/_files/content.html +++ /dev/null @@ -1,7 +0,0 @@ -Database transaction -From Wikipedia, the free encyclopedia -Jump to: navigation, search -A database transaction is a unit of interaction with a database management system or similar system that is treated in a coherent and reliable way independent of other transactions that must be either entirely completed or aborted. Ideally, a database system will guarantee the properties of Atomicity, Consistency, Isolation and Durability (ACID) for each transaction. In practice, these properties are often relaxed somewhat to provide better performance. - -In some systems, transactions are also called LUWs for Logical Units of Work. - diff --git a/tests_old/Search/_files/content.txt b/tests_old/Search/_files/content.txt deleted file mode 100644 index af807786f..000000000 --- a/tests_old/Search/_files/content.txt +++ /dev/null @@ -1,12 +0,0 @@ -This file contains only contains some plain text copied from wikipedia. - -In database products the ability to handle transactions allows the user to ensure that integrity of a database is maintained. - -A single transaction might require several queries, each reading and/or writing information in the database. When this happens it is usually important to be sure that the database is not left with only some of the queries carried out. For example, when doing a money transfer, if the money was debited from one account, it is important that it also be credited to the depositing account. Also, transactions should not interfere with each other. For more information about desirable transaction properties, see ACID. - -A simple transaction is usually issued to the database system in a language like SQL in this form: - -Begin the transaction -Execute several queries (although any updates to the database aren't actually visible to the outside world yet) -Commit the transaction (updates become visible if the transaction is successful) -If one of the queries fails the database system may rollback either the entire transaction or just the failed query. This behaviour is dependent on the DBMS in use and how it is set up. The transaction can also be rolled back manually at any time before the commit. diff --git a/tests_old/SearchTestCase.php b/tests_old/SearchTestCase.php deleted file mode 100644 index d1711afc7..000000000 --- a/tests_old/SearchTestCase.php +++ /dev/null @@ -1,177 +0,0 @@ -. - */ - -/** - * Doctrine_Search_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Search_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('SearchTest'); - - parent::prepareTables(); - } - public function prepareData() - { } - - public function testBuildingOfSearchRecordDefinition() - { - $e = new SearchTest(); - - $this->assertTrue($e->SearchTestIndex instanceof Doctrine_Collection); - - $rel = $e->getTable()->getRelation('SearchTestIndex'); - - $this->assertIdentical($rel->getLocal(), 'id'); - $this->assertIdentical($rel->getForeign(), 'id'); - } - public function testSavingEntriesUpdatesIndex() - { - $e = new SearchTest(); - - $e->title = 'Once there was an ORM framework'; - $e->content = 'There are many ORM frameworks, but nevertheless we decided to create one.'; - - $e->save(); - } - - public function testQuerying() - { - $q = new Doctrine_Query(); - - $q->select('t.title') - ->from('SearchTest t') - ->innerJoin('t.SearchTestIndex i') - ->where('i.keyword = ?'); - - $array = $q->execute(array('orm'), Doctrine::HYDRATE_ARRAY); - - $this->assertEqual($array[0]['title'], 'Once there was an ORM framework'); - } - - public function testUsingWordRange() - { - $q = new Doctrine_Query(); - - $q->select('t.title, i.*') - ->from('SearchTest t') - ->innerJoin('t.SearchTestIndex i') - ->where('i.keyword = ? OR i.keyword = ?'); - - $array = $q->execute(array('orm', 'framework'), Doctrine::HYDRATE_ARRAY); - - $this->assertEqual($array[0]['title'], 'Once there was an ORM framework'); - } - - public function testQueryingReturnsEmptyArrayForStopKeyword() - { - $q = new Doctrine_Query(); - - $q->select('t.title') - ->from('SearchTest t') - ->innerJoin('t.SearchTestIndex i') - ->where('i.keyword = ?'); - - $array = $q->execute(array('was'), Doctrine::HYDRATE_ARRAY); - - $this->assertEqual(count($array), 0); - } - - public function testQueryingReturnsEmptyArrayForUnknownKeyword() - { - $q = new Doctrine_Query(); - - $q->select('t.title') - ->from('SearchTest t') - ->innerJoin('t.SearchTestIndex i') - ->where('i.keyword = ?'); - - $array = $q->execute(array('someunknownword'), Doctrine::HYDRATE_ARRAY); - - $this->assertEqual(count($array), 0); - } - - public function testUpdateIndexInsertsNullValuesForBatchUpdatedEntries() - { - $e = new SearchTest(); - $tpl = $e->getTable()->getTemplate('Doctrine_Template_Searchable'); - $tpl->getPlugin()->setOption('batchUpdates', true); - - $e->title = 'Some searchable title'; - $e->content = 'Some searchable content'; - - $e->save(); - - $coll = Doctrine_Query::create() - ->from('SearchTestIndex s') - ->orderby('s.id DESC') - ->limit(1) - ->setHydrationMode(Doctrine::HYDRATE_ARRAY) - ->fetchOne(); - - $this->assertEqual($coll['id'], 2); - $this->assertEqual($coll['keyword'], null); - $this->assertEqual($coll['field'], null); - $this->assertEqual($coll['position'], null); - } - - public function testBatchUpdatesUpdateAllPendingEntries() - { - $e = new SearchTest(); - $e->batchUpdateIndex(); - - $coll = Doctrine_Query::create() - ->from('SearchTestIndex s') - ->setHydrationMode(Doctrine::HYDRATE_ARRAY) - ->execute(); - - $coll = $this->conn->fetchAll('SELECT * FROM search_test_index'); - - - } - - public function testThrowExceptionIfInvalidTable() - { - try{ - $oQuery = new Doctrine_Search_Query(new Doctrine_Query()); - $this->fail("Should throw exception"); - }catch(Doctrine_Search_Exception $exception){ - $this->assertEqual($exception->getMessage(), "Invalid argument type. Expected instance of Doctrine_Table."); - } - } - - - public function testGenerateSearchQueryForWeightedSearch() - { - $oQuery = new Doctrine_Search_Query("SearchTest"); - $oQuery->query("^test"); - $this->assertEqual($oQuery->getSql(), "SELECT SUM(sub_relevance) AS relevance, id FROM WHERE keyword = ? GROUP BY id ORDER BY relevance DESC"); - } -} diff --git a/tests_old/Sequence/FirebirdTestCase.php b/tests_old/Sequence/FirebirdTestCase.php deleted file mode 100644 index 0c45e6255..000000000 --- a/tests_old/Sequence/FirebirdTestCase.php +++ /dev/null @@ -1,55 +0,0 @@ -. - */ - -/** - * Doctrine_Sequence_Firebird_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Sequence_Firebird_TestCase extends Doctrine_UnitTestCase -{ - public function testCurrIdExecutesSql() - { - $this->sequence->currId('user'); - - $this->assertEqual($this->adapter->pop(), 'SELECT GEN_ID(user_seq, 0) as the_value FROM RDB$DATABASE'); - } - public function testNextIdExecutesSql() - { - $id = $this->sequence->nextId('user'); - - $this->assertEqual($this->adapter->pop(), 'SELECT GEN_ID(user_seq, 1) as the_value FROM RDB$DATABASE'); - } - public function testLastInsertIdCallsPdoLevelEquivalent() - { - $id = $this->sequence->lastInsertId('user'); - - $this->assertEqual($id, 1); - - $this->assertEqual($this->adapter->pop(), 'LAST_INSERT_ID()'); - } -} diff --git a/tests_old/Sequence/InformixTestCase.php b/tests_old/Sequence/InformixTestCase.php deleted file mode 100644 index c39fee90a..000000000 --- a/tests_old/Sequence/InformixTestCase.php +++ /dev/null @@ -1,34 +0,0 @@ -. - */ - -/** - * Doctrine_Sequence_Informix_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Sequence_Informix_TestCase extends Doctrine_UnitTestCase { -} diff --git a/tests_old/Sequence/MssqlTestCase.php b/tests_old/Sequence/MssqlTestCase.php deleted file mode 100644 index 52edf8ed6..000000000 --- a/tests_old/Sequence/MssqlTestCase.php +++ /dev/null @@ -1,63 +0,0 @@ -. - */ - -/** - * Doctrine_Sequence_Mssql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Sequence_Mssql_TestCase extends Doctrine_UnitTestCase -{ - public function testCurrIdExecutesSql() - { - $id = $this->sequence->currId('user'); - - $this->assertEqual($this->adapter->pop(), 'DELETE FROM user_seq WHERE id < 0'); - - $this->assertEqual($this->adapter->pop(), 'SELECT @@IDENTITY'); - $this->assertEqual($this->adapter->pop(), 'SELECT @@VERSION'); - $this->assertEqual($this->adapter->pop(), 'SET IDENTITY_INSERT user_seq OFF INSERT INTO user_seq DEFAULT VALUES'); - $this->assertEqual($this->adapter->pop(), 'SELECT COUNT(1) FROM user_seq'); - } - public function testNextIdExecutesSql() - { - $id = $this->sequence->nextId('user'); - - $this->assertEqual($this->adapter->pop(), 'DELETE FROM user_seq WHERE id < 0'); - - $this->assertEqual($this->adapter->pop(), 'SELECT @@IDENTITY'); - $this->assertEqual($this->adapter->pop(), 'SELECT @@VERSION'); - $this->assertEqual($this->adapter->pop(), 'SET IDENTITY_INSERT user_seq OFF INSERT INTO user_seq DEFAULT VALUES'); - $this->assertEqual($this->adapter->pop(), 'SELECT COUNT(1) FROM user_seq'); - } - public function testLastInsertIdCallsPdoLevelEquivalent() - { - $id = $this->sequence->lastInsertId('user'); - - $this->assertEqual($this->adapter->pop(), 'SELECT @@IDENTITY'); - } -} diff --git a/tests_old/Sequence/MysqlTestCase.php b/tests_old/Sequence/MysqlTestCase.php deleted file mode 100644 index 6995ac959..000000000 --- a/tests_old/Sequence/MysqlTestCase.php +++ /dev/null @@ -1,59 +0,0 @@ -. - */ - -/** - * Doctrine_Sequence_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Sequence_Mysql_TestCase extends Doctrine_UnitTestCase -{ - public function testCurrIdExecutesSql() - { - $this->sequence->currId('user'); - - $this->assertEqual($this->adapter->pop(), 'SELECT MAX(id) FROM user_seq'); - } - public function testNextIdExecutesSql() - { - $id = $this->sequence->nextId('user'); - - $this->assertEqual($id, 1); - - $this->assertEqual($this->adapter->pop(), 'DELETE FROM user_seq WHERE id < 1'); - $this->assertEqual($this->adapter->pop(), 'LAST_INSERT_ID()'); - $this->assertEqual($this->adapter->pop(), 'INSERT INTO user_seq (id) VALUES (NULL)'); - } - public function testLastInsertIdCallsPdoLevelEquivalent() - { - $id = $this->sequence->lastInsertId('user'); - - $this->assertEqual($id, 1); - - $this->assertEqual($this->adapter->pop(), 'LAST_INSERT_ID()'); - } -} diff --git a/tests_old/Sequence/OracleTestCase.php b/tests_old/Sequence/OracleTestCase.php deleted file mode 100644 index 72e7d7b1d..000000000 --- a/tests_old/Sequence/OracleTestCase.php +++ /dev/null @@ -1,55 +0,0 @@ -. - */ - -/** - * Doctrine_Sequence_Oracle_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Sequence_Oracle_TestCase extends Doctrine_UnitTestCase -{ - public function testCurrIdExecutesSql() - { - $this->sequence->currId('user'); - $q = "SELECT (last_number-1) FROM user_sequences WHERE sequence_name='user_seq' OR sequence_name='USER_SEQ'"; - - $this->assertEqual($this->adapter->pop(), $q); - } - public function testNextIdExecutesSql() - { - $id = $this->sequence->nextId('user'); - - $this->assertEqual($this->adapter->pop(), 'SELECT user_seq.nextval FROM DUAL'); - - } - public function testLastInsertIdExecutesSql() - { - $this->sequence->lastInsertId('user'); - - $this->assertEqual($this->adapter->pop(), 'SELECT user_seq.currval'); - } -} diff --git a/tests_old/Sequence/PgsqlTestCase.php b/tests_old/Sequence/PgsqlTestCase.php deleted file mode 100644 index f5ccb4e55..000000000 --- a/tests_old/Sequence/PgsqlTestCase.php +++ /dev/null @@ -1,55 +0,0 @@ -. - */ - -/** - * Doctrine_Sequence_Pgsql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Sequence_Pgsql_TestCase extends Doctrine_UnitTestCase -{ - public function testCurrIdExecutesSql() - { - $this->sequence->currId('user'); - $q = "SELECT last_value FROM user_seq"; - - $this->assertEqual($this->adapter->pop(), $q); - } - public function testNextIdExecutesSql() - { - $id = $this->sequence->nextId('user'); - - $this->assertEqual($this->adapter->pop(), "SELECT NEXTVAL('user_seq')"); - - } - public function testLastInsertIdExecutesSql() - { - $this->sequence->lastInsertId('user'); - - $this->assertEqual($this->adapter->pop(), "SELECT CURRVAL('user_seq')"); - } -} diff --git a/tests_old/Sequence/SqliteTestCase.php b/tests_old/Sequence/SqliteTestCase.php deleted file mode 100644 index 012807bb5..000000000 --- a/tests_old/Sequence/SqliteTestCase.php +++ /dev/null @@ -1,61 +0,0 @@ -. - */ - -/** - * Doctrine_Sequence_Sqlite_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Sequence_Sqlite_TestCase extends Doctrine_UnitTestCase -{ - public function testCurrIdExecutesSql() - { - $this->adapter->forceLastInsertIdFail(false); - - $this->sequence->currId('user'); - - $this->assertEqual($this->adapter->pop(), 'SELECT MAX(id) FROM user_seq'); - } - public function testNextIdExecutesSql() - { - $id = $this->sequence->nextId('user'); - - $this->assertEqual($id, 1); - - $this->assertEqual($this->adapter->pop(), 'DELETE FROM user_seq WHERE id < 1'); - $this->assertEqual($this->adapter->pop(), 'LAST_INSERT_ID()'); - $this->assertEqual($this->adapter->pop(), 'INSERT INTO user_seq (id) VALUES (NULL)'); - } - public function testLastInsertIdCallsPdoLevelEquivalent() - { - $id = $this->sequence->lastInsertId('user'); - - $this->assertEqual($id, 1); - - $this->assertEqual($this->adapter->pop(), 'LAST_INSERT_ID()'); - } -} diff --git a/tests_old/SequenceTestCase.php b/tests_old/SequenceTestCase.php deleted file mode 100644 index 40879ff99..000000000 --- a/tests_old/SequenceTestCase.php +++ /dev/null @@ -1,62 +0,0 @@ -. - */ - -/** - * Doctrine_Sequence_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Sequence_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { - } - public function prepareTables() - { - } - public function testSequencesAreSupportedForRecords() - { - /** - // the last profiled event is transaction commit - $this->assertEqual($this->adapter->pop(), 'COMMIT'); - // query execution - - $this->assertEqual($this->adapter->pop(), 'INSERT INTO custom_sequence_record (name, id) VALUES (?, ?)'); - // query prepare - $this->assertEqual($this->adapter->pop(), 'INSERT INTO custom_sequence_record (name, id) VALUES (?, ?)'); - - // sequence generation (first fails) - $this->assertEqual($this->adapter->pop(), 'INSERT INTO custom_seq_seq (id) VALUES (1)'); - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE custom_seq_seq (id INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)'); - $this->assertEqual($this->adapter->pop(), 'INSERT INTO custom_seq_seq (id) VALUES (NULL)'); - - // transaction begin - $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); - $this->assertEqual($this->adapter->pop(), 'CREATE TABLE custom_sequence_record (id INTEGER, name VARCHAR(2147483647), PRIMARY KEY(id))'); - */ - } -} diff --git a/tests_old/TableTestCase.php b/tests_old/TableTestCase.php deleted file mode 100644 index 5a6baefd3..000000000 --- a/tests_old/TableTestCase.php +++ /dev/null @@ -1,245 +0,0 @@ -. - */ - -/** - * Doctrine_Table_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Table_TestCase extends Doctrine_UnitTestCase -{ - - public function prepareTables() - { - $this->tables[] = 'FieldNameTest'; - parent::prepareTables(); - } - - public function testInitializingNewTableWorksWithoutConnection() - { - $table = new Doctrine_Table('Test', $this->conn); - - $this->assertEqual($table->getComponentName(), 'Test'); - } - - public function testFieldConversion() - { - $this->dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER); - - $t = new FieldNameTest(); - - $t->someColumn = 'abc'; - $t->someEnum = 'php'; - $t->someInt = 1; - $t->someArray = array(); - $obj = new StdClass(); - $t->someObject = $obj; - - $this->assertEqual($t->someColumn, 'abc'); - $this->assertEqual($t->someEnum, 'php'); - $this->assertEqual($t->someInt, 1); - $this->assertEqual($t->someArray, array()); - $this->assertEqual($t->someObject, $obj); - - $t->save(); - - $this->assertEqual($t->someColumn, 'abc'); - $this->assertEqual($t->someEnum, 'php'); - $this->assertEqual($t->someInt, 1); - $this->assertEqual($t->someArray, array()); - $this->assertEqual($t->someObject, $obj); - - $t->refresh(); - - $this->assertEqual($t->someColumn, 'abc'); - $this->assertEqual($t->someEnum, 'php'); - $this->assertEqual($t->someInt, 1); - $this->assertEqual($t->someArray, array()); - $this->assertEqual($t->someObject, $obj); - - $this->connection->clear(); - - $t = $this->connection->getRepository('FieldNameTest')->find(1); - - $this->assertEqual($t->someColumn, 'abc'); - $this->assertEqual($t->someEnum, 'php'); - $this->assertEqual($t->someInt, 1); - $this->assertEqual($t->someArray, array()); - $this->assertEqual($t->someObject, $obj); - - $this->dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); - } - - public function testGetForeignKey() - { - $fk = $this->objTable->getTable()->getRelation("Group"); - $this->assertTrue($fk instanceof Doctrine_Relation_Association); - $this->assertTrue($fk->getTable() instanceof Doctrine_ClassMetadata); - $this->assertTrue($fk->getType() == Doctrine_Relation::MANY_AGGREGATE); - $this->assertTrue($fk->getLocal() == "user_id"); - $this->assertTrue($fk->getForeign() == "group_id"); - - $fk = $this->objTable->getTable()->getRelation("Email"); - $this->assertTrue($fk instanceof Doctrine_Relation_LocalKey); - - $this->assertTrue($fk->getTable() instanceof Doctrine_ClassMetadata); - $this->assertTrue($fk->getType() == Doctrine_Relation::ONE_AGGREGATE); - - $this->assertTrue($fk->getLocal() == "email_id"); - $fkIdFieldNames = (array)$fk->getTable()->getIdentifier(); - $this->assertTrue($fk->getForeign() == $fkIdFieldNames[0]); - - - $fk = $this->objTable->getTable()->getRelation('Phonenumber'); - $this->assertTrue($fk instanceof Doctrine_Relation_ForeignKey); - $this->assertTrue($fk->getTable() instanceof Doctrine_ClassMetadata); - $this->assertTrue($fk->getType() == Doctrine_Relation::MANY); - $objTableIdFieldNames = (array)$this->objTable->getTable()->getIdentifier(); - $this->assertTrue($fk->getLocal() == $objTableIdFieldNames[0]); - $this->assertTrue($fk->getForeign() == 'entity_id'); - - - } - public function testGetComponentName() - { - $this->assertTrue($this->objTable->getComponentName() == 'User'); - } - - public function testGetTableName() - { - $this->assertTrue($this->objTable->getTable()->getTableName() == 'entity'); - } - - public function testGetConnection() - { - $this->assertTrue($this->objTable->getConnection() instanceof Doctrine_Connection); - } - - public function testSetSequenceName() - { - $this->objTable->sequenceName = 'test-seq'; - $this->assertEqual($this->objTable->sequenceName, 'test-seq'); - $this->objTable->sequenceName = null; - } - - public function testCreate() - { - $record = $this->objTable->create(); - $this->assertTrue($record instanceof Doctrine_Entity); - $this->assertTrue($record->state() == Doctrine_Entity::STATE_TCLEAN); - } - - public function testFind() - { - $record = $this->objTable->find(4); - $this->assertTrue($record instanceof Doctrine_Entity); - - try { - $record = $this->objTable->find('4'); - $this->assertTrue($record instanceof Doctrine_Entity); - } catch(Exception $e) { - $this->assertTrue(false); - } - - try { - $record = $this->objTable->find('4', Doctrine::FETCH_ARRAY); - $this->assertTrue(is_array($record)); - $this->assertTrue( ! is_object($record)); - $this->assertTrue(array_key_exists('id', $record)); - $this->assertTrue(array_key_exists('name', $record)); - $this->assertTrue( ! $record instanceof Doctrine_Entity); - } catch(Exception $e) { - $this->assertTrue(false); - } - - try { - $record = $this->objTable->find(123); - $this->assertTrue($record === false); - } catch(Exception $e) { - $this->assertTrue(false); - } - - try { - $record = $this->objTable->find(null); - $this->assertTrue($record === false); - } catch(Exception $e) { - $this->assertTrue(false); - } - - try { - $record = $this->objTable->find(false); - $this->assertTrue($record === false); - } catch(Exception $e) { - $this->assertTrue(false); - } - } - - public function testFindAll() - { - $users = $this->objTable->findAll(); - $this->assertEqual($users->count(), 8); - $this->assertTrue($users instanceof Doctrine_Collection); - - $users = $this->objTable->findAll(Doctrine::FETCH_ARRAY); - $this->assertTrue( ! $users instanceof Doctrine_Collection); - $this->assertTrue(is_array($users)); - $this->assertTrue( ! is_object($users)); - $this->assertEqual(count($users), 8); - } - - public function testFindByDql() - { - $users = $this->objTable->findByDql("name LIKE '%Arnold%'"); - $this->assertEqual($users->count(), 1); - $this->assertTrue($users instanceof Doctrine_Collection); - } - - public function testGetProxy() - { - $user = $this->objTable->getProxy(4); - $this->assertTrue($user instanceof Doctrine_Entity); - - try { - $record = $this->objTable->find(123); - } catch(Exception $e) { - $this->assertTrue($e instanceOf Doctrine_Find_Exception); - } - } - - public function testGetColumns() - { - $columns = $this->objTable->getTable()->getColumns(); - $this->assertTrue(is_array($columns)); - - } - - public function testApplyInheritance() - { - $this->assertEqual($this->objTable->applyInheritance("id = 3"), "id = 3 AND type = ?"); - } - -} diff --git a/tests_old/TemplateTestCase.php b/tests_old/TemplateTestCase.php deleted file mode 100644 index 3a6db6bb6..000000000 --- a/tests_old/TemplateTestCase.php +++ /dev/null @@ -1,136 +0,0 @@ -. - */ - -/** - * Doctrine_Template_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Template_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { } - public function prepareData() - { } - - public function testAccessingNonExistingImplementationThrowsException() - { - try { - $user = new ConcreteUser(); - $user->Group; - $this->fail(); - } catch (Doctrine_Relation_Parser_Exception $e) { - $this->pass(); - } - } - - public function testAccessingExistingImplementationSupportsAssociations() - { - $this->manager->setImpl('UserTemplate', 'ConcreteUser') - ->setImpl('GroupUserTemplate', 'ConcreteGroupUser') - ->setImpl('GroupTemplate', 'ConcreteGroup') - ->setImpl('EmailTemplate', 'ConcreteEmail'); - - $user = new ConcreteUser(); - $group = $user->Group[0]; - - $this->assertTrue($group instanceof ConcreteGroup); - - $this->assertTrue($group->User[0] instanceof ConcreteUser); - } - public function testAccessingExistingImplementationSupportsForeignKeyRelations() - { - - $user = new ConcreteUser(); - - $this->assertTrue($user->Email[0] instanceof ConcreteEmail); - } - - public function testShouldCallMethodInTemplate() - { - $user = new ConcreteUser(); - $this->assertEqual("foo", $user->foo()); - } - -} - -// move these to ../templates? -class UserTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('password', 'string'); - } - public function setUp() - { - $this->hasMany('GroupTemplate as Group', array('local' => 'user_id', - 'foreign' => 'group_id', - 'refClass' => 'GroupUserTemplate')); - $this->hasMany('EmailTemplate as Email', array('local' => 'id', - 'foreign' => 'user_id')); - } - - public function foo() - { - return "foo"; - } -} -class EmailTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('address', 'string'); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() - { - $this->hasOne('UserTemplate as User', array('local' => 'user_id', - 'foreign' => 'id')); - } -} -class GroupTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - } - public function setUp() - { - $this->hasMany('UserTemplate as User', array('local' => 'user_id', - 'foreign' => 'group_id', - 'refClass' => 'GroupUserTemplate')); - } -} -class GroupUserTemplate extends Doctrine_Template -{ - public function setTableDefinition() - { - $this->hasColumn('user_id', 'integer'); - $this->hasColumn('group_id', 'integer'); - } -} diff --git a/tests_old/Ticket/381TestCase.php b/tests_old/Ticket/381TestCase.php deleted file mode 100644 index 545baff7c..000000000 --- a/tests_old/Ticket/381TestCase.php +++ /dev/null @@ -1,60 +0,0 @@ -. - */ - -/** - * Doctrine_Ticket381_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Ticket_381_TestCase extends Doctrine_UnitTestCase { - - public function prepareData() - { } - public function prepareTables() { - $this->tables = array('Book'); - parent::prepareTables(); - } - - public function testTicket() - { - $obj = new Book(); - $obj->save(); - $obj->set('name', 'yes'); - $obj->save(); - $this->assertEqual($obj->get('name'), 'yes'); - $obj->save(); - } - public function testTicket2() - { - $obj = new Book(); - $obj->set('name', 'yes2'); - $obj->save(); - $this->assertEqual($obj->get('name'), 'yes2'); - $obj->save(); - } - -} diff --git a/tests_old/Ticket/424BTestCase.php b/tests_old/Ticket/424BTestCase.php deleted file mode 100644 index 7f7fa8fbd..000000000 --- a/tests_old/Ticket/424BTestCase.php +++ /dev/null @@ -1,97 +0,0 @@ -. - */ - -/** - * Doctrine_Ticket424B_TestCase - * - * This test case tests many-many relationship with non-autoincrement primary key - * - * @package Doctrine - * @author Tamcy <7am.online@gmail.com> - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Ticket_424B_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('mmrUser_B', 'mmrGroup_B', 'mmrGroupUser_B'); - - parent::prepareTables(); - } - - protected function newGroup($code, $name) - { - $group = new mmrGroup_B(); - $group->id = $code; - $group->name = $name; - $group->save(); - return $group; - } - - protected function newUser($code, $name, $groups) - { - $u = new mmrUser_B(); - $u->id = $code; - $u->name = $name; - - foreach ($groups as $idx=>$group) { - $u->Group[$idx] = $group; - } - - $u->save(); - return $u; - } - - public function testManyManyRelationWithAliasColumns() - { - $groupA = $this->newGroup(1, 'Group A'); - $groupB = $this->newGroup(2, 'Group B'); - $groupC = $this->newGroup(3, 'Group C'); - - $john = $this->newUser(1, 'John', array($groupA, $groupB)); - $peter = $this->newUser(2, 'Peter', array($groupA, $groupC)); - $alan = $this->newUser(3, 'Alan', array($groupB, $groupC)); - - $q = new Doctrine_Query(); - $gu = $q->from('mmrGroupUser_B')->execute(); - $this->assertEqual(count($gu), 6); - - // Direct query - $q = new Doctrine_Query(); - $gu = $q->from('mmrGroupUser_B')->where('group_id = ?', $groupA->id)->execute(); - $this->assertEqual(count($gu), 2); - - // Query by join - $q = new Doctrine_Query(); - $userOfGroupAByName = $q->from('mmrUser_B u, u.Group g') - ->where('g.name = ?', array($groupA->name)); - $q->execute(); - $this->assertEqual(count($userOfGroupAByName), 2); - - } -} diff --git a/tests_old/Ticket/424CTestCase.php b/tests_old/Ticket/424CTestCase.php deleted file mode 100644 index c31b30309..000000000 --- a/tests_old/Ticket/424CTestCase.php +++ /dev/null @@ -1,96 +0,0 @@ -. - */ - -/** - * Doctrine_Ticket424B_TestCase - * - * This test case tests many-many relationship with non-autoincrement, alias primary key - * - * @package Doctrine - * @author Tamcy <7am.online@gmail.com> - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_424C_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('mmrUser_C', 'mmrGroup_C', 'mmrGroupUser_C'); - parent::prepareTables(); - } - - protected function newGroup($code, $name) - { - $group = new mmrGroup_C(); - $group->id = $code; - $group->name = $name; - $group->save(); - return $group; - } - - protected function newUser($code, $name, $groups) - { - $u = new mmrUser_C(); - $u->id = $code; - $u->name = $name; - foreach ($groups as $idx=>$group) { - $u->Group[$idx] = $group; - } - $u->save(); - return $u; - } - - public function testManyManyRelationWithAliasColumns() - { - $groupA = $this->newGroup(1, 'Group A'); - $groupB = $this->newGroup(2, 'Group B'); - $groupC = $this->newGroup(3, 'Group C'); - - $john = $this->newUser(1, 'John', array($groupA, $groupB)); - $peter = $this->newUser(2, 'Peter', array($groupA, $groupC)); - $alan = $this->newUser(3, 'Alan', array($groupB, $groupC)); - - $q = new Doctrine_Query(); - $gu = $q->from('mmrGroupUser_C')->execute(); - $this->assertEqual(count($gu), 6); - - // Direct query - $q = new Doctrine_Query(); - $gu = $q->from('mmrGroupUser_C')->where('group_id = ?', $groupA->id)->execute(); - $this->assertEqual(count($gu), 2); - - // Query by join - $q = new Doctrine_Query(); - $userOfGroupAByName = $q->from('mmrUser_C u, u.Group g') - ->where('g.name = ?', array($groupA->name)); - - $q->execute(); - - $this->assertEqual(count($userOfGroupAByName), 2); - } -} diff --git a/tests_old/Ticket/428TestCase.php b/tests_old/Ticket/428TestCase.php deleted file mode 100644 index 5441efd8b..000000000 --- a/tests_old/Ticket/428TestCase.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Ticket_428_TestCase extends Doctrine_UnitTestCase -{ - private $_albums; - - public function prepareTables() - { - $this->tables = array('Album', 'Song'); - parent::prepareTables(); - } - - public function prepareData() - { - } - - public function testInitData() - { - // Since the tests do a $this->objTable()->clear() before each method call - // using the User model is not recommended for this test - $albums = new Doctrine_Collection('Album'); - - $albums[0]->name = 'Revolution'; - $albums[0]->Song[0]->title = 'Revolution'; - $albums[0]->Song[1]->title = 'Hey Jude'; - $albums[0]->Song[2]->title = 'Across the Universe'; - $albums[0]->Song[3]->title = 'Michelle'; - $albums->save(); - $this->assertEqual(count($albums[0]->Song), 4); - $this->_albums = $albums; - } - - public function testAggregateValueMappingSupportsLeftJoins() - { - foreach ($this->_albums as $album) { - $album->clearRelated(); - } - - $q = new Doctrine_Query(); - - $q->select('a.name, COUNT(s.id) count')->from('Album a')->leftJoin('a.Song s')->groupby('a.id'); - $albums = $q->execute(); - - // Should not reuse the existing collection in this case - $this->assertEqual(count($albums[0]->Song), 1); - - try { - // Collection[0] should refer to the object with aggregate value - $this->assertEqual($albums[0]['Song'][0]['count'], 4); - } catch (Exception $e) { - $this->fail('count aggregate value should be available'); - } - } -} diff --git a/tests_old/Ticket/438TestCase.php b/tests_old/Ticket/438TestCase.php deleted file mode 100644 index e108765c2..000000000 --- a/tests_old/Ticket/438TestCase.php +++ /dev/null @@ -1,144 +0,0 @@ -. - */ - -/** - * Doctrine_Ticket_438_TestCase - * - * @package Doctrine - * @author Tamcy <7am.online@gmail.com> - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Ticket_438_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('T438_Student', 'T438_Course', 'T438_StudentCourse'); - parent::prepareTables(); - } - - protected function newCourse($id, $name) - { - $course = new T438_Course(); - $course->id = $id; - $course->name = $name; - $course->save(); - return $course; - } - - protected function newStudent($id, $name) - { - $u = new T438_Student(); - $u->id = $id; - $u->name = $name; - $u->save(); - return $u; - } - - protected function newStudentCourse($student, $course) - { - $sc = new T438_StudentCourse; - $sc->student_id = $student->id; - $sc->course_id = $course->id; - $sc->save(); - return $sc; - } - - public function testTicket() - { - $student1 = $this->newStudent('07090002', 'First Student'); - $course1 = $this->newCourse('MATH001', 'Maths'); - $course2 = $this->newCourse('ENG002', 'English Literature'); - - $this->newStudentCourse($student1, $course1); - $this->newStudentCourse($student1, $course2); - - - // 1. Fetch relationship on demand (multiple queries) - $q = new Doctrine_Query(); - $q->from('T438_StudentCourse sc') - ->where('sc.student_id = ? AND sc.course_id = ?',array('07090002', 'MATH001')); - - $record = $q->execute()->getFirst(); - $this->assertEqual($record->student_id, '07090002'); - $this->assertEqual($record->course_id, 'MATH001'); - - $this->assertEqual($record->get('Student')->id, '07090002'); - $this->assertEqual($record->get('Course')->id, 'MATH001'); - - // 2. Fetch relationship in single query - $q = new Doctrine_Query(); - $coll = $q->select('sc.*, s.*, c.*') - ->from('T438_StudentCourse sc, sc.Student s, sc.Course c') - ->where('sc.student_id = ? AND sc.course_id = ?',array('07090002', 'MATH001')) - ->execute(); - - $record = $coll->getFirst(); - $this->assertEqual($record->student_id, '07090002'); - $this->assertEqual($record->course_id, 'MATH001'); - - $this->assertEqual($record->get('Student')->id, '07090002'); - $this->assertEqual($record->get('Course')->id, 'MATH001'); - } -} - - -class T438_Student extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('t438_student_record'); - $class->setColumn('s_id as id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('s_name as name', 'varchar', 50, array ()); - $class->hasMany('T438_Course as StudyCourses', array('refClass' => 'T438_StudentCourse', 'local' => 'sc_student_id', 'foreign' => 'sc_course_id')); - } -} - - -class T438_Course extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('t438_course'); - $class->setColumn('c_id as id', 'varchar', 20, array ( 'primary' => true,)); - $class->setColumn('c_name as name', 'varchar', 50, array ()); - $class->hasMany('T438_Student as Students', array('refClass' => 'T438_StudentCourse', 'local' => 'sc_course_id', 'foreign' => 'sc_student_id')); - } -} - -class T438_StudentCourse extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('t438_student_course'); - $class->setColumn('sc_student_id as student_id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('sc_course_id as course_id', 'varchar', 20, array ( 'primary' => true,)); - $class->setColumn('sc_remark as remark', 'varchar', 500, array ()); - $class->hasOne('T438_Student as Student', array('local' => 'sc_student_id', 'foreign' => 's_id')); - $class->hasOne('T438_Course as Course', array('local' => 'sc_course_id', 'foreign' => 'c_id')); - } -} diff --git a/tests_old/Ticket/480TestCase.php b/tests_old/Ticket/480TestCase.php deleted file mode 100644 index 35a356b4e..000000000 --- a/tests_old/Ticket/480TestCase.php +++ /dev/null @@ -1,62 +0,0 @@ -. - */ - -/** - * Doctrine_Ticket_480_TestCase - * - * @package Doctrine - * @author Miloslav Kmet - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class stComment extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('st_comment'); - $class->setColumn('title', 'string', 100, array()); - $class->setColumn('body', 'string', 1000, array()); - } -} - -class Doctrine_Ticket_480_TestCase extends Doctrine_UnitTestCase -{ - public function testInit() - { - $this->dbh = new Doctrine_Adapter_Mock('oracle'); - $this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); - } - - public function testTicket() - { - $this->conn->export->exportClasses(array('stComment')); - $queries = $this->dbh->getAll(); - - // (2nd|1st except transaction init.) executed query must be CREATE TABLE or CREATE SEQUENCE, not CREATE TRIGGER - // Trigger can be created after both CREATE TABLE and CREATE SEQUENCE - $this->assertFalse(preg_match('~^CREATE TRIGGER.*~', $queries[1])); - $this->assertFalse(preg_match('~^CREATE TRIGGER.*~', $queries[2])); - } -} diff --git a/tests_old/Ticket/576TestCase.php b/tests_old/Ticket/576TestCase.php deleted file mode 100644 index 915fbfc59..000000000 --- a/tests_old/Ticket/576TestCase.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_576_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('Entity'); - parent::prepareTables(); - } - - public function prepareData() { } - - public function testInit() - { - $entity = new Entity(); - $entity->name = 'myname'; - $entity->loginname = 'test'; - $entity->save(); - } - - public function testBug() - { - // load our user and our collection of pages - $user = Doctrine_Query::create()->from('Entity')->fetchOne(); - $this->assertEqual($user->name, 'myname'); - $this->assertEqual($user->loginname, 'test'); - - $user->name = null; - $this->assertEqual($user->name, null); - - $data = Doctrine_Query::create() - ->select('name') - ->from('Entity') - ->fetchOne(array(), Doctrine::FETCH_ARRAY); - - $user->hydrate($data); - $this->assertEqual($user->name, 'myname'); - $this->assertEqual($user->loginname, 'test'); // <<----- this is what the bug is about - } -} diff --git a/tests_old/Ticket/583TestCase.php b/tests_old/Ticket/583TestCase.php deleted file mode 100644 index 34dbcd0ba..000000000 --- a/tests_old/Ticket/583TestCase.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_583_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('Entity'); - parent::prepareTables(); - } - - public function prepareData() { } - - public function testBug() - { - $entity = new Entity(); - $entity->name = 'myname'; - $entity->save(); - - // load our user and our collection of pages - $user = Doctrine_Query::create()->select('id')->from('Entity')->fetchOne(); - $this->assertEqual($user->name, 'myname'); - - // load our user and our collection of pages - $user = Doctrine_Query::create()->select('*')->from('Entity')->fetchOne(); - $this->assertEqual($user->name, 'myname'); - - } -} diff --git a/tests_old/Ticket/587TestCase.php b/tests_old/Ticket/587TestCase.php deleted file mode 100644 index 6d3d25cd1..000000000 --- a/tests_old/Ticket/587TestCase.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_587_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array_merge($this->tables, array('BookmarkUser', 'Bookmark', 'Page')); - parent::prepareTables(); - } - public function prepareData() - { - parent::prepareData(); - } - - public function testInit() - { - $user = new BookmarkUser(); - $user['name'] = 'Anonymous'; - $user->save(); - - $pages = new Doctrine_Collection('Page'); - $pages[0]['name'] = 'Yahoo'; - $pages[0]['url'] = 'http://www.yahoo.com'; - $pages->save(); - - $this->assertEqual(count($pages), 1); - } - - /** - * This test case demonstrates an issue with the identity case in the - * Doctrine_Table class. The brief summary is that if you create a - * record, then delete it, then create another record with the same - * primary keys, the record can get into a state where it is in the - * database but may appear to be marked as TCLEAN under certain - * circumstances (such as when it comes back as part of a collection). - * This makes the $record->exists() method return false, which prevents - * the record from being deleted among other things. - */ - public function testIdentityMapAndRecordStatus() - { - // load our user and our collection of pages - $user = Doctrine_Query::create()->query( - 'SELECT * FROM BookmarkUser u WHERE u.name=?', array('Anonymous') - )->getFirst(); - $pages = Doctrine_Query::create()->query('SELECT * FROM Page'); - - // bookmark the pages (manually) - foreach ($pages as $page) { - $bookmark = new Bookmark(); - $bookmark['page_id'] = $page['id']; - $bookmark['user_id'] = $user['id']; - $bookmark->save(); - } - - // select all bookmarks - $bookmarks = Doctrine_Manager::connection()->query( - 'SELECT * FROM Bookmark b' - ); - $this->assertEqual(count($bookmarks), 1); - - // verify that they all exist - foreach ($bookmarks as $bookmark) { - $this->assertTrue($bookmark->exists()); - } - - // now delete them all. - $user['Bookmarks']->delete(); - - // verify count when accessed directly from database - $bookmarks = Doctrine_Query::create()->query( - 'SELECT * FROM Bookmark' - ); - $this->assertEqual(count($bookmarks), 0); - - // now recreate bookmarks and verify they exist: - foreach ($pages as $page) { - $bookmark = new Bookmark(); - $bookmark['page_id'] = $page['id']; - $bookmark['user_id'] = $user['id']; - $bookmark->save(); - } - - // select all bookmarks for the user - $bookmarks = Doctrine_Manager::connection()->query( - 'SELECT * FROM Bookmark b' - ); - $this->assertEqual(count($bookmarks), 1); - - // verify that they all exist - foreach ($bookmarks as $bookmark) { - $this->assertTrue($bookmark->exists()); - } - } -} diff --git a/tests_old/Ticket/626BTestCase.php b/tests_old/Ticket/626BTestCase.php deleted file mode 100644 index d50ea808e..000000000 --- a/tests_old/Ticket/626BTestCase.php +++ /dev/null @@ -1,144 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_626B_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('T626_Group', 'T626B_Student', 'T626_Course', 'T626B_StudentCourse'); - parent::prepareTables(); - } - - protected function newCourse($id, $name) - { - $course = new T626_Course(); - $course->id = $id; - $course->name = $name; - $course->save(); - return $course; - } - - protected function newGroup($id, $name) - { - $group = new T626_Group(); - $group->id = $id; - $group->name = $name; - $group->save(); - return $group; - } - - protected function newStudent($id, $name, $group) - { - $u = new T626B_Student(); - $u->id = $id; - $u->name = $name; - $u->group_id = $group->id; - $u->save(); - return $u; - } - - protected function newStudentCourse($student, $course) - { - $sc = new T626B_StudentCourse; - $sc->student_id = $student->id; - $sc->course_id = $course->id; - $sc->save(); - return $sc; - } - - public function testTicket() - { - $group1 = $this->newGroup('1', 'Group 1'); - $student1 = $this->newStudent('07090002', 'First Student', $group1); - $course1 = $this->newCourse('MATH001', 'Maths'); - $course2 = $this->newCourse('ENG002', 'English Literature'); - - $this->newStudentCourse($student1, $course1); - $this->newStudentCourse($student1, $course2); - - try { - $group = $student1->get('Group'); - $this->pass(); - } catch (Exception $e) { - $this->fail($e->__toString()); - } - - try { - $courses = $student1->get('StudyCourses'); - $this->pass(); - } catch (Exception $e) { - $this->fail($e->__toString()); - } - - } -} - - -class T626B_Student extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T626B_Student_record'); - - $class->setColumn('s_id as id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('s_g_id as group_id', 'varchar', 30, array ('notnull'=>true)); - $class->setColumn('s_name as name', 'varchar', 50, array ()); - - $class->hasMany('T626_Course as StudyCourses', array('refClass' => 'T626B_StudentCourse', 'local' => 'sc_student_id', 'foreign' => 'sc_course_id')); - $class->hasOne('T626_Group as Group', array('local' => 's_g_id', 'foreign' => 'g_id')); - } -} - -class T626_Group extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T626B_Student_group'); - - $class->setColumn('g_id as id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('g_name as name', 'varchar', 50, array ()); - - $class->hasMany('T626B_Student as Students', array('local' => 'g_id', 'foreign' => 's_id')); - } -} - - -class T626_Course extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T626_course'); - - $class->setColumn('c_id as id', 'varchar', 20, array ( 'primary' => true,)); - $class->setColumn('c_name as name', 'varchar', 50, array ()); - $class->hasMany('T626B_Student as Students', array('refClass' => 'T626B_StudentCourse', 'local' => 'sc_course_id', 'foreign' => 'sc_student_id')); - } -} - -class T626B_StudentCourse extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T626B_Student_course'); - - $class->setColumn('sc_student_id as student_id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('sc_course_id as course_id', 'varchar', 20, array ( 'primary' => true,)); - $class->setColumn('sc_remark as remark', 'varchar', 500, array ()); - $class->hasOne('T626B_Student as Student', array('local' => 'sc_student_id', 'foreign' => 's_id')); - $class->hasOne('T626_Course as Course', array('local' => 'sc_course_id', 'foreign' => 'c_id')); - } -} diff --git a/tests_old/Ticket/626CTestCase.php b/tests_old/Ticket/626CTestCase.php deleted file mode 100644 index acda31937..000000000 --- a/tests_old/Ticket/626CTestCase.php +++ /dev/null @@ -1,85 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_626C_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('T626C_Student1', 'T626C_Student2'); - parent::prepareTables(); - } - - protected function newStudent($cls, $id, $name) - { - $u = new $cls; - $u->id = $id; - $u->name = $name; - $u->save(); - return $u; - } - - public function testFieldNames() - { - $student1 = $this->newStudent('T626C_Student1', '07090002', 'First Student'); - - try { - $students = Doctrine_Query::create() - ->from('T626C_Student1 s INDEXBY s.id') - ->execute(array(), Doctrine::FETCH_ARRAY); - $this->pass(); - } catch (Exception $e) { - $this->fail($e->__toString()); - } - } - - public function testColNames() - { - $student1 = $this->newStudent('T626C_Student2', '07090002', 'First Student'); - - try { - $students = Doctrine_Query::create() - ->from('T626C_Student2 s INDEXBY s.id') - ->execute(array(), Doctrine::FETCH_ARRAY); - $this->pass(); - } catch (Exception $e) { - $this->fail($e->__toString()); - } - } -} - - -class T626C_Student1 extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T626C_Student_record_1'); - - $class->setColumn('s_id as id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('s_name as name', 'varchar', 50, array ()); - } -} - -class T626C_Student2 extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T626C_Student_record_2'); - - $class->setColumn('id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('name', 'varchar', 50, array ()); - } -} \ No newline at end of file diff --git a/tests_old/Ticket/626DTestCase.php b/tests_old/Ticket/626DTestCase.php deleted file mode 100644 index 6dbefd001..000000000 --- a/tests_old/Ticket/626DTestCase.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_626D_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('T626D_Student1'); - parent::prepareTables(); - } - - protected function newStudent($cls, $id, $name) - { - $u = new $cls; - $u->id = $id; - $u->name = $name; - $u->save(); - return $u; - } - - public function testFieldNames() - { - $student1 = $this->newStudent('T626D_Student1', '07090002', 'First Student'); - - try { - $student = $this->conn->getRepository('T626D_Student1')->find('07090002'); - $this->pass(); - } catch (Exception $e) { - $this->fail($e->__toString()); - } - } -} - - -class T626D_Student1 extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T626D_Student_record_1'); - - $class->setColumn('s_id as id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('s_name as name', 'varchar', 50, array ()); - } -} diff --git a/tests_old/Ticket/638TestCase.php b/tests_old/Ticket/638TestCase.php deleted file mode 100644 index 2fbe12ce2..000000000 --- a/tests_old/Ticket/638TestCase.php +++ /dev/null @@ -1,151 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_638_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('T638_Student', 'T638_Course', 'T638_StudentCourse'); - parent::prepareTables(); - } - - protected function newCourse($id, $name) - { - $course = new T638_Course(); - $course->id = $id; - $course->name = $name; - $course->save(); - return $course; - } - - protected function newStudent($id, $name) - { - $u = new T638_Student(); - $u->id = $id; - $u->name = $name; - $u->group_id = 1; - $u->save(); - return $u; - } - - protected function newStudentCourse($student, $course) - { - $sc = new T638_StudentCourse; - $sc->student_id = $student->id; - $sc->course_id = $course->id; - $sc->save(); - return $sc; - } - - public function testTicket() - { - $student1 = $this->newStudent('07090002', 'First Student'); - $course1 = $this->newCourse('MATH001', 'Maths'); - $course2 = $this->newCourse('ENG002', 'English Literature'); - - $sc = new T638_StudentCourse; - $sc->set('Student', $student1); - $sc->set('Course', $course1); - - if ($student1->get('id') instanceof T638_StudentCourse) - { - $this->fail('Student Id incorrectly replaced!'); - } - else - { - $this->pass(); - } - - if ($student1->get('id') != '07090002') - { - $this->fail('Student Id is not correct after assignment!'); - } - else - { - $this->pass(); - } - - if ($course1->get('id') instanceof T638_StudentCourse) - { - $this->fail('Course Id incorrectly replaced!'); - } - else - { - $this->pass(); - } - - if ($course1->get('id') != 'MATH001') - { - $this->fail('Course Id is not correct after assignment!'); - } - else - { - $this->pass(); - } - - $this->assertEqual($sc->get('student_id'), '07090002'); - $this->assertEqual($sc->get('course_id'), 'MATH001'); - $this->assertIdentical($sc->get('Student'), $student1); - $this->assertIdentical($sc->get('Course'), $course1); - } -} - - -class T638_Student extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T638_student'); - - $class->setColumn('s_id as id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('s_g_id as group_id', 'varchar', 30, array ('notnull'=>true)); - $class->setColumn('s_name as name', 'varchar', 50, array ('notnull'=>true)); - } - -} - -class T638_Course extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T638_course'); - - $class->setColumn('c_id as id', 'varchar', 20, array ( 'primary' => true,)); - $class->setColumn('c_name as name', 'varchar', 50, array ('notnull'=>true)); - } - - public function set($fieldName, $value, $load = true) - { - parent::set($fieldName, $value, $load); - } -} - -class T638_StudentCourse extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T638_Student_course'); - - $class->setColumn('sc_student_id as student_id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('sc_course_id as course_id', 'varchar', 20, array ( 'primary' => true,)); - $class->setColumn('sc_remark as remark', 'varchar', 500, array ('notnull'=>true)); - - $class->hasOne('T638_Student as Student', array('local' => 'sc_student_id', 'foreign' => 's_id')); - $class->hasOne('T638_Course as Course', array('local' => 'sc_course_id', 'foreign' => 'c_id')); - } -} - diff --git a/tests_old/Ticket/642TestCase.php b/tests_old/Ticket/642TestCase.php deleted file mode 100644 index 8ad705be9..000000000 --- a/tests_old/Ticket/642TestCase.php +++ /dev/null @@ -1,65 +0,0 @@ -. - */ - -/** - * Doctrine_Ticket_642_TestCase - * - * @package Doctrine - * @author Guilherme Blanco - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Ticket_642_TestCase extends Doctrine_UnitTestCase -{ - public function testInit() - { - $this->dbh = new Doctrine_Adapter_Mock('mysql'); - $this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); - } - - - public function testTest() - { - $this->conn->export->exportClasses(array('stDummyObj')); - $queries = $this->dbh->getAll(); - - // Default was not being defined, even if notnull was set - $this->assertEqual("CREATE TABLE st_dummy_obj (id BIGINT AUTO_INCREMENT, startdate DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB", $queries[1]); - } -} - - -class stDummyObj extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('st_dummy_obj'); - $class->setColumn('startDate', 'timestamp', null, array( - 'notnull' => true, - 'default' => '0000-00-00 00:00:00' - )); - } -} - -?> \ No newline at end of file diff --git a/tests_old/Ticket/673TestCase.php b/tests_old/Ticket/673TestCase.php deleted file mode 100644 index 0624edb37..000000000 --- a/tests_old/Ticket/673TestCase.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_673_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - - public function prepareTables() - { - $this->tables = array('T673_Student'); - parent::prepareTables(); - } - - public function testTicket() - { - $q = Doctrine_Query::create() - ->update('T673_Student s') - ->set('s.foo', 's.foo + 1') - ->where('s.id = 2'); - - $this->assertTrue(preg_match_all('/(s_foo)/', $q->getSql(), $m) === 2); - $this->assertTrue(preg_match_all('/(s_id)/', $q->getSql(), $m) === 1); - - try { - $q->execute(); - $this->pass(); - } catch (Exception $e) { - $this->fail($e->__toString()); - } - - $q = Doctrine_Query::create() - ->delete() - ->from('T673_Student s') - ->where('s.name = ? AND s.foo < ?', 'foo', 3); - - $this->assertTrue(preg_match_all('/(s_name)/', $q->getSql(), $m) === 1); - $this->assertTrue(preg_match_all('/(s_foo)/', $q->getSql(), $m) === 1); - - try { - $q->execute(); - $this->pass(); - } catch (Exception $e) { - $this->fail($e->__toString()); - } - } -} - - -class T673_Student extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('T673_Student_record'); - - $class->setColumn('s_id as id', 'varchar', 30, array ( 'primary' => true,)); - $class->setColumn('s_foo as foo', 'integer', 4, array ('notnull'=>true)); - $class->setColumn('s_name as name', 'varchar', 50, array ()); - } -} diff --git a/tests_old/Ticket/697TestCase.php b/tests_old/Ticket/697TestCase.php deleted file mode 100644 index eca87108e..000000000 --- a/tests_old/Ticket/697TestCase.php +++ /dev/null @@ -1,63 +0,0 @@ -tables = array('T697_Person', 'T697_User'); - parent::prepareTables(); - } - - public function testIdsAreSetWhenSavingSubclassInstancesInCTI() - { - $p = new T697_Person(); - $p['name']='Rodrigo'; - $p->save(); - $this->assertEqual(1, $p->id); - - $u = new T697_User(); - $u['name']='Fernandes'; - $u['password']='Doctrine RULES'; - $u->save(); - $this->assertEqual(2, $u->id); - } -} - -class T697_Person extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, array( - 'discriminatorColumn' => 'dtype', - 'discriminatorMap' => array( - 1 => 'T697_Person', 2 => 'T697_User' - ) - )); - $class->setSubclasses(array('T697_User')); - $class->setTableName('t697_person'); - $class->setColumn('name', 'string', 30); - $class->setColumn('dtype', 'integer', 4); - } -} - -//Class table inheritance -class T697_User extends T697_Person { - public static function initMetadata($class) - { - $class->setTableName('t697_user'); - $class->setColumn('password', 'string', 30); - } -} diff --git a/tests_old/Ticket/741TestCase.php b/tests_old/Ticket/741TestCase.php deleted file mode 100644 index 42e188522..000000000 --- a/tests_old/Ticket/741TestCase.php +++ /dev/null @@ -1,80 +0,0 @@ -tables = array('Parent741', 'Child741'); - parent::prepareTables(); - } - - public function testTicket() - { - $moo = new Parent741(); - $moo->amount = 1000; - $cow = new Child741(); - - $moo->Cows[] = $cow; - $cow->Moo = $moo; - $moo->save(); - $this->assertEqual($moo->amount, 0); - } - -} - - - -class Parent741 extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setColumn('id', 'integer', 4, array ( - 'primary' => true, - 'autoincrement' => true, - 'notnull' => true, - )); - - $class->setColumn('amount', 'integer'); - $class->hasMany('Child741 as Cows', array('local' => 'id', 'foreign' => 'moo_id')); - } -} - -class Child741 extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setColumn('id', 'integer', 4, array ( - 'primary' => true, - 'autoincrement' => true, - 'notnull' => true, - )); - - $class->setColumn('moo_id', 'integer'); - $class->hasOne('Parent741 as Moo', array('local' => 'moo_id', 'foreign' => 'id')); - } - - public function postInsert($e) - { - - //echo "State: ". $this->Moo->state() . " \t Amount: " . $this->Moo->amount . "\n"; - $this->Moo->amount = 0; - //echo "State: ". $this->Moo->state() . " \t Amount: " . $this->Moo->amount . "\n"; - $this->Moo->save(); - //echo "State: ". $this->Moo->state() . " \t Amount: " . $this->Moo->amount . "\n"; - $this->Moo->refresh(); - //echo "State: ". $this->Moo->state() . " \t Amount: " . $this->Moo->amount . "\n"; - /* - This outputs the following - State: 6 Amount: 1000 - State: 6 Amount: 0 - State: 6 Amount: 0 - State: 3 Amount: 1000 - - */ - } -} diff --git a/tests_old/Ticket/749TestCase.php b/tests_old/Ticket/749TestCase.php deleted file mode 100644 index 046dbcac1..000000000 --- a/tests_old/Ticket/749TestCase.php +++ /dev/null @@ -1,149 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - * - * This test case demonstrates a problem with column aggregation inheritance - * in Doctrine 0.9. The high level summary is that it is possible to make - * it work in general -- if class B is a subclass of class A, you can select - * from class A and get back objects of class B. However, those objects do - * not have the related objects of class B, and in fact an exception is - * thrown when you try to access those related objects. - * - * This test case should not probably be applied to trunk and possibly not - * to 0.10 branch. I'm not sure it's even possible to fix in 0.9 but it is - * an issue that keeps arising for me so it seemed worth a test case. - */ - -class Doctrine_Ticket_749_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables = array('Parent749', 'Record749', 'RelatedRecord749'); - parent::prepareTables(); - } - - public function prepareData() - { - $record = new Record749(); - $record['title'] = 'Test Record 1'; - $record['Related']['content'] = 'Test Content 1'; - $record->save(); - - $record = new Record749(); - $record['title'] = 'Test Record 2'; - $record['Related']['content'] = 'Test Content 2'; - $record->save(); - } - - public function testSelectDataFromSubclassAsCollection() - { - $records = Doctrine_Query::create()->query(' - FROM Record749 r ORDER BY r.title - ', array()); - - $this->verifyRecords($records); - } - - public function testSelectDataFromParentClassAsCollection() - { - $records = Doctrine_Query::create()->query(' - FROM Parent749 p ORDER BY p.title - ', array()); - - $this->verifyRecords($records); - } - - /** - * This method is used by both tests, as the collection of records should - * be identical for both of them if things are working properly. - */ - private function verifyRecords ($records) { - $expected_values = array( - array('title'=>'Test Record 1', 'content'=>'Test Content 1'), - array('title'=>'Test Record 2', 'content'=>'Test Content 2'), - ); - - foreach ($records as $record) { - $this->assertTrue($record instanceof Record749); - $expected = array_shift($expected_values); - $this->assertEqual($record['title'], $expected['title']); - try { - $this->assertEqual($record['Related']['content'], $expected['content']); - } catch (Exception $e) { - $this->fail('Caught exception when trying to get related content.'); - } - } - } -} - -class Parent749 extends Doctrine_Entity -{ - public function setTableDefinition() - { - $this->setTableName('mytable'); - $this->hasColumn('id', 'integer', 4, array ( - 'primary' => true, - 'autoincrement' => true, - 'notnull' => true, - )); - - $this->hasColumn('title', 'string', 255, array ()); - $this->hasColumn('type', 'integer', 11, array ()); - - $this->option('subclasses', array('Record749')); - } - - public function setUp() - { - } -} - -class Record749 extends Parent749 -{ - public function setTableDefinition() - { - parent::setTableDefinition(); - $this->setTableName('mytable'); - } - - public function setUp() - { - parent::setUp(); - $this->hasOne('RelatedRecord749 as Related', array('local' => 'id', - 'foreign' => 'record_id')); - - $this->setInheritanceMap(array('type' => '1')); - } -} - -class RelatedRecord749 extends Doctrine_Entity -{ - public function setTableDefinition() - { - $this->hasColumn('id', 'integer', 4, array ( - 'primary' => true, - 'autoincrement' => true, - 'notnull' => true, - )); - - $this->hasColumn('content', 'string', 255, array ()); - $this->hasColumn('record_id', 'integer', null, array ('unique' => true,)); - } - - public function setUp() - { - $this->hasOne('Record749 as Record', array('local' => 'record_id', - 'foreign' => 'id', - 'onDelete' => 'cascade')); - } - -} - diff --git a/tests_old/Ticket/912TestCase.php b/tests_old/Ticket/912TestCase.php deleted file mode 100644 index b448d9090..000000000 --- a/tests_old/Ticket/912TestCase.php +++ /dev/null @@ -1,234 +0,0 @@ -. - */ - -/** - * Doctrine_Ticket_912_TestCase - * - * @package Doctrine - * @author David Stendardi - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Ticket_912_TestCase extends Doctrine_UnitTestCase { - - /** - * prepareData - */ - - public function prepareData() - { - $oResume = new ticket912_Resume; - $oResume->title = 'titre'; - $oResume->Person->name = 'David'; - $oResume->KnownLanguages[0]->comments = 'foo'; - $oResume->KnownLanguages[0]->Language->label = "Enlish"; - $oResume->KnownLanguages[0]->Level->label = "Fluent"; - $oResume->save(); - } - - /** - * prepareTables - */ - - public function prepareTables() - { - $this->tables = array(); - $this->tables[] = 'ticket912_Resume'; - $this->tables[] = 'ticket912_Person'; - $this->tables[] = 'ticket912_ResumeHasLanguage'; - $this->tables[] = 'ticket912_LanguageLevel'; - $this->tables[] = 'ticket912_Language'; - - parent :: prepareTables(); - } - - - /** - * Test the existence expected indexes - */ - - public function testTicket() - { - $q = new Doctrine_Query(); - - // simple query with deep relations - $q->addSelect('Resume.id, Person.id, Person.name, KnownLanguages.id, Level.label, Language.label') - ->from('ticket912_Resume Resume') - ->leftJoin('Resume.Person Person') - ->leftJoin('Resume.KnownLanguages KnownLanguages') - ->leftJoin('KnownLanguages.Level Level') - ->leftJoin('KnownLanguages.Language Language'); - - $aResult = $q->fetchArray(); - - // should be setted.. - $issetLevel = isset($aResult[0]['KnownLanguages'][0]['Level']); - $issetLanguage = isset($aResult[0]['KnownLanguages'][0]['Language']); - - $this->assertTrue($issetLevel); - $this->assertTrue($issetLanguage); - - } -} - - -/** - * This class has been auto-generated by the Doctrine ORM Framework - */ - -class ticket912_Resume extends Doctrine_Entity -{ - public static function initMetadata($mapping) - { - $mapping->setTableName('resume'); - $mapping->mapColumn('id', 'integer', 8, array ( - 'primary' => true, - 'autoincrement' => true, - 'unsigned' => true, - )); - - $mapping->mapColumn('person_id', 'integer', 8, array('unsigned' => true)); - $mapping->mapColumn('title', 'string', 255); - - $mapping->hasMany('ticket912_ResumeHasLanguage as KnownLanguages', array('local' => 'id', 'foreign' => 'resume_id')); - - $mapping->hasOne('ticket912_Person as Person', array( - 'local' => 'person_id', - 'foreign' => 'id', - 'onDelete' => 'SET NULL', - 'onUpdate' => 'CASCADE' - )); - } -} - -/** - * First level one to one relation class Language - */ -class ticket912_Person extends Doctrine_Entity -{ - public static function initMetadata($mapping) - { - $mapping->setTableName('person'); - $mapping->mapColumn('id', 'integer', 8, array ( - 'primary' => true, - 'autoincrement' => true, - 'unsigned' => true, - )); - - $mapping->mapColumn('name', 'string', 255, array ()); - } -} - - -/** - * Second level one to many relation class ResumeHasLanguageLanguage - */ - -class ticket912_ResumeHasLanguage extends Doctrine_Entity -{ - public static function initMetadata($mapping) - { - $mapping->setTableName('resume_has_language'); - $mapping->mapColumn('id', 'integer', 8, array ( - 'primary' => true, - 'autoincrement' => true, - 'unsigned' => true, - )); - - $mapping->mapColumn('resume_id', 'integer', 8, array ( - 'notnull' => true, - 'unsigned' => true, - )); - - $mapping->mapColumn('language_id', 'integer', 2, array ( - 'unsigned' => true, - )); - - $mapping->mapColumn('language_level_id', 'integer', 2, array ( - 'unsigned' => true, - )); - - $mapping->mapColumn('comments', 'string', 4000, array ()); - - $mapping->hasOne('ticket912_Resume as Resume', array('local' => 'resume_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE')); - - $mapping->hasOne('ticket912_Language as Language', array('local' => 'language_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE')); - - $mapping->hasOne('ticket912_LanguageLevel as Level', array('local' => 'language_level_id', - 'foreign' => 'id', - 'onDelete' => 'SET NULL', - 'onUpdate' => 'CASCADE')); - } -} - - - -/** - * Third level one to one relation class Language - */ -class ticket912_Language extends Doctrine_Entity -{ - public static function initMetadata($mapping) - { - $mapping->setTableName('language'); - $mapping->mapColumn('id', 'integer', 2, array( - 'primary' => true, - 'autoincrement' => true, - 'unsigned' => true, - )); - - $mapping->mapColumn('label', 'string', 100, array ('notnull' => true)); - - $mapping->hasMany('ticket912_Resume as Resumes', array('local' => 'id', 'foreign' => 'language_id')); - $mapping->hasMany('ticket912_ResumeHasLanguage as ResumeKnownLanguages', array('local' => 'id', 'foreign' => 'language_id')); - } -} - -/** - * Third level one to one relation class Language - */ - -class ticket912_LanguageLevel extends Doctrine_Entity -{ - public static function initMetadata($mapping) - { - $mapping->setTableName('language_level'); - $mapping->mapColumn('id', 'integer', 2, array ( - 'primary' => true, - 'autoincrement' => true, - 'unsigned' => true, - )); - - $mapping->mapColumn('label', 'string', 100, array ('notnull' => true)); - - $mapping->hasMany('ticket912_ResumeHasLanguage as ResumeKnownLanguages', array( - 'local' => 'id', - 'foreign' => 'language_level_id')); - } -} \ No newline at end of file diff --git a/tests_old/Ticket/NjeroTestCase.php b/tests_old/Ticket/NjeroTestCase.php deleted file mode 100644 index 322bef4cb..000000000 --- a/tests_old/Ticket/NjeroTestCase.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ - -class Doctrine_Ticket_Njero_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() { } - public function prepareTables() - { - $this->tables = array(); - $this->tables[] = 'CoverageCodeN'; - $this->tables[] = 'PolicyCodeN'; - $this->tables[] = 'LiabilityCodeN'; - $this->tables[] = 'PolicyN'; - $this->tables[] = 'RateN'; - parent::prepareTables(); - } - - public function testHasOneMultiLevelRelations() - { - $policy_code = new PolicyCodeN(); - $policy_code->code = 1; - $policy_code->description = "Special Policy"; - $policy_code->save(); - - $coverage_code = new CoverageCodeN(); - $coverage_code->code = 1; - $coverage_code->description = "Full Coverage"; - $coverage_code->save(); - - $coverage_code = new CoverageCodeN(); - $coverage_code->code = 3; # note we skip 2 - $coverage_code->description = "Partial Coverage"; - $coverage_code->save(); - - $liability_code = new LiabilityCodeN(); - $liability_code->code = 1; - $liability_code->description = "Limited Territory"; - $liability_code->save(); - - $rate = new RateN(); - $rate->policy_code = 1; - $rate->coverage_code = 3; - $rate->liability_code = 1; - $rate->total_rate = 123.45; - $rate->save(); - - $policy = new PolicyN(); - $policy->rate_id = 1; - $policy->policy_number = "123456789"; - $policy->save(); - - $q = new Doctrine_Query(); - - # If I use - # $p = $q->from('PolicyN p') - # this test passes, but there is another issue just not reflected in this test yet, see "in my app" note below - - $q->from('PolicyN p, p.RateN r, r.PolicyCodeN y, r.CoverageCodeN c, r.LiabilityCodeN l') - ->where('(p.id = ?)', array('1')); - - $p = $q->execute()->getFirst(); - - $this->assertEqual($p->rate_id, 1); - $this->assertEqual($p->RateN->id, 1); - $this->assertEqual($p->RateN->policy_code, 1); - $this->assertEqual($p->RateN->coverage_code, 3); # fail - $this->assertEqual($p->RateN->liability_code, 1); - - $c = $p->RateN->coverage_code; - $c2 = $p->RateN->CoverageCodeN->code; - $c3 = $p->RateN->coverage_code; - - $this->assertEqual($c, $c2); # fail - $this->assertEqual($c, $c3); # in my app this fails as well, but I can't reproduce this - #echo "Values " . serialize(array($c, $c2, $c3)); - - } -} diff --git a/tests_old/TokenizerTestCase.php b/tests_old/TokenizerTestCase.php deleted file mode 100644 index 26e0f3020..000000000 --- a/tests_old/TokenizerTestCase.php +++ /dev/null @@ -1,137 +0,0 @@ -. - */ - -/** - * Doctrine_Tokenizer_TestCase - * This class tests the functinality of Doctrine_Tokenizer component - * - * @package Doctrine - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision: 1181 $ - * @author Konsta Vesterinen - */ -class Doctrine_Tokenizer_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - - public function testSqlExplode() - { - $tokenizer = new Doctrine_Query_Tokenizer(); - - $str = "word1 word2 word3"; - $a = $tokenizer->sqlExplode($str); - - $this->assertEqual($a, array("word1", "word2", "word3")); - - $str = "word1 (word2 word3)"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "(word2 word3)")); - - $str = "word1 'word2 word3'"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "'word2 word3'")); - - $str = "word1 'word2 word3'"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "'word2 word3'")); - - $str = "word1 \"word2 word3\""; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "\"word2 word3\"")); - - $str = "word1 ((word2) word3)"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "((word2) word3)")); - - $str = "word1 ( (word2) 'word3')"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "( (word2) 'word3')")); - - $str = "word1 ( \"(word2) 'word3')"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "( \"(word2) 'word3')")); - - $str = "word1 ( ''(word2) 'word3')"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "( ''(word2) 'word3')")); - - $str = "word1 ( '()()'(word2) 'word3')"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "( '()()'(word2) 'word3')")); - - $str = "word1 'word2)() word3'"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "'word2)() word3'")); - - $str = "word1 (word2() word3)"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "(word2() word3)")); - - $str = "word1 \"word2)() word3\""; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("word1", "\"word2)() word3\"")); - - $str = "something (subquery '')"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("something", "(subquery '')")); - - $str = "something (( ))"; - $a = $tokenizer->sqlExplode($str); - $this->assertEqual($a, array("something", "(( ))")); - } - - public function testSqlExplode2() - { - $tokenizer = new Doctrine_Query_Tokenizer(); - $str = 'rdbms (dbal OR database)'; - $a = $tokenizer->sqlExplode($str, ' OR '); - - $this->assertEqual($a, array('rdbms (dbal OR database)')); - } - - public function testBracketExplode() - { - $tokenizer = new Doctrine_Query_Tokenizer(); - - $str = 'foo.field AND bar.field'; - $a = $tokenizer->bracketExplode($str, array(' \&\& ', ' AND '), '(', ')'); - $this->assertEqual($a, array('foo.field', 'bar.field')); - - // delimiters should be case insensitive - $str = 'foo.field and bar.field'; - $a = $tokenizer->bracketExplode($str, array(' \&\& ', ' AND '), '(', ')'); - $this->assertEqual($a, array('foo.field', 'bar.field')); - } - - - public function testQuoteExplodedShouldQuoteArray() - { - $tokenizer = new Doctrine_Query_Tokenizer(); - $term = $tokenizer->quoteExplode("test", array("'test'", "test2")); - $this->assertEqual($term[0], "test"); - } -} diff --git a/tests_old/Transaction/FirebirdTestCase.php b/tests_old/Transaction/FirebirdTestCase.php deleted file mode 100644 index 6e67c3ea6..000000000 --- a/tests_old/Transaction/FirebirdTestCase.php +++ /dev/null @@ -1,113 +0,0 @@ -. - */ - -/** - * Doctrine_Transaction_Firebird_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Transaction_Firebird_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateSavePointExecutesSql() - { - $this->transaction->beginTransaction('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'SAVEPOINT mypoint'); - } - public function testReleaseSavePointExecutesSql() - { - $this->transaction->commit('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'RELEASE SAVEPOINT mypoint'); - } - public function testRollbackSavePointExecutesSql() - { - $this->transaction->beginTransaction('mypoint'); - $this->transaction->rollback('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'ROLLBACK TO SAVEPOINT mypoint'); - } - public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() - { - try { - $this->transaction->setIsolation('unknown'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - public function testSetIsolationThrowsExceptionOnUnknownWaitMode() - { - try { - $this->transaction->setIsolation('READ UNCOMMITTED', array('wait' => 'unknown')); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - public function testSetIsolationThrowsExceptionOnUnknownReadWriteMode() - { - try { - $this->transaction->setIsolation('READ UNCOMMITTED', array('rw' => 'unknown')); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - public function testSetIsolationExecutesSql() - { - $this->transaction->setIsolation('READ UNCOMMITTED'); - $this->transaction->setIsolation('READ COMMITTED'); - $this->transaction->setIsolation('REPEATABLE READ'); - $this->transaction->setIsolation('SERIALIZABLE'); - - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL SNAPSHOT TABLE STABILITY'); - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL SNAPSHOT'); - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED NO RECORD_VERSION'); - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED RECORD_VERSION'); - } - public function testSetIsolationSupportsReadWriteOptions() - { - $this->transaction->setIsolation('SERIALIZABLE', array('rw' => 'READ ONLY')); - - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION READ ONLY ISOLATION LEVEL SNAPSHOT TABLE STABILITY'); - - $this->transaction->setIsolation('SERIALIZABLE', array('rw' => 'READ WRITE')); - - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION READ WRITE ISOLATION LEVEL SNAPSHOT TABLE STABILITY'); - } - public function testSetIsolationSupportsWaitOptions() - { - $this->transaction->setIsolation('SERIALIZABLE', array('wait' => 'NO WAIT')); - - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION NO WAIT ISOLATION LEVEL SNAPSHOT TABLE STABILITY'); - - $this->transaction->setIsolation('SERIALIZABLE', array('wait' => 'WAIT')); - - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION WAIT ISOLATION LEVEL SNAPSHOT TABLE STABILITY'); - } -} diff --git a/tests_old/Transaction/InformixTestCase.php b/tests_old/Transaction/InformixTestCase.php deleted file mode 100644 index aadb930a0..000000000 --- a/tests_old/Transaction/InformixTestCase.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -/** - * Doctrine_Transaction_Informix_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Transaction_Informix_TestCase extends Doctrine_UnitTestCase -{ -} diff --git a/tests_old/Transaction/MssqlTestCase.php b/tests_old/Transaction/MssqlTestCase.php deleted file mode 100644 index 0200677dd..000000000 --- a/tests_old/Transaction/MssqlTestCase.php +++ /dev/null @@ -1,62 +0,0 @@ -. - */ - -/** - * Doctrine_Transaction_Firebird_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Transaction_Mssql_TestCase extends Doctrine_Driver_UnitTestCase -{ - public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() - { - try { - $this->transaction->setIsolation('unknown'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - public function testSetIsolationExecutesSql() - { - $this->transaction->setIsolation('READ UNCOMMITTED'); - $this->transaction->setIsolation('READ COMMITTED'); - $this->transaction->setIsolation('REPEATABLE READ'); - $this->transaction->setIsolation('SERIALIZABLE'); - - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'); - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ'); - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED'); - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED'); - } - public function testSetIsolationSupportsSnapshotMode() - { - $this->transaction->setIsolation('SNAPSHOT'); - - $this->assertEqual($this->adapter->pop(), 'SET TRANSACTION ISOLATION LEVEL SNAPSHOT'); - } -} diff --git a/tests_old/Transaction/MysqlTestCase.php b/tests_old/Transaction/MysqlTestCase.php deleted file mode 100644 index 6d7efa6cb..000000000 --- a/tests_old/Transaction/MysqlTestCase.php +++ /dev/null @@ -1,75 +0,0 @@ -. - */ - -/** - * Doctrine_Transaction_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Transaction_Mysql_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateSavePointExecutesSql() - { - $this->transaction->beginTransaction('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'SAVEPOINT mypoint'); - } - public function testReleaseSavePointExecutesSql() - { - $this->transaction->commit('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'RELEASE SAVEPOINT mypoint'); - } - public function testRollbackSavePointExecutesSql() - { - $this->transaction->beginTransaction('mypoint'); - $this->transaction->rollback('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'ROLLBACK TO SAVEPOINT mypoint'); - } - public function testGetIsolationExecutesSql() - { - $this->transaction->getIsolation(); - - $this->assertEqual($this->adapter->pop(), 'SELECT @@tx_isolation'); - } - public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() - { - try { - $this->transaction->setIsolation('unknown'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - public function testSetIsolationExecutesSql() - { - $this->transaction->setIsolation('READ UNCOMMITTED'); - - $this->assertEqual($this->adapter->pop(), 'SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED'); - } -} diff --git a/tests_old/Transaction/OracleTestCase.php b/tests_old/Transaction/OracleTestCase.php deleted file mode 100644 index 768a5b8d2..000000000 --- a/tests_old/Transaction/OracleTestCase.php +++ /dev/null @@ -1,73 +0,0 @@ -. - */ - -/** - * Doctrine_Transaction_Mysql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Transaction_Oracle_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateSavePointExecutesSql() - { - $this->transaction->beginTransaction('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'SAVEPOINT mypoint'); - } - public function testReleaseSavePointAlwaysReturnsTrue() - { - $this->assertEqual($this->transaction->commit('mypoint'), true); - } - public function testRollbackSavePointExecutesSql() - { - $this->transaction->beginTransaction('mypoint'); - $this->transaction->rollback('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'ROLLBACK TO SAVEPOINT mypoint'); - } - public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() - { - try { - $this->transaction->setIsolation('unknown'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - public function testSetIsolationExecutesSql() - { - $this->transaction->setIsolation('READ UNCOMMITTED'); - $this->transaction->setIsolation('READ COMMITTED'); - $this->transaction->setIsolation('REPEATABLE READ'); - $this->transaction->setIsolation('SERIALIZABLE'); - - $this->assertEqual($this->adapter->pop(), 'ALTER SESSION ISOLATION LEVEL SERIALIZABLE'); - $this->assertEqual($this->adapter->pop(), 'ALTER SESSION ISOLATION LEVEL SERIALIZABLE'); - $this->assertEqual($this->adapter->pop(), 'ALTER SESSION ISOLATION LEVEL SERIALIZABLE'); - $this->assertEqual($this->adapter->pop(), 'ALTER SESSION ISOLATION LEVEL READ COMMITTED'); - } -} diff --git a/tests_old/Transaction/PgsqlTestCase.php b/tests_old/Transaction/PgsqlTestCase.php deleted file mode 100644 index 7df34991f..000000000 --- a/tests_old/Transaction/PgsqlTestCase.php +++ /dev/null @@ -1,69 +0,0 @@ -. - */ - -/** - * Doctrine_Transaction_Pgsql_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Transaction_Pgsql_TestCase extends Doctrine_UnitTestCase -{ - public function testCreateSavePointExecutesSql() - { - $this->transaction->beginTransaction('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'SAVEPOINT mypoint'); - } - public function testReleaseSavePointExecutesSql() - { - $this->transaction->commit('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'RELEASE SAVEPOINT mypoint'); - } - public function testRollbackSavePointExecutesSql() - { - $this->transaction->beginTransaction('mypoint'); - $this->transaction->rollback('mypoint'); - - $this->assertEqual($this->adapter->pop(), 'ROLLBACK TO SAVEPOINT mypoint'); - } - public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() - { - try { - $this->transaction->setIsolation('unknown'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - public function testSetIsolationExecutesSql() - { - $this->transaction->setIsolation('READ UNCOMMITTED'); - - $this->assertEqual($this->adapter->pop(), 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ UNCOMMITTED'); - } -} diff --git a/tests_old/Transaction/SqliteTestCase.php b/tests_old/Transaction/SqliteTestCase.php deleted file mode 100644 index 40b7dc003..000000000 --- a/tests_old/Transaction/SqliteTestCase.php +++ /dev/null @@ -1,56 +0,0 @@ -. - */ - -/** - * Doctrine_Transaction_Sqlite_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Transaction_Sqlite_TestCase extends Doctrine_UnitTestCase -{ - public function testSetIsolationThrowsExceptionOnUnknownIsolationMode() - { - try { - $this->transaction->setIsolation('unknown'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - public function testSetIsolationExecutesSql() - { - $this->transaction->setIsolation('READ UNCOMMITTED'); - $this->transaction->setIsolation('READ COMMITTED'); - $this->transaction->setIsolation('REPEATABLE READ'); - $this->transaction->setIsolation('SERIALIZABLE'); - - $this->assertEqual($this->adapter->pop(), 'PRAGMA read_uncommitted = 1'); - $this->assertEqual($this->adapter->pop(), 'PRAGMA read_uncommitted = 1'); - $this->assertEqual($this->adapter->pop(), 'PRAGMA read_uncommitted = 1'); - $this->assertEqual($this->adapter->pop(), 'PRAGMA read_uncommitted = 0'); - } -} diff --git a/tests_old/TransactionTestCase.php b/tests_old/TransactionTestCase.php deleted file mode 100644 index 1e61caba3..000000000 --- a/tests_old/TransactionTestCase.php +++ /dev/null @@ -1,317 +0,0 @@ -. - */ - -/** - * Doctrine_Transaction_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Transaction_TestCase extends Doctrine_UnitTestCase -{ - public function testInit() - { - $this->transaction = new Doctrine_Transaction_Mock(); - - $this->listener = new TransactionListener(); - - $this->conn->setListener($this->listener); - } - - public function testCreateSavepointListenersGetInvoked() - { - try { - $this->transaction->beginTransaction('point'); - - $this->pass(); - } catch(Doctrine_Transaction_Exception $e) { - $this->fail(); - } - - $this->assertEqual($this->listener->pop(), 'postSavepointCreate'); - $this->assertEqual($this->listener->pop(), 'preSavepointCreate'); - } - - public function testCommitSavepointListenersGetInvoked() - { - try { - $this->transaction->commit('point'); - - $this->pass(); - } catch(Doctrine_Transaction_Exception $e) { - $this->fail(); - } - - $this->assertEqual($this->listener->pop(), 'postSavepointCommit'); - $this->assertEqual($this->listener->pop(), 'preSavepointCommit'); - $this->assertEqual($this->transaction->getTransactionLevel(), 0); - } - - public function testNestedSavepoints() - { - $this->assertEqual($this->transaction->getTransactionLevel(), 0); - $this->transaction->beginTransaction(); - $this->assertEqual($this->transaction->getTransactionLevel(), 1); - $this->transaction->beginTransaction('point 1'); - $this->assertEqual($this->transaction->getTransactionLevel(), 2); - $this->transaction->beginTransaction('point 2'); - $this->assertEqual($this->transaction->getTransactionLevel(), 3); - $this->transaction->commit('point 2'); - $this->assertEqual($this->transaction->getTransactionLevel(), 2); - $this->transaction->commit('point 1'); - $this->assertEqual($this->transaction->getTransactionLevel(), 1); - $this->transaction->commit(); - $this->assertEqual($this->transaction->getTransactionLevel(), 0); - } - - public function testRollbackSavepointListenersGetInvoked() - { - try { - $this->transaction->beginTransaction('point'); - $this->transaction->rollback('point'); - - $this->pass(); - } catch(Doctrine_Transaction_Exception $e) { - $this->fail(); - } - - $this->assertEqual($this->listener->pop(), 'postSavepointRollback'); - $this->assertEqual($this->listener->pop(), 'preSavepointRollback'); - $this->assertEqual($this->listener->pop(), 'postSavepointCreate'); - $this->assertEqual($this->listener->pop(), 'preSavepointCreate'); - $this->assertEqual($this->transaction->getTransactionLevel(), 0); - - $this->listener = new Doctrine_Eventlistener(); - $this->conn->setListener($this->listener); - } - - public function testCreateSavepointIsOnlyImplementedAtDriverLevel() - { - try { - $this->transaction->beginTransaction('savepoint'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - - public function testReleaseSavepointIsOnlyImplementedAtDriverLevel() - { - try { - $this->transaction->commit('savepoint'); - $this->fail(); - } catch (Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - - public function testRollbackSavepointIsOnlyImplementedAtDriverLevel() - { - try { - $this->transaction->rollback('savepoint'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - - public function testSetIsolationIsOnlyImplementedAtDriverLevel() - { - try { - $this->transaction->setIsolation('READ UNCOMMITTED'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - - public function testGetIsolationIsOnlyImplementedAtDriverLevel() - { - try { - $this->transaction->GetIsolation('READ UNCOMMITTED'); - $this->fail(); - } catch(Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - - public function testTransactionLevelIsInitiallyZero() - { - $this->assertEqual($this->transaction->getTransactionLevel(), 0); - } - - public function testGetStateReturnsStateConstant() - { - $this->assertEqual($this->transaction->getState(), Doctrine_Transaction::STATE_SLEEP); - } - - public function testCommittingWithNoActiveTransactionThrowsException() - { - try { - $this->transaction->commit(); - $this->fail(); - } catch (Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - - public function testExceptionIsThrownWhenUsingRollbackOnNotActiveTransaction() - { - try { - $this->transaction->rollback(); - $this->fail(); - } catch (Doctrine_Transaction_Exception $e) { - $this->pass(); - } - } - - public function testBeginTransactionStartsNewTransaction() - { - $this->transaction->beginTransaction(); - - $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); - } - - public function testCommitMethodCommitsCurrentTransaction() - { - $this->transaction->commit(); - - $this->assertEqual($this->adapter->pop(), 'COMMIT'); - } - public function testNestedTransaction() - { - $conn = Doctrine_Manager::connection(); - - try { - $conn->beginTransaction(); - - // Create new client - $user = new User(); - $user->set('name', 'Test User'); - $user->save(); - - // Create new credit card - $phonenumber = new Phonenumber(); - $phonenumber->set('entity_id', $user->get('id')); - $phonenumber->set('phonenumber', '123 123'); - $phonenumber->save(); - - $conn->commit(); - } catch (Exception $e) { - $conn->rollback(); - } - - $this->assertTrue($user->id > 0); - $this->assertTrue($phonenumber->id > 0); - } - - public function testAddDuplicateRecordToTransactionShouldSkipSecond(){ - $transaction = new Doctrine_Transaction(); - $user = new User(); - $transaction->addInvalid($user); - $this->assertEqual(1, count($transaction->getInvalid())); - $transaction->addInvalid($user); - $this->assertEqual(1, count($transaction->getInvalid())); - } - -} -class TransactionListener extends Doctrine_EventListener -{ - protected $_messages = array(); - - public function preTransactionCommit(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - - $event->skipOperation(); - } - public function postTransactionCommit(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - } - - public function preTransactionRollback(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - - $event->skipOperation(); - } - public function postTransactionRollback(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - } - - public function preTransactionBegin(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - - $event->skipOperation(); - } - public function postTransactionBegin(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - } - - - public function preSavepointCommit(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - - $event->skipOperation(); - } - public function postSavepointCommit(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - } - - public function preSavepointRollback(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - - $event->skipOperation(); - } - public function postSavepointRollback(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - } - - public function preSavepointCreate(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - - $event->skipOperation(); - } - - public function postSavepointCreate(Doctrine_Event $event) - { - $this->_messages[] = __FUNCTION__; - } - - public function pop() - { - return array_pop($this->_messages); - } -} diff --git a/tests_old/TreeStructureTestCase.php b/tests_old/TreeStructureTestCase.php deleted file mode 100644 index 3109a16ea..000000000 --- a/tests_old/TreeStructureTestCase.php +++ /dev/null @@ -1,128 +0,0 @@ -. - */ - -/** - * Doctrine_TreeStructure_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_TreeStructure_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - // we don't need the standard tables here - $this->tables = array('TreeLeaf'); - parent::prepareTables(); - } - - public function prepareData() - { - - } - - public function testSelfReferentialRelationship() - { - $component = new TreeLeaf(); - - try { - $rel = $component->getTable()->getRelation('Parent'); - $rel = $component->getTable()->getRelation('Children'); - $this->pass(); - } catch(Doctrine_Exception $e) { - $this->fail(); - } - } - - public function testLocalAndForeignKeysAreSetCorrectly() { - $component = new TreeLeaf(); - - $rel = $component->getTable()->getRelation('Parent'); - $this->assertEqual($rel->getLocal(), 'parent_id'); - $this->assertEqual($rel->getForeign(), 'id'); - - $rel = $component->getTable()->getRelation('Children'); - $this->assertEqual($rel->getLocal(), 'id'); - $this->assertEqual($rel->getForeign(), 'parent_id'); - } - - public function testTreeLeafRelationships() - { - /* structure: - * - * o1 - * -> o2 - * -> o3 - * - * o4 - * - * thus it would be expected that o1 has 2 children and o4 is a - * leaf with no parents or children. - */ - - $o1 = new TreeLeaf(); - $o1->name = 'o1'; - $o1->save(); - - $o2 = new TreeLeaf(); - $o2->name = 'o2'; - $o2->Parent = $o1; - $o2->save(); - - $o3 = new TreeLeaf(); - $o3->name = 'o3'; - $o3->Parent = $o1; - $o3->save(); - - //$o1->refresh(); - - $o4 = new TreeLeaf(); - $o4->name = 'o4'; - $o4->save(); - - $this->assertFalse(isset($o1->Parent)); - $this->assertTrue(isset($o2->Parent)); - $this->assertTrue($o2->Parent === $o1); - $this->assertFalse(isset($o4->Parent)); - - $this->assertTrue(count($o1->Children) == 2); - $this->assertTrue(count($o1->get('Children')) == 2); - - $this->assertTrue(count($o4->Children) == 0); - } - public function testTreeStructureFetchingWorksWithDql() - { - $q = new Doctrine_Query(); - $q->select('l.*, c.*') - ->from('TreeLeaf l, l.Children c') - ->where('l.parent_id IS NULL') - ->groupby('l.id, c.id'); - - $coll = $q->execute(); - - } -} - diff --git a/tests_old/UnitOfWorkTestCase.php b/tests_old/UnitOfWorkTestCase.php deleted file mode 100644 index 9310607a7..000000000 --- a/tests_old/UnitOfWorkTestCase.php +++ /dev/null @@ -1,137 +0,0 @@ -. - */ - -/** - * Doctrine_UnitOfWork_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_UnitOfWork_TestCase extends Doctrine_UnitTestCase { - private $correct = array('Task', 'ResourceType', 'Resource', 'Assignment', 'ResourceReference'); - private $correct2 = array ( - 0 => 'Resource', - 1 => 'Task', - 2 => 'ResourceType', - 3 => 'Assignment', - 4 => 'ResourceReference', - ); - public function testbuildFlushTree() { - $task = new Task(); - - $tree = $this->unitOfWork->buildFlushTree(array('Task')); - $this->assertEqual($tree,array('Resource', 'Task', 'Assignment')); - - $tree = $this->unitOfWork->buildFlushTree(array('Task','Resource')); - $this->assertEqual($tree, $this->correct); - - $tree = $this->unitOfWork->buildFlushTree(array('Task', 'Assignment', 'Resource')); - $this->assertEqual($tree, $this->correct); - - $tree = $this->unitOfWork->buildFlushTree(array('Assignment', 'Task', 'Resource')); - $this->assertEqual($tree, $this->correct2); - } - public function testbuildFlushTree2() { - $this->correct = array('Forum_Category','Forum_Board','Forum_Thread'); - - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Category','Forum_Board')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree3() { - $this->correct = array('Forum_Category','Forum_Board','Forum_Thread','Forum_Entry'); - - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Entry','Forum_Board')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board','Forum_Entry')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree4() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Thread','Forum_Board')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board','Forum_Thread')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree5() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board','Forum_Thread','Forum_Entry')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board','Forum_Entry','Forum_Thread')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree6() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Entry','Forum_Board','Forum_Thread')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Entry','Forum_Thread','Forum_Board')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree7() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Thread','Forum_Board','Forum_Entry')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Thread','Forum_Entry','Forum_Board')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree8() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board','Forum_Thread','Forum_Category')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Category','Forum_Thread','Forum_Board')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Thread','Forum_Board','Forum_Category')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree9() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board','Forum_Thread','Forum_Category','Forum_Entry')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board','Forum_Thread','Forum_Entry','Forum_Category')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Board','Forum_Category','Forum_Thread','Forum_Entry')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree10() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Entry','Forum_Thread','Forum_Board','Forum_Category')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Entry','Forum_Thread','Forum_Category','Forum_Board')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Entry','Forum_Category','Forum_Board','Forum_Thread')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree11() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Thread','Forum_Category','Forum_Board','Forum_Entry')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Thread','Forum_Entry','Forum_Category','Forum_Board')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Thread','Forum_Board','Forum_Entry','Forum_Category')); - $this->assertEqual($tree, $this->correct); - } - public function testBuildFlushTree12() { - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Category','Forum_Entry','Forum_Board','Forum_Thread')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Category','Forum_Thread','Forum_Entry','Forum_Board')); - $this->assertEqual($tree, $this->correct); - $tree = $this->unitOfWork->buildFlushTree(array('Forum_Category','Forum_Board','Forum_Thread','Forum_Entry')); - $this->assertEqual($tree, $this->correct); - } -} diff --git a/tests_old/UnsortedTestCase.php b/tests_old/UnsortedTestCase.php deleted file mode 100644 index 097fe42fa..000000000 --- a/tests_old/UnsortedTestCase.php +++ /dev/null @@ -1,29 +0,0 @@ -description = 'Package'; - - $packageverison = new PackageVersion(); - $packageverison->description = 'Version'; - - $packageverisonnotes = new PackageVersionNotes(); - $packageverisonnotes->description = 'Notes'; - - $package->Version[0] = $packageverison; - $package->Version[0]->Note[0] = $packageverisonnotes; - - $package->save(); - - $this->assertNotNull($package->id); - $this->assertNotNull($package->Version[0]->id); - $this->assertNotNull($package->Version[0]->Note[0]->id); - } -} diff --git a/tests_old/Validator/FutureTestCase.php b/tests_old/Validator/FutureTestCase.php deleted file mode 100644 index 653cd9586..000000000 --- a/tests_old/Validator/FutureTestCase.php +++ /dev/null @@ -1,84 +0,0 @@ -. - */ - -/** - * Doctrine_Validator_FutureTestCase - * - * @package Doctrine - * @author Roman Borschel - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Validator_Future_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = 'ValidatorTest_DateModel'; - parent::prepareTables(); - } - - public function prepareData() - { - - } - - public function testValidFutureDates() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - // one year ahead - $user1 = new ValidatorTest_DateModel(); - $user1->death = date('Y-m-d', time() + 365 * 24 * 60 * 60); - $this->assertTrue($user1->trySave()); - - // one month ahead - $user1 = new ValidatorTest_DateModel(); - $user1->death = date('Y-m-d', time() + 30 * 24 * 60 * 60); - $this->assertTrue($user1->trySave()); - - // one day ahead - $user1->death = date('Y-m-d', time() + 24 * 60 * 60); - $this->assertTrue($user1->trySave()); - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - public function testInvalidFutureDates() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - $user1 = new ValidatorTest_DateModel(); - $user1->death = date('Y-m-d', 42); - $this->assertFalse($user1->trySave()); - - $user1->death = date('Y-m-d', time()); - $this->assertFalse($user1->trySave()); - - $user1->death = date('Y-m-d', time() + 60); - $this->assertFalse($user1->trySave()); - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - -} diff --git a/tests_old/Validator/PastTestCase.php b/tests_old/Validator/PastTestCase.php deleted file mode 100644 index 6e1f17a6a..000000000 --- a/tests_old/Validator/PastTestCase.php +++ /dev/null @@ -1,84 +0,0 @@ -. - */ - -/** - * Doctrine_Validator_FutureTestCase - * - * @package Doctrine - * @author Roman Borschel - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Validator_Past_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = 'ValidatorTest_DateModel'; - parent::prepareTables(); - } - - public function prepareData() - { - - } - - public function testInvalidPastDates() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - // one year ahead - $user1 = new ValidatorTest_DateModel(); - $user1->birthday = date('Y-m-d', time() + 365 * 24 * 60 * 60); - $this->assertFalse($user1->trySave()); - - // one month ahead - $user1 = new ValidatorTest_DateModel(); - $user1->birthday = date('Y-m-d', time() + 30 * 24 * 60 * 60); - $this->assertFalse($user1->trySave()); - - // one day ahead - $user1->birthday = date('Y-m-d', time() + 24 * 60 * 60); - $this->assertFalse($user1->trySave()); - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - public function testValidPastDates() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - $user1 = new ValidatorTest_DateModel(); - $user1->birthday = date('Y-m-d', 42); - $this->assertTrue($user1->trySave()); - - $user1->birthday = date('Y-m-d', mktime(0,0,0,6,3,1981)); - $this->assertTrue($user1->trySave()); - - $user1->birthday = date('Y-m-d', mktime(0,0,0,3,9,1983)); - $this->assertTrue($user1->trySave()); - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - -} diff --git a/tests_old/ValidatorTestCase.php b/tests_old/ValidatorTestCase.php deleted file mode 100644 index 75d8e7fc8..000000000 --- a/tests_old/ValidatorTestCase.php +++ /dev/null @@ -1,431 +0,0 @@ -. - */ - -/** - * Doctrine_Validator_TestCase - * TestCase for Doctrine's validation component. - * - * @todo More tests to cover the full interface of Doctrine_Validator_ErrorStack. - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_Validator_TestCase extends Doctrine_UnitTestCase -{ - public function prepareTables() - { - $this->tables[] = 'ValidatorTest'; - $this->tables[] = 'ValidatorTest_Person'; - $this->tables[] = 'ValidatorTest_FootballPlayer'; - $this->tables[] = 'ValidatorTest_ClientModel'; - $this->tables[] = 'ValidatorTest_ClientToAddressModel'; - $this->tables[] = 'ValidatorTest_AddressModel'; - parent::prepareTables(); - } - - public function testIsValidType() - { - $var = '123'; - $this->assertTrue(Doctrine_Validator::isValidType($var, 'string')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'float')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'array')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'object')); - - $var = 123; - $this->assertTrue(Doctrine_Validator::isValidType($var, 'string')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'float')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'array')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'object')); - - $var = 123.12; - $this->assertTrue(Doctrine_Validator::isValidType($var, 'string')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'float')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'array')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'object')); - - $var = '123.12'; - $this->assertTrue(Doctrine_Validator::isValidType($var, 'string')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'float')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'array')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'object')); - - $var = ''; - $this->assertTrue(Doctrine_Validator::isValidType($var, 'string')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'float')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'array')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'object')); - - $var = null; - $this->assertTrue(Doctrine_Validator::isValidType($var, 'string')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'float')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'array')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'object')); - - $var = 'str'; - $this->assertTrue(Doctrine_Validator::isValidType($var, 'string')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'float')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'array')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'object')); - - $var = array(); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'string')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'float')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'array')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'object')); - - $var = new Exception(); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'string')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'integer')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'float')); - $this->assertFalse(Doctrine_Validator::isValidType($var, 'array')); - $this->assertTrue(Doctrine_Validator::isValidType($var, 'object')); - } - - - public function testValidate2() - { - $test = new ValidatorTest(); - $test->mymixed = "message"; - $test->myrange = 1; - $test->myregexp = '123a'; - - $validator = new Doctrine_Validator(); - $validator->validateRecord($test); - - $stack = $test->errorStack(); - - $this->assertTrue($stack instanceof Doctrine_Validator_ErrorStack); - - $this->assertTrue(in_array('notnull', $stack['mystring'])); - $this->assertTrue(in_array('notblank', $stack['myemail2'])); - $this->assertTrue(in_array('range', $stack['myrange'])); - $this->assertTrue(in_array('regexp', $stack['myregexp'])); - $test->mystring = 'str'; - - - $test->save(); - } - - public function testValidate() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - $user = $this->connection->getRepository('User')->find(4); - - $set = array('password' => 'this is an example of too long password', - 'loginname' => 'this is an example of too long loginname', - 'name' => 'valid name', - 'created' => 'invalid'); - $user->setArray($set); - $email = $user->Email; - $email->address = 'zYne@invalid'; - - $this->assertTrue($user->getModified() == $set); - - $validator = new Doctrine_Validator(); - - $validator->validateRecord($user); - - $stack = $user->errorStack(); - - $this->assertTrue($stack instanceof Doctrine_Validator_ErrorStack); - $this->assertTrue(in_array('length', $stack['loginname'])); - $this->assertTrue(in_array('length', $stack['password'])); - $this->assertTrue(in_array('type', $stack['created'])); - - $validator->validateRecord($email); - $stack = $email->errorStack(); - $this->assertTrue(in_array('email', $stack['address'])); - $email->address = 'arnold@example.com'; - - $validator->validateRecord($email); - $stack = $email->errorStack(); - - $this->assertTrue(in_array('unique', $stack['address'])); - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - /** - * Tests the Email validator. (Doctrine_Validator_Email) - */ - public function testIsValidEmail() - { - - $validator = new Doctrine_Validator_Email(); - - $this->assertFalse($validator->validate("example@example")); - $this->assertFalse($validator->validate("example@@example")); - $this->assertFalse($validator->validate("example@example.")); - $this->assertFalse($validator->validate("example@e..")); - - $this->assertTrue($validator->validate("null+doctrine@pookey.co.uk")); - $this->assertTrue($validator->validate("null@pookey.co.uk")); - $this->assertTrue($validator->validate("null@pookey.com")); - $this->assertTrue($validator->validate("null@users.doctrine.pengus.net")); - } - - /** - * Tests saving records with invalid attributes. - */ - public function testSave() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - $user = $this->connection->getRepository("User")->find(4); - try { - $user->name = "this is an example of too long name not very good example but an example nevertheless"; - $user->save(); - } catch(Doctrine_Validator_Exception $e) { - $this->assertEqual($e->count(), 1); - $invalidRecords = $e->getInvalidRecords(); - $this->assertEqual(count($invalidRecords), 1); - $stack = $invalidRecords[0]->errorStack(); - $this->assertTrue(in_array('length', $stack['name'])); - } - - try { - $user = $this->connection->create("User"); - $user->Email->address = "jackdaniels@drinkmore.info..."; - $user->name = "this is an example of too long user name not very good example but an example nevertheless"; - $user->save(); - $this->fail(); - } catch (Doctrine_Validator_Exception $e) { - $this->pass(); - $a = $e->getInvalidRecords(); - //var_dump($a[1]->getErrorStack()); - $this->assertTrue(is_array($a)); - //var_dump(array_search($user, $a)); - $emailStack = $user->Email->errorStack(); - $userStack = $user->errorStack(); - $this->assertTrue(in_array('email', $emailStack['address'])); - $this->assertTrue(in_array('length', $userStack['name'])); - } - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - /** - * Tests whether the validate() callback works correctly - * in descendants of Doctrine_Entity. - */ - public function testValidationHooks() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - // Tests validate() and validateOnInsert() - $user = new User(); - try { - $user->name = "I'm not The Saint"; - $user->password = "1234"; - $user->save(); - } catch(Doctrine_Validator_Exception $e) { - $this->assertEqual($e->count(), 1); - $invalidRecords = $e->getInvalidRecords(); - $this->assertEqual(count($invalidRecords), 1); - - $stack = $invalidRecords[0]->errorStack(); - - $this->assertEqual($stack->count(), 2); - $this->assertTrue(in_array('notTheSaint', $stack['name'])); // validate() hook constraint - $this->assertTrue(in_array('pwNotTopSecret', $stack['password'])); // validateOnInsert() hook constraint - } - - // Tests validateOnUpdate() - $user = $this->connection->getRepository("User")->find(4); - try { - $user->name = "The Saint"; // Set correct name - $user->password = "Top Secret"; // Set correct password - $user->loginname = "Somebody"; // Wrong login name! - $user->save(); - $this->fail(); - } catch(Doctrine_Validator_Exception $e) { - $invalidRecords = $e->getInvalidRecords(); - $this->assertEqual(count($invalidRecords), 1); - - $stack = $invalidRecords[0]->errorStack(); - - $this->assertEqual($stack->count(), 1); - $this->assertTrue(in_array('notNobody', $stack['loginname'])); // validateOnUpdate() hook constraint - } - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - /** - * Tests whether the validateOnInsert() callback works correctly - * in descendants of Doctrine_Entity. - */ - public function testHookValidateOnInsert() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - $user = new User(); - $user->password = "1234"; - - try { - $user->save(); - $this->fail(); - } catch (Doctrine_Validator_Exception $ex) { - $errors = $user->errorStack(); - $this->assertTrue(in_array('pwNotTopSecret', $errors['password'])); - } - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - /* - public function testIssue() - { - $this->manager->setAttribute(Doctrine::ATTR_VLD, true); - - try { - $person = new ValidatorTest_Person(); - $person->name = ''; // will raise a validation exception since name must be 'notblank' - $person->is_football_player = true; - - $person->ValidatorTest_FootballPlayer->team_name = 'liverpool'; - $person->ValidatorTest_FootballPlayer->goals_count = 2; - - $person->save(); - } - catch(Doctrine_Validator_Exception $e) { - $this->fail("test"); - //var_dump($person->getErrorStack()); - //var_dump($person->ValidatorTest_FootballPlayer->getErrorStack()); - } - - $this->manager->setAttribute(Doctrine::ATTR_VLD, false); - } - */ - - // @todo move to a separate test file (tests/Validator/UniqueTestCase) . - - public function testSetSameUniqueValueOnSameRecordThrowsNoException() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - $r = new ValidatorTest_Person(); - $r->identifier = '1234'; - $r->save(); - - $r = $this->connection->getRepository('ValidatorTest_Person')->findAll()->getFirst(); - $r->identifier = 1234; - try { - $r->save(); - } - catch (Doctrine_Validator_Exception $e) { - $this->fail("Validator exception raised without reason!"); - } - - $r->delete(); // clean up - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - public function testSetSameUniqueValueOnDifferentRecordThrowsException() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - - $r = new ValidatorTest_Person(); - $r->identifier = '1234'; - $r->save(); - - $r = new ValidatorTest_Person(); - $r->identifier = 1234; - try { - $r->save(); - $this->fail("No validator exception thrown on unique validation."); - } catch (Doctrine_Validator_Exception $e) { - $this->pass(); - } - $r->delete(); // clean up - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - public function testValidationOnManyToManyRelations() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - try { - $client = new ValidatorTest_ClientModel(); - $client->short_name = 'test'; - $client->ValidatorTest_AddressModel[0]->state = 'az'; - $client->save(); - $this->fail(); - } catch (Doctrine_Validator_Exception $dve) { - $s = $dve->getInvalidRecords(); - $this->assertEqual(1, count($dve->getInvalidRecords())); - $stack = $client->ValidatorTest_AddressModel[0]->getErrorStack(); - - $this->assertTrue(in_array('notnull', $stack['address1'])); - $this->assertTrue(in_array('notblank', $stack['address1'])); - $this->assertTrue(in_array('notnull', $stack['address2'])); - $this->assertTrue(in_array('notnull', $stack['city'])); - $this->assertTrue(in_array('notblank', $stack['city'])); - $this->assertTrue(in_array('usstate', $stack['state'])); - $this->assertTrue(in_array('notnull', $stack['zip'])); - $this->assertTrue(in_array('notblank', $stack['zip'])); - } - - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - - public function testSaveInTransactionThrowsValidatorException() - { - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); - try { - $this->conn->beginTransaction(); - $client = new ValidatorTest_ClientModel(); - $client->short_name = 'test'; - $client->ValidatorTest_AddressModel[0]->state = 'az'; - $client->save(); - $this->fail(); - $this->conn->commit(); - } catch (Doctrine_Validator_Exception $dve) { - $this->conn->rollback(); - $s = $dve->getInvalidRecords(); - $this->assertEqual(1, count($dve->getInvalidRecords())); - $stack = $client->ValidatorTest_AddressModel[0]->getErrorStack(); - - $this->assertTrue(in_array('notnull', $stack['address1'])); - $this->assertTrue(in_array('notblank', $stack['address1'])); - $this->assertTrue(in_array('notnull', $stack['address2'])); - $this->assertTrue(in_array('notnull', $stack['city'])); - $this->assertTrue(in_array('notblank', $stack['city'])); - $this->assertTrue(in_array('usstate', $stack['state'])); - $this->assertTrue(in_array('notnull', $stack['zip'])); - $this->assertTrue(in_array('notblank', $stack['zip'])); - } - $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); - } - -} diff --git a/tests_old/ValueHolderTestCase.php b/tests_old/ValueHolderTestCase.php deleted file mode 100644 index 44de22447..000000000 --- a/tests_old/ValueHolderTestCase.php +++ /dev/null @@ -1,60 +0,0 @@ -valueHolder->data[0] = 'first'; - - $this->assertEqual($this->valueHolder->data[0], 'first'); - $this->assertEqual($this->valueHolder[0], 'first'); - $this->assertEqual($this->valueHolder->get(0), 'first'); - - $this->valueHolder->data['key'] = 'second'; - - $this->assertEqual($this->valueHolder->data['key'], 'second'); - $this->assertEqual($this->valueHolder->key, 'second'); - $this->assertEqual($this->valueHolder['key'], 'second'); - $this->assertEqual($this->valueHolder->get('key'), 'second'); - } - public function testSimpleQuery() { - $q = new Doctrine_Query($this->connection); - $q->from("User"); - $users = $q->execute(array(), Doctrine::FETCH_VHOLDER); - $this->assertEqual($users->count(), 8); - - - } - public function testQueryWithOneToManyRelation() { - $q = new Doctrine_Query($this->connection); - $q->from("User.Phonenumber"); - $users = $q->execute(array(), Doctrine::FETCH_VHOLDER); - $this->assertEqual($users->count(), 8); - $this->assertTrue($users[0] instanceof Doctrine_ValueHolder); - $this->assertTrue($users[3] instanceof Doctrine_ValueHolder); - $this->assertTrue($users[7] instanceof Doctrine_ValueHolder); - - $this->assertEqual(count($users[0]->Phonenumber), 1); - $this->assertEqual(count($users[1]->Phonenumber), 3); - $this->assertEqual(count($users[2]->Phonenumber), 1); - $this->assertEqual(count($users[3]->Phonenumber), 1); - $this->assertEqual(count($users[4]->Phonenumber), 3); - } - public function testDelete() { - $f = false; - try { - $this->valueHolder->delete(); - } catch(Doctrine_Exception $e) { - $f = true; - } - $this->assertTrue($f); - } - public function testSave() { - $f = false; - try { - $this->valueHolder->save(); - } catch(Doctrine_Exception $e) { - $f = true; - } - $this->assertTrue($f); - } -} diff --git a/tests_old/ViewTestCase.php b/tests_old/ViewTestCase.php deleted file mode 100644 index f64ff118b..000000000 --- a/tests_old/ViewTestCase.php +++ /dev/null @@ -1,78 +0,0 @@ -. - */ - -/** - * Doctrine_View_TestCase - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class Doctrine_View_TestCase extends Doctrine_UnitTestCase -{ - - public function testCreateView() - { - $query = new Doctrine_Query($this->connection); - $query->from('User'); - - $view = new Doctrine_View($query, 'MyView'); - - $this->assertEqual($view->getName(), 'MyView'); - - $this->assertTrue($view->getQuery() === $query); - $this->assertTrue($view === $query->getView()); - $this->assertTrue($view->getConnection() instanceof Doctrine_Connection); - - $success = true; - - try { - $view->create(); - } catch(Exception $e) { - $success = false; - } - $this->assertTrue($success); - - $users = $view->execute(); - $count = $this->conn->count(); - $this->assertTrue($users instanceof Doctrine_Collection); - $this->assertEqual($users->count(), 8); - $this->assertEqual($users[0]->name, 'zYne'); - $this->assertEqual($users[0]->state(), Doctrine_Entity::STATE_CLEAN); - $this->assertEqual($count, $this->conn->count()); - - $success = true; - try { - $view->drop(); - } catch(Exception $e) { - $success = false; - } - $this->assertTrue($success); - } - - public function testConstructor() - { - } -} diff --git a/tests_old/coverage/Doctrine.html b/tests_old/coverage/Doctrine.html deleted file mode 100644 index 0dcd5b840..000000000 --- a/tests_old/coverage/Doctrine.html +++ /dev/null @@ -1,3570 +0,0 @@ - - - Coverage for Doctrine - - -

    Coverage for Doctrine

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Doctrine.php 3223 2007-11-25 19:07:30Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine -
    24 * the base class of Doctrine framework -
    25 * -
    26 * @package     Doctrine -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3223 $ -
    33 */ -
    34final class Doctrine -
    35{ -
    36    /** -
    37     * VERSION -
    38     */ -
    39    const VERSION                   = '0.1.0'; -
    40 -
    41    /** -
    42     * ERROR CONSTANTS -
    43     */ -
    44    const ERR                       = -1; -
    45    const ERR_SYNTAX                = -2; -
    46    const ERR_CONSTRAINT            = -3; -
    47    const ERR_NOT_FOUND             = -4; -
    48    const ERR_ALREADY_EXISTS        = -5; -
    49    const ERR_UNSUPPORTED           = -6; -
    50    const ERR_MISMATCH              = -7; -
    51    const ERR_INVALID               = -8; -
    52    const ERR_NOT_CAPABLE           = -9; -
    53    const ERR_TRUNCATED             = -10; -
    54    const ERR_INVALID_NUMBER        = -11; -
    55    const ERR_INVALID_DATE          = -12; -
    56    const ERR_DIVZERO               = -13; -
    57    const ERR_NODBSELECTED          = -14; -
    58    const ERR_CANNOT_CREATE         = -15; -
    59    const ERR_CANNOT_DELETE         = -16; -
    60    const ERR_CANNOT_DROP           = -17; -
    61    const ERR_NOSUCHTABLE           = -18; -
    62    const ERR_NOSUCHFIELD           = -19; -
    63    const ERR_NEED_MORE_DATA        = -20; -
    64    const ERR_NOT_LOCKED            = -21; -
    65    const ERR_VALUE_COUNT_ON_ROW    = -22; -
    66    const ERR_INVALID_DSN           = -23; -
    67    const ERR_CONNECT_FAILED        = -24; -
    68    const ERR_EXTENSION_NOT_FOUND   = -25; -
    69    const ERR_NOSUCHDB              = -26; -
    70    const ERR_ACCESS_VIOLATION      = -27; -
    71    const ERR_CANNOT_REPLACE        = -28; -
    72    const ERR_CONSTRAINT_NOT_NULL   = -29; -
    73    const ERR_DEADLOCK              = -30; -
    74    const ERR_CANNOT_ALTER          = -31; -
    75    const ERR_MANAGER               = -32; -
    76    const ERR_MANAGER_PARSE         = -33; -
    77    const ERR_LOADMODULE            = -34; -
    78    const ERR_INSUFFICIENT_DATA     = -35; -
    79    const ERR_CLASS_NAME            = -36; -
    80 -
    81    /** -
    82     * PDO derived constants -
    83     */ -
    84    const CASE_LOWER = 2; -
    85    const CASE_NATURAL = 0; -
    86    const CASE_UPPER = 1; -
    87    const CURSOR_FWDONLY = 0; -
    88    const CURSOR_SCROLL = 1; -
    89    const ERRMODE_EXCEPTION = 2; -
    90    const ERRMODE_SILENT = 0; -
    91    const ERRMODE_WARNING = 1; -
    92    const FETCH_ASSOC = 2; -
    93    const FETCH_BOTH = 4; -
    94    const FETCH_BOUND = 6; -
    95    const FETCH_CLASS = 8; -
    96    const FETCH_CLASSTYPE = 262144; -
    97    const FETCH_COLUMN = 7; -
    98    const FETCH_FUNC = 10; -
    99    const FETCH_GROUP = 65536; -
    100    const FETCH_INTO = 9; -
    101    const FETCH_LAZY = 1; -
    102    const FETCH_NAMED = 11; -
    103    const FETCH_NUM = 3; -
    104    const FETCH_OBJ = 5; -
    105    const FETCH_ORI_ABS = 4; -
    106    const FETCH_ORI_FIRST = 2; -
    107    const FETCH_ORI_LAST = 3; -
    108    const FETCH_ORI_NEXT = 0; -
    109    const FETCH_ORI_PRIOR = 1; -
    110    const FETCH_ORI_REL = 5; -
    111    const FETCH_SERIALIZE = 524288; -
    112    const FETCH_UNIQUE = 196608; -
    113    const NULL_EMPTY_STRING = 1; -
    114    const NULL_NATURAL = 0; -
    115    const NULL_TO_STRING         = NULL; -
    116    const PARAM_BOOL = 5; -
    117    const PARAM_INPUT_OUTPUT = -2147483648; -
    118    const PARAM_INT = 1; -
    119    const PARAM_LOB = 3; -
    120    const PARAM_NULL = 0; -
    121    const PARAM_STMT = 4; -
    122    const PARAM_STR = 2; -
    123 -
    124    /** -
    125     * ATTRIBUTE CONSTANTS -
    126     */ -
    127 -
    128    /** -
    129     * PDO derived attributes -
    130     */ -
    131    const ATTR_AUTOCOMMIT           = 0; -
    132    const ATTR_PREFETCH             = 1; -
    133    const ATTR_TIMEOUT              = 2; -
    134    const ATTR_ERRMODE              = 3; -
    135    const ATTR_SERVER_VERSION       = 4; -
    136    const ATTR_CLIENT_VERSION       = 5; -
    137    const ATTR_SERVER_INFO          = 6; -
    138    const ATTR_CONNECTION_STATUS    = 7; -
    139    const ATTR_CASE                 = 8; -
    140    const ATTR_CURSOR_NAME          = 9; -
    141    const ATTR_CURSOR               = 10; -
    142    const ATTR_ORACLE_NULLS         = 11; -
    143    const ATTR_PERSISTENT           = 12; -
    144    const ATTR_STATEMENT_CLASS      = 13; -
    145    const ATTR_FETCH_TABLE_NAMES    = 14; -
    146    const ATTR_FETCH_CATALOG_NAMES  = 15; -
    147    const ATTR_DRIVER_NAME          = 16; -
    148    const ATTR_STRINGIFY_FETCHES    = 17; -
    149    const ATTR_MAX_COLUMN_LEN       = 18; -
    150 -
    151    /** -
    152     * Doctrine constants -
    153     */ -
    154    const ATTR_LISTENER             = 100; -
    155    const ATTR_QUOTE_IDENTIFIER     = 101; -
    156    const ATTR_FIELD_CASE           = 102; -
    157    const ATTR_IDXNAME_FORMAT       = 103; -
    158    const ATTR_SEQNAME_FORMAT       = 104; -
    159    const ATTR_SEQCOL_NAME          = 105; -
    160    const ATTR_CMPNAME_FORMAT       = 118; -
    161    const ATTR_DBNAME_FORMAT        = 117; -
    162    const ATTR_TBLCLASS_FORMAT      = 119; -
    163    const ATTR_TBLNAME_FORMAT       = 120; -
    164    const ATTR_EXPORT               = 140; -
    165    const ATTR_DECIMAL_PLACES       = 141; -
    166 -
    167    const ATTR_PORTABILITY          = 106; -
    168    const ATTR_VALIDATE             = 107; -
    169    const ATTR_COLL_KEY             = 108; -
    170    const ATTR_QUERY_LIMIT          = 109; -
    171    const ATTR_DEFAULT_TABLE_TYPE   = 112; -
    172    const ATTR_DEF_TEXT_LENGTH      = 113; -
    173    const ATTR_DEF_VARCHAR_LENGTH   = 114; -
    174    const ATTR_DEF_TABLESPACE       = 115; -
    175    const ATTR_EMULATE_DATABASE     = 116; -
    176    const ATTR_USE_NATIVE_ENUM      = 117; -
    177    const ATTR_DEFAULT_SEQUENCE     = 133; -
    178 -
    179    const ATTR_FETCHMODE                = 118; -
    180    const ATTR_NAME_PREFIX              = 121; -
    181    const ATTR_CREATE_TABLES            = 122; -
    182    const ATTR_COLL_LIMIT               = 123; -
    183 -
    184    const ATTR_CACHE                    = 150; -
    185    const ATTR_RESULT_CACHE             = 150; -
    186    const ATTR_CACHE_LIFESPAN           = 151; -
    187    const ATTR_RESULT_CACHE_LIFESPAN    = 151; -
    188    const ATTR_LOAD_REFERENCES          = 153; -
    189    const ATTR_RECORD_LISTENER          = 154; -
    190    const ATTR_THROW_EXCEPTIONS         = 155; -
    191    const ATTR_DEFAULT_PARAM_NAMESPACE  = 156; -
    192    const ATTR_QUERY_CACHE              = 157; -
    193    const ATTR_QUERY_CACHE_LIFESPAN     = 158; -
    194 -
    195    /** -
    196     * LIMIT CONSTANTS -
    197     */ -
    198 -
    199    /** -
    200     * constant for row limiting -
    201     */ -
    202    const LIMIT_ROWS       = 1; -
    203 -
    204    /** -
    205     * constant for record limiting -
    206     */ -
    207    const LIMIT_RECORDS    = 2; -
    208 -
    209    /** -
    210     * FETCHMODE CONSTANTS -
    211     */ -
    212 -
    213    /** -
    214     * IMMEDIATE FETCHING -
    215     * mode for immediate fetching -
    216     */ -
    217    const FETCH_IMMEDIATE       = 0; -
    218 -
    219    /** -
    220     * BATCH FETCHING -
    221     * mode for batch fetching -
    222     */ -
    223    const FETCH_BATCH           = 1; -
    224 -
    225    /** -
    226     * LAZY FETCHING -
    227     * mode for offset fetching -
    228     */ -
    229    const FETCH_OFFSET          = 3; -
    230 -
    231    /** -
    232     * LAZY OFFSET FETCHING -
    233     * mode for lazy offset fetching -
    234     */ -
    235    const FETCH_LAZY_OFFSET     = 4; -
    236 -
    237    /** -
    238     * FETCH CONSTANTS -
    239     */ -
    240 -
    241 -
    242    /** -
    243     * FETCH VALUEHOLDER -
    244     */ -
    245    const FETCH_VHOLDER         = 1; -
    246 -
    247    /** -
    248     * FETCH RECORD -
    249     * -
    250     * Specifies that the fetch method shall return Doctrine_Record -
    251     * objects as the elements of the result set. -
    252     * -
    253     * This is the default fetchmode. -
    254     */ -
    255    const FETCH_RECORD          = 2; -
    256 -
    257    /** -
    258     * FETCH ARRAY -
    259     */ -
    260    const FETCH_ARRAY           = 3; -
    261 -
    262    /** -
    263     * PORTABILITY CONSTANTS -
    264     */ -
    265 -
    266    /** -
    267     * Portability: turn off all portability features. -
    268     * @see self::ATTR_PORTABILITY -
    269     */ -
    270    const PORTABILITY_NONE          = 0; -
    271 -
    272    /** -
    273     * Portability: convert names of tables and fields to case defined in the -
    274     * "field_case" option when using the query*(), fetch*() methods. -
    275     * @see self::ATTR_PORTABILITY -
    276     */ -
    277    const PORTABILITY_FIX_CASE      = 1; -
    278 -
    279    /** -
    280     * Portability: right trim the data output by query*() and fetch*(). -
    281     * @see self::ATTR_PORTABILITY -
    282     */ -
    283    const PORTABILITY_RTRIM         = 2; -
    284 -
    285    /** -
    286     * Portability: force reporting the number of rows deleted. -
    287     * @see self::ATTR_PORTABILITY -
    288     */ -
    289    const PORTABILITY_DELETE_COUNT  = 4; -
    290 -
    291    /** -
    292     * Portability: convert empty values to null strings in data output by -
    293     * query*() and fetch*(). -
    294     * @see self::ATTR_PORTABILITY -
    295     */ -
    296    const PORTABILITY_EMPTY_TO_NULL = 8; -
    297 -
    298    /** -
    299     * Portability: removes database/table qualifiers from associative indexes -
    300     * @see self::ATTR_PORTABILITY -
    301     */ -
    302    const PORTABILITY_FIX_ASSOC_FIELD_NAMES = 16; -
    303 -
    304    /** -
    305     * Portability: makes Doctrine_Expression throw exception for unportable RDBMS expressions -
    306     * @see self::ATTR_PORTABILITY -
    307     */ -
    308    const PORTABILITY_EXPR          = 32; -
    309 -
    310    /** -
    311     * Portability: turn on all portability features. -
    312     * @see self::ATTR_PORTABILITY -
    313     */ -
    314    const PORTABILITY_ALL           = 63; -
    315 -
    316    /** -
    317     * LOCKMODE CONSTANTS -
    318     */ -
    319 -
    320    /** -
    321     * mode for optimistic locking -
    322     */ -
    323    const LOCK_OPTIMISTIC       = 0; -
    324 -
    325    /** -
    326     * mode for pessimistic locking -
    327     */ -
    328    const LOCK_PESSIMISTIC      = 1; -
    329 -
    330    /** -
    331     * EXPORT CONSTANTS -
    332     */ -
    333 -
    334    /** -
    335     * EXPORT_NONE -
    336     */ -
    337    const EXPORT_NONE               = 0; -
    338 -
    339    /** -
    340     * EXPORT_TABLES -
    341     */ -
    342    const EXPORT_TABLES             = 1; -
    343 -
    344    /** -
    345     * EXPORT_CONSTRAINTS -
    346     */ -
    347    const EXPORT_CONSTRAINTS        = 2; -
    348 -
    349    /** -
    350     * EXPORT_PLUGINS -
    351     */ -
    352    const EXPORT_PLUGINS            = 4; -
    353 -
    354    /** -
    355     * EXPORT_ALL -
    356     */ -
    357    const EXPORT_ALL                = 7; -
    358 -
    359    /** -
    360     * HYDRATION CONSTANTS -
    361     */ -
    362    const HYDRATE_RECORD            = 2; -
    363 -
    364    /** -
    365     * HYDRATE_ARRAY -
    366     */ -
    367    const HYDRATE_ARRAY             = 3; -
    368 -
    369    /** -
    370     * HYDRATE_NONE -
    371     */ -
    372    const HYDRATE_NONE              = 4; -
    373 -
    374    /** -
    375     * VALIDATION CONSTANTS -
    376     */ -
    377    const VALIDATE_NONE             = 0; -
    378 -
    379    /** -
    380     * VALIDATE_LENGTHS -
    381     */ -
    382    const VALIDATE_LENGTHS          = 1; -
    383 -
    384    /** -
    385     * VALIDATE_TYPES -
    386     */ -
    387    const VALIDATE_TYPES            = 2; -
    388 -
    389    /** -
    390     * VALIDATE_CONSTRAINTS -
    391     */ -
    392    const VALIDATE_CONSTRAINTS      = 4; -
    393 -
    394    /** -
    395     * VALIDATE_ALL -
    396     */ -
    397    const VALIDATE_ALL              = 7; -
    398 -
    399    /** -
    400     * IDENTIFIER_AUTOINC -
    401     * -
    402     * constant for auto_increment identifier -
    403     */ -
    404    const IDENTIFIER_AUTOINC        = 1; -
    405 -
    406    /** -
    407     * IDENTIFIER_SEQUENCE -
    408     * -
    409     * constant for sequence identifier -
    410     */ -
    411    const IDENTIFIER_SEQUENCE       = 2; -
    412 -
    413    /** -
    414     * IDENTIFIER_NATURAL -
    415     * -
    416     * constant for normal identifier -
    417     */ -
    418    const IDENTIFIER_NATURAL        = 3; -
    419 -
    420    /** -
    421     * IDENTIFIER_COMPOSITE -
    422     * -
    423     * constant for composite identifier -
    424     */ -
    425    const IDENTIFIER_COMPOSITE      = 4; -
    426 -
    427    /** -
    428     * Path -
    429     * -
    430     * @var string $path            doctrine root directory -
    431     */ -
    432    private static $_path; -
    433 -
    434    /** -
    435     * Debug -
    436     * -
    437     * Bool true/false -
    438     * -
    439     * @var boolean $_debug -
    440     */ -
    441    private static $_debug = false; -
    442 -
    443    /** -
    444     * _loadedModels -
    445     * -
    446     * Array of all the loaded models and the path to each one for autoloading -
    447     * -
    448     * @var array -
    449     */ -
    450    private static $_loadedModels = array(); -
    451 -
    452    /** -
    453     * _validators -
    454     * -
    455     * Array of all the loaded validators -
    456     * @var array -
    457     */ -
    458    private static $_validators = array(); -
    459 -
    460    /** -
    461     * Constructor for the main class -
    462     * -
    463     * This class can not be instantiated so it will throw an exception.  -
    464     * -
    465     * @return void -
    466     * @throws Doctrine_Exception -
    467     */ -
    468    public function __construct() -
    469    { -
    470        throw new Doctrine_Exception('Doctrine is static class. No instances can be created.'); -
    471    } -
    472 -
    473    /** -
    474     * debug -
    475     * -
    476     * @param string $bool -
    477     * @return void -
    478     */ -
    479    public static function debug($bool = null) -
    480    { -
    481        if ($bool !== null) { -
    482            self::$_debug = (bool) $bool; -
    483        } -
    484 -
    485        return self::$_debug; -
    486    } -
    487 -
    488    /** -
    489     * getPath -
    490     * returns the doctrine root -
    491     * -
    492     * @return string -
    493     */ -
    494    public static function getPath() -
    495    { -
    496        if ( ! self::$_path) { -
    497            self::$_path = dirname(__FILE__); -
    498        } -
    499 -
    500        return self::$_path; -
    501    } -
    502 -
    503    /** -
    504     * loadModels -
    505     * -
    506     * Recursively load all models from a directory or array of directories -
    507     * -
    508     * @param string $directory    Path to directory of models or array of directory paths -
    509     * @return array $loadedModels -
    510     */ -
    511    public static function loadModels($directory) -
    512    { -
    513        if ($directory !== null) { -
    514            $manager = Doctrine_Manager::getInstance(); -
    515 -
    516            foreach ((array) $directory as $dir) { -
    517                $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), -
    518                                                        RecursiveIteratorIterator::LEAVES_ONLY); -
    519                foreach ($it as $file) { -
    520                    $e = explode('.', $file->getFileName()); -
    521                    if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) { -
    522                        self::$_loadedModels[$e[0]] = $file->getPathName(); -
    523                    } -
    524                } -
    525            } -
    526        } -
    527 -
    528        return self::getLoadedModels(array_keys(self::$_loadedModels)); -
    529    } -
    530 -
    531    /** -
    532     * getLoadedModels -
    533     * -
    534     * Get all the loaded models, you can provide an array of classes or it will use get_declared_classes() -
    535     * -
    536     * Will filter through an array of classes and return the Doctrine_Records out of them. -
    537     * If you do not specify $classes it will return all of the currently loaded Doctrine_Records -
    538     * -
    539     * @param classes  Array of classes to filter through, otherwise uses get_declared_classes() -
    540     * @return array   $loadedModels -
    541     */ -
    542    public static function getLoadedModels($classes = null) -
    543    { -
    544        if ($classes === null) { -
    545            $classes = get_declared_classes(); -
    546            $classes = array_merge($classes, array_keys(self::$_loadedModels)); -
    547        } -
    548 -
    549        $loadedModels = array(); -
    550 -
    551        foreach ((array) $classes as $name) { -
    552            try { -
    553                $declaredBefore = get_declared_classes(); -
    554                $class = new ReflectionClass($name); -
    555                if (self::isValidModelClass($class)) { -
    556                    $loadedModels[] = $name; -
    557                } -
    558            } catch (Exception $e) { -
    559                // Determine class names by the actual inclusion of the model file -
    560                // The possibility exists that the class name(s) contained in the model -
    561                // file is not the same as the actual model file name itself -
    562                if (isset(self::$_loadedModels[$name])) { -
    563                    try { -
    564                        require_once self::$_loadedModels[$name]; -
    565                        $declaredAfter = get_declared_classes(); -
    566                        // Using array_slice since array_diff is broken is some versions -
    567                        $foundClasses = array_slice($declaredAfter, count($declaredBefore)-1); -
    568                        if ($foundClasses) { -
    569                            foreach ($foundClasses as $name) { -
    570                                $class = new ReflectionClass($name); -
    571                                if (self::isValidModelClass($class)) { -
    572                                    $loadedModels[] = $name; -
    573                                } -
    574                            } -
    575                        } -
    576                    } catch (Exception $e) { -
    577                        continue; -
    578                    } -
    579                } -
    580            } -
    581 -
    582        } -
    583        return $loadedModels; -
    584    } -
    585 -
    586 -
    587    /** -
    588     * isValidModelClass -
    589     * -
    590     * Checks whether a reflection class is a valid Doctrine model class -
    591     * -
    592     * @param class  A reflection class to validate -
    593     * @return boolean -
    594     */ -
    595    public static function isValidModelClass($class) -
    596    { -
    597        if ($class instanceof ReflectionClass) { -
    598            // Skip the following classes -
    599            // - abstract classes -
    600            // - not a subclass of Doctrine_Record -
    601            // - don't have a setTableDefinition method -
    602            if (!$class->isAbstract() && -
    603                $class->isSubClassOf('Doctrine_Record') && -
    604                $class->hasMethod('setTableDefinition')) { -
    605                return true; -
    606            } -
    607        } -
    608        return false; -
    609    } -
    610 -
    611 -
    612    /** -
    613     * getConnectionByTableName -
    614     * -
    615     * Get the connection object for a table by the actual table name -
    616     * -
    617     * @param string $tableName -
    618     * @return object Doctrine_Connection -
    619     */ -
    620    public static function getConnectionByTableName($tableName) -
    621    { -
    622        $loadedModels = self::getLoadedModels(); -
    623 -
    624        foreach ($loadedModels as $name) { -
    625            $model = new $name(); -
    626            $table = $model->getTable(); -
    627 -
    628            if ($table->getTableName() == $tableName) { -
    629               return $table->getConnection(); -
    630            } -
    631        } -
    632 -
    633        return Doctrine_Manager::connection(); -
    634    } -
    635 -
    636    /** -
    637     * generateModelsFromDb -
    638     * -
    639     * method for importing existing schema to Doctrine_Record classes -
    640     * -
    641     * @param string $directory Directory to write your models to -
    642     * @param array $databases Array of databases to generate models for -
    643     * @return boolean -
    644     * @throws Exception -
    645     */ -
    646    public static function generateModelsFromDb($directory, array $databases = array()) -
    647    { -
    648        return Doctrine_Manager::connection()->import->importSchema($directory, $databases); -
    649    } -
    650 -
    651    /** -
    652     * generateYamlFromDb -
    653     * -
    654     * Generates models from database to temporary location then uses those models to generate a yaml schema file. -
    655     * This should probably be fixed. We should write something to generate a yaml schema file directly from the database. -
    656     * -
    657     * @param string $yamlPath Path to write oyur yaml schema file to -
    658     * @return void -
    659     */ -
    660    public static function generateYamlFromDb($yamlPath) -
    661    { -
    662        $directory = '/tmp/tmp_doctrine_models'; -
    663 -
    664        Doctrine::generateModelsFromDb($directory); -
    665 -
    666        $export = new Doctrine_Export_Schema(); -
    667 -
    668        $result = $export->exportSchema($yamlPath, 'yml', $directory); -
    669 -
    670        exec('rm -rf ' . $directory); -
    671 -
    672        return $result; -
    673    } -
    674 -
    675    /** -
    676     * generateModelsFromYaml -
    677     * -
    678     * Generate a yaml schema file from an existing directory of models -
    679     * -
    680     * @param string $yamlPath Path to your yaml schema files -
    681     * @param string $directory Directory to generate your models in -
    682     * @param array  $options Array of options to pass to the schema importer -
    683     * @return void -
    684     */ -
    685    public static function generateModelsFromYaml($yamlPath, $directory, $options = array()) -
    686    { -
    687        $import = new Doctrine_Import_Schema(); -
    688        $import->setOptions($options); -
    689 -
    690        return $import->importSchema($yamlPath, 'yml', $directory); -
    691    } -
    692 -
    693    /** -
    694     * createTablesFromModels -
    695     * -
    696     * Creates database tables for the models in the specified directory -
    697     * -
    698     * @param string $directory Directory containing your models -
    699     * @return void -
    700     */ -
    701    public static function createTablesFromModels($directory = null) -
    702    { -
    703        return Doctrine_Manager::connection()->export->exportSchema($directory); -
    704    } -
    705 -
    706    /** -
    707     * createTablesFromArray -
    708     * -
    709     * Creates database tables for the models in the supplied array -
    710     * -
    711     * @param array $array An array of models to be exported -
    712     * @return void -
    713     */ -
    714    public static function createTablesFromArray($array) -
    715    { -
    716        return Doctrine_Manager::connection()->export->exportClasses($array); -
    717    } -
    718 -
    719    /** -
    720     * generateSqlFromModels -
    721     * -
    722     * @param string $directory -
    723     * @return string $build  String of sql queries. One query per line -
    724     */ -
    725    public static function generateSqlFromModels($directory = null) -
    726    { -
    727        $sql = Doctrine_Manager::connection()->export->exportSql($directory); -
    728 -
    729        $build = ''; -
    730        foreach ($sql as $query) { -
    731            $build .= $query.";\n"; -
    732        } -
    733 -
    734        return $build; -
    735    } -
    736 -
    737    /** -
    738     * generateYamlFromModels -
    739     * -
    740     * Generate yaml schema file for the models in the specified directory -
    741     * -
    742     * @param string $yamlPath Path to your yaml schema files -
    743     * @param string $directory Directory to generate your models in -
    744     * @return void -
    745     */ -
    746    public static function generateYamlFromModels($yamlPath, $directory) -
    747    { -
    748        $export = new Doctrine_Export_Schema(); -
    749 -
    750        return $export->exportSchema($yamlPath, 'yml', $directory); -
    751    } -
    752 -
    753    /** -
    754     * createDatabases -
    755     * -
    756     * Creates databases for connections -
    757     * -
    758     * @param string $specifiedConnections Array of connections you wish to create the database for -
    759     * @return void -
    760     */ -
    761    public static function createDatabases($specifiedConnections = array()) -
    762    { -
    763        if ( ! is_array($specifiedConnections)) { -
    764            $specifiedConnections = (array) $specifiedConnections; -
    765        } -
    766 -
    767        $manager = Doctrine_Manager::getInstance(); -
    768        $connections = $manager->getConnections(); -
    769 -
    770        $results = array(); -
    771 -
    772        foreach ($connections as $name => $connection) { -
    773            if ( ! empty($specifiedConnections) && !in_array($name, $specifiedConnections)) { -
    774                continue; -
    775            } -
    776 -
    777            $info = $manager->parsePdoDsn($connection->getOption('dsn')); -
    778            $username = $connection->getOption('username'); -
    779            $password = $connection->getOption('password'); -
    780 -
    781            // Make connection without database specified so we can create it -
    782            $connect = $manager->openConnection(new PDO($info['scheme'] . ':host=' . $info['host'], $username, $password), 'tmp_connection', false); -
    783 -
    784            try { -
    785                // Create database -
    786                $connect->export->createDatabase($name); -
    787 -
    788                // Close the tmp connection with no database -
    789                $manager->closeConnection($connect); -
    790 -
    791                // Close original connection -
    792                $manager->closeConnection($connection); -
    793 -
    794                // Reopen original connection with newly created database -
    795                $manager->openConnection(new PDO($info['dsn'], $username, $password), $name, true); -
    796 -
    797                $results[$name] = true; -
    798            } catch (Exception $e) { -
    799                $results[$name] = false; -
    800            } -
    801        } -
    802 -
    803        return $results; -
    804    } -
    805 -
    806    /** -
    807     * dropDatabases -
    808     * -
    809     * Drops databases for connections -
    810     * -
    811     * @param string $specifiedConnections Array of connections you wish to drop the database for -
    812     * @return void -
    813     */ -
    814    public static function dropDatabases($specifiedConnections = array()) -
    815    { -
    816        if ( ! is_array($specifiedConnections)) { -
    817            $specifiedConnections = (array) $specifiedConnections; -
    818        } -
    819 -
    820        $manager = Doctrine_Manager::getInstance(); -
    821 -
    822        $connections = $manager->getConnections(); -
    823 -
    824        $results = array(); -
    825 -
    826        foreach ($connections as $name => $connection) { -
    827            if ( ! empty($specifiedConnections) && !in_array($name, $specifiedConnections)) { -
    828                continue; -
    829            } -
    830 -
    831            try { -
    832                $connection->export->dropDatabase($name); -
    833 -
    834                $results[$name] = true; -
    835            } catch (Exception $e) { -
    836                $results[$name] = false; -
    837            } -
    838        } -
    839 -
    840        return $results; -
    841    } -
    842 -
    843    /** -
    844     * dumpData -
    845     * -
    846     * Dump data to a yaml fixtures file -
    847     * -
    848     * @param string $yamlPath Path to write the yaml data fixtures to -
    849     * @param string $individualFiles Whether or not to dump data to individual fixtures files -
    850     * @return void -
    851     */ -
    852    public static function dumpData($yamlPath, $individualFiles = false) -
    853    { -
    854        $data = new Doctrine_Data(); -
    855 -
    856        return $data->exportData($yamlPath, 'yml', array(), $individualFiles); -
    857    } -
    858 -
    859    /** -
    860     * loadData -
    861     * -
    862     * Load data from a yaml fixtures file. -
    863     * The output of dumpData can be fed to loadData -
    864     * -
    865     * @param string $yamlPath Path to your yaml data fixtures -
    866     * @param string $append Whether or not to append the data -
    867     * @return void -
    868     */ -
    869    public static function loadData($yamlPath, $append = false) -
    870    { -
    871        $data = new Doctrine_Data(); -
    872 -
    873        if ( ! $append) { -
    874            $data->purge(); -
    875        } -
    876 -
    877        return $data->importData($yamlPath, 'yml'); -
    878    } -
    879 -
    880    /** -
    881     * migrate -
    882     * -
    883     * Migrate database to specified $to version. Migrates from current to latest if you do not specify. -
    884     * -
    885     * @param string $migrationsPath Path to migrations directory which contains your migration classes -
    886     * @param string $to Version you wish to migrate to. -
    887     * @return bool true -
    888     * @throws new Doctrine_Migration_Exception -
    889     */ -
    890    public static function migrate($migrationsPath, $to = null) -
    891    { -
    892        $migration = new Doctrine_Migration($migrationsPath); -
    893 -
    894        return $migration->migrate($to); -
    895    } -
    896 -
    897    /** -
    898     * generateMigrationClass -
    899     * -
    900     * Generate new migration class skeleton -
    901     * -
    902     * @param string $className Name of the Migration class to generate -
    903     * @param string $migrationsPath Path to directory which contains your migration classes -
    904     */ -
    905    public static function generateMigrationClass($className, $migrationsPath) -
    906    { -
    907        $builder = new Doctrine_Migration_Builder($migrationsPath); -
    908 -
    909        return $builder->generateMigrationClass($className); -
    910    } -
    911 -
    912    /** -
    913     * generateMigrationsFromDb -
    914     * -
    915     * @param string $migrationsPath -
    916     * @return void -
    917     * @throws new Doctrine_Migration_Exception -
    918     */ -
    919    public static function generateMigrationsFromDb($migrationsPath) -
    920    { -
    921        $builder = new Doctrine_Migration_Builder($migrationsPath); -
    922 -
    923        return $builder->generateMigrationsFromDb(); -
    924    } -
    925 -
    926    /** -
    927     * generateMigrationsFromModels -
    928     * -
    929     * @param string $migrationsPath -
    930     * @param string $modelsPath -
    931     * @return void -
    932     */ -
    933    public static function generateMigrationsFromModels($migrationsPath, $modelsPath = null) -
    934    { -
    935        $builder = new Doctrine_Migration_Builder($migrationsPath); -
    936 -
    937        return $builder->generateMigrationsFromModels($modelsPath); -
    938    } -
    939 -
    940    /** -
    941     * getTable -
    942     * -
    943     * @param string $tableName -
    944     * @return void -
    945     */ -
    946    public static function getTable($tableName) -
    947    { -
    948        return Doctrine_Manager::table($tableName); -
    949    } -
    950 -
    951    /** -
    952     * fileFinder -
    953     * -
    954     * @param string $type -
    955     * @return void -
    956     */ -
    957    public static function fileFinder($type) -
    958    { -
    959        return Doctrine_FileFinder::type($type); -
    960    } -
    961 -
    962    /** -
    963     * compile -
    964     * -
    965     * method for making a single file of most used doctrine runtime components -
    966     * including the compiled file instead of multiple files (in worst -
    967     * cases dozens of files) can improve performance by an order of magnitude -
    968     * -
    969     * @param string $target -
    970     * @param array  $includedDrivers -
    971     * @throws Doctrine_Exception -
    972     * @return void -
    973     */ -
    974    public static function compile($target = null, $includedDrivers = array()) -
    975    { -
    976        return Doctrine_Compiler::compile($target, $includedDrivers); -
    977    } -
    978 -
    979    /** -
    980     * autoload -
    981     * -
    982     * simple autoload function -
    983     * returns true if the class was loaded, otherwise false -
    984     * -
    985     * @param string $classname -
    986     * @return boolean -
    987     */ -
    988    public static function autoload($className) -
    989    { -
    990        if (class_exists($className, false)) { -
    991            return false; -
    992        } -
    993 -
    994        if ( ! self::$_path) { -
    995            self::$_path = dirname(__FILE__); -
    996        } -
    997 -
    998        $class = self::$_path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; -
    999 -
    1000        if (file_exists($class)) { -
    1001            require_once($class); -
    1002 -
    1003            return true; -
    1004        } -
    1005 -
    1006        $loadedModels = self::$_loadedModels; -
    1007 -
    1008        if (isset($loadedModels[$className]) && file_exists($loadedModels[$className])) { -
    1009            require_once($loadedModels[$className]); -
    1010 -
    1011            return true; -
    1012        } -
    1013 -
    1014        return false; -
    1015    } -
    1016 -
    1017    /** -
    1018     * dump -
    1019     * -
    1020     * dumps a given variable -
    1021     * -
    1022     * @param mixed $var        a variable of any type -
    1023     * @param boolean $output   whether to output the content -
    1024     * @param string $indent    indention string -
    1025     * @return void|string -
    1026     */ -
    1027    public static function dump($var, $output = true, $indent = "") -
    1028    { -
    1029        $ret = array(); -
    1030        switch (gettype($var)) { -
    1031            case 'array': -
    1032                $ret[] = 'Array('; -
    1033                $indent .= "    "; -
    1034                foreach ($var as $k => $v) { -
    1035 -
    1036                    $ret[] = $indent . $k . ' : ' . self::dump($v, false, $indent); -
    1037                } -
    1038                $indent = substr($indent,0, -4); -
    1039                $ret[] = $indent . ")"; -
    1040                break; -
    1041            case 'object': -
    1042                $ret[] = 'Object(' . get_class($var) . ')'; -
    1043                break; -
    1044            default: -
    1045                $ret[] = var_export($var, true); -
    1046        } -
    1047        if ($output) { -
    1048            print implode("\n", $ret); -
    1049        } -
    1050        return implode("\n", $ret); -
    1051    } -
    1052 -
    1053    /** -
    1054     * tableize -
    1055     * -
    1056     * returns table name from class name -
    1057     * -
    1058     * @param string $classname -
    1059     * @return string -
    1060     */ -
    1061    public static function tableize($classname) -
    1062    { -
    1063         return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $classname)); -
    1064    } -
    1065 -
    1066    /** -
    1067     * classify -
    1068     * -
    1069     * returns class name from table name -
    1070     * -
    1071     * @param string $tablename -
    1072     * @return string -
    1073     */ -
    1074    public static function classify($tablename) -
    1075    { -
    1076        return preg_replace_callback('~(_?)(_)([\w])~', array("Doctrine", "classifyCallback"), ucfirst($tablename)); -
    1077    } -
    1078 -
    1079    /** -
    1080     * classifyCallback -
    1081     * -
    1082     * Callback function to classify a classname properly. -
    1083     * -
    1084     * @param array $matches An array of matches from a pcre_replace call -
    1085     * @return string A string with matches 1 and mathces 3 in upper case. -
    1086     */ -
    1087    public static function classifyCallback($matches) -
    1088    { -
    1089        return $matches[1] . strtoupper($matches[3]); -
    1090    } -
    1091 -
    1092    /** -
    1093     * isValidClassName -
    1094     * -
    1095     * checks for valid class name (uses camel case and underscores) -
    1096     * -
    1097     * @param string $classname -
    1098     * @return boolean -
    1099     */ -
    1100    public static function isValidClassname($classname) -
    1101    { -
    1102        if (preg_match('~(^[a-z])|(_[a-z])|([\W])|(_{2})~', $classname)) { -
    1103            return false; -
    1104        } -
    1105 -
    1106        return true; -
    1107    } -
    1108 -
    1109    /** -
    1110     * makeDirectories -
    1111     * -
    1112     * Makes the directories for a path recursively -
    1113     * -
    1114     * @param string $path -
    1115     * @return void -
    1116     */ -
    1117    public static function makeDirectories($path, $mode = 0777) -
    1118    { -
    1119        if (!$path) { -
    1120          return false; -
    1121        } -
    1122 -
    1123        if (is_dir($path) || is_file($path)) { -
    1124          return true; -
    1125        } -
    1126 -
    1127        return mkdir($path, $mode, true); -
    1128    } -
    1129 -
    1130    /** -
    1131     * removeDirectories -
    1132     * -
    1133     * @param string $folderPath -
    1134     * @return void -
    1135     */ -
    1136    public static function removeDirectories($folderPath) -
    1137    { -
    1138        if ( ! is_dir($folderPath)) -
    1139        { -
    1140            return false; -
    1141        } -
    1142 -
    1143        foreach (scandir($folderPath) as $value) -
    1144        { -
    1145            if ($value != '.' && $value != '..') -
    1146            { -
    1147                $value = $folderPath . "/" . $value; -
    1148 -
    1149                if (is_dir($value)) { -
    1150                    self::removeDirectories($value); -
    1151                } else if (is_file($value)) { -
    1152                    @unlink($value); -
    1153                } -
    1154            } -
    1155        } -
    1156 -
    1157        return rmdir ( $folderPath ); -
    1158    }     -
    1159 -
    1160    /** -
    1161     * getValidators -
    1162     * -
    1163     * Get available doctrine validators -
    1164     * -
    1165     * @return array $validators -
    1166     */ -
    1167    public static function getValidators() -
    1168    { -
    1169        if (empty(self::$_validators)) { -
    1170            $dir = Doctrine::getPath() . DIRECTORY_SEPARATOR . 'Doctrine' . DIRECTORY_SEPARATOR . 'Validator'; -
    1171 -
    1172            $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY); -
    1173            foreach ($files as $file) { -
    1174                $e = explode('.', $file->getFileName()); -
    1175 -
    1176                if (end($e) == 'php') { -
    1177                    $name = strtolower($e[0]); -
    1178 -
    1179                    self::$_validators[$name] = $name; -
    1180                } -
    1181            } -
    1182        } -
    1183 -
    1184        return self::$_validators; -
    1185    } -
    1186} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Access.html b/tests_old/coverage/Doctrine_Access.html deleted file mode 100644 index e6166c33f..000000000 --- a/tests_old/coverage/Doctrine_Access.html +++ /dev/null @@ -1,471 +0,0 @@ - - - Coverage for Doctrine_Access - - -

    Coverage for Doctrine_Access

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Access.php 3189 2007-11-18 20:37:44Z meus $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Access -
    24 * -
    25 * the purpose of Doctrine_Access is to provice array access -
    26 * and property overload interface for subclasses -
    27 * -
    28 * @package     Doctrine -
    29 * @subpackage  Access -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 3189 $ -
    34 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    35 */ -
    36abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements ArrayAccess -
    37{ -
    38    /** -
    39     * setArray -
    40     * -
    41     * @param array $array          an array of key => value pairs -
    42     * @since 1.0 -
    43     * @return Doctrine_Access -
    44     */ -
    45    public function setArray(array $array) -
    46    { -
    47        foreach ($array as $k=>$v) { -
    48            $this->set($k,$v); -
    49        } -
    50 -
    51        return $this; -
    52    } -
    53 -
    54    /** -
    55     * __set        an alias of set() -
    56     * -
    57     * @see set, offsetSet -
    58     * @param $name -
    59     * @param $value -
    60     * @since 1.0 -
    61     * @return void -
    62     */ -
    63    public function __set($name,$value) -
    64    { -
    65        $this->set($name,$value); -
    66    } -
    67 -
    68    /** -
    69     * __get -- an alias of get() -
    70     * -
    71     * @see get,  offsetGet -
    72     * @param mixed $name -
    73     * @since 1.0 -
    74     * @return mixed -
    75     */ -
    76    public function __get($name) -
    77    { -
    78        return $this->get($name); -
    79    } -
    80 -
    81    /** -
    82     * __isset() -
    83     * -
    84     * @param string $name -
    85     * @since 1.0 -
    86     * @return boolean          whether or not this object contains $name -
    87     */ -
    88    public function __isset($name) -
    89    { -
    90        return $this->contains($name); -
    91    } -
    92 -
    93    /** -
    94     * __unset() -
    95     * -
    96     * @param string $name -
    97     * @since 1.0 -
    98     * @return void -
    99     */ -
    100    public function __unset($name) -
    101    { -
    102        return $this->remove($name); -
    103    } -
    104 -
    105    /** -
    106     * Check if an offsetExists. Alias for contains. -
    107     * -
    108     * @param mixed $offset -
    109     * @return boolean          whether or not this object contains $offset -
    110     */ -
    111    public function offsetExists($offset) -
    112    { -
    113        return $this->contains($offset); -
    114    } -
    115 -
    116    /** -
    117     * offsetGet    an alias of get() -
    118     * -
    119     * @see get,  __get -
    120     * @param mixed $offset -
    121     * @return mixed -
    122     */ -
    123    public function offsetGet($offset) -
    124    { -
    125        return $this->get($offset); -
    126    } -
    127 -
    128    /** -
    129     * sets $offset to $value -
    130     * @see set,  __set -
    131     * @param mixed $offset -
    132     * @param mixed $value -
    133     * @return void -
    134     */ -
    135    public function offsetSet($offset, $value) -
    136    { -
    137        if ( ! isset($offset)) { -
    138            $this->add($value); -
    139        } else { -
    140            $this->set($offset, $value); -
    141        } -
    142    } -
    143 -
    144    /** -
    145     * unset a given offset -
    146     * @see set, offsetSet, __set -
    147     * @param mixed $offset -
    148     */ -
    149    public function offsetUnset($offset) -
    150    { -
    151        return $this->remove($offset); -
    152    } -
    153} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Adapter_Mock.html b/tests_old/coverage/Doctrine_Adapter_Mock.html deleted file mode 100644 index 34b82dc30..000000000 --- a/tests_old/coverage/Doctrine_Adapter_Mock.html +++ /dev/null @@ -1,498 +0,0 @@ - - - Coverage for Doctrine_Adapter_Mock - - -

    Coverage for Doctrine_Adapter_Mock

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mock.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Adapter_Mock -
    24 * This class is used for special testing purposes. -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Adapter -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2963 $ -
    33 */ -
    34class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable -
    35{ -
    36    private $name; -
    37     -
    38    private $queries = array(); -
    39     -
    40    private $exception = array(); -
    41     -
    42    private $lastInsertIdFail = false; -
    43 -
    44    public function __construct($name = null)  -
    45    { -
    46        $this->name = $name; -
    47    } -
    48    public function getName()  -
    49    { -
    50        return $this->name; -
    51    } -
    52    public function pop()  -
    53    { -
    54        return array_pop($this->queries); -
    55    } -
    56    public function forceException($name, $message = '', $code = 0)  -
    57    { -
    58        $this->exception = array($name, $message, $code); -
    59    } -
    60    public function prepare($query) -
    61    { -
    62        $mock = new Doctrine_Adapter_Statement_Mock($this, $query); -
    63        $mock->queryString = $query; -
    64         -
    65        return $mock; -
    66    } -
    67    public function addQuery($query) -
    68    { -
    69        $this->queries[] = $query; -
    70    } -
    71    public function query($query)  -
    72    { -
    73        $this->queries[] = $query; -
    74 -
    75        $e    = $this->exception; -
    76 -
    77        if ( ! empty($e)) { -
    78            $name = $e[0]; -
    79 -
    80            $this->exception = array(); -
    81 -
    82            throw new $name($e[1], $e[2]); -
    83        } -
    84 -
    85        $stmt = new Doctrine_Adapter_Statement_Mock($this, $query); -
    86        $stmt->queryString = $query; -
    87         -
    88        return $stmt; -
    89    } -
    90    public function getAll()  -
    91    { -
    92        return $this->queries; -
    93    } -
    94    public function quote($input)  -
    95    { -
    96        return "'" . addslashes($input) . "'"; -
    97    } -
    98    public function exec($statement)  -
    99    { -
    100        $this->queries[] = $statement; -
    101 -
    102        $e    = $this->exception; -
    103 -
    104        if ( ! empty($e)) { -
    105            $name = $e[0]; -
    106 -
    107            $this->exception = array(); -
    108 -
    109            throw new $name($e[1], $e[2]); -
    110        } -
    111 -
    112        return 0; -
    113    } -
    114    public function forceLastInsertIdFail($fail = true)  -
    115    { -
    116        if ($fail) { -
    117            $this->lastInsertIdFail = true; -
    118        } else { -
    119            $this->lastInsertIdFail = false; -
    120        } -
    121    } -
    122    public function lastInsertId() -
    123    { -
    124        $this->queries[] = 'LAST_INSERT_ID()'; -
    125        if ($this->lastInsertIdFail) { -
    126            return null; -
    127        } else { -
    128            return 1; -
    129        } -
    130    } -
    131    public function count()  -
    132    { -
    133        return count($this->queries);     -
    134    } -
    135    public function beginTransaction() -
    136    { -
    137        $this->queries[] = 'BEGIN TRANSACTION'; -
    138    } -
    139    public function commit() -
    140    { -
    141        $this->queries[] = 'COMMIT'; -
    142    } -
    143    public function rollBack()  -
    144    { -
    145        $this->queries[] = 'ROLLBACK'; -
    146    } -
    147    public function errorCode()  -
    148    { } -
    149    public function errorInfo() -
    150    { } -
    151    public function getAttribute($attribute)  -
    152    { -
    153        if ($attribute == Doctrine::ATTR_DRIVER_NAME) -
    154            return strtolower($this->name); -
    155    } -
    156    public function setAttribute($attribute, $value)  -
    157    { -
    158                                        -
    159    } -
    160    public function sqliteCreateFunction() -
    161    { } -
    162} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Adapter_Statement_Mock.html b/tests_old/coverage/Doctrine_Adapter_Statement_Mock.html deleted file mode 100644 index 00edb1871..000000000 --- a/tests_old/coverage/Doctrine_Adapter_Statement_Mock.html +++ /dev/null @@ -1,1059 +0,0 @@ - - - Coverage for Doctrine_Adapter_Statement_Mock - - -

    Coverage for Doctrine_Adapter_Statement_Mock

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mock.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Adapter_Statement_Mock -
    24 * This class is used for special testing purposes. -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Adapter -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2963 $ -
    33 */ -
    34class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Interface -
    35{ -
    36    private $mock; -
    37     -
    38    public $queryString; -
    39 -
    40    public function __construct($mock) -
    41    { -
    42        $this->mock  = $mock; -
    43    } -
    44 -
    45    /** -
    46     * bindColumn -
    47     * Bind a column to a PHP variable -
    48     * -
    49     * @param mixed $column         Number of the column (1-indexed) or name of the column in the result set. -
    50     *                              If using the column name, be aware that the name should match -
    51     *                              the case of the column, as returned by the driver. -
    52     * @param string $param         Name of the PHP variable to which the column will be bound. -
    53     * @param integer $type         Data type of the parameter, specified by the Doctrine::PARAM_* constants. -
    54     * @return boolean              Returns TRUE on success or FALSE on failure -
    55     */ -
    56    public function bindColumn($column, $param, $type = null) -
    57    { -
    58         -
    59    } -
    60 -
    61    /** -
    62     * bindValue -
    63     * Binds a value to a corresponding named or question mark  -
    64     * placeholder in the SQL statement that was use to prepare the statement. -
    65     * -
    66     * @param mixed $param          Parameter identifier. For a prepared statement using named placeholders, -
    67     *                              this will be a parameter name of the form :name. For a prepared statement -
    68     *                              using question mark placeholders, this will be the 1-indexed position of the parameter -
    69     * -
    70     * @param mixed $value          The value to bind to the parameter. -
    71     * @param integer $type         Explicit data type for the parameter using the Doctrine::PARAM_* constants. -
    72     * -
    73     * @return boolean              Returns TRUE on success or FALSE on failure. -
    74     */ -
    75    public function bindValue($param, $value, $type = null) -
    76    { -
    77         -
    78    } -
    79 -
    80    /** -
    81     * bindParam -
    82     * Binds a PHP variable to a corresponding named or question mark placeholder in the  -
    83     * SQL statement that was use to prepare the statement. Unlike Doctrine_Adapter_Statement_Interface->bindValue(), -
    84     * the variable is bound as a reference and will only be evaluated at the time  -
    85     * that Doctrine_Adapter_Statement_Interface->execute() is called. -
    86     * -
    87     * Most parameters are input parameters, that is, parameters that are  -
    88     * used in a read-only fashion to build up the query. Some drivers support the invocation  -
    89     * of stored procedures that return data as output parameters, and some also as input/output -
    90     * parameters that both send in data and are updated to receive it. -
    91     * -
    92     * @param mixed $param          Parameter identifier. For a prepared statement using named placeholders, -
    93     *                              this will be a parameter name of the form :name. For a prepared statement -
    94     *                              using question mark placeholders, this will be the 1-indexed position of the parameter -
    95     * -
    96     * @param mixed $variable       Name of the PHP variable to bind to the SQL statement parameter. -
    97     * -
    98     * @param integer $type         Explicit data type for the parameter using the Doctrine::PARAM_* constants. To return -
    99     *                              an INOUT parameter from a stored procedure, use the bitwise OR operator to set the -
    100     *                              Doctrine::PARAM_INPUT_OUTPUT bits for the data_type parameter. -
    101     * -
    102     * @param integer $length       Length of the data type. To indicate that a parameter is an OUT parameter -
    103     *                              from a stored procedure, you must explicitly set the length. -
    104     * @param mixed $driverOptions -
    105     * @return boolean              Returns TRUE on success or FALSE on failure. -
    106     */ -
    107    public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array()) -
    108    { -
    109         -
    110    } -
    111 -
    112    /** -
    113     * closeCursor -
    114     * Closes the cursor, enabling the statement to be executed again. -
    115     * -
    116     * @return boolean              Returns TRUE on success or FALSE on failure. -
    117     */ -
    118    public function closeCursor() -
    119    { -
    120        return true; -
    121    } -
    122 -
    123    /**  -
    124     * columnCount -
    125     * Returns the number of columns in the result set  -
    126     * -
    127     * @return integer              Returns the number of columns in the result set represented -
    128     *                              by the Doctrine_Adapter_Statement_Interface object. If there is no result set, -
    129     *                              this method should return 0. -
    130     */ -
    131    public function columnCount() -
    132    { -
    133        return 0;         -
    134    } -
    135 -
    136    /** -
    137     * errorCode -
    138     * Fetch the SQLSTATE associated with the last operation on the statement handle  -
    139     * -
    140     * @see Doctrine_Adapter_Interface::errorCode() -
    141     * @return string       error code string -
    142     */ -
    143    public function errorCode() -
    144    { -
    145        return array(); -
    146    } -
    147 -
    148    /** -
    149     * errorInfo -
    150     * Fetch extended error information associated with the last operation on the statement handle -
    151     * -
    152     * @see Doctrine_Adapter_Interface::errorInfo() -
    153     * @return array        error info array -
    154     */ -
    155    public function errorInfo() -
    156    {  -
    157        return array(); -
    158    } -
    159 -
    160    /** -
    161     * fetch -
    162     * -
    163     * @see Doctrine::FETCH_* constants -
    164     * @param integer $fetchStyle           Controls how the next row will be returned to the caller. -
    165     *                                      This value must be one of the Doctrine::FETCH_* constants, -
    166     *                                      defaulting to Doctrine::FETCH_BOTH -
    167     * -
    168     * @param integer $cursorOrientation    For a PDOStatement object representing a scrollable cursor,  -
    169     *                                      this value determines which row will be returned to the caller.  -
    170     *                                      This value must be one of the Doctrine::FETCH_ORI_* constants, defaulting to -
    171     *                                      Doctrine::FETCH_ORI_NEXT. To request a scrollable cursor for your  -
    172     *                                      Doctrine_Adapter_Statement_Interface object, -
    173     *                                      you must set the Doctrine::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you -
    174     *                                      prepare the SQL statement with Doctrine_Adapter_Interface->prepare(). -
    175     * -
    176     * @param integer $cursorOffset         For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for which the -
    177     *                                      $cursorOrientation parameter is set to Doctrine::FETCH_ORI_ABS, this value specifies -
    178     *                                      the absolute number of the row in the result set that shall be fetched. -
    179     *                                       -
    180     *                                      For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for  -
    181     *                                      which the $cursorOrientation parameter is set to Doctrine::FETCH_ORI_REL, this value  -
    182     *                                      specifies the row to fetch relative to the cursor position before  -
    183     *                                      Doctrine_Adapter_Statement_Interface->fetch() was called. -
    184     * -
    185     * @return mixed -
    186     */ -
    187    public function fetch($fetchStyle = Doctrine::FETCH_BOTH, -
    188                          $cursorOrientation = Doctrine::FETCH_ORI_NEXT, -
    189                          $cursorOffset = null) -
    190    { -
    191        return array(); -
    192    } -
    193 -
    194    /** -
    195     * fetchAll -
    196     * Returns an array containing all of the result set rows -
    197     * -
    198     * @param integer $fetchStyle           Controls how the next row will be returned to the caller. -
    199     *                                      This value must be one of the Doctrine::FETCH_* constants, -
    200     *                                      defaulting to Doctrine::FETCH_BOTH -
    201     * -
    202     * @param integer $columnIndex          Returns the indicated 0-indexed column when the value of $fetchStyle is -
    203     *                                      Doctrine::FETCH_COLUMN. Defaults to 0. -
    204     * -
    205     * @return array -
    206     */ -
    207    public function fetchAll($fetchMode = Doctrine::FETCH_BOTH) -
    208    { -
    209        return array(); -
    210    } -
    211 -
    212    /** -
    213     * execute -
    214     * Executes a prepared statement -
    215     * -
    216     * If the prepared statement included parameter markers, you must either: -
    217     * call PDOStatement->bindParam() to bind PHP variables to the parameter markers: -
    218     * bound variables pass their value as input and receive the output value, -
    219     * if any, of their associated parameter markers or pass an array of input-only -
    220     * parameter values -
    221     * -
    222     * -
    223     * @param array $params             An array of values with as many elements as there are -
    224     *                                  bound parameters in the SQL statement being executed. -
    225     * @return boolean                  Returns TRUE on success or FALSE on failure. -
    226     */ -
    227    public function execute($params = null) -
    228    { -
    229        if (is_object($this->mock)) { -
    230            $this->mock->addQuery($this->queryString); -
    231        } -
    232        return true; -
    233    } -
    234 -
    235    /** -
    236     * fetchColumn -
    237     * Returns a single column from the next row of a -
    238     * result set or FALSE if there are no more rows. -
    239     * -
    240     * @param integer $columnIndex          0-indexed number of the column you wish to retrieve from the row. If no  -
    241     *                                      value is supplied, Doctrine_Adapter_Statement_Interface->fetchColumn()  -
    242     *                                      fetches the first column. -
    243     * -
    244     * @return string                       returns a single column in the next row of a result set. -
    245     */ -
    246    public function fetchColumn($columnIndex = 0) -
    247    { -
    248        return 0; -
    249    } -
    250 -
    251    /** -
    252     * fetchObject -
    253     * Fetches the next row and returns it as an object. -
    254     * -
    255     * Fetches the next row and returns it as an object. This function is an alternative to  -
    256     * Doctrine_Adapter_Statement_Interface->fetch() with Doctrine::FETCH_CLASS or Doctrine::FETCH_OBJ style. -
    257     * -
    258     * @param string $className             Name of the created class, defaults to stdClass.  -
    259     * @param array $args                   Elements of this array are passed to the constructor. -
    260     * -
    261     * @return mixed                        an instance of the required class with property names that correspond  -
    262     *                                      to the column names or FALSE in case of an error. -
    263     */ -
    264    public function fetchObject($className = 'stdClass', $args = array())  -
    265    { -
    266        return new $className(); -
    267    } -
    268 -
    269    /** -
    270     * nextRowset -
    271     * Advances to the next rowset in a multi-rowset statement handle -
    272     *  -
    273     * Some database servers support stored procedures that return more than one rowset  -
    274     * (also known as a result set). The nextRowset() method enables you to access the second  -
    275     * and subsequent rowsets associated with a PDOStatement object. Each rowset can have a  -
    276     * different set of columns from the preceding rowset. -
    277     * -
    278     * @return boolean                      Returns TRUE on success or FALSE on failure. -
    279     */ -
    280    public function nextRowset() -
    281    { -
    282        return true; -
    283    } -
    284 -
    285    /** -
    286     * rowCount -
    287     * rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement  -
    288     * executed by the corresponding object. -
    289     * -
    290     * If the last SQL statement executed by the associated Statement object was a SELECT statement,  -
    291     * some databases may return the number of rows returned by that statement. However,  -
    292     * this behaviour is not guaranteed for all databases and should not be  -
    293     * relied on for portable applications. -
    294     * -
    295     * @return integer                      Returns the number of rows. -
    296     */ -
    297    public function rowCount() -
    298    {  -
    299        return 0; -
    300    } -
    301 -
    302    /** -
    303     * getColumnMeta -
    304     * Returns metadata for a column in a result set -
    305     * -
    306     * @param integer $column               The 0-indexed column in the result set. -
    307     * -
    308     * @return array                        Associative meta data array with the following structure: -
    309     * -
    310     *          native_type                 The PHP native type used to represent the column value. -
    311     *          driver:decl_                type The SQL type used to represent the column value in the database. If the column in the result set is the result of a function, this value is not returned by PDOStatement->getColumnMeta(). -
    312     *          flags                       Any flags set for this column. -
    313     *          name                        The name of this column as returned by the database. -
    314     *          len                         The length of this column. Normally -1 for types other than floating point decimals. -
    315     *          precision                   The numeric precision of this column. Normally 0 for types other than floating point decimals. -
    316     *          pdo_type                    The type of this column as represented by the PDO::PARAM_* constants. -
    317     */ -
    318    public function getColumnMeta($column) -
    319    { } -
    320    /** -
    321     * getAttribute -
    322     * Retrieve a statement attribute  -
    323     * -
    324     * @param integer $attribute -
    325     * @see Doctrine::ATTR_* constants -
    326     * @return mixed                        the attribute value -
    327     */ -
    328    public function getAttribute($attribute) -
    329    { } -
    330    /** -
    331     * setAttribute -
    332     * Set a statement attribute -
    333     * -
    334     * @param integer $attribute -
    335     * @param mixed $value                  the value of given attribute -
    336     * @return boolean                      Returns TRUE on success or FALSE on failure. -
    337     */ -
    338    public function setAttribute($attribute, $value) -
    339    { } -
    340    /** -
    341     * setFetchMode -
    342     * Set the default fetch mode for this statement -
    343     * -
    344     * @param integer $mode                 The fetch mode must be one of the Doctrine::FETCH_* constants. -
    345     * @return boolean                      Returns 1 on success or FALSE on failure. -
    346     */ -
    347    public function setFetchMode($mode, $arg1 = null, $arg2 = null) -
    348    { } -
    349} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_AuditLog.html b/tests_old/coverage/Doctrine_AuditLog.html deleted file mode 100644 index 20f99fde0..000000000 --- a/tests_old/coverage/Doctrine_AuditLog.html +++ /dev/null @@ -1,375 +0,0 @@ - - - Coverage for Doctrine_AuditLog - - -

    Coverage for Doctrine_AuditLog

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_AuditLog -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  AuditLog -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_AuditLog extends Doctrine_Plugin -
    34{ -
    35    protected $_options = array( -
    36                            'className'     => '%CLASS%Version', -
    37                            'versionColumn' => 'version', -
    38                            'generateFiles' => false, -
    39                            'table'         => false, -
    40                            'pluginTable'   => false, -
    41                            ); -
    42 -
    43    /** -
    44     * Create a new auditlog_  -
    45     *  -
    46     * @param array $options An array of options -
    47     * @return void -
    48     */ -
    49    public function __construct(array $options = array()) -
    50    { -
    51        $this->_options = array_merge($this->_options, $options); -
    52    } -
    53 -
    54    /** -
    55     * Get the version  -
    56     *  -
    57     * @param Doctrine_Record $record  -
    58     * @param mixed $version  -
    59     * @return array An array with version information -
    60     */ -
    61    public function getVersion(Doctrine_Record $record, $version) -
    62    {            -
    63        $className = $this->_options['className']; -
    64 -
    65        $q = new Doctrine_Query(); -
    66 -
    67        $values = array(); -
    68        foreach ((array) $this->_options['table']->getIdentifier() as $id) { -
    69            $conditions[] = $className . '.' . $id . ' = ?'; -
    70            $values[] = $record->get($id); -
    71        } -
    72        $where = implode(' AND ', $conditions) . ' AND ' . $className . '.' . $this->_options['versionColumn'] . ' = ?'; -
    73         -
    74        $values[] = $version; -
    75 -
    76        $q->from($className) -
    77          ->where($where); -
    78 -
    79        return $q->execute($values, Doctrine::HYDRATE_ARRAY); -
    80    } -
    81 -
    82    /** -
    83     * buildDefinition for a table  -
    84     *  -
    85     * @param Doctrine_Table $table  -
    86     * @return boolean true on success otherwise false. -
    87     */ -
    88    public function buildDefinition() -
    89    { -
    90        $name = $this->_options['table']->getComponentName(); -
    91 -
    92        $columns = $this->_options['table']->getColumns(); -
    93 -
    94        // remove all sequence, autoincrement and unique constraint definitions -
    95        foreach ($columns as $column => $definition) { -
    96            unset($columns[$column]['autoincrement']); -
    97            unset($columns[$column]['sequence']); -
    98            unset($columns[$column]['unique']); -
    99        } -
    100 -
    101        // the version column should be part of the primary key definition -
    102        $columns[$this->_options['versionColumn']] = array('type' => 'integer', -
    103                                                           'length' => 8, -
    104                                                           'primary' => true); -
    105 -
    106        $id = $this->_options['table']->getIdentifier(); -
    107 -
    108        $options = array('className' => $this->_options['className']); -
    109 -
    110        $relations = array($name => array('local' => $id, -
    111                                          'foreign' => $id,  -
    112                                          'onDelete' => 'CASCADE', -
    113                                          'onUpdate' => 'CASCADE')); -
    114 -
    115        $this->generateClass($options, $columns, array()); -
    116         -
    117        $this->_options['pluginTable'] = $this->_options['table']->getConnection()->getTable($this->_options['className']); -
    118 -
    119        return true; -
    120    } -
    121} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_AuditLog_Listener.html b/tests_old/coverage/Doctrine_AuditLog_Listener.html deleted file mode 100644 index 8b33e27a9..000000000 --- a/tests_old/coverage/Doctrine_AuditLog_Listener.html +++ /dev/null @@ -1,273 +0,0 @@ - - - Coverage for Doctrine_AuditLog_Listener - - -

    Coverage for Doctrine_AuditLog_Listener

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Record_Listener'); -
    22/** -
    23 * Doctrine_AuditLog_Listener -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  AuditLog -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener -
    34{ -
    35     -
    36    protected $_auditLog; -
    37 -
    38    public function __construct(Doctrine_AuditLog $auditLog) { -
    39        $this->_auditLog = $auditLog; -
    40    } -
    41    public function preInsert(Doctrine_Event $event) -
    42    { -
    43        $versionColumn = $this->_auditLog->getOption('versionColumn'); -
    44 -
    45        $event->getInvoker()->set($versionColumn, 1); -
    46    } -
    47    public function postInsert(Doctrine_Event $event)  -
    48    { -
    49        $class = $this->_auditLog->getOption('className'); -
    50 -
    51        $record  = $event->getInvoker(); -
    52 -
    53        $version = new $class(); -
    54        $version->merge($record->toArray()); -
    55        $version->save(); -
    56    } -
    57    public function preDelete(Doctrine_Event $event) -
    58    { -
    59        $class = $this->_auditLog->getOption('className'); -
    60 -
    61        $record  = $event->getInvoker(); -
    62 -
    63        $versionColumn = $this->_auditLog->getOption('versionColumn'); -
    64        $version = $record->get($versionColumn); -
    65 -
    66        $record->set($versionColumn, ++$version); -
    67 -
    68        $version = new $class(); -
    69        $version->merge($record->toArray()); -
    70        $version->save(); -
    71    } -
    72    public function preUpdate(Doctrine_Event $event) -
    73    { -
    74        $class  = $this->_auditLog->getOption('className'); -
    75        $record = $event->getInvoker();  -
    76 -
    77        $versionColumn = $this->_auditLog->getOption('versionColumn'); -
    78 -
    79        $version = $record->get($versionColumn); -
    80 -
    81        $record->set($versionColumn, ++$version); -
    82         -
    83        $version = new $class(); -
    84        $version->merge($record->toArray()); -
    85        $version->save(); -
    86    } -
    87} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Cache_Array.html b/tests_old/coverage/Doctrine_Cache_Array.html deleted file mode 100644 index e50825889..000000000 --- a/tests_old/coverage/Doctrine_Cache_Array.html +++ /dev/null @@ -1,351 +0,0 @@ - - - Coverage for Doctrine_Cache_Array - - -

    Coverage for Doctrine_Cache_Array

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Array.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Cache_Interface -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Cache -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Cache_Array implements Countable, Doctrine_Cache_Interface -
    34{ -
    35    /** -
    36     * @var array $data         an array of cached data -
    37     */ -
    38    protected $data; -
    39 -
    40    /** -
    41     * Test if a cache is available for the given id and (if yes) return it (false else) -
    42     *  -
    43     * Note : return value is always "string" (unserialization is done by the core not by the backend) -
    44     *  -
    45     * @param string $id cache id -
    46     * @param boolean $testCacheValidity        if set to false, the cache validity won't be tested -
    47     * @return string cached datas (or false) -
    48     */ -
    49    public function fetch($id, $testCacheValidity = true)  -
    50    { -
    51        if (isset($this->data[$id])) { -
    52            return $this->data[$id]; -
    53        } -
    54        return false; -
    55    } -
    56 -
    57    /** -
    58     * Test if a cache is available or not (for the given id) -
    59     * -
    60     * @param string $id cache id -
    61     * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record -
    62     */ -
    63    public function contains($id) -
    64    { -
    65        return isset($this->data[$id]); -
    66    } -
    67 -
    68    /** -
    69     * Save some string datas into a cache record -
    70     * -
    71     * Note : $data is always saved as a string -
    72     * -
    73     * @param string $data      data to cache -
    74     * @param string $id        cache id -
    75     * @param int $lifeTime     if != false, set a specific lifetime for this cache record (null => infinite lifeTime) -
    76     * @return boolean true if no problem -
    77     */ -
    78    public function save($id, $data, $lifeTime = false) -
    79    { -
    80        $this->data[$id] = $data; -
    81    } -
    82 -
    83    /** -
    84     * Remove a cache record -
    85     *  -
    86     * @param string $id cache id -
    87     * @return boolean true if no problem -
    88     */ -
    89    public function delete($id) -
    90    { -
    91        unset($this->data[$id]); -
    92    } -
    93 -
    94    /** -
    95     * Remove all cache record -
    96     *  -
    97     * @return boolean true if no problem -
    98     */ -
    99    public function deleteAll() -
    100    { -
    101        $this->data = array(); -
    102    } -
    103 -
    104    /** -
    105     * count -
    106     * -
    107     * @return integer -
    108     */ -
    109    public function count()  -
    110    { -
    111        return count($this->data); -
    112    } -
    113} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Collection.html b/tests_old/coverage/Doctrine_Collection.html deleted file mode 100644 index 88b0e1b86..000000000 --- a/tests_old/coverage/Doctrine_Collection.html +++ /dev/null @@ -1,2514 +0,0 @@ - - - Coverage for Doctrine_Collection - - -

    Coverage for Doctrine_Collection

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Collection.php 3172 2007-11-15 22:45:09Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Access'); -
    22/** -
    23 * Doctrine_Collection -
    24 * Collection of Doctrine_Record objects. -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Collection -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 3172 $ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34class Doctrine_Collection extends Doctrine_Access implements Countable, IteratorAggregate, Serializable -
    35{ -
    36    /** -
    37     * @var array $data                     an array containing the records of this collection -
    38     */ -
    39    protected $data = array(); -
    40 -
    41    /** -
    42     * @var Doctrine_Table $table           each collection has only records of specified table -
    43     */ -
    44    protected $_table; -
    45 -
    46    /** -
    47     * @var array $_snapshot                a snapshot of the fetched data -
    48     */ -
    49    protected $_snapshot = array(); -
    50 -
    51    /** -
    52     * @var Doctrine_Record $reference      collection can belong to a record -
    53     */ -
    54    protected $reference; -
    55 -
    56    /** -
    57     * @var string $referenceField         the reference field of the collection -
    58     */ -
    59    protected $referenceField; -
    60 -
    61    /** -
    62     * @var Doctrine_Relation               the record this collection is related to, if any -
    63     */ -
    64    protected $relation; -
    65 -
    66    /** -
    67     * @var string $keyColumn               the name of the column that is used for collection key mapping -
    68     */ -
    69    protected $keyColumn; -
    70 -
    71    /** -
    72     * @var Doctrine_Null $null             used for extremely fast null value testing -
    73     */ -
    74    protected static $null; -
    75 -
    76 -
    77    /** -
    78     * constructor -
    79     * -
    80     * @param Doctrine_Table|string $table -
    81     */ -
    82    public function __construct($table, $keyColumn = null) -
    83    { -
    84        if ( ! ($table instanceof Doctrine_Table)) { -
    85            $table = Doctrine_Manager::getInstance() -
    86                        ->getTable($table); -
    87        } -
    88        $this->_table = $table; -
    89 -
    90        if ($keyColumn === null) { -
    91            $keyColumn = $table->getBoundQueryPart('indexBy'); -
    92        } -
    93 -
    94        if ($keyColumn !== null) { -
    95            $this->keyColumn = $keyColumn; -
    96        } -
    97    } -
    98 -
    99    /** -
    100     * initNullObject -
    101     * initializes the null object for this collection -
    102     * -
    103     * @return void -
    104     */ -
    105    public static function initNullObject(Doctrine_Null $null) -
    106    { -
    107        self::$null = $null; -
    108    } -
    109 -
    110    /** -
    111     * getTable -
    112     * returns the table this collection belongs to -
    113     * -
    114     * @return Doctrine_Table -
    115     */ -
    116    public function getTable() -
    117    { -
    118        return $this->_table; -
    119    } -
    120 -
    121    /** -
    122     * setData -
    123     * -
    124     * @param array $data -
    125     * @return Doctrine_Collection -
    126     */ -
    127    public function setData(array $data)  -
    128    { -
    129        $this->data = $data; -
    130    } -
    131 -
    132    /** -
    133     * this method is automatically called when this Doctrine_Collection is serialized -
    134     * -
    135     * @return array -
    136     */ -
    137    public function serialize() -
    138    { -
    139        $vars = get_object_vars($this); -
    140 -
    141        unset($vars['reference']); -
    142        unset($vars['reference_field']); -
    143        unset($vars['relation']); -
    144        unset($vars['expandable']); -
    145        unset($vars['expanded']); -
    146        unset($vars['generator']); -
    147 -
    148        $vars['_table'] = $vars['_table']->getComponentName(); -
    149 -
    150        return serialize($vars); -
    151    } -
    152 -
    153    /** -
    154     * unseralize -
    155     * this method is automatically called everytime a Doctrine_Collection object is unserialized -
    156     * -
    157     * @return void -
    158     */ -
    159    public function unserialize($serialized) -
    160    { -
    161        $manager    = Doctrine_Manager::getInstance(); -
    162        $connection    = $manager->getCurrentConnection(); -
    163 -
    164        $array = unserialize($serialized); -
    165 -
    166        foreach ($array as $name => $values) { -
    167            $this->$name = $values; -
    168        } -
    169 -
    170        $this->_table = $connection->getTable($this->_table); -
    171 -
    172        $keyColumn = isset($array['keyColumn']) ? $array['keyColumn'] : null; -
    173        if ($keyColumn === null) { -
    174            $keyColumn = $this->_table->getBoundQueryPart('indexBy'); -
    175        } -
    176 -
    177        if ($keyColumn !== null) { -
    178            $this->keyColumn = $keyColumn; -
    179        } -
    180    } -
    181 -
    182    /** -
    183     * setKeyColumn -
    184     * sets the key column for this collection -
    185     * -
    186     * @param string $column -
    187     * @return Doctrine_Collection -
    188     */ -
    189    public function setKeyColumn($column) -
    190    { -
    191        $this->keyColumn = $column; -
    192         -
    193        return $this; -
    194    } -
    195 -
    196    /** -
    197     * getKeyColumn -
    198     * returns the name of the key column -
    199     * -
    200     * @return string -
    201     */ -
    202    public function getKeyColumn() -
    203    { -
    204        return $this->column; -
    205    } -
    206 -
    207    /** -
    208     * getData -
    209     * returns all the records as an array -
    210     * -
    211     * @return array -
    212     */ -
    213    public function getData() -
    214    { -
    215        return $this->data; -
    216    } -
    217 -
    218    /** -
    219     * getFirst -
    220     * returns the first record in the collection -
    221     * -
    222     * @return mixed -
    223     */ -
    224    public function getFirst() -
    225    { -
    226        return reset($this->data); -
    227    } -
    228 -
    229    /** -
    230     * getLast -
    231     * returns the last record in the collection -
    232     * -
    233     * @return mixed -
    234     */ -
    235    public function getLast() -
    236    { -
    237        return end($this->data); -
    238    } -
    239    /** -
    240     * returns the last record in the collection -
    241     * -
    242     * @return mixed -
    243     */ -
    244    public function end() -
    245    { -
    246        return end($this->data); -
    247    } -
    248    /** -
    249     * returns the current key -
    250     * -
    251     * @return mixed -
    252     */ -
    253    public function key() -
    254    { -
    255        return key($this->data); -
    256    } -
    257    /** -
    258     * setReference -
    259     * sets a reference pointer -
    260     * -
    261     * @return void -
    262     */ -
    263    public function setReference(Doctrine_Record $record, Doctrine_Relation $relation) -
    264    { -
    265        $this->reference       = $record; -
    266        $this->relation        = $relation; -
    267 -
    268        if ($relation instanceof Doctrine_Relation_ForeignKey ||  -
    269            $relation instanceof Doctrine_Relation_LocalKey) { -
    270 -
    271            $this->referenceField = $relation->getForeign(); -
    272 -
    273            $value = $record->get($relation->getLocal()); -
    274 -
    275            foreach ($this->data as $record) { -
    276                if ($value !== null) { -
    277                    $record->set($this->referenceField, $value, false); -
    278                } else { -
    279                    $record->set($this->referenceField, $this->reference, false); -
    280                } -
    281            } -
    282        } elseif ($relation instanceof Doctrine_Relation_Association) { -
    283 -
    284        } -
    285    } -
    286 -
    287    /** -
    288     * getReference -
    289     * -
    290     * @return mixed -
    291     */ -
    292    public function getReference() -
    293    { -
    294        return $this->reference; -
    295    } -
    296 -
    297    /** -
    298     * remove -
    299     * removes a specified collection element -
    300     * -
    301     * @param mixed $key -
    302     * @return boolean -
    303     */ -
    304    public function remove($key) -
    305    { -
    306        $removed = $this->data[$key]; -
    307 -
    308        unset($this->data[$key]); -
    309        return $removed; -
    310    } -
    311 -
    312    /** -
    313     * contains -
    314     * whether or not this collection contains a specified element -
    315     * -
    316     * @param mixed $key                    the key of the element -
    317     * @return boolean -
    318     */ -
    319    public function contains($key) -
    320    { -
    321        return isset($this->data[$key]); -
    322    } -
    323    public function search(Doctrine_Record $record) -
    324    { -
    325        return array_search($record, $this->data, true); -
    326    } -
    327 -
    328    /** -
    329     * get -
    330     * returns a record for given key -
    331     * -
    332     * There are two special cases: -
    333     * -
    334     * 1. if null is given as a key a new record is created and attached -
    335     * at the end of the collection -
    336     * -
    337     * 2. if given key does not exist, then a new record is create and attached -
    338     * to the given key -
    339     * -
    340     * Collection also maps referential information to newly created records -
    341     * -
    342     * @param mixed $key                    the key of the element -
    343     * @return Doctrine_Record              return a specified record -
    344     */ -
    345    public function get($key) -
    346    { -
    347        if ( ! isset($this->data[$key])) { -
    348            $record = $this->_table->create(); -
    349 -
    350            if (isset($this->referenceField)) { -
    351                $value = $this->reference->get($this->relation->getLocal()); -
    352 -
    353                if ($value !== null) { -
    354                    $record->set($this->referenceField, $value, false); -
    355                } else { -
    356                    $record->set($this->referenceField, $this->reference, false); -
    357                } -
    358            } -
    359            if ($key === null) { -
    360                $this->data[] = $record; -
    361            } else { -
    362                $this->data[$key] = $record;       -
    363            } -
    364 -
    365            if (isset($this->keyColumn)) { -
    366 -
    367                $record->set($this->keyColumn, $key); -
    368            } -
    369 -
    370            return $record; -
    371        } -
    372 -
    373        return $this->data[$key]; -
    374    } -
    375 -
    376    /** -
    377     * @return array                an array containing all primary keys -
    378     */ -
    379    public function getPrimaryKeys() -
    380    { -
    381        $list = array(); -
    382        $name = $this->_table->getIdentifier(); -
    383 -
    384        foreach ($this->data as $record) { -
    385            if (is_array($record) && isset($record[$name])) { -
    386                $list[] = $record[$name]; -
    387            } else { -
    388                $list[] = $record->getIncremented(); -
    389            } -
    390        } -
    391        return $list; -
    392    } -
    393 -
    394    /** -
    395     * returns all keys -
    396     * @return array -
    397     */ -
    398    public function getKeys() -
    399    { -
    400        return array_keys($this->data); -
    401    } -
    402 -
    403    /** -
    404     * count -
    405     * this class implements interface countable -
    406     * returns the number of records in this collection -
    407     * -
    408     * @return integer -
    409     */ -
    410    public function count() -
    411    { -
    412        return count($this->data); -
    413    } -
    414 -
    415    /** -
    416     * set -
    417     * @param integer $key -
    418     * @param Doctrine_Record $record -
    419     * @return void -
    420     */ -
    421    public function set($key, Doctrine_Record $record) -
    422    { -
    423        if (isset($this->referenceField)) { -
    424            $record->set($this->referenceField, $this->reference, false); -
    425        } -
    426 -
    427        $this->data[$key] = $record; -
    428    } -
    429 -
    430    /** -
    431     * adds a record to collection -
    432     * @param Doctrine_Record $record              record to be added -
    433     * @param string $key                          optional key for the record -
    434     * @return boolean -
    435     */ -
    436    public function add(Doctrine_Record $record, $key = null) -
    437    { -
    438        if (isset($this->referenceField)) { -
    439            $value = $this->reference->get($this->relation->getLocal()); -
    440 -
    441            if ($value !== null) { -
    442                $record->set($this->referenceField, $value, false); -
    443            } else { -
    444                $record->set($this->referenceField, $this->reference, false); -
    445            } -
    446        } -
    447        /** -
    448         * for some weird reason in_array cannot be used here (php bug ?) -
    449         * -
    450         * if used it results in fatal error : [ nesting level too deep ] -
    451         */ -
    452        foreach ($this->data as $val) { -
    453            if ($val === $record) { -
    454                return false; -
    455            } -
    456        } -
    457 -
    458        if (isset($key)) { -
    459            if (isset($this->data[$key])) { -
    460                return false; -
    461            } -
    462            $this->data[$key] = $record; -
    463            return true; -
    464        } -
    465 -
    466        if (isset($this->keyColumn)) { -
    467            $value = $record->get($this->keyColumn); -
    468            if ($value === null) { -
    469                throw new Doctrine_Collection_Exception("Couldn't create collection index. Record field '".$this->keyColumn."' was null."); -
    470            } -
    471            $this->data[$value] = $record; -
    472        } else { -
    473            $this->data[] = $record; -
    474        } -
    475        return true; -
    476    } -
    477 -
    478    /** -
    479     * loadRelated -
    480     * -
    481     * @param mixed $name -
    482     * @return boolean -
    483     */ -
    484    public function loadRelated($name = null) -
    485    { -
    486        $list = array(); -
    487        $query   = new Doctrine_Query($this->_table->getConnection()); -
    488 -
    489        if ( ! isset($name)) { -
    490            foreach ($this->data as $record) { -
    491                $value = $record->getIncremented(); -
    492                if ($value !== null) { -
    493                    $list[] = $value; -
    494                } -
    495            } -
    496            $query->from($this->_table->getComponentName() . '(' . implode(", ",$this->_table->getPrimaryKeys()) . ')'); -
    497            $query->where($this->_table->getComponentName() . '.id IN (' . substr(str_repeat("?, ", count($list)),0,-2) . ')'); -
    498 -
    499            return $query; -
    500        } -
    501 -
    502        $rel     = $this->_table->getRelation($name); -
    503 -
    504        if ($rel instanceof Doctrine_Relation_LocalKey || $rel instanceof Doctrine_Relation_ForeignKey) { -
    505            foreach ($this->data as $record) { -
    506                $list[] = $record[$rel->getLocal()]; -
    507            } -
    508        } else { -
    509            foreach ($this->data as $record) { -
    510                $value = $record->getIncremented(); -
    511                if ($value !== null) { -
    512                    $list[] = $value; -
    513                } -
    514            } -
    515        } -
    516 -
    517        $dql     = $rel->getRelationDql(count($list), 'collection'); -
    518 -
    519        $coll    = $query->query($dql, $list); -
    520 -
    521        $this->populateRelated($name, $coll); -
    522    } -
    523 -
    524    /** -
    525     * populateRelated -
    526     * -
    527     * @param string $name -
    528     * @param Doctrine_Collection $coll -
    529     * @return void -
    530     */ -
    531    public function populateRelated($name, Doctrine_Collection $coll) -
    532    { -
    533        $rel     = $this->_table->getRelation($name); -
    534        $table   = $rel->getTable(); -
    535        $foreign = $rel->getForeign(); -
    536        $local   = $rel->getLocal(); -
    537 -
    538        if ($rel instanceof Doctrine_Relation_LocalKey) { -
    539            foreach ($this->data as $key => $record) { -
    540                foreach ($coll as $k => $related) { -
    541                    if ($related[$foreign] == $record[$local]) { -
    542                        $this->data[$key]->setRelated($name, $related); -
    543                    } -
    544                } -
    545            } -
    546        } elseif ($rel instanceof Doctrine_Relation_ForeignKey) { -
    547            foreach ($this->data as $key => $record) { -
    548                if ( ! $record->exists()) { -
    549                    continue; -
    550                } -
    551                $sub = new Doctrine_Collection($table); -
    552 -
    553                foreach ($coll as $k => $related) { -
    554                    if ($related[$foreign] == $record[$local]) { -
    555                        $sub->add($related); -
    556                        $coll->remove($k); -
    557                    } -
    558                } -
    559 -
    560                $this->data[$key]->setRelated($name, $sub); -
    561            } -
    562        } elseif ($rel instanceof Doctrine_Relation_Association) { -
    563            $identifier = $this->_table->getIdentifier(); -
    564            $asf        = $rel->getAssociationFactory(); -
    565            $name       = $table->getComponentName(); -
    566 -
    567            foreach ($this->data as $key => $record) { -
    568                if ( ! $record->exists()) { -
    569                    continue; -
    570                } -
    571                $sub = new Doctrine_Collection($table); -
    572                foreach ($coll as $k => $related) { -
    573                    if ($related->get($local) == $record[$identifier]) { -
    574                        $sub->add($related->get($name)); -
    575                    } -
    576                } -
    577                $this->data[$key]->setRelated($name, $sub); -
    578 -
    579            } -
    580        } -
    581    } -
    582 -
    583    /** -
    584     * getNormalIterator -
    585     * returns normal iterator - an iterator that will not expand this collection -
    586     * -
    587     * @return Doctrine_Iterator_Normal -
    588     */ -
    589    public function getNormalIterator() -
    590    { -
    591        return new Doctrine_Collection_Iterator_Normal($this); -
    592    } -
    593 -
    594    /** -
    595     * takeSnapshot -
    596     * takes a snapshot from this collection -
    597     * -
    598     * snapshots are used for diff processing, for example -
    599     * when a fetched collection has three elements, then two of those -
    600     * are being removed the diff would contain one element -
    601     * -
    602     * Doctrine_Collection::save() attaches the diff with the help of last -
    603     * snapshot. -
    604     * -
    605     * @return Doctrine_Collection -
    606     */ -
    607    public function takeSnapshot() -
    608    { -
    609        $this->_snapshot = $this->data; -
    610         -
    611        return $this; -
    612    } -
    613 -
    614    /** -
    615     * getSnapshot -
    616     * returns the data of the last snapshot -
    617     * -
    618     * @return array    returns the data in last snapshot -
    619     */ -
    620    public function getSnapshot() -
    621    { -
    622        return $this->_snapshot; -
    623    } -
    624 -
    625    /** -
    626     * processDiff -
    627     * processes the difference of the last snapshot and the current data -
    628     * -
    629     * an example: -
    630     * Snapshot with the objects 1, 2 and 4 -
    631     * Current data with objects 2, 3 and 5 -
    632     * -
    633     * The process would remove object 4 -
    634     * -
    635     * @return Doctrine_Collection -
    636     */ -
    637    public function processDiff()  -
    638    { -
    639        foreach (array_udiff($this->_snapshot, $this->data, array($this, "compareRecords")) as $record) { -
    640            $record->delete(); -
    641        } -
    642 -
    643        return $this; -
    644    } -
    645 -
    646    /** -
    647     * toArray -
    648     * Mimics the result of a $query->execute(array(), Doctrine::FETCH_ARRAY); -
    649     * -
    650     * @param boolean $deep -
    651     */ -
    652    public function toArray($deep = false, $prefixKey = false) -
    653    { -
    654        $data = array(); -
    655        foreach ($this as $key => $record) { -
    656             -
    657            $key = $prefixKey ? get_class($record) . '_' .$key:$key; -
    658             -
    659            $data[$key] = $record->toArray($deep, $prefixKey); -
    660        } -
    661         -
    662        return $data; -
    663    } -
    664 -
    665    /** -
    666     * fromArray -
    667     * -
    668     * Populate a Doctrine_Collection from an array of data -
    669     * -
    670     * @param string $array  -
    671     * @return void -
    672     */ -
    673     -
    674    public function fromArray($array) -
    675    { -
    676        $data = array(); -
    677        foreach ($array as $rowKey => $row) { -
    678            $this[$rowKey]->fromArray($row); -
    679        } -
    680    } -
    681 -
    682    /** -
    683     * exportTo -
    684     * -
    685     * Export a Doctrine_Collection to one of the supported Doctrine_Parser formats -
    686     * -
    687     * @param string $type  -
    688     * @param string $deep  -
    689     * @return void -
    690     */ -
    691    public function exportTo($type, $deep = false) -
    692    { -
    693        if ($type == 'array') { -
    694            return $this->toArray($deep); -
    695        } else { -
    696            return Doctrine_Parser::dump($this->toArray($deep, true), $type); -
    697        } -
    698    } -
    699 -
    700    /** -
    701     * importFrom -
    702     * -
    703     * Import data to a Doctrine_Collection from one of the supported Doctrine_Parser formats -
    704     * -
    705     * @param string $type  -
    706     * @param string $data  -
    707     * @return void -
    708     */ -
    709    public function importFrom($type, $data) -
    710    { -
    711        if ($type == 'array') { -
    712            return $this->fromArray($data); -
    713        } else { -
    714            return $this->fromArray(Doctrine_Parser::load($data, $type)); -
    715        } -
    716    } -
    717 -
    718    /** -
    719     * getDeleteDiff -
    720     * -
    721     * @return void -
    722     */ -
    723    public function getDeleteDiff() -
    724    { -
    725        return array_udiff($this->_snapshot, $this->data, array($this, "compareRecords")); -
    726    } -
    727 -
    728    /** -
    729     * getInsertDiff -
    730     * -
    731     * @return void -
    732     */ -
    733    public function getInsertDiff() -
    734    { -
    735        return array_udiff($this->data, $this->_snapshot, array($this, "compareRecords")); -
    736    } -
    737 -
    738    /** -
    739     * compareRecords -
    740     * Compares two records. To be used on _snapshot diffs using array_udiff -
    741     */ -
    742    protected function compareRecords($a, $b) -
    743    { -
    744        if ($a->getOid() == $b->getOid()) { -
    745            return 0; -
    746        } -
    747         -
    748        return ($a->getOid() > $b->getOid()) ? 1 : -1; -
    749    } -
    750 -
    751    /** -
    752     * save -
    753     * saves all records of this collection and processes the  -
    754     * difference of the last snapshot and the current data -
    755     * -
    756     * @param Doctrine_Connection $conn     optional connection parameter -
    757     * @return Doctrine_Collection -
    758     */ -
    759    public function save(Doctrine_Connection $conn = null) -
    760    { -
    761        if ($conn == null) { -
    762            $conn = $this->_table->getConnection(); -
    763        } -
    764         -
    765        $conn->beginTransaction(); -
    766 -
    767        $conn->transaction->addCollection($this); -
    768 -
    769        $this->processDiff(); -
    770 -
    771        foreach ($this->getData() as $key => $record) { -
    772            $record->save($conn); -
    773        } -
    774 -
    775        $conn->commit(); -
    776 -
    777        return $this; -
    778    } -
    779 -
    780    /** -
    781     * delete -
    782     * single shot delete -
    783     * deletes all records from this collection -
    784     * and uses only one database query to perform this operation -
    785     * -
    786     * @return Doctrine_Collection -
    787     */ -
    788    public function delete(Doctrine_Connection $conn = null) -
    789    { -
    790        if ($conn == null) { -
    791            $conn = $this->_table->getConnection(); -
    792        } -
    793 -
    794        $conn->beginTransaction(); -
    795        $conn->transaction->addCollection($this); -
    796 -
    797        foreach ($this as $key => $record) { -
    798            $record->delete($conn); -
    799        } -
    800 -
    801        $conn->commit(); -
    802 -
    803        $this->data = array(); -
    804         -
    805        return $this; -
    806    } -
    807 -
    808    /** -
    809     * getIterator -
    810     * @return object ArrayIterator -
    811     */ -
    812    public function getIterator() -
    813    { -
    814        $data = $this->data; -
    815        return new ArrayIterator($data); -
    816    } -
    817 -
    818    /** -
    819     * returns a string representation of this object -
    820     */ -
    821    public function __toString() -
    822    { -
    823        return Doctrine_Lib::getCollectionAsString($this); -
    824    } -
    825     -
    826    /** -
    827     * returns the relation object -
    828     * @return object Doctrine_Relation -
    829     */ -
    830    public function getRelation() -
    831    { -
    832        return $this->relation; -
    833    } -
    834} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Configurable.html b/tests_old/coverage/Doctrine_Configurable.html deleted file mode 100644 index 152fef3ad..000000000 --- a/tests_old/coverage/Doctrine_Configurable.html +++ /dev/null @@ -1,1251 +0,0 @@ - - - Coverage for Doctrine_Configurable - - -

    Coverage for Doctrine_Configurable

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Configurable.php 3223 2007-11-25 19:07:30Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Configurable -
    24 * the base for Doctrine_Table, Doctrine_Manager and Doctrine_Connection -
    25 * -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Configurable -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3223 $ -
    33 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    34 */ -
    35abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable -
    36{ -
    37    /** -
    38     * @var array $attributes               an array of containing all attributes -
    39     */ -
    40    protected $attributes = array(); -
    41 -
    42    /** -
    43     * @var Doctrine_Configurable $parent   the parent of this component -
    44     */ -
    45    protected $parent; -
    46 -
    47    /** -
    48     * @var array $_impl                    an array containing concrete implementations for class templates -
    49     *                                      keys as template names and values as names of the concrete -
    50     *                                      implementation classes -
    51     */ -
    52    protected $_impl = array(); -
    53     -
    54    /** -
    55     * @var array $_params                  an array of user defined parameters -
    56     */ -
    57    protected $_params = array(); -
    58 -
    59    /** -
    60     * setAttribute -
    61     * sets a given attribute -
    62     * -
    63     * <code> -
    64     * $manager->setAttribute(Doctrine::ATTR_PORTABILITY, Doctrine::PORTABILITY_ALL); -
    65     * -
    66     * // or -
    67     * -
    68     * $manager->setAttribute('portability', Doctrine::PORTABILITY_ALL); -
    69     * </code> -
    70     * -
    71     * @param mixed $attribute              either a Doctrine::ATTR_* integer constant or a string -
    72     *                                      corresponding to a constant -
    73     * @param mixed $value                  the value of the attribute -
    74     * @see Doctrine::ATTR_* constants -
    75     * @throws Doctrine_Exception           if the value is invalid -
    76     * @return void -
    77     */ -
    78    public function setAttribute($attribute,$value) -
    79    { -
    80        if (is_string($attribute)) { -
    81            $upper = strtoupper($attribute); -
    82 -
    83            $const = 'Doctrine::ATTR_' . $attribute; -
    84            if (defined($const)) { -
    85                $this->_state = constant($const); -
    86            } else { -
    87                throw new Doctrine_Exception('Unknown attribute ' . $attribute); -
    88            } -
    89        } -
    90        switch ($attribute) { -
    91            case Doctrine::ATTR_FETCHMODE: -
    92                throw new Doctrine_Exception('Deprecated attribute. See http://doctrine.pengus.net/doctrine/manual/new/?chapter=configuration'); -
    93            case Doctrine::ATTR_LISTENER: -
    94                $this->setEventListener($value); -
    95                break; -
    96            case Doctrine::ATTR_COLL_KEY: -
    97                if ( ! ($this instanceof Doctrine_Table)) { -
    98                    throw new Doctrine_Exception("This attribute can only be set at table level."); -
    99                } -
    100                if ($value !== null && ! $this->hasColumn($value)) { -
    101                    throw new Doctrine_Exception("Couldn't set collection key attribute. No such column '$value'"); -
    102                } -
    103                break; -
    104            case Doctrine::ATTR_CACHE: -
    105            case Doctrine::ATTR_RESULT_CACHE: -
    106            case Doctrine::ATTR_QUERY_CACHE: -
    107                if ($value !== null) { -
    108                    if ( ! ($value instanceof Doctrine_Cache_Interface)) { -
    109                        throw new Doctrine_Exception('Cache driver should implement Doctrine_Cache_Interface'); -
    110                    } -
    111                } -
    112                break; -
    113            case Doctrine::ATTR_VALIDATE: -
    114            case Doctrine::ATTR_QUERY_LIMIT: -
    115            case Doctrine::ATTR_QUOTE_IDENTIFIER: -
    116            case Doctrine::ATTR_PORTABILITY: -
    117            case Doctrine::ATTR_DEFAULT_TABLE_TYPE: -
    118            case Doctrine::ATTR_EMULATE_DATABASE: -
    119            case Doctrine::ATTR_USE_NATIVE_ENUM: -
    120            case Doctrine::ATTR_DEFAULT_SEQUENCE: -
    121            case Doctrine::ATTR_EXPORT: -
    122            case Doctrine::ATTR_DECIMAL_PLACES: -
    123            case Doctrine::ATTR_LOAD_REFERENCES: -
    124            case Doctrine::ATTR_RECORD_LISTENER: -
    125            case Doctrine::ATTR_THROW_EXCEPTIONS: -
    126            case Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE: -
    127 -
    128                break; -
    129            case Doctrine::ATTR_SEQCOL_NAME: -
    130                if ( ! is_string($value)) { -
    131                    throw new Doctrine_Exception('Sequence column name attribute only accepts string values'); -
    132                } -
    133                break; -
    134            case Doctrine::ATTR_FIELD_CASE: -
    135                if ($value != 0 && $value != CASE_LOWER && $value != CASE_UPPER) -
    136                    throw new Doctrine_Exception('Field case attribute should be either 0, CASE_LOWER or CASE_UPPER constant.'); -
    137                break; -
    138            case Doctrine::ATTR_SEQNAME_FORMAT: -
    139            case Doctrine::ATTR_IDXNAME_FORMAT: -
    140            case Doctrine::ATTR_TBLNAME_FORMAT: -
    141                if ($this instanceof Doctrine_Table) { -
    142                    throw new Doctrine_Exception('Sequence / index name format attributes cannot be set' -
    143                                               . 'at table level (only at connection or global level).'); -
    144                } -
    145                break; -
    146            default: -
    147                throw new Doctrine_Exception("Unknown attribute."); -
    148        } -
    149 -
    150        $this->attributes[$attribute] = $value; -
    151 -
    152    } -
    153 -
    154    public function getParams($namespace = null) -
    155    { -
    156     if ($namespace == null) { -
    157         $namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE); -
    158     } -
    159     -
    160     if ( ! isset($this->_params[$namespace])) { -
    161         return null; -
    162     } -
    163 -
    164        return $this->_params[$namespace]; -
    165    } -
    166     -
    167    public function getParamNamespaces() -
    168    { -
    169        return array_keys($this->_params); -
    170    } -
    171 -
    172    public function setParam($name, $value, $namespace = null)  -
    173    { -
    174     if ($namespace == null) { -
    175         $namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE); -
    176     } -
    177     -
    178     $this->_params[$namespace][$name] = $value; -
    179     -
    180     return $this; -
    181    } -
    182     -
    183    public function getParam($name, $value, $namespace)  -
    184    { -
    185     if ($namespace == null) { -
    186         $namespace = $this->getAttribute(Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE); -
    187     } -
    188     -
    189        if ( ! isset($this->_params[$name])) { -
    190            if (isset($this->parent)) { -
    191                return $this->parent->getParam($name); -
    192            } -
    193            return null; -
    194        } -
    195        return $this->_params[$name]; -
    196    } -
    197    /** -
    198     * setImpl -
    199     * binds given class to given template name -
    200     * -
    201     * this method is the base of Doctrine dependency injection -
    202     * -
    203     * @param string $template      name of the class template -
    204     * @param string $class         name of the class to be bound -
    205     * @return Doctrine_Configurable    this object -
    206     */ -
    207    public function setImpl($template, $class) -
    208    { -
    209        $this->_impl[$template] = $class; -
    210 -
    211        return $this; -
    212    } -
    213 -
    214    /** -
    215     * getImpl -
    216     * returns the implementation for given class -
    217     * -
    218     * @return string   name of the concrete implementation -
    219     */ -
    220    public function getImpl($template) -
    221    { -
    222        if ( ! isset($this->_impl[$template])) { -
    223            if (isset($this->parent)) { -
    224                return $this->parent->getImpl($template); -
    225            } -
    226            return null; -
    227        } -
    228        return $this->_impl[$template]; -
    229    } -
    230     -
    231     -
    232    public function hasImpl($template) -
    233    { -
    234        if ( ! isset($this->_impl[$template])) { -
    235            if (isset($this->parent)) { -
    236                return $this->parent->hasImpl($template); -
    237            } -
    238            return false; -
    239        } -
    240        return true; -
    241    } -
    242 -
    243    /** -
    244     * @param Doctrine_EventListener $listener -
    245     * @return void -
    246     */ -
    247    public function setEventListener($listener) -
    248    { -
    249        return $this->setListener($listener); -
    250    } -
    251 -
    252    /** -
    253     * addRecordListener -
    254     * -
    255     * @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener -
    256     * @return mixed        this object -
    257     */ -
    258    public function addRecordListener($listener, $name = null) -
    259    { -
    260        if ( ! isset($this->attributes[Doctrine::ATTR_RECORD_LISTENER]) || -
    261             ! ($this->attributes[Doctrine::ATTR_RECORD_LISTENER] instanceof Doctrine_Record_Listener_Chain)) { -
    262 -
    263            $this->attributes[Doctrine::ATTR_RECORD_LISTENER] = new Doctrine_Record_Listener_Chain(); -
    264        } -
    265        $this->attributes[Doctrine::ATTR_RECORD_LISTENER]->add($listener, $name); -
    266 -
    267        return $this; -
    268    } -
    269 -
    270    /** -
    271     * getListener -
    272     * -
    273     * @return Doctrine_EventListener_Interface|Doctrine_Overloadable -
    274     */ -
    275    public function getRecordListener() -
    276    { -
    277        if ( ! isset($this->attributes[Doctrine::ATTR_RECORD_LISTENER])) { -
    278            if (isset($this->parent)) { -
    279                return $this->parent->getRecordListener(); -
    280            } -
    281            return null; -
    282        } -
    283        return $this->attributes[Doctrine::ATTR_RECORD_LISTENER]; -
    284    } -
    285 -
    286    /** -
    287     * setListener -
    288     * -
    289     * @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener -
    290     * @return Doctrine_Configurable        this object -
    291     */ -
    292    public function setRecordListener($listener) -
    293    { -
    294        if ( ! ($listener instanceof Doctrine_Record_Listener_Interface) -
    295            && ! ($listener instanceof Doctrine_Overloadable) -
    296        ) { -
    297            throw new Doctrine_Exception("Couldn't set eventlistener. Record listeners should implement either Doctrine_Record_Listener_Interface or Doctrine_Overloadable"); -
    298        } -
    299        $this->attributes[Doctrine::ATTR_RECORD_LISTENER] = $listener; -
    300 -
    301        return $this; -
    302    } -
    303 -
    304    /** -
    305     * addListener -
    306     * -
    307     * @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener -
    308     * @return mixed        this object -
    309     */ -
    310    public function addListener($listener, $name = null) -
    311    { -
    312        if ( ! isset($this->attributes[Doctrine::ATTR_LISTENER]) || -
    313             ! ($this->attributes[Doctrine::ATTR_LISTENER] instanceof Doctrine_EventListener_Chain)) { -
    314 -
    315            $this->attributes[Doctrine::ATTR_LISTENER] = new Doctrine_EventListener_Chain(); -
    316        } -
    317        $this->attributes[Doctrine::ATTR_LISTENER]->add($listener, $name); -
    318 -
    319        return $this; -
    320    } -
    321 -
    322    /** -
    323     * getListener -
    324     * -
    325     * @return Doctrine_EventListener_Interface|Doctrine_Overloadable -
    326     */ -
    327    public function getListener() -
    328    { -
    329        if ( ! isset($this->attributes[Doctrine::ATTR_LISTENER])) { -
    330            if (isset($this->parent)) { -
    331                return $this->parent->getListener(); -
    332            } -
    333            return null; -
    334        } -
    335        return $this->attributes[Doctrine::ATTR_LISTENER]; -
    336    } -
    337 -
    338    /** -
    339     * setListener -
    340     * -
    341     * @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener -
    342     * @return Doctrine_Configurable        this object -
    343     */ -
    344    public function setListener($listener) -
    345    { -
    346        if ( ! ($listener instanceof Doctrine_EventListener_Interface) -
    347            && ! ($listener instanceof Doctrine_Overloadable) -
    348        ) { -
    349            throw new Doctrine_EventListener_Exception("Couldn't set eventlistener. EventListeners should implement either Doctrine_EventListener_Interface or Doctrine_Overloadable"); -
    350        } -
    351        $this->attributes[Doctrine::ATTR_LISTENER] = $listener; -
    352 -
    353        return $this; -
    354    } -
    355 -
    356    /** -
    357     * returns the value of an attribute -
    358     * -
    359     * @param integer $attribute -
    360     * @return mixed -
    361     */ -
    362    public function getAttribute($attribute) -
    363    { -
    364        $attribute = (int) $attribute; -
    365 -
    366        if ($attribute < 0) { -
    367            throw new Doctrine_Exception('Unknown attribute.'); -
    368        } -
    369 -
    370        if (isset($this->attributes[$attribute])) { -
    371            return $this->attributes[$attribute]; -
    372        } -
    373         -
    374        if (isset($this->parent)) { -
    375            return $this->parent->getAttribute($attribute); -
    376        } -
    377        return null; -
    378    } -
    379 -
    380    /** -
    381     * getAttributes -
    382     * returns all attributes as an array -
    383     * -
    384     * @return array -
    385     */ -
    386    public function getAttributes() -
    387    { -
    388        return $this->attributes; -
    389    } -
    390 -
    391    /** -
    392     * sets a parent for this configurable component -
    393     * the parent must be configurable component itself -
    394     * -
    395     * @param Doctrine_Configurable $component -
    396     * @return void -
    397     */ -
    398    public function setParent(Doctrine_Configurable $component) -
    399    { -
    400        $this->parent = $component; -
    401    } -
    402 -
    403    /** -
    404     * getParent -
    405     * returns the parent of this component -
    406     * -
    407     * @return Doctrine_Configurable -
    408     */ -
    409    public function getParent() -
    410    { -
    411        return $this->parent; -
    412    } -
    413} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection.html b/tests_old/coverage/Doctrine_Connection.html deleted file mode 100644 index 0e0e19224..000000000 --- a/tests_old/coverage/Doctrine_Connection.html +++ /dev/null @@ -1,3978 +0,0 @@ - - - Coverage for Doctrine_Connection - - -

    Coverage for Doctrine_Connection

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Connection.php 3223 2007-11-25 19:07:30Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Configurable'); -
    22/** -
    23 * Doctrine_Connection -
    24 * -
    25 * A wrapper layer on top of PDO / Doctrine_Adapter -
    26 * -
    27 * Doctrine_Connection is the heart of any Doctrine based application. -
    28 * -
    29 * 1. Event listeners -
    30 *    An easy to use, pluggable eventlistener architecture. Aspects such as -
    31 *    logging, query profiling and caching can be easily implemented through -
    32 *    the use of these listeners -
    33 * -
    34 * 2. Lazy-connecting -
    35 *    Creating an instance of Doctrine_Connection does not connect -
    36 *    to database. Connecting to database is only invoked when actually needed -
    37 *    (for example when query() is being called)  -
    38 * -
    39 * 3. Convenience methods -
    40 *    Doctrine_Connection provides many convenience methods such as fetchAll(), fetchOne() etc. -
    41 * -
    42 * 4. Modular structure -
    43 *    Higher level functionality such as schema importing, exporting, sequence handling etc. -
    44 *    is divided into modules. For a full list of connection modules see  -
    45 *    Doctrine_Connection::$_modules -
    46 * -
    47 * @package     Doctrine -
    48 * @subpackage  Connection -
    49 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    50 * @link        www.phpdoctrine.org -
    51 * @since       1.0 -
    52 * @version     $Revision: 3223 $ -
    53 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    54 * @author      Lukas Smith <smith@pooteeweet.org> (MDB2 library) -
    55 */ -
    56abstract class Doctrine_Connection extends Doctrine_Configurable implements Countable, IteratorAggregate -
    57{ -
    58    /** -
    59     * @var $dbh                                the database handler -
    60     */ -
    61    protected $dbh; -
    62 -
    63    /** -
    64     * @var array $tables                       an array containing all the initialized Doctrine_Table objects -
    65     *                                          keys representing Doctrine_Table component names and values as Doctrine_Table objects -
    66     */ -
    67    protected $tables           = array(); -
    68 -
    69    /** -
    70     * @var string $driverName                  the name of this connection driver -
    71     */ -
    72    protected $driverName; -
    73 -
    74    /** -
    75     * @var boolean $isConnected                whether or not a connection has been established -
    76     */ -
    77    protected $isConnected      = false; -
    78 -
    79    /** -
    80     * @var array $supported                    an array containing all features this driver supports, -
    81     *                                          keys representing feature names and values as -
    82     *                                          one of the following (true, false, 'emulated') -
    83     */ -
    84    protected $supported        = array(); -
    85 -
    86    /** -
    87     * @var array $pendingAttributes            An array of pending attributes. When setting attributes -
    88     *                                          no connection is needed. When connected all the pending -
    89     *                                          attributes are passed to the underlying adapter (usually PDO) instance. -
    90     */ -
    91    protected $pendingAttributes  = array(); -
    92 -
    93    /** -
    94     * @var array $modules                      an array containing all modules -
    95     *              transaction                 Doctrine_Transaction driver, handles savepoint and transaction isolation abstraction -
    96     * -
    97     *              expression                  Doctrine_Expression driver, handles expression abstraction -
    98     * -
    99     *              dataDict                    Doctrine_DataDict driver, handles datatype abstraction -
    100     * -
    101     *              export                      Doctrine_Export driver, handles db structure modification abstraction (contains -
    102     *                                          methods such as alterTable, createConstraint etc.) -
    103     *              import                      Doctrine_Import driver, handles db schema reading -
    104     * -
    105     *              sequence                    Doctrine_Sequence driver, handles sequential id generation and retrieval -
    106     * -
    107     *              unitOfWork                  Doctrine_Connection_UnitOfWork handles many orm functionalities such as object -
    108     *                                          deletion and saving -
    109     * -
    110     *              formatter                   Doctrine_Formatter handles data formatting, quoting and escaping -
    111     * -
    112     * @see Doctrine_Connection::__get() -
    113     * @see Doctrine_DataDict -
    114     * @see Doctrine_Expression -
    115     * @see Doctrine_Export -
    116     * @see Doctrine_Transaction -
    117     * @see Doctrine_Sequence -
    118     * @see Doctrine_Connection_UnitOfWork -
    119     * @see Doctrine_Formatter -
    120     */ -
    121    private $modules = array('transaction' => false, -
    122                             'expression'  => false, -
    123                             'dataDict'    => false, -
    124                             'export'      => false, -
    125                             'import'      => false, -
    126                             'sequence'    => false, -
    127                             'unitOfWork'  => false, -
    128                             'formatter'   => false, -
    129                             'util'        => false, -
    130                             ); -
    131 -
    132    /** -
    133     * @var array $properties               an array of connection properties -
    134     */ -
    135    protected $properties = array('sql_comments'        => array(array('start' => '--', 'end' => "\n", 'escape' => false), -
    136                                                                 array('start' => '/*', 'end' => '*/', 'escape' => false)), -
    137                                  'identifier_quoting'  => array('start' => '"', 'end' => '"','escape' => '"'), -
    138                                  'string_quoting'      => array('start' => "'", -
    139                                                                 'end' => "'", -
    140                                                                 'escape' => false, -
    141                                                                 'escape_pattern' => false), -
    142                                  'wildcards'           => array('%', '_'), -
    143                                  'varchar_max_length'  => 255, -
    144                                  ); -
    145 -
    146    /** -
    147     * @var array $serverInfo -
    148     */ -
    149    protected $serverInfo = array(); -
    150     -
    151    protected $options    = array(); -
    152 -
    153    /** -
    154     * @var array $availableDrivers         an array containing all available drivers -
    155     */ -
    156    private static $availableDrivers    = array( -
    157                                        'Mysql', -
    158                                        'Pgsql', -
    159                                        'Oracle', -
    160                                        'Informix', -
    161                                        'Mssql', -
    162                                        'Sqlite', -
    163                                        'Firebird' -
    164                                        ); -
    165    protected $_count = 0; -
    166 -
    167    /** -
    168     * the constructor -
    169     * -
    170     * @param Doctrine_Manager $manager                 the manager object -
    171     * @param PDO|Doctrine_Adapter_Interface $adapter   database driver -
    172     */ -
    173    public function __construct(Doctrine_Manager $manager, $adapter, $user = null, $pass = null) -
    174    { -
    175        if (is_object($adapter)) { -
    176            if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) { -
    177                throw new Doctrine_Connection_Exception('First argument should be an instance of PDO or implement Doctrine_Adapter_Interface'); -
    178            } -
    179            $this->dbh = $adapter; -
    180 -
    181            $this->isConnected = true; -
    182 -
    183        } else if (is_array($adapter)) { -
    184            $this->pendingAttributes[Doctrine::ATTR_DRIVER_NAME] = $adapter['scheme']; -
    185 -
    186            $this->options['dsn']      = $adapter['dsn']; -
    187            $this->options['username'] = $adapter['user']; -
    188            $this->options['password'] = $adapter['pass']; -
    189             -
    190            $this->options['other'] = array();   -
    191            if (isset($adapter['other'])) { -
    192                $this->options['other'] = array(Doctrine::ATTR_PERSISTENT => $adapter['persistent']); -
    193            } -
    194 -
    195        } -
    196 -
    197        $this->setParent($manager); -
    198 -
    199        $this->setAttribute(Doctrine::ATTR_CASE, Doctrine::CASE_NATURAL); -
    200        $this->setAttribute(Doctrine::ATTR_ERRMODE, Doctrine::ERRMODE_EXCEPTION); -
    201 -
    202        $this->getAttribute(Doctrine::ATTR_LISTENER)->onOpen($this); -
    203    } -
    204 -
    205    /** -
    206     * getOption -
    207     *  -
    208     * Retrieves option -
    209     * -
    210     * @param string $option  -
    211     * @return void -
    212     */ -
    213    public function getOption($option) -
    214    { -
    215        if (isset($this->options[$option])) { -
    216            return $this->options[$option]; -
    217        } -
    218    } -
    219 -
    220    /** -
    221     * getAttribute -
    222     * retrieves a database connection attribute -
    223     * -
    224     * @param integer $attribute -
    225     * @return mixed -
    226     */ -
    227    public function getAttribute($attribute) -
    228    { -
    229 -
    230        if ($attribute >= 100) { -
    231            if ( ! isset($this->attributes[$attribute])) { -
    232                return parent::getAttribute($attribute); -
    233            } -
    234            return $this->attributes[$attribute]; -
    235        } -
    236 -
    237        if ($this->isConnected) { -
    238            try { -
    239                return $this->dbh->getAttribute($attribute); -
    240            } catch(Exception $e) { -
    241                throw new Doctrine_Connection_Exception('Attribute ' . $attribute . ' not found.'); -
    242            } -
    243        } else { -
    244            if ( ! isset($this->pendingAttributes[$attribute])) { -
    245                $this->connect(); -
    246                $this->getAttribute($attribute); -
    247            } -
    248 -
    249            return $this->pendingAttributes[$attribute]; -
    250        } -
    251    } -
    252 -
    253    /** -
    254     * returns an array of available PDO drivers -
    255     */ -
    256    public static function getAvailableDrivers() -
    257    { -
    258        return PDO::getAvailableDrivers(); -
    259    } -
    260 -
    261    /** -
    262     * setAttribute -
    263     * sets an attribute -
    264     * -
    265     * @todo why check for >= 100? has this any special meaning when creating  -
    266     * attributes? -
    267     * -
    268     * @param integer $attribute -
    269     * @param mixed $value -
    270     * @return boolean -
    271     */ -
    272    public function setAttribute($attribute, $value) -
    273    { -
    274        if ($attribute >= 100) { -
    275            parent::setAttribute($attribute, $value); -
    276        } else { -
    277            if ($this->isConnected) { -
    278                $this->dbh->setAttribute($attribute, $value); -
    279            } else { -
    280                $this->pendingAttributes[$attribute] = $value; -
    281            } -
    282        } -
    283        return $this; -
    284    } -
    285 -
    286    /** -
    287     * getName -
    288     * returns the name of this driver -
    289     * -
    290     * @return string           the name of this driver -
    291     */ -
    292    public function getName() -
    293    { -
    294        return $this->driverName; -
    295    } -
    296 -
    297    /** -
    298     * __get -
    299     * lazy loads given module and returns it -
    300     * -
    301     * @see Doctrine_DataDict -
    302     * @see Doctrine_Expression -
    303     * @see Doctrine_Export -
    304     * @see Doctrine_Transaction -
    305     * @see Doctrine_Connection::$modules       all availible modules -
    306     * @param string $name                      the name of the module to get -
    307     * @throws Doctrine_Connection_Exception    if trying to get an unknown module -
    308     * @return Doctrine_Connection_Module       connection module -
    309     */ -
    310    public function __get($name) -
    311    { -
    312        if (isset($this->properties[$name])) { -
    313            return $this->properties[$name]; -
    314        } -
    315 -
    316        if ( ! isset($this->modules[$name])) { -
    317            throw new Doctrine_Connection_Exception('Unknown module / property ' . $name); -
    318        } -
    319        if ($this->modules[$name] === false) { -
    320            switch ($name) { -
    321                case 'unitOfWork': -
    322                    $this->modules[$name] = new Doctrine_Connection_UnitOfWork($this); -
    323                    break; -
    324                case 'formatter': -
    325                    $this->modules[$name] = new Doctrine_Formatter($this); -
    326                    break; -
    327                default: -
    328                    $class = 'Doctrine_' . ucwords($name) . '_' . $this->getName(); -
    329                    $this->modules[$name] = new $class($this); -
    330                } -
    331        } -
    332 -
    333        return $this->modules[$name]; -
    334    } -
    335 -
    336    /** -
    337     * returns the manager that created this connection -
    338     * -
    339     * @return Doctrine_Manager -
    340     */ -
    341    public function getManager() -
    342    { -
    343        return $this->getParent(); -
    344    } -
    345 -
    346    /** -
    347     * returns the database handler of which this connection uses -
    348     * -
    349     * @return PDO              the database handler -
    350     */ -
    351    public function getDbh() -
    352    { -
    353        $this->connect(); -
    354         -
    355        return $this->dbh; -
    356    } -
    357 -
    358    /** -
    359     * connect -
    360     * connects into database -
    361     * -
    362     * @return boolean -
    363     */ -
    364    public function connect() -
    365    { -
    366 -
    367        if ($this->isConnected) { -
    368            return false; -
    369        } -
    370 -
    371        $event = new Doctrine_Event($this, Doctrine_Event::CONN_CONNECT); -
    372 -
    373        $this->getListener()->preConnect($event); -
    374 -
    375        $e     = explode(':', $this->options['dsn']); -
    376        $found = false; -
    377         -
    378        if (extension_loaded('pdo')) { -
    379            if (in_array($e[0], PDO::getAvailableDrivers())) { -
    380                $this->dbh = new PDO($this->options['dsn'], $this->options['username'],  -
    381                                     $this->options['password'], $this->options['other']); -
    382                                      -
    383                $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -
    384                $found = true; -
    385            } -
    386        } -
    387 -
    388        if ( ! $found) { -
    389            $class = 'Doctrine_Adapter_' . ucwords($e[0]); -
    390 -
    391            if (class_exists($class)) { -
    392                $this->dbh = new $class($this->options['dsn'], $this->options['username'], $this->options['password']); -
    393            } else { -
    394                throw new Doctrine_Connection_Exception("Couldn't locate driver named " . $e[0]);           -
    395            } -
    396        } -
    397 -
    398        // attach the pending attributes to adapter -
    399        foreach($this->pendingAttributes as $attr => $value) { -
    400            // some drivers don't support setting this so we just skip it -
    401            if ($attr == Doctrine::ATTR_DRIVER_NAME) { -
    402                continue; -
    403            } -
    404            $this->dbh->setAttribute($attr, $value); -
    405        } -
    406 -
    407        $this->isConnected = true; -
    408 -
    409        $this->getListener()->postConnect($event); -
    410        return true; -
    411    } -
    412     -
    413    public function incrementQueryCount()  -
    414    { -
    415        $this->_count++; -
    416    } -
    417 -
    418    /** -
    419     * converts given driver name -
    420     * -
    421     * @param -
    422     */ -
    423    public function driverName($name) -
    424    { -
    425    } -
    426 -
    427    /** -
    428     * supports -
    429     * -
    430     * @param string $feature   the name of the feature -
    431     * @return boolean          whether or not this drivers supports given feature -
    432     */ -
    433    public function supports($feature) -
    434    { -
    435        return (isset($this->supported[$feature]) -
    436                  && ($this->supported[$feature] === 'emulated' -
    437                   || $this->supported[$feature])); -
    438    } -
    439 -
    440    /** -
    441     * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT -
    442     * query, except that if there is already a row in the table with the same -
    443     * key field values, the REPLACE query just updates its values instead of -
    444     * inserting a new row. -
    445     * -
    446     * The REPLACE type of query does not make part of the SQL standards. Since -
    447     * practically only MySQL and SQLIte implement it natively, this type of -
    448     * query isemulated through this method for other DBMS using standard types -
    449     * of queries inside a transaction to assure the atomicity of the operation. -
    450     * -
    451     * @param                   string  name of the table on which the REPLACE query will -
    452     *                          be executed. -
    453     * -
    454     * @param   array           an associative array that describes the fields and the -
    455     *                          values that will be inserted or updated in the specified table. The -
    456     *                          indexes of the array are the names of all the fields of the table. -
    457     * -
    458     *                          The values of the array are values to be assigned to the specified field. -
    459     * -
    460     * @param array $keys       an array containing all key fields (primary key fields -
    461     *                          or unique index fields) for this table -
    462     * -
    463     *                          the uniqueness of a row will be determined according to -
    464     *                          the provided key fields -
    465     * -
    466     *                          this method will fail if no key fields are specified -
    467     * -
    468     * @throws Doctrine_Connection_Exception        if this driver doesn't support replace -
    469     * @throws Doctrine_Connection_Exception        if some of the key values was null -
    470     * @throws Doctrine_Connection_Exception        if there were no key fields -
    471     * @throws PDOException                         if something fails at PDO level -
    472     * @ return integer                              number of rows affected -
    473     */ -
    474    public function replace(Doctrine_Table $table, array $fields, array $keys) -
    475    { -
    476        if (empty($keys)) { -
    477            throw new Doctrine_Connection_Exception('Not specified which fields are keys'); -
    478        } -
    479        $condition = $values = array(); -
    480 -
    481        foreach ($fields as $fieldName => $value) { -
    482            $values[$fieldName] = $value; -
    483 -
    484            if (in_array($fieldName, $keys)) { -
    485                if ($value === null) -
    486                    throw new Doctrine_Connection_Exception('key value '.$fieldName.' may not be null'); -
    487 -
    488                $condition[] = $table->getColumnName($fieldName) . ' = ?'; -
    489                $conditionValues[] = $value; -
    490            } -
    491        } -
    492 -
    493        $query = 'DELETE FROM ' . $this->quoteIdentifier($table->getTableName()) -
    494                . ' WHERE ' . implode(' AND ', $condition); -
    495        $affectedRows = $this->exec($query, $conditionValues); -
    496 -
    497        $this->insert($table, $values); -
    498 -
    499        $affectedRows++; -
    500 -
    501        return $affectedRows; -
    502    } -
    503 -
    504    /** -
    505     * deletes table row(s) matching the specified identifier -
    506     * -
    507     * @throws Doctrine_Connection_Exception    if something went wrong at the database level -
    508     * @param string $table         The table to delete data from -
    509     * @param array $identifier     An associateve array containing identifier column-value pairs. -
    510     * @return integer              The number of affected rows -
    511     */ -
    512    public function delete(Doctrine_Table $table, array $identifier) -
    513    { -
    514        $tmp = array(); -
    515 -
    516        foreach (array_keys($identifier) as $id) { -
    517            $tmp[] = $table->getColumnName($id) . ' = ?'; -
    518        } -
    519 -
    520        $query = 'DELETE FROM ' -
    521               . $this->quoteIdentifier($table->getTableName()) -
    522               . ' WHERE ' . implode(' AND ', $tmp); -
    523 -
    524 -
    525        return $this->exec($query, array_values($identifier)); -
    526    } -
    527 -
    528    /** -
    529     * Updates table row(s) with specified data -
    530     * -
    531     * @throws Doctrine_Connection_Exception    if something went wrong at the database level -
    532     * @param string $table     The table to insert data into -
    533     * @param array $values     An associateve array containing column-value pairs. -
    534     * @return mixed            boolean false if empty value array was given, -
    535     *                          otherwise returns the number of affected rows -
    536     */ -
    537    public function update(Doctrine_Table $table, array $fields, array $identifier) -
    538    { -
    539        if (empty($fields)) { -
    540            return false; -
    541        } -
    542 -
    543        $set = array(); -
    544        foreach ($fields as $fieldName => $value) { -
    545            if ($value instanceof Doctrine_Expression) { -
    546                $set[] = $table->getColumnName($fieldName) . ' = ' . $value->getSql(); -
    547                unset($values[$name]); -
    548            } else { -
    549                $set[] = $table->getColumnName($fieldName) . ' = ?'; -
    550            } -
    551        } -
    552 -
    553        $params = array_merge(array_values($fields), array_values($identifier)); -
    554 -
    555        $sql  = 'UPDATE ' . $this->quoteIdentifier($table->getTableName()) -
    556              . ' SET ' . implode(', ', $set) -
    557              . ' WHERE ' . implode(' = ? AND ', $table->getIdentifierColumnNames()) -
    558              . ' = ?'; -
    559 -
    560        return $this->exec($sql, $params); -
    561    } -
    562 -
    563    /** -
    564     * Inserts a table row with specified data. -
    565     * -
    566     * @param string $table     The table to insert data into. -
    567     * @param array $values     An associateve array containing column-value pairs. -
    568     * @return mixed            boolean false if empty value array was given, -
    569     *                          otherwise returns the number of affected rows -
    570     */ -
    571    public function insert(Doctrine_Table $table, array $fields) { -
    572        if (empty($fields)) { -
    573            return false; -
    574        } -
    575 -
    576        $tableName = $table->getTableName(); -
    577 -
    578        // column names are specified as array keys -
    579        $cols = array(); -
    580        // the query VALUES will contain either expresions (eg 'NOW()') or ? -
    581        $a = array(); -
    582        foreach ($fields as $fieldName => $value) { -
    583            $cols[] = $this->quoteIdentifier($table->getColumnName($fieldName)); -
    584            if ($value instanceof Doctrine_Expression) { -
    585                $a[] = $value->getSql(); -
    586                unset($fields[$fieldName]); -
    587            } else { -
    588                $a[] = '?'; -
    589            } -
    590        } -
    591 -
    592        // build the statement -
    593        $query = 'INSERT INTO ' . $this->quoteIdentifier($tableName)  -
    594               . ' (' . implode(', ', $cols) . ') ' -
    595               . 'VALUES ('; -
    596 -
    597        $query .= implode(', ', $a) . ')'; -
    598        // prepare and execute the statement -
    599 -
    600        return $this->exec($query, array_values($fields)); -
    601    } -
    602 -
    603    /** -
    604     * Set the charset on the current connection -
    605     * -
    606     * @param string    charset -
    607     */ -
    608    public function setCharset($charset) -
    609    { -
    610 -
    611    } -
    612 -
    613    /** -
    614     * Quote a string so it can be safely used as a table or column name -
    615     * -
    616     * Delimiting style depends on which database driver is being used. -
    617     * -
    618     * NOTE: just because you CAN use delimited identifiers doesn't mean -
    619     * you SHOULD use them.  In general, they end up causing way more -
    620     * problems than they solve. -
    621     * -
    622     * Portability is broken by using the following characters inside -
    623     * delimited identifiers: -
    624     *   + backtick (<kbd>`</kbd>) -- due to MySQL -
    625     *   + double quote (<kbd>"</kbd>) -- due to Oracle -
    626     *   + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access -
    627     * -
    628     * Delimited identifiers are known to generally work correctly under -
    629     * the following drivers: -
    630     *   + mssql -
    631     *   + mysql -
    632     *   + mysqli -
    633     *   + oci8 -
    634     *   + pgsql -
    635     *   + sqlite -
    636     * -
    637     * InterBase doesn't seem to be able to use delimited identifiers -
    638     * via PHP 4.  They work fine under PHP 5. -
    639     * -
    640     * @param string $str           identifier name to be quoted -
    641     * @param bool $checkOption     check the 'quote_identifier' option -
    642     * -
    643     * @return string               quoted identifier string -
    644     */ -
    645    public function quoteIdentifier($str, $checkOption = true) -
    646    { -
    647        // quick fix for the identifiers that contain a dot -
    648        if (strpos($str, '.')) { -
    649            $e = explode('.', $str); -
    650             -
    651            return $this->formatter->quoteIdentifier($e[0], $checkOption) . '.'  -
    652                 . $this->formatter->quoteIdentifier($e[1], $checkOption); -
    653        } -
    654        return $this->formatter->quoteIdentifier($str, $checkOption); -
    655    } -
    656 -
    657    /** -
    658     * convertBooleans -
    659     * some drivers need the boolean values to be converted into integers -
    660     * when using DQL API -
    661     * -
    662     * This method takes care of that conversion -
    663     * -
    664     * @param array $item -
    665     * @return void -
    666     */ -
    667    public function convertBooleans($item) -
    668    { -
    669        return $this->formatter->convertBooleans($item); -
    670    } -
    671 -
    672    /** -
    673     * quote -
    674     * quotes given input parameter -
    675     * -
    676     * @param mixed $input      parameter to be quoted -
    677     * @param string $type -
    678     * @return mixed -
    679     */ -
    680    public function quote($input, $type = null) -
    681    { -
    682        return $this->formatter->quote($input, $type); -
    683    } -
    684 -
    685    /** -
    686     * Set the date/time format for the current connection -
    687     * -
    688     * @param string    time format -
    689     * -
    690     * @return void -
    691     */ -
    692    public function setDateFormat($format = null) -
    693    { -
    694    } -
    695 -
    696    /** -
    697     * fetchAll -
    698     * -
    699     * @param string $statement         sql query to be executed -
    700     * @param array $params             prepared statement params -
    701     * @return array -
    702     */ -
    703    public function fetchAll($statement, array $params = array())  -
    704    { -
    705        return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_ASSOC); -
    706    } -
    707 -
    708    /** -
    709     * fetchOne -
    710     * -
    711     * @param string $statement         sql query to be executed -
    712     * @param array $params             prepared statement params -
    713     * @param int $colnum               0-indexed column number to retrieve -
    714     * @return mixed -
    715     */ -
    716    public function fetchOne($statement, array $params = array(), $colnum = 0)  -
    717    { -
    718        return $this->execute($statement, $params)->fetchColumn($colnum); -
    719    } -
    720 -
    721    /** -
    722     * fetchRow -
    723     * -
    724     * @param string $statement         sql query to be executed -
    725     * @param array $params             prepared statement params -
    726     * @return array -
    727     */ -
    728    public function fetchRow($statement, array $params = array())  -
    729    { -
    730        return $this->execute($statement, $params)->fetch(Doctrine::FETCH_ASSOC); -
    731    } -
    732 -
    733    /** -
    734     * fetchArray -
    735     * -
    736     * @param string $statement         sql query to be executed -
    737     * @param array $params             prepared statement params -
    738     * @return array -
    739     */ -
    740    public function fetchArray($statement, array $params = array())  -
    741    { -
    742        return $this->execute($statement, $params)->fetch(Doctrine::FETCH_NUM); -
    743    } -
    744 -
    745    /** -
    746     * fetchColumn -
    747     * -
    748     * @param string $statement         sql query to be executed -
    749     * @param array $params             prepared statement params -
    750     * @param int $colnum               0-indexed column number to retrieve -
    751     * @return array -
    752     */ -
    753    public function fetchColumn($statement, array $params = array(), $colnum = 0)  -
    754    { -
    755        return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_COLUMN, $colnum); -
    756    } -
    757 -
    758    /** -
    759     * fetchAssoc -
    760     * -
    761     * @param string $statement         sql query to be executed -
    762     * @param array $params             prepared statement params -
    763     * @return array -
    764     */ -
    765    public function fetchAssoc($statement, array $params = array())  -
    766    { -
    767        return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_ASSOC); -
    768    } -
    769 -
    770    /** -
    771     * fetchBoth -
    772     * -
    773     * @param string $statement         sql query to be executed -
    774     * @param array $params             prepared statement params -
    775     * @return array -
    776     */ -
    777    public function fetchBoth($statement, array $params = array())  -
    778    { -
    779        return $this->execute($statement, $params)->fetchAll(Doctrine::FETCH_BOTH); -
    780    } -
    781 -
    782    /** -
    783     * query -
    784     * queries the database using Doctrine Query Language -
    785     * returns a collection of Doctrine_Record objects -
    786     * -
    787     * <code> -
    788     * $users = $conn->query('SELECT u.* FROM User u'); -
    789     * -
    790     * $users = $conn->query('SELECT u.* FROM User u WHERE u.name LIKE ?', array('someone')); -
    791     * </code> -
    792     * -
    793     * @param string $query             DQL query -
    794     * @param array $params             query parameters -
    795     * @param int $hydrationMode        Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD -
    796     * @see Doctrine_Query -
    797     * @return Doctrine_Collection      Collection of Doctrine_Record objects -
    798     */ -
    799    public function query($query, array $params = array(), $hydrationMode = null) -
    800    { -
    801        $parser = new Doctrine_Query($this); -
    802 -
    803        return $parser->query($query, $params, $hydrationMode); -
    804    } -
    805 -
    806    /** -
    807     * prepare -
    808     * -
    809     * @param string $statement -
    810     */ -
    811    public function prepare($statement) -
    812    { -
    813        $this->connect(); -
    814 -
    815        try { -
    816            $event = new Doctrine_Event($this, Doctrine_Event::CONN_PREPARE, $statement); -
    817     -
    818            $this->getAttribute(Doctrine::ATTR_LISTENER)->prePrepare($event); -
    819 -
    820            $stmt = false; -
    821     -
    822            if ( ! $event->skipOperation) { -
    823                $stmt = $this->dbh->prepare($statement); -
    824            } -
    825     -
    826            $this->getAttribute(Doctrine::ATTR_LISTENER)->postPrepare($event); -
    827             -
    828            return new Doctrine_Connection_Statement($this, $stmt); -
    829        } catch(Doctrine_Adapter_Exception $e) { -
    830        } catch(PDOException $e) { } -
    831 -
    832        $this->rethrowException($e, $this); -
    833    } -
    834 -
    835    /** -
    836     * query -
    837     * queries the database using Doctrine Query Language and returns -
    838     * the first record found -
    839     * -
    840     * <code> -
    841     * $user = $conn->queryOne('SELECT u.* FROM User u WHERE u.id = ?', array(1)); -
    842     * -
    843     * $user = $conn->queryOne('SELECT u.* FROM User u WHERE u.name LIKE ? AND u.password = ?', -
    844     *         array('someone', 'password') -
    845     *         ); -
    846     * </code> -
    847     * -
    848     * @param string $query             DQL query -
    849     * @param array $params             query parameters -
    850     * @see Doctrine_Query -
    851     * @return Doctrine_Record|false    Doctrine_Record object on success, -
    852     *                                  boolean false on failure -
    853     */ -
    854    public function queryOne($query, array $params = array())  -
    855    { -
    856        $parser = new Doctrine_Query($this); -
    857 -
    858        $coll = $parser->query($query, $params); -
    859        if ( ! $coll->contains(0)) { -
    860            return false; -
    861        } -
    862        return $coll[0]; -
    863    } -
    864 -
    865    /** -
    866     * queries the database with limit and offset -
    867     * added to the query and returns a Doctrine_Connection_Statement object -
    868     * -
    869     * @param string $query -
    870     * @param integer $limit -
    871     * @param integer $offset -
    872     * @return Doctrine_Connection_Statement -
    873     */ -
    874    public function select($query, $limit = 0, $offset = 0) -
    875    { -
    876        if ($limit > 0 || $offset > 0) { -
    877            $query = $this->modifyLimitQuery($query, $limit, $offset); -
    878        } -
    879        return $this->execute($query); -
    880    } -
    881 -
    882    /** -
    883     * standaloneQuery -
    884     * -
    885     * @param string $query     sql query -
    886     * @param array $params     query parameters -
    887     * -
    888     * @return PDOStatement|Doctrine_Adapter_Statement -
    889     */ -
    890    public function standaloneQuery($query, $params = array()) -
    891    { -
    892        return $this->execute($query, $params); -
    893    } -
    894 -
    895    /** -
    896     * execute -
    897     * @param string $query     sql query -
    898     * @param array $params     query parameters -
    899     * -
    900     * @return PDOStatement|Doctrine_Adapter_Statement -
    901     */ -
    902    public function execute($query, array $params = array()) -
    903    { -
    904        $this->connect(); -
    905 -
    906        try { -
    907            if ( ! empty($params)) { -
    908                $stmt = $this->prepare($query); -
    909                $stmt->execute($params); -
    910                return $stmt; -
    911            } else { -
    912                $event = new Doctrine_Event($this, Doctrine_Event::CONN_QUERY, $query, $params); -
    913 -
    914                $this->getAttribute(Doctrine::ATTR_LISTENER)->preQuery($event); -
    915 -
    916                if ( ! $event->skipOperation) { -
    917                    $stmt = $this->dbh->query($query); -
    918                    $this->_count++; -
    919                } -
    920                $this->getAttribute(Doctrine::ATTR_LISTENER)->postQuery($event); -
    921 -
    922                return $stmt; -
    923            } -
    924        } catch (Doctrine_Adapter_Exception $e) { -
    925        } catch (PDOException $e) { } -
    926 -
    927        $this->rethrowException($e, $this); -
    928    } -
    929 -
    930    /** -
    931     * exec -
    932     * @param string $query     sql query -
    933     * @param array $params     query parameters -
    934     * -
    935     * @return PDOStatement|Doctrine_Adapter_Statement -
    936     */ -
    937    public function exec($query, array $params = array()) { -
    938        $this->connect(); -
    939 -
    940        try { -
    941            if ( ! empty($params)) { -
    942                $stmt = $this->prepare($query); -
    943                $stmt->execute($params); -
    944 -
    945                return $stmt->rowCount(); -
    946            } else { -
    947                $event = new Doctrine_Event($this, Doctrine_Event::CONN_EXEC, $query, $params); -
    948 -
    949                $this->getAttribute(Doctrine::ATTR_LISTENER)->preExec($event); -
    950 -
    951                if ( ! $event->skipOperation) { -
    952                    $count = $this->dbh->exec($query); -
    953 -
    954                    $this->_count++; -
    955                } -
    956                $this->getAttribute(Doctrine::ATTR_LISTENER)->postExec($event); -
    957 -
    958                return $count; -
    959            } -
    960        } catch (Doctrine_Adapter_Exception $e) { -
    961        } catch (PDOException $e) { } -
    962 -
    963        $this->rethrowException($e, $this); -
    964    } -
    965 -
    966    /** -
    967     * rethrowException -
    968     * -
    969     * @throws Doctrine_Connection_Exception -
    970     */ -
    971    public function rethrowException(Exception $e, $invoker) -
    972    { -
    973        $event = new Doctrine_Event($this, Doctrine_Event::CONN_ERROR); -
    974 -
    975        $this->getListener()->preError($event); -
    976         -
    977        $name = 'Doctrine_Connection_' . $this->driverName . '_Exception'; -
    978 -
    979        $exc  = new $name($e->getMessage(), (int) $e->getCode()); -
    980        if ( ! is_array($e->errorInfo)) { -
    981            $e->errorInfo = array(null, null, null, null); -
    982        } -
    983        $exc->processErrorInfo($e->errorInfo); -
    984 -
    985         if ($this->getAttribute(Doctrine::ATTR_THROW_EXCEPTIONS)) { -
    986            throw $exc; -
    987        } -
    988         -
    989        $this->getListener()->postError($event); -
    990    } -
    991 -
    992    /** -
    993     * hasTable -
    994     * whether or not this connection has table $name initialized -
    995     * -
    996     * @param mixed $name -
    997     * @return boolean -
    998     */ -
    999    public function hasTable($name) -
    1000    { -
    1001        return isset($this->tables[$name]); -
    1002    } -
    1003 -
    1004    /** -
    1005     * returns a table object for given component name -
    1006     * -
    1007     * @param string $name              component name -
    1008     * @return object Doctrine_Table -
    1009     */ -
    1010    public function getTable($name) -
    1011    { -
    1012        if (isset($this->tables[$name])) { -
    1013            return $this->tables[$name]; -
    1014        } -
    1015        $class = $name . 'Table'; -
    1016 -
    1017        if (class_exists($class) && in_array('Doctrine_Table', class_parents($class))) { -
    1018            $table = new $class($name, $this, true); -
    1019        } else { -
    1020            $table = new Doctrine_Table($name, $this, true); -
    1021        } -
    1022 -
    1023        $this->tables[$name] = $table; -
    1024 -
    1025        return $table; -
    1026    } -
    1027 -
    1028    /** -
    1029     * returns an array of all initialized tables -
    1030     * -
    1031     * @return array -
    1032     */ -
    1033    public function getTables() -
    1034    { -
    1035        return $this->tables; -
    1036    } -
    1037 -
    1038    /** -
    1039     * returns an iterator that iterators through all -
    1040     * initialized table objects -
    1041     * -
    1042     * <code> -
    1043     * foreach ($conn as $index => $table) { -
    1044     *      print $table;  // get a string representation of each table object -
    1045     * } -
    1046     * </code> -
    1047     * -
    1048     * @return ArrayIterator        SPL ArrayIterator object -
    1049     */ -
    1050    public function getIterator() -
    1051    { -
    1052        return new ArrayIterator($this->tables); -
    1053    } -
    1054 -
    1055    /** -
    1056     * returns the count of initialized table objects -
    1057     * -
    1058     * @return integer -
    1059     */ -
    1060    public function count() -
    1061    { -
    1062        return $this->_count; -
    1063    } -
    1064 -
    1065    /** -
    1066     * addTable -
    1067     * adds a Doctrine_Table object into connection registry -
    1068     * -
    1069     * @param $table                a Doctrine_Table object to be added into registry -
    1070     * @return boolean -
    1071     */ -
    1072    public function addTable(Doctrine_Table $table) -
    1073    { -
    1074        $name = $table->getComponentName(); -
    1075 -
    1076        if (isset($this->tables[$name])) { -
    1077            return false; -
    1078        } -
    1079        $this->tables[$name] = $table; -
    1080        return true; -
    1081    } -
    1082 -
    1083    /** -
    1084     * create -
    1085     * creates a record -
    1086     * -
    1087     * create                       creates a record -
    1088     * @param string $name          component name -
    1089     * @return Doctrine_Record      Doctrine_Record object -
    1090     */ -
    1091    public function create($name) -
    1092    { -
    1093        return $this->getTable($name)->create(); -
    1094    } -
    1095     -
    1096    /** -
    1097     * Creates a new Doctrine_Query object that operates on this connection. -
    1098     *  -
    1099     * @return Doctrine_Query  -
    1100     */ -
    1101    public function createQuery() -
    1102    { -
    1103        return new Doctrine_Query($this); -
    1104    } -
    1105 -
    1106    /** -
    1107     * flush -
    1108     * saves all the records from all tables -
    1109     * this operation is isolated using a transaction -
    1110     * -
    1111     * @throws PDOException         if something went wrong at database level -
    1112     * @return void -
    1113     */ -
    1114    public function flush() -
    1115    { -
    1116        $this->beginTransaction(); -
    1117        $this->unitOfWork->saveAll(); -
    1118        $this->commit(); -
    1119    } -
    1120 -
    1121    /** -
    1122     * clear -
    1123     * clears all repositories -
    1124     * -
    1125     * @return void -
    1126     */ -
    1127    public function clear() -
    1128    { -
    1129        foreach ($this->tables as $k => $table) { -
    1130            $table->getRepository()->evictAll(); -
    1131            $table->clear(); -
    1132        } -
    1133    } -
    1134 -
    1135    /** -
    1136     * evictTables -
    1137     * evicts all tables -
    1138     * -
    1139     * @return void -
    1140     */ -
    1141    public function evictTables() -
    1142    { -
    1143        $this->tables = array(); -
    1144        $this->exported = array(); -
    1145    } -
    1146 -
    1147    /** -
    1148     * close -
    1149     * closes the connection -
    1150     * -
    1151     * @return void -
    1152     */ -
    1153    public function close() -
    1154    { -
    1155        $event = new Doctrine_Event($this, Doctrine_Event::CONN_CLOSE); -
    1156 -
    1157        $this->getAttribute(Doctrine::ATTR_LISTENER)->preClose($event); -
    1158 -
    1159        $this->clear(); -
    1160         -
    1161        unset($this->dbh); -
    1162        $this->isConnected = false; -
    1163 -
    1164        $this->getAttribute(Doctrine::ATTR_LISTENER)->postClose($event); -
    1165    } -
    1166 -
    1167    /** -
    1168     * get the current transaction nesting level -
    1169     * -
    1170     * @return integer -
    1171     */ -
    1172    public function getTransactionLevel() -
    1173    { -
    1174        return $this->transaction->getTransactionLevel(); -
    1175    } -
    1176 -
    1177    /** -
    1178     * errorCode -
    1179     * Fetch the SQLSTATE associated with the last operation on the database handle -
    1180     * -
    1181     * @return integer -
    1182     */ -
    1183    public function errorCode() -
    1184    { -
    1185        $this->connect(); -
    1186 -
    1187        return $this->dbh->errorCode(); -
    1188    } -
    1189 -
    1190    /** -
    1191     * errorInfo -
    1192     * Fetch extended error information associated with the last operation on the database handle -
    1193     * -
    1194     * @return array -
    1195     */ -
    1196    public function errorInfo() -
    1197    { -
    1198        $this->connect(); -
    1199 -
    1200        return $this->dbh->errorInfo(); -
    1201    } -
    1202     -
    1203    /** -
    1204     * getCacheDriver -
    1205     * -
    1206     * @return Doctrine_Cache_Interface -
    1207     * @deprecated Use getResultCacheDriver() -
    1208     */ -
    1209    public function getCacheDriver() -
    1210    { -
    1211        return $this->getResultCacheDriver(); -
    1212    } -
    1213     -
    1214    /** -
    1215     * getResultCacheDriver -
    1216     * -
    1217     * @return Doctrine_Cache_Interface -
    1218     */ -
    1219    public function getResultCacheDriver() -
    1220    { -
    1221        if ( ! $this->getAttribute(Doctrine::ATTR_RESULT_CACHE)) { -
    1222            throw new Doctrine_Exception('Result Cache driver not initialized.'); -
    1223        } -
    1224 -
    1225        return $this->getAttribute(Doctrine::ATTR_RESULT_CACHE); -
    1226    } -
    1227     -
    1228    /** -
    1229     * getQueryCacheDriver -
    1230     * -
    1231     * @return Doctrine_Cache_Interface -
    1232     */ -
    1233    public function getQueryCacheDriver() -
    1234    { -
    1235        if ( ! $this->getAttribute(Doctrine::ATTR_QUERY_CACHE)) { -
    1236            throw new Doctrine_Exception('Query Cache driver not initialized.'); -
    1237        } -
    1238 -
    1239        return $this->getAttribute(Doctrine::ATTR_QUERY_CACHE); -
    1240    } -
    1241 -
    1242    /** -
    1243     * lastInsertId -
    1244     * -
    1245     * Returns the ID of the last inserted row, or the last value from a sequence object, -
    1246     * depending on the underlying driver. -
    1247     * -
    1248     * Note: This method may not return a meaningful or consistent result across different drivers,  -
    1249     * because the underlying database may not even support the notion of auto-increment fields or sequences. -
    1250     * -
    1251     * @param string $table     name of the table into which a new row was inserted -
    1252     * @param string $field     name of the field into which a new row was inserted -
    1253     */ -
    1254    public function lastInsertId($table = null, $field = null) -
    1255    { -
    1256        return $this->sequence->lastInsertId($table, $field); -
    1257    } -
    1258 -
    1259    /** -
    1260     * beginTransaction -
    1261     * Start a transaction or set a savepoint. -
    1262     * -
    1263     * if trying to set a savepoint and there is no active transaction -
    1264     * a new transaction is being started -
    1265     * -
    1266     * Listeners: onPreTransactionBegin, onTransactionBegin -
    1267     * -
    1268     * @param string $savepoint                 name of a savepoint to set -
    1269     * @throws Doctrine_Transaction_Exception   if the transaction fails at database level -
    1270     * @return integer                          current transaction nesting level -
    1271     */ -
    1272    public function beginTransaction($savepoint = null) -
    1273    { -
    1274        $this->transaction->beginTransaction($savepoint); -
    1275    } -
    1276 -
    1277    /** -
    1278     * commit -
    1279     * Commit the database changes done during a transaction that is in -
    1280     * progress or release a savepoint. This function may only be called when -
    1281     * auto-committing is disabled, otherwise it will fail. -
    1282     * -
    1283     * Listeners: onPreTransactionCommit, onTransactionCommit -
    1284     * -
    1285     * @param string $savepoint                 name of a savepoint to release -
    1286     * @throws Doctrine_Transaction_Exception   if the transaction fails at PDO level -
    1287     * @throws Doctrine_Validator_Exception     if the transaction fails due to record validations -
    1288     * @return boolean                          false if commit couldn't be performed, true otherwise -
    1289     */ -
    1290    public function commit($savepoint = null) -
    1291    { -
    1292        $this->transaction->commit($savepoint); -
    1293    } -
    1294 -
    1295    /** -
    1296     * rollback -
    1297     * Cancel any database changes done during a transaction or since a specific -
    1298     * savepoint that is in progress. This function may only be called when -
    1299     * auto-committing is disabled, otherwise it will fail. Therefore, a new -
    1300     * transaction is implicitly started after canceling the pending changes. -
    1301     * -
    1302     * this method can be listened with onPreTransactionRollback and onTransactionRollback -
    1303     * eventlistener methods -
    1304     * -
    1305     * @param string $savepoint                 name of a savepoint to rollback to    -
    1306     * @throws Doctrine_Transaction_Exception   if the rollback operation fails at database level -
    1307     * @return boolean                          false if rollback couldn't be performed, true otherwise -
    1308     */ -
    1309    public function rollback($savepoint = null) -
    1310    { -
    1311        $this->transaction->rollback($savepoint); -
    1312    } -
    1313 -
    1314    /** -
    1315     * returns a string representation of this object -
    1316     * @return string -
    1317     */ -
    1318    public function __toString() -
    1319    { -
    1320        return Doctrine_Lib::getConnectionAsString($this); -
    1321    } -
    1322} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Common.html b/tests_old/coverage/Doctrine_Connection_Common.html deleted file mode 100644 index cd594d09a..000000000 --- a/tests_old/coverage/Doctrine_Connection_Common.html +++ /dev/null @@ -1,182 +0,0 @@ - - - Coverage for Doctrine_Connection_Common - - -

    Coverage for Doctrine_Connection_Common

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Common.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection'); -
    22/** -
    23 * standard connection, the parent of pgsql, mysql and sqlite -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @link        www.phpdoctrine.org -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Connection_Common extends Doctrine_Connection -
    34{ -
    35    /** -
    36     * Adds an driver-specific LIMIT clause to the query -
    37     * -
    38     * @param string $query -
    39     * @param mixed $limit -
    40     * @param mixed $offset -
    41     */ -
    42    public function modifyLimitQuery($query, $limit = false,$offset = false,$isManip=false) -
    43    { -
    44        $limit = (int) $limit; -
    45        $offset = (int) $offset; -
    46         -
    47        if ($limit && $offset) { -
    48            $query .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; -
    49        } elseif ($limit && ! $offset) { -
    50            $query .= ' LIMIT ' . $limit; -
    51        } elseif ( ! $limit && $offset) { -
    52            $query .= ' LIMIT 999999999999 OFFSET ' . $offset; -
    53        } -
    54 -
    55        return $query; -
    56    } -
    57}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Exception.html b/tests_old/coverage/Doctrine_Connection_Exception.html deleted file mode 100644 index f717e4fd2..000000000 --- a/tests_old/coverage/Doctrine_Connection_Exception.html +++ /dev/null @@ -1,362 +0,0 @@ - - - Coverage for Doctrine_Connection_Exception - - -

    Coverage for Doctrine_Connection_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Connection_Exception extends Doctrine_Exception -
    34{ -
    35    /** -
    36     * @var array $errorMessages        an array containing messages for portable error codes -
    37     */ -
    38    static protected $errorMessages = array( -
    39                Doctrine::ERR                    => 'unknown error', -
    40                Doctrine::ERR_ALREADY_EXISTS     => 'already exists', -
    41                Doctrine::ERR_CANNOT_CREATE      => 'can not create', -
    42                Doctrine::ERR_CANNOT_ALTER       => 'can not alter', -
    43                Doctrine::ERR_CANNOT_REPLACE     => 'can not replace', -
    44                Doctrine::ERR_CANNOT_DELETE      => 'can not delete', -
    45                Doctrine::ERR_CANNOT_DROP        => 'can not drop', -
    46                Doctrine::ERR_CONSTRAINT         => 'constraint violation', -
    47                Doctrine::ERR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint', -
    48                Doctrine::ERR_DIVZERO            => 'division by zero', -
    49                Doctrine::ERR_INVALID            => 'invalid', -
    50                Doctrine::ERR_INVALID_DATE       => 'invalid date or time', -
    51                Doctrine::ERR_INVALID_NUMBER     => 'invalid number', -
    52                Doctrine::ERR_MISMATCH           => 'mismatch', -
    53                Doctrine::ERR_NODBSELECTED       => 'no database selected', -
    54                Doctrine::ERR_NOSUCHFIELD        => 'no such field', -
    55                Doctrine::ERR_NOSUCHTABLE        => 'no such table', -
    56                Doctrine::ERR_NOT_CAPABLE        => 'Doctrine backend not capable', -
    57                Doctrine::ERR_NOT_FOUND          => 'not found', -
    58                Doctrine::ERR_NOT_LOCKED         => 'not locked', -
    59                Doctrine::ERR_SYNTAX             => 'syntax error', -
    60                Doctrine::ERR_UNSUPPORTED        => 'not supported', -
    61                Doctrine::ERR_VALUE_COUNT_ON_ROW => 'value count on row', -
    62                Doctrine::ERR_INVALID_DSN        => 'invalid DSN', -
    63                Doctrine::ERR_CONNECT_FAILED     => 'connect failed', -
    64                Doctrine::ERR_NEED_MORE_DATA     => 'insufficient data supplied', -
    65                Doctrine::ERR_EXTENSION_NOT_FOUND=> 'extension not found', -
    66                Doctrine::ERR_NOSUCHDB           => 'no such database', -
    67                Doctrine::ERR_ACCESS_VIOLATION   => 'insufficient permissions', -
    68                Doctrine::ERR_LOADMODULE         => 'error while including on demand module', -
    69                Doctrine::ERR_TRUNCATED          => 'truncated', -
    70                Doctrine::ERR_DEADLOCK           => 'deadlock detected', -
    71                ); -
    72 -
    73    /** -
    74     * @see Doctrine::ERR_* constants -
    75     * @since 1.0 -
    76     * @var integer $portableCode           portable error code -
    77     */ -
    78    protected $portableCode; -
    79 -
    80    /** -
    81     * getPortableCode -
    82     * returns portable error code -
    83     * -
    84     * @return integer      portable error code -
    85     */ -
    86    public function getPortableCode() -
    87    { -
    88        return $this->portableCode; -
    89    } -
    90 -
    91    /** -
    92     * getPortableMessage -
    93     * returns portable error message -
    94     * -
    95     * @return string       portable error message -
    96     */ -
    97    public function getPortableMessage() -
    98    { -
    99        return self::errorMessage($this->portableCode); -
    100    } -
    101 -
    102    /** -
    103     * Return a textual error message for a Doctrine error code -
    104     * -
    105     * @param   int|array   integer error code, -
    106     *                           null to get the current error code-message map, -
    107     *                           or an array with a new error code-message map -
    108     * -
    109     * @return  string  error message, or false if the error code was -
    110     *                  not recognized -
    111     */ -
    112    public function errorMessage($value = null) -
    113    { -
    114        return isset(self::$errorMessages[$value]) ? -
    115           self::$errorMessages[$value] : self::$errorMessages[Doctrine::ERR]; -
    116    } -
    117}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Firebird.html b/tests_old/coverage/Doctrine_Connection_Firebird.html deleted file mode 100644 index 8b1c25df1..000000000 --- a/tests_old/coverage/Doctrine_Connection_Firebird.html +++ /dev/null @@ -1,344 +0,0 @@ - - - Coverage for Doctrine_Connection_Firebird - - -

    Coverage for Doctrine_Connection_Firebird

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Firebird.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection'); -
    22/** -
    23 * Doctrine_Connection_Firebird -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    30 * @author      Lorenzo Alberton <l.alberton@quipo.it> (PEAR MDB2 Interbase driver) -
    31 * @version     $Revision: 2963 $ -
    32 * @link        www.phpdoctrine.org -
    33 * @since       1.0 -
    34 */ -
    35class Doctrine_Connection_Firebird extends Doctrine_Connection -
    36{ -
    37    /** -
    38     * @var string $driverName                  the name of this connection driver -
    39     */ -
    40    protected $driverName = 'Firebird'; -
    41 -
    42    /** -
    43     * the constructor -
    44     * -
    45     * @param Doctrine_Manager $manager -
    46     * @param PDO $pdo                          database handle -
    47     */ -
    48    public function __construct(Doctrine_Manager $manager, $adapter) -
    49    { -
    50 -
    51        $this->supported = array( -
    52                          'sequences'             => true, -
    53                          'indexes'               => true, -
    54                          'affected_rows'         => true, -
    55                          'summary_functions'     => true, -
    56                          'order_by_text'         => true, -
    57                          'transactions'          => true, -
    58                          'savepoints'            => true, -
    59                          'current_id'            => true, -
    60                          'limit_queries'         => 'emulated', -
    61                          'LOBs'                  => true, -
    62                          'replace'               => 'emulated', -
    63                          'sub_selects'           => true, -
    64                          'auto_increment'        => true, -
    65                          'primary_key'           => true, -
    66                          'result_introspection'  => true, -
    67                          'prepared_statements'   => true, -
    68                          'identifier_quoting'    => false, -
    69                          'pattern_escaping'      => true -
    70                          ); -
    71        // initialize all driver options -
    72        /** -
    73        $this->options['DBA_username'] = false; -
    74        $this->options['DBA_password'] = false; -
    75        $this->options['database_path'] = ''; -
    76        $this->options['database_extension'] = '.gdb'; -
    77        $this->options['server_version'] = ''; -
    78        */ -
    79        parent::__construct($manager, $adapter); -
    80    } -
    81 -
    82    /** -
    83     * Set the charset on the current connection -
    84     * -
    85     * @param string    charset -
    86     * -
    87     * @return void -
    88     */ -
    89    public function setCharset($charset) -
    90    { -
    91        $query = 'SET NAMES '.$this->dbh->quote($charset); -
    92        $this->exec($query); -
    93    } -
    94 -
    95    /** -
    96     * Adds an driver-specific LIMIT clause to the query -
    97     * -
    98     * @param string $query     query to modify -
    99     * @param integer $limit    limit the number of rows -
    100     * @param integer $offset   start reading from given offset -
    101     * @return string modified  query -
    102     */ -
    103    public function modifyLimitQuery($query, $limit, $offset) -
    104    { -
    105        if ($limit > 0) { -
    106            $query = preg_replace('/^([\s(])*SELECT(?!\s*FIRST\s*\d+)/i', -
    107                "SELECT FIRST $limit SKIP $offset", $query); -
    108        } -
    109        return $query; -
    110    } -
    111}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Firebird_Exception.html b/tests_old/coverage/Doctrine_Connection_Firebird_Exception.html deleted file mode 100644 index 5ab9a28a8..000000000 --- a/tests_old/coverage/Doctrine_Connection_Firebird_Exception.html +++ /dev/null @@ -1,419 +0,0 @@ - - - Coverage for Doctrine_Connection_Firebird_Exception - - -

    Coverage for Doctrine_Connection_Firebird_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Exception'); -
    22/** -
    23 * Doctrine_Connection_Firebird_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 * @author      Lorenzo Alberton <l.alberton@quipo.it> (PEAR MDB2 Interbase driver) -
    33 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    34 */ -
    35class Doctrine_Connection_Firebird_Exception extends Doctrine_Connection_Exception -
    36{ -
    37    /** -
    38     * @var array $errorCodeMap         an array that is used for determining portable -
    39     *                                  error code from a native database error code -
    40     */ -
    41    protected static $errorCodeMap = array( -
    42                                    -104 => Doctrine::ERR_SYNTAX, -
    43                                    -150 => Doctrine::ERR_ACCESS_VIOLATION, -
    44                                    -151 => Doctrine::ERR_ACCESS_VIOLATION, -
    45                                    -155 => Doctrine::ERR_NOSUCHTABLE, -
    46                                    -157 => Doctrine::ERR_NOSUCHFIELD, -
    47                                    -158 => Doctrine::ERR_VALUE_COUNT_ON_ROW, -
    48                                    -170 => Doctrine::ERR_MISMATCH, -
    49                                    -171 => Doctrine::ERR_MISMATCH, -
    50                                    -172 => Doctrine::ERR_INVALID, -
    51                                    // -204 =>  // Covers too many errors, need to use regex on msg -
    52                                    -205 => Doctrine::ERR_NOSUCHFIELD, -
    53                                    -206 => Doctrine::ERR_NOSUCHFIELD, -
    54                                    -208 => Doctrine::ERR_INVALID, -
    55                                    -219 => Doctrine::ERR_NOSUCHTABLE, -
    56                                    -297 => Doctrine::ERR_CONSTRAINT, -
    57                                    -303 => Doctrine::ERR_INVALID, -
    58                                    -413 => Doctrine::ERR_INVALID_NUMBER, -
    59                                    -530 => Doctrine::ERR_CONSTRAINT, -
    60                                    -551 => Doctrine::ERR_ACCESS_VIOLATION, -
    61                                    -552 => Doctrine::ERR_ACCESS_VIOLATION, -
    62                                    // -607 =>  // Covers too many errors, need to use regex on msg -
    63                                    -625 => Doctrine::ERR_CONSTRAINT_NOT_NULL, -
    64                                    -803 => Doctrine::ERR_CONSTRAINT, -
    65                                    -804 => Doctrine::ERR_VALUE_COUNT_ON_ROW, -
    66                                    -904 => Doctrine::ERR_CONNECT_FAILED, -
    67                                    -922 => Doctrine::ERR_NOSUCHDB, -
    68                                    -923 => Doctrine::ERR_CONNECT_FAILED, -
    69                                    -924 => Doctrine::ERR_CONNECT_FAILED -
    70                                    ); -
    71 -
    72    /** -
    73     * @var array $errorRegexps         an array that is used for determining portable -
    74     *                                  error code from a native database error message -
    75     */ -
    76    protected static $errorRegexps = array( -
    77                                    '/generator .* is not defined/' -
    78                                        => Doctrine::ERR_SYNTAX,  // for compat. w ibase_errcode() -
    79                                    '/table.*(not exist|not found|unknown)/i' -
    80                                        => Doctrine::ERR_NOSUCHTABLE, -
    81                                    '/table .* already exists/i' -
    82                                        => Doctrine::ERR_ALREADY_EXISTS, -
    83                                    '/unsuccessful metadata update .* failed attempt to store duplicate value/i' -
    84                                        => Doctrine::ERR_ALREADY_EXISTS, -
    85                                    '/unsuccessful metadata update .* not found/i' -
    86                                        => Doctrine::ERR_NOT_FOUND, -
    87                                    '/validation error for column .* value "\*\*\* null/i' -
    88                                        => Doctrine::ERR_CONSTRAINT_NOT_NULL, -
    89                                    '/violation of [\w ]+ constraint/i' -
    90                                        => Doctrine::ERR_CONSTRAINT, -
    91                                    '/conversion error from string/i' -
    92                                        => Doctrine::ERR_INVALID_NUMBER, -
    93                                    '/no permission for/i' -
    94                                        => Doctrine::ERR_ACCESS_VIOLATION, -
    95                                    '/arithmetic exception, numeric overflow, or string truncation/i' -
    96                                        => Doctrine::ERR_INVALID, -
    97                                    '/table unknown/i' -
    98                                        => Doctrine::ERR_NOSUCHTABLE, -
    99                                    ); -
    100 -
    101    /** -
    102     * This method checks if native error code/message can be -
    103     * converted into a portable code and then adds this -
    104     * portable error code to errorInfo array and returns the modified array -
    105     * -
    106     * the portable error code is added at the end of array -
    107     * -
    108     * @param array $errorInfo      error info array -
    109     * @since 1.0 -
    110     * @return array -
    111     */ -
    112    public function processErrorInfo(array $errorInfo) -
    113    { -
    114            /** -
    115            // todo: are the following lines needed? -
    116            // memo for the interbase php module hackers: we need something similar -
    117            // to mysql_errno() to retrieve error codes instead of this ugly hack -
    118            if (preg_match('/^([^0-9\-]+)([0-9\-]+)\s+(.*)$/', $native_msg, $m)) { -
    119                $native_code = (int)$m[2]; -
    120            } else { -
    121                $native_code = null; -
    122            } -
    123            */ -
    124 -
    125        foreach (self::$errorRegexps as $regexp => $code) { -
    126            if (preg_match($regexp, $errorInfo[2])) { -
    127                $errorInfo[3] = $code; -
    128                break; -
    129            } -
    130        } -
    131        if (isset(self::$errorCodeMap[$errorInfo[1]])) { -
    132            $errorInfo[3] = self::$errorCodeMap[$errorInfo[1]]; -
    133        } -
    134        return $errorInfo; -
    135    } -
    136}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Module.html b/tests_old/coverage/Doctrine_Connection_Module.html deleted file mode 100644 index d620316d9..000000000 --- a/tests_old/coverage/Doctrine_Connection_Module.html +++ /dev/null @@ -1,260 +0,0 @@ - - - Coverage for Doctrine_Connection_Module - - -

    Coverage for Doctrine_Connection_Module

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Module.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Connection_Module -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Connection_Module -
    34{ -
    35    /** -
    36     * @var Doctrine_Connection $conn       Doctrine_Connection object, every connection -
    37     *                                      module holds an instance of Doctrine_Connection -
    38     */ -
    39    protected $conn; -
    40 -
    41    /** -
    42     * @var string $moduleName              the name of this module -
    43     */ -
    44    protected $moduleName; -
    45 -
    46    /** -
    47     * @param Doctrine_Connection $conn     Doctrine_Connection object, every connection -
    48     *                                      module holds an instance of Doctrine_Connection -
    49     */ -
    50    public function __construct($conn = null) -
    51    { -
    52        if ( ! ($conn instanceof Doctrine_Connection)) { -
    53            $conn = Doctrine_Manager::getInstance()->getCurrentConnection(); -
    54        } -
    55        $this->conn = $conn; -
    56 -
    57        $e = explode('_', get_class($this)); -
    58 -
    59        $this->moduleName = $e[1]; -
    60    } -
    61 -
    62    /** -
    63     * getConnection -
    64     * returns the connection object this module uses -
    65     * -
    66     * @return Doctrine_Connection -
    67     */ -
    68    public function getConnection() -
    69    { -
    70        return $this->conn; -
    71    } -
    72 -
    73    /** -
    74     * getModuleName -
    75     * returns the name of this module -
    76     * -
    77     * @return string       the name of this module -
    78     */ -
    79    public function getModuleName() -
    80    { -
    81        return $this->moduleName; -
    82    } -
    83}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Mssql.html b/tests_old/coverage/Doctrine_Connection_Mssql.html deleted file mode 100644 index 20e1be7b1..000000000 --- a/tests_old/coverage/Doctrine_Connection_Mssql.html +++ /dev/null @@ -1,593 +0,0 @@ - - - Coverage for Doctrine_Connection_Mssql - - -

    Coverage for Doctrine_Connection_Mssql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mssql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection'); -
    22/** -
    23 * Doctrine_Connection_Mssql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    30 * @version     $Revision: 2963 $ -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 */ -
    34class Doctrine_Connection_Mssql extends Doctrine_Connection -
    35{ -
    36    /** -
    37     * @var string $driverName                  the name of this connection driver -
    38     */ -
    39    protected $driverName = 'Mssql'; -
    40 -
    41    /** -
    42     * the constructor -
    43     * -
    44     * @param Doctrine_Manager $manager -
    45     * @param PDO $pdo                          database handle -
    46     */ -
    47    public function __construct(Doctrine_Manager $manager, $adapter) -
    48    { -
    49        // initialize all driver options -
    50        $this->supported = array( -
    51                          'sequences'             => 'emulated', -
    52                          'indexes'               => true, -
    53                          'affected_rows'         => true, -
    54                          'transactions'          => true, -
    55                          'summary_functions'     => true, -
    56                          'order_by_text'         => true, -
    57                          'current_id'            => 'emulated', -
    58                          'limit_queries'         => 'emulated', -
    59                          'LOBs'                  => true, -
    60                          'replace'               => 'emulated', -
    61                          'sub_selects'           => true, -
    62                          'auto_increment'        => true, -
    63                          'primary_key'           => true, -
    64                          'result_introspection'  => true, -
    65                          'prepared_statements'   => 'emulated', -
    66                          ); -
    67 -
    68        parent::__construct($manager, $adapter); -
    69    } -
    70 -
    71    /** -
    72     * quoteIdentifier -
    73     * Quote a string so it can be safely used as a table / column name -
    74     * -
    75     * Quoting style depends on which database driver is being used. -
    76     * -
    77     * @param string $identifier    identifier name to be quoted -
    78     * @param bool   $checkOption   check the 'quote_identifier' option -
    79     * -
    80     * @return string  quoted identifier string -
    81     */ -
    82    public function quoteIdentifier($identifier, $checkOption = false) -
    83    { -
    84        if ($checkOption && ! $this->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER)) { -
    85            return $identifier; -
    86        } -
    87        return '[' . str_replace(']', ']]', $identifier) . ']'; -
    88    } -
    89 -
    90    /** -
    91     * Adds an adapter-specific LIMIT clause to the SELECT statement. -
    92     * [ borrowed from Zend Framework ] -
    93     * -
    94     * @param string $query -
    95     * @param mixed $limit -
    96     * @param mixed $offset -
    97     * @link http://lists.bestpractical.com/pipermail/rt-devel/2005-June/007339.html -
    98     * @return string -
    99     */ -
    100    public function modifyLimitQuery($query, $limit, $offset, $isManip = false) -
    101    { -
    102        if ($limit > 0) { -
    103            $count = intval($limit); -
    104 -
    105            $offset = intval($offset); -
    106            if ($offset < 0) { -
    107                throw new Doctrine_Connection_Exception("LIMIT argument offset=$offset is not valid"); -
    108            } -
    109     -
    110            $orderby = stristr($query, 'ORDER BY'); -
    111            if ($orderby !== false) { -
    112                $sort = (stripos($orderby, 'desc') !== false) ? 'desc' : 'asc'; -
    113                $order = str_ireplace('ORDER BY', '', $orderby); -
    114                $order = trim(preg_replace('/ASC|DESC/i', '', $order)); -
    115            } -
    116     -
    117            $query = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . ($count+$offset) . ' ', $query); -
    118     -
    119            $query = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $query . ') AS inner_tbl'; -
    120            if ($orderby !== false) { -
    121                $query .= ' ORDER BY ' . $order . ' '; -
    122                $query .= (stripos($sort, 'asc') !== false) ? 'DESC' : 'ASC'; -
    123            } -
    124            $query .= ') AS outer_tbl'; -
    125            if ($orderby !== false) { -
    126                $query .= ' ORDER BY ' . $order . ' ' . $sort; -
    127            } -
    128     -
    129            return $query; -
    130 -
    131        } -
    132 -
    133        return $query; -
    134    } -
    135 -
    136    /** -
    137     * return version information about the server -
    138     * -
    139     * @param bool   $native  determines if the raw version string should be returned -
    140     * @return mixed array/string with version information or MDB2 error object -
    141     */ -
    142    public function getServerVersion($native = false) -
    143    { -
    144        if ($this->serverInfo) { -
    145            $serverInfo = $this->serverInfo; -
    146        } else { -
    147            $query      = 'SELECT @@VERSION'; -
    148            $serverInfo = $this->fetchOne($query); -
    149        } -
    150        // cache server_info -
    151        $this->serverInfo = $serverInfo; -
    152        if ( ! $native) { -
    153            if (preg_match('/([0-9]+)\.([0-9]+)\.([0-9]+)/', $serverInfo, $tmp)) { -
    154                $serverInfo = array( -
    155                    'major' => $tmp[1], -
    156                    'minor' => $tmp[2], -
    157                    'patch' => $tmp[3], -
    158                    'extra' => null, -
    159                    'native' => $serverInfo, -
    160                ); -
    161            } else { -
    162                $serverInfo = array( -
    163                    'major' => null, -
    164                    'minor' => null, -
    165                    'patch' => null, -
    166                    'extra' => null, -
    167                    'native' => $serverInfo, -
    168                ); -
    169            } -
    170        } -
    171        return $serverInfo; -
    172    } -
    173 -
    174    /** -
    175     * Checks if there's a sequence that exists. -
    176     * -
    177     * @param  string $seq_name     The sequence name to verify. -
    178     * @return boolean              The value if the table exists or not -
    179     */ -
    180    public function checkSequence($seqName) -
    181    { -
    182        $query = 'SELECT * FROM ' . $seqName; -
    183        try { -
    184            $this->exec($query); -
    185        } catch(Doctrine_Connection_Exception $e) { -
    186            if ($e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { -
    187                return false; -
    188            } -
    189 -
    190            throw $e; -
    191        } -
    192        return true; -
    193    } -
    194}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Mssql_Exception.html b/tests_old/coverage/Doctrine_Connection_Mssql_Exception.html deleted file mode 100644 index cf867b188..000000000 --- a/tests_old/coverage/Doctrine_Connection_Mssql_Exception.html +++ /dev/null @@ -1,236 +0,0 @@ - - - Coverage for Doctrine_Connection_Mssql_Exception - - -

    Coverage for Doctrine_Connection_Mssql_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Exception'); -
    22/** -
    23 * Doctrine_Connection_Mssql_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 * @link        www.phpdoctrine.org -
    33 */ -
    34class Doctrine_Connection_Mssql_Exception extends Doctrine_Connection_Exception -
    35{ -
    36    /** -
    37     * @var array $errorCodeMap         an array that is used for determining portable -
    38     *                                  error code from a native database error code -
    39     */ -
    40    protected static $errorCodeMap = array( -
    41                                      110   => Doctrine::ERR_VALUE_COUNT_ON_ROW, -
    42                                      155   => Doctrine::ERR_NOSUCHFIELD, -
    43                                      170   => Doctrine::ERR_SYNTAX, -
    44                                      207   => Doctrine::ERR_NOSUCHFIELD, -
    45                                      208   => Doctrine::ERR_NOSUCHTABLE, -
    46                                      245   => Doctrine::ERR_INVALID_NUMBER, -
    47                                      515   => Doctrine::ERR_CONSTRAINT_NOT_NULL, -
    48                                      547   => Doctrine::ERR_CONSTRAINT, -
    49                                      1913  => Doctrine::ERR_ALREADY_EXISTS, -
    50                                      2627  => Doctrine::ERR_CONSTRAINT, -
    51                                      2714  => Doctrine::ERR_ALREADY_EXISTS, -
    52                                      3701  => Doctrine::ERR_NOSUCHTABLE, -
    53                                      8134  => Doctrine::ERR_DIVZERO, -
    54                                      ); -
    55 -
    56    /** -
    57     * This method checks if native error code/message can be -
    58     * converted into a portable code and then adds this -
    59     * portable error code to $portableCode field -
    60     * -
    61     * @param array $errorInfo      error info array -
    62     * @since 1.0 -
    63     * @return boolean              whether or not the error info processing was successfull -
    64     *                              (the process is successfull if portable error code was found) -
    65     */ -
    66    public function processErrorInfo(array $errorInfo) -
    67    { -
    68        $code = $errorInfo[1]; -
    69        if (isset(self::$errorCodeMap[$code])) { -
    70            $this->portableCode = self::$errorCodeMap[$code]; -
    71            return true; -
    72        } -
    73        return false; -
    74    } -
    75}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Mysql.html b/tests_old/coverage/Doctrine_Connection_Mysql.html deleted file mode 100644 index 8f127ba93..000000000 --- a/tests_old/coverage/Doctrine_Connection_Mysql.html +++ /dev/null @@ -1,639 +0,0 @@ - - - Coverage for Doctrine_Connection_Mysql - - -

    Coverage for Doctrine_Connection_Mysql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mysql.php 3183 2007-11-18 16:06:37Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Common'); -
    22/** -
    23 * Doctrine_Connection_Mysql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    30 * @version     $Revision: 3183 $ -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 */ -
    34class Doctrine_Connection_Mysql extends Doctrine_Connection_Common -
    35{ -
    36    /** -
    37     * @var string $driverName                  the name of this connection driver -
    38     */ -
    39    protected $driverName = 'Mysql'; -
    40 -
    41    /** -
    42     * the constructor -
    43     * -
    44     * @param Doctrine_Manager $manager -
    45     * @param PDO|Doctrine_Adapter $adapter     database handler -
    46     */ -
    47    public function __construct(Doctrine_Manager $manager, $adapter) -
    48    { -
    49        $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); -
    50        $this->setAttribute(Doctrine::ATTR_DEFAULT_TABLE_TYPE, 'INNODB'); -
    51 -
    52        $this->supported = array( -
    53                          'sequences'            => 'emulated', -
    54                          'indexes'              => true, -
    55                          'affected_rows'        => true, -
    56                          'transactions'         => true, -
    57                          'savepoints'           => false, -
    58                          'summary_functions'    => true, -
    59                          'order_by_text'        => true, -
    60                          'current_id'           => 'emulated', -
    61                          'limit_queries'        => true, -
    62                          'LOBs'                 => true, -
    63                          'replace'              => true, -
    64                          'sub_selects'          => true, -
    65                          'auto_increment'       => true, -
    66                          'primary_key'          => true, -
    67                          'result_introspection' => true, -
    68                          'prepared_statements'  => 'emulated', -
    69                          'identifier_quoting'   => true, -
    70                          'pattern_escaping'     => true -
    71                          ); -
    72 -
    73        $this->properties['string_quoting'] = array('start' => "'", -
    74                                                    'end' => "'", -
    75                                                    'escape' => '\\', -
    76                                                    'escape_pattern' => '\\'); -
    77 -
    78        $this->properties['identifier_quoting'] = array('start' => '`', -
    79                                                        'end' => '`', -
    80                                                        'escape' => '`'); -
    81 -
    82        $this->properties['sql_comments'] = array( -
    83                                            array('start' => '-- ', 'end' => "\n", 'escape' => false), -
    84                                            array('start' => '#', 'end' => "\n", 'escape' => false), -
    85                                            array('start' => '/*', 'end' => '*/', 'escape' => false), -
    86                                            ); -
    87 -
    88        $this->properties['varchar_max_length'] = 255; -
    89 -
    90        parent::__construct($manager, $adapter); -
    91    } -
    92 -
    93    /** -
    94     * Set the charset on the current connection -
    95     * -
    96     * @param string    charset -
    97     */ -
    98    public function setCharset($charset) -
    99    { -
    100        $query = 'SET NAMES ' . $this->quote($charset); -
    101 -
    102        $this->exec($query); -
    103    } -
    104 -
    105    /** -
    106     * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT -
    107     * query, except that if there is already a row in the table with the same -
    108     * key field values, the REPLACE query just updates its values instead of -
    109     * inserting a new row. -
    110     * -
    111     * The REPLACE type of query does not make part of the SQL standards. Since -
    112     * practically only MySQL implements it natively, this type of query is -
    113     * emulated through this method for other DBMS using standard types of -
    114     * queries inside a transaction to assure the atomicity of the operation. -
    115     * -
    116     * @access public -
    117     * -
    118     * @param string $table name of the table on which the REPLACE query will -
    119     *  be executed. -
    120     * @param array $fields associative array that describes the fields and the -
    121     *  values that will be inserted or updated in the specified table. The -
    122     *  indexes of the array are the names of all the fields of the table. The -
    123     *  values of the array are also associative arrays that describe the -
    124     *  values and other properties of the table fields. -
    125     * -
    126     *  Here follows a list of field properties that need to be specified: -
    127     * -
    128     *    value: -
    129     *          Value to be assigned to the specified field. This value may be -
    130     *          of specified in database independent type format as this -
    131     *          function can perform the necessary datatype conversions. -
    132     * -
    133     *    Default: -
    134     *          this property is required unless the Null property -
    135     *          is set to 1. -
    136     * -
    137     *    type -
    138     *          Name of the type of the field. Currently, all types Metabase -
    139     *          are supported except for clob and blob. -
    140     * -
    141     *    Default: no type conversion -
    142     * -
    143     *    null -
    144     *          Boolean property that indicates that the value for this field -
    145     *          should be set to null. -
    146     * -
    147     *          The default value for fields missing in INSERT queries may be -
    148     *          specified the definition of a table. Often, the default value -
    149     *          is already null, but since the REPLACE may be emulated using -
    150     *          an UPDATE query, make sure that all fields of the table are -
    151     *          listed in this function argument array. -
    152     * -
    153     *    Default: 0 -
    154     * -
    155     *    key -
    156     *          Boolean property that indicates that this field should be -
    157     *          handled as a primary key or at least as part of the compound -
    158     *          unique index of the table that will determine the row that will -
    159     *          updated if it exists or inserted a new row otherwise. -
    160     * -
    161     *          This function will fail if no key field is specified or if the -
    162     *          value of a key field is set to null because fields that are -
    163     *          part of unique index they may not be null. -
    164     * -
    165     *    Default: 0 -
    166     * -
    167     * @return integer      the number of affected rows -
    168     */ -
    169    public function replace(Doctrine_Table $table, array $fields, array $keys) -
    170    { -
    171        $count = count($fields); -
    172        $query = $values = ''; -
    173        $keys = $colnum = 0; -
    174 -
    175        for (reset($fields); $colnum < $count; next($fields), $colnum++) { -
    176            $name = key($fields); -
    177 -
    178            if ($colnum > 0) { -
    179                $query .= ','; -
    180                $values.= ','; -
    181            } -
    182 -
    183            $query .= $table->getColumnName($name); -
    184 -
    185            if (isset($fields[$name]['null']) && $fields[$name]['null']) { -
    186                $value = 'NULL'; -
    187            } else { -
    188                $type = isset($fields[$name]['type']) ? $fields[$name]['type'] : null; -
    189                $value = $this->quote($fields[$name]['value'], $type); -
    190            } -
    191 -
    192            $values .= $value; -
    193 -
    194            if (isset($fields[$name]['key']) && $fields[$name]['key']) { -
    195                if ($value === 'NULL') { -
    196                    throw new Doctrine_Connection_Mysql_Exception('key value '.$name.' may not be NULL'); -
    197                } -
    198                $keys++; -
    199            } -
    200        } -
    201 -
    202        if ($keys == 0) { -
    203            throw new Doctrine_Connection_Mysql_Exception('not specified which fields are keys'); -
    204        } -
    205        $query = 'REPLACE INTO ' . $table->getTableName() . ' (' . $query . ') VALUES (' . $values . ')'; -
    206 -
    207        return $this->exec($query); -
    208    } -
    209} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Mysql_Exception.html b/tests_old/coverage/Doctrine_Connection_Mysql_Exception.html deleted file mode 100644 index f73a7dc32..000000000 --- a/tests_old/coverage/Doctrine_Connection_Mysql_Exception.html +++ /dev/null @@ -1,266 +0,0 @@ - - - Coverage for Doctrine_Connection_Mysql_Exception - - -

    Coverage for Doctrine_Connection_Mysql_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Exception'); -
    22/** -
    23 * Doctrine_Connection_Mysql_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 * @link        www.phpdoctrine.org -
    33 */ -
    34class Doctrine_Connection_Mysql_Exception extends Doctrine_Connection_Exception -
    35{ -
    36    /** -
    37     * @var array $errorCodeMap         an array that is used for determining portable -
    38     *                                  error code from a native database error code -
    39     */ -
    40    protected static $errorCodeMap = array( -
    41                                      1004 => Doctrine::ERR_CANNOT_CREATE, -
    42                                      1005 => Doctrine::ERR_CANNOT_CREATE, -
    43                                      1006 => Doctrine::ERR_CANNOT_CREATE, -
    44                                      1007 => Doctrine::ERR_ALREADY_EXISTS, -
    45                                      1008 => Doctrine::ERR_CANNOT_DROP, -
    46                                      1022 => Doctrine::ERR_ALREADY_EXISTS, -
    47                                      1044 => Doctrine::ERR_ACCESS_VIOLATION, -
    48                                      1046 => Doctrine::ERR_NODBSELECTED, -
    49                                      1048 => Doctrine::ERR_CONSTRAINT, -
    50                                      1049 => Doctrine::ERR_NOSUCHDB, -
    51                                      1050 => Doctrine::ERR_ALREADY_EXISTS, -
    52                                      1051 => Doctrine::ERR_NOSUCHTABLE, -
    53                                      1054 => Doctrine::ERR_NOSUCHFIELD, -
    54                                      1061 => Doctrine::ERR_ALREADY_EXISTS, -
    55                                      1062 => Doctrine::ERR_ALREADY_EXISTS, -
    56                                      1064 => Doctrine::ERR_SYNTAX, -
    57                                      1091 => Doctrine::ERR_NOT_FOUND, -
    58                                      1100 => Doctrine::ERR_NOT_LOCKED, -
    59                                      1136 => Doctrine::ERR_VALUE_COUNT_ON_ROW, -
    60                                      1142 => Doctrine::ERR_ACCESS_VIOLATION, -
    61                                      1146 => Doctrine::ERR_NOSUCHTABLE, -
    62                                      1216 => Doctrine::ERR_CONSTRAINT, -
    63                                      1217 => Doctrine::ERR_CONSTRAINT, -
    64                                      ); -
    65 -
    66    /** -
    67     * This method checks if native error code/message can be -
    68     * converted into a portable code and then adds this -
    69     * portable error code to $portableCode field -
    70     * -
    71     * @param array $errorInfo      error info array -
    72     * @since 1.0 -
    73     * @return boolean              whether or not the error info processing was successfull -
    74     *                              (the process is successfull if portable error code was found) -
    75     */ -
    76    public function processErrorInfo(array $errorInfo) -
    77    { -
    78        $code = $errorInfo[1]; -
    79        if (isset(self::$errorCodeMap[$code])) { -
    80            $this->portableCode = self::$errorCodeMap[$code]; -
    81            return true; -
    82        } -
    83        return false; -
    84    } -
    85}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Oracle.html b/tests_old/coverage/Doctrine_Connection_Oracle.html deleted file mode 100644 index 012060f4c..000000000 --- a/tests_old/coverage/Doctrine_Connection_Oracle.html +++ /dev/null @@ -1,365 +0,0 @@ - - - Coverage for Doctrine_Connection_Oracle - - -

    Coverage for Doctrine_Connection_Oracle

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Oracle.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection'); -
    22/** -
    23 * Doctrine_Connection_Oracle -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Connection_Oracle extends Doctrine_Connection -
    34{ -
    35    /** -
    36     * @var string $driverName                  the name of this connection driver -
    37     */ -
    38    protected $driverName = 'Oracle'; -
    39 -
    40    public function __construct(Doctrine_Manager $manager, $adapter) -
    41    { -
    42        $this->supported = array( -
    43                          'sequences'            => true, -
    44                          'indexes'              => true, -
    45                          'summary_functions'    => true, -
    46                          'order_by_text'        => true, -
    47                          'current_id'           => true, -
    48                          'affected_rows'        => true, -
    49                          'transactions'         => true, -
    50                          'savepoints'           => true, -
    51                          'limit_queries'        => true, -
    52                          'LOBs'                 => true, -
    53                          'replace'              => 'emulated', -
    54                          'sub_selects'          => true, -
    55                          'auto_increment'       => false, // implementation is broken -
    56                          'primary_key'          => true, -
    57                          'result_introspection' => true, -
    58                          'prepared_statements'  => true, -
    59                          'identifier_quoting'   => true, -
    60                          'pattern_escaping'     => true, -
    61                          ); -
    62        /** -
    63        $this->options['DBA_username'] = false; -
    64        $this->options['DBA_password'] = false; -
    65        $this->options['database_name_prefix'] = false; -
    66        $this->options['emulate_database'] = true; -
    67        $this->options['default_tablespace'] = false; -
    68        $this->options['default_text_field_length'] = 2000; -
    69        $this->options['result_prefetching'] = false; -
    70        */ -
    71        parent::__construct($manager, $adapter); -
    72    } -
    73 -
    74    /** -
    75     * Sets up the date/time format -
    76     * -
    77     */ -
    78    public function setDateFormat($format = 'YYYY-MM-DD HH24:MI:SS') -
    79    { -
    80      $this->exec('ALTER SESSION SET NLS_DATE_FORMAT = "' . $format . '"'); -
    81    } -
    82 -
    83    /** -
    84     * Adds an driver-specific LIMIT clause to the query -
    85     * -
    86     * @param string $query         query to modify -
    87     * @param integer $limit        limit the number of rows -
    88     * @param integer $offset       start reading from given offset -
    89     * @return string               the modified query -
    90     */ -
    91    public function modifyLimitQuery($query, $limit, $offset) -
    92    { -
    93        /** -
    94        $e      = explode("select ",strtolower($query)); -
    95        $e2     = explode(" from ",$e[1]); -
    96        $fields = $e2[0]; -
    97        */ -
    98        $limit = (int) $limit; -
    99        $offset = (int) $offset; -
    100        if (preg_match('/^\s*SELECT/i', $query)) { -
    101            if ( ! preg_match('/\sFROM\s/i', $query)) { -
    102                $query .= " FROM dual"; -
    103            } -
    104            if ($limit > 0) { -
    105                // taken from http://svn.ez.no/svn/ezcomponents/packages/Database -
    106                $max = $offset + $limit; -
    107                if ($offset > 0) { -
    108                    $min = $offset + 1; -
    109                    $query = 'SELECT * FROM (SELECT a.*, ROWNUM dctrn_rownum FROM (' . $query -
    110                           . ') a WHERE ROWNUM <= ' . $max . ') WHERE dctrn_rownum >= ' . $min; -
    111                } else { -
    112                    $query = 'SELECT a.* FROM (' . $query .') a WHERE ROWNUM <= ' . $max; -
    113                } -
    114            } -
    115        } -
    116        return $query; -
    117    } -
    118}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Oracle_Exception.html b/tests_old/coverage/Doctrine_Connection_Oracle_Exception.html deleted file mode 100644 index 42a520046..000000000 --- a/tests_old/coverage/Doctrine_Connection_Oracle_Exception.html +++ /dev/null @@ -1,251 +0,0 @@ - - - Coverage for Doctrine_Connection_Oracle_Exception - - -

    Coverage for Doctrine_Connection_Oracle_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Exception'); -
    22/** -
    23 * Doctrine_Connection_Oracle_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 * @link        www.phpdoctrine.org -
    33 */ -
    34class Doctrine_Connection_Oracle_Exception extends Doctrine_Connection_Exception -
    35{ -
    36    /** -
    37     * @var array $errorCodeMap         an array that is used for determining portable -
    38     *                                  error code from a native database error code -
    39     */ -
    40    protected static $errorCodeMap = array( -
    41                                      1    => Doctrine::ERR_CONSTRAINT, -
    42                                      900  => Doctrine::ERR_SYNTAX, -
    43                                      904  => Doctrine::ERR_NOSUCHFIELD, -
    44                                      913  => Doctrine::ERR_VALUE_COUNT_ON_ROW, -
    45                                      921  => Doctrine::ERR_SYNTAX, -
    46                                      923  => Doctrine::ERR_SYNTAX, -
    47                                      942  => Doctrine::ERR_NOSUCHTABLE, -
    48                                      955  => Doctrine::ERR_ALREADY_EXISTS, -
    49                                      1400 => Doctrine::ERR_CONSTRAINT_NOT_NULL, -
    50                                      1401 => Doctrine::ERR_INVALID, -
    51                                      1407 => Doctrine::ERR_CONSTRAINT_NOT_NULL, -
    52                                      1418 => Doctrine::ERR_NOT_FOUND, -
    53                                      1476 => Doctrine::ERR_DIVZERO, -
    54                                      1722 => Doctrine::ERR_INVALID_NUMBER, -
    55                                      2289 => Doctrine::ERR_NOSUCHTABLE, -
    56                                      2291 => Doctrine::ERR_CONSTRAINT, -
    57                                      2292 => Doctrine::ERR_CONSTRAINT, -
    58                                      2449 => Doctrine::ERR_CONSTRAINT, -
    59                                      ); -
    60 -
    61    /** -
    62     * This method checks if native error code/message can be -
    63     * converted into a portable code and then adds this -
    64     * portable error code to $portableCode field -
    65     * -
    66     * @param array $errorInfo      error info array -
    67     * @since 1.0 -
    68     * @return boolean              whether or not the error info processing was successfull -
    69     *                              (the process is successfull if portable error code was found) -
    70     */ -
    71    public function processErrorInfo(array $errorInfo) -
    72    { -
    73        $code = $errorInfo[1]; -
    74        if (isset(self::$errorCodeMap[$code])) { -
    75            $this->portableCode = self::$errorCodeMap[$code]; -
    76            return true; -
    77        } -
    78        return false; -
    79    } -
    80}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Pgsql.html b/tests_old/coverage/Doctrine_Connection_Pgsql.html deleted file mode 100644 index e7a2f09fa..000000000 --- a/tests_old/coverage/Doctrine_Connection_Pgsql.html +++ /dev/null @@ -1,596 +0,0 @@ - - - Coverage for Doctrine_Connection_Pgsql - - -

    Coverage for Doctrine_Connection_Pgsql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Pgsql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload("Doctrine_Connection_Common"); -
    22/** -
    23 * Doctrine_Connection_Pgsql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    30 * @version     $Revision: 2963 $ -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 */ -
    34class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common -
    35{ -
    36    /** -
    37     * @var string $driverName                  the name of this connection driver -
    38     */ -
    39    protected $driverName = 'Pgsql'; -
    40 -
    41    /** -
    42     * the constructor -
    43     * -
    44     * @param Doctrine_Manager $manager -
    45     * @param PDO $pdo                          database handle -
    46     */ -
    47    public function __construct(Doctrine_Manager $manager, $adapter) -
    48    { -
    49        // initialize all driver options -
    50        $this->supported = array( -
    51                          'sequences'               => true, -
    52                          'indexes'                 => true, -
    53                          'affected_rows'           => true, -
    54                          'summary_functions'       => true, -
    55                          'order_by_text'           => true, -
    56                          'transactions'            => true, -
    57                          'savepoints'              => true, -
    58                          'current_id'              => true, -
    59                          'limit_queries'           => true, -
    60                          'LOBs'                    => true, -
    61                          'replace'                 => 'emulated', -
    62                          'sub_selects'             => true, -
    63                          'auto_increment'          => 'emulated', -
    64                          'primary_key'             => true, -
    65                          'result_introspection'    => true, -
    66                          'prepared_statements'     => true, -
    67                          'identifier_quoting'      => true, -
    68                          'pattern_escaping'        => true, -
    69                          ); -
    70 -
    71        $this->properties['string_quoting'] = array('start' => "'", -
    72                                                    'end' => "'", -
    73                                                    'escape' => "'", -
    74                                                    'escape_pattern' => '\\'); -
    75 -
    76        $this->properties['identifier_quoting'] = array('start' => '"', -
    77                                                        'end' => '"', -
    78                                                        'escape' => '"'); -
    79        parent::__construct($manager, $adapter); -
    80    } -
    81 -
    82    /** -
    83     * Set the charset on the current connection -
    84     * -
    85     * @param string    charset -
    86     * -
    87     * @return void -
    88     */ -
    89    public function setCharset($charset) -
    90    { -
    91        $query = 'SET NAMES '.$this->dbh->quote($charset); -
    92        $this->exec($query); -
    93    } -
    94 -
    95    /** -
    96     * convertBoolean -
    97     * some drivers need the boolean values to be converted into integers -
    98     * when using DQL API -
    99     * -
    100     * This method takes care of that conversion -
    101     * -
    102     * @param array $item -
    103     * @return void -
    104     */ -
    105    public function convertBooleans($item) -
    106    { -
    107        if (is_array($item)) { -
    108            foreach ($item as $key => $value) { -
    109                if (is_bool($value)) { -
    110                    $item[$key] = ($value) ? 'true' : 'false'; -
    111                } -
    112            } -
    113        } else { -
    114           if (is_bool($item)) { -
    115               $item = ($item) ? 'true' : 'false'; -
    116           } -
    117        } -
    118        return $item; -
    119    } -
    120 -
    121    /** -
    122     * Changes a query string for various DBMS specific reasons -
    123     * -
    124     * @param string $query         query to modify -
    125     * @param integer $limit        limit the number of rows -
    126     * @param integer $offset       start reading from given offset -
    127     * @param boolean $isManip      if the query is a DML query -
    128     * @return string               modified query -
    129     */ -
    130    public function modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false) -
    131    { -
    132        if ($limit > 0) { -
    133            $query = rtrim($query); -
    134 -
    135            if (substr($query, -1) == ';') { -
    136                $query = substr($query, 0, -1); -
    137            } -
    138 -
    139            if ($isManip) { -
    140                $manip = preg_replace('/^(DELETE FROM|UPDATE).*$/', '\\1', $query); -
    141                $from  = $match[2]; -
    142                $where = $match[3]; -
    143                $query = $manip . ' ' . $from . ' WHERE ctid=(SELECT ctid FROM ' -
    144                       . $from . ' ' . $where . ' LIMIT ' . $limit . ')'; -
    145 -
    146            } else { -
    147                if ( ! empty($limit)) { -
    148                  $query .= ' LIMIT ' . $limit; -
    149                } -
    150                if ( ! empty($offset)) { -
    151                  $query .= ' OFFSET ' . $offset; -
    152                } -
    153            } -
    154        } -
    155        return $query; -
    156    } -
    157 -
    158    /** -
    159     * return version information about the server -
    160     * -
    161     * @param string $native    determines if the raw version string should be returned -
    162     * @return array|string     an array or string with version information -
    163     */ -
    164    public function getServerVersion($native = false) -
    165    { -
    166        $query = 'SHOW SERVER_VERSION'; -
    167 -
    168        $serverInfo = $this->fetchOne($query); -
    169 -
    170        if ( ! $native) { -
    171            $tmp = explode('.', $serverInfo, 3); -
    172 -
    173            if (empty($tmp[2]) && isset($tmp[1]) -
    174                && preg_match('/(\d+)(.*)/', $tmp[1], $tmp2) -
    175            ) { -
    176                $serverInfo = array( -
    177                    'major' => $tmp[0], -
    178                    'minor' => $tmp2[1], -
    179                    'patch' => null, -
    180                    'extra' => $tmp2[2], -
    181                    'native' => $serverInfo, -
    182                ); -
    183            } else { -
    184                $serverInfo = array( -
    185                    'major' => isset($tmp[0]) ? $tmp[0] : null, -
    186                    'minor' => isset($tmp[1]) ? $tmp[1] : null, -
    187                    'patch' => isset($tmp[2]) ? $tmp[2] : null, -
    188                    'extra' => null, -
    189                    'native' => $serverInfo, -
    190                ); -
    191            } -
    192        } -
    193        return $serverInfo; -
    194    } -
    195}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Pgsql_Exception.html b/tests_old/coverage/Doctrine_Connection_Pgsql_Exception.html deleted file mode 100644 index 000a8367d..000000000 --- a/tests_old/coverage/Doctrine_Connection_Pgsql_Exception.html +++ /dev/null @@ -1,335 +0,0 @@ - - - Coverage for Doctrine_Connection_Pgsql_Exception - - -

    Coverage for Doctrine_Connection_Pgsql_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Exception'); -
    22/** -
    23 * Doctrine_Connection_Pgsql_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    30 * @author      Paul Cooper <pgc@ucecom.com> (PEAR MDB2 Pgsql driver) -
    31 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    32 * @since       1.0 -
    33 * @version     $Revision: 2963 $ -
    34 */ -
    35class Doctrine_Connection_Pgsql_Exception extends Doctrine_Connection_Exception -
    36{ -
    37    /** -
    38     * @var array $errorRegexps         an array that is used for determining portable -
    39     *                                  error code from a native database error message -
    40     */ -
    41    protected static $errorRegexps = array( -
    42                                    '/parser: parse error at or near/i' -
    43                                        => Doctrine::ERR_SYNTAX, -
    44                                    '/syntax error at/' -
    45                                        => Doctrine::ERR_SYNTAX, -
    46                                    '/column reference .* is ambiguous/i' -
    47                                        => Doctrine::ERR_SYNTAX, -
    48                                    '/column .* (of relation .*)?does not exist/i' -
    49                                        => Doctrine::ERR_NOSUCHFIELD, -
    50                                    '/attribute .* not found|relation .* does not have attribute/i' -
    51                                        => Doctrine::ERR_NOSUCHFIELD, -
    52                                    '/column .* specified in USING clause does not exist in (left|right) table/i' -
    53                                        => Doctrine::ERR_NOSUCHFIELD, -
    54                                    '/(relation|sequence|table).*does not exist|class .* not found/i' -
    55                                        => Doctrine::ERR_NOSUCHTABLE, -
    56                                    '/index .* does not exist/' -
    57                                        => Doctrine::ERR_NOT_FOUND, -
    58                                    '/relation .* already exists/i' -
    59                                        => Doctrine::ERR_ALREADY_EXISTS, -
    60                                    '/(divide|division) by zero$/i' -
    61                                        => Doctrine::ERR_DIVZERO, -
    62                                    '/pg_atoi: error in .*: can\'t parse /i' -
    63                                        => Doctrine::ERR_INVALID_NUMBER, -
    64                                    '/invalid input syntax for( type)? (integer|numeric)/i' -
    65                                        => Doctrine::ERR_INVALID_NUMBER, -
    66                                    '/value .* is out of range for type \w*int/i' -
    67                                        => Doctrine::ERR_INVALID_NUMBER, -
    68                                    '/integer out of range/i' -
    69                                        => Doctrine::ERR_INVALID_NUMBER, -
    70                                    '/value too long for type character/i' -
    71                                        => Doctrine::ERR_INVALID, -
    72                                    '/permission denied/' -
    73                                        => Doctrine::ERR_ACCESS_VIOLATION, -
    74                                    '/violates [\w ]+ constraint/' -
    75                                        => Doctrine::ERR_CONSTRAINT, -
    76                                    '/referential integrity violation/' -
    77                                        => Doctrine::ERR_CONSTRAINT, -
    78                                    '/violates not-null constraint/' -
    79                                        => Doctrine::ERR_CONSTRAINT_NOT_NULL, -
    80                                    '/more expressions than target columns/i' -
    81                                        => Doctrine::ERR_VALUE_COUNT_ON_ROW, -
    82                                ); -
    83 -
    84    /** -
    85     * This method checks if native error code/message can be -
    86     * converted into a portable code and then adds this -
    87     * portable error code to $portableCode field -
    88     * -
    89     * the portable error code is added at the end of array -
    90     * -
    91     * @param array $errorInfo      error info array -
    92     * @since 1.0 -
    93     * @see Doctrine::ERR_* constants -
    94     * @see Doctrine_Connection::$portableCode -
    95     * @return boolean              whether or not the error info processing was successfull -
    96     *                              (the process is successfull if portable error code was found) -
    97     */ -
    98    public function processErrorInfo(array $errorInfo) -
    99    { -
    100        foreach (self::$errorRegexps as $regexp => $code) { -
    101            if (preg_match($regexp, $errorInfo[2])) { -
    102                $this->portableCode = $code; -
    103                return true; -
    104            } -
    105        } -
    106        return false; -
    107    } -
    108}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Profiler.html b/tests_old/coverage/Doctrine_Connection_Profiler.html deleted file mode 100644 index d5646324d..000000000 --- a/tests_old/coverage/Doctrine_Connection_Profiler.html +++ /dev/null @@ -1,560 +0,0 @@ - - - Coverage for Doctrine_Connection_Profiler - - -

    Coverage for Doctrine_Connection_Profiler

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Overloadable'); -
    22/** -
    23 * Doctrine_Connection_Profiler -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 */ -
    33class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAggregate, Countable -
    34{ -
    35    /** -
    36     * @param array $listeners      an array containing all availible listeners -
    37     */ -
    38    private $listeners  = array('query', -
    39                                'prepare', -
    40                                'commit', -
    41                                'rollback', -
    42                                'connect', -
    43                                'begintransaction', -
    44                                'exec', -
    45                                'execute', -
    46                                ); -
    47 -
    48    /** -
    49     * @param array $events         an array containing all listened events -
    50     */ -
    51    private $events     = array(); -
    52 -
    53    /** -
    54     * constructor -
    55     */ -
    56    public function __construct() { -
    57 -
    58    } -
    59 -
    60    /** -
    61     * setFilterQueryType -
    62     * -
    63     * @param integer $filter -
    64     * @return boolean -
    65     */ -
    66    public function setFilterQueryType() { -
    67                                              -
    68    }                                          -
    69    /** -
    70     * method overloader -
    71     * this method is used for invoking different listeners, for the full -
    72     * list of availible listeners, see Doctrine_EventListener -
    73     * -
    74     * @param string $m     the name of the method -
    75     * @param array $a      method arguments -
    76     * @see Doctrine_EventListener -
    77     * @return boolean -
    78     */ -
    79    public function __call($m, $a) -
    80    { -
    81        // first argument should be an instance of Doctrine_Event -
    82        if ( ! ($a[0] instanceof Doctrine_Event)) { -
    83            throw new Doctrine_Connection_Profiler_Exception("Couldn't listen event. Event should be an instance of Doctrine_Event."); -
    84        } -
    85 -
    86 -
    87        if (substr($m, 0, 3) === 'pre') { -
    88            // pre-event listener found -
    89            $a[0]->start(); -
    90 -
    91            if ( ! in_array($a[0], $this->events, true)) { -
    92                $this->events[] = $a[0]; -
    93            } -
    94        } else { -
    95            // after-event listener found -
    96            $a[0]->end(); -
    97        } -
    98        /** -
    99         * If filtering by query type is enabled, only keep the query if -
    100         * it was one of the allowed types. -
    101         */ -
    102         /** -
    103        if ( ! is_null($this->filterTypes)) { -
    104            if ( ! ($a[0]->getQueryType() & $this->_filterTypes)) { -
    105 -
    106            } -
    107        } -
    108        */ -
    109 -
    110    } -
    111 -
    112    /** -
    113     * get -
    114     * -
    115     * @param mixed $key -
    116     * @return Doctrine_Event -
    117     */ -
    118    public function get($key)  -
    119    { -
    120        if (isset($this->events[$key])) { -
    121            return $this->events[$key]; -
    122        } -
    123        return null; -
    124    } -
    125 -
    126    /** -
    127     * getAll -
    128     * returns all profiled events as an array -
    129     * -
    130     * @return array        all events in an array -
    131     */ -
    132    public function getAll()  -
    133    { -
    134        return $this->events; -
    135    } -
    136 -
    137    /** -
    138     * getIterator -
    139     * returns an iterator that iterates through the logged events -
    140     * -
    141     * @return ArrayIterator -
    142     */ -
    143    public function getIterator() -
    144    { -
    145        return new ArrayIterator($this->events); -
    146    } -
    147 -
    148    /** -
    149     * count -
    150     *  -
    151     * @return integer -
    152     */ -
    153    public function count()  -
    154    { -
    155        return count($this->events); -
    156    } -
    157 -
    158    /** -
    159     * pop the last event from the event stack -
    160     * -
    161     * @return Doctrine_Event -
    162     */ -
    163    public function pop()  -
    164    { -
    165        return array_pop($this->events); -
    166    } -
    167 -
    168    /** -
    169     * Get the Doctrine_Event object for the last query that was run, regardless if it has -
    170     * ended or not. If the event has not ended, it's end time will be Null. -
    171     * -
    172     * @return Doctrine_Event -
    173     */ -
    174    public function lastEvent() -
    175    { -
    176        if (empty($this->events)) { -
    177            return false; -
    178        } -
    179 -
    180        end($this->events); -
    181        return current($this->events); -
    182    } -
    183}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Sqlite.html b/tests_old/coverage/Doctrine_Connection_Sqlite.html deleted file mode 100644 index ab64b9678..000000000 --- a/tests_old/coverage/Doctrine_Connection_Sqlite.html +++ /dev/null @@ -1,342 +0,0 @@ - - - Coverage for Doctrine_Connection_Sqlite - - -

    Coverage for Doctrine_Connection_Sqlite

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Sqlite.php 3032 2007-10-29 19:50:16Z meus $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22Doctrine::autoload("Doctrine_Connection_Common"); -
    23 -
    24/** -
    25 * Doctrine_Connection_Sqlite -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Connection -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    31 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    32 * @version     $Revision: 3032 $ -
    33 * @link        www.phpdoctrine.org -
    34 * @since       1.0 -
    35 */ -
    36class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common -
    37{ -
    38    /** -
    39     * @var string $driverName                  the name of this connection driver -
    40     */ -
    41    protected $driverName = 'Sqlite'; -
    42 -
    43    /** -
    44     * the constructor -
    45     * -
    46     * @param Doctrine_Manager $manager -
    47     * @param PDO $pdo                          database handle -
    48     */ -
    49    public function __construct(Doctrine_Manager $manager, $adapter) -
    50    { -
    51        $this->supported = array('sequences'            => 'emulated', -
    52                          'indexes'              => true, -
    53                          'affected_rows'        => true, -
    54                          'summary_functions'    => true, -
    55                          'order_by_text'        => true, -
    56                          'current_id'           => 'emulated', -
    57                          'limit_queries'        => true, -
    58                          'LOBs'                 => true, -
    59                          'replace'              => true, -
    60                          'transactions'         => true, -
    61                          'savepoints'           => false, -
    62                          'sub_selects'          => true, -
    63                          'auto_increment'       => true, -
    64                          'primary_key'          => true, -
    65                          'result_introspection' => false, // not implemented -
    66                          'prepared_statements'  => 'emulated', -
    67                          'identifier_quoting'   => true, -
    68                          'pattern_escaping'     => false, -
    69                          ); -
    70         parent::__construct($manager, $adapter); -
    71 -
    72        if ($this->isConnected) { -
    73            $this->dbh->sqliteCreateFunction('mod',    array('Doctrine_Expression_Sqlite', 'modImpl'), 2); -
    74            $this->dbh->sqliteCreateFunction('concat', array('Doctrine_Expression_Sqlite', 'concatImpl')); -
    75            $this->dbh->sqliteCreateFunction('md5', 'md5', 1); -
    76            $this->dbh->sqliteCreateFunction('now', 'time', 0); -
    77        } -
    78    } -
    79 -
    80    /** -
    81     * initializes database functions missing in sqlite -
    82     * -
    83     * @see Doctrine_Expression -
    84     * @return void -
    85     */ -
    86    public function connect()  -
    87    { -
    88        if ($this->isConnected) { -
    89            return false; -
    90        } -
    91 -
    92        parent::connect(); -
    93 -
    94        $this->dbh->sqliteCreateFunction('mod',    array('Doctrine_Expression_Sqlite', 'modImpl'), 2); -
    95        $this->dbh->sqliteCreateFunction('concat', array('Doctrine_Expression_Sqlite', 'concatImpl')); -
    96        $this->dbh->sqliteCreateFunction('md5', 'md5', 1); -
    97        $this->dbh->sqliteCreateFunction('now', 'time', 0); -
    98    } -
    99 -
    100    /** -
    101     * getDatabaseFile -
    102     * -
    103     * @param string $name      the name of the database -
    104     * @return string -
    105     */ -
    106    public function getDatabaseFile($name) -
    107    { -
    108        return $name . '.db'; -
    109    } -
    110} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Sqlite_Exception.html b/tests_old/coverage/Doctrine_Connection_Sqlite_Exception.html deleted file mode 100644 index f01f7231c..000000000 --- a/tests_old/coverage/Doctrine_Connection_Sqlite_Exception.html +++ /dev/null @@ -1,245 +0,0 @@ - - - Coverage for Doctrine_Connection_Sqlite_Exception - - -

    Coverage for Doctrine_Connection_Sqlite_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Exception'); -
    22/** -
    23 * Doctrine_Connection_Sqlite_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 * @link        www.phpdoctrine.org -
    33 */ -
    34class Doctrine_Connection_Sqlite_Exception extends Doctrine_Connection_Exception -
    35{ -
    36    /** -
    37     * @var array $errorRegexps         an array that is used for determining portable -
    38     *                                  error code from a native database error message -
    39     */ -
    40    protected static $errorRegexps = array( -
    41                              '/^no such table:/'                    => Doctrine::ERR_NOSUCHTABLE, -
    42                              '/^no such index:/'                    => Doctrine::ERR_NOT_FOUND, -
    43                              '/^(table|index) .* already exists$/'  => Doctrine::ERR_ALREADY_EXISTS, -
    44                              '/PRIMARY KEY must be unique/i'        => Doctrine::ERR_CONSTRAINT, -
    45                              '/is not unique/'                      => Doctrine::ERR_CONSTRAINT, -
    46                              '/columns .* are not unique/i'         => Doctrine::ERR_CONSTRAINT, -
    47                              '/uniqueness constraint failed/'       => Doctrine::ERR_CONSTRAINT, -
    48                              '/may not be NULL/'                    => Doctrine::ERR_CONSTRAINT_NOT_NULL, -
    49                              '/^no such column:/'                   => Doctrine::ERR_NOSUCHFIELD, -
    50                              '/column not present in both tables/i' => Doctrine::ERR_NOSUCHFIELD, -
    51                              '/^near ".*": syntax error$/'          => Doctrine::ERR_SYNTAX, -
    52                              '/[0-9]+ values for [0-9]+ columns/i'  => Doctrine::ERR_VALUE_COUNT_ON_ROW, -
    53                              ); -
    54 -
    55    /** -
    56     * This method checks if native error code/message can be -
    57     * converted into a portable code and then adds this -
    58     * portable error code to $portableCode field -
    59     * -
    60     * @param array $errorInfo      error info array -
    61     * @since 1.0 -
    62     * @see Doctrine::ERR_* constants -
    63     * @see Doctrine_Connection::$portableCode -
    64     * @return boolean              whether or not the error info processing was successfull -
    65     *                              (the process is successfull if portable error code was found) -
    66     */ -
    67    public function processErrorInfo(array $errorInfo) -
    68    { -
    69        foreach (self::$errorRegexps as $regexp => $code) { -
    70            if (preg_match($regexp, $errorInfo[2])) { -
    71 -
    72                $this->portableCode = $code; -
    73                return true; -
    74            } -
    75        } -
    76        return false; -
    77    } -
    78}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_Statement.html b/tests_old/coverage/Doctrine_Connection_Statement.html deleted file mode 100644 index 81c11d37a..000000000 --- a/tests_old/coverage/Doctrine_Connection_Statement.html +++ /dev/null @@ -1,1389 +0,0 @@ - - - Coverage for Doctrine_Connection_Statement - - -

    Coverage for Doctrine_Connection_Statement

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Statement.php 1532 2007-05-31 17:45:07Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Adapter_Statement_Interface'); -
    22/** -
    23 * Doctrine_Connection_Statement -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 1532 $ -
    32 */ -
    33class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interface -
    34{ -
    35    /** -
    36     * @var Doctrine_Connection $conn       Doctrine_Connection object, every connection -
    37     *                                      statement holds an instance of Doctrine_Connection -
    38     */ -
    39    protected $_conn; -
    40 -
    41    /** -
    42     * @var mixed $_stmt                    PDOStatement object, boolean false or Doctrine_Adapter_Statement object -
    43     */ -
    44    protected $_stmt; -
    45 -
    46    /** -
    47     * constructor -
    48     * -
    49     * @param Doctrine_Connection $conn     Doctrine_Connection object, every connection -
    50     *                                      statement holds an instance of Doctrine_Connection -
    51     * @param mixed $stmt -
    52     */ -
    53    public function __construct(Doctrine_Connection $conn, $stmt) -
    54    { -
    55        $this->_conn = $conn; -
    56        $this->_stmt = $stmt; -
    57 -
    58        if ($stmt === false) { -
    59            throw new Doctrine_Exception('Unknown statement object given.'); -
    60        } -
    61    } -
    62 -
    63    /** -
    64     * getConnection -
    65     * returns the connection object this statement uses -
    66     * -
    67     * @return Doctrine_Connection -
    68     */ -
    69    public function getConnection() -
    70    { -
    71        return $this->_conn; -
    72    } -
    73    public function getStatement() -
    74    { -
    75        return $this->_stmt; -
    76    } -
    77    public function getQuery() -
    78    { -
    79        return $this->_stmt->queryString; -
    80    } -
    81 -
    82    /** -
    83     * bindColumn -
    84     * Bind a column to a PHP variable -
    85     * -
    86     * @param mixed $column         Number of the column (1-indexed) or name of the column in the result set. -
    87     *                              If using the column name, be aware that the name should match -
    88     *                              the case of the column, as returned by the driver. -
    89     * -
    90     * @param string $param         Name of the PHP variable to which the column will be bound. -
    91     * @param integer $type         Data type of the parameter, specified by the Doctrine::PARAM_* constants. -
    92     * @return boolean              Returns TRUE on success or FALSE on failure -
    93     */ -
    94    public function bindColumn($column, $param, $type = null) -
    95    { -
    96        if ($type === null) { -
    97            return $this->_stmt->bindColumn($column, $param); -
    98        } else { -
    99            return $this->_stmt->bindColumn($column, $param, $type); -
    100        } -
    101    } -
    102 -
    103    /** -
    104     * bindValue -
    105     * Binds a value to a corresponding named or question mark -
    106     * placeholder in the SQL statement that was use to prepare the statement. -
    107     * -
    108     * @param mixed $param          Parameter identifier. For a prepared statement using named placeholders, -
    109     *                              this will be a parameter name of the form :name. For a prepared statement -
    110     *                              using question mark placeholders, this will be the 1-indexed position of the parameter -
    111     * -
    112     * @param mixed $value          The value to bind to the parameter. -
    113     * @param integer $type         Explicit data type for the parameter using the Doctrine::PARAM_* constants. -
    114     * -
    115     * @return boolean              Returns TRUE on success or FALSE on failure. -
    116     */ -
    117    public function bindValue($param, $value, $type = null) -
    118    { -
    119        if ($type === null) { -
    120            return $this->_stmt->bindValue($param, $value); -
    121        } else { -
    122            return $this->_stmt->bindValue($param, $value, $type); -
    123        } -
    124    } -
    125 -
    126    /** -
    127     * bindParam -
    128     * Binds a PHP variable to a corresponding named or question mark placeholder in the -
    129     * SQL statement that was use to prepare the statement. Unlike Doctrine_Adapter_Statement_Interface->bindValue(), -
    130     * the variable is bound as a reference and will only be evaluated at the time -
    131     * that Doctrine_Adapter_Statement_Interface->execute() is called. -
    132     * -
    133     * Most parameters are input parameters, that is, parameters that are -
    134     * used in a read-only fashion to build up the query. Some drivers support the invocation -
    135     * of stored procedures that return data as output parameters, and some also as input/output -
    136     * parameters that both send in data and are updated to receive it. -
    137     * -
    138     * @param mixed $param          Parameter identifier. For a prepared statement using named placeholders, -
    139     *                              this will be a parameter name of the form :name. For a prepared statement -
    140     *                              using question mark placeholders, this will be the 1-indexed position of the parameter -
    141     * -
    142     * @param mixed $variable       Name of the PHP variable to bind to the SQL statement parameter. -
    143     * -
    144     * @param integer $type         Explicit data type for the parameter using the Doctrine::PARAM_* constants. To return -
    145     *                              an INOUT parameter from a stored procedure, use the bitwise OR operator to set the -
    146     *                              Doctrine::PARAM_INPUT_OUTPUT bits for the data_type parameter. -
    147     * -
    148     * @param integer $length       Length of the data type. To indicate that a parameter is an OUT parameter -
    149     *                              from a stored procedure, you must explicitly set the length. -
    150     * @param mixed $driverOptions -
    151     * @return boolean              Returns TRUE on success or FALSE on failure. -
    152     */ -
    153    public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array()) -
    154    { -
    155        if ($type === null) { -
    156            return $this->_stmt->bindParam($column, $variable); -
    157        } else { -
    158            return $this->_stmt->bindParam($column, $variable, $type, $length, $driverOptions); -
    159        } -
    160    } -
    161 -
    162    /** -
    163     * closeCursor -
    164     * Closes the cursor, enabling the statement to be executed again. -
    165     * -
    166     * @return boolean              Returns TRUE on success or FALSE on failure. -
    167     */ -
    168    public function closeCursor() -
    169    { -
    170        return $this->_stmt->closeCursor(); -
    171    } -
    172 -
    173    /** -
    174     * columnCount -
    175     * Returns the number of columns in the result set -
    176     * -
    177     * @return integer              Returns the number of columns in the result set represented -
    178     *                              by the Doctrine_Adapter_Statement_Interface object. If there is no result set, -
    179     *                              this method should return 0. -
    180     */ -
    181    public function columnCount() -
    182    { -
    183        return $this->_stmt->columnCount(); -
    184    } -
    185 -
    186    /** -
    187     * errorCode -
    188     * Fetch the SQLSTATE associated with the last operation on the statement handle -
    189     * -
    190     * @see Doctrine_Adapter_Interface::errorCode() -
    191     * @return string       error code string -
    192     */ -
    193    public function errorCode() -
    194    { -
    195        return $this->_stmt->errorCode(); -
    196    } -
    197 -
    198    /** -
    199     * errorInfo -
    200     * Fetch extended error information associated with the last operation on the statement handle -
    201     * -
    202     * @see Doctrine_Adapter_Interface::errorInfo() -
    203     * @return array        error info array -
    204     */ -
    205    public function errorInfo() -
    206    { -
    207        return $this->_stmt->errorInfo(); -
    208    } -
    209 -
    210    /** -
    211     * execute -
    212     * Executes a prepared statement -
    213     * -
    214     * If the prepared statement included parameter markers, you must either: -
    215     * call PDOStatement->bindParam() to bind PHP variables to the parameter markers: -
    216     * bound variables pass their value as input and receive the output value, -
    217     * if any, of their associated parameter markers or pass an array of input-only -
    218     * parameter values -
    219     * -
    220     * -
    221     * @param array $params             An array of values with as many elements as there are -
    222     *                                  bound parameters in the SQL statement being executed. -
    223     * @return boolean                  Returns TRUE on success or FALSE on failure. -
    224     */ -
    225    public function execute($params = null) -
    226    { -
    227        try { -
    228            $event = new Doctrine_Event($this, Doctrine_Event::STMT_EXECUTE, $this->getQuery(), $params); -
    229            $this->_conn->getListener()->preStmtExecute($event); -
    230 -
    231            $result = true; -
    232            if ( ! $event->skipOperation) { -
    233                $result = $this->_stmt->execute($params); -
    234                $this->_conn->incrementQueryCount(); -
    235            } -
    236 -
    237            $this->_conn->getListener()->postStmtExecute($event); -
    238 -
    239            return $result; -
    240        } catch (PDOException $e) { -
    241        } catch (Doctrine_Adapter_Exception $e) { -
    242        } -
    243 -
    244        $this->_conn->rethrowException($e, $this); -
    245 -
    246        return false; -
    247    } -
    248 -
    249    /** -
    250     * fetch -
    251     * -
    252     * @see Doctrine::FETCH_* constants -
    253     * @param integer $fetchStyle           Controls how the next row will be returned to the caller. -
    254     *                                      This value must be one of the Doctrine::FETCH_* constants, -
    255     *                                      defaulting to Doctrine::FETCH_BOTH -
    256     * -
    257     * @param integer $cursorOrientation    For a PDOStatement object representing a scrollable cursor, -
    258     *                                      this value determines which row will be returned to the caller. -
    259     *                                      This value must be one of the Doctrine::FETCH_ORI_* constants, defaulting to -
    260     *                                      Doctrine::FETCH_ORI_NEXT. To request a scrollable cursor for your -
    261     *                                      Doctrine_Adapter_Statement_Interface object, -
    262     *                                      you must set the Doctrine::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you -
    263     *                                      prepare the SQL statement with Doctrine_Adapter_Interface->prepare(). -
    264     * -
    265     * @param integer $cursorOffset         For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for which the -
    266     *                                      $cursorOrientation parameter is set to Doctrine::FETCH_ORI_ABS, this value specifies -
    267     *                                      the absolute number of the row in the result set that shall be fetched. -
    268     * -
    269     *                                      For a Doctrine_Adapter_Statement_Interface object representing a scrollable cursor for -
    270     *                                      which the $cursorOrientation parameter is set to Doctrine::FETCH_ORI_REL, this value -
    271     *                                      specifies the row to fetch relative to the cursor position before -
    272     *                                      Doctrine_Adapter_Statement_Interface->fetch() was called. -
    273     * -
    274     * @return mixed -
    275     */ -
    276    public function fetch($fetchMode = Doctrine::FETCH_BOTH, -
    277                          $cursorOrientation = Doctrine::FETCH_ORI_NEXT, -
    278                          $cursorOffset = null) -
    279    { -
    280        $event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCH, $this->getQuery()); -
    281 -
    282        $event->fetchMode = $fetchMode; -
    283        $event->cursorOrientation = $cursorOrientation; -
    284        $event->cursorOffset = $cursorOffset; -
    285 -
    286        $data = $this->_conn->getListener()->preFetch($event); -
    287 -
    288        if ( ! $event->skipOperation) { -
    289            $data = $this->_stmt->fetch($fetchMode, $cursorOrientation, $cursorOffset); -
    290        } -
    291 -
    292        $this->_conn->getListener()->postFetch($event); -
    293 -
    294        return $data; -
    295    } -
    296 -
    297    /** -
    298     * fetchAll -
    299     * Returns an array containing all of the result set rows -
    300     * -
    301     * @param integer $fetchMode            Controls how the next row will be returned to the caller. -
    302     *                                      This value must be one of the Doctrine::FETCH_* constants, -
    303     *                                      defaulting to Doctrine::FETCH_BOTH -
    304     * -
    305     * @param integer $columnIndex          Returns the indicated 0-indexed column when the value of $fetchStyle is -
    306     *                                      Doctrine::FETCH_COLUMN. Defaults to 0. -
    307     * -
    308     * @return array -
    309     */ -
    310    public function fetchAll($fetchMode = Doctrine::FETCH_BOTH, -
    311                             $columnIndex = null) -
    312    { -
    313        $event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCHALL, $this->getQuery()); -
    314        $event->fetchMode = $fetchMode; -
    315        $event->columnIndex = $columnIndex; -
    316 -
    317        $this->_conn->getListener()->preFetchAll($event); -
    318 -
    319        if ( ! $event->skipOperation) { -
    320            if ($columnIndex !== null) { -
    321                $data = $this->_stmt->fetchAll($fetchMode, $columnIndex); -
    322            } else { -
    323                $data = $this->_stmt->fetchAll($fetchMode); -
    324            } -
    325 -
    326            $event->data = $data; -
    327        } -
    328 -
    329        $this->_conn->getListener()->postFetchAll($event); -
    330 -
    331        return $data; -
    332    } -
    333 -
    334    /** -
    335     * fetchColumn -
    336     * Returns a single column from the next row of a -
    337     * result set or FALSE if there are no more rows. -
    338     * -
    339     * @param integer $columnIndex          0-indexed number of the column you wish to retrieve from the row. If no -
    340     *                                      value is supplied, Doctrine_Adapter_Statement_Interface->fetchColumn() -
    341     *                                      fetches the first column. -
    342     * -
    343     * @return string                       returns a single column in the next row of a result set. -
    344     */ -
    345    public function fetchColumn($columnIndex = 0) -
    346    { -
    347        return $this->_stmt->fetchColumn($columnIndex); -
    348    } -
    349 -
    350    /** -
    351     * fetchObject -
    352     * Fetches the next row and returns it as an object. -
    353     * -
    354     * Fetches the next row and returns it as an object. This function is an alternative to -
    355     * Doctrine_Adapter_Statement_Interface->fetch() with Doctrine::FETCH_CLASS or Doctrine::FETCH_OBJ style. -
    356     * -
    357     * @param string $className             Name of the created class, defaults to stdClass. -
    358     * @param array $args                   Elements of this array are passed to the constructor. -
    359     * -
    360     * @return mixed                        an instance of the required class with property names that correspond -
    361     *                                      to the column names or FALSE in case of an error. -
    362     */ -
    363    public function fetchObject($className = 'stdClass', $args = array()) -
    364    { -
    365        return $this->_stmt->fetchObject($className, $args); -
    366    } -
    367 -
    368    /** -
    369     * getAttribute -
    370     * Retrieve a statement attribute -
    371     * -
    372     * @param integer $attribute -
    373     * @see Doctrine::ATTR_* constants -
    374     * @return mixed                        the attribute value -
    375     */ -
    376    public function getAttribute($attribute) -
    377    { -
    378        return $this->_stmt->getAttribute($attribute); -
    379    } -
    380 -
    381    /** -
    382     * getColumnMeta -
    383     * Returns metadata for a column in a result set -
    384     * -
    385     * @param integer $column               The 0-indexed column in the result set. -
    386     * -
    387     * @return array                        Associative meta data array with the following structure: -
    388     * -
    389     *          native_type                 The PHP native type used to represent the column value. -
    390     *          driver:decl_                type The SQL type used to represent the column value in the database. If the column in the result set is the result of a function, this value is not returned by PDOStatement->getColumnMeta(). -
    391     *          flags                       Any flags set for this column. -
    392     *          name                        The name of this column as returned by the database. -
    393     *          len                         The length of this column. Normally -1 for types other than floating point decimals. -
    394     *          precision                   The numeric precision of this column. Normally 0 for types other than floating point decimals. -
    395     *          pdo_type                    The type of this column as represented by the PDO::PARAM_* constants. -
    396     */ -
    397    public function getColumnMeta($column) -
    398    { -
    399        return $this->_stmt->getColumnMeta($column); -
    400    } -
    401 -
    402    /** -
    403     * nextRowset -
    404     * Advances to the next rowset in a multi-rowset statement handle -
    405     * -
    406     * Some database servers support stored procedures that return more than one rowset -
    407     * (also known as a result set). The nextRowset() method enables you to access the second -
    408     * and subsequent rowsets associated with a PDOStatement object. Each rowset can have a -
    409     * different set of columns from the preceding rowset. -
    410     * -
    411     * @return boolean                      Returns TRUE on success or FALSE on failure. -
    412     */ -
    413    public function nextRowset() -
    414    { -
    415        return $this->_stmt->nextRowset(); -
    416    } -
    417 -
    418    /** -
    419     * rowCount -
    420     * rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement -
    421     * executed by the corresponding object. -
    422     * -
    423     * If the last SQL statement executed by the associated Statement object was a SELECT statement, -
    424     * some databases may return the number of rows returned by that statement. However, -
    425     * this behaviour is not guaranteed for all databases and should not be -
    426     * relied on for portable applications. -
    427     * -
    428     * @return integer                      Returns the number of rows. -
    429     */ -
    430    public function rowCount() -
    431    { -
    432        return $this->_stmt->rowCount(); -
    433    } -
    434 -
    435    /** -
    436     * setAttribute -
    437     * Set a statement attribute -
    438     * -
    439     * @param integer $attribute -
    440     * @param mixed $value                  the value of given attribute -
    441     * @return boolean                      Returns TRUE on success or FALSE on failure. -
    442     */ -
    443    public function setAttribute($attribute, $value) -
    444    { -
    445        return $this->_stmt->setAttribute($attribute, $value); -
    446    } -
    447 -
    448    /** -
    449     * setFetchMode -
    450     * Set the default fetch mode for this statement -
    451     * -
    452     * @param integer $mode                 The fetch mode must be one of the Doctrine::FETCH_* constants. -
    453     * @return boolean                      Returns 1 on success or FALSE on failure. -
    454     */ -
    455    public function setFetchMode($mode, $arg1 = null, $arg2 = null) -
    456    { -
    457        return $this->_stmt->setFetchMode($mode, $arg1, $arg2); -
    458    } -
    459} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Connection_UnitOfWork.html b/tests_old/coverage/Doctrine_Connection_UnitOfWork.html deleted file mode 100644 index b36ab6554..000000000 --- a/tests_old/coverage/Doctrine_Connection_UnitOfWork.html +++ /dev/null @@ -1,2139 +0,0 @@ - - - Coverage for Doctrine_Connection_UnitOfWork - - -

    Coverage for Doctrine_Connection_UnitOfWork

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: UnitOfWork.php 3195 2007-11-20 14:26:42Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * Doctrine_Connection_UnitOfWork -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Connection -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3195 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module -
    34{ -
    35    /** -
    36     * buildFlushTree -
    37     * builds a flush tree that is used in transactions -
    38     * -
    39     * The returned array has all the initialized components in -
    40     * 'correct' order. Basically this means that the records of those -
    41     * components can be saved safely in the order specified by the returned array. -
    42     * -
    43     * @param array $tables     an array of Doctrine_Table objects or component names -
    44     * @return array            an array of component names in flushing order -
    45     */ -
    46    public function buildFlushTree(array $tables) -
    47    { -
    48        $tree = array(); -
    49        foreach ($tables as $k => $table) { -
    50 -
    51            if ( ! ($table instanceof Doctrine_Table)) { -
    52                $table = $this->conn->getTable($table, false); -
    53            } -
    54            $nm     = $table->getComponentName(); -
    55 -
    56            $index  = array_search($nm, $tree); -
    57 -
    58            if ($index === false) { -
    59                $tree[] = $nm; -
    60                $index  = max(array_keys($tree)); -
    61            } -
    62 -
    63            $rels = $table->getRelations(); -
    64 -
    65            // group relations -
    66 -
    67            foreach ($rels as $key => $rel) { -
    68                if ($rel instanceof Doctrine_Relation_ForeignKey) { -
    69                    unset($rels[$key]); -
    70                    array_unshift($rels, $rel); -
    71                } -
    72            } -
    73 -
    74            foreach ($rels as $rel) { -
    75                $name   = $rel->getTable()->getComponentName(); -
    76                $index2 = array_search($name,$tree); -
    77                $type   = $rel->getType(); -
    78 -
    79                // skip self-referenced relations -
    80                if ($name === $nm) { -
    81                    continue; -
    82                } -
    83 -
    84                if ($rel instanceof Doctrine_Relation_ForeignKey) { -
    85                    if ($index2 !== false) { -
    86                        if ($index2 >= $index) -
    87                            continue; -
    88 -
    89                        unset($tree[$index]); -
    90                        array_splice($tree,$index2,0,$nm); -
    91                        $index = $index2; -
    92                    } else { -
    93                        $tree[] = $name; -
    94                    } -
    95 -
    96                } elseif ($rel instanceof Doctrine_Relation_LocalKey) { -
    97                    if ($index2 !== false) { -
    98                        if ($index2 <= $index) -
    99                            continue; -
    100 -
    101                        unset($tree[$index2]); -
    102                        array_splice($tree,$index,0,$name); -
    103                    } else { -
    104                        array_unshift($tree,$name); -
    105                        $index++; -
    106                    } -
    107                } elseif ($rel instanceof Doctrine_Relation_Association) { -
    108                    $t = $rel->getAssociationFactory(); -
    109                    $n = $t->getComponentName(); -
    110 -
    111                    if ($index2 !== false) -
    112                        unset($tree[$index2]); -
    113 -
    114                    array_splice($tree, $index, 0, $name); -
    115                    $index++; -
    116 -
    117                    $index3 = array_search($n, $tree); -
    118 -
    119                    if ($index3 !== false) { -
    120                        if ($index3 >= $index) -
    121                            continue; -
    122 -
    123                        unset($tree[$index]); -
    124                        array_splice($tree, $index3, 0, $n); -
    125                        $index = $index2; -
    126                    } else { -
    127                        $tree[] = $n; -
    128                    } -
    129                } -
    130            } -
    131        } -
    132        return array_values($tree); -
    133    } -
    134 -
    135    /** -
    136     * saves the given record -
    137     * -
    138     * @param Doctrine_Record $record -
    139     * @return void -
    140     */ -
    141    public function saveGraph(Doctrine_Record $record) -
    142    { -
    143        $conn = $this->getConnection(); -
    144 -
    145        $state = $record->state(); -
    146        if ($state === Doctrine_Record::STATE_LOCKED) { -
    147            return false; -
    148        } -
    149 -
    150        $record->state(Doctrine_Record::STATE_LOCKED); -
    151         -
    152        $conn->beginTransaction(); -
    153        $saveLater = $this->saveRelated($record); -
    154 -
    155        $record->state($state); -
    156 -
    157        if ($record->isValid()) { -
    158            $event = new Doctrine_Event($record, Doctrine_Event::RECORD_SAVE); -
    159 -
    160            $record->preSave($event); -
    161 -
    162            $record->getTable()->getRecordListener()->preSave($event); -
    163            $state = $record->state(); -
    164 -
    165            if ( ! $event->skipOperation) { -
    166                switch ($state) { -
    167                    case Doctrine_Record::STATE_TDIRTY: -
    168                        $this->insert($record); -
    169                        break; -
    170                    case Doctrine_Record::STATE_DIRTY: -
    171                    case Doctrine_Record::STATE_PROXY: -
    172                        $this->update($record); -
    173                        break; -
    174                    case Doctrine_Record::STATE_CLEAN: -
    175                    case Doctrine_Record::STATE_TCLEAN: -
    176 -
    177                        break; -
    178                } -
    179            } -
    180 -
    181            $record->getTable()->getRecordListener()->postSave($event); -
    182              -
    183            $record->postSave($event); -
    184        } else { -
    185            $conn->transaction->addInvalid($record); -
    186        } -
    187 -
    188        $state = $record->state(); -
    189 -
    190        $record->state(Doctrine_Record::STATE_LOCKED); -
    191 -
    192        foreach ($saveLater as $fk) { -
    193            $alias = $fk->getAlias(); -
    194 -
    195            if ($record->hasReference($alias)) { -
    196                $obj = $record->$alias; -
    197             -
    198                // check that the related object is not an instance of Doctrine_Null -
    199                if ( ! ($obj instanceof Doctrine_Null)) { -
    200                    $obj->save($conn); -
    201                } -
    202            } -
    203        } -
    204 -
    205        // save the MANY-TO-MANY associations -
    206        $this->saveAssociations($record); -
    207 -
    208        $record->state($state); -
    209         -
    210        $conn->commit(); -
    211 -
    212        return true; -
    213    } -
    214 -
    215    /** -
    216     * saves the given record -
    217     * -
    218     * @param Doctrine_Record $record -
    219     * @return void -
    220     */ -
    221    public function save(Doctrine_Record $record) -
    222    { -
    223        $event = new Doctrine_Event($record, Doctrine_Event::RECORD_SAVE); -
    224 -
    225        $record->preSave($event); -
    226 -
    227        $record->getTable()->getRecordListener()->preSave($event); -
    228 -
    229        if ( ! $event->skipOperation) { -
    230            switch ($record->state()) { -
    231                case Doctrine_Record::STATE_TDIRTY: -
    232                    $this->insert($record); -
    233                    break; -
    234                case Doctrine_Record::STATE_DIRTY: -
    235                case Doctrine_Record::STATE_PROXY: -
    236                    $this->update($record); -
    237                    break; -
    238                case Doctrine_Record::STATE_CLEAN: -
    239                case Doctrine_Record::STATE_TCLEAN: -
    240                    // do nothing -
    241                    break; -
    242            } -
    243        } -
    244 -
    245        $record->getTable()->getRecordListener()->postSave($event); -
    246         -
    247        $record->postSave($event); -
    248    } -
    249 -
    250    /** -
    251     * deletes given record and all the related composites -
    252     * this operation is isolated by a transaction -
    253     * -
    254     * this event can be listened by the onPreDelete and onDelete listeners -
    255     * -
    256     * @return boolean      true on success, false on failure -
    257     */ -
    258    public function delete(Doctrine_Record $record) -
    259    { -
    260        if ( ! $record->exists()) { -
    261            return false; -
    262        } -
    263        $this->conn->beginTransaction(); -
    264 -
    265        $event = new Doctrine_Event($record, Doctrine_Event::RECORD_DELETE); -
    266 -
    267        $record->preDelete($event); -
    268         -
    269        $table = $record->getTable(); -
    270 -
    271        $table->getRecordListener()->preDelete($event); -
    272 -
    273        $state = $record->state(); -
    274 -
    275        $record->state(Doctrine_Record::STATE_LOCKED); -
    276 -
    277        $this->deleteComposites($record); -
    278 -
    279        if ( ! $event->skipOperation) { -
    280            $record->state(Doctrine_Record::STATE_TDIRTY); -
    281            if ($table->getOption('joinedParents')) { -
    282 -
    283                foreach ($table->getOption('joinedParents') as $parent) { -
    284                    $parentTable = $table->getConnection()->getTable($parent); -
    285                     -
    286                    $this->conn->delete($parentTable, $record->identifier()); -
    287                } -
    288            } -
    289            $this->conn->delete($table, $record->identifier()); -
    290 -
    291            $record->state(Doctrine_Record::STATE_TCLEAN); -
    292        } else { -
    293            // return to original state    -
    294            $record->state($state); -
    295        } -
    296 -
    297        $table->getRecordListener()->postDelete($event); -
    298 -
    299        $record->postDelete($event); -
    300         -
    301        $table->removeRecord($record); -
    302 -
    303        $this->conn->commit(); -
    304 -
    305        return true; -
    306    } -
    307     -
    308    /** -
    309     * @todo Description. See also the todo for deleteMultiple(). -
    310     */ -
    311    public function deleteRecord(Doctrine_Record $record) -
    312    { -
    313        $ids = $record->identifier(); -
    314        $tmp = array(); -
    315         -
    316        foreach (array_keys($ids) as $id) { -
    317            $tmp[] = $id . ' = ? '; -
    318        } -
    319         -
    320        $params = array_values($ids); -
    321 -
    322        $query = 'DELETE FROM ' -
    323               . $this->conn->quoteIdentifier($record->getTable()->getTableName()) -
    324               . ' WHERE ' . implode(' AND ', $tmp); -
    325 -
    326 -
    327        return $this->conn->exec($query, $params); -
    328    } -
    329 -
    330    /** -
    331     * deleteMultiple -
    332     * deletes all records from the pending delete list -
    333     * -
    334     * @return void -
    335     * @todo Refactor. Maybe move to the Connection class? Sometimes UnitOfWork constructs -
    336     *       queries itself and sometimes it leaves the sql construction to Connection. -
    337     *       This should be changed. -
    338     */ -
    339    public function deleteMultiple(array $records) -
    340    {         -
    341        foreach ($this->delete as $name => $deletes) { -
    342            $record = false; -
    343            $ids = array(); -
    344             -
    345            // Note: Why is the last element's table identifier checked here and then  -
    346            // the table object from $deletes[0] used??? -
    347            if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier()) && -
    348                    count($deletes) > 0) { -
    349                $table = $deletes[0]->getTable(); -
    350                $query = 'DELETE FROM ' -
    351                       . $this->conn->quoteIdentifier($table->getTableName()) -
    352                       . ' WHERE '; -
    353 -
    354                $params = array(); -
    355                $cond = array(); -
    356                foreach ($deletes as $k => $record) { -
    357                    $ids = $record->identifier(); -
    358                    $tmp = array(); -
    359                    foreach (array_keys($ids) as $id) { -
    360                        $tmp[] = $table->getColumnName($id) . ' = ? '; -
    361                    } -
    362                    $params = array_merge($params, array_values($ids)); -
    363                    $cond[] = '(' . implode(' AND ', $tmp) . ')'; -
    364                } -
    365                $query .= implode(' OR ', $cond); -
    366 -
    367                $this->conn->execute($query, $params); -
    368            } else { -
    369                foreach ($deletes as $k => $record) { -
    370                    $ids[] = $record->getIncremented(); -
    371                } -
    372                // looks pretty messy. $record should be already out of scope. ugly php behaviour. -
    373                // even the php manual agrees on that and recommends to unset() the last element -
    374                // immediately after the loop ends. -
    375                $table = $record->getTable(); -
    376                if ($record instanceof Doctrine_Record) { -
    377                    $params = substr(str_repeat('?, ', count($ids)), 0, -2); -
    378     -
    379                    $query = 'DELETE FROM ' -
    380                           . $this->conn->quoteIdentifier($record->getTable()->getTableName()) -
    381                           . ' WHERE ' -
    382                           . $table->getColumnName($table->getIdentifier()) -
    383                           . ' IN(' . $params . ')'; -
    384         -
    385                    $this->conn->execute($query, $ids); -
    386                } -
    387            } -
    388        } -
    389    } -
    390 -
    391    /** -
    392     * saveRelated -
    393     * saves all related records to $record -
    394     * -
    395     * @throws PDOException         if something went wrong at database level -
    396     * @param Doctrine_Record $record -
    397     */ -
    398    public function saveRelated(Doctrine_Record $record) -
    399    { -
    400        $saveLater = array(); -
    401        foreach ($record->getReferences() as $k => $v) { -
    402            $rel = $record->getTable()->getRelation($k); -
    403 -
    404            $local = $rel->getLocal(); -
    405            $foreign = $rel->getForeign(); -
    406 -
    407            if ($rel instanceof Doctrine_Relation_ForeignKey) { -
    408                $saveLater[$k] = $rel; -
    409            } else if ($rel instanceof Doctrine_Relation_LocalKey) { -
    410                // ONE-TO-ONE relationship -
    411                $obj = $record->get($rel->getAlias()); -
    412 -
    413                // Protection against infinite function recursion before attempting to save -
    414                if ($obj instanceof Doctrine_Record && $obj->isModified()) { -
    415                    $obj->save($this->conn); -
    416                     -
    417                    /** Can this be removed? -
    418                    $id = array_values($obj->identifier()); -
    419 -
    420                    foreach ((array) $rel->getLocal() as $k => $field) { -
    421                        $record->set($field, $id[$k]); -
    422                    } -
    423                    */ -
    424                } -
    425            } -
    426        } -
    427 -
    428        return $saveLater; -
    429    } -
    430 -
    431    /** -
    432     * saveAssociations -
    433     * -
    434     * this method takes a diff of one-to-many / many-to-many original and -
    435     * current collections and applies the changes -
    436     * -
    437     * for example if original many-to-many related collection has records with -
    438     * primary keys 1,2 and 3 and the new collection has records with primary keys -
    439     * 3, 4 and 5, this method would first destroy the associations to 1 and 2 and then -
    440     * save new associations to 4 and 5 -
    441     * -
    442     * @throws Doctrine_Connection_Exception         if something went wrong at database level -
    443     * @param Doctrine_Record $record -
    444     * @return void -
    445     */ -
    446    public function saveAssociations(Doctrine_Record $record) -
    447    { -
    448        foreach ($record->getReferences() as $k => $v) { -
    449            $rel = $record->getTable()->getRelation($k); -
    450             -
    451            if ($rel instanceof Doctrine_Relation_Association) {    -
    452                $v->save($this->conn); -
    453 -
    454                $assocTable = $rel->getAssociationTable(); -
    455                foreach ($v->getDeleteDiff() as $r) { -
    456                    $query = 'DELETE FROM ' . $assocTable->getTableName() -
    457                           . ' WHERE ' . $rel->getForeign() . ' = ?' -
    458                           . ' AND ' . $rel->getLocal() . ' = ?'; -
    459 -
    460                    $this->conn->execute($query, array($r->getIncremented(), $record->getIncremented())); -
    461                } -
    462 -
    463                foreach ($v->getInsertDiff() as $r) { -
    464                    $assocRecord = $assocTable->create(); -
    465                    $assocRecord->set($assocTable->getFieldName($rel->getForeign()), $r); -
    466                    $assocRecord->set($assocTable->getFieldName($rel->getLocal()), $record); -
    467 -
    468                    $this->saveGraph($assocRecord); -
    469                } -
    470            } -
    471        } -
    472    } -
    473 -
    474    /** -
    475     * deletes all related composites -
    476     * this method is always called internally when a record is deleted -
    477     * -
    478     * @throws PDOException         if something went wrong at database level -
    479     * @return void -
    480     */ -
    481    public function deleteComposites(Doctrine_Record $record) -
    482    { -
    483        foreach ($record->getTable()->getRelations() as $fk) { -
    484            if ($fk->isComposite()) { -
    485                $obj = $record->get($fk->getAlias()); -
    486                if ($obj instanceof Doctrine_Record &&  -
    487                        $obj->state() != Doctrine_Record::STATE_LOCKED)  { -
    488                    $obj->delete($this->conn); -
    489                } -
    490            } -
    491        } -
    492    } -
    493 -
    494    /** -
    495     * saveAll -
    496     * persists all the pending records from all tables -
    497     * -
    498     * @throws PDOException         if something went wrong at database level -
    499     * @return void -
    500     */ -
    501    public function saveAll() -
    502    { -
    503        // get the flush tree -
    504        $tree = $this->buildFlushTree($this->conn->getTables()); -
    505 -
    506        // save all records -
    507        foreach ($tree as $name) { -
    508            $table = $this->conn->getTable($name); -
    509 -
    510            foreach ($table->getRepository() as $record) { -
    511                $this->save($record); -
    512            } -
    513        } -
    514 -
    515        // save all associations -
    516        foreach ($tree as $name) { -
    517            $table = $this->conn->getTable($name); -
    518 -
    519            foreach ($table->getRepository() as $record) { -
    520                $this->saveAssociations($record); -
    521            } -
    522        } -
    523    } -
    524 -
    525    /** -
    526     * updates given record -
    527     * -
    528     * @param Doctrine_Record $record   record to be updated -
    529     * @return boolean                  whether or not the update was successful -
    530     */ -
    531    public function update(Doctrine_Record $record) -
    532    { -
    533        $event = new Doctrine_Event($record, Doctrine_Event::RECORD_UPDATE); -
    534 -
    535        $record->preUpdate($event); -
    536 -
    537        $table = $record->getTable(); -
    538 -
    539        $table->getRecordListener()->preUpdate($event); -
    540 -
    541        if ( ! $event->skipOperation) { -
    542            $identifier = $record->identifier(); -
    543 -
    544            if ($table->getOption('joinedParents')) { -
    545                $dataSet = $this->formatDataSet($record); -
    546                 -
    547                $component = $table->getComponentName(); -
    548 -
    549                $classes = $table->getOption('joinedParents'); -
    550                $classes[] = $component; -
    551 -
    552                foreach ($record as $field => $value) { -
    553                    if ($value instanceof Doctrine_Record) { -
    554                        if ( ! $value->exists()) { -
    555                            $value->save(); -
    556                        } -
    557                        $record->set($field, $value->getIncremented()); -
    558                    } -
    559                } -
    560 -
    561                foreach ($classes as $class) { -
    562                    $parentTable = $this->conn->getTable($class); -
    563 -
    564                    $this->conn->update($this->conn->getTable($class), $dataSet[$class], $identifier); -
    565                } -
    566            } else { -
    567                $array = $record->getPrepared(); -
    568                 -
    569                $this->conn->update($table, $array, $identifier); -
    570            } -
    571            $record->assignIdentifier(true); -
    572        } -
    573         -
    574        $table->getRecordListener()->postUpdate($event); -
    575 -
    576        $record->postUpdate($event); -
    577 -
    578        return true; -
    579    } -
    580     -
    581    /** -
    582     * inserts a record into database -
    583     * -
    584     * @param Doctrine_Record $record   record to be inserted -
    585     * @return boolean -
    586     */ -
    587    public function insert(Doctrine_Record $record) -
    588    { -
    589         // listen the onPreInsert event -
    590        $event = new Doctrine_Event($record, Doctrine_Event::RECORD_INSERT); -
    591 -
    592        $record->preInsert($event); -
    593         -
    594        $table = $record->getTable(); -
    595 -
    596        $table->getRecordListener()->preInsert($event); -
    597 -
    598        if ( ! $event->skipOperation) { -
    599            if ($table->getOption('joinedParents')) { -
    600                $dataSet = $this->formatDataSet($record); -
    601                 -
    602                $component = $table->getComponentName(); -
    603 -
    604                $classes = $table->getOption('joinedParents'); -
    605                $classes[] = $component; -
    606 -
    607                foreach ($classes as $k => $parent) { -
    608                    if ($k === 0) { -
    609                        $rootRecord = new $parent(); -
    610 -
    611                        $rootRecord->merge($dataSet[$parent]); -
    612 -
    613                        $this->processSingleInsert($rootRecord); -
    614                    } else { -
    615                        foreach ((array) $rootRecord->identifier() as $id => $value) { -
    616                            $dataSet[$parent][$id] = $value; -
    617                        } -
    618 -
    619                        $this->conn->insert($this->conn->getTable($parent), $dataSet[$parent]); -
    620                    } -
    621                } -
    622            } else { -
    623                $this->processSingleInsert($record); -
    624            } -
    625        } -
    626 -
    627        $table->addRecord($record); -
    628 -
    629        $table->getRecordListener()->postInsert($event); -
    630 -
    631        $record->postInsert($event); -
    632 -
    633        return true; -
    634    } -
    635     -
    636    /** -
    637     * @todo DESCRIBE WHAT THIS METHOD DOES, PLEASE! -
    638     */ -
    639    public function formatDataSet(Doctrine_Record $record) -
    640    { -
    641     $table = $record->getTable(); -
    642 -
    643        $dataSet = array(); -
    644     -
    645        $component = $table->getComponentName(); -
    646     -
    647        $array = $record->getPrepared(); -
    648     -
    649        foreach ($table->getColumns() as $columnName => $definition) { -
    650            $fieldName = $table->getFieldName($columnName); -
    651            if (isset($definition['primary']) && $definition['primary']) { -
    652                continue; -
    653            } -
    654     -
    655            if (isset($definition['owner'])) { -
    656                $dataSet[$definition['owner']][$fieldName] = $array[$fieldName]; -
    657            } else { -
    658                $dataSet[$component][$fieldName] = $array[$fieldName]; -
    659            } -
    660        }     -
    661         -
    662        return $dataSet; -
    663    } -
    664     -
    665    /** -
    666     * @todo DESCRIBE WHAT THIS METHOD DOES, PLEASE! -
    667     */ -
    668    public function processSingleInsert(Doctrine_Record $record) -
    669    { -
    670        $fields = $record->getPrepared(); -
    671 -
    672        if (empty($fields)) { -
    673            return false; -
    674        } -
    675         -
    676        $table = $record->getTable(); -
    677        $identifier = (array) $table->getIdentifier(); -
    678 -
    679        $seq = $record->getTable()->sequenceName; -
    680 -
    681        if ( ! empty($seq)) { -
    682            $id = $this->conn->sequence->nextId($seq); -
    683            $seqName = $table->getIdentifier(); -
    684            $fields[$seqName] = $id; -
    685 -
    686            $record->assignIdentifier($id); -
    687        } -
    688 -
    689        $this->conn->insert($table, $fields); -
    690 -
    691        if (empty($seq) && count($identifier) == 1 && $identifier[0] == $table->getIdentifier() && -
    692            $table->getIdentifierType() != Doctrine::IDENTIFIER_NATURAL) { -
    693 -
    694            if (strtolower($this->conn->getName()) == 'pgsql') { -
    695                $seq = $table->getTableName() . '_' . $identifier[0]; -
    696            } -
    697 -
    698            $id = $this->conn->sequence->lastInsertId($seq); -
    699 -
    700            if ( ! $id) { -
    701                throw new Doctrine_Connection_Exception("Couldn't get last insert identifier."); -
    702            } -
    703 -
    704            $record->assignIdentifier($id); -
    705        } else { -
    706            $record->assignIdentifier(true); -
    707        }     -
    708    } -
    709} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_DataDict.html b/tests_old/coverage/Doctrine_DataDict.html deleted file mode 100644 index 530615124..000000000 --- a/tests_old/coverage/Doctrine_DataDict.html +++ /dev/null @@ -1,299 +0,0 @@ - - - Coverage for Doctrine_DataDict - - -

    Coverage for Doctrine_DataDict

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: DataDict.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_DataDict -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  DataDict -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    33 */ -
    34class Doctrine_DataDict extends Doctrine_Connection_Module -
    35{ -
    36    /** -
    37     * Obtain an array of changes that may need to applied -
    38     * -
    39     * @param array $current new definition -
    40     * @param array  $previous old definition -
    41     * @return array  containing all changes that will need to be applied -
    42     */ -
    43    public function compareDefinition($current, $previous) -
    44    { -
    45        $type = !empty($current['type']) ? $current['type'] : null; -
    46 -
    47        if ( ! method_exists($this, "_compare{$type}Definition")) { -
    48            throw new Doctrine_DataDict_Exception('type "'.$current['type'].'" is not yet supported'); -
    49        } -
    50 -
    51        if (empty($previous['type']) || $previous['type'] != $type) { -
    52            return $current; -
    53        } -
    54 -
    55        $change = $this->{"_compare{$type}Definition"}($current, $previous); -
    56 -
    57        if ($previous['type'] != $type) { -
    58            $change['type'] = true; -
    59        } -
    60 -
    61        $previous_notnull = !empty($previous['notnull']) ? $previous['notnull'] : false; -
    62        $notnull = !empty($current['notnull']) ? $current['notnull'] : false; -
    63        if ($previous_notnull != $notnull) { -
    64            $change['notnull'] = true; -
    65        } -
    66 -
    67        $previous_default = array_key_exists('default', $previous) ? $previous['default'] : -
    68            ($previous_notnull ? '' : null); -
    69        $default = array_key_exists('default', $current) ? $current['default'] : -
    70            ($notnull ? '' : null); -
    71        if ($previous_default !== $default) { -
    72            $change['default'] = true; -
    73        } -
    74 -
    75        return $change; -
    76    } -
    77 -
    78    /** -
    79     * parseBoolean -
    80     * parses a literal boolean value and returns  -
    81     * proper sql equivalent -
    82     * -
    83     * @param string $value     boolean value to be parsed -
    84     * @return string           parsed boolean value -
    85     */ -
    86    public function parseBoolean($value) -
    87    { -
    88        // parse booleans -
    89        if ($value == 'true') { -
    90            $value = 1; -
    91        } elseif ($value == 'false') { -
    92            $value = 0; -
    93        } -
    94        return $value; -
    95    } -
    96}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_DataDict_Exception.html b/tests_old/coverage/Doctrine_DataDict_Exception.html deleted file mode 100644 index 43d2be3ad..000000000 --- a/tests_old/coverage/Doctrine_DataDict_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_DataDict_Exception - - -

    Coverage for Doctrine_DataDict_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_DataDict_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  DataDict -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_DataDict_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_DataDict_Firebird.html b/tests_old/coverage/Doctrine_DataDict_Firebird.html deleted file mode 100644 index 82a878499..000000000 --- a/tests_old/coverage/Doctrine_DataDict_Firebird.html +++ /dev/null @@ -1,665 +0,0 @@ - - - Coverage for Doctrine_DataDict_Firebird - - -

    Coverage for Doctrine_DataDict_Firebird

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Firebird.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_DataDict'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  DataDict -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lorenzo Alberton <l.alberton@quipo.it> (PEAR MDB2 Interbase driver) -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @version     $Revision: 2963 $ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_DataDict_Firebird extends Doctrine_DataDict -
    34{ -
    35    /** -
    36     * Obtain DBMS specific SQL code portion needed to declare an text type -
    37     * field to be used in statements like CREATE TABLE. -
    38     * -
    39     * @param array $field  associative array with the name of the properties -
    40     *      of the field being declared as array indexes. Currently, the types -
    41     *      of supported field properties are as follows: -
    42     * -
    43     *      length -
    44     *          Integer value that determines the maximum length of the text -
    45     *          field. If this argument is missing the field should be -
    46     *          declared to have the longest length allowed by the DBMS. -
    47     * -
    48     *      default -
    49     *          Text value to be used as default for this field. -
    50     * -
    51     *      notnull -
    52     *          Boolean flag that indicates whether this field is constrained -
    53     *          to not be set to null. -
    54     * @return string  DBMS specific SQL code portion that should be used to -
    55     *      declare the specified field. -
    56     */ -
    57    public function getNativeDeclaration($field) -
    58    { -
    59        if ( ! isset($field['type'])) { -
    60            throw new Doctrine_DataDict_Exception('Missing column type.'); -
    61        } -
    62        switch ($field['type']) { -
    63            case 'varchar': -
    64            case 'string': -
    65            case 'array': -
    66            case 'object': -
    67            case 'char': -
    68            case 'text': -
    69            case 'gzip': -
    70                $length = !empty($field['length']) -
    71                    ? $field['length'] : 16777215; // TODO: $this->conn->options['default_text_field_length']; -
    72 -
    73                $fixed  = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; -
    74 -
    75                return $fixed ? 'CHAR('.$length.')' : 'VARCHAR('.$length.')'; -
    76            case 'clob': -
    77                return 'BLOB SUB_TYPE 1'; -
    78            case 'blob': -
    79                return 'BLOB SUB_TYPE 0'; -
    80            case 'integer': -
    81            case 'enum': -
    82            case 'int': -
    83                return 'INT'; -
    84            case 'boolean': -
    85                return 'SMALLINT'; -
    86            case 'date': -
    87                return 'DATE'; -
    88            case 'time': -
    89                return 'TIME'; -
    90            case 'timestamp': -
    91                return 'TIMESTAMP'; -
    92            case 'float': -
    93                return 'DOUBLE PRECISION'; -
    94            case 'decimal': -
    95                $length = !empty($field['length']) ? $field['length'] : 18; -
    96                $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES); -
    97                return 'DECIMAL('.$length.','.$scale.')'; -
    98        } -
    99 -
    100        throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] .  '\'.'); -
    101    } -
    102 -
    103    /** -
    104     * Maps a native array description of a field to a Doctrine datatype and length -
    105     * -
    106     * @param array  $field native field description -
    107     * @return array containing the various possible types, length, sign, fixed -
    108     */ -
    109    public function getPortableDeclaration($field) -
    110    { -
    111        $length  = (isset($field['length']) && $field['length'] > 0) ? $field['length'] : null; -
    112 -
    113        $type = array(); -
    114        $unsigned = $fixed = null; -
    115        $dbType = strtolower($field['type']); -
    116        $field['field_sub_type'] = !empty($field['field_sub_type']) -
    117            ? strtolower($field['field_sub_type']) : null; -
    118 -
    119        if ( ! isset($field['name'])) { -
    120            $field['name'] = ''; -
    121        } -
    122 -
    123        switch ($dbType) { -
    124            case 'smallint': -
    125            case 'integer': -
    126            case 'int64': -
    127                //these may be 'numeric' or 'decimal' -
    128                if (isset($field['field_sub_type'])) { -
    129                    $field['type'] = $field['field_sub_type']; -
    130                    return $this->getPortableDeclaration($field); -
    131                } -
    132            case 'bigint': -
    133            case 'quad': -
    134                $type[] = 'integer'; -
    135                if ($length == '1') { -
    136                    $type[] = 'boolean'; -
    137                    if (preg_match('/^(is|has)/', $field['name'])) { -
    138                        $type = array_reverse($type); -
    139                    } -
    140                } -
    141                break; -
    142            case 'varchar': -
    143                $fixed = false; -
    144            case 'char': -
    145            case 'cstring': -
    146                $type[] = 'string'; -
    147                if ($length == '1') { -
    148                    $type[] = 'boolean'; -
    149                    if (preg_match('/^(is|has)/', $field['name'])) { -
    150                        $type = array_reverse($type); -
    151                    } -
    152                } -
    153                if ($fixed !== false) { -
    154                    $fixed = true; -
    155                } -
    156                break; -
    157            case 'date': -
    158                $type[] = 'date'; -
    159                $length = null; -
    160                break; -
    161            case 'timestamp': -
    162                $type[] = 'timestamp'; -
    163                $length = null; -
    164                break; -
    165            case 'time': -
    166                $type[] = 'time'; -
    167                $length = null; -
    168                break; -
    169            case 'float': -
    170            case 'double': -
    171            case 'double precision': -
    172            case 'd_float': -
    173                $type[] = 'float'; -
    174                break; -
    175            case 'decimal': -
    176            case 'numeric': -
    177                $type[] = 'decimal'; -
    178                break; -
    179            case 'blob': -
    180                $type[] = ($field['field_sub_type'] == 'text') ? 'clob' : 'blob'; -
    181                $length = null; -
    182                break; -
    183            default: -
    184                throw new Doctrine_DataDict_Exception('unknown database attribute type: '.$dbType); -
    185        } -
    186 -
    187        return array('type'     => $type, -
    188                     'length'   => $length, -
    189                     'unsigned' => $unsigned, -
    190                     'fixed'    => $fixed); -
    191    } -
    192 -
    193    /** -
    194     * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET -
    195     * of a field declaration to be used in statements like CREATE TABLE. -
    196     * -
    197     * @param string $charset   name of the charset -
    198     * @return string  DBMS specific SQL code portion needed to set the CHARACTER SET -
    199     *                 of a field declaration. -
    200     */ -
    201    public function getCharsetFieldDeclaration($charset) -
    202    { -
    203        return 'CHARACTER SET ' . $charset; -
    204    } -
    205 -
    206    /** -
    207     * Obtain DBMS specific SQL code portion needed to set the COLLATION -
    208     * of a field declaration to be used in statements like CREATE TABLE. -
    209     * -
    210     * @param string $collation   name of the collation -
    211     * @return string  DBMS specific SQL code portion needed to set the COLLATION -
    212     *                 of a field declaration. -
    213     */ -
    214    public function getCollationFieldDeclaration($collation) -
    215    { -
    216        return 'COLLATE ' . $collation; -
    217    } -
    218}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_DataDict_Mssql.html b/tests_old/coverage/Doctrine_DataDict_Mssql.html deleted file mode 100644 index a7083ef16..000000000 --- a/tests_old/coverage/Doctrine_DataDict_Mssql.html +++ /dev/null @@ -1,579 +0,0 @@ - - - Coverage for Doctrine_DataDict_Mssql - - -

    Coverage for Doctrine_DataDict_Mssql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mssql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_DataDict'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  DataDict -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    28 * @author      Frank M. Kromann <frank@kromann.info> (PEAR MDB2 Mssql driver) -
    29 * @author      David Coallier <davidc@php.net> (PEAR MDB2 Mssql driver) -
    30 * @version     $Revision: 2963 $ -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 */ -
    34class Doctrine_DataDict_Mssql extends Doctrine_DataDict -
    35{ -
    36    /** -
    37     * Obtain DBMS specific SQL code portion needed to declare an text type -
    38     * field to be used in statements like CREATE TABLE. -
    39     * -
    40     * @param array $field  associative array with the name of the properties -
    41     *      of the field being declared as array indexes. Currently, the types -
    42     *      of supported field properties are as follows: -
    43     * -
    44     *      length -
    45     *          Integer value that determines the maximum length of the text -
    46     *          field. If this argument is missing the field should be -
    47     *          declared to have the longest length allowed by the DBMS. -
    48     * -
    49     *      default -
    50     *          Text value to be used as default for this field. -
    51     * -
    52     *      notnull -
    53     *          Boolean flag that indicates whether this field is constrained -
    54     *          to not be set to null. -
    55     * -
    56     * @return      string      DBMS specific SQL code portion that should be used to -
    57     *                          declare the specified field. -
    58     */ -
    59    public function getNativeDeclaration($field) -
    60    { -
    61        if ( ! isset($field['type'])) { -
    62            throw new Doctrine_DataDict_Exception('Missing column type.'); -
    63        } -
    64        switch ($field['type']) { -
    65            case 'array': -
    66            case 'object': -
    67            case 'text': -
    68            case 'char': -
    69            case 'varchar': -
    70            case 'string': -
    71            case 'gzip': -
    72                $length = !empty($field['length']) -
    73                    ? $field['length'] : false; -
    74 -
    75                $fixed  = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; -
    76 -
    77                return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->options['default_text_field_length'].')') -
    78                    : ($length ? 'VARCHAR('.$length.')' : 'TEXT'); -
    79            case 'clob': -
    80                if ( ! empty($field['length'])) { -
    81                    $length = $field['length']; -
    82                    if ($length <= 8000) { -
    83                        return 'VARCHAR('.$length.')'; -
    84                    } -
    85                 } -
    86                 return 'TEXT'; -
    87            case 'blob': -
    88                if ( ! empty($field['length'])) { -
    89                    $length = $field['length']; -
    90                    if ($length <= 8000) { -
    91                        return "VARBINARY($length)"; -
    92                    } -
    93                } -
    94                return 'IMAGE'; -
    95            case 'integer': -
    96            case 'enum': -
    97            case 'int': -
    98                return 'INT'; -
    99            case 'boolean': -
    100                return 'BIT'; -
    101            case 'date': -
    102                return 'CHAR(' . strlen('YYYY-MM-DD') . ')'; -
    103            case 'time': -
    104                return 'CHAR(' . strlen('HH:MM:SS') . ')'; -
    105            case 'timestamp': -
    106                return 'CHAR(' . strlen('YYYY-MM-DD HH:MM:SS') . ')'; -
    107            case 'float': -
    108                return 'FLOAT'; -
    109            case 'decimal': -
    110                $length = !empty($field['length']) ? $field['length'] : 18; -
    111                $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES); -
    112                return 'DECIMAL('.$length.','.$scale.')'; -
    113        } -
    114 -
    115        throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] .  '\'.'); -
    116    } -
    117 -
    118    /** -
    119     * Maps a native array description of a field to a MDB2 datatype and length -
    120     * -
    121     * @param   array           $field native field description -
    122     * @return  array           containing the various possible types, length, sign, fixed -
    123     */ -
    124    public function getPortableDeclaration($field) -
    125    { -
    126        $db_type = preg_replace('/\d/','', strtolower($field['type']) ); -
    127        $length  = (isset($field['length']) && $field['length'] > 0) ? $field['length'] : null; -
    128 -
    129        $type = array(); -
    130        // todo: unsigned handling seems to be missing -
    131        $unsigned = $fixed = null; -
    132 -
    133        if ( ! isset($field['name'])) -
    134            $field['name'] = ''; -
    135 -
    136        switch ($db_type) { -
    137            case 'bit': -
    138                $type[0] = 'boolean'; -
    139            break; -
    140            case 'int': -
    141                $type[0] = 'integer'; -
    142                if ($length == 1) { -
    143                    $type[] = 'boolean'; -
    144                } -
    145            break; -
    146            case 'datetime': -
    147                $type[0] = 'timestamp'; -
    148            break; -
    149            case 'float': -
    150            case 'real': -
    151            case 'numeric': -
    152                $type[0] = 'float'; -
    153            break; -
    154            case 'decimal': -
    155            case 'money': -
    156                $type[0] = 'decimal'; -
    157            break; -
    158            case 'text': -
    159            case 'varchar': -
    160                $fixed = false; -
    161            case 'char': -
    162                $type[0] = 'string'; -
    163                if ($length == '1') { -
    164                    $type[] = 'boolean'; -
    165                    if (preg_match('/^[is|has]/', $field['name'])) { -
    166                        $type = array_reverse($type); -
    167                    } -
    168                } elseif (strstr($db_type, 'text')) { -
    169                    $type[] = 'clob'; -
    170                } -
    171                if ($fixed !== false) { -
    172                    $fixed = true; -
    173                } -
    174            break; -
    175            case 'image': -
    176            case 'varbinary': -
    177                $type[] = 'blob'; -
    178                $length = null; -
    179            break; -
    180            default: -
    181                throw new Doctrine_DataDict_Exception('unknown database attribute type: '.$db_type); -
    182        } -
    183 -
    184        return array('type'     => $type, -
    185                     'length'   => $length, -
    186                     'unsigned' => $unsigned, -
    187                     'fixed'    => $fixed); -
    188    } -
    189} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_DataDict_Mysql.html b/tests_old/coverage/Doctrine_DataDict_Mysql.html deleted file mode 100644 index 17c35bd20..000000000 --- a/tests_old/coverage/Doctrine_DataDict_Mysql.html +++ /dev/null @@ -1,1421 +0,0 @@ - - - Coverage for Doctrine_DataDict_Mysql - - -

    Coverage for Doctrine_DataDict_Mysql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mysql.php 3084 2007-11-08 14:01:03Z samw3 $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_DataDict'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  DataDict -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    28 * @version     $Revision: 3084 $ -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 */ -
    32class Doctrine_DataDict_Mysql extends Doctrine_DataDict -
    33{ -
    34    protected $keywords = array( -
    35                          'ADD', 'ALL', 'ALTER', -
    36                          'ANALYZE', 'AND', 'AS', -
    37                          'ASC', 'ASENSITIVE', 'BEFORE', -
    38                          'BETWEEN', 'BIGINT', 'BINARY', -
    39                          'BLOB', 'BOTH', 'BY', -
    40                          'CALL', 'CASCADE', 'CASE', -
    41                          'CHANGE', 'CHAR', 'CHARACTER', -
    42                          'CHECK', 'COLLATE', 'COLUMN', -
    43                          'CONDITION', 'CONNECTION', 'CONSTRAINT', -
    44                          'CONTINUE', 'CONVERT', 'CREATE', -
    45                          'CROSS', 'CURRENT_DATE', 'CURRENT_TIME', -
    46                          'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', -
    47                          'DATABASE', 'DATABASES', 'DAY_HOUR', -
    48                          'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', -
    49                          'DEC', 'DECIMAL', 'DECLARE', -
    50                          'DEFAULT', 'DELAYED', 'DELETE', -
    51                          'DESC', 'DESCRIBE', 'DETERMINISTIC', -
    52                          'DISTINCT', 'DISTINCTROW', 'DIV', -
    53                          'DOUBLE', 'DROP', 'DUAL', -
    54                          'EACH', 'ELSE', 'ELSEIF', -
    55                          'ENCLOSED', 'ESCAPED', 'EXISTS', -
    56                          'EXIT', 'EXPLAIN', 'FALSE', -
    57                          'FETCH', 'FLOAT', 'FLOAT4', -
    58                          'FLOAT8', 'FOR', 'FORCE', -
    59                          'FOREIGN', 'FROM', 'FULLTEXT', -
    60                          'GRANT', 'GROUP', 'HAVING', -
    61                          'HIGH_PRIORITY', 'HOUR_MICROSECOND', 'HOUR_MINUTE', -
    62                          'HOUR_SECOND', 'IF', 'IGNORE', -
    63                          'IN', 'INDEX', 'INFILE', -
    64                          'INNER', 'INOUT', 'INSENSITIVE', -
    65                          'INSERT', 'INT', 'INT1', -
    66                          'INT2', 'INT3', 'INT4', -
    67                          'INT8', 'INTEGER', 'INTERVAL', -
    68                          'INTO', 'IS', 'ITERATE', -
    69                          'JOIN', 'KEY', 'KEYS', -
    70                          'KILL', 'LEADING', 'LEAVE', -
    71                          'LEFT', 'LIKE', 'LIMIT', -
    72                          'LINES', 'LOAD', 'LOCALTIME', -
    73                          'LOCALTIMESTAMP', 'LOCK', 'LONG', -
    74                          'LONGBLOB', 'LONGTEXT', 'LOOP', -
    75                          'LOW_PRIORITY', 'MATCH', 'MEDIUMBLOB', -
    76                          'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT', -
    77                          'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MOD', -
    78                          'MODIFIES', 'NATURAL', 'NOT', -
    79                          'NO_WRITE_TO_BINLOG', 'NULL', 'NUMERIC', -
    80                          'ON', 'OPTIMIZE', 'OPTION', -
    81                          'OPTIONALLY', 'OR', 'ORDER', -
    82                          'OUT', 'OUTER', 'OUTFILE', -
    83                          'PRECISION', 'PRIMARY', 'PROCEDURE', -
    84                          'PURGE', 'RAID0', 'READ', -
    85                          'READS', 'REAL', 'REFERENCES', -
    86                          'REGEXP', 'RELEASE', 'RENAME', -
    87                          'REPEAT', 'REPLACE', 'REQUIRE', -
    88                          'RESTRICT', 'RETURN', 'REVOKE', -
    89                          'RIGHT', 'RLIKE', 'SCHEMA', -
    90                          'SCHEMAS', 'SECOND_MICROSECOND', 'SELECT', -
    91                          'SENSITIVE', 'SEPARATOR', 'SET', -
    92                          'SHOW', 'SMALLINT', 'SONAME', -
    93                          'SPATIAL', 'SPECIFIC', 'SQL', -
    94                          'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', -
    95                          'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_SMALL_RESULT', -
    96                          'SSL', 'STARTING', 'STRAIGHT_JOIN', -
    97                          'TABLE', 'TERMINATED', 'THEN', -
    98                          'TINYBLOB', 'TINYINT', 'TINYTEXT', -
    99                          'TO', 'TRAILING', 'TRIGGER', -
    100                          'TRUE', 'UNDO', 'UNION', -
    101                          'UNIQUE', 'UNLOCK', 'UNSIGNED', -
    102                          'UPDATE', 'USAGE', 'USE', -
    103                          'USING', 'UTC_DATE', 'UTC_TIME', -
    104                          'UTC_TIMESTAMP', 'VALUES', 'VARBINARY', -
    105                          'VARCHAR', 'VARCHARACTER', 'VARYING', -
    106                          'WHEN', 'WHERE', 'WHILE', -
    107                          'WITH', 'WRITE', 'X509', -
    108                          'XOR', 'YEAR_MONTH', 'ZEROFILL' -
    109                          ); -
    110 -
    111    /** -
    112     * Obtain DBMS specific SQL code portion needed to declare an text type -
    113     * field to be used in statements like CREATE TABLE. -
    114     * -
    115     * @param array $field  associative array with the name of the properties -
    116     *      of the field being declared as array indexes. Currently, the types -
    117     *      of supported field properties are as follows: -
    118     * -
    119     *      length -
    120     *          Integer value that determines the maximum length of the text -
    121     *          field. If this argument is missing the field should be -
    122     *          declared to have the longest length allowed by the DBMS. -
    123     * -
    124     *      default -
    125     *          Text value to be used as default for this field. -
    126     * -
    127     *      notnull -
    128     *          Boolean flag that indicates whether this field is constrained -
    129     *          to not be set to null. -
    130     * -
    131     * @return string  DBMS specific SQL code portion that should be used to -
    132     *      declare the specified field. -
    133     */ -
    134    public function getNativeDeclaration($field) -
    135    { -
    136        if ( ! isset($field['type'])) { -
    137            throw new Doctrine_DataDict_Exception('Missing column type.'); -
    138        } -
    139 -
    140        switch ($field['type']) { -
    141            case 'char': -
    142                $length = ( ! empty($field['length'])) ? $field['length'] : false; -
    143 -
    144                return $length ? 'CHAR('.$length.')' : 'CHAR(255)'; -
    145            case 'varchar': -
    146            case 'array': -
    147            case 'object': -
    148            case 'string': -
    149            case 'gzip': -
    150                if ( ! isset($field['length'])) { -
    151                    if (array_key_exists('default', $field)) { -
    152                        $field['length'] = $this->conn->varchar_max_length; -
    153                    } else { -
    154                        $field['length'] = false; -
    155                    } -
    156                } -
    157 -
    158                $length = ($field['length'] <= $this->conn->varchar_max_length) ? $field['length'] : false; -
    159                $fixed  = (isset($field['fixed'])) ? $field['fixed'] : false; -
    160 -
    161                return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)') -
    162                    : ($length ? 'VARCHAR(' . $length . ')' : 'TEXT'); -
    163            case 'clob': -
    164                if ( ! empty($field['length'])) { -
    165                    $length = $field['length']; -
    166                    if ($length <= 255) { -
    167                        return 'TINYTEXT'; -
    168                    } elseif ($length <= 65532) { -
    169                        return 'TEXT'; -
    170                    } elseif ($length <= 16777215) { -
    171                        return 'MEDIUMTEXT'; -
    172                    } -
    173                } -
    174                return 'LONGTEXT'; -
    175            case 'blob': -
    176                if ( ! empty($field['length'])) { -
    177                    $length = $field['length']; -
    178                    if ($length <= 255) { -
    179                        return 'TINYBLOB'; -
    180                    } elseif ($length <= 65532) { -
    181                        return 'BLOB'; -
    182                    } elseif ($length <= 16777215) { -
    183                        return 'MEDIUMBLOB'; -
    184                    } -
    185                } -
    186                return 'LONGBLOB'; -
    187            case 'enum': -
    188                if ($this->conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) { -
    189                    $values = array(); -
    190                    foreach ($field['values'] as $value) { -
    191                      $values[] = $this->conn->quote($value, 'varchar'); -
    192                    } -
    193                    return 'ENUM('.implode(', ', $values).')'; -
    194                } -
    195                // fall back to integer -
    196            case 'integer': -
    197            case 'int': -
    198                if ( ! empty($field['length'])) { -
    199                    $length = $field['length']; -
    200                    if ($length <= 1) { -
    201                        return 'TINYINT'; -
    202                    } elseif ($length == 2) { -
    203                        return 'SMALLINT'; -
    204                    } elseif ($length == 3) { -
    205                        return 'MEDIUMINT'; -
    206                    } elseif ($length == 4) { -
    207                        return 'INT'; -
    208                    } elseif ($length > 4) { -
    209                        return 'BIGINT'; -
    210                    } -
    211                } -
    212                return 'INT'; -
    213            case 'boolean': -
    214                return 'TINYINT(1)'; -
    215            case 'date': -
    216                return 'DATE'; -
    217            case 'time': -
    218                return 'TIME'; -
    219            case 'timestamp': -
    220                return 'DATETIME'; -
    221            case 'float': -
    222            case 'double': -
    223                return 'DOUBLE'; -
    224            case 'decimal': -
    225                $length = !empty($field['length']) ? $field['length'] : 18; -
    226                $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES); -
    227                return 'DECIMAL('.$length.','.$scale.')'; -
    228        } -
    229        throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] .  '\'.'); -
    230    } -
    231 -
    232    /** -
    233     * Maps a native array description of a field to a MDB2 datatype and length -
    234     * -
    235     * @param array  $field native field description -
    236     * @return array containing the various possible types, length, sign, fixed -
    237     */ -
    238    public function getPortableDeclaration(array $field) -
    239    { -
    240        $dbType = strtolower($field['type']); -
    241        $dbType = strtok($dbType, '(), '); -
    242        if ($dbType == 'national') { -
    243            $dbType = strtok('(), '); -
    244        } -
    245        if (isset($field['length'])) { -
    246            $length = $field['length']; -
    247            $decimal = ''; -
    248        } else { -
    249            $length = strtok('(), '); -
    250            $decimal = strtok('(), '); -
    251        } -
    252        $type = array(); -
    253        $unsigned = $fixed = null; -
    254 -
    255        if ( ! isset($field['name'])) { -
    256            $field['name'] = ''; -
    257        } -
    258 -
    259        $values = null; -
    260 -
    261        switch ($dbType) { -
    262            case 'tinyint': -
    263                $type[] = 'integer'; -
    264                $type[] = 'boolean'; -
    265                if (preg_match('/^(is|has)/', $field['name'])) { -
    266                    $type = array_reverse($type); -
    267                } -
    268                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    269                $length = 1; -
    270            break; -
    271            case 'smallint': -
    272                $type[] = 'integer'; -
    273                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    274                $length = 2; -
    275            break; -
    276            case 'mediumint': -
    277                $type[] = 'integer'; -
    278                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    279                $length = 3; -
    280            break; -
    281            case 'int': -
    282            case 'integer': -
    283                $type[] = 'integer'; -
    284                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    285                $length = 4; -
    286            break; -
    287            case 'bigint': -
    288                $type[] = 'integer'; -
    289                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    290                $length = 8; -
    291            break; -
    292            case 'tinytext': -
    293            case 'mediumtext': -
    294            case 'longtext': -
    295            case 'text': -
    296            case 'text': -
    297            case 'varchar': -
    298                $fixed = false; -
    299            case 'string': -
    300            case 'char': -
    301                $type[] = 'string'; -
    302                if ($length == '1') { -
    303                    $type[] = 'boolean'; -
    304                    if (preg_match('/^(is|has)/', $field['name'])) { -
    305                        $type = array_reverse($type); -
    306                    } -
    307                } elseif (strstr($dbType, 'text')) { -
    308                    $type[] = 'clob'; -
    309                    if ($decimal == 'binary') { -
    310                        $type[] = 'blob'; -
    311                    } -
    312                } -
    313                if ($fixed !== false) { -
    314                    $fixed = true; -
    315                } -
    316            break; -
    317            case 'enum': -
    318                $type[] = 'enum'; -
    319                preg_match_all('/\'.+\'/U', $field['type'], $matches); -
    320                $length = 0; -
    321                $fixed = false; -
    322                if (is_array($matches)) { -
    323                    foreach ($matches[0] as $value) { -
    324                        $length = max($length, strlen($value)-2); -
    325                    } -
    326                    if ($length == '1' && count($matches[0]) == 2) { -
    327                        $type[] = 'boolean'; -
    328                        if (preg_match('/^(is|has)/', $field['name'])) { -
    329                            $type = array_reverse($type); -
    330                        } -
    331                    } else { -
    332                        $values = $matches[0]; -
    333                    } -
    334                } -
    335                $type[] = 'integer'; -
    336            case 'set': -
    337                $fixed = false; -
    338                $type[] = 'text'; -
    339                $type[] = 'integer'; -
    340            break; -
    341            case 'date': -
    342                $type[] = 'date'; -
    343                $length = null; -
    344            break; -
    345            case 'datetime': -
    346            case 'timestamp': -
    347                $type[] = 'timestamp'; -
    348                $length = null; -
    349            break; -
    350            case 'time': -
    351                $type[] = 'time'; -
    352                $length = null; -
    353            break; -
    354            case 'float': -
    355            case 'double': -
    356            case 'real': -
    357                $type[] = 'float'; -
    358                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    359            break; -
    360            case 'unknown': -
    361            case 'decimal': -
    362            case 'numeric': -
    363                $type[] = 'decimal'; -
    364                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    365            break; -
    366            case 'tinyblob': -
    367            case 'mediumblob': -
    368            case 'longblob': -
    369            case 'blob': -
    370                $type[] = 'blob'; -
    371                $length = null; -
    372            break; -
    373            case 'year': -
    374                $type[] = 'integer'; -
    375                $type[] = 'date'; -
    376                $length = null; -
    377            break; -
    378            default: -
    379                throw new Doctrine_DataDict_Exception('unknown database attribute type: ' . $dbType); -
    380        } -
    381 -
    382        $length = ((int) $length == 0) ? null : (int) $length; -
    383 -
    384        if ($values === null) { -
    385            return array('type' => $type, 'length' => $length, 'unsigned' => $unsigned, 'fixed' => $fixed); -
    386        } else { -
    387            return array('type' => $type, 'length' => $length, 'unsigned' => $unsigned, 'fixed' => $fixed, 'values' => $values); -
    388        } -
    389    } -
    390 -
    391    /** -
    392     * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET -
    393     * of a field declaration to be used in statements like CREATE TABLE. -
    394     * -
    395     * @param string $charset   name of the charset -
    396     * @return string  DBMS specific SQL code portion needed to set the CHARACTER SET -
    397     *                 of a field declaration. -
    398     */ -
    399    public function getCharsetFieldDeclaration($charset) -
    400    { -
    401        return 'CHARACTER SET ' . $charset; -
    402    } -
    403 -
    404    /** -
    405     * Obtain DBMS specific SQL code portion needed to set the COLLATION -
    406     * of a field declaration to be used in statements like CREATE TABLE. -
    407     * -
    408     * @param string $collation   name of the collation -
    409     * @return string  DBMS specific SQL code portion needed to set the COLLATION -
    410     *                 of a field declaration. -
    411     */ -
    412    public function getCollationFieldDeclaration($collation) -
    413    { -
    414        return 'COLLATE ' . $collation; -
    415    } -
    416 -
    417    /** -
    418     * Obtain DBMS specific SQL code portion needed to declare an integer type -
    419     * field to be used in statements like CREATE TABLE. -
    420     * -
    421     * @param string  $name   name the field to be declared. -
    422     * @param string  $field  associative array with the name of the properties -
    423     *                        of the field being declared as array indexes. -
    424     *                        Currently, the types of supported field -
    425     *                        properties are as follows: -
    426     * -
    427     *                       unsigned -
    428     *                        Boolean flag that indicates whether the field -
    429     *                        should be declared as unsigned integer if -
    430     *                        possible. -
    431     * -
    432     *                       default -
    433     *                        Integer value to be used as default for this -
    434     *                        field. -
    435     * -
    436     *                       notnull -
    437     *                        Boolean flag that indicates whether this field is -
    438     *                        constrained to not be set to null. -
    439     * @return string  DBMS specific SQL code portion that should be used to -
    440     *                 declare the specified field. -
    441     */ -
    442    public function getIntegerDeclaration($name, $field) -
    443    { -
    444        $default = $autoinc = ''; -
    445        if ( ! empty($field['autoincrement'])) { -
    446            $autoinc = ' AUTO_INCREMENT'; -
    447        } elseif (array_key_exists('default', $field)) { -
    448            if ($field['default'] === '') { -
    449                $field['default'] = empty($field['notnull']) ? null : 0; -
    450            } -
    451            if (is_null($field['default'])) { -
    452                $default = ' DEFAULT NULL'; -
    453            } else { -
    454                $default = ' DEFAULT '.$this->conn->quote($field['default']); -
    455            } -
    456        } -
    457        /** -
    458        elseif (empty($field['notnull'])) { -
    459            $default = ' DEFAULT NULL'; -
    460        } -
    461        */ -
    462 -
    463        $notnull  = (isset($field['notnull'])  && $field['notnull'])  ? ' NOT NULL' : ''; -
    464        $unsigned = (isset($field['unsigned']) && $field['unsigned']) ? ' UNSIGNED' : ''; -
    465 -
    466        $name = $this->conn->quoteIdentifier($name, true); -
    467 -
    468        return $name . ' ' . $this->getNativeDeclaration($field) . $unsigned . $default . $notnull . $autoinc; -
    469    } -
    470}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_DataDict_Oracle.html b/tests_old/coverage/Doctrine_DataDict_Oracle.html deleted file mode 100644 index d05b70542..000000000 --- a/tests_old/coverage/Doctrine_DataDict_Oracle.html +++ /dev/null @@ -1,609 +0,0 @@ - - - Coverage for Doctrine_DataDict_Oracle - - -

    Coverage for Doctrine_DataDict_Oracle

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Oracle.php 3159 2007-11-15 05:16:31Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_DataDict'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  DataDict -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @version     $Revision: 3159 $ -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 */ -
    31class Doctrine_DataDict_Oracle extends Doctrine_DataDict -
    32{ -
    33    /** -
    34     * Obtain DBMS specific SQL code portion needed to declare an text type -
    35     * field to be used in statements like CREATE TABLE. -
    36     * -
    37     * @param array $field  associative array with the name of the properties -
    38     *      of the field being declared as array indexes. Currently, the types -
    39     *      of supported field properties are as follows: -
    40     * -
    41     *      length -
    42     *          Integer value that determines the maximum length of the text -
    43     *          field. If this argument is missing the field should be -
    44     *          declared to have the longest length allowed by the DBMS. -
    45     * -
    46     *      default -
    47     *          Text value to be used as default for this field. -
    48     * -
    49     *      notnull -
    50     *          Boolean flag that indicates whether this field is constrained -
    51     *          to not be set to null. -
    52     * @return string  DBMS specific SQL code portion that should be used to -
    53     *      declare the specified field. -
    54     */ -
    55    public function getNativeDeclaration(array $field) -
    56    { -
    57        if ( ! isset($field['type'])) { -
    58            throw new Doctrine_DataDict_Exception('Missing column type.'); -
    59        } -
    60        switch ($field['type']) { -
    61            case 'string': -
    62            case 'array': -
    63            case 'object': -
    64            case 'gzip': -
    65            case 'char': -
    66            case 'varchar': -
    67                $length = !empty($field['length']) -
    68                    ? $field['length'] : 16777215; // TODO: $this->conn->options['default_text_field_length']; -
    69 -
    70                $fixed  = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; -
    71 -
    72                return $fixed ? 'CHAR('.$length.')' : 'VARCHAR2('.$length.')'; -
    73            case 'clob': -
    74                return 'CLOB'; -
    75            case 'blob': -
    76                return 'BLOB'; -
    77            case 'integer': -
    78            case 'enum': -
    79            case 'int': -
    80                if ( ! empty($field['length'])) { -
    81                    return 'NUMBER('.$field['length'].')'; -
    82                } -
    83                return 'INT'; -
    84            case 'boolean': -
    85                return 'NUMBER(1)'; -
    86            case 'date': -
    87            case 'time': -
    88            case 'timestamp': -
    89                return 'DATE'; -
    90            case 'float': -
    91            case 'double': -
    92                return 'NUMBER'; -
    93            case 'decimal': -
    94                $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES); -
    95                return 'NUMBER(*,'.$scale.')'; -
    96            default: -
    97        } -
    98        throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] .  '\'.'); -
    99    } -
    100 -
    101    /** -
    102     * Maps a native array description of a field to a doctrine datatype and length -
    103     * -
    104     * @param array  $field native field description -
    105     * @return array containing the various possible types, length, sign, fixed -
    106     * @throws Doctrine_DataDict_Oracle_Exception -
    107     */ -
    108    public function getPortableDeclaration(array $field) -
    109    { -
    110        if ( ! isset($field['data_type'])) { -
    111            throw new Doctrine_DataDict_Exception('Native oracle definition must have a data_type key specified'); -
    112        } -
    113         -
    114        $dbType = strtolower($field['data_type']); -
    115        $type = array(); -
    116        $length = $unsigned = $fixed = null; -
    117        if ( ! empty($field['data_length'])) { -
    118            $length = $field['data_length']; -
    119        } -
    120 -
    121        if ( ! isset($field['column_name'])) { -
    122            $field['column_name'] = ''; -
    123        } -
    124 -
    125        switch ($dbType) { -
    126            case 'integer': -
    127            case 'pls_integer': -
    128            case 'binary_integer': -
    129                $type[] = 'integer'; -
    130                if ($length == '1') { -
    131                    $type[] = 'boolean'; -
    132                    if (preg_match('/^(is|has)/', $field['column_name'])) { -
    133                        $type = array_reverse($type); -
    134                    } -
    135                } -
    136                break; -
    137            case 'varchar': -
    138            case 'varchar2': -
    139            case 'nvarchar2': -
    140                $fixed = false; -
    141            case 'char': -
    142            case 'nchar': -
    143                $type[] = 'string'; -
    144                if ($length == '1') { -
    145                    $type[] = 'boolean'; -
    146                    if (preg_match('/^(is|has)/', $field['column_name'])) { -
    147                        $type = array_reverse($type); -
    148                    } -
    149                } -
    150                if ($fixed !== false) { -
    151                    $fixed = true; -
    152                } -
    153                break; -
    154            case 'date': -
    155            case 'timestamp': -
    156                $type[] = 'timestamp'; -
    157                $length = null; -
    158                break; -
    159            case 'float': -
    160                $type[] = 'float'; -
    161                break; -
    162            case 'number': -
    163                if ( ! empty($field['data_scale'])) { -
    164                    $type[] = 'decimal'; -
    165                } else { -
    166                    $type[] = 'integer'; -
    167                    if ($length == '1') { -
    168                        $type[] = 'boolean'; -
    169                        if (preg_match('/^(is|has)/', $field['column_name'])) { -
    170                            $type = array_reverse($type); -
    171                        } -
    172                    } -
    173                } -
    174                break; -
    175            case 'long': -
    176                $type[] = 'string'; -
    177            case 'clob': -
    178            case 'nclob': -
    179                $type[] = 'clob'; -
    180                break; -
    181            case 'blob': -
    182            case 'raw': -
    183            case 'long raw': -
    184            case 'bfile': -
    185                $type[] = 'blob'; -
    186                $length = null; -
    187            break; -
    188            case 'rowid': -
    189            case 'urowid': -
    190            default: -
    191                throw new Doctrine_DataDict_Exception('unknown database attribute type: ' . $dbType); -
    192        } -
    193 -
    194        return array('type'     => $type, -
    195                     'length'   => $length, -
    196                     'unsigned' => $unsigned, -
    197                     'fixed'    => $fixed); -
    198    } -
    199} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_DataDict_Pgsql.html b/tests_old/coverage/Doctrine_DataDict_Pgsql.html deleted file mode 100644 index a65daaa91..000000000 --- a/tests_old/coverage/Doctrine_DataDict_Pgsql.html +++ /dev/null @@ -1,1884 +0,0 @@ - - - Coverage for Doctrine_DataDict_Pgsql - - -

    Coverage for Doctrine_DataDict_Pgsql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Pgsql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_DataDict'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  DataDict -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Paul Cooper <pgc@ucecom.com> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @version     $Revision: 2963 $ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_DataDict_Pgsql extends Doctrine_DataDict -
    34{ -
    35    /** -
    36     * @param array $reservedKeyWords     an array of reserved keywords by pgsql -
    37     */ -
    38    protected static $reservedKeyWords = array( -
    39                                        'abort', -
    40                                        'absolute', -
    41                                        'access', -
    42                                        'action', -
    43                                        'add', -
    44                                        'after', -
    45                                        'aggregate', -
    46                                        'all', -
    47                                        'alter', -
    48                                        'analyse', -
    49                                        'analyze', -
    50                                        'and', -
    51                                        'any', -
    52                                        'as', -
    53                                        'asc', -
    54                                        'assertion', -
    55                                        'assignment', -
    56                                        'at', -
    57                                        'authorization', -
    58                                        'backward', -
    59                                        'before', -
    60                                        'begin', -
    61                                        'between', -
    62                                        'bigint', -
    63                                        'binary', -
    64                                        'bit', -
    65                                        'boolean', -
    66                                        'both', -
    67                                        'by', -
    68                                        'cache', -
    69                                        'called', -
    70                                        'cascade', -
    71                                        'case', -
    72                                        'cast', -
    73                                        'chain', -
    74                                        'char', -
    75                                        'character', -
    76                                        'characteristics', -
    77                                        'check', -
    78                                        'checkpoint', -
    79                                        'class', -
    80                                        'close', -
    81                                        'cluster', -
    82                                        'coalesce', -
    83                                        'collate', -
    84                                        'column', -
    85                                        'comment', -
    86                                        'commit', -
    87                                        'committed', -
    88                                        'constraint', -
    89                                        'constraints', -
    90                                        'conversion', -
    91                                        'convert', -
    92                                        'copy', -
    93                                        'create', -
    94                                        'createdb', -
    95                                        'createuser', -
    96                                        'cross', -
    97                                        'current_date', -
    98                                        'current_time', -
    99                                        'current_timestamp', -
    100                                        'current_user', -
    101                                        'cursor', -
    102                                        'cycle', -
    103                                        'database', -
    104                                        'day', -
    105                                        'deallocate', -
    106                                        'dec', -
    107                                        'decimal', -
    108                                        'declare', -
    109                                        'default', -
    110                                        'deferrable', -
    111                                        'deferred', -
    112                                        'definer', -
    113                                        'delete', -
    114                                        'delimiter', -
    115                                        'delimiters', -
    116                                        'desc', -
    117                                        'distinct', -
    118                                        'do', -
    119                                        'domain', -
    120                                        'double', -
    121                                        'drop', -
    122                                        'each', -
    123                                        'else', -
    124                                        'encoding', -
    125                                        'encrypted', -
    126                                        'end', -
    127                                        'escape', -
    128                                        'except', -
    129                                        'exclusive', -
    130                                        'execute', -
    131                                        'exists', -
    132                                        'explain', -
    133                                        'external', -
    134                                        'extract', -
    135                                        'false', -
    136                                        'fetch', -
    137                                        'float', -
    138                                        'for', -
    139                                        'force', -
    140                                        'foreign', -
    141                                        'forward', -
    142                                        'freeze', -
    143                                        'from', -
    144                                        'full', -
    145                                        'function', -
    146                                        'get', -
    147                                        'global', -
    148                                        'grant', -
    149                                        'group', -
    150                                        'handler', -
    151                                        'having', -
    152                                        'hour', -
    153                                        'ilike', -
    154                                        'immediate', -
    155                                        'immutable', -
    156                                        'implicit', -
    157                                        'in', -
    158                                        'increment', -
    159                                        'index', -
    160                                        'inherits', -
    161                                        'initially', -
    162                                        'inner', -
    163                                        'inout', -
    164                                        'input', -
    165                                        'insensitive', -
    166                                        'insert', -
    167                                        'instead', -
    168                                        'int', -
    169                                        'integer', -
    170                                        'intersect', -
    171                                        'interval', -
    172                                        'into', -
    173                                        'invoker', -
    174                                        'is', -
    175                                        'isnull', -
    176                                        'isolation', -
    177                                        'join', -
    178                                        'key', -
    179                                        'lancompiler', -
    180                                        'language', -
    181                                        'leading', -
    182                                        'left', -
    183                                        'level', -
    184                                        'like', -
    185                                        'limit', -
    186                                        'listen', -
    187                                        'load', -
    188                                        'local', -
    189                                        'localtime', -
    190                                        'localtimestamp', -
    191                                        'location', -
    192                                        'lock', -
    193                                        'match', -
    194                                        'maxvalue', -
    195                                        'minute', -
    196                                        'minvalue', -
    197                                        'mode', -
    198                                        'month', -
    199                                        'move', -
    200                                        'names', -
    201                                        'national', -
    202                                        'natural', -
    203                                        'nchar', -
    204                                        'new', -
    205                                        'next', -
    206                                        'no', -
    207                                        'nocreatedb', -
    208                                        'nocreateuser', -
    209                                        'none', -
    210                                        'not', -
    211                                        'nothing', -
    212                                        'notify', -
    213                                        'notnull', -
    214                                        'null', -
    215                                        'nullif', -
    216                                        'numeric', -
    217                                        'of', -
    218                                        'off', -
    219                                        'offset', -
    220                                        'oids', -
    221                                        'old', -
    222                                        'on', -
    223                                        'only', -
    224                                        'operator', -
    225                                        'option', -
    226                                        'or', -
    227                                        'order', -
    228                                        'out', -
    229                                        'outer', -
    230                                        'overlaps', -
    231                                        'overlay', -
    232                                        'owner', -
    233                                        'partial', -
    234                                        'password', -
    235                                        'path', -
    236                                        'pendant', -
    237                                        'placing', -
    238                                        'position', -
    239                                        'precision', -
    240                                        'prepare', -
    241                                        'primary', -
    242                                        'prior', -
    243                                        'privileges', -
    244                                        'procedural', -
    245                                        'procedure', -
    246                                        'read', -
    247                                        'real', -
    248                                        'recheck', -
    249                                        'references', -
    250                                        'reindex', -
    251                                        'relative', -
    252                                        'rename', -
    253                                        'replace', -
    254                                        'reset', -
    255                                        'restrict', -
    256                                        'returns', -
    257                                        'revoke', -
    258                                        'right', -
    259                                        'rollback', -
    260                                        'row', -
    261                                        'rule', -
    262                                        'schema', -
    263                                        'scroll', -
    264                                        'second', -
    265                                        'security', -
    266                                        'select', -
    267                                        'sequence', -
    268                                        'serializable', -
    269                                        'session', -
    270                                        'session_user', -
    271                                        'set', -
    272                                        'setof', -
    273                                        'share', -
    274                                        'show', -
    275                                        'similar', -
    276                                        'simple', -
    277                                        'smallint', -
    278                                        'some', -
    279                                        'stable', -
    280                                        'start', -
    281                                        'statement', -
    282                                        'statistics', -
    283                                        'stdin', -
    284                                        'stdout', -
    285                                        'storage', -
    286                                        'strict', -
    287                                        'substring', -
    288                                        'sysid', -
    289                                        'table', -
    290                                        'temp', -
    291                                        'template', -
    292                                        'temporary', -
    293                                        'then', -
    294                                        'time', -
    295                                        'timestamp', -
    296                                        'to', -
    297                                        'toast', -
    298                                        'trailing', -
    299                                        'transaction', -
    300                                        'treat', -
    301                                        'trigger', -
    302                                        'trim', -
    303                                        'true', -
    304                                        'truncate', -
    305                                        'trusted', -
    306                                        'type', -
    307                                        'unencrypted', -
    308                                        'union', -
    309                                        'unique', -
    310                                        'unknown', -
    311                                        'unlisten', -
    312                                        'until', -
    313                                        'update', -
    314                                        'usage', -
    315                                        'user', -
    316                                        'using', -
    317                                        'vacuum', -
    318                                        'valid', -
    319                                        'validator', -
    320                                        'values', -
    321                                        'varchar', -
    322                                        'varying', -
    323                                        'verbose', -
    324                                        'version', -
    325                                        'view', -
    326                                        'volatile', -
    327                                        'when', -
    328                                        'where', -
    329                                        'with', -
    330                                        'without', -
    331                                        'work', -
    332                                        'write', -
    333                                        'year', -
    334                                        'zone' -
    335                                        ); -
    336 -
    337    /** -
    338     * Obtain DBMS specific SQL code portion needed to declare an text type -
    339     * field to be used in statements like CREATE TABLE. -
    340     * -
    341     * @param array $field  associative array with the name of the properties -
    342     *      of the field being declared as array indexes. Currently, the types -
    343     *      of supported field properties are as follows: -
    344     * -
    345     *      length -
    346     *          Integer value that determines the maximum length of the text -
    347     *          field. If this argument is missing the field should be -
    348     *          declared to have the longest length allowed by the DBMS. -
    349     * -
    350     *      default -
    351     *          Text value to be used as default for this field. -
    352     * -
    353     *      notnull -
    354     *          Boolean flag that indicates whether this field is constrained -
    355     *          to not be set to null. -
    356     * -
    357     * @return string  DBMS specific SQL code portion that should be used to -
    358     *      declare the specified field. -
    359     */ -
    360    public function getNativeDeclaration(array $field) -
    361    { -
    362        if ( ! isset($field['type'])) { -
    363            throw new Doctrine_DataDict_Exception('Missing column type.'); -
    364        } -
    365        switch ($field['type']) { -
    366            case 'char': -
    367            case 'string': -
    368            case 'array': -
    369            case 'object': -
    370            case 'varchar': -
    371            case 'gzip': -
    372                // TODO: what is the maximum VARCHAR length in pgsql ? -
    373                $length = (isset($field['length']) && $field['length'] && $field['length'] < 10000) ? $field['length'] : null; -
    374 -
    375                $fixed  = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; -
    376 -
    377                return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR('.$this->conn->options['default_text_field_length'].')') -
    378                    : ($length ? 'VARCHAR(' .$length . ')' : 'TEXT'); -
    379 -
    380            case 'clob': -
    381                return 'TEXT'; -
    382            case 'blob': -
    383                return 'BYTEA'; -
    384            case 'enum': -
    385            case 'integer': -
    386            case 'int': -
    387                if ( ! empty($field['autoincrement'])) { -
    388                    if ( ! empty($field['length'])) { -
    389                        $length = $field['length']; -
    390                        if ($length > 4) { -
    391                            return 'BIGSERIAL'; -
    392                        } -
    393                    } -
    394                    return 'SERIAL'; -
    395                } -
    396                if ( ! empty($field['length'])) { -
    397                    $length = $field['length']; -
    398                    if ($length <= 2) { -
    399                        return 'SMALLINT'; -
    400                    } elseif ($length == 3 || $length == 4) { -
    401                        return 'INT'; -
    402                    } elseif ($length > 4) { -
    403                        return 'BIGINT'; -
    404                    } -
    405                } -
    406                return 'INT'; -
    407            case 'boolean': -
    408                return 'BOOLEAN'; -
    409            case 'date': -
    410                return 'DATE'; -
    411            case 'time': -
    412                return 'TIME without time zone'; -
    413            case 'timestamp': -
    414                return 'TIMESTAMP without time zone'; -
    415            case 'float': -
    416            case 'double': -
    417                return 'FLOAT8'; -
    418            case 'decimal': -
    419                $length = !empty($field['length']) ? $field['length'] : 18; -
    420                $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES); -
    421                return 'NUMERIC('.$length.','.$scale.')'; -
    422        } -
    423        throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] .  '\'.'); -
    424    } -
    425 -
    426    /** -
    427     * Maps a native array description of a field to a portable Doctrine datatype and length -
    428     * -
    429     * @param array  $field native field description -
    430     * -
    431     * @return array containing the various possible types, length, sign, fixed -
    432     */ -
    433    public function getPortableDeclaration(array $field) -
    434    { -
    435 -
    436        $length = (isset($field['length'])) ? $field['length'] : null; -
    437        if ($length == '-1' && isset($field['atttypmod'])) { -
    438            $length = $field['atttypmod'] - 4; -
    439        } -
    440        if ((int)$length <= 0) { -
    441            $length = null; -
    442        } -
    443        $type = array(); -
    444        $unsigned = $fixed = null; -
    445 -
    446        if ( ! isset($field['name'])) { -
    447            $field['name'] = ''; -
    448        } -
    449 -
    450        $dbType = strtolower($field['type']); -
    451 -
    452        switch ($dbType) { -
    453            case 'smallint': -
    454            case 'int2': -
    455                $type[] = 'integer'; -
    456                $unsigned = false; -
    457                $length = 2; -
    458                if ($length == '2') { -
    459                    $type[] = 'boolean'; -
    460                    if (preg_match('/^(is|has)/', $field['name'])) { -
    461                        $type = array_reverse($type); -
    462                    } -
    463                } -
    464                break; -
    465            case 'int': -
    466            case 'int4': -
    467            case 'integer': -
    468            case 'serial': -
    469            case 'serial4': -
    470                $type[] = 'integer'; -
    471                $unsigned = false; -
    472                $length = 4; -
    473                break; -
    474            case 'bigint': -
    475            case 'int8': -
    476            case 'bigserial': -
    477            case 'serial8': -
    478                $type[] = 'integer'; -
    479                $unsigned = false; -
    480                $length = 8; -
    481                break; -
    482            case 'bool': -
    483            case 'boolean': -
    484                $type[] = 'boolean'; -
    485                $length = 1; -
    486                break; -
    487            case 'text': -
    488            case 'varchar': -
    489                $fixed = false; -
    490            case 'unknown': -
    491            case 'char': -
    492            case 'bpchar': -
    493                $type[] = 'string'; -
    494                if ($length == '1') { -
    495                    $type[] = 'boolean'; -
    496                    if (preg_match('/^(is|has)/', $field['name'])) { -
    497                        $type = array_reverse($type); -
    498                    } -
    499                } elseif (strstr($dbType, 'text')) { -
    500                    $type[] = 'clob'; -
    501                } -
    502                if ($fixed !== false) { -
    503                    $fixed = true; -
    504                } -
    505                break; -
    506            case 'date': -
    507                $type[] = 'date'; -
    508                $length = null; -
    509                break; -
    510            case 'datetime': -
    511            case 'timestamp': -
    512                $type[] = 'timestamp'; -
    513                $length = null; -
    514                break; -
    515            case 'time': -
    516                $type[] = 'time'; -
    517                $length = null; -
    518                break; -
    519            case 'float': -
    520            case 'float4': -
    521            case 'double': -
    522            case 'real': -
    523                $type[] = 'float'; -
    524                break; -
    525            case 'decimal': -
    526            case 'money': -
    527            case 'numeric': -
    528                $type[] = 'decimal'; -
    529                break; -
    530            case 'tinyblob': -
    531            case 'mediumblob': -
    532            case 'longblob': -
    533            case 'blob': -
    534            case 'bytea': -
    535                $type[] = 'blob'; -
    536                $length = null; -
    537                break; -
    538            case 'oid': -
    539                $type[] = 'blob'; -
    540                $type[] = 'clob'; -
    541                $length = null; -
    542                break; -
    543            case 'year': -
    544                $type[] = 'integer'; -
    545                $type[] = 'date'; -
    546                $length = null; -
    547                break; -
    548            default: -
    549                throw new Doctrine_DataDict_Exception('unknown database attribute type: '.$dbType); -
    550        } -
    551 -
    552        return array('type'     => $type, -
    553                     'length'   => $length, -
    554                     'unsigned' => $unsigned, -
    555                     'fixed'    => $fixed); -
    556    } -
    557 -
    558    /** -
    559     * Obtain DBMS specific SQL code portion needed to declare an integer type -
    560     * field to be used in statements like CREATE TABLE. -
    561     * -
    562     * @param string $name name the field to be declared. -
    563     * @param array $field associative array with the name of the properties -
    564     *       of the field being declared as array indexes. Currently, the types -
    565     *       of supported field properties are as follows: -
    566     * -
    567     *       unsigned -
    568     *           Boolean flag that indicates whether the field should be -
    569     *           declared as unsigned integer if possible. -
    570     * -
    571     *       default -
    572     *           Integer value to be used as default for this field. -
    573     * -
    574     *       notnull -
    575     *           Boolean flag that indicates whether this field is constrained -
    576     *           to not be set to null. -
    577     * @return string DBMS specific SQL code portion that should be used to -
    578     *       declare the specified field. -
    579     */ -
    580    public function getIntegerDeclaration($name, $field) -
    581    { -
    582        /** -
    583        if ( ! empty($field['unsigned'])) { -
    584            $this->conn->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer"; -
    585        } -
    586        */ -
    587 -
    588        if ( ! empty($field['autoincrement'])) { -
    589            $name = $this->conn->quoteIdentifier($name, true); -
    590            return $name . ' ' . $this->getNativeDeclaration($field); -
    591        } -
    592 -
    593        $default = ''; -
    594        if (array_key_exists('default', $field)) { -
    595            if ($field['default'] === '') { -
    596                $field['default'] = empty($field['notnull']) ? null : 0; -
    597            } -
    598            $default = ' DEFAULT '.$this->conn->quote($field['default'], $field['type']); -
    599        } -
    600        /** -
    601        TODO: is this needed ? -
    602        elseif (empty($field['notnull'])) { -
    603            $default = ' DEFAULT NULL'; -
    604        } -
    605        */ -
    606 -
    607        $notnull = empty($field['notnull']) ? '' : ' NOT NULL'; -
    608        $name = $this->conn->quoteIdentifier($name, true); -
    609        return $name . ' ' . $this->getNativeDeclaration($field) . $default . $notnull; -
    610    } -
    611 -
    612    /** -
    613     * parseBoolean -
    614     * parses a literal boolean value and returns -
    615     * proper sql equivalent -
    616     * -
    617     * @param string $value     boolean value to be parsed -
    618     * @return string           parsed boolean value -
    619     */ -
    620    public function parseBoolean($value) -
    621    { -
    622        return $value; -
    623    } -
    624} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_DataDict_Sqlite.html b/tests_old/coverage/Doctrine_DataDict_Sqlite.html deleted file mode 100644 index e6bc23894..000000000 --- a/tests_old/coverage/Doctrine_DataDict_Sqlite.html +++ /dev/null @@ -1,911 +0,0 @@ - - - Coverage for Doctrine_DataDict_Sqlite - - -

    Coverage for Doctrine_DataDict_Sqlite

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Sqlite.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_DataDict'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  DataDict -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    28 * @version     $Revision: 2963 $ -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 */ -
    32class Doctrine_DataDict_Sqlite extends Doctrine_DataDict -
    33{ -
    34    /** -
    35     * Obtain DBMS specific SQL code portion needed to declare an text type -
    36     * field to be used in statements like CREATE TABLE. -
    37     * -
    38     * @param array $field  associative array with the name of the properties -
    39     *      of the field being declared as array indexes. Currently, the types -
    40     *      of supported field properties are as follows: -
    41     * -
    42     *      length -
    43     *          Integer value that determines the maximum length of the text -
    44     *          field. If this argument is missing the field should be -
    45     *          declared to have the longest length allowed by the DBMS. -
    46     * -
    47     *      default -
    48     *          Text value to be used as default for this field. -
    49     * -
    50     *      notnull -
    51     *          Boolean flag that indicates whether this field is constrained -
    52     *          to not be set to null. -
    53     * @author Lukas Smith (PEAR MDB2 library) -
    54     * @return string  DBMS specific SQL code portion that should be used to -
    55     *      declare the specified field. -
    56     */ -
    57    public function getNativeDeclaration(array $field) -
    58    { -
    59        if ( ! isset($field['type'])) { -
    60            throw new Doctrine_DataDict_Exception('Missing column type.'); -
    61        } -
    62        switch ($field['type']) { -
    63            case 'text': -
    64            case 'object': -
    65            case 'array': -
    66            case 'string': -
    67            case 'char': -
    68            case 'gzip': -
    69            case 'varchar': -
    70                $length = (isset($field['length']) && $field['length']) ? $field['length'] : null; -
    71 -
    72                $fixed  = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; -
    73 -
    74                return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->getAttribute(Doctrine::ATTR_DEFAULT_TEXTFLD_LENGTH).')') -
    75                    : ($length ? 'VARCHAR('.$length.')' : 'TEXT'); -
    76            case 'clob': -
    77                if ( ! empty($field['length'])) { -
    78                    $length = $field['length']; -
    79                    if ($length <= 255) { -
    80                        return 'TINYTEXT'; -
    81                    } elseif ($length <= 65535) { -
    82                        return 'TEXT'; -
    83                    } elseif ($length <= 16777215) { -
    84                        return 'MEDIUMTEXT'; -
    85                    } -
    86                } -
    87                return 'LONGTEXT'; -
    88            case 'blob': -
    89                if ( ! empty($field['length'])) { -
    90                    $length = $field['length']; -
    91                    if ($length <= 255) { -
    92                        return 'TINYBLOB'; -
    93                    } elseif ($length <= 65535) { -
    94                        return 'BLOB'; -
    95                    } elseif ($length <= 16777215) { -
    96                        return 'MEDIUMBLOB'; -
    97                    } -
    98                } -
    99                return 'LONGBLOB'; -
    100            case 'enum': -
    101            case 'integer': -
    102            case 'boolean': -
    103            case 'int': -
    104                return 'INTEGER'; -
    105            case 'date': -
    106                return 'DATE'; -
    107            case 'time': -
    108                return 'TIME'; -
    109            case 'timestamp': -
    110                return 'DATETIME'; -
    111            case 'float': -
    112            case 'double': -
    113                return 'DOUBLE';//($this->conn->options['fixed_float'] ? '('. -
    114                    //($this->conn->options['fixed_float']+2).','.$this->conn->options['fixed_float'].')' : ''); -
    115            case 'decimal': -
    116                $length = !empty($field['length']) ? $field['length'] : 18; -
    117                $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES); -
    118                return 'DECIMAL('.$length.','.$scale.')'; -
    119        } -
    120        throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] .  '\'.'); -
    121    } -
    122 -
    123    /** -
    124     * Maps a native array description of a field to Doctrine datatype and length -
    125     * -
    126     * @param array  $field native field description -
    127     * @return array containing the various possible types, length, sign, fixed -
    128     */ -
    129    public function getPortableDeclaration(array $field) -
    130    { -
    131        $dbType = strtolower($field['type']); -
    132        $length = (isset($field['length'])) ? $field['length'] : null; -
    133        $unsigned = (isset($field['unsigned'])) ? $field['unsigned'] : null; -
    134        $fixed = null; -
    135        $type = array(); -
    136 -
    137        if ( ! isset($field['name'])) { -
    138            $field['name'] = ''; -
    139        } -
    140 -
    141        switch ($dbType) { -
    142            case 'boolean': -
    143                $type[] = 'boolean'; -
    144                break; -
    145            case 'tinyint': -
    146                $type[] = 'integer'; -
    147                $type[] = 'boolean'; -
    148                if (preg_match('/^(is|has)/', $field['name'])) { -
    149                    $type = array_reverse($type); -
    150                } -
    151                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    152                $length = 1; -
    153                break; -
    154            case 'smallint': -
    155                $type[] = 'integer'; -
    156                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    157                $length = 2; -
    158                break; -
    159            case 'mediumint': -
    160                $type[] = 'integer'; -
    161                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    162                $length = 3; -
    163                break; -
    164            case 'int': -
    165            case 'integer': -
    166            case 'serial': -
    167                $type[] = 'integer'; -
    168                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    169                $length = 4; -
    170                break; -
    171            case 'bigint': -
    172            case 'bigserial': -
    173                $type[] = 'integer'; -
    174                $unsigned = preg_match('/ unsigned/i', $field['type']); -
    175                $length = 8; -
    176                break; -
    177            case 'clob': -
    178            case 'tinytext': -
    179            case 'mediumtext': -
    180            case 'longtext': -
    181            case 'text': -
    182            case 'varchar': -
    183            case 'varchar2': -
    184                $fixed = false; -
    185            case 'char': -
    186                $type[] = 'text'; -
    187                if ($length == '1') { -
    188                    $type[] = 'boolean'; -
    189                    if (preg_match('/^(is|has)/', $field['name'])) { -
    190                        $type = array_reverse($type); -
    191                    } -
    192                } elseif (strstr($dbType, 'text')) { -
    193                    $type[] = 'clob'; -
    194                } -
    195                if ($fixed !== false) { -
    196                    $fixed = true; -
    197                } -
    198                break; -
    199            case 'date': -
    200                $type[] = 'date'; -
    201                $length = null; -
    202                break; -
    203            case 'datetime': -
    204            case 'timestamp': -
    205                $type[] = 'timestamp'; -
    206                $length = null; -
    207                break; -
    208            case 'time': -
    209                $type[] = 'time'; -
    210                $length = null; -
    211                break; -
    212            case 'float': -
    213            case 'double': -
    214            case 'real': -
    215                $type[] = 'float'; -
    216                $length = null; -
    217                break; -
    218            case 'decimal': -
    219            case 'numeric': -
    220                $type[] = 'decimal'; -
    221                $length = null; -
    222                break; -
    223            case 'tinyblob': -
    224            case 'mediumblob': -
    225            case 'longblob': -
    226            case 'blob': -
    227                $type[] = 'blob'; -
    228                $length = null; -
    229                break; -
    230            case 'year': -
    231                $type[] = 'integer'; -
    232                $type[] = 'date'; -
    233                $length = null; -
    234                break; -
    235            default: -
    236                throw new Doctrine_DataDict_Exception('unknown database attribute type: '.$dbType); -
    237        } -
    238 -
    239        return array('type'     => $type, -
    240                     'length'   => $length, -
    241                     'unsigned' => $unsigned, -
    242                     'fixed'    => $fixed); -
    243    } -
    244 -
    245    /** -
    246     * Obtain DBMS specific SQL code portion needed to declare an integer type -
    247     * field to be used in statements like CREATE TABLE. -
    248     * -
    249     * @param string  $name   name the field to be declared. -
    250     * @param array  $field   associative array with the name of the properties -
    251     *                        of the field being declared as array indexes. -
    252     *                        Currently, the types of supported field -
    253     *                        properties are as follows: -
    254     * -
    255     *                       unsigned -
    256     *                        Boolean flag that indicates whether the field -
    257     *                        should be declared as unsigned integer if -
    258     *                        possible. -
    259     * -
    260     *                       default -
    261     *                        Integer value to be used as default for this -
    262     *                        field. -
    263     * -
    264     *                       notnull -
    265     *                        Boolean flag that indicates whether this field is -
    266     *                        constrained to not be set to null. -
    267     * @return string  DBMS specific SQL code portion that should be used to -
    268     *                 declare the specified field. -
    269     * @access protected -
    270     */ -
    271    public function getIntegerDeclaration($name, array $field) -
    272    { -
    273        $default = $autoinc = ''; -
    274        $type    = $this->getNativeDeclaration($field); -
    275 -
    276        $autoincrement = isset($field['autoincrement']) && $field['autoincrement']; -
    277 -
    278        if ($autoincrement) { -
    279            $autoinc = ' PRIMARY KEY AUTOINCREMENT'; -
    280            $type    = 'INTEGER'; -
    281        } elseif (array_key_exists('default', $field)) { -
    282            if ($field['default'] === '') { -
    283                $field['default'] = empty($field['notnull']) ? null : 0; -
    284            } -
    285            $default = ' DEFAULT ' . $this->conn->quote($field['default'], $field['type']); -
    286        }/** -
    287        elseif (empty($field['notnull'])) { -
    288            $default = ' DEFAULT NULL'; -
    289        } -
    290        */ -
    291 -
    292        $notnull  = (isset($field['notnull']) && $field['notnull']) ? ' NOT NULL' : ''; -
    293 -
    294        // sqlite does not support unsigned attribute for autoinremented fields -
    295        $unsigned = (isset($field['unsigned']) && $field['unsigned'] && !$autoincrement) ? ' UNSIGNED' : ''; -
    296 -
    297        $name = $this->conn->quoteIdentifier($name, true); -
    298        return $name . ' ' . $type . $unsigned . $default . $notnull . $autoinc; -
    299    } -
    300}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Event.html b/tests_old/coverage/Doctrine_Event.html deleted file mode 100644 index dd683b06b..000000000 --- a/tests_old/coverage/Doctrine_Event.html +++ /dev/null @@ -1,999 +0,0 @@ - - - Coverage for Doctrine_Event - - -

    Coverage for Doctrine_Event

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Event -
    24 * -
    25 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    26 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    27 * @package     Doctrine -
    28 * @subpackage  Event -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 */ -
    33class Doctrine_Event -
    34{ -
    35    /** -
    36     * CONNECTION EVENT CODES -
    37     */ -
    38    const CONN_QUERY         = 1; -
    39    const CONN_EXEC          = 2; -
    40    const CONN_PREPARE       = 3; -
    41    const CONN_CONNECT       = 4; -
    42    const CONN_CLOSE         = 5; -
    43    const CONN_ERROR         = 6; -
    44 -
    45    const STMT_EXECUTE       = 10; -
    46    const STMT_FETCH         = 11; -
    47    const STMT_FETCHALL      = 12; -
    48 -
    49    const TX_BEGIN           = 31; -
    50    const TX_COMMIT          = 32; -
    51    const TX_ROLLBACK        = 33; -
    52    const SAVEPOINT_CREATE   = 34; -
    53    const SAVEPOINT_ROLLBACK = 35; -
    54    const SAVEPOINT_COMMIT   = 36; -
    55 -
    56    const HYDRATE            = 40; -
    57 -
    58    /* -
    59     * RECORD EVENT CODES -
    60     */ -
    61    const RECORD_DELETE      = 21; -
    62    const RECORD_SAVE        = 22; -
    63    const RECORD_UPDATE      = 23; -
    64    const RECORD_INSERT      = 24; -
    65    const RECORD_SERIALIZE   = 25; -
    66    const RECORD_UNSERIALIZE = 26; -
    67 -
    68    /** -
    69     * @var mixed $_invoker             the handler which invoked this event -
    70     */ -
    71    protected $_invoker; -
    72 -
    73    /** -
    74     * @var string $_query              the sql query associated with this event (if any) -
    75     */ -
    76    protected $_query; -
    77 -
    78    /** -
    79     * @var string $_params             the parameters associated with the query (if any) -
    80     */ -
    81    protected $_params; -
    82 -
    83    /** -
    84     * @see Doctrine_Event constants -
    85     * @var integer $_code              the event code -
    86     */ -
    87    protected $_code; -
    88 -
    89    /** -
    90     * @var integer $_startedMicrotime  the time point in which this event was started -
    91     */ -
    92    protected $_startedMicrotime; -
    93 -
    94    /** -
    95     * @var integer $_endedMicrotime    the time point in which this event was ended -
    96     */ -
    97    protected $_endedMicrotime; -
    98 -
    99    /** -
    100     * @var array $_options             an array of options -
    101     */ -
    102    protected $_options = array(); -
    103 -
    104    /** -
    105     * constructor -
    106     * -
    107     * @param Doctrine_Connection|Doctrine_Connection_Statement| -
    108              Doctrine_Connection_UnitOfWork|Doctrine_Transaction $invoker   the handler which invoked this event -
    109     * @param integer $code                                                  the event code -
    110     * @param string $query                                                  the sql query associated with this event (if any) -
    111     */ -
    112    public function __construct($invoker, $code, $query = null, $params = array()) -
    113    { -
    114        $this->_invoker = $invoker; -
    115        $this->_code    = $code; -
    116        $this->_query   = $query; -
    117        $this->_params  = $params; -
    118    } -
    119 -
    120    /** -
    121     * getQuery -
    122     * -
    123     * @return string       returns the query associated with this event (if any) -
    124     */ -
    125    public function getQuery() -
    126    { -
    127        return $this->_query; -
    128    } -
    129 -
    130    /** -
    131     * getName -
    132     * returns the name of this event -
    133     * -
    134     * @return string       the name of this event -
    135     */ -
    136    public function getName()  -
    137    { -
    138        switch ($this->_code) { -
    139            case self::CONN_QUERY: -
    140                return 'query'; -
    141            case self::CONN_EXEC: -
    142                return 'exec'; -
    143            case self::CONN_PREPARE: -
    144                return 'prepare'; -
    145            case self::CONN_CONNECT: -
    146                return 'connect'; -
    147            case self::CONN_CLOSE: -
    148                return 'close'; -
    149            case self::CONN_ERROR: -
    150                return 'error'; -
    151 -
    152            case self::STMT_EXECUTE: -
    153                return 'execute'; -
    154            case self::STMT_FETCH: -
    155                return 'fetch'; -
    156            case self::STMT_FETCHALL: -
    157                return 'fetch all'; -
    158             -
    159            case self::TX_BEGIN: -
    160                return 'begin'; -
    161            case self::TX_COMMIT: -
    162                return 'commit'; -
    163            case self::TX_ROLLBACK: -
    164                return 'rollback'; -
    165 -
    166            case self::SAVEPOINT_CREATE: -
    167                return 'create savepoint'; -
    168            case self::SAVEPOINT_ROLLBACK: -
    169                return 'rollback savepoint'; -
    170            case self::SAVEPOINT_COMMIT: -
    171                return 'commit savepoint'; -
    172  -
    173            case self::RECORD_DELETE: -
    174                return 'delete record'; -
    175            case self::RECORD_SAVE: -
    176                return 'save record'; -
    177            case self::RECORD_UPDATE: -
    178                return 'update record'; -
    179            case self::RECORD_INSERT: -
    180                return 'insert record'; -
    181            case self::RECORD_SERIALIZE: -
    182                return 'serialize record'; -
    183            case self::RECORD_UNSERIALIZE: -
    184                return 'unserialize record'; -
    185        } -
    186    } -
    187 -
    188    /** -
    189     * getCode -
    190     * -
    191     * @return integer      returns the code associated with this event -
    192     */ -
    193    public function getCode() -
    194    { -
    195        return $this->_code; -
    196    } -
    197 -
    198    /** -
    199     * getOption -
    200     * returns the value of an option -
    201     * -
    202     * @param string $option    the name of the option -
    203     * @return mixed -
    204     */ -
    205    public function __get($option) -
    206    { -
    207        if ( ! isset($this->_options[$option])) { -
    208            return null; -
    209        } -
    210         -
    211        return $this->_options[$option]; -
    212    } -
    213 -
    214    /** -
    215     * skipOperation -
    216     * skips the next operation -
    217     * an alias for __set('skipOperation', true) -
    218     * -
    219     * @return Doctrine_Event   this object -
    220     */ -
    221    public function skipOperation() -
    222    { -
    223        $this->_options['skipOperation'] = true; -
    224     -
    225        return $this; -
    226    } -
    227 -
    228    /** -
    229     * setOption -
    230     * sets the value of an option -
    231     * -
    232     * @param string $option    the name of the option -
    233     * @param mixed $value      the value of the given option -
    234     * @return Doctrine_Event   this object -
    235     */ -
    236    public function __set($option, $value) -
    237    { -
    238        $this->_options[$option] = $value; -
    239 -
    240        return $this; -
    241    } -
    242 -
    243    /** -
    244     * setOption -
    245     * sets the value of an option by reference -
    246     * -
    247     * @param string $option    the name of the option -
    248     * @param mixed $value      the value of the given option -
    249     * @return Doctrine_Event   this object -
    250     */ -
    251    public function set($option, &$value) -
    252    { -
    253        $this->_options[$option] =& $value; -
    254 -
    255        return $this; -
    256    } -
    257 -
    258    /** -
    259     * start -
    260     * starts the internal timer of this event -
    261     * -
    262     * @return Doctrine_Event   this object -
    263     */ -
    264    public function start() -
    265    { -
    266        $this->_startedMicrotime = microtime(true); -
    267    } -
    268 -
    269    /** -
    270     * hasEnded -
    271     * whether or not this event has ended -
    272     * -
    273     * @return boolean -
    274     */ -
    275    public function hasEnded() -
    276    { -
    277        return ($this->_endedMicrotime != null); -
    278    } -
    279 -
    280    /** -
    281     * end -
    282     * ends the internal timer of this event -
    283     * -
    284     * @return Doctrine_Event   this object -
    285     */ -
    286    public function end() -
    287    { -
    288        $this->_endedMicrotime = microtime(true); -
    289         -
    290        return $this; -
    291    } -
    292 -
    293    /** -
    294     * getInvoker -
    295     * returns the handler that invoked this event -
    296     * -
    297     * @return Doctrine_Connection|Doctrine_Connection_Statement| -
    298     *         Doctrine_Connection_UnitOfWork|Doctrine_Transaction   the handler that invoked this event -
    299     */ -
    300    public function getInvoker() -
    301    { -
    302        return $this->_invoker; -
    303    } -
    304 -
    305    /** -
    306     * getParams -
    307     * returns the parameters of the query -
    308     * -
    309     * @return array   parameters of the query -
    310     */ -
    311    public function getParams() -
    312    { -
    313        return $this->_params; -
    314    } -
    315 -
    316    /** -
    317     * Get the elapsed time (in microseconds) that the event ran.  If the event has -
    318     * not yet ended, return false. -
    319     * -
    320     * @return mixed -
    321     */ -
    322    public function getElapsedSecs() -
    323    { -
    324        if (is_null($this->_endedMicrotime)) { -
    325            return false; -
    326        } -
    327        return ($this->_endedMicrotime - $this->_startedMicrotime); -
    328    } -
    329} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_EventListener.html b/tests_old/coverage/Doctrine_EventListener.html deleted file mode 100644 index e8c499588..000000000 --- a/tests_old/coverage/Doctrine_EventListener.html +++ /dev/null @@ -1,372 +0,0 @@ - - - Coverage for Doctrine_EventListener - - -

    Coverage for Doctrine_EventListener

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: EventListener.php 2758 2007-10-07 22:43:33Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_EventListener_Interface'); -
    22/** -
    23 * Doctrine_EventListener     all event listeners extend this base class -
    24 *                            the empty methods allow child classes to only implement the methods they need to implement -
    25 * -
    26 * -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @package     Doctrine -
    29 * @subpackage  EventListener -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 2758 $ -
    34 */ -
    35class Doctrine_EventListener implements Doctrine_EventListener_Interface -
    36{ -
    37    public function preClose(Doctrine_Event $event) -
    38    { } -
    39    public function postClose(Doctrine_Event $event) -
    40    { } -
    41 -
    42    public function onCollectionDelete(Doctrine_Collection $collection) -
    43    { } -
    44    public function onPreCollectionDelete(Doctrine_Collection $collection) -
    45    { } -
    46 -
    47    public function onOpen(Doctrine_Connection $connection) -
    48    { } -
    49 -
    50    public function preTransactionCommit(Doctrine_Event $event) -
    51    { } -
    52    public function postTransactionCommit(Doctrine_Event $event) -
    53    { } -
    54 -
    55    public function preTransactionRollback(Doctrine_Event $event) -
    56    { } -
    57    public function postTransactionRollback(Doctrine_Event $event) -
    58    { } -
    59 -
    60    public function preTransactionBegin(Doctrine_Event $event) -
    61    { } -
    62    public function postTransactionBegin(Doctrine_Event $event) -
    63    { } -
    64 -
    65 -
    66    public function preSavepointCommit(Doctrine_Event $event) -
    67    { } -
    68    public function postSavepointCommit(Doctrine_Event $event) -
    69    { } -
    70 -
    71    public function preSavepointRollback(Doctrine_Event $event) -
    72    { } -
    73    public function postSavepointRollback(Doctrine_Event $event) -
    74    { } -
    75 -
    76    public function preSavepointCreate(Doctrine_Event $event) -
    77    { } -
    78    public function postSavepointCreate(Doctrine_Event $event) -
    79    { } -
    80 -
    81    public function postConnect(Doctrine_Event $event) -
    82    { } -
    83    public function preConnect(Doctrine_Event $event) -
    84    { } -
    85 -
    86    public function preQuery(Doctrine_Event $event) -
    87    { } -
    88    public function postQuery(Doctrine_Event $event) -
    89    { } -
    90 -
    91    public function prePrepare(Doctrine_Event $event) -
    92    { } -
    93    public function postPrepare(Doctrine_Event $event) -
    94    { } -
    95 -
    96    public function preExec(Doctrine_Event $event) -
    97    { } -
    98    public function postExec(Doctrine_Event $event) -
    99    { } -
    100 -
    101    public function preError(Doctrine_Event $event) -
    102    { } -
    103    public function postError(Doctrine_Event $event) -
    104    { } -
    105 -
    106    public function preFetch(Doctrine_Event $event) -
    107    { } -
    108    public function postFetch(Doctrine_Event $event) -
    109    { } -
    110 -
    111    public function preFetchAll(Doctrine_Event $event) -
    112    { } -
    113    public function postFetchAll(Doctrine_Event $event) -
    114    { } -
    115 -
    116    public function preStmtExecute(Doctrine_Event $event) -
    117    { } -
    118    public function postStmtExecute(Doctrine_Event $event) -
    119    { } -
    120} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_EventListener_Chain.html b/tests_old/coverage/Doctrine_EventListener_Chain.html deleted file mode 100644 index 5f405ece0..000000000 --- a/tests_old/coverage/Doctrine_EventListener_Chain.html +++ /dev/null @@ -1,1230 +0,0 @@ - - - Coverage for Doctrine_EventListener_Chain - - -

    Coverage for Doctrine_EventListener_Chain

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Chain.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Access'); -
    22 -
    23/** -
    24 * Doctrine_EventListener_Chain -
    25 * this class represents a chain of different listeners, -
    26 * useful for having multiple listeners listening the events at the same time -
    27 * -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @package     Doctrine -
    30 * @subpackage  EventListener -
    31 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    32 * @link        www.phpdoctrine.org -
    33 * @since       1.0 -
    34 * @version     $Revision: 2963 $ -
    35 */ -
    36class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_EventListener_Interface -
    37{ -
    38    /** -
    39     * @var array $listeners        an array containing all listeners -
    40     */ -
    41    protected $_listeners = array(); -
    42 -
    43    /** -
    44     * add -
    45     * adds a listener to the chain of listeners -
    46     * -
    47     * @param object $listener -
    48     * @param string $name -
    49     * @return void -
    50     */ -
    51    public function add($listener, $name = null) -
    52    { -
    53        if ( ! ($listener instanceof Doctrine_EventListener_Interface) && -
    54             ! ($listener instanceof Doctrine_Overloadable)) { -
    55             -
    56            throw new Doctrine_EventListener_Exception("Couldn't add eventlistener. EventListeners should implement either Doctrine_EventListener_Interface or Doctrine_Overloadable"); -
    57        } -
    58        if ($name === null) { -
    59            $this->_listeners[] = $listener; -
    60        } else { -
    61            $this->_listeners[$name] = $listener; -
    62        } -
    63    } -
    64 -
    65    /** -
    66     * returns a Doctrine_EventListener on success -
    67     * and null on failure -
    68     * -
    69     * @param mixed $key -
    70     * @return mixed -
    71     */ -
    72    public function get($key) -
    73    { -
    74        if ( ! isset($this->_listeners[$key])) { -
    75            return null; -
    76        } -
    77        return $this->_listeners[$key]; -
    78    } -
    79 -
    80    /** -
    81     * set -
    82     * -
    83     * @param mixed $key -
    84     * @param Doctrine_EventListener $listener -
    85     * @return void -
    86     */ -
    87    public function set($key, Doctrine_EventListener $listener) -
    88    { -
    89        $this->_listeners[$key] = $listener; -
    90    } -
    91 -
    92    /** -
    93     * onLoad -
    94     * an event invoked when Doctrine_Record is being loaded from database -
    95     * -
    96     * @param Doctrine_Record $record -
    97     * @return void -
    98     */ -
    99    public function onLoad(Doctrine_Record $record) -
    100    { -
    101        foreach ($this->_listeners as $listener) { -
    102            $listener->onLoad($record); -
    103        } -
    104    } -
    105 -
    106    /** -
    107     * onPreLoad -
    108     * an event invoked when Doctrine_Record is being loaded -
    109     * from database but not yet initialized -
    110     * -
    111     * @param Doctrine_Record $record -
    112     * @return void -
    113     */ -
    114    public function onPreLoad(Doctrine_Record $record) -
    115    { -
    116        foreach ($this->_listeners as $listener) { -
    117            $listener->onPreLoad($record); -
    118        } -
    119    } -
    120 -
    121    /** -
    122     * onSleep -
    123     * an event invoked when Doctrine_Record is serialized -
    124     * -
    125     * @param Doctrine_Record $record -
    126     * @return void -
    127     */ -
    128    public function onSleep(Doctrine_Record $record) -
    129    { -
    130        foreach ($this->_listeners as $listener) { -
    131            $listener->onSleep($record); -
    132        } -
    133    } -
    134 -
    135    /** -
    136     * onWakeUp -
    137     * an event invoked when Doctrine_Record is unserialized -
    138     * -
    139     * @param Doctrine_Record $record -
    140     * @return void -
    141     */ -
    142    public function onWakeUp(Doctrine_Record $record) -
    143    { -
    144        foreach ($this->_listeners as $listener) { -
    145            $listener->onWakeUp($record); -
    146        } -
    147    } -
    148 -
    149    /** -
    150     * postClose -
    151     * an event invoked after Doctrine_Connection is closed -
    152     * -
    153     * @param Doctrine_Event $event -
    154     * @return void -
    155     */ -
    156    public function postClose(Doctrine_Event $event) -
    157    { -
    158        foreach ($this->_listeners as $listener) { -
    159            $listener->postClose($event); -
    160        } -
    161    } -
    162 -
    163    /** -
    164     * preClose -
    165     * an event invoked before Doctrine_Connection is closed -
    166     * -
    167     * @param Doctrine_Event $event -
    168     * @return void -
    169     */ -
    170    public function preClose(Doctrine_Event $event) -
    171    { -
    172        foreach ($this->_listeners as $listener) { -
    173            $listener->preClose($event); -
    174        } -
    175    } -
    176 -
    177    /** -
    178     * onOpen -
    179     * an event invoked after Doctrine_Connection is opened -
    180     * -
    181     * @param Doctrine_Connection $connection -
    182     * @return void -
    183     */ -
    184    public function onOpen(Doctrine_Connection $connection) -
    185    { -
    186        foreach ($this->_listeners as $listener) { -
    187            $listener->onOpen($connection); -
    188        } -
    189    } -
    190 -
    191    /** -
    192     * onTransactionCommit -
    193     * an event invoked after a Doctrine_Connection transaction is committed -
    194     * -
    195     * @param Doctrine_Event $event -
    196     * @return void -
    197     */ -
    198    public function postTransactionCommit(Doctrine_Event $event) -
    199    { -
    200        foreach ($this->_listeners as $listener) { -
    201            $listener->postTransactionCommit($event); -
    202        } -
    203    } -
    204 -
    205    /** -
    206     * onPreTransactionCommit -
    207     * an event invoked before a Doctrine_Connection transaction is committed -
    208     * -
    209     * @param Doctrine_Event $event -
    210     * @return void -
    211     */ -
    212    public function preTransactionCommit(Doctrine_Event $event) -
    213    { -
    214        foreach ($this->_listeners as $listener) { -
    215            $listener->preTransactionCommit($event); -
    216        } -
    217    } -
    218 -
    219    /** -
    220     * onTransactionRollback -
    221     * an event invoked after a Doctrine_Connection transaction is being rolled back -
    222     * -
    223     * @param Doctrine_Event $event -
    224     * @return void -
    225     */ -
    226    public function postTransactionRollback(Doctrine_Event $event) -
    227    { -
    228        foreach ($this->_listeners as $listener) { -
    229            $listener->postTransactionRollback($event); -
    230        } -
    231    } -
    232 -
    233    /** -
    234     * onPreTransactionRollback -
    235     * an event invoked before a Doctrine_Connection transaction is being rolled back -
    236     * -
    237     * @param Doctrine_Event $event -
    238     * @return void -
    239     */ -
    240    public function preTransactionRollback(Doctrine_Event $event) -
    241    { -
    242        foreach ($this->_listeners as $listener) { -
    243            $listener->preTransactionRollback($event); -
    244        } -
    245    } -
    246 -
    247    /** -
    248     * onTransactionBegin -
    249     * an event invoked after a Doctrine_Connection transaction has been started -
    250     * -
    251     * @param Doctrine_Event $event -
    252     * @return void -
    253     */ -
    254    public function postTransactionBegin(Doctrine_Event $event) -
    255    { -
    256        foreach ($this->_listeners as $listener) { -
    257            $listener->postTransactionBegin($event); -
    258        } -
    259    } -
    260 -
    261    /** -
    262     * onTransactionBegin -
    263     * an event invoked before a Doctrine_Connection transaction is being started -
    264     * -
    265     * @param Doctrine_Event $event -
    266     * @return void -
    267     */ -
    268    public function preTransactionBegin(Doctrine_Event $event) -
    269    { -
    270        foreach ($this->_listeners as $listener) { -
    271            $listener->preTransactionBegin($event); -
    272        } -
    273    } -
    274 -
    275    /** -
    276     * onCollectionDelete -
    277     * an event invoked after a Doctrine_Collection is being deleted -
    278     * -
    279     * @param Doctrine_Collection $collection -
    280     * @return void -
    281     */ -
    282    public function onCollectionDelete(Doctrine_Collection $collection) -
    283    { -
    284        foreach ($this->_listeners as $listener) { -
    285            $listener->onCollectionDelete($collection); -
    286        } -
    287    } -
    288 -
    289    /** -
    290     * onCollectionDelete -
    291     * an event invoked after a Doctrine_Collection is being deleted -
    292     * -
    293     * @param Doctrine_Collection $collection -
    294     * @return void -
    295     */ -
    296    public function onPreCollectionDelete(Doctrine_Collection $collection) -
    297    { -
    298        foreach ($this->_listeners as $listener) { -
    299            $listener->onPreCollectionDelete($collection); -
    300        } -
    301    } -
    302    public function postConnect(Doctrine_Event $event) -
    303    { -
    304        foreach ($this->_listeners as $listener) { -
    305            $listener->postConnect($event); -
    306        } -
    307    } -
    308    public function preConnect(Doctrine_Event $event) -
    309    { -
    310        foreach ($this->_listeners as $listener) { -
    311            $listener->preConnect($event); -
    312        } -
    313    } -
    314    public function preQuery(Doctrine_Event $event) -
    315    {  -
    316        foreach ($this->_listeners as $listener) { -
    317            $listener->preQuery($event); -
    318        } -
    319    } -
    320    public function postQuery(Doctrine_Event $event) -
    321    { -
    322        foreach ($this->_listeners as $listener) { -
    323            $listener->postQuery($event); -
    324        } -
    325    } -
    326 -
    327    public function prePrepare(Doctrine_Event $event) -
    328    {  -
    329        foreach ($this->_listeners as $listener) { -
    330            $listener->prePrepare($event); -
    331        } -
    332    } -
    333    public function postPrepare(Doctrine_Event $event) -
    334    { -
    335        foreach ($this->_listeners as $listener) { -
    336            $listener->postPrepare($event); -
    337        } -
    338    } -
    339 -
    340    public function preExec(Doctrine_Event $event) -
    341    { -
    342        foreach ($this->_listeners as $listener) { -
    343            $listener->preExec($event); -
    344        } -
    345    } -
    346    public function postExec(Doctrine_Event $event) -
    347    { -
    348        foreach ($this->_listeners as $listener) { -
    349            $listener->postExec($event); -
    350        } -
    351    } -
    352 -
    353    public function preError(Doctrine_Event $event) -
    354    {  -
    355        foreach ($this->_listeners as $listener) { -
    356            $listener->preError($event); -
    357        } -
    358    } -
    359    public function postError(Doctrine_Event $event) -
    360    { -
    361        foreach ($this->_listeners as $listener) { -
    362            $listener->postError($event); -
    363        } -
    364    } -
    365 -
    366    public function preFetch(Doctrine_Event $event) -
    367    {  -
    368        foreach ($this->_listeners as $listener) { -
    369            $listener->preFetch($event); -
    370        } -
    371    } -
    372    public function postFetch(Doctrine_Event $event) -
    373    { -
    374        foreach ($this->_listeners as $listener) { -
    375            $listener->postFetch($event); -
    376        } -
    377    } -
    378 -
    379    public function preFetchAll(Doctrine_Event $event) -
    380    {  -
    381        foreach ($this->_listeners as $listener) { -
    382            $listener->preFetchAll($event); -
    383        } -
    384    } -
    385 -
    386    public function postFetchAll(Doctrine_Event $event) -
    387    { -
    388        foreach ($this->_listeners as $listener) { -
    389            $listener->postFetchAll($event); -
    390        } -
    391    } -
    392 -
    393    public function preStmtExecute(Doctrine_Event $event) -
    394    { -
    395        foreach ($this->_listeners as $listener) { -
    396            $listener->preStmtExecute($event); -
    397        } -
    398    } -
    399 -
    400    public function postStmtExecute(Doctrine_Event $event) -
    401    { -
    402        foreach ($this->_listeners as $listener) { -
    403            $listener->postStmtExecute($event); -
    404        } -
    405    } -
    406} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Exception.html b/tests_old/coverage/Doctrine_Exception.html deleted file mode 100644 index 07a61f969..000000000 --- a/tests_old/coverage/Doctrine_Exception.html +++ /dev/null @@ -1,288 +0,0 @@ - - - Coverage for Doctrine_Exception - - -

    Coverage for Doctrine_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Exception -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Exception extends Exception -
    34{  -
    35    /** -
    36     * @var array $_errorMessages       an array of error messages -
    37     */ -
    38    protected static $_errorMessages = array( -
    39                Doctrine::ERR                    => 'unknown error', -
    40                Doctrine::ERR_ALREADY_EXISTS     => 'already exists', -
    41                Doctrine::ERR_CANNOT_CREATE      => 'can not create', -
    42                Doctrine::ERR_CANNOT_ALTER       => 'can not alter', -
    43                Doctrine::ERR_CANNOT_REPLACE     => 'can not replace', -
    44                Doctrine::ERR_CANNOT_DELETE      => 'can not delete', -
    45                Doctrine::ERR_CANNOT_DROP        => 'can not drop', -
    46                Doctrine::ERR_CONSTRAINT         => 'constraint violation', -
    47                Doctrine::ERR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint', -
    48                Doctrine::ERR_DIVZERO            => 'division by zero', -
    49                Doctrine::ERR_INVALID            => 'invalid', -
    50                Doctrine::ERR_INVALID_DATE       => 'invalid date or time', -
    51                Doctrine::ERR_INVALID_NUMBER     => 'invalid number', -
    52                Doctrine::ERR_MISMATCH           => 'mismatch', -
    53                Doctrine::ERR_NODBSELECTED       => 'no database selected', -
    54                Doctrine::ERR_NOSUCHFIELD        => 'no such field', -
    55                Doctrine::ERR_NOSUCHTABLE        => 'no such table', -
    56                Doctrine::ERR_NOT_CAPABLE        => 'Doctrine backend not capable', -
    57                Doctrine::ERR_NOT_FOUND          => 'not found', -
    58                Doctrine::ERR_NOT_LOCKED         => 'not locked', -
    59                Doctrine::ERR_SYNTAX             => 'syntax error', -
    60                Doctrine::ERR_UNSUPPORTED        => 'not supported', -
    61                Doctrine::ERR_VALUE_COUNT_ON_ROW => 'value count on row', -
    62                Doctrine::ERR_INVALID_DSN        => 'invalid DSN', -
    63                Doctrine::ERR_CONNECT_FAILED     => 'connect failed', -
    64                Doctrine::ERR_NEED_MORE_DATA     => 'insufficient data supplied', -
    65                Doctrine::ERR_EXTENSION_NOT_FOUND=> 'extension not found', -
    66                Doctrine::ERR_NOSUCHDB           => 'no such database', -
    67                Doctrine::ERR_ACCESS_VIOLATION   => 'insufficient permissions', -
    68                Doctrine::ERR_LOADMODULE         => 'error while including on demand module', -
    69                Doctrine::ERR_TRUNCATED          => 'truncated', -
    70                Doctrine::ERR_DEADLOCK           => 'deadlock detected', -
    71            ); -
    72 -
    73    /** -
    74     * Return a textual error message for a Doctrine error code -
    75     * -
    76     * @param   int|array   integer error code, -
    77     *                           null to get the current error code-message map, -
    78     *                           or an array with a new error code-message map -
    79     * -
    80     * @return  string  error message -
    81     */ -
    82    public function errorMessage($value = null) -
    83    { -
    84        if (is_null($value)) { -
    85            return self::$_errorMessages; -
    86        } -
    87 -
    88        return isset(self::$_errorMessages[$value]) ? -
    89           self::$_errorMessages[$value] : self::$_errorMessages[Doctrine::ERR]; -
    90    } -
    91 -
    92} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Export.html b/tests_old/coverage/Doctrine_Export.html deleted file mode 100644 index fc4c0566b..000000000 --- a/tests_old/coverage/Doctrine_Export.html +++ /dev/null @@ -1,3846 +0,0 @@ - - - Coverage for Doctrine_Export - - -

    Coverage for Doctrine_Export

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Export.php 3149 2007-11-13 22:28:37Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * Doctrine_Export -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Export -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3149 $ -
    33 */ -
    34class Doctrine_Export extends Doctrine_Connection_Module -
    35{ -
    36    protected $valid_default_values = array( -
    37        'text'      => '', -
    38        'boolean'   => true, -
    39        'integer'   => 0, -
    40        'decimal'   => 0.0, -
    41        'float'     => 0.0, -
    42        'timestamp' => '1970-01-01 00:00:00', -
    43        'time'      => '00:00:00', -
    44        'date'      => '1970-01-01', -
    45        'clob'      => '', -
    46        'blob'      => '', -
    47        'string'    => '' -
    48    ); -
    49 -
    50    /** -
    51     * drop an existing database -
    52     * (this method is implemented by the drivers) -
    53     * -
    54     * @param string $name name of the database that should be dropped -
    55     * @return void -
    56     */ -
    57    public function dropDatabase($database) -
    58    { -
    59        $this->conn->execute($this->dropDatabaseSql($database)); -
    60    } -
    61 -
    62    /** -
    63     * drop an existing database -
    64     * (this method is implemented by the drivers) -
    65     * -
    66     * @param string $name name of the database that should be dropped -
    67     * @return void -
    68     */ -
    69    public function dropDatabaseSql($database) -
    70    { -
    71        throw new Doctrine_Export_Exception('Drop database not supported by this driver.'); -
    72    } -
    73 -
    74    /** -
    75     * dropTableSql -
    76     * drop an existing table -
    77     * -
    78     * @param string $table           name of table that should be dropped from the database -
    79     * @return string -
    80     */ -
    81    public function dropTableSql($table) -
    82    { -
    83        return 'DROP TABLE ' . $this->conn->quoteIdentifier($table); -
    84    } -
    85 -
    86    /** -
    87     * dropTable -
    88     * drop an existing table -
    89     * -
    90     * @param string $table           name of table that should be dropped from the database -
    91     * @return void -
    92     */ -
    93    public function dropTable($table) -
    94    { -
    95        $this->conn->execute($this->dropTableSql($table)); -
    96    } -
    97 -
    98    /** -
    99     * drop existing index -
    100     * -
    101     * @param string    $table        name of table that should be used in method -
    102     * @param string    $name         name of the index to be dropped -
    103     * @return void -
    104     */ -
    105    public function dropIndex($table, $name) -
    106    { -
    107        return $this->conn->exec($this->dropIndexSql($table, $name)); -
    108    } -
    109 -
    110    /** -
    111     * dropIndexSql -
    112     * -
    113     * @param string    $table        name of table that should be used in method -
    114     * @param string    $name         name of the index to be dropped -
    115     * @return string                 SQL that is used for dropping an index -
    116     */ -
    117    public function dropIndexSql($table, $name) -
    118    { -
    119        $name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name)); -
    120         -
    121        return 'DROP INDEX ' . $name; -
    122    } -
    123 -
    124    /** -
    125     * drop existing constraint -
    126     * -
    127     * @param string    $table        name of table that should be used in method -
    128     * @param string    $name         name of the constraint to be dropped -
    129     * @param string    $primary      hint if the constraint is primary -
    130     * @return void -
    131     */ -
    132    public function dropConstraint($table, $name, $primary = false) -
    133    { -
    134        $table = $this->conn->quoteIdentifier($table); -
    135        $name  = $this->conn->quoteIdentifier($name); -
    136         -
    137        return $this->conn->exec('ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $name); -
    138    } -
    139 -
    140    /** -
    141     * drop existing foreign key -
    142     * -
    143     * @param string    $table        name of table that should be used in method -
    144     * @param string    $name         name of the foreign key to be dropped -
    145     * @return void -
    146     */ -
    147    public function dropForeignKey($table, $name) -
    148    { -
    149        return $this->dropConstraint($table, $name); -
    150    } -
    151 -
    152    /** -
    153     * dropSequenceSql -
    154     * drop existing sequence -
    155     * (this method is implemented by the drivers) -
    156     * -
    157     * @throws Doctrine_Connection_Exception     if something fails at database level -
    158     * @param string $sequenceName      name of the sequence to be dropped -
    159     * @return void -
    160     */ -
    161    public function dropSequence($sequenceName) -
    162    { -
    163        $this->conn->exec($this->dropSequenceSql($sequenceName)); -
    164    } -
    165 -
    166    /** -
    167     * dropSequenceSql -
    168     * drop existing sequence -
    169     * -
    170     * @throws Doctrine_Connection_Exception     if something fails at database level -
    171     * @param string $sequenceName name of the sequence to be dropped -
    172     * @return void -
    173     */ -
    174    public function dropSequenceSql($sequenceName) -
    175    { -
    176        throw new Doctrine_Export_Exception('Drop sequence not supported by this driver.'); -
    177    } -
    178 -
    179    /** -
    180     * create a new database -
    181     * (this method is implemented by the drivers) -
    182     * -
    183     * @param string $name name of the database that should be created -
    184     * @return void -
    185     */ -
    186    public function createDatabase($database) -
    187    { -
    188        $this->conn->execute($this->createDatabaseSql($database)); -
    189    } -
    190 -
    191    /** -
    192     * create a new database -
    193     * (this method is implemented by the drivers) -
    194     * -
    195     * @param string $name name of the database that should be created -
    196     * @return string -
    197     */ -
    198    public function createDatabaseSql($database) -
    199    { -
    200        throw new Doctrine_Export_Exception('Create database not supported by this driver.'); -
    201    } -
    202 -
    203    /** -
    204     * create a new table -
    205     * -
    206     * @param string $name   Name of the database that should be created -
    207     * @param array $fields  Associative array that contains the definition of each field of the new table -
    208     *                       The indexes of the array entries are the names of the fields of the table an -
    209     *                       the array entry values are associative arrays like those that are meant to be -
    210     *                       passed with the field definitions to get[Type]Declaration() functions. -
    211     *                          array( -
    212     *                              'id' => array( -
    213     *                                  'type' => 'integer', -
    214     *                                  'unsigned' => 1 -
    215     *                                  'notnull' => 1 -
    216     *                                  'default' => 0 -
    217     *                              ), -
    218     *                              'name' => array( -
    219     *                                  'type' => 'text', -
    220     *                                  'length' => 12 -
    221     *                              ), -
    222     *                              'password' => array( -
    223     *                                  'type' => 'text', -
    224     *                                  'length' => 12 -
    225     *                              ) -
    226     *                          ); -
    227     * @param array $options  An associative array of table options: -
    228     * -
    229     * @return string -
    230     */ -
    231    public function createTableSql($name, array $fields, array $options = array()) -
    232    { -
    233        if ( ! $name) { -
    234            throw new Doctrine_Export_Exception('no valid table name specified'); -
    235        } -
    236 -
    237        if (empty($fields)) { -
    238            throw new Doctrine_Export_Exception('no fields specified for table ' . $name); -
    239        } -
    240 -
    241        $queryFields = $this->getFieldDeclarationList($fields); -
    242 -
    243 -
    244        if (isset($options['primary']) && ! empty($options['primary'])) { -
    245            $queryFields .= ', PRIMARY KEY(' . implode(', ', array_values($options['primary'])) . ')'; -
    246        } -
    247 -
    248        if (isset($options['indexes']) && ! empty($options['indexes'])) { -
    249            foreach($options['indexes'] as $index => $definition) { -
    250                $queryFields .= ', ' . $this->getIndexDeclaration($index, $definition); -
    251            } -
    252        } -
    253 -
    254        $query = 'CREATE TABLE ' . $this->conn->quoteIdentifier($name, true) . ' (' . $queryFields; -
    255 -
    256        $check = $this->getCheckDeclaration($fields); -
    257 -
    258        if ( ! empty($check)) { -
    259            $query .= ', ' . $check; -
    260        } -
    261 -
    262        $query .= ')'; -
    263 -
    264 -
    265 -
    266        $sql[] = $query; -
    267 -
    268        if (isset($options['foreignKeys'])) { -
    269 -
    270            foreach ((array) $options['foreignKeys'] as $k => $definition) { -
    271                if (is_array($definition)) { -
    272                    $sql[] = $this->createForeignKeySql($name, $definition); -
    273                } -
    274            } -
    275        } -
    276        return $sql; -
    277    } -
    278 -
    279    /** -
    280     * create a new table -
    281     * -
    282     * @param string $name   Name of the database that should be created -
    283     * @param array $fields  Associative array that contains the definition of each field of the new table -
    284     * @param array $options  An associative array of table options: -
    285     * @see Doctrine_Export::createTableSql() -
    286     * -
    287     * @return void -
    288     */ -
    289    public function createTable($name, array $fields, array $options = array()) -
    290    { -
    291        $sql = (array) $this->createTableSql($name, $fields, $options); -
    292 -
    293        foreach ($sql as $query) { -
    294            $this->conn->execute($query); -
    295        } -
    296    } -
    297 -
    298    /** -
    299     * create sequence -
    300     * -
    301     * @throws Doctrine_Connection_Exception     if something fails at database level -
    302     * @param string    $seqName        name of the sequence to be created -
    303     * @param string    $start          start value of the sequence; default is 1 -
    304     * @param array     $options  An associative array of table options: -
    305     *                          array( -
    306     *                              'comment' => 'Foo', -
    307     *                              'charset' => 'utf8', -
    308     *                              'collate' => 'utf8_unicode_ci', -
    309     *                          ); -
    310     * @return void -
    311     */ -
    312    public function createSequence($seqName, $start = 1, array $options = array()) -
    313    { -
    314        return $this->conn->execute($this->createSequenceSql($seqName, $start = 1, $options)); -
    315    } -
    316 -
    317    /** -
    318     * return RDBMS specific create sequence statement -
    319     * (this method is implemented by the drivers) -
    320     * -
    321     * @throws Doctrine_Connection_Exception     if something fails at database level -
    322     * @param string    $seqName        name of the sequence to be created -
    323     * @param string    $start          start value of the sequence; default is 1 -
    324     * @param array     $options  An associative array of table options: -
    325     *                          array( -
    326     *                              'comment' => 'Foo', -
    327     *                              'charset' => 'utf8', -
    328     *                              'collate' => 'utf8_unicode_ci', -
    329     *                          ); -
    330     * @return string -
    331     */ -
    332    public function createSequenceSql($seqName, $start = 1, array $options = array()) -
    333    { -
    334        throw new Doctrine_Export_Exception('Create sequence not supported by this driver.'); -
    335    } -
    336 -
    337    /** -
    338     * create a constraint on a table -
    339     * -
    340     * @param string    $table         name of the table on which the constraint is to be created -
    341     * @param string    $name          name of the constraint to be created -
    342     * @param array     $definition    associative array that defines properties of the constraint to be created. -
    343     *                                 Currently, only one property named FIELDS is supported. This property -
    344     *                                 is also an associative with the names of the constraint fields as array -
    345     *                                 constraints. Each entry of this array is set to another type of associative -
    346     *                                 array that specifies properties of the constraint that are specific to -
    347     *                                 each field. -
    348     * -
    349     *                                 Example -
    350     *                                    array( -
    351     *                                        'fields' => array( -
    352     *                                            'user_name' => array(), -
    353     *                                            'last_login' => array() -
    354     *                                        ) -
    355     *                                    ) -
    356     * @return void -
    357     */ -
    358    public function createConstraint($table, $name, $definition) -
    359    { -
    360        $sql = $this->createConstraintSql($table, $name, $definition); -
    361         -
    362        return $this->conn->exec($sql); -
    363    } -
    364 -
    365    /** -
    366     * create a constraint on a table -
    367     * -
    368     * @param string    $table         name of the table on which the constraint is to be created -
    369     * @param string    $name          name of the constraint to be created -
    370     * @param array     $definition    associative array that defines properties of the constraint to be created. -
    371     *                                 Currently, only one property named FIELDS is supported. This property -
    372     *                                 is also an associative with the names of the constraint fields as array -
    373     *                                 constraints. Each entry of this array is set to another type of associative -
    374     *                                 array that specifies properties of the constraint that are specific to -
    375     *                                 each field. -
    376     * -
    377     *                                 Example -
    378     *                                    array( -
    379     *                                        'fields' => array( -
    380     *                                            'user_name' => array(), -
    381     *                                            'last_login' => array() -
    382     *                                        ) -
    383     *                                    ) -
    384     * @return void -
    385     */ -
    386    public function createConstraintSql($table, $name, $definition) -
    387    { -
    388        $table = $this->conn->quoteIdentifier($table); -
    389        $name  = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name)); -
    390        $query = 'ALTER TABLE ' . $table . ' ADD CONSTRAINT ' . $name; -
    391 -
    392        if (isset($definition['primary']) && $definition['primary']) { -
    393            $query .= ' PRIMARY KEY'; -
    394        } elseif (isset($definition['unique']) && $definition['unique']) { -
    395            $query .= ' UNIQUE'; -
    396        } -
    397 -
    398        $fields = array(); -
    399        foreach (array_keys($definition['fields']) as $field) { -
    400            $fields[] = $this->conn->quoteIdentifier($field, true); -
    401        } -
    402        $query .= ' ('. implode(', ', $fields) . ')'; -
    403 -
    404        return $query; -
    405    } -
    406 -
    407    /** -
    408     * Get the stucture of a field into an array -
    409     * -
    410     * @param string    $table         name of the table on which the index is to be created -
    411     * @param string    $name          name of the index to be created -
    412     * @param array     $definition    associative array that defines properties of the index to be created. -
    413     *                                 Currently, only one property named FIELDS is supported. This property -
    414     *                                 is also an associative with the names of the index fields as array -
    415     *                                 indexes. Each entry of this array is set to another type of associative -
    416     *                                 array that specifies properties of the index that are specific to -
    417     *                                 each field. -
    418     * -
    419     *                                 Currently, only the sorting property is supported. It should be used -
    420     *                                 to define the sorting direction of the index. It may be set to either -
    421     *                                 ascending or descending. -
    422     * -
    423     *                                 Not all DBMS support index sorting direction configuration. The DBMS -
    424     *                                 drivers of those that do not support it ignore this property. Use the -
    425     *                                 function supports() to determine whether the DBMS driver can manage indexes. -
    426     * -
    427     *                                 Example -
    428     *                                    array( -
    429     *                                        'fields' => array( -
    430     *                                            'user_name' => array( -
    431     *                                                'sorting' => 'ascending' -
    432     *                                            ), -
    433     *                                            'last_login' => array() -
    434     *                                        ) -
    435     *                                    ) -
    436     * @return void -
    437     */ -
    438    public function createIndex($table, $name, array $definition) -
    439    { -
    440        return $this->conn->execute($this->createIndexSql($table, $name, $definition)); -
    441    } -
    442 -
    443    /** -
    444     * Get the stucture of a field into an array -
    445     * -
    446     * @param string    $table         name of the table on which the index is to be created -
    447     * @param string    $name          name of the index to be created -
    448     * @param array     $definition    associative array that defines properties of the index to be created. -
    449     * @see Doctrine_Export::createIndex() -
    450     * @return string -
    451     */ -
    452    public function createIndexSql($table, $name, array $definition) -
    453    { -
    454        $table  = $this->conn->quoteIdentifier($table); -
    455        $name   = $this->conn->quoteIdentifier($name); -
    456        $type   = ''; -
    457 -
    458        if (isset($definition['type'])) { -
    459            switch (strtolower($definition['type'])) { -
    460                case 'unique': -
    461                    $type = strtoupper($definition['type']) . ' '; -
    462                break; -
    463                default: -
    464                    throw new Doctrine_Export_Exception('Unknown index type ' . $definition['type']); -
    465            } -
    466        } -
    467 -
    468        $query = 'CREATE ' . $type . 'INDEX ' . $name . ' ON ' . $table; -
    469 -
    470        $fields = array(); -
    471        foreach ($definition['fields'] as $field) { -
    472            $fields[] = $this->conn->quoteIdentifier($field); -
    473        } -
    474        $query .= ' (' . implode(', ', $fields) . ')'; -
    475 -
    476        return $query; -
    477    }     -
    478    /** -
    479     * createForeignKeySql -
    480     * -
    481     * @param string    $table         name of the table on which the foreign key is to be created -
    482     * @param array     $definition    associative array that defines properties of the foreign key to be created. -
    483     * @return string -
    484     */ -
    485    public function createForeignKeySql($table, array $definition) -
    486    { -
    487        $table = $this->conn->quoteIdentifier($table); -
    488 -
    489        $query = 'ALTER TABLE ' . $table . ' ADD ' . $this->getForeignKeyDeclaration($definition); -
    490 -
    491        return $query; -
    492    } -
    493 -
    494    /** -
    495     * createForeignKey -
    496     * -
    497     * @param string    $table         name of the table on which the foreign key is to be created -
    498     * @param array     $definition    associative array that defines properties of the foreign key to be created. -
    499     * @return string -
    500     */ -
    501    public function createForeignKey($table, array $definition) -
    502    { -
    503        $sql = $this->createForeignKeySql($table, $definition); -
    504         -
    505        return $this->conn->execute($sql); -
    506    } -
    507 -
    508    /** -
    509     * alter an existing table -
    510     * (this method is implemented by the drivers) -
    511     * -
    512     * @param string $name         name of the table that is intended to be changed. -
    513     * @param array $changes     associative array that contains the details of each type -
    514     *                             of change that is intended to be performed. The types of -
    515     *                             changes that are currently supported are defined as follows: -
    516     * -
    517     *                             name -
    518     * -
    519     *                                New name for the table. -
    520     * -
    521     *                            add -
    522     * -
    523     *                                Associative array with the names of fields to be added as -
    524     *                                 indexes of the array. The value of each entry of the array -
    525     *                                 should be set to another associative array with the properties -
    526     *                                 of the fields to be added. The properties of the fields should -
    527     *                                 be the same as defined by the MDB2 parser. -
    528     * -
    529     * -
    530     *                            remove -
    531     * -
    532     *                                Associative array with the names of fields to be removed as indexes -
    533     *                                 of the array. Currently the values assigned to each entry are ignored. -
    534     *                                 An empty array should be used for future compatibility. -
    535     * -
    536     *                            rename -
    537     * -
    538     *                                Associative array with the names of fields to be renamed as indexes -
    539     *                                 of the array. The value of each entry of the array should be set to -
    540     *                                 another associative array with the entry named name with the new -
    541     *                                 field name and the entry named Declaration that is expected to contain -
    542     *                                 the portion of the field declaration already in DBMS specific SQL code -
    543     *                                 as it is used in the CREATE TABLE statement. -
    544     * -
    545     *                            change -
    546     * -
    547     *                                Associative array with the names of the fields to be changed as indexes -
    548     *                                 of the array. Keep in mind that if it is intended to change either the -
    549     *                                 name of a field and any other properties, the change array entries -
    550     *                                 should have the new names of the fields as array indexes. -
    551     * -
    552     *                                The value of each entry of the array should be set to another associative -
    553     *                                 array with the properties of the fields to that are meant to be changed as -
    554     *                                 array entries. These entries should be assigned to the new values of the -
    555     *                                 respective properties. The properties of the fields should be the same -
    556     *                                 as defined by the MDB2 parser. -
    557     * -
    558     *                            Example -
    559     *                                array( -
    560     *                                    'name' => 'userlist', -
    561     *                                    'add' => array( -
    562     *                                        'quota' => array( -
    563     *                                            'type' => 'integer', -
    564     *                                            'unsigned' => 1 -
    565     *                                        ) -
    566     *                                    ), -
    567     *                                    'remove' => array( -
    568     *                                        'file_limit' => array(), -
    569     *                                        'time_limit' => array() -
    570     *                                    ), -
    571     *                                    'change' => array( -
    572     *                                        'name' => array( -
    573     *                                            'length' => '20', -
    574     *                                            'definition' => array( -
    575     *                                                'type' => 'text', -
    576     *                                                'length' => 20, -
    577     *                                            ), -
    578     *                                        ) -
    579     *                                    ), -
    580     *                                    'rename' => array( -
    581     *                                        'sex' => array( -
    582     *                                            'name' => 'gender', -
    583     *                                            'definition' => array( -
    584     *                                                'type' => 'text', -
    585     *                                                'length' => 1, -
    586     *                                                'default' => 'M', -
    587     *                                            ), -
    588     *                                        ) -
    589     *                                    ) -
    590     *                                ) -
    591     * -
    592     * @param boolean $check     indicates whether the function should just check if the DBMS driver -
    593     *                             can perform the requested table alterations if the value is true or -
    594     *                             actually perform them otherwise. -
    595     * @return void -
    596     */ -
    597    public function alterTable($name, array $changes, $check = false) -
    598    { -
    599        $sql = $this->alterTableSql($name, $changes, $check); -
    600         -
    601        if (is_string($sql) && $sql) { -
    602            $this->conn->execute($sql); -
    603        } -
    604    } -
    605 -
    606    /** -
    607     * generates the sql for altering an existing table -
    608     * (this method is implemented by the drivers) -
    609     * -
    610     * @param string $name          name of the table that is intended to be changed. -
    611     * @param array $changes        associative array that contains the details of each type      * -
    612     * @param boolean $check        indicates whether the function should just check if the DBMS driver -
    613     *                              can perform the requested table alterations if the value is true or -
    614     *                              actually perform them otherwise. -
    615     * @see Doctrine_Export::alterTable() -
    616     * @return string -
    617     */ -
    618    public function alterTableSql($name, array $changes, $check = false) -
    619    { -
    620        throw new Doctrine_Export_Exception('Alter table not supported by this driver.'); -
    621    } -
    622 -
    623    /** -
    624     * Get declaration of a number of field in bulk -
    625     * -
    626     * @param array $fields  a multidimensional associative array. -
    627     *      The first dimension determines the field name, while the second -
    628     *      dimension is keyed with the name of the properties -
    629     *      of the field being declared as array indexes. Currently, the types -
    630     *      of supported field properties are as follows: -
    631     * -
    632     *      length -
    633     *          Integer value that determines the maximum length of the text -
    634     *          field. If this argument is missing the field should be -
    635     *          declared to have the longest length allowed by the DBMS. -
    636     * -
    637     *      default -
    638     *          Text value to be used as default for this field. -
    639     * -
    640     *      notnull -
    641     *          Boolean flag that indicates whether this field is constrained -
    642     *          to not be set to null. -
    643     *      charset -
    644     *          Text value with the default CHARACTER SET for this field. -
    645     *      collation -
    646     *          Text value with the default COLLATION for this field. -
    647     *      unique -
    648     *          unique constraint -
    649     * -
    650     * @return string -
    651     */ -
    652    public function getFieldDeclarationList(array $fields) -
    653    { -
    654        foreach ($fields as $fieldName => $field) { -
    655            $query = $this->getDeclaration($fieldName, $field); -
    656 -
    657            $queryFields[] = $query; -
    658        } -
    659        return implode(', ', $queryFields); -
    660    } -
    661 -
    662    /** -
    663     * Obtain DBMS specific SQL code portion needed to declare a generic type -
    664     * field to be used in statements like CREATE TABLE. -
    665     * -
    666     * @param string $name   name the field to be declared. -
    667     * @param array  $field  associative array with the name of the properties -
    668     *      of the field being declared as array indexes. Currently, the types -
    669     *      of supported field properties are as follows: -
    670     * -
    671     *      length -
    672     *          Integer value that determines the maximum length of the text -
    673     *          field. If this argument is missing the field should be -
    674     *          declared to have the longest length allowed by the DBMS. -
    675     * -
    676     *      default -
    677     *          Text value to be used as default for this field. -
    678     * -
    679     *      notnull -
    680     *          Boolean flag that indicates whether this field is constrained -
    681     *          to not be set to null. -
    682     *      charset -
    683     *          Text value with the default CHARACTER SET for this field. -
    684     *      collation -
    685     *          Text value with the default COLLATION for this field. -
    686     *      unique -
    687     *          unique constraint -
    688     *      check -
    689     *          column check constraint -
    690     * -
    691     * @return string  DBMS specific SQL code portion that should be used to -
    692     *      declare the specified field. -
    693     */ -
    694    public function getDeclaration($name, array $field) -
    695    { -
    696 -
    697        $default   = $this->getDefaultFieldDeclaration($field); -
    698 -
    699        $charset   = (isset($field['charset']) && $field['charset']) ? -
    700                    ' ' . $this->getCharsetFieldDeclaration($field['charset']) : ''; -
    701 -
    702        $collation = (isset($field['collation']) && $field['collation']) ? -
    703                    ' ' . $this->getCollationFieldDeclaration($field['collation']) : ''; -
    704 -
    705        $notnull   = (isset($field['notnull']) && $field['notnull']) ? ' NOT NULL' : ''; -
    706 -
    707        $unique    = (isset($field['unique']) && $field['unique']) ? -
    708                    ' ' . $this->getUniqueFieldDeclaration() : ''; -
    709 -
    710        $check     = (isset($field['check']) && $field['check']) ? -
    711                    ' ' . $field['check'] : ''; -
    712 -
    713        $method = 'get' . $field['type'] . 'Declaration'; -
    714 -
    715        if (method_exists($this->conn->dataDict, $method)) { -
    716            return $this->conn->dataDict->$method($name, $field); -
    717        } else { -
    718            $dec = $this->conn->dataDict->getNativeDeclaration($field); -
    719        } -
    720        return $this->conn->quoteIdentifier($name, true) . ' ' . $dec . $charset . $default . $notnull . $unique . $check . $collation; -
    721    } -
    722 -
    723    /** -
    724     * getDefaultDeclaration -
    725     * Obtain DBMS specific SQL code portion needed to set a default value -
    726     * declaration to be used in statements like CREATE TABLE. -
    727     * -
    728     * @param array $field      field definition array -
    729     * @return string           DBMS specific SQL code portion needed to set a default value -
    730     */ -
    731    public function getDefaultFieldDeclaration($field) -
    732    { -
    733        $default = ''; -
    734        if (isset($field['default'])) { -
    735            if ($field['default'] === '') { -
    736                $field['default'] = empty($field['notnull']) -
    737                    ? null : $this->valid_default_values[$field['type']]; -
    738 -
    739                if ($field['default'] === '' && -
    740                   ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_EMPTY_TO_NULL)) { -
    741                    $field['default'] = null; -
    742                } -
    743            } -
    744 -
    745            if ($field['type'] === 'boolean') { -
    746                $fields['default'] = $this->conn->convertBooleans($field['default']); -
    747            } -
    748            $default = ' DEFAULT ' . $this->conn->quote($field['default'], $field['type']); -
    749        } -
    750        return $default; -
    751    } -
    752 -
    753    /** -
    754     * Obtain DBMS specific SQL code portion needed to set a CHECK constraint -
    755     * declaration to be used in statements like CREATE TABLE. -
    756     * -
    757     * @param array $definition     check definition -
    758     * @return string               DBMS specific SQL code portion needed to set a CHECK constraint -
    759     */ -
    760    public function getCheckDeclaration(array $definition) -
    761    { -
    762        $constraints = array(); -
    763        foreach ($definition as $field => $def) { -
    764            if (is_string($def)) { -
    765                $constraints[] = 'CHECK (' . $def . ')'; -
    766            } else { -
    767                if (isset($def['min'])) { -
    768                    $constraints[] = 'CHECK (' . $field . ' >= ' . $def['min'] . ')'; -
    769                } -
    770 -
    771                if (isset($def['max'])) { -
    772                    $constraints[] = 'CHECK (' . $field . ' <= ' . $def['max'] . ')'; -
    773                } -
    774            } -
    775        } -
    776 -
    777        return implode(', ', $constraints); -
    778    } -
    779 -
    780    /** -
    781     * Obtain DBMS specific SQL code portion needed to set an index -
    782     * declaration to be used in statements like CREATE TABLE. -
    783     * -
    784     * @param string $name          name of the index -
    785     * @param array $definition     index definition -
    786     * @return string               DBMS specific SQL code portion needed to set an index -
    787     */ -
    788    public function getIndexDeclaration($name, array $definition) -
    789    { -
    790        $name   = $this->conn->quoteIdentifier($name); -
    791        $type   = ''; -
    792 -
    793        if (isset($definition['type'])) { -
    794            if (strtolower($definition['type']) == 'unique') { -
    795                $type = strtoupper($definition['type']) . ' '; -
    796            } else { -
    797                throw new Doctrine_Export_Exception('Unknown index type ' . $definition['type']); -
    798            } -
    799        } -
    800 -
    801        if ( ! isset($definition['fields']) || ! is_array($definition['fields'])) { -
    802            throw new Doctrine_Export_Exception('No index columns given.'); -
    803        } -
    804 -
    805        $query = $type . 'INDEX ' . $name; -
    806 -
    807        $query .= ' (' . $this->getIndexFieldDeclarationList($definition['fields']) . ')'; -
    808 -
    809        return $query; -
    810    } -
    811 -
    812    /** -
    813     * getIndexFieldDeclarationList -
    814     * Obtain DBMS specific SQL code portion needed to set an index -
    815     * declaration to be used in statements like CREATE TABLE. -
    816     * -
    817     * @return string -
    818     */ -
    819    public function getIndexFieldDeclarationList(array $fields) -
    820    { -
    821        $ret = array(); -
    822        foreach ($fields as $field => $definition) { -
    823            if (is_array($definition)) { -
    824                $ret[] = $this->conn->quoteIdentifier($field); -
    825            } else { -
    826                $ret[] = $this->conn->quoteIdentifier($definition); -
    827            } -
    828        } -
    829        return implode(', ', $ret); -
    830    } -
    831 -
    832    /** -
    833     * A method to return the required SQL string that fits between CREATE ... TABLE -
    834     * to create the table as a temporary table. -
    835     * -
    836     * Should be overridden in driver classes to return the correct string for the -
    837     * specific database type. -
    838     * -
    839     * The default is to return the string "TEMPORARY" - this will result in a -
    840     * SQL error for any database that does not support temporary tables, or that -
    841     * requires a different SQL command from "CREATE TEMPORARY TABLE". -
    842     * -
    843     * @return string The string required to be placed between "CREATE" and "TABLE" -
    844     *                to generate a temporary table, if possible. -
    845     */ -
    846    public function getTemporaryTableQuery() -
    847    { -
    848        return 'TEMPORARY'; -
    849    } -
    850 -
    851    /** -
    852     * getForeignKeyDeclaration -
    853     * Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint -
    854     * of a field declaration to be used in statements like CREATE TABLE. -
    855     * -
    856     * @param array $definition         an associative array with the following structure: -
    857     *          name                    optional constraint name -
    858     * -
    859     *          local                   the local field(s) -
    860     * -
    861     *          foreign                 the foreign reference field(s) -
    862     * -
    863     *          foreignTable            the name of the foreign table -
    864     * -
    865     *          onDelete                referential delete action -
    866     * -
    867     *          onUpdate                referential update action -
    868     * -
    869     *          deferred                deferred constraint checking -
    870     * -
    871     * The onDelete and onUpdate keys accept the following values: -
    872     * -
    873     * CASCADE: Delete or update the row from the parent table and automatically delete or -
    874     *          update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported. -
    875     *          Between two tables, you should not define several ON UPDATE CASCADE clauses that act on the same column -
    876     *          in the parent table or in the child table. -
    877     * -
    878     * SET NULL: Delete or update the row from the parent table and set the foreign key column or columns in the -
    879     *          child table to NULL. This is valid only if the foreign key columns do not have the NOT NULL qualifier -
    880     *          specified. Both ON DELETE SET NULL and ON UPDATE SET NULL clauses are supported. -
    881     * -
    882     * NO ACTION: In standard SQL, NO ACTION means no action in the sense that an attempt to delete or update a primary -
    883     *           key value is not allowed to proceed if there is a related foreign key value in the referenced table. -
    884     * -
    885     * RESTRICT: Rejects the delete or update operation for the parent table. NO ACTION and RESTRICT are the same as -
    886     *           omitting the ON DELETE or ON UPDATE clause. -
    887     * -
    888     * SET DEFAULT -
    889     * -
    890     * @return string  DBMS specific SQL code portion needed to set the FOREIGN KEY constraint -
    891     *                 of a field declaration. -
    892     */ -
    893    public function getForeignKeyDeclaration(array $definition) -
    894    { -
    895        $sql  = $this->getForeignKeyBaseDeclaration($definition); -
    896        $sql .= $this->getAdvancedForeignKeyOptions($definition); -
    897 -
    898        return $sql; -
    899    } -
    900 -
    901    /** -
    902     * getAdvancedForeignKeyOptions -
    903     * Return the FOREIGN KEY query section dealing with non-standard options -
    904     * as MATCH, INITIALLY DEFERRED, ON UPDATE, ... -
    905     * -
    906     * @param array $definition     foreign key definition -
    907     * @return string -
    908     */ -
    909    public function getAdvancedForeignKeyOptions(array $definition) -
    910    { -
    911        $query = ''; -
    912        if ( ! empty($definition['onUpdate'])) { -
    913            $query .= ' ON UPDATE ' . $this->getForeignKeyRefentialAction($definition['onUpdate']); -
    914        } -
    915        if ( ! empty($definition['onDelete'])) { -
    916            $query .= ' ON DELETE ' . $this->getForeignKeyRefentialAction($definition['onDelete']); -
    917        } -
    918        return $query; -
    919    } -
    920 -
    921    /** -
    922     * getForeignKeyReferentialAction -
    923     * -
    924     * returns given referential action in uppercase if valid, otherwise throws -
    925     * an exception -
    926     * -
    927     * @throws Doctrine_Exception_Exception     if unknown referential action given -
    928     * @param string $action    foreign key referential action -
    929     * @param string            foreign key referential action in uppercase -
    930     */ -
    931    public function getForeignKeyReferentialAction($action) -
    932    { -
    933        $upper = strtoupper($action); -
    934        switch ($upper) { -
    935            case 'CASCADE': -
    936            case 'SET NULL': -
    937            case 'NO ACTION': -
    938            case 'RESTRICT': -
    939            case 'SET DEFAULT': -
    940                return $upper; -
    941            break; -
    942            default: -
    943                throw new Doctrine_Export_Exception('Unknown foreign key referential action \'' . $upper . '\' given.'); -
    944        } -
    945    } -
    946 -
    947    /** -
    948     * getForeignKeyBaseDeclaration -
    949     * Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint -
    950     * of a field declaration to be used in statements like CREATE TABLE. -
    951     * -
    952     * @param array $definition -
    953     * @return string -
    954     */ -
    955    public function getForeignKeyBaseDeclaration(array $definition) -
    956    { -
    957        $sql = ''; -
    958        if (isset($definition['name'])) { -
    959            $sql .= ' CONSTRAINT ' . $this->conn->quoteIdentifier($definition['name']) . ' '; -
    960        } -
    961        $sql .= 'FOREIGN KEY ('; -
    962 -
    963        if ( ! isset($definition['local'])) { -
    964            throw new Doctrine_Export_Exception('Local reference field missing from definition.'); -
    965        } -
    966        if ( ! isset($definition['foreign'])) { -
    967            throw new Doctrine_Export_Exception('Foreign reference field missing from definition.'); -
    968        } -
    969        if ( ! isset($definition['foreignTable'])) { -
    970            throw new Doctrine_Export_Exception('Foreign reference table missing from definition.'); -
    971        } -
    972 -
    973        if ( ! is_array($definition['local'])) { -
    974            $definition['local'] = array($definition['local']); -
    975        } -
    976        if ( ! is_array($definition['foreign'])) { -
    977            $definition['foreign'] = array($definition['foreign']); -
    978        } -
    979 -
    980        $sql .= implode(', ', array_map(array($this->conn, 'quoteIdentifier'), $definition['local'])) -
    981              . ') REFERENCES ' -
    982              . $this->conn->quoteIdentifier($definition['foreignTable']) . '(' -
    983              . implode(', ', array_map(array($this->conn, 'quoteIdentifier'), $definition['foreign'])) . ')'; -
    984 -
    985        return $sql; -
    986    } -
    987 -
    988    /** -
    989     * Obtain DBMS specific SQL code portion needed to set the UNIQUE constraint -
    990     * of a field declaration to be used in statements like CREATE TABLE. -
    991     * -
    992     * @return string  DBMS specific SQL code portion needed to set the UNIQUE constraint -
    993     *                 of a field declaration. -
    994     */ -
    995    public function getUniqueFieldDeclaration() -
    996    { -
    997        return 'UNIQUE'; -
    998    } -
    999 -
    1000    /** -
    1001     * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET -
    1002     * of a field declaration to be used in statements like CREATE TABLE. -
    1003     * -
    1004     * @param string $charset   name of the charset -
    1005     * @return string  DBMS specific SQL code portion needed to set the CHARACTER SET -
    1006     *                 of a field declaration. -
    1007     */ -
    1008    public function getCharsetFieldDeclaration($charset) -
    1009    { -
    1010        return ''; -
    1011    } -
    1012 -
    1013    /** -
    1014     * Obtain DBMS specific SQL code portion needed to set the COLLATION -
    1015     * of a field declaration to be used in statements like CREATE TABLE. -
    1016     * -
    1017     * @param string $collation   name of the collation -
    1018     * @return string  DBMS specific SQL code portion needed to set the COLLATION -
    1019     *                 of a field declaration. -
    1020     */ -
    1021    public function getCollationFieldDeclaration($collation) -
    1022    { -
    1023        return ''; -
    1024    } -
    1025 -
    1026    /** -
    1027     * exportSchema -
    1028     * method for exporting Doctrine_Record classes to a schema -
    1029     * -
    1030     * if the directory parameter is given this method first iterates -
    1031     * recursively trhough the given directory in order to find any model classes -
    1032     * -
    1033     * Then it iterates through all declared classes and creates tables for the ones -
    1034     * that extend Doctrine_Record and are not abstract classes -
    1035     * -
    1036     * @throws Doctrine_Connection_Exception    if some error other than Doctrine::ERR_ALREADY_EXISTS -
    1037     *                                          occurred during the create table operation -
    1038     * @param string $directory     optional directory parameter -
    1039     * @return void -
    1040     */ -
    1041    public function exportSchema($directory = null) -
    1042    { -
    1043        if ($directory !== null) { -
    1044            $models = Doctrine::loadModels($directory); -
    1045        } else { -
    1046            $models = Doctrine::getLoadedModels(); -
    1047        } -
    1048         -
    1049        $this->exportClasses($models); -
    1050    } -
    1051 -
    1052    /** -
    1053     * exportClasses -
    1054     * method for exporting Doctrine_Record classes to a schema -
    1055     * -
    1056     * @throws Doctrine_Connection_Exception    if some error other than Doctrine::ERR_ALREADY_EXISTS -
    1057     *                                          occurred during the create table operation -
    1058     * @param array $classes -
    1059     * @return void -
    1060     */ -
    1061    public function exportClasses(array $classes) -
    1062    { -
    1063        $connections = array(); -
    1064        foreach ($classes as $class) { -
    1065            $record = new $class(); -
    1066            $connection = $record->getTable()->getConnection(); -
    1067            $connectionName = Doctrine_Manager::getInstance()->getConnectionName($connection); -
    1068             -
    1069            if ( ! isset($connections[$connectionName])) { -
    1070                $connections[$connectionName] = array(); -
    1071                $connections[$connectionName]['creates'] = array(); -
    1072                $connections[$connectionName]['alters'] = array(); -
    1073            } -
    1074             -
    1075            $sql = $this->exportClassesSql(array($class)); -
    1076            // Build array of all the creates -
    1077            // We need these to happen first -
    1078            foreach ($sql as $key => $query) { -
    1079                if (strstr($query, 'CREATE')) { -
    1080                    $connections[$connectionName]['creates'][] = $query; -
    1081                    // Unset the create from sql so we can have an array of everything else but creates -
    1082                    unset($sql[$key]); -
    1083                } -
    1084            } -
    1085             -
    1086            $connections[$connectionName]['alters'] = array_merge($connections[$connectionName]['alters'], $sql); -
    1087        } -
    1088 -
    1089        // Loop over all the sql again to merge the creates and alters in to the same array, but so that the alters are at the bottom -
    1090        $build = array(); -
    1091        foreach ($connections as $connectionName => $sql) { -
    1092            $build[$connectionName] = array_merge($sql['creates'], $sql['alters']); -
    1093        } -
    1094 -
    1095        foreach ($build as $connectionName => $sql) { -
    1096            $connection = Doctrine_Manager::getInstance()->getConnection($connectionName); -
    1097             -
    1098            $connection->beginTransaction(); -
    1099             -
    1100            foreach ($sql as $query) { -
    1101                try { -
    1102                    $connection->exec($query); -
    1103                } catch (Doctrine_Connection_Exception $e) { -
    1104                    // we only want to silence table already exists errors -
    1105                    if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { -
    1106                        $connection->rollback(); -
    1107                        throw new Doctrine_Export_Exception($e->getMessage() . '. Failing Query: ' . $query); -
    1108                    } -
    1109                } -
    1110            } -
    1111             -
    1112            $connection->commit(); -
    1113        } -
    1114    } -
    1115 -
    1116    /** -
    1117     * exportClassesSql -
    1118     * method for exporting Doctrine_Record classes to a schema -
    1119     * -
    1120     * @throws Doctrine_Connection_Exception    if some error other than Doctrine::ERR_ALREADY_EXISTS -
    1121     *                                          occurred during the create table operation -
    1122     * @param array $classes -
    1123     * @return void -
    1124     */ -
    1125    public function exportClassesSql(array $classes) -
    1126    { -
    1127        $models = Doctrine::getLoadedModels($classes); -
    1128         -
    1129        $sql = array(); -
    1130         -
    1131        foreach ($models as $name) { -
    1132            $record = new $name(); -
    1133            $table  = $record->getTable(); -
    1134 -
    1135            $parents = $table->getOption('joinedParents'); -
    1136 -
    1137            foreach ($parents as $parent) { -
    1138                $data  = $table->getConnection()->getTable($parent)->getExportableFormat(); -
    1139 -
    1140                $query = $this->conn->export->createTableSql($data['tableName'], $data['columns'], $data['options']); -
    1141                 -
    1142                $sql = array_merge($sql, (array) $query); -
    1143            } -
    1144 -
    1145            $data = $table->getExportableFormat(); -
    1146 -
    1147            $query = $this->conn->export->createTableSql($data['tableName'], $data['columns'], $data['options']); -
    1148 -
    1149            if (is_array($query)) { -
    1150                $sql = array_merge($sql, $query); -
    1151            } else { -
    1152                $sql[] = $query; -
    1153            } -
    1154             -
    1155            if ($table->getAttribute(Doctrine::ATTR_EXPORT) & Doctrine::EXPORT_PLUGINS) { -
    1156                $sql = array_merge($sql, $this->exportPluginsSql($table)); -
    1157            } -
    1158        } -
    1159         -
    1160        $sql = array_unique($sql); -
    1161         -
    1162        rsort($sql); -
    1163 -
    1164        return $sql; -
    1165    } -
    1166 -
    1167    /** -
    1168     * fetches all plugins recursively for given table -
    1169     * -
    1170     * @param Doctrine_Table $table     table object to retrieve the plugins from -
    1171     * @return array                    an array of Doctrine_Plugin objects -
    1172     */ -
    1173    public function getAllPlugins(Doctrine_Table $table) -
    1174    { -
    1175        $plugins = array(); -
    1176 -
    1177        foreach ($table->getTemplates() as $name => $template) { -
    1178            $plugin = $template->getPlugin(); -
    1179 -
    1180            if ($plugin === null) { -
    1181                continue;                      -
    1182            } -
    1183 -
    1184            $plugins[] = $plugin; -
    1185 -
    1186            $pluginTable = $plugin->getOption('pluginTable'); -
    1187             -
    1188            if ($pluginTable instanceof Doctrine_Table) { -
    1189                $plugins = array_merge($plugins, $this->getAllPlugins($pluginTable)); -
    1190            } -
    1191        } -
    1192 -
    1193        return $plugins; -
    1194    } -
    1195 -
    1196    /** -
    1197     * exportPluginsSql -
    1198     * exports plugin tables for given table -
    1199     * -
    1200     * @param Doctrine_Table $table     the table in which the plugins belong to -
    1201     * @return array    an array of sql strings -
    1202     */ -
    1203    public function exportPluginsSql(Doctrine_Table $table) -
    1204    { -
    1205     $sql = array(); -
    1206 -
    1207        foreach ($this->getAllPlugins($table) as $name => $plugin) { -
    1208            $table = $plugin->getOption('pluginTable'); -
    1209             -
    1210            // Make sure plugin has a valid table -
    1211            if ($table instanceof Doctrine_Table) { -
    1212                $data = $table->getExportableFormat(); -
    1213 -
    1214                $query = $this->conn->export->createTableSql($data['tableName'], $data['columns'], $data['options']); -
    1215 -
    1216                $sql = array_merge($sql, (array) $query); -
    1217            } -
    1218        } -
    1219 -
    1220        return $sql; -
    1221    } -
    1222 -
    1223    /** -
    1224     * exportSql -
    1225     * returns the sql for exporting Doctrine_Record classes to a schema -
    1226     * -
    1227     * if the directory parameter is given this method first iterates -
    1228     * recursively trhough the given directory in order to find any model classes -
    1229     * -
    1230     * Then it iterates through all declared classes and creates tables for the ones -
    1231     * that extend Doctrine_Record and are not abstract classes -
    1232     * -
    1233     * @throws Doctrine_Connection_Exception    if some error other than Doctrine::ERR_ALREADY_EXISTS -
    1234     *                                          occurred during the create table operation -
    1235     * @param string $directory     optional directory parameter -
    1236     * @return void -
    1237     */ -
    1238    public function exportSql($directory = null) -
    1239    { -
    1240        if ($directory !== null) { -
    1241            $models = Doctrine::loadModels($directory); -
    1242        } else { -
    1243            $models = Doctrine::getLoadedModels(); -
    1244        } -
    1245         -
    1246        return $this->exportClassesSql($models); -
    1247    } -
    1248 -
    1249    /** -
    1250     * exportTable -
    1251     * exports given table into database based on column and option definitions -
    1252     * -
    1253     * @throws Doctrine_Connection_Exception    if some error other than Doctrine::ERR_ALREADY_EXISTS -
    1254     *                                          occurred during the create table operation -
    1255     * @return boolean                          whether or not the export operation was successful -
    1256     *                                          false if table already existed in the database -
    1257     */ -
    1258    public function exportTable(Doctrine_Table $table) -
    1259    { -
    1260        /** -
    1261        TODO: maybe there should be portability option for the following check -
    1262        if ( ! Doctrine::isValidClassname($table->getOption('declaringClass')->getName())) { -
    1263            throw new Doctrine_Export_Exception('Class name not valid.'); -
    1264        } -
    1265        */ -
    1266 -
    1267        try { -
    1268            $data = $table->getExportableFormat(); -
    1269 -
    1270            $this->conn->export->createTable($data['tableName'], $data['columns'], $data['options']); -
    1271        } catch(Doctrine_Connection_Exception $e) { -
    1272            // we only want to silence table already exists errors -
    1273            if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { -
    1274                throw $e; -
    1275            } -
    1276        } -
    1277    } -
    1278} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Export_Exception.html b/tests_old/coverage/Doctrine_Export_Exception.html deleted file mode 100644 index 64db23262..000000000 --- a/tests_old/coverage/Doctrine_Export_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Export_Exception - - -

    Coverage for Doctrine_Export_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Export_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Export -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Export_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Export_Firebird.html b/tests_old/coverage/Doctrine_Export_Firebird.html deleted file mode 100644 index 16390274f..000000000 --- a/tests_old/coverage/Doctrine_Export_Firebird.html +++ /dev/null @@ -1,1665 +0,0 @@ - - - Coverage for Doctrine_Export_Firebird - - -

    Coverage for Doctrine_Export_Firebird

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Firebird.php 3034 2007-10-29 22:57:32Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Export'); -
    22/** -
    23 * Doctrine_Export_Sqlite -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Export -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @author      Lorenzo Alberton <l.alberton@quipo.it> (PEAR MDB2 Interbase driver) -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 3034 $ -
    34 */ -
    35class Doctrine_Export_Firebird extends Doctrine_Export -
    36{ -
    37    /** -
    38     * create a new database -
    39     * -
    40     * @param string $name  name of the database that should be created -
    41     * @return void -
    42     */ -
    43    public function createDatabase($name) -
    44    { -
    45        throw new Doctrine_Export_Exception( -
    46                'PHP Interbase API does not support direct queries. You have to ' . -
    47                'create the db manually by using isql command or a similar program'); -
    48    } -
    49 -
    50    /** -
    51     * drop an existing database -
    52     * -
    53     * @param string $name  name of the database that should be dropped -
    54     * @return void -
    55     */ -
    56    public  function dropDatabase($name) -
    57    { -
    58        throw new Doctrine_Export_Exception( -
    59                'PHP Interbase API does not support direct queries. You have ' . -
    60                'to drop the db manually by using isql command or a similar program'); -
    61    } -
    62 -
    63    /** -
    64     * add an autoincrement sequence + trigger -
    65     * -
    66     * @param string $name  name of the PK field -
    67     * @param string $table name of the table -
    68     * @param string $start start value for the sequence -
    69     * @return void -
    70     */ -
    71    public function _makeAutoincrement($name, $table, $start = null) -
    72    { -
    73        if (is_null($start)) { -
    74            $this->conn->beginTransaction(); -
    75            $query = 'SELECT MAX(' . $this->conn->quoteIdentifier($name, true) . ') FROM ' . $this->conn->quoteIdentifier($table, true); -
    76            $start = $this->conn->fetchOne($query, 'integer'); -
    77 -
    78            ++$start; -
    79            $result = $this->createSequence($table, $start); -
    80            $this->conn->commit(); -
    81        } else { -
    82            $result = $this->createSequence($table, $start); -
    83        } -
    84 -
    85        $sequence_name = $this->conn->formatter->getSequenceName($table); -
    86        $trigger_name  = $this->conn->quoteIdentifier($table . '_AUTOINCREMENT_PK', true); -
    87 -
    88        $table = $this->conn->quoteIdentifier($table, true); -
    89        $name  = $this->conn->quoteIdentifier($name,  true); -
    90 -
    91        $triggerSql = 'CREATE TRIGGER ' . $trigger_name . ' FOR ' . $table -
    92                    . ' ACTIVE BEFORE INSERT POSITION 0 AS' -
    93                    . ' BEGIN' -
    94                    . ' IF (NEW.' . $name . ' IS NULL OR NEW.' . $name . ' = 0) THEN' -
    95                    . ' NEW.' . $name . ' = GEN_ID('.$sequence_name.', 1)' -
    96                    . ' END'; -
    97        $result = $this->conn->exec($triggerSql); -
    98 -
    99        // TODO ? $this->_silentCommit(); -
    100 -
    101        return $result; -
    102    } -
    103 -
    104    /** -
    105     * drop an existing autoincrement sequence + trigger -
    106     * -
    107     * @param string $table name of the table -
    108     * @return void -
    109     */ -
    110    public function _dropAutoincrement($table) -
    111    { -
    112 -
    113        $result = $this->dropSequence($table); -
    114 -
    115        //remove autoincrement trigger associated with the table -
    116        $table = $this->conn->quote(strtoupper($table)); -
    117        $triggerName = $this->conn->quote(strtoupper($table) . '_AUTOINCREMENT_PK'); -
    118 -
    119        return $this->conn->exec("DELETE FROM RDB\$TRIGGERS WHERE UPPER(RDB\$RELATION_NAME)=" . $table . " AND UPPER(RDB\$TRIGGER_NAME)=" . $triggerName); -
    120    } -
    121 -
    122    /** -
    123     * create a new table -
    124     * -
    125     * @param string $name     Name of the database that should be created -
    126     * @param array $fields Associative array that contains the definition of each field of the new table -
    127     *                        The indexes of the array entries are the names of the fields of the table an -
    128     *                        the array entry values are associative arrays like those that are meant to be -
    129     *                         passed with the field definitions to get[Type]Declaration() functions. -
    130     * -
    131     *                        Example -
    132     *                        array( -
    133     * -
    134     *                            'id' => array( -
    135     *                                'type' => 'integer', -
    136     *                                'unsigned' => 1, -
    137     *                                'notnull' => 1, -
    138     *                                'default' => 0, -
    139     *                            ), -
    140     *                            'name' => array( -
    141     *                                'type' => 'text', -
    142     *                                'length' => 12, -
    143     *                            ), -
    144     *                            'description' => array( -
    145     *                                'type' => 'text', -
    146     *                                'length' => 12, -
    147     *                            ) -
    148     *                        ); -
    149     * @param array $options  An associative array of table options: -
    150     * -
    151     * @return void -
    152     */ -
    153    public function createTable($name, array $fields, array $options = array()) { -
    154        parent::createTable($name, $fields, $options); -
    155 -
    156        // TODO ? $this->_silentCommit(); -
    157        foreach ($fields as $field_name => $field) { -
    158            if ( ! empty($field['autoincrement'])) { -
    159                //create PK constraint -
    160                $pk_definition = array( -
    161                    'fields' => array($field_name => array()), -
    162                    'primary' => true, -
    163                ); -
    164                //$pk_name = $name.'_PK'; -
    165                $pk_name = null; -
    166                $result = $this->createConstraint($name, $pk_name, $pk_definition); -
    167 -
    168                //create autoincrement sequence + trigger -
    169                return $this->_makeAutoincrement($field_name, $name, 1); -
    170            } -
    171        } -
    172    } -
    173 -
    174    /** -
    175     * Check if planned changes are supported -
    176     * -
    177     * @param string $name name of the database that should be dropped -
    178     * @return void -
    179     */ -
    180    public function checkSupportedChanges(&$changes) -
    181    { -
    182        foreach ($changes as $change_name => $change) { -
    183            switch ($change_name) { -
    184                case 'notnull': -
    185                    throw new Doctrine_DataDict_Exception('it is not supported changes to field not null constraint'); -
    186                case 'default': -
    187                    throw new Doctrine_DataDict_Exception('it is not supported changes to field default value'); -
    188                case 'length': -
    189                    /* -
    190                    return throw new Doctrine_DataDict_Firebird_Exception('it is not supported changes to field default length'); -
    191                    */ -
    192                case 'unsigned': -
    193                case 'type': -
    194                case 'declaration': -
    195                case 'definition': -
    196                    break; -
    197                default: -
    198                    throw new Doctrine_DataDict_Exception('it is not supported change of type' . $change_name); -
    199            } -
    200        } -
    201        return true; -
    202    } -
    203 -
    204    /** -
    205     * drop an existing table -
    206     * -
    207     * @param string $name name of the table that should be dropped -
    208     * @return mixed MDB2_OK on success, a MDB2 error on failure -
    209     * @access public -
    210     */ -
    211    public function dropTable($name) -
    212    { -
    213        $result = $this->_dropAutoincrement($name); -
    214        $result = parent::dropTable($name); -
    215 -
    216        //$this->_silentCommit(); -
    217 -
    218        return $result; -
    219    } -
    220 -
    221    /** -
    222     * alter an existing table -
    223     * -
    224     * @param string $name         name of the table that is intended to be changed. -
    225     * @param array $changes     associative array that contains the details of each type -
    226     *                             of change that is intended to be performed. The types of -
    227     *                             changes that are currently supported are defined as follows: -
    228     * -
    229     *                             name -
    230     * -
    231     *                                New name for the table. -
    232     * -
    233     *                            add -
    234     * -
    235     *                                Associative array with the names of fields to be added as -
    236     *                                 indexes of the array. The value of each entry of the array -
    237     *                                 should be set to another associative array with the properties -
    238     *                                 of the fields to be added. The properties of the fields should -
    239     *                                 be the same as defined by the Metabase parser. -
    240     * -
    241     * -
    242     *                            remove -
    243     * -
    244     *                                Associative array with the names of fields to be removed as indexes -
    245     *                                 of the array. Currently the values assigned to each entry are ignored. -
    246     *                                 An empty array should be used for future compatibility. -
    247     * -
    248     *                            rename -
    249     * -
    250     *                                Associative array with the names of fields to be renamed as indexes -
    251     *                                 of the array. The value of each entry of the array should be set to -
    252     *                                 another associative array with the entry named name with the new -
    253     *                                 field name and the entry named Declaration that is expected to contain -
    254     *                                 the portion of the field declaration already in DBMS specific SQL code -
    255     *                                 as it is used in the CREATE TABLE statement. -
    256     * -
    257     *                            change -
    258     * -
    259     *                                Associative array with the names of the fields to be changed as indexes -
    260     *                                 of the array. Keep in mind that if it is intended to change either the -
    261     *                                 name of a field and any other properties, the change array entries -
    262     *                                 should have the new names of the fields as array indexes. -
    263     * -
    264     *                                The value of each entry of the array should be set to another associative -
    265     *                                 array with the properties of the fields to that are meant to be changed as -
    266     *                                 array entries. These entries should be assigned to the new values of the -
    267     *                                 respective properties. The properties of the fields should be the same -
    268     *                                 as defined by the Metabase parser. -
    269     * -
    270     *                            Example -
    271     *                                array( -
    272     *                                    'name' => 'userlist', -
    273     *                                    'add' => array( -
    274     *                                        'quota' => array( -
    275     *                                            'type' => 'integer', -
    276     *                                            'unsigned' => 1 -
    277     *                                        ) -
    278     *                                    ), -
    279     *                                    'remove' => array( -
    280     *                                        'file_limit' => array(), -
    281     *                                        'time_limit' => array() -
    282     *                                    ), -
    283     *                                    'change' => array( -
    284     *                                        'name' => array( -
    285     *                                            'length' => '20', -
    286     *                                            'definition' => array( -
    287     *                                                'type' => 'text', -
    288     *                                                'length' => 20, -
    289     *                                            ), -
    290     *                                        ) -
    291     *                                    ), -
    292     *                                    'rename' => array( -
    293     *                                        'sex' => array( -
    294     *                                            'name' => 'gender', -
    295     *                                            'definition' => array( -
    296     *                                                'type' => 'text', -
    297     *                                                'length' => 1, -
    298     *                                                'default' => 'M', -
    299     *                                            ), -
    300     *                                        ) -
    301     *                                    ) -
    302     *                                ) -
    303     * -
    304     * @param boolean $check     indicates whether the function should just check if the DBMS driver -
    305     *                             can perform the requested table alterations if the value is true or -
    306     *                             actually perform them otherwise. -
    307     * @return void -
    308     */ -
    309    public function alterTable($name, array $changes, $check = false) -
    310    { -
    311        foreach ($changes as $changeName => $change) { -
    312            switch ($changeName) { -
    313                case 'add': -
    314                case 'remove': -
    315                case 'rename': -
    316                    break; -
    317                case 'change': -
    318                    foreach ($changes['change'] as $field) { -
    319                        $this->checkSupportedChanges($field); -
    320                    } -
    321                    break; -
    322                default: -
    323                    throw new Doctrine_DataDict_Exception('change type ' . $changeName . ' not yet supported'); -
    324            } -
    325        } -
    326        if ($check) { -
    327            return true; -
    328        } -
    329        $query = ''; -
    330        if ( ! empty($changes['add']) && is_array($changes['add'])) { -
    331            foreach ($changes['add'] as $fieldName => $field) { -
    332                if ($query) { -
    333                    $query.= ', '; -
    334                } -
    335                $query.= 'ADD ' . $this->getDeclaration($fieldName, $field); -
    336            } -
    337        } -
    338 -
    339        if ( ! empty($changes['remove']) && is_array($changes['remove'])) { -
    340            foreach ($changes['remove'] as $field_name => $field) { -
    341                if ($query) { -
    342                    $query.= ', '; -
    343                } -
    344                $field_name = $this->conn->quoteIdentifier($field_name, true); -
    345                $query.= 'DROP ' . $field_name; -
    346            } -
    347        } -
    348 -
    349        if ( ! empty($changes['rename']) && is_array($changes['rename'])) { -
    350            foreach ($changes['rename'] as $field_name => $field) { -
    351                if ($query) { -
    352                    $query.= ', '; -
    353                } -
    354                $field_name = $this->conn->quoteIdentifier($field_name, true); -
    355                $query.= 'ALTER ' . $field_name . ' TO ' . $this->conn->quoteIdentifier($field['name'], true); -
    356            } -
    357        } -
    358 -
    359        if ( ! empty($changes['change']) && is_array($changes['change'])) { -
    360            // missing support to change DEFAULT and NULLability -
    361            foreach ($changes['change'] as $fieldName => $field) { -
    362                $this->checkSupportedChanges($field); -
    363                if ($query) { -
    364                    $query.= ', '; -
    365                } -
    366                $this->conn->loadModule('Datatype', null, true); -
    367                $field_name = $this->conn->quoteIdentifier($fieldName, true); -
    368                $query.= 'ALTER ' . $field_name.' TYPE ' . $this->getTypeDeclaration($field['definition']); -
    369            } -
    370        } -
    371 -
    372        if ( ! strlen($query)) { -
    373            return false; -
    374        } -
    375 -
    376        $name = $this->conn->quoteIdentifier($name, true); -
    377        $result = $this->conn->exec('ALTER TABLE ' . $name . ' ' . $query); -
    378        $this->_silentCommit(); -
    379        return $result; -
    380    } -
    381 -
    382    /** -
    383     * Get the stucture of a field into an array -
    384     * -
    385     * @param string    $table         name of the table on which the index is to be created -
    386     * @param string    $name         name of the index to be created -
    387     * @param array     $definition        associative array that defines properties of the index to be created. -
    388     *                                 Currently, only one property named FIELDS is supported. This property -
    389     *                                 is also an associative with the names of the index fields as array -
    390     *                                 indexes. Each entry of this array is set to another type of associative -
    391     *                                 array that specifies properties of the index that are specific to -
    392     *                                 each field. -
    393     * -
    394     *                                Currently, only the sorting property is supported. It should be used -
    395     *                                 to define the sorting direction of the index. It may be set to either -
    396     *                                 ascending or descending. -
    397     * -
    398     *                                Not all DBMS support index sorting direction configuration. The DBMS -
    399     *                                 drivers of those that do not support it ignore this property. Use the -
    400     *                                 function support() to determine whether the DBMS driver can manage indexes. -
    401 -
    402     *                                 Example -
    403     *                                    array( -
    404     *                                        'fields' => array( -
    405     *                                            'user_name' => array( -
    406     *                                                'sorting' => 'ascending' -
    407     *                                            ), -
    408     *                                            'last_login' => array() -
    409     *                                        ) -
    410     *                                    ) -
    411     * @return void -
    412     */ -
    413    public function createIndexSql($table, $name, array $definition) -
    414    { -
    415        $query = 'CREATE'; -
    416 -
    417        $query_sort = ''; -
    418        foreach ($definition['fields'] as $field) { -
    419            if ( ! strcmp($query_sort, '') && isset($field['sorting'])) { -
    420                switch ($field['sorting']) { -
    421                    case 'ascending': -
    422                        $query_sort = ' ASC'; -
    423                        break; -
    424                    case 'descending': -
    425                        $query_sort = ' DESC'; -
    426                        break; -
    427                } -
    428            } -
    429        } -
    430        $table = $this->conn->quoteIdentifier($table, true); -
    431        $name  = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true); -
    432        $query .= $query_sort. ' INDEX ' . $name . ' ON ' . $table; -
    433        $fields = array(); -
    434        foreach (array_keys($definition['fields']) as $field) { -
    435            $fields[] = $this->conn->quoteIdentifier($field, true); -
    436        } -
    437        $query .= ' ('.implode(', ', $fields) . ')'; -
    438 -
    439        return $query; -
    440    } -
    441 -
    442    /** -
    443     * create a constraint on a table -
    444     * -
    445     * @param string    $table      name of the table on which the constraint is to be created -
    446     * @param string    $name       name of the constraint to be created -
    447     * @param array     $definition associative array that defines properties of the constraint to be created. -
    448     *                              Currently, only one property named FIELDS is supported. This property -
    449     *                              is also an associative with the names of the constraint fields as array -
    450     *                              constraints. Each entry of this array is set to another type of associative -
    451     *                              array that specifies properties of the constraint that are specific to -
    452     *                              each field. -
    453     * -
    454     *                              Example -
    455     *                                  array( -
    456     *                                      'fields' => array( -
    457     *                                          'user_name' => array(), -
    458     *                                          'last_login' => array(), -
    459     *                                      ) -
    460     *                                  ) -
    461     * @return void -
    462     */ -
    463    public function createConstraint($table, $name, $definition) -
    464    { -
    465        $table = $this->conn->quoteIdentifier($table, true); -
    466 -
    467        if ( ! empty($name)) { -
    468            $name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true); -
    469        } -
    470        $query = "ALTER TABLE $table ADD"; -
    471        if ( ! empty($definition['primary'])) { -
    472            if ( ! empty($name)) { -
    473                $query.= ' CONSTRAINT '.$name; -
    474            } -
    475            $query.= ' PRIMARY KEY'; -
    476        } else { -
    477            $query.= ' CONSTRAINT '. $name; -
    478            if ( ! empty($definition['unique'])) { -
    479               $query.= ' UNIQUE'; -
    480            } -
    481        } -
    482        $fields = array(); -
    483        foreach (array_keys($definition['fields']) as $field) { -
    484            $fields[] = $this->conn->quoteIdentifier($field, true); -
    485        } -
    486        $query .= ' ('. implode(', ', $fields) . ')'; -
    487        $result = $this->conn->exec($query); -
    488        // TODO ? $this->_silentCommit(); -
    489        return $result; -
    490    } -
    491 -
    492    /** -
    493     * A method to return the required SQL string that fits between CREATE ... TABLE -
    494     * to create the table as a temporary table. -
    495     * -
    496     * @return string The string required to be placed between "CREATE" and "TABLE" -
    497     *                to generate a temporary table, if possible. -
    498     */ -
    499    public function getTemporaryTableQuery() -
    500    { -
    501        return 'GLOBAL TEMPORARY'; -
    502    } -
    503 -
    504    /** -
    505     * create sequence -
    506     * -
    507     * @param string $seqName name of the sequence to be created -
    508     * @param string $start start value of the sequence; default is 1 -
    509     * @param array     $options  An associative array of table options: -
    510     *                          array( -
    511     *                              'comment' => 'Foo', -
    512     *                              'charset' => 'utf8', -
    513     *                              'collate' => 'utf8_unicode_ci', -
    514     *                          ); -
    515     * @return boolean -
    516     */ -
    517    public function createSequence($seqName, $start = 1, array $options = array()) -
    518    { -
    519        $sequenceName = $this->conn->formatter->getSequenceName($seqName); -
    520 -
    521        $this->conn->exec('CREATE GENERATOR ' . $sequenceName); -
    522 -
    523        try { -
    524            $this->conn->exec('SET GENERATOR ' . $sequenceName . ' TO ' . ($start-1)); -
    525             -
    526            return true; -
    527        } catch (Doctrine_Connection_Exception $e) { -
    528            try { -
    529                $this->dropSequence($seqName); -
    530            } catch(Doctrine_Connection_Exception $e) { -
    531                throw new Doctrine_Export_Exception('Could not drop inconsistent sequence table'); -
    532            } -
    533        } -
    534        throw new Doctrine_Export_Exception('could not create sequence table'); -
    535    } -
    536 -
    537    /** -
    538     * drop existing sequence -
    539     * -
    540     * @param string $seqName name of the sequence to be dropped -
    541     * @return void -
    542     */ -
    543    public function dropSequenceSql($seqName) -
    544    { -
    545        $sequenceName = $this->conn->formatter->getSequenceName($seqName); -
    546        $sequenceName = $this->conn->quote($sequenceName); -
    547        $query = "DELETE FROM RDB\$GENERATORS WHERE UPPER(RDB\$GENERATOR_NAME)=" . $sequenceName; -
    548         -
    549        return $query; -
    550    } -
    551} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Export_Mysql.html b/tests_old/coverage/Doctrine_Export_Mysql.html deleted file mode 100644 index 87a3458cd..000000000 --- a/tests_old/coverage/Doctrine_Export_Mysql.html +++ /dev/null @@ -1,1982 +0,0 @@ - - - Coverage for Doctrine_Export_Mysql - - -

    Coverage for Doctrine_Export_Mysql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mysql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Export'); -
    22/** -
    23 * Doctrine_Export_Mysql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Export -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2963 $ -
    33 */ -
    34class Doctrine_Export_Mysql extends Doctrine_Export -
    35{ -
    36   /** -
    37     * create a new database -
    38     * -
    39     * @param string $name name of the database that should be created -
    40     * @return string -
    41     */ -
    42    public function createDatabaseSql($name) -
    43    { -
    44        return 'CREATE DATABASE ' . $this->conn->quoteIdentifier($name, true); -
    45    } -
    46 -
    47    /** -
    48     * drop an existing database -
    49     * -
    50     * @param string $name name of the database that should be dropped -
    51     * @return string -
    52     */ -
    53    public function dropDatabaseSql($name) -
    54    { -
    55        return 'DROP DATABASE ' . $this->conn->quoteIdentifier($name); -
    56    } -
    57 -
    58    /** -
    59     * create a new table -
    60     * -
    61     * @param string $name   Name of the database that should be created -
    62     * @param array $fields  Associative array that contains the definition of each field of the new table -
    63     *                       The indexes of the array entries are the names of the fields of the table an -
    64     *                       the array entry values are associative arrays like those that are meant to be -
    65     *                       passed with the field definitions to get[Type]Declaration() functions. -
    66     *                          array( -
    67     *                              'id' => array( -
    68     *                                  'type' => 'integer', -
    69     *                                  'unsigned' => 1 -
    70     *                                  'notnull' => 1 -
    71     *                                  'default' => 0 -
    72     *                              ), -
    73     *                              'name' => array( -
    74     *                                  'type' => 'text', -
    75     *                                  'length' => 12 -
    76     *                              ), -
    77     *                              'password' => array( -
    78     *                                  'type' => 'text', -
    79     *                                  'length' => 12 -
    80     *                              ) -
    81     *                          ); -
    82     * @param array $options  An associative array of table options: -
    83     *                          array( -
    84     *                              'comment' => 'Foo', -
    85     *                              'charset' => 'utf8', -
    86     *                              'collate' => 'utf8_unicode_ci', -
    87     *                              'type'    => 'innodb', -
    88     *                          ); -
    89     * -
    90     * @return void -
    91     */ -
    92    public function createTableSql($name, array $fields, array $options = array())  -
    93    { -
    94        if ( ! $name) -
    95            throw new Doctrine_Export_Exception('no valid table name specified'); -
    96 -
    97        if (empty($fields)) { -
    98            throw new Doctrine_Export_Exception('no fields specified for table "'.$name.'"'); -
    99        } -
    100        $queryFields = $this->getFieldDeclarationList($fields); -
    101         -
    102        // build indexes for all foreign key fields (needed in MySQL!!) -
    103        if (isset($options['foreignKeys'])) { -
    104            foreach ($options['foreignKeys'] as $fk) { -
    105                $local = $fk['local']; -
    106                $found = false; -
    107                if (isset($options['indexes'])) { -
    108                    foreach ($options['indexes'] as $definition) { -
    109                        if (is_string($definition['fields'])) { -
    110                            // Check if index already exists on the column                             -
    111                            $found = ($local == $definition['fields']);                         -
    112                        } else if (in_array($local, $definition['fields']) && count($definition['fields']) === 1) { -
    113                            // Index already exists on the column -
    114                            $found = true; -
    115                        } -
    116                    } -
    117                } -
    118                if (isset($options['primary']) && !empty($options['primary']) && -
    119                        in_array($local, $options['primary'])) { -
    120                    // field is part of the PK and therefore already indexed -
    121                    $found = true; -
    122                } -
    123                 -
    124                if ( ! $found) { -
    125                    $options['indexes'][$local] = array('fields' => array($local => array())); -
    126                } -
    127            } -
    128        } -
    129 -
    130        // add all indexes -
    131        if (isset($options['indexes']) && ! empty($options['indexes'])) { -
    132            foreach($options['indexes'] as $index => $definition) { -
    133                $queryFields .= ', ' . $this->getIndexDeclaration($index, $definition); -
    134            } -
    135        } -
    136 -
    137        // attach all primary keys -
    138        if (isset($options['primary']) && ! empty($options['primary'])) { -
    139            $keyColumns = array_values($options['primary']); -
    140            $keyColumns = array_map(array($this->conn, 'quoteIdentifier'), $keyColumns); -
    141            $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; -
    142        } -
    143 -
    144        $query = 'CREATE TABLE ' . $this->conn->quoteIdentifier($name, true) . ' (' . $queryFields . ')'; -
    145 -
    146        $optionStrings = array(); -
    147 -
    148        if (isset($options['comment'])) { -
    149            $optionStrings['comment'] = 'COMMENT = ' . $this->dbh->quote($options['comment'], 'text'); -
    150        } -
    151        if (isset($options['charset'])) { -
    152            $optionStrings['charset'] = 'DEFAULT CHARACTER SET ' . $options['charset']; -
    153            if (isset($options['collate'])) { -
    154                $optionStrings['charset'] .= ' COLLATE ' . $options['collate']; -
    155            } -
    156        } -
    157 -
    158        $type = false; -
    159 -
    160        // get the type of the table -
    161        if (isset($options['type'])) { -
    162            $type = $options['type']; -
    163        } else { -
    164            $type = $this->conn->getAttribute(Doctrine::ATTR_DEFAULT_TABLE_TYPE); -
    165        } -
    166 -
    167        if ($type) { -
    168            $optionStrings[] = 'ENGINE = ' . $type; -
    169        } -
    170 -
    171        if ( ! empty($optionStrings)) { -
    172            $query.= ' '.implode(' ', $optionStrings); -
    173        } -
    174        $sql[] = $query; -
    175 -
    176        if (isset($options['foreignKeys'])) { -
    177 -
    178            foreach ((array) $options['foreignKeys'] as $k => $definition) { -
    179                if (is_array($definition)) { -
    180                    $sql[] = $this->createForeignKeySql($name, $definition); -
    181                } -
    182            } -
    183        }    -
    184        return $sql; -
    185    } -
    186 -
    187    /** -
    188     * alter an existing table -
    189     * -
    190     * @param string $name         name of the table that is intended to be changed. -
    191     * @param array $changes     associative array that contains the details of each type -
    192     *                             of change that is intended to be performed. The types of -
    193     *                             changes that are currently supported are defined as follows: -
    194     * -
    195     *                             name -
    196     * -
    197     *                                New name for the table. -
    198     * -
    199     *                            add -
    200     * -
    201     *                                Associative array with the names of fields to be added as -
    202     *                                 indexes of the array. The value of each entry of the array -
    203     *                                 should be set to another associative array with the properties -
    204     *                                 of the fields to be added. The properties of the fields should -
    205     *                                 be the same as defined by the Metabase parser. -
    206     * -
    207     * -
    208     *                            remove -
    209     * -
    210     *                                Associative array with the names of fields to be removed as indexes -
    211     *                                 of the array. Currently the values assigned to each entry are ignored. -
    212     *                                 An empty array should be used for future compatibility. -
    213     * -
    214     *                            rename -
    215     * -
    216     *                                Associative array with the names of fields to be renamed as indexes -
    217     *                                 of the array. The value of each entry of the array should be set to -
    218     *                                 another associative array with the entry named name with the new -
    219     *                                 field name and the entry named Declaration that is expected to contain -
    220     *                                 the portion of the field declaration already in DBMS specific SQL code -
    221     *                                 as it is used in the CREATE TABLE statement. -
    222     * -
    223     *                            change -
    224     * -
    225     *                                Associative array with the names of the fields to be changed as indexes -
    226     *                                 of the array. Keep in mind that if it is intended to change either the -
    227     *                                 name of a field and any other properties, the change array entries -
    228     *                                 should have the new names of the fields as array indexes. -
    229     * -
    230     *                                The value of each entry of the array should be set to another associative -
    231     *                                 array with the properties of the fields to that are meant to be changed as -
    232     *                                 array entries. These entries should be assigned to the new values of the -
    233     *                                 respective properties. The properties of the fields should be the same -
    234     *                                 as defined by the Metabase parser. -
    235     * -
    236     *                            Example -
    237     *                                array( -
    238     *                                    'name' => 'userlist', -
    239     *                                    'add' => array( -
    240     *                                        'quota' => array( -
    241     *                                            'type' => 'integer', -
    242     *                                            'unsigned' => 1 -
    243     *                                        ) -
    244     *                                    ), -
    245     *                                    'remove' => array( -
    246     *                                        'file_limit' => array(), -
    247     *                                        'time_limit' => array() -
    248     *                                    ), -
    249     *                                    'change' => array( -
    250     *                                        'name' => array( -
    251     *                                            'length' => '20', -
    252     *                                            'definition' => array( -
    253     *                                                'type' => 'text', -
    254     *                                                'length' => 20, -
    255     *                                            ), -
    256     *                                        ) -
    257     *                                    ), -
    258     *                                    'rename' => array( -
    259     *                                        'sex' => array( -
    260     *                                            'name' => 'gender', -
    261     *                                            'definition' => array( -
    262     *                                                'type' => 'text', -
    263     *                                                'length' => 1, -
    264     *                                                'default' => 'M', -
    265     *                                            ), -
    266     *                                        ) -
    267     *                                    ) -
    268     *                                ) -
    269     * -
    270     * @param boolean $check     indicates whether the function should just check if the DBMS driver -
    271     *                           can perform the requested table alterations if the value is true or -
    272     *                           actually perform them otherwise. -
    273     * @return boolean -
    274     */ -
    275    public function alterTableSql($name, array $changes, $check = false) -
    276    { -
    277        if ( ! $name) { -
    278            throw new Doctrine_Export_Exception('no valid table name specified'); -
    279        } -
    280        foreach ($changes as $changeName => $change) { -
    281            switch ($changeName) { -
    282                case 'add': -
    283                case 'remove': -
    284                case 'change': -
    285                case 'rename': -
    286                case 'name': -
    287                    break; -
    288                default: -
    289                    throw new Doctrine_Export_Exception('change type "' . $changeName . '" not yet supported'); -
    290            } -
    291        } -
    292 -
    293        if ($check) { -
    294            return true; -
    295        } -
    296 -
    297        $query = ''; -
    298        if ( ! empty($changes['name'])) { -
    299            $change_name = $this->conn->quoteIdentifier($changes['name']); -
    300            $query .= 'RENAME TO ' . $change_name; -
    301        } -
    302 -
    303        if ( ! empty($changes['add']) && is_array($changes['add'])) { -
    304            foreach ($changes['add'] as $fieldName => $field) { -
    305                if ($query) { -
    306                    $query.= ', '; -
    307                } -
    308                $query.= 'ADD ' . $this->getDeclaration($fieldName, $field); -
    309            } -
    310        } -
    311 -
    312        if ( ! empty($changes['remove']) && is_array($changes['remove'])) { -
    313            foreach ($changes['remove'] as $fieldName => $field) { -
    314                if ($query) { -
    315                    $query .= ', '; -
    316                } -
    317                $fieldName = $this->conn->quoteIdentifier($fieldName); -
    318                $query .= 'DROP ' . $fieldName; -
    319            } -
    320        } -
    321 -
    322        $rename = array(); -
    323        if ( ! empty($changes['rename']) && is_array($changes['rename'])) { -
    324            foreach ($changes['rename'] as $fieldName => $field) { -
    325                $rename[$field['name']] = $fieldName; -
    326            } -
    327        } -
    328 -
    329        if ( ! empty($changes['change']) && is_array($changes['change'])) { -
    330            foreach ($changes['change'] as $fieldName => $field) { -
    331                if ($query) { -
    332                    $query.= ', '; -
    333                } -
    334                if (isset($rename[$fieldName])) { -
    335                    $oldFieldName = $rename[$fieldName]; -
    336                    unset($rename[$fieldName]); -
    337                } else { -
    338                    $oldFieldName = $fieldName; -
    339                } -
    340                $oldFieldName = $this->conn->quoteIdentifier($oldFieldName, true); -
    341                $query .= 'CHANGE ' . $oldFieldName . ' '  -
    342                        . $this->getDeclaration($fieldName, $field['definition']); -
    343            } -
    344        } -
    345 -
    346        if ( ! empty($rename) && is_array($rename)) { -
    347            foreach ($rename as $renameName => $renamedField) { -
    348                if ($query) { -
    349                    $query.= ', '; -
    350                } -
    351                $field = $changes['rename'][$renamedField]; -
    352                $renamedField = $this->conn->quoteIdentifier($renamedField, true); -
    353                $query .= 'CHANGE ' . $renamedField . ' ' -
    354                        . $this->getDeclaration($field['name'], $field['definition']); -
    355            } -
    356        } -
    357 -
    358        if ( ! $query) { -
    359            return false; -
    360        } -
    361 -
    362        $name = $this->conn->quoteIdentifier($name, true); -
    363         -
    364        return 'ALTER TABLE ' . $name . ' ' . $query; -
    365    } -
    366 -
    367    /** -
    368     * create sequence -
    369     * -
    370     * @param string    $sequenceName name of the sequence to be created -
    371     * @param string    $start        start value of the sequence; default is 1 -
    372     * @param array     $options  An associative array of table options: -
    373     *                          array( -
    374     *                              'comment' => 'Foo', -
    375     *                              'charset' => 'utf8', -
    376     *                              'collate' => 'utf8_unicode_ci', -
    377     *                              'type'    => 'innodb', -
    378     *                          ); -
    379     * @return boolean -
    380     */ -
    381    public function createSequence($sequenceName, $start = 1, array $options = array()) -
    382    { -
    383        $sequenceName   = $this->conn->quoteIdentifier($this->conn->getSequenceName($sequenceName), true); -
    384        $seqcolName     = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true); -
    385 -
    386        $optionsStrings = array(); -
    387 -
    388        if (isset($options['comment']) && ! empty($options['comment'])) { -
    389            $optionsStrings['comment'] = 'COMMENT = ' . $this->conn->quote($options['comment'], 'string'); -
    390        } -
    391 -
    392        if (isset($options['charset']) && ! empty($options['charset'])) { -
    393            $optionsStrings['charset'] = 'DEFAULT CHARACTER SET ' . $options['charset']; -
    394 -
    395            if (isset($options['collate'])) { -
    396                $optionsStrings['collate'] .= ' COLLATE ' . $options['collate']; -
    397            } -
    398        } -
    399 -
    400        $type = false; -
    401 -
    402        if (isset($options['type'])) { -
    403            $type = $options['type']; -
    404        } else { -
    405            $type = $this->conn->default_table_type; -
    406        } -
    407        if ($type) { -
    408            $optionsStrings[] = 'ENGINE = ' . $type; -
    409        } -
    410 -
    411 -
    412        try { -
    413            $query  = 'CREATE TABLE ' . $sequenceName -
    414                    . ' (' . $seqcolName . ' INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (' -
    415                    . $seqcolName . '))' -
    416                    . strlen($this->conn->default_table_type) ? ' TYPE = ' -
    417                    . $this->conn->default_table_type : ''; -
    418 -
    419            $res    = $this->conn->exec($query); -
    420        } catch(Doctrine_Connection_Exception $e) { -
    421            throw new Doctrine_Export_Exception('could not create sequence table'); -
    422        } -
    423 -
    424        if ($start == 1) -
    425            return true; -
    426 -
    427        $query  = 'INSERT INTO ' . $sequenceName -
    428                . ' (' . $seqcolName . ') VALUES (' . ($start - 1) . ')'; -
    429 -
    430        $res    = $this->conn->exec($query); -
    431 -
    432        // Handle error -
    433        try { -
    434            $result = $this->conn->exec('DROP TABLE ' . $sequenceName); -
    435        } catch(Doctrine_Connection_Exception $e) { -
    436            throw new Doctrine_Export_Exception('could not drop inconsistent sequence table'); -
    437        } -
    438 -
    439 -
    440    } -
    441 -
    442    /** -
    443     * Get the stucture of a field into an array -
    444     * -
    445     * @author Leoncx -
    446     * @param string    $table         name of the table on which the index is to be created -
    447     * @param string    $name          name of the index to be created -
    448     * @param array     $definition    associative array that defines properties of the index to be created. -
    449     *                                 Currently, only one property named FIELDS is supported. This property -
    450     *                                 is also an associative with the names of the index fields as array -
    451     *                                 indexes. Each entry of this array is set to another type of associative -
    452     *                                 array that specifies properties of the index that are specific to -
    453     *                                 each field. -
    454     * -
    455     *                                 Currently, only the sorting property is supported. It should be used -
    456     *                                 to define the sorting direction of the index. It may be set to either -
    457     *                                 ascending or descending. -
    458     * -
    459     *                                 Not all DBMS support index sorting direction configuration. The DBMS -
    460     *                                 drivers of those that do not support it ignore this property. Use the -
    461     *                                 function supports() to determine whether the DBMS driver can manage indexes. -
    462     * -
    463     *                                 Example -
    464     *                                    array( -
    465     *                                        'fields' => array( -
    466     *                                            'user_name' => array( -
    467     *                                                'sorting' => 'ASC' -
    468     *                                                'length' => 10 -
    469     *                                            ), -
    470     *                                            'last_login' => array() -
    471     *                                        ) -
    472     *                                    ) -
    473     * @throws PDOException -
    474     * @return void -
    475     */ -
    476    public function createIndexSql($table, $name, array $definition) -
    477    { -
    478        $table  = $table; -
    479        $name   = $this->conn->formatter->getIndexName($name); -
    480        $name   = $this->conn->quoteIdentifier($name); -
    481        $type   = ''; -
    482        if (isset($definition['type'])) { -
    483            switch (strtolower($definition['type'])) { -
    484                case 'fulltext': -
    485                case 'unique': -
    486                    $type = strtoupper($definition['type']) . ' '; -
    487                break; -
    488                default: -
    489                    throw new Doctrine_Export_Exception('Unknown index type ' . $definition['type']); -
    490            } -
    491        } -
    492        $query  = 'CREATE ' . $type . 'INDEX ' . $name . ' ON ' . $table; -
    493        $query .= ' (' . $this->getIndexFieldDeclarationList($definition['fields']) . ')'; -
    494 -
    495        return $query; -
    496    } -
    497 -
    498    /**  -
    499     * getDefaultDeclaration -
    500     * Obtain DBMS specific SQL code portion needed to set a default value -
    501     * declaration to be used in statements like CREATE TABLE. -
    502     * -
    503     * @param array $field      field definition array -
    504     * @return string           DBMS specific SQL code portion needed to set a default value -
    505     */ -
    506    public function getDefaultFieldDeclaration($field) -
    507    { -
    508        $default = ''; -
    509        if (isset($field['default']) && ( ! isset($field['length']) || $field['length'] <= 255)) { -
    510            if ($field['default'] === '') { -
    511                $field['default'] = empty($field['notnull']) -
    512                    ? null : $this->valid_default_values[$field['type']]; -
    513 -
    514                if ($field['default'] === '' -
    515                    && ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_EMPTY_TO_NULL) -
    516                ) { -
    517                    $field['default'] = ' '; -
    518                } -
    519            } -
    520     -
    521            $default = ' DEFAULT ' . $this->conn->quote($field['default'], $field['type']); -
    522        } -
    523        return $default; -
    524    } -
    525 -
    526    /** -
    527     * Obtain DBMS specific SQL code portion needed to set an index  -
    528     * declaration to be used in statements like CREATE TABLE. -
    529     * -
    530     * @param string $charset       name of the index -
    531     * @param array $definition     index definition -
    532     * @return string  DBMS specific SQL code portion needed to set an index -
    533     */ -
    534    public function getIndexDeclaration($name, array $definition) -
    535    { -
    536        $name   = $this->conn->formatter->getIndexName($name); -
    537        $type   = ''; -
    538        if (isset($definition['type'])) { -
    539            switch (strtolower($definition['type'])) { -
    540                case 'fulltext': -
    541                case 'unique': -
    542                    $type = strtoupper($definition['type']) . ' '; -
    543                break; -
    544                default: -
    545                    throw new Doctrine_Export_Exception('Unknown index type ' . $definition['type']); -
    546            } -
    547        } -
    548         -
    549        if ( ! isset($definition['fields'])) { -
    550            throw new Doctrine_Export_Exception('No index columns given.'); -
    551        } -
    552        if ( ! is_array($definition['fields'])) { -
    553            $definition['fields'] = array($definition['fields']); -
    554        } -
    555 -
    556        $query = $type . 'INDEX ' . $this->conn->quoteIdentifier($name); -
    557 -
    558        $query .= ' (' . $this->getIndexFieldDeclarationList($definition['fields']) . ')'; -
    559         -
    560        return $query; -
    561    } -
    562 -
    563    /** -
    564     * getIndexFieldDeclarationList -
    565     * Obtain DBMS specific SQL code portion needed to set an index -
    566     * declaration to be used in statements like CREATE TABLE. -
    567     * -
    568     * @return string -
    569     */ -
    570    public function getIndexFieldDeclarationList(array $fields) -
    571    { -
    572        $declFields = array(); -
    573 -
    574        foreach ($fields as $fieldName => $field) { -
    575            $fieldString = $this->conn->quoteIdentifier($fieldName); -
    576 -
    577            if (is_array($field)) { -
    578                if (isset($field['length'])) { -
    579                    $fieldString .= '(' . $field['length'] . ')'; -
    580                } -
    581 -
    582                if (isset($field['sorting'])) { -
    583                    $sort = strtoupper($field['sorting']); -
    584                    switch ($sort) { -
    585                        case 'ASC': -
    586                        case 'DESC': -
    587                            $fieldString .= ' ' . $sort; -
    588                            break; -
    589                        default: -
    590                            throw new Doctrine_Export_Exception('Unknown index sorting option given.'); -
    591                    } -
    592                } -
    593            } else { -
    594                $fieldString = $this->conn->quoteIdentifier($field); -
    595            } -
    596            $declFields[] = $fieldString; -
    597        } -
    598        return implode(', ', $declFields); -
    599    } -
    600 -
    601    /** -
    602     * getAdvancedForeignKeyOptions -
    603     * Return the FOREIGN KEY query section dealing with non-standard options -
    604     * as MATCH, INITIALLY DEFERRED, ON UPDATE, ... -
    605     * -
    606     * @param array $definition -
    607     * @return string -
    608     */ -
    609    public function getAdvancedForeignKeyOptions(array $definition) -
    610    { -
    611        $query = ''; -
    612        if ( ! empty($definition['match'])) { -
    613            $query .= ' MATCH ' . $definition['match']; -
    614        } -
    615        if ( ! empty($definition['onUpdate'])) { -
    616            $query .= ' ON UPDATE ' . $this->getForeignKeyReferentialAction($definition['onUpdate']); -
    617        } -
    618        if ( ! empty($definition['onDelete'])) { -
    619            $query .= ' ON DELETE ' . $this->getForeignKeyReferentialAction($definition['onDelete']); -
    620        } -
    621        return $query; -
    622    } -
    623 -
    624    /** -
    625     * drop existing index -
    626     * -
    627     * @param string    $table          name of table that should be used in method -
    628     * @param string    $name           name of the index to be dropped -
    629     * @return void -
    630     */ -
    631    public function dropIndexSql($table, $name) -
    632    { -
    633        $table  = $this->conn->quoteIdentifier($table, true); -
    634        $name   = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true); -
    635        return 'DROP INDEX ' . $name . ' ON ' . $table; -
    636    } -
    637 -
    638    /** -
    639     * dropTable -
    640     * -
    641     * @param string    $table          name of table that should be dropped from the database -
    642     * @throws PDOException -
    643     * @return void -
    644     */ -
    645    public function dropTableSql($table) -
    646    { -
    647        $table  = $this->conn->quoteIdentifier($table, true); -
    648        return 'DROP TABLE ' . $table; -
    649    } -
    650     -
    651    public function dropForeignKey($table, $name) -
    652    { -
    653        $table = $this->conn->quoteIdentifier($table); -
    654        $name  = $this->conn->quoteIdentifier($name); -
    655        return $this->conn->exec('ALTER TABLE ' . $table . ' DROP FOREIGN KEY ' . $name); -
    656    } -
    657}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Export_Oracle.html b/tests_old/coverage/Doctrine_Export_Oracle.html deleted file mode 100644 index 3afb9d5f1..000000000 --- a/tests_old/coverage/Doctrine_Export_Oracle.html +++ /dev/null @@ -1,1514 +0,0 @@ - - - Coverage for Doctrine_Export_Oracle - - -

    Coverage for Doctrine_Export_Oracle

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Oracle.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Export'); -
    22/** -
    23 * Doctrine_Export_Oracle -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Export -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2963 $ -
    33 */ -
    34class Doctrine_Export_Oracle extends Doctrine_Export -
    35{ -
    36    /** -
    37     * create a new database -
    38     * -
    39     * @param object $db database object that is extended by this class -
    40     * @param string $name name of the database that should be created -
    41     * @return mixed MDB2_OK on success, a MDB2 error on failure -
    42     * @access public -
    43     */ -
    44    public function createDatabase($name) -
    45    { -
    46        if ( ! $this->conn->getAttribute(Doctrine::ATTR_EMULATE_DATABASE)) -
    47            throw new Doctrine_Export_Exception('database creation is only supported if the "emulate_database" attribute is enabled'); -
    48 -
    49        $username   = sprintf($this->conn->getAttribute(Doctrine::ATTR_DB_NAME_FORMAT), $name); -
    50        $password   = $this->conn->dsn['password'] ? $this->conn->dsn['password'] : $name; -
    51 -
    52        $tablespace = $this->conn->getAttribute(Doctrine::ATTR_DB_NAME_FORMAT) -
    53                    ? ' DEFAULT TABLESPACE '.$this->conn->options['default_tablespace'] : ''; -
    54 -
    55        $query  = 'CREATE USER ' . $username . ' IDENTIFIED BY ' . $password . $tablespace; -
    56        $result = $this->conn->exec($query); -
    57 -
    58        try { -
    59            $query = 'GRANT CREATE SESSION, CREATE TABLE, UNLIMITED TABLESPACE, CREATE SEQUENCE, CREATE TRIGGER TO ' . $username; -
    60            $result = $this->conn->exec($query); -
    61        } catch (Exception $e) { -
    62            $query = 'DROP USER '.$username.' CASCADE'; -
    63            $result2 = $this->conn->exec($query); -
    64        } -
    65        return true; -
    66    } -
    67 -
    68    /** -
    69     * drop an existing database -
    70     * -
    71     * @param object $this->conn database object that is extended by this class -
    72     * @param string $name name of the database that should be dropped -
    73     * @return mixed MDB2_OK on success, a MDB2 error on failure -
    74     * @access public -
    75     */ -
    76    public function dropDatabase($name) -
    77    { -
    78        if ( ! $this->conn->getAttribute(Doctrine::ATTR_EMULATE_DATABASE)) -
    79            throw new Doctrine_Export_Exception('database dropping is only supported if the -
    80                                                       "emulate_database" option is enabled'); -
    81 -
    82        $username = sprintf($this->conn->getAttribute(Doctrine::ATTR_DB_NAME_FORMAT), $name); -
    83 -
    84        return $this->conn->exec('DROP USER ' . $username . ' CASCADE'); -
    85    } -
    86 -
    87    /** -
    88     * add an autoincrement sequence + trigger -
    89     * -
    90     * @param string $name  name of the PK field -
    91     * @param string $table name of the table -
    92     * @param string $start start value for the sequence -
    93     * @return mixed        MDB2_OK on success, a MDB2 error on failure -
    94     * @access private -
    95     */ -
    96    public function _makeAutoincrement($name, $table, $start = 1) -
    97    { -
    98        $sql   = array(); -
    99        $table = strtoupper($table); -
    100        $indexName  = $table . '_AI_PK'; -
    101        $definition = array( -
    102            'primary' => true, -
    103            'fields' => array($name => true), -
    104        ); -
    105 -
    106        $sql[] = $this->createConstraintSql($table, $indexName, $definition); -
    107 -
    108        if (is_null($start)) { -
    109            $query = 'SELECT MAX(' . $this->conn->quoteIdentifier($name, true) . ') FROM ' . $this->conn->quoteIdentifier($table, true); -
    110            $start = $this->conn->fetchOne($query); -
    111 -
    112            ++$start; -
    113        } -
    114 -
    115        $sql[] = $this->createSequenceSql($table, $start); -
    116 -
    117        $sequenceName = $this->conn->formatter->getSequenceName($table); -
    118        $triggerName  = $this->conn->quoteIdentifier($table . '_AI_PK', true); -
    119        $table = $this->conn->quoteIdentifier($table, true); -
    120        $name  = $this->conn->quoteIdentifier($name, true); -
    121        $sql[] = 'CREATE TRIGGER ' . $triggerName . ' -
    122   BEFORE INSERT -
    123   ON '.$table.' -
    124   FOR EACH ROW -
    125DECLARE -
    126   last_Sequence NUMBER; -
    127   last_InsertID NUMBER; -
    128BEGIN -
    129   SELECT '.$sequenceName.'.NEXTVAL INTO :NEW.'.$name.' FROM DUAL; -
    130   IF (:NEW.'.$name.' IS NULL OR :NEW.'.$name.' = 0) THEN -
    131      SELECT '.$sequenceName.'.NEXTVAL INTO :NEW.'.$name.' FROM DUAL; -
    132   ELSE -
    133      SELECT NVL(Last_Number, 0) INTO last_Sequence -
    134        FROM User_Sequences -
    135       WHERE UPPER(Sequence_Name) = UPPER(\''.$sequenceName.'\'); -
    136      SELECT :NEW.id INTO last_InsertID FROM DUAL; -
    137      WHILE (last_InsertID > last_Sequence) LOOP -
    138         SELECT ' . $sequenceName . '.NEXTVAL INTO last_Sequence FROM DUAL; -
    139      END LOOP; -
    140   END IF; -
    141END; -
    142'; -
    143        return $sql; -
    144    } -
    145 -
    146    /** -
    147     * drop an existing autoincrement sequence + trigger -
    148     * -
    149     * @param string $table name of the table -
    150     * @return void -
    151     */ -
    152    public function dropAutoincrement($table) -
    153    { -
    154        $table = strtoupper($table); -
    155        $triggerName = $table . '_AI_PK'; -
    156        $trigger_name_quoted = $this->conn->quote($triggerName); -
    157        $query = 'SELECT trigger_name FROM user_triggers'; -
    158        $query.= ' WHERE trigger_name='.$trigger_name_quoted.' OR trigger_name='.strtoupper($trigger_name_quoted); -
    159        $trigger = $this->conn->fetchOne($query); -
    160 -
    161        if ($trigger) { -
    162            $trigger_name  = $this->conn->quoteIdentifier($table . '_AI_PK', true); -
    163            $trigger_sql = 'DROP TRIGGER ' . $trigger_name; -
    164 -
    165            // if throws exception, trigger for autoincrement PK could not be dropped -
    166            $this->conn->exec($trigger_sql); -
    167 -
    168            // if throws exception, sequence for autoincrement PK could not be dropped -
    169            $this->dropSequence($table); -
    170 -
    171            $indexName = $table . '_AI_PK'; -
    172 -
    173            // if throws exception, primary key for autoincrement PK could not be dropped -
    174            $this->dropConstraint($table, $indexName); -
    175        } -
    176    } -
    177   /** -
    178     * A method to return the required SQL string that fits between CREATE ... TABLE -
    179     * to create the table as a temporary table. -
    180     * -
    181     * @return string The string required to be placed between "CREATE" and "TABLE" -
    182     *                to generate a temporary table, if possible. -
    183     */ -
    184    public function getTemporaryTableQuery() -
    185    { -
    186        return 'GLOBAL TEMPORARY'; -
    187    } -
    188 -
    189    /** -
    190     * getAdvancedForeignKeyOptions -
    191     * Return the FOREIGN KEY query section dealing with non-standard options -
    192     * as MATCH, INITIALLY DEFERRED, ON UPDATE, ... -
    193     * -
    194     * @param array $definition         foreign key definition -
    195     * @return string -
    196     * @access protected -
    197     */ -
    198    public function getAdvancedForeignKeyOptions(array $definition) -
    199    { -
    200        $query = ''; -
    201        if (isset($definition['onDelete'])) { -
    202            $query .= ' ON DELETE ' . $definition['onDelete']; -
    203        } -
    204        if (isset($definition['deferrable'])) { -
    205            $query .= ' DEFERRABLE'; -
    206        } else { -
    207            $query .= ' NOT DEFERRABLE'; -
    208        } -
    209        if (isset($definition['feferred'])) { -
    210            $query .= ' INITIALLY DEFERRED'; -
    211        } else { -
    212            $query .= ' INITIALLY IMMEDIATE'; -
    213        } -
    214        return $query; -
    215    } -
    216 -
    217    /** -
    218     * create a new table -
    219     * -
    220     * @param string $name     Name of the database that should be created -
    221     * @param array $fields Associative array that contains the definition of each field of the new table -
    222     *                        The indexes of the array entries are the names of the fields of the table an -
    223     *                        the array entry values are associative arrays like those that are meant to be -
    224     *                         passed with the field definitions to get[Type]Declaration() functions. -
    225     * -
    226     *                        Example -
    227     *                        array( -
    228     * -
    229     *                            'id' => array( -
    230     *                                'type' => 'integer', -
    231     *                                'unsigned' => 1 -
    232     *                                'notnull' => 1 -
    233     *                                'default' => 0 -
    234     *                            ), -
    235     *                            'name' => array( -
    236     *                                'type' => 'text', -
    237     *                                'length' => 12 -
    238     *                            ), -
    239     *                            'password' => array( -
    240     *                                'type' => 'text', -
    241     *                                'length' => 12 -
    242     *                            ) -
    243     *                        ); -
    244     * @param array $options  An associative array of table options: -
    245     * -
    246     * @return void -
    247     */ -
    248    public function createTable($name, array $fields, array $options = array()) -
    249    { -
    250        $this->conn->beginTransaction(); -
    251 -
    252        foreach ($this->createTableSql($name, $fields, $options) as $sql) { -
    253            $this->conn->exec($sql); -
    254        } -
    255 -
    256        $this->conn->commit(); -
    257    } -
    258 -
    259    /** -
    260     * create a new table -
    261     * -
    262     * @param string $name     Name of the database that should be created -
    263     * @param array $fields Associative array that contains the definition of each field of the new table -
    264     *                        The indexes of the array entries are the names of the fields of the table an -
    265     *                        the array entry values are associative arrays like those that are meant to be -
    266     *                         passed with the field definitions to get[Type]Declaration() functions. -
    267     * -
    268     *                        Example -
    269     *                        array( -
    270     * -
    271     *                            'id' => array( -
    272     *                                'type' => 'integer', -
    273     *                                'unsigned' => 1 -
    274     *                                'notnull' => 1 -
    275     *                                'default' => 0 -
    276     *                            ), -
    277     *                            'name' => array( -
    278     *                                'type' => 'text', -
    279     *                                'length' => 12 -
    280     *                            ), -
    281     *                            'password' => array( -
    282     *                                'type' => 'text', -
    283     *                                'length' => 12 -
    284     *                            ) -
    285     *                        ); -
    286     * @param array $options  An associative array of table options: -
    287     * -
    288     * @return void -
    289     */ -
    290    public function createTableSql($name, array $fields, array $options = array()) -
    291    { -
    292        $sql = parent::createTableSql($name, $fields, $options); -
    293 -
    294        foreach ($fields as $fieldName => $field) { -
    295            if (isset($field['autoincrement']) && $field['autoincrement'] || -
    296               (isset($field['autoinc']) && $fields['autoinc'])) {            -
    297                $sql = array_merge($sql, $this->_makeAutoincrement($fieldName, $name)); -
    298            } -
    299        } -
    300 -
    301        return $sql; -
    302    } -
    303 -
    304    /** -
    305     * drop an existing table -
    306     * -
    307     * @param string $name name of the table that should be dropped -
    308     * @return void -
    309     */ -
    310    public function dropTable($name) -
    311    { -
    312        //$this->conn->beginNestedTransaction(); -
    313        $result = $this->dropAutoincrement($name); -
    314        $result = parent::dropTable($name); -
    315        //$this->conn->completeNestedTransaction(); -
    316        return $result; -
    317    } -
    318 -
    319    /** -
    320     * alter an existing table -
    321     * -
    322     * @param string $name         name of the table that is intended to be changed. -
    323     * @param array $changes     associative array that contains the details of each type -
    324     *                             of change that is intended to be performed. The types of -
    325     *                             changes that are currently supported are defined as follows: -
    326     * -
    327     *                             name -
    328     * -
    329     *                                New name for the table. -
    330     * -
    331     *                            add -
    332     * -
    333     *                                Associative array with the names of fields to be added as -
    334     *                                 indexes of the array. The value of each entry of the array -
    335     *                                 should be set to another associative array with the properties -
    336     *                                 of the fields to be added. The properties of the fields should -
    337     *                                 be the same as defined by the MDB2 parser. -
    338     * -
    339     * -
    340     *                            remove -
    341     * -
    342     *                                Associative array with the names of fields to be removed as indexes -
    343     *                                 of the array. Currently the values assigned to each entry are ignored. -
    344     *                                 An empty array should be used for future compatibility. -
    345     * -
    346     *                            rename -
    347     * -
    348     *                                Associative array with the names of fields to be renamed as indexes -
    349     *                                 of the array. The value of each entry of the array should be set to -
    350     *                                 another associative array with the entry named name with the new -
    351     *                                 field name and the entry named Declaration that is expected to contain -
    352     *                                 the portion of the field declaration already in DBMS specific SQL code -
    353     *                                 as it is used in the CREATE TABLE statement. -
    354     * -
    355     *                            change -
    356     * -
    357     *                                Associative array with the names of the fields to be changed as indexes -
    358     *                                 of the array. Keep in mind that if it is intended to change either the -
    359     *                                 name of a field and any other properties, the change array entries -
    360     *                                 should have the new names of the fields as array indexes. -
    361     * -
    362     *                                The value of each entry of the array should be set to another associative -
    363     *                                 array with the properties of the fields to that are meant to be changed as -
    364     *                                 array entries. These entries should be assigned to the new values of the -
    365     *                                 respective properties. The properties of the fields should be the same -
    366     *                                 as defined by the MDB2 parser. -
    367     * -
    368     *                            Example -
    369     *                                array( -
    370     *                                    'name' => 'userlist', -
    371     *                                    'add' => array( -
    372     *                                        'quota' => array( -
    373     *                                            'type' => 'integer', -
    374     *                                            'unsigned' => 1 -
    375     *                                        ) -
    376     *                                    ), -
    377     *                                    'remove' => array( -
    378     *                                        'file_limit' => array(), -
    379     *                                        'time_limit' => array() -
    380     *                                    ), -
    381     *                                    'change' => array( -
    382     *                                        'name' => array( -
    383     *                                            'length' => '20', -
    384     *                                            'definition' => array( -
    385     *                                                'type' => 'text', -
    386     *                                                'length' => 20, -
    387     *                                            ), -
    388     *                                        ) -
    389     *                                    ), -
    390     *                                    'rename' => array( -
    391     *                                        'sex' => array( -
    392     *                                            'name' => 'gender', -
    393     *                                            'definition' => array( -
    394     *                                                'type' => 'text', -
    395     *                                                'length' => 1, -
    396     *                                                'default' => 'M', -
    397     *                                            ), -
    398     *                                        ) -
    399     *                                    ) -
    400     *                                ) -
    401     * -
    402     * @param boolean $check     indicates whether the function should just check if the DBMS driver -
    403     *                             can perform the requested table alterations if the value is true or -
    404     *                             actually perform them otherwise. -
    405     * @return void -
    406     */ -
    407    public function alterTable($name, array $changes, $check = false) -
    408    { -
    409 -
    410        foreach ($changes as $changeName => $change) { -
    411            switch ($changeName) { -
    412                case 'add': -
    413                case 'remove': -
    414                case 'change': -
    415                case 'name': -
    416                case 'rename': -
    417                    break; -
    418                default: -
    419                    throw new Doctrine_Export_Exception('change type "' . $changeName . '" not yet supported'); -
    420            } -
    421        } -
    422 -
    423        if ($check) { -
    424            return false; -
    425        } -
    426 -
    427        $name = $this->conn->quoteIdentifier($name, true); -
    428 -
    429        if ( ! empty($changes['add']) && is_array($changes['add'])) { -
    430            $fields = array(); -
    431            foreach ($changes['add'] as $fieldName => $field) { -
    432                $fields[] = $this->conn->getDeclaration($fieldName, $field); -
    433            } -
    434            $result = $this->conn->exec('ALTER TABLE ' . $name . ' ADD (' . implode(', ', $fields) . ')'); -
    435        } -
    436 -
    437        if ( ! empty($changes['change']) && is_array($changes['change'])) { -
    438            $fields = array(); -
    439            foreach ($changes['change'] as $fieldName => $field) { -
    440                $fields[] = $fieldName. ' ' . $this->conn->getDeclaration('', $field['definition']); -
    441            } -
    442            $result = $this->conn->exec('ALTER TABLE ' . $name . ' MODIFY (' . implode(', ', $fields) . ')'); -
    443        } -
    444 -
    445        if ( ! empty($changes['rename']) && is_array($changes['rename'])) { -
    446            foreach ($changes['rename'] as $fieldName => $field) { -
    447                $query = 'ALTER TABLE ' . $name . ' RENAME COLUMN ' . $this->conn->quoteIdentifier($fieldName, true) -
    448                       . ' TO ' . $this->conn->quoteIdentifier($field['name']); -
    449 -
    450                $result = $this->conn->exec($query); -
    451            } -
    452        } -
    453 -
    454        if ( ! empty($changes['remove']) && is_array($changes['remove'])) { -
    455            $fields = array(); -
    456            foreach ($changes['remove'] as $fieldName => $field) { -
    457                $fields[] = $this->conn->quoteIdentifier($fieldName, true); -
    458            } -
    459            $result = $this->conn->exec('ALTER TABLE ' . $name . ' DROP COLUMN ' . implode(', ', $fields)); -
    460        } -
    461 -
    462        if ( ! empty($changes['name'])) { -
    463            $changeName = $this->conn->quoteIdentifier($changes['name'], true); -
    464            $result = $this->conn->exec('ALTER TABLE ' . $name . ' RENAME TO ' . $changeName); -
    465        } -
    466    } -
    467 -
    468    /** -
    469     * create sequence -
    470     * -
    471     * @param string $seqName name of the sequence to be created -
    472     * @param string $start start value of the sequence; default is 1 -
    473     * @param array     $options  An associative array of table options: -
    474     *                          array( -
    475     *                              'comment' => 'Foo', -
    476     *                              'charset' => 'utf8', -
    477     *                              'collate' => 'utf8_unicode_ci', -
    478     *                          ); -
    479     * @return string -
    480     */ -
    481    public function createSequenceSql($seqName, $start = 1, array $options = array()) -
    482    { -
    483        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    484        $query  = 'CREATE SEQUENCE ' . $sequenceName . ' START WITH ' . $start . ' INCREMENT BY 1 NOCACHE'; -
    485        $query .= ($start < 1 ? ' MINVALUE ' . $start : ''); -
    486        return $query; -
    487    } -
    488 -
    489    /** -
    490     * drop existing sequence -
    491     * -
    492     * @param object $this->conn database object that is extended by this class -
    493     * @param string $seqName name of the sequence to be dropped -
    494     * @return string -
    495     */ -
    496    public function dropSequenceSql($seqName) -
    497    { -
    498        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    499        return 'DROP SEQUENCE ' . $sequenceName; -
    500    } -
    501}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Export_Pgsql.html b/tests_old/coverage/Doctrine_Export_Pgsql.html deleted file mode 100644 index 77915a4d9..000000000 --- a/tests_old/coverage/Doctrine_Export_Pgsql.html +++ /dev/null @@ -1,1100 +0,0 @@ - - - Coverage for Doctrine_Export_Pgsql - - -

    Coverage for Doctrine_Export_Pgsql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Pgsql.php 2966 2007-10-21 08:39:13Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Export'); -
    22/** -
    23 * Doctrine_Export_Pgsql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Export -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2966 $ -
    33 */ -
    34class Doctrine_Export_Pgsql extends Doctrine_Export -
    35{ -
    36   /** -
    37     * create a new database -
    38     * -
    39     * @param string $name name of the database that should be created -
    40     * @throws PDOException -
    41     * @return void -
    42     */ -
    43    public function createDatabaseSql($name) -
    44    { -
    45        $query  = 'CREATE DATABASE ' . $this->conn->quoteIdentifier($name); -
    46         -
    47        return $query; -
    48    } -
    49 -
    50    /** -
    51     * drop an existing database -
    52     * -
    53     * @param string $name name of the database that should be dropped -
    54     * @throws PDOException -
    55     * @access public -
    56     */ -
    57    public function dropDatabaseSql($name) -
    58    { -
    59        $query  = 'DROP DATABASE ' . $this->conn->quoteIdentifier($name); -
    60         -
    61        return $query; -
    62    } -
    63 -
    64    /** -
    65     * getAdvancedForeignKeyOptions -
    66     * Return the FOREIGN KEY query section dealing with non-standard options -
    67     * as MATCH, INITIALLY DEFERRED, ON UPDATE, ... -
    68     * -
    69     * @param array $definition         foreign key definition -
    70     * @return string -
    71     * @access protected -
    72     */ -
    73    public function getAdvancedForeignKeyOptions(array $definition) -
    74    { -
    75        $query = ''; -
    76        if (isset($definition['match'])) { -
    77            $query .= ' MATCH ' . $definition['match']; -
    78        } -
    79        if (isset($definition['onUpdate'])) { -
    80            $query .= ' ON UPDATE ' . $definition['onUpdate']; -
    81        } -
    82        if (isset($definition['onDelete'])) { -
    83            $query .= ' ON DELETE ' . $definition['onDelete']; -
    84        } -
    85        if (isset($definition['deferrable'])) { -
    86            $query .= ' DEFERRABLE'; -
    87        } else { -
    88            $query .= ' NOT DEFERRABLE'; -
    89        } -
    90        if (isset($definition['feferred'])) { -
    91            $query .= ' INITIALLY DEFERRED'; -
    92        } else { -
    93            $query .= ' INITIALLY IMMEDIATE'; -
    94        } -
    95        return $query; -
    96    } -
    97 -
    98    /** -
    99     * generates the sql for altering an existing table on postgresql -
    100     * -
    101     * @param string $name          name of the table that is intended to be changed. -
    102     * @param array $changes        associative array that contains the details of each type      * -
    103     * @param boolean $check        indicates whether the function should just check if the DBMS driver -
    104     *                              can perform the requested table alterations if the value is true or -
    105     *                              actually perform them otherwise. -
    106     * @see Doctrine_Export::alterTable() -
    107     * @return array -
    108     */ -
    109    public function alterTableSql($name, array $changes, $check = false) -
    110    { -
    111        foreach ($changes as $changeName => $change) { -
    112            switch ($changeName) { -
    113                case 'add': -
    114                case 'remove': -
    115                case 'change': -
    116                case 'name': -
    117                case 'rename': -
    118                    break; -
    119                default: -
    120                    throw new Doctrine_Export_Exception('change type "' . $changeName . '\" not yet supported'); -
    121            } -
    122        } -
    123 -
    124        if ($check) { -
    125            return true; -
    126        } -
    127         -
    128        $sql = array(); -
    129 -
    130        if (isset($changes['add']) && is_array($changes['add'])) { -
    131            foreach ($changes['add'] as $fieldName => $field) { -
    132                $query = 'ADD ' . $this->getDeclaration($fieldName, $field); -
    133                $sql[] = 'ALTER TABLE ' . $name . ' ' . $query; -
    134            } -
    135        } -
    136 -
    137        if (isset($changes['remove']) && is_array($changes['remove'])) { -
    138            foreach ($changes['remove'] as $fieldName => $field) { -
    139                $fieldName = $this->conn->quoteIdentifier($fieldName, true); -
    140                $query = 'DROP ' . $fieldName; -
    141                $sql[] = 'ALTER TABLE ' . $name . ' ' . $query; -
    142            } -
    143        } -
    144 -
    145        if (isset($changes['change']) && is_array($changes['change'])) { -
    146            foreach ($changes['change'] as $fieldName => $field) { -
    147                $fieldName = $this->conn->quoteIdentifier($fieldName, true); -
    148                if (isset($field['type'])) { -
    149                    $serverInfo = $this->conn->getServerVersion(); -
    150 -
    151                    if (is_array($serverInfo) && $serverInfo['major'] < 8) { -
    152                        throw new Doctrine_Export_Exception('changing column type for "'.$field['type'].'\" requires PostgreSQL 8.0 or above'); -
    153                    } -
    154                    $query = 'ALTER ' . $fieldName . ' TYPE ' . $this->conn->datatype->getTypeDeclaration($field['definition']); -
    155                    $sql[] = 'ALTER TABLE ' . $name . ' ' . $query; -
    156                } -
    157                if (array_key_exists('default', $field)) { -
    158                    $query = 'ALTER ' . $fieldName . ' SET DEFAULT ' . $this->conn->quote($field['definition']['default'], $field['definition']['type']); -
    159                    $sql[] = 'ALTER TABLE ' . $name . ' ' . $query; -
    160                } -
    161                if ( ! empty($field['notnull'])) { -
    162                    $query = 'ALTER ' . $fieldName . ' ' . ($field['definition']['notnull'] ? 'SET' : 'DROP') . ' NOT NULL'; -
    163                    $sql[] = 'ALTER TABLE ' . $name . ' ' . $query; -
    164                } -
    165            } -
    166        } -
    167 -
    168        if (isset($changes['rename']) && is_array($changes['rename'])) { -
    169            foreach ($changes['rename'] as $fieldName => $field) { -
    170                $fieldName = $this->conn->quoteIdentifier($fieldName, true); -
    171                $sql[] = 'ALTER TABLE ' . $name . ' RENAME COLUMN ' . $fieldName . ' TO ' . $this->conn->quoteIdentifier($field['name'], true); -
    172            } -
    173        } -
    174 -
    175        $name = $this->conn->quoteIdentifier($name, true); -
    176        if (isset($changes['name'])) { -
    177            $changeName = $this->conn->quoteIdentifier($changes['name'], true); -
    178            $sql[] = 'ALTER TABLE ' . $name . ' RENAME TO ' . $changeName; -
    179        } -
    180         -
    181        return $sql; -
    182    } -
    183     -
    184    /** -
    185     * alter an existing table -
    186     * -
    187     * @param string $name         name of the table that is intended to be changed. -
    188     * @param array $changes     associative array that contains the details of each type -
    189     *                             of change that is intended to be performed. The types of -
    190     *                             changes that are currently supported are defined as follows: -
    191     * -
    192     *                             name -
    193     * -
    194     *                                New name for the table. -
    195     * -
    196     *                            add -
    197     * -
    198     *                                Associative array with the names of fields to be added as -
    199     *                                 indexes of the array. The value of each entry of the array -
    200     *                                 should be set to another associative array with the properties -
    201     *                                 of the fields to be added. The properties of the fields should -
    202     *                                 be the same as defined by the Metabase parser. -
    203     * -
    204     * -
    205     *                            remove -
    206     * -
    207     *                                Associative array with the names of fields to be removed as indexes -
    208     *                                 of the array. Currently the values assigned to each entry are ignored. -
    209     *                                 An empty array should be used for future compatibility. -
    210     * -
    211     *                            rename -
    212     * -
    213     *                                Associative array with the names of fields to be renamed as indexes -
    214     *                                 of the array. The value of each entry of the array should be set to -
    215     *                                 another associative array with the entry named name with the new -
    216     *                                 field name and the entry named Declaration that is expected to contain -
    217     *                                 the portion of the field declaration already in DBMS specific SQL code -
    218     *                                 as it is used in the CREATE TABLE statement. -
    219     * -
    220     *                            change -
    221     * -
    222     *                                Associative array with the names of the fields to be changed as indexes -
    223     *                                 of the array. Keep in mind that if it is intended to change either the -
    224     *                                 name of a field and any other properties, the change array entries -
    225     *                                 should have the new names of the fields as array indexes. -
    226     * -
    227     *                                The value of each entry of the array should be set to another associative -
    228     *                                 array with the properties of the fields to that are meant to be changed as -
    229     *                                 array entries. These entries should be assigned to the new values of the -
    230     *                                 respective properties. The properties of the fields should be the same -
    231     *                                 as defined by the Metabase parser. -
    232     * -
    233     *                            Example -
    234     *                                array( -
    235     *                                    'name' => 'userlist', -
    236     *                                    'add' => array( -
    237     *                                        'quota' => array( -
    238     *                                            'type' => 'integer', -
    239     *                                            'unsigned' => 1 -
    240     *                                        ) -
    241     *                                    ), -
    242     *                                    'remove' => array( -
    243     *                                        'file_limit' => array(), -
    244     *                                        'time_limit' => array() -
    245     *                                    ), -
    246     *                                    'change' => array( -
    247     *                                        'name' => array( -
    248     *                                            'length' => '20', -
    249     *                                            'definition' => array( -
    250     *                                                'type' => 'text', -
    251     *                                                'length' => 20, -
    252     *                                            ), -
    253     *                                        ) -
    254     *                                    ), -
    255     *                                    'rename' => array( -
    256     *                                        'sex' => array( -
    257     *                                            'name' => 'gender', -
    258     *                                            'definition' => array( -
    259     *                                                'type' => 'text', -
    260     *                                                'length' => 1, -
    261     *                                                'default' => 'M', -
    262     *                                            ), -
    263     *                                        ) -
    264     *                                    ) -
    265     *                                ) -
    266     * -
    267     * @param boolean $check     indicates whether the function should just check if the DBMS driver -
    268     *                             can perform the requested table alterations if the value is true or -
    269     *                             actually perform them otherwise. -
    270     * @throws Doctrine_Connection_Exception -
    271     * @return boolean -
    272     */ -
    273    public function alterTable($name, array $changes, $check = false) -
    274    { -
    275        $sql = $this->alterTableSql($name, $changes, $check); -
    276        foreach ($sql as $query) { -
    277            $this->conn->exec($query); -
    278        } -
    279        return true;     -
    280    } -
    281 -
    282    /** -
    283     * return RDBMS specific create sequence statement -
    284     * -
    285     * @throws Doctrine_Connection_Exception     if something fails at database level -
    286     * @param string    $seqName        name of the sequence to be created -
    287     * @param string    $start          start value of the sequence; default is 1 -
    288     * @param array     $options  An associative array of table options: -
    289     *                          array( -
    290     *                              'comment' => 'Foo', -
    291     *                              'charset' => 'utf8', -
    292     *                              'collate' => 'utf8_unicode_ci', -
    293     *                          ); -
    294     * @return string -
    295     */ -
    296    public function createSequenceSql($sequenceName, $start = 1, array $options = array()) -
    297    { -
    298        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($sequenceName), true); -
    299        return $this->conn->exec('CREATE SEQUENCE ' . $sequenceName . ' INCREMENT 1' . -
    300                    ($start < 1 ? ' MINVALUE ' . $start : '') . ' START ' . $start); -
    301    } -
    302 -
    303    /** -
    304     * drop existing sequence -
    305     * -
    306     * @param string $sequenceName name of the sequence to be dropped -
    307     */ -
    308    public function dropSequenceSql($sequenceName) -
    309    { -
    310        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($sequenceName), true); -
    311        return 'DROP SEQUENCE ' . $sequenceName; -
    312    } -
    313 -
    314    /** -
    315     * Creates a table. -
    316     * -
    317     * @param unknown_type $name -
    318     * @param array $fields -
    319     * @param array $options -
    320     * @return unknown -
    321     */ -
    322    public function createTableSql($name, array $fields, array $options = array()) -
    323    { -
    324        if ( ! $name) { -
    325            throw new Doctrine_Export_Exception('no valid table name specified'); -
    326        } -
    327         -
    328        if (empty($fields)) { -
    329            throw new Doctrine_Export_Exception('no fields specified for table ' . $name); -
    330        } -
    331 -
    332        $queryFields = $this->getFieldDeclarationList($fields); -
    333 -
    334 -
    335        if (isset($options['primary']) && ! empty($options['primary'])) { -
    336            $keyColumns = array_values($options['primary']); -
    337            $keyColumns = array_map(array($this->conn, 'quoteIdentifier'), $keyColumns); -
    338            $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; -
    339        } -
    340 -
    341        $query = 'CREATE TABLE ' . $this->conn->quoteIdentifier($name, true) . ' (' . $queryFields . ')'; -
    342 -
    343        $sql[] = $query; -
    344 -
    345        if (isset($options['indexes']) && ! empty($options['indexes'])) { -
    346            foreach($options['indexes'] as $index => $definition) { -
    347                $sql[] = $this->createIndexSql($name, $index, $definition); -
    348            } -
    349        } -
    350         -
    351        if (isset($options['foreignKeys'])) { -
    352 -
    353            foreach ((array) $options['foreignKeys'] as $k => $definition) { -
    354                if (is_array($definition)) { -
    355                    $sql[] = $this->createForeignKeySql($name, $definition); -
    356                } -
    357            } -
    358        } -
    359         -
    360        return $sql; -
    361    } -
    362 -
    363}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Export_Schema.html b/tests_old/coverage/Doctrine_Export_Schema.html deleted file mode 100644 index 1251ae7f7..000000000 --- a/tests_old/coverage/Doctrine_Export_Schema.html +++ /dev/null @@ -1,404 +0,0 @@ - - - Coverage for Doctrine_Export_Schema - - -

    Coverage for Doctrine_Export_Schema

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 * $Id: Schema.php 1838 2007-06-26 00:58:21Z nicobn $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Export_Schema -
    24 *  -
    25 * Used for exporting a schema to a yaml file -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Export -
    29 * @link        www.phpdoctrine.org -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @version     $Revision: 1838 $ -
    32 * @author      Nicolas Bérard-Nault <nicobn@gmail.com> -
    33 * @author      Jonathan H. Wage <jwage@mac.com> -
    34 */ -
    35class Doctrine_Export_Schema -
    36{     -
    37    /** -
    38     * buildSchema -
    39     *  -
    40     * Build schema array that can be dumped to file -
    41     * -
    42     * @param string $directory  -
    43     * @return void -
    44     */ -
    45    public function buildSchema($directory = null, $models = array()) -
    46    { -
    47        if ($directory) { -
    48            $loadedModels = Doctrine::loadModels($directory); -
    49        } else { -
    50            $loadedModels = Doctrine::getLoadedModels(); -
    51        } -
    52 -
    53        $array = array(); -
    54         -
    55        $parent = new ReflectionClass('Doctrine_Record'); -
    56 -
    57        $sql = array(); -
    58        $fks = array(); -
    59 -
    60        // we iterate trhough the diff of previously declared classes -
    61        // and currently declared classes -
    62        foreach ($loadedModels as $className) { -
    63            if ( ! empty($models) && !in_array($className, $models)) { -
    64                continue; -
    65            } -
    66 -
    67            $record = new $className(); -
    68            $recordTable  = $record->getTable(); -
    69             -
    70            $data = $recordTable->getExportableFormat(); -
    71             -
    72            $table = array(); -
    73             -
    74            foreach ($data['columns'] AS $name => $column) { -
    75                $data['columns'][$name]['type'] = $column['type'] . '(' . $column['length'] . ')'; -
    76                unset($data['columns'][$name]['length']); -
    77            } -
    78             -
    79            $table['columns'] = $data['columns']; -
    80             -
    81            $relations = $recordTable->getRelations(); -
    82            foreach ($relations as $key => $relation) { -
    83                $relationData = $relation->toArray(); -
    84                 -
    85                $relationKey = $relationData['alias']; -
    86                 -
    87                if (isset($relationData['refTable']) && $relationData['refTable']) { -
    88                    $table['relations'][$relationKey]['refClass'] = $relationData['refTable']->getComponentName(); -
    89                } -
    90                 -
    91                if (isset($relationData['class']) && $relationData['class'] && $relation['class'] != $relationKey) { -
    92                    $table['relations'][$relationKey]['class'] = $relationData['class']; -
    93                } -
    94  -
    95                $table['relations'][$relationKey]['local'] = $relationData['local']; -
    96                $table['relations'][$relationKey]['foreign'] = $relationData['foreign']; -
    97                 -
    98                if ($relationData['type'] === Doctrine_Relation::ONE) { -
    99                    $table['relations'][$relationKey]['type'] = 'one'; -
    100                } else if($relationData['type'] === Doctrine_Relation::MANY) { -
    101                    $table['relations'][$relationKey]['type'] = 'many'; -
    102                } else { -
    103                    $table['relations'][$relationKey]['type'] = 'one'; -
    104                } -
    105            } -
    106             -
    107            $array[$className] = $table; -
    108        } -
    109         -
    110        return $array; -
    111    } -
    112 -
    113    /** -
    114     * exportSchema -
    115     * -
    116     * @param  string $schema  -
    117     * @param  string $directory  -
    118     * @return string $string of data in the specified format -
    119     * @return void -
    120     */ -
    121    public function exportSchema($schema, $format = 'yml', $directory = null, $models = array()) -
    122    { -
    123        $array = $this->buildSchema($directory, $models); -
    124         -
    125        if (is_dir($schema)) { -
    126          $schema = $schema . DIRECTORY_SEPARATOR . 'schema.' . $format; -
    127        } -
    128         -
    129        return Doctrine_Parser::dump($array, $format, $schema); -
    130    } -
    131}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Export_Sqlite.html b/tests_old/coverage/Doctrine_Export_Sqlite.html deleted file mode 100644 index b28f15d2b..000000000 --- a/tests_old/coverage/Doctrine_Export_Sqlite.html +++ /dev/null @@ -1,1260 +0,0 @@ - - - Coverage for Doctrine_Export_Sqlite - - -

    Coverage for Doctrine_Export_Sqlite

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Sqlite.php 3048 2007-11-01 19:45:36Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Export'); -
    22/** -
    23 * Doctrine_Export_Sqlite -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Export -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3048 $ -
    33 */ -
    34class Doctrine_Export_Sqlite extends Doctrine_Export -
    35{ -
    36    /** -
    37     * drop an existing database -
    38     * -
    39     * @param string $name                  name of the database that should be dropped -
    40     * @throws Doctrine_Export_Exception    if the database file does not exist -
    41     * @throws Doctrine_Export_Exception    if something failed during the removal of the database file -
    42     * @return void -
    43     */ -
    44    public function dropDatabase($name) -
    45    { -
    46        $databaseFile = $this->conn->getDatabaseFile($name); -
    47        if ( ! @file_exists($databaseFile)) { -
    48            throw new Doctrine_Export_Exception('database does not exist'); -
    49        } -
    50        $result = @unlink($databaseFile); -
    51        if ( ! $result) { -
    52            throw new Doctrine_Export_Exception('could not remove the database file'); -
    53        } -
    54    } -
    55 -
    56    /** -
    57     * Get the stucture of a field into an array -
    58     * -
    59     * @param string    $table         name of the table on which the index is to be created -
    60     * @param string    $name         name of the index to be created -
    61     * @param array     $definition        associative array that defines properties of the index to be created. -
    62     *                                 Currently, only one property named FIELDS is supported. This property -
    63     *                                 is also an associative with the names of the index fields as array -
    64     *                                 indexes. Each entry of this array is set to another type of associative -
    65     *                                 array that specifies properties of the index that are specific to -
    66     *                                 each field. -
    67     * -
    68     *                                Currently, only the sorting property is supported. It should be used -
    69     *                                 to define the sorting direction of the index. It may be set to either -
    70     *                                 ascending or descending. -
    71     * -
    72     *                                Not all DBMS support index sorting direction configuration. The DBMS -
    73     *                                 drivers of those that do not support it ignore this property. Use the -
    74     *                                 function support() to determine whether the DBMS driver can manage indexes. -
    75 -
    76     *                                 Example -
    77     *                                    array( -
    78     *                                        'fields' => array( -
    79     *                                            'user_name' => array( -
    80     *                                                'sorting' => 'ascending' -
    81     *                                            ), -
    82     *                                            'last_login' => array() -
    83     *                                        ) -
    84     *                                    ) -
    85     * @throws PDOException -
    86     * @return void -
    87     */ -
    88    public function createIndexSql($table, $name, array $definition) -
    89    { -
    90        $name  = $this->conn->formatter->getIndexName($name); -
    91        $name  = $this->conn->quoteIdentifier($name); -
    92        $query = 'CREATE INDEX ' . $name . ' ON ' . $table; -
    93        $query .= ' (' . $this->getIndexFieldDeclarationList($definition['fields']) . ')'; -
    94 -
    95        return $query; -
    96    } -
    97 -
    98    /** -
    99     * getIndexFieldDeclarationList -
    100     * Obtain DBMS specific SQL code portion needed to set an index -
    101     * declaration to be used in statements like CREATE TABLE. -
    102     * -
    103     * @return string    -
    104     */ -
    105    public function getIndexFieldDeclarationList(array $fields) -
    106    { -
    107        $declFields = array(); -
    108 -
    109        foreach ($fields as $fieldName => $field) { -
    110            $fieldString = $this->conn->quoteIdentifier($fieldName); -
    111 -
    112            if (is_array($field)) { -
    113                if (isset($field['sorting'])) { -
    114                    $sort = strtoupper($field['sorting']); -
    115                    switch ($sort) { -
    116                        case 'ASC': -
    117                        case 'DESC': -
    118                            $fieldString .= ' ' . $sort; -
    119                            break; -
    120                        default: -
    121                            throw new Doctrine_Export_Exception('Unknown index sorting option given.'); -
    122                    } -
    123                } -
    124            } else { -
    125                $fieldString = $this->conn->quoteIdentifier($field); -
    126            } -
    127            $declFields[] = $fieldString; -
    128        } -
    129        return implode(', ', $declFields); -
    130    } -
    131 -
    132    /** -
    133     * create a new table -
    134     * -
    135     * @param string $name   Name of the database that should be created -
    136     * @param array $fields  Associative array that contains the definition of each field of the new table -
    137     *                       The indexes of the array entries are the names of the fields of the table an -
    138     *                       the array entry values are associative arrays like those that are meant to be -
    139     *                       passed with the field definitions to get[Type]Declaration() functions. -
    140     *                          array( -
    141     *                              'id' => array( -
    142     *                                  'type' => 'integer', -
    143     *                                  'unsigned' => 1 -
    144     *                                  'notnull' => 1 -
    145     *                                  'default' => 0 -
    146     *                              ), -
    147     *                              'name' => array( -
    148     *                                  'type' => 'text', -
    149     *                                  'length' => 12 -
    150     *                              ), -
    151     *                              'password' => array( -
    152     *                                  'type' => 'text', -
    153     *                                  'length' => 12 -
    154     *                              ) -
    155     *                          ); -
    156     * @param array $options  An associative array of table options: -
    157     * -
    158     * @return void -
    159     */ -
    160    public function createTableSql($name, array $fields, array $options = array()) -
    161    { -
    162        if ( ! $name) { -
    163            throw new Doctrine_Export_Exception('no valid table name specified'); -
    164        } -
    165         -
    166        if (empty($fields)) { -
    167            throw new Doctrine_Export_Exception('no fields specified for table '.$name); -
    168        } -
    169        $queryFields = $this->getFieldDeclarationList($fields); -
    170         -
    171        $autoinc = false; -
    172        foreach($fields as $field) { -
    173            if (isset($field['autoincrement']) && $field['autoincrement'] ||  -
    174              (isset($field['autoinc']) && $field['autoinc'])) { -
    175                $autoinc = true; -
    176                break; -
    177            } -
    178        } -
    179 -
    180        if ( ! $autoinc && isset($options['primary']) && ! empty($options['primary'])) { -
    181            $keyColumns = array_values($options['primary']); -
    182            $keyColumns = array_map(array($this->conn, 'quoteIdentifier'), $keyColumns); -
    183            $queryFields.= ', PRIMARY KEY('.implode(', ', $keyColumns).')'; -
    184        } -
    185 -
    186        $name  = $this->conn->quoteIdentifier($name, true); -
    187        $sql   = 'CREATE TABLE ' . $name . ' (' . $queryFields; -
    188 -
    189        if ($check = $this->getCheckDeclaration($fields)) { -
    190            $sql .= ', ' . $check; -
    191        } -
    192 -
    193        if (isset($options['checks']) && $check = $this->getCheckDeclaration($options['checks'])) { -
    194            $sql .= ', ' . $check; -
    195        } -
    196 -
    197        $sql .= ')'; -
    198 -
    199        $query[] = $sql; -
    200 -
    201        if (isset($options['indexes']) && ! empty($options['indexes'])) { -
    202            foreach ($options['indexes'] as $index => $definition) { -
    203                $query[] = $this->createIndexSql($name, $index, $definition); -
    204            } -
    205        } -
    206        return $query; -
    207         -
    208         -
    209        /** -
    210        try { -
    211 -
    212            if ( ! empty($fk)) { -
    213                $this->conn->beginTransaction(); -
    214            } -
    215 -
    216            $ret   = $this->conn->exec($query); -
    217 -
    218            if ( ! empty($fk)) { -
    219                foreach ($fk as $definition) { -
    220 -
    221                    $query = 'CREATE TRIGGER doctrine_' . $name . '_cscd_delete ' -
    222                           . 'AFTER DELETE ON ' . $name . ' FOR EACH ROW ' -
    223                           . 'BEGIN ' -
    224                           . 'DELETE FROM ' . $definition['foreignTable'] . ' WHERE '; -
    225 -
    226                    $local = (array) $definition['local']; -
    227                    foreach((array) $definition['foreign'] as $k => $field) { -
    228                        $query .= $field . ' = old.' . $local[$k] . ';'; -
    229                    } -
    230 -
    231                    $query .= 'END;'; -
    232 -
    233                    $this->conn->exec($query); -
    234                } -
    235 -
    236                $this->conn->commit(); -
    237            } -
    238 -
    239 -
    240        } catch(Doctrine_Exception $e) { -
    241 -
    242            $this->conn->rollback(); -
    243 -
    244            throw $e; -
    245        } -
    246        */ -
    247    } -
    248 -
    249    /** -
    250     * getAdvancedForeignKeyOptions -
    251     * Return the FOREIGN KEY query section dealing with non-standard options -
    252     * as MATCH, INITIALLY DEFERRED, ON UPDATE, ... -
    253     * -
    254     * @param array $definition         foreign key definition -
    255     * @return string -
    256     * @access protected -
    257     */ -
    258    public function getAdvancedForeignKeyOptions(array $definition) -
    259    { -
    260        $query = ''; -
    261        if (isset($definition['match'])) { -
    262            $query .= ' MATCH ' . $definition['match']; -
    263        } -
    264        if (isset($definition['onUpdate'])) { -
    265            $query .= ' ON UPDATE ' . $definition['onUpdate']; -
    266        } -
    267        if (isset($definition['onDelete'])) { -
    268            $query .= ' ON DELETE ' . $definition['onDelete']; -
    269        } -
    270        if (isset($definition['deferrable'])) { -
    271            $query .= ' DEFERRABLE'; -
    272        } else { -
    273            $query .= ' NOT DEFERRABLE'; -
    274        } -
    275        if (isset($definition['feferred'])) { -
    276            $query .= ' INITIALLY DEFERRED'; -
    277        } else { -
    278            $query .= ' INITIALLY IMMEDIATE'; -
    279        } -
    280        return $query; -
    281    } -
    282 -
    283    /** -
    284     * create sequence -
    285     * -
    286     * @param string    $seqName        name of the sequence to be created -
    287     * @param string    $start          start value of the sequence; default is 1 -
    288     * @param array     $options  An associative array of table options: -
    289     *                          array( -
    290     *                              'comment' => 'Foo', -
    291     *                              'charset' => 'utf8', -
    292     *                              'collate' => 'utf8_unicode_ci', -
    293     *                          ); -
    294     * @return boolean -
    295     */ -
    296    public function createSequence($seqName, $start = 1, array $options = array()) -
    297    { -
    298        $sequenceName   = $this->conn->quoteIdentifier($this->conn->getSequenceName($seqName), true); -
    299        $seqcolName     = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true); -
    300        $query          = 'CREATE TABLE ' . $sequenceName . ' (' . $seqcolName . ' INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)'; -
    301 -
    302        $this->conn->exec($query); -
    303 -
    304        if ($start == 1) { -
    305            return true; -
    306        } -
    307 -
    308        try { -
    309            $this->conn->exec('INSERT INTO ' . $sequenceName . ' (' . $seqcolName . ') VALUES (' . ($start-1) . ')'); -
    310            return true; -
    311        } catch(Doctrine_Connection_Exception $e) { -
    312            // Handle error     -
    313 -
    314            try { -
    315                $result = $db->exec('DROP TABLE ' . $sequenceName); -
    316            } catch(Doctrine_Connection_Exception $e) { -
    317                throw new Doctrine_Export_Exception('could not drop inconsistent sequence table'); -
    318            } -
    319        } -
    320        throw new Doctrine_Export_Exception('could not create sequence table'); -
    321    } -
    322 -
    323    /** -
    324     * drop existing sequence -
    325     * -
    326     * @param string $sequenceName      name of the sequence to be dropped -
    327     * @return string -
    328     */ -
    329    public function dropSequenceSql($sequenceName) -
    330    { -
    331        $sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($sequenceName), true); -
    332 -
    333        return 'DROP TABLE ' . $sequenceName; -
    334    } -
    335     -
    336    public function alterTableSql($name, array $changes, $check = false) -
    337    { -
    338        if ( ! $name) { -
    339            throw new Doctrine_Export_Exception('no valid table name specified'); -
    340        } -
    341        foreach ($changes as $changeName => $change) { -
    342            switch ($changeName) { -
    343                case 'add': -
    344                case 'change': -
    345                case 'rename': -
    346                case 'name': -
    347                    break; -
    348                default: -
    349                    throw new Doctrine_Export_Exception('change type "' . $changeName . '" not yet supported'); -
    350            } -
    351        } -
    352 -
    353        if ($check) { -
    354            return true; -
    355        } -
    356 -
    357        $query = ''; -
    358        if ( ! empty($changes['name'])) { -
    359            $change_name = $this->conn->quoteIdentifier($changes['name']); -
    360            $query .= 'RENAME TO ' . $change_name; -
    361        } -
    362 -
    363        if ( ! empty($changes['add']) && is_array($changes['add'])) { -
    364            foreach ($changes['add'] as $fieldName => $field) { -
    365                if ($query) { -
    366                    $query.= ', '; -
    367                } -
    368                $query.= 'ADD ' . $this->getDeclaration($fieldName, $field); -
    369            } -
    370        } -
    371 -
    372        $rename = array(); -
    373        if ( ! empty($changes['rename']) && is_array($changes['rename'])) { -
    374            foreach ($changes['rename'] as $fieldName => $field) { -
    375                $rename[$field['name']] = $fieldName; -
    376            } -
    377        } -
    378 -
    379        if ( ! empty($changes['change']) && is_array($changes['change'])) { -
    380            foreach ($changes['change'] as $fieldName => $field) { -
    381                if ($query) { -
    382                    $query.= ', '; -
    383                } -
    384                if (isset($rename[$fieldName])) { -
    385                    $oldFieldName = $rename[$fieldName]; -
    386                    unset($rename[$fieldName]); -
    387                } else { -
    388                    $oldFieldName = $fieldName; -
    389                } -
    390                $oldFieldName = $this->conn->quoteIdentifier($oldFieldName, true); -
    391                $query .= 'CHANGE ' . $oldFieldName . ' '  -
    392                        . $this->getDeclaration($fieldName, $field['definition']); -
    393            } -
    394        } -
    395 -
    396        if ( ! empty($rename) && is_array($rename)) { -
    397            foreach ($rename as $renameName => $renamedField) { -
    398                if ($query) { -
    399                    $query.= ', '; -
    400                } -
    401                $field = $changes['rename'][$renamedField]; -
    402                $renamedField = $this->conn->quoteIdentifier($renamedField, true); -
    403                $query .= 'CHANGE ' . $renamedField . ' ' -
    404                        . $this->getDeclaration($field['name'], $field['definition']); -
    405            } -
    406        } -
    407 -
    408        if ( ! $query) { -
    409            return false; -
    410        } -
    411 -
    412        $name = $this->conn->quoteIdentifier($name, true); -
    413         -
    414        return 'ALTER TABLE ' . $name . ' ' . $query; -
    415    } -
    416} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Expression.html b/tests_old/coverage/Doctrine_Expression.html deleted file mode 100644 index 95ae4393a..000000000 --- a/tests_old/coverage/Doctrine_Expression.html +++ /dev/null @@ -1,444 +0,0 @@ - - - Coverage for Doctrine_Expression - - -

    Coverage for Doctrine_Expression

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Expression.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * Doctrine_Expression -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Expression -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Expression -
    34{ -
    35    protected $_expression; -
    36    protected $_conn; -
    37    protected $_tokenizer; -
    38 -
    39    /** -
    40     * Create an expression  -
    41     *  -
    42     * @param string $expr The expression -
    43     * @param Doctrine_Connection $conn The connection (optional) -
    44     * @return void -
    45     */ -
    46    public function __construct($expr, $conn = null) -
    47    { -
    48        $this->_tokenizer = new Doctrine_Query_Tokenizer(); -
    49        $this->setExpression($expr); -
    50        if ($conn !== null) { -
    51            $this->_conn = $conn; -
    52        } -
    53    } -
    54 -
    55    /** -
    56     * getConnection  -
    57     *  -
    58     * @return Doctrine_Connection The connection -
    59     */ -
    60    public function getConnection() -
    61    { -
    62        if ( ! isset($this->_conn)) { -
    63            return Doctrine_Manager::connection(); -
    64        } -
    65 -
    66        return $this->_conn; -
    67    } -
    68 -
    69    /** -
    70     * setExpression  -
    71     *  -
    72     * @param string $clause The expression to set -
    73     * @return void -
    74     */ -
    75    public function setExpression($clause) -
    76    { -
    77        $this->_expression = $this->parseClause($clause); -
    78    } -
    79 -
    80    /** -
    81     * parseExpression  -
    82     * -
    83     * @todo: What does this function do? -
    84     *  -
    85     * @param string $expr The expression to parse -
    86     * @return void -
    87     */ -
    88    public function parseExpression($expr) -
    89    { -
    90        $pos  = strpos($expr, '('); -
    91        if ($pos === false) { -
    92            return $expr; -
    93        } -
    94 -
    95        // get the name of the function -
    96        $name   = substr($expr, 0, $pos); -
    97        $argStr = substr($expr, ($pos + 1), -1); -
    98 -
    99        // parse args -
    100        foreach ($this->_tokenizer->bracketExplode($argStr, ',') as $arg) { -
    101           $args[] = $this->parseClause($arg); -
    102        } -
    103 -
    104        return call_user_func_array(array($this->getConnection()->expression, $name), $args); -
    105    } -
    106 -
    107    /** -
    108     * parseClause  -
    109     *  -
    110     * @param string $clause The clause -
    111     * @return string The parse clause -
    112     */ -
    113    public function parseClause($clause) -
    114    { -
    115        $e = $this->_tokenizer->bracketExplode($clause, ' '); -
    116 -
    117        foreach ($e as $k => $expr) { -
    118            $e[$k] = $this->parseExpression($expr); -
    119        } -
    120         -
    121        return implode(' ', $e); -
    122    } -
    123 -
    124    /** -
    125     * getSql  -
    126     *  -
    127     * @return string The expression -
    128     */ -
    129    public function getSql() -
    130    { -
    131 -
    132        return $this->_expression; -
    133    } -
    134 -
    135    /** -
    136     * __toString  -
    137     *  -
    138     * @return void -
    139     */ -
    140    public function __toString() -
    141    { -
    142        return $this->getSql(); -
    143    } -
    144} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Expression_Driver.html b/tests_old/coverage/Doctrine_Expression_Driver.html deleted file mode 100644 index da38d4c77..000000000 --- a/tests_old/coverage/Doctrine_Expression_Driver.html +++ /dev/null @@ -1,2198 +0,0 @@ - - - Coverage for Doctrine_Expression_Driver - - -

    Coverage for Doctrine_Expression_Driver

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * Doctrine_Expression_Driver -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Expression -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Expression_Driver extends Doctrine_Connection_Module -
    34{ -
    35    public function getIdentifier($column) -
    36    { -
    37        return $column; -
    38    } -
    39    public function getIdentifiers($columns) -
    40    { -
    41        return $columns; -
    42    } -
    43 -
    44    /** -
    45     * regexp -
    46     * returns the regular expression operator -
    47     * -
    48     * @return string -
    49     */ -
    50    public function regexp() -
    51    { -
    52        throw new Doctrine_Expression_Exception('Regular expression operator is not supported by this database driver.'); -
    53    } -
    54 -
    55    /** -
    56     * Returns the average value of a column -
    57     * -
    58     * @param string $column    the column to use -
    59     * @return string           generated sql including an AVG aggregate function -
    60     */ -
    61    public function avg($column) -
    62    { -
    63        $column = $this->getIdentifier($column); -
    64        return 'AVG(' .  $column . ')'; -
    65    } -
    66 -
    67    /** -
    68     * Returns the number of rows (without a NULL value) of a column -
    69     * -
    70     * If a '*' is used instead of a column the number of selected rows -
    71     * is returned. -
    72     * -
    73     * @param string|integer $column    the column to use -
    74     * @return string                   generated sql including a COUNT aggregate function -
    75     */ -
    76    public function count($column) -
    77    { -
    78        $column = $this->getIdentifier($column); -
    79        return 'COUNT(' . $column . ')'; -
    80    } -
    81 -
    82    /** -
    83     * Returns the highest value of a column -
    84     * -
    85     * @param string $column    the column to use -
    86     * @return string           generated sql including a MAX aggregate function -
    87     */ -
    88    public function max($column) -
    89    { -
    90        $column = $this->getIdentifier($column); -
    91        return 'MAX(' . $column . ')'; -
    92    } -
    93 -
    94    /** -
    95     * Returns the lowest value of a column -
    96     * -
    97     * @param string $column the column to use -
    98     * @return string -
    99     */ -
    100    public function min($column) -
    101    { -
    102        $column = $this->getIdentifier($column); -
    103        return 'MIN(' . $column . ')'; -
    104    } -
    105 -
    106    /** -
    107     * Returns the total sum of a column -
    108     * -
    109     * @param string $column the column to use -
    110     * @return string -
    111     */ -
    112    public function sum($column) -
    113    { -
    114        $column = $this->getIdentifier($column); -
    115        return 'SUM(' . $column . ')'; -
    116    } -
    117 -
    118    // scalar functions -
    119 -
    120    /** -
    121     * Returns the md5 sum of a field. -
    122     * -
    123     * Note: Not SQL92, but common functionality -
    124     * -
    125     * @return string -
    126     */ -
    127    public function md5($column) -
    128    { -
    129        $column = $this->getIdentifier($column); -
    130        return 'MD5(' . $column . ')'; -
    131    } -
    132 -
    133    /** -
    134     * Returns the length of a text field. -
    135     * -
    136     * @param string $expression1 -
    137     * @param string $expression2 -
    138     * @return string -
    139     */ -
    140    public function length($column) -
    141    { -
    142        $column = $this->getIdentifier($column); -
    143        return 'LENGTH(' . $column . ')'; -
    144    } -
    145 -
    146    /** -
    147     * Rounds a numeric field to the number of decimals specified. -
    148     * -
    149     * @param string $expression1 -
    150     * @param string $expression2 -
    151     * @return string -
    152     */ -
    153    public function round($column, $decimals = 0) -
    154    { -
    155        $column = $this->getIdentifier($column); -
    156 -
    157        return 'ROUND(' . $column . ', ' . $decimals . ')'; -
    158    } -
    159 -
    160    /** -
    161     * Returns the remainder of the division operation -
    162     * $expression1 / $expression2. -
    163     * -
    164     * @param string $expression1 -
    165     * @param string $expression2 -
    166     * @return string -
    167     */ -
    168    public function mod($expression1, $expression2) -
    169    { -
    170        $expression1 = $this->getIdentifier($expression1); -
    171        $expression2 = $this->getIdentifier($expression2); -
    172        return 'MOD(' . $expression1 . ', ' . $expression2 . ')'; -
    173    } -
    174 -
    175    /** -
    176     * trim -
    177     * returns the string $str with leading and proceeding space characters removed -
    178     * -
    179     * @param string $str       literal string or column name -
    180     * @return string -
    181     */ -
    182    public function trim($str) -
    183    { -
    184        return 'TRIM(' . $str . ')'; -
    185    } -
    186 -
    187    /** -
    188     * rtrim -
    189     * returns the string $str with proceeding space characters removed -
    190     * -
    191     * @param string $str       literal string or column name -
    192     * @return string -
    193     */ -
    194    public function rtrim($str) -
    195    { -
    196        return 'RTRIM(' . $str . ')'; -
    197    } -
    198 -
    199    /** -
    200     * ltrim -
    201     * returns the string $str with leading space characters removed -
    202     * -
    203     * @param string $str       literal string or column name -
    204     * @return string -
    205     */ -
    206    public function ltrim($str) -
    207    { -
    208        return 'LTRIM(' . $str . ')'; -
    209    } -
    210 -
    211    /** -
    212     * upper -
    213     * Returns the string $str with all characters changed to -
    214     * uppercase according to the current character set mapping. -
    215     * -
    216     * @param string $str       literal string or column name -
    217     * @return string -
    218     */ -
    219    public function upper($str) -
    220    { -
    221        return 'UPPER(' . $str . ')'; -
    222    } -
    223 -
    224    /** -
    225     * lower -
    226     * Returns the string $str with all characters changed to -
    227     * lowercase according to the current character set mapping. -
    228     * -
    229     * @param string $str       literal string or column name -
    230     * @return string -
    231     */ -
    232    public function lower($str) -
    233    { -
    234        return 'LOWER(' . $str . ')'; -
    235    } -
    236 -
    237    /** -
    238     * locate -
    239     * returns the position of the first occurrence of substring $substr in string $str -
    240     * -
    241     * @param string $substr    literal string to find -
    242     * @param string $str       literal string -
    243     * @return integer -
    244     */ -
    245    public function locate($str, $substr) -
    246    { -
    247        return 'LOCATE(' . $str . ', ' . $substr . ')'; -
    248    } -
    249 -
    250    /** -
    251     * Returns the current system date. -
    252     * -
    253     * @return string -
    254     */ -
    255    public function now() -
    256    { -
    257        return 'NOW()'; -
    258    } -
    259 -
    260    /** -
    261     * soundex -
    262     * Returns a string to call a function to compute the -
    263     * soundex encoding of a string -
    264     * -
    265     * The string "?000" is returned if the argument is NULL. -
    266     * -
    267     * @param string $value -
    268     * @return string   SQL soundex function with given parameter -
    269     */ -
    270    public function soundex($value) -
    271    { -
    272        throw new Doctrine_Expression_Exception('SQL soundex function not supported by this driver.'); -
    273    } -
    274 -
    275    /** -
    276     * return string to call a function to get a substring inside an SQL statement -
    277     * -
    278     * Note: Not SQL92, but common functionality. -
    279     * -
    280     * SQLite only supports the 2 parameter variant of this function -
    281     * -
    282     * @param string $value         an sql string literal or column name/alias -
    283     * @param integer $position     where to start the substring portion -
    284     * @param integer $length       the substring portion length -
    285     * @return string               SQL substring function with given parameters -
    286     */ -
    287    public function substring($value, $from, $len = null) -
    288    { -
    289        $value = $this->getIdentifier($value); -
    290        if ($len === null) -
    291            return 'SUBSTRING(' . $value . ' FROM ' . $from . ')'; -
    292        else { -
    293            $len = $this->getIdentifier($len); -
    294            return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $len . ')'; -
    295        } -
    296    } -
    297 -
    298    /** -
    299     * Returns a series of strings concatinated -
    300     * -
    301     * concat() accepts an arbitrary number of parameters. Each parameter -
    302     * must contain an expression or an array with expressions. -
    303     * -
    304     * @param string|array(string) strings that will be concatinated. -
    305     */ -
    306    public function concat() -
    307    { -
    308        $args = func_get_args(); -
    309 -
    310        return 'CONCAT(' . join(', ', (array) $args) . ')'; -
    311    } -
    312 -
    313    /** -
    314     * Returns the SQL for a logical not. -
    315     * -
    316     * Example: -
    317     * <code> -
    318     * $q = new Doctrine_Query(); -
    319     * $e = $q->expr; -
    320     * $q->select('*')->from('table') -
    321     *   ->where($e->eq('id', $e->not('null')); -
    322     * </code> -
    323     * -
    324     * @return string a logical expression -
    325     */ -
    326    public function not($expression) -
    327    { -
    328        $expression = $this->getIdentifier($expression); -
    329        return 'NOT(' . $expression . ')'; -
    330    } -
    331 -
    332    /** -
    333     * Returns the SQL to perform the same mathematical operation over an array -
    334     * of values or expressions. -
    335     * -
    336     * basicMath() accepts an arbitrary number of parameters. Each parameter -
    337     * must contain a value or an expression or an array with values or -
    338     * expressions. -
    339     * -
    340     * @param string $type the type of operation, can be '+', '-', '*' or '/'. -
    341     * @param string|array(string) -
    342     * @return string an expression -
    343     */ -
    344    private function basicMath($type, array $args) -
    345    { -
    346        $elements = $this->getIdentifiers($args); -
    347        if (count($elements) < 1) { -
    348            return ''; -
    349        } -
    350        if (count($elements) == 1) { -
    351            return $elements[0]; -
    352        } else { -
    353            return '(' . implode(' ' . $type . ' ', $elements) . ')'; -
    354        } -
    355    } -
    356 -
    357    /** -
    358     * Returns the SQL to add values or expressions together. -
    359     * -
    360     * add() accepts an arbitrary number of parameters. Each parameter -
    361     * must contain a value or an expression or an array with values or -
    362     * expressions. -
    363     * -
    364     * Example: -
    365     * <code> -
    366     * $q = new Doctrine_Query(); -
    367     * $e = $q->expr; -
    368     * -
    369     * $q->select('u.*') -
    370     *   ->from('User u') -
    371     *   ->where($e->eq($e->add('id', 2), 12)); -
    372     * </code> -
    373     * -
    374     * @param string|array(string) -
    375     * @return string an expression -
    376     */ -
    377    public function add(array $args) -
    378    { -
    379        return $this->basicMath('+', $args); -
    380    } -
    381 -
    382    /** -
    383     * Returns the SQL to subtract values or expressions from eachother. -
    384     * -
    385     * subtract() accepts an arbitrary number of parameters. Each parameter -
    386     * must contain a value or an expression or an array with values or -
    387     * expressions. -
    388     * -
    389     * Example: -
    390     * <code> -
    391     * $q = new Doctrine_Query(); -
    392     * $e = $q->expr; -
    393     * -
    394     * $q->select('u.*') -
    395     *   ->from('User u') -
    396     *   ->where($e->eq($e->sub('id', 2), 12)); -
    397     * </code> -
    398     * -
    399     * @param string|array(string) -
    400     * @return string an expression -
    401     */ -
    402    public function sub(array $args) -
    403    { -
    404        return $this->basicMath('-', $args ); -
    405    } -
    406 -
    407    /** -
    408     * Returns the SQL to multiply values or expressions by eachother. -
    409     * -
    410     * multiply() accepts an arbitrary number of parameters. Each parameter -
    411     * must contain a value or an expression or an array with values or -
    412     * expressions. -
    413     * -
    414     * Example: -
    415     * <code> -
    416     * $q = new Doctrine_Query(); -
    417     * $e = $q->expr; -
    418     * -
    419     * $q->select('u.*') -
    420     *   ->from('User u') -
    421     *   ->where($e->eq($e->mul('id', 2), 12)); -
    422     * </code> -
    423     * -
    424     * @param string|array(string) -
    425     * @return string an expression -
    426     */ -
    427    public function mul(array $args) -
    428    { -
    429        return $this->basicMath('*', $args); -
    430    } -
    431 -
    432    /** -
    433     * Returns the SQL to divide values or expressions by eachother. -
    434     * -
    435     * divide() accepts an arbitrary number of parameters. Each parameter -
    436     * must contain a value or an expression or an array with values or -
    437     * expressions. -
    438     * -
    439     * Example: -
    440     * <code> -
    441     * $q = new Doctrine_Query(); -
    442     * $e = $q->expr; -
    443     * -
    444     * $q->select('u.*') -
    445     *   ->from('User u') -
    446     *   ->where($e->eq($e->div('id', 2), 12)); -
    447     * </code> -
    448     * -
    449     * @param string|array(string) -
    450     * @return string an expression -
    451     */ -
    452    public function div(array $args) -
    453    { -
    454        return $this->basicMath('/', $args); -
    455    } -
    456 -
    457    /** -
    458     * Returns the SQL to check if two values are equal. -
    459     * -
    460     * Example: -
    461     * <code> -
    462     * $q = new Doctrine_Query(); -
    463     * $q->select('u.*') -
    464     *   ->from('User u') -
    465     *   ->where($q->expr->eq('id', 1)); -
    466     * </code> -
    467     * -
    468     * @param string $value1 logical expression to compare -
    469     * @param string $value2 logical expression to compare with -
    470     * @return string logical expression -
    471     */ -
    472    public function eq($value1, $value2) -
    473    { -
    474        $value1 = $this->getIdentifier($value1); -
    475        $value2 = $this->getIdentifier($value2); -
    476        return $value1 . ' = ' . $value2; -
    477    } -
    478 -
    479    /** -
    480     * Returns the SQL to check if two values are unequal. -
    481     * -
    482     * Example: -
    483     * <code> -
    484     * $q = new Doctrine_Query(); -
    485     * $q->select('u.*') -
    486     *   ->from('User u') -
    487     *   ->where($q->expr->neq('id', 1)); -
    488     * </code> -
    489     * -
    490     * @param string $value1 logical expression to compare -
    491     * @param string $value2 logical expression to compare with -
    492     * @return string logical expression -
    493     */ -
    494    public function neq($value1, $value2) -
    495    { -
    496        $value1 = $this->getIdentifier($value1); -
    497        $value2 = $this->getIdentifier($value2); -
    498        return $value1 . ' <> ' . $value2; -
    499    } -
    500 -
    501    /** -
    502     * Returns the SQL to check if one value is greater than another value. -
    503     * -
    504     * Example: -
    505     * <code> -
    506     * $q = new Doctrine_Query(); -
    507     * $q->select('u.*') -
    508     *   ->from('User u') -
    509     *   ->where($q->expr->gt('id', 1)); -
    510     * </code> -
    511     * -
    512     * @param string $value1 logical expression to compare -
    513     * @param string $value2 logical expression to compare with -
    514     * @return string logical expression -
    515     */ -
    516    public function gt($value1, $value2) -
    517    { -
    518        $value1 = $this->getIdentifier($value1); -
    519        $value2 = $this->getIdentifier($value2); -
    520        return $value1 . ' > ' . $value2; -
    521    } -
    522 -
    523    /** -
    524     * Returns the SQL to check if one value is greater than or equal to -
    525     * another value. -
    526     * -
    527     * Example: -
    528     * <code> -
    529     * $q = new Doctrine_Query(); -
    530     * $q->select('u.*') -
    531     *   ->from('User u') -
    532     *   ->where($q->expr->gte('id', 1)); -
    533     * </code> -
    534     * -
    535     * @param string $value1 logical expression to compare -
    536     * @param string $value2 logical expression to compare with -
    537     * @return string logical expression -
    538     */ -
    539    public function gte($value1, $value2) -
    540    { -
    541        $value1 = $this->getIdentifier($value1); -
    542        $value2 = $this->getIdentifier($value2); -
    543        return $value1 . ' >= ' . $value2; -
    544    } -
    545 -
    546    /** -
    547     * Returns the SQL to check if one value is less than another value. -
    548     * -
    549     * Example: -
    550     * <code> -
    551     * $q = new Doctrine_Query(); -
    552     * $q->select('u.*') -
    553     *   ->from('User u') -
    554     *   ->where($q->expr->lt('id', 1)); -
    555     * </code> -
    556     * -
    557     * @param string $value1        logical expression to compare -
    558     * @param string $value2        logical expression to compare with -
    559     * @return string logical expression -
    560     */ -
    561    public function lt($value1, $value2) -
    562    { -
    563        $value1 = $this->getIdentifier($value1); -
    564        $value2 = $this->getIdentifier($value2); -
    565        return $value1 . ' < ' . $value2; -
    566    } -
    567 -
    568    /** -
    569     * Returns the SQL to check if one value is less than or equal to -
    570     * another value. -
    571     * -
    572     * Example: -
    573     * <code> -
    574     * $q = new Doctrine_Query(); -
    575     * $q->select('u.*') -
    576     *   ->from('User u') -
    577     *   ->where($q->expr->lte('id', 1)); -
    578     * </code> -
    579     * -
    580     * @param string $value1        logical expression to compare -
    581     * @param string $value2        logical expression to compare with -
    582     * @return string logical expression -
    583     */ -
    584    public function lte($value1, $value2) -
    585    { -
    586        $value1 = $this->getIdentifier($value1); -
    587        $value2 = $this->getIdentifier($value2); -
    588        return $value1 . ' <= ' . $value2; -
    589    } -
    590 -
    591    /** -
    592     * Returns the SQL to check if a value is one in a set of -
    593     * given values.. -
    594     * -
    595     * in() accepts an arbitrary number of parameters. The first parameter -
    596     * must always specify the value that should be matched against. Successive -
    597     * must contain a logical expression or an array with logical expressions. -
    598     * These expressions will be matched against the first parameter. -
    599     * -
    600     * Example: -
    601     * <code> -
    602     * $q = new Doctrine_Query(); -
    603     * $q->select('u.*') -
    604     *   ->from('User u') -
    605     *   ->where($q->expr->in( 'id', array(1,2,3))); -
    606     * </code> -
    607     * -
    608     * @param string $column        the value that should be matched against -
    609     * @param string|array(string)  values that will be matched against $column -
    610     * @return string logical expression -
    611     */ -
    612    public function in($column, $values) -
    613    { -
    614        if ( ! is_array($values)) { -
    615            $values = array($values); -
    616        } -
    617        $values = $this->getIdentifiers($values); -
    618        $column = $this->getIdentifier($column); -
    619 -
    620        if (count($values) == 0) { -
    621            throw new Doctrine_Expression_Exception('Values array for IN operator should not be empty.'); -
    622        } -
    623        return $column . ' IN (' . implode(', ', $values) . ')'; -
    624    } -
    625 -
    626    /** -
    627     * Returns SQL that checks if a expression is null. -
    628     * -
    629     * Example: -
    630     * <code> -
    631     * $q = new Doctrine_Query(); -
    632     * $q->select('u.*') -
    633     *   ->from('User u') -
    634     *   ->where($q->expr->isNull('id')); -
    635     * </code> -
    636     * -
    637     * @param string $expression the expression that should be compared to null -
    638     * @return string logical expression -
    639     */ -
    640    public function isNull($expression) -
    641    { -
    642        $expression = $this->getIdentifier($expression); -
    643        return $expression . ' IS NULL'; -
    644    } -
    645 -
    646    /** -
    647     * Returns SQL that checks if a expression is not null. -
    648     * -
    649     * Example: -
    650     * <code> -
    651     * $q = new Doctrine_Query(); -
    652     * $q->select('u.*') -
    653     *   ->from('User u') -
    654     *   ->where($q->expr->isNotNull('id')); -
    655     * </code> -
    656     * -
    657     * @param string $expression the expression that should be compared to null -
    658     * @return string logical expression -
    659     */ -
    660    public function isNotNull($expression) -
    661    { -
    662        $expression = $this->getIdentifier($expression); -
    663        return $expression . ' IS NOT NULL'; -
    664    } -
    665 -
    666    /** -
    667     * Returns SQL that checks if an expression evaluates to a value between -
    668     * two values. -
    669     * -
    670     * The parameter $expression is checked if it is between $value1 and $value2. -
    671     * -
    672     * Note: There is a slight difference in the way BETWEEN works on some databases. -
    673     * http://www.w3schools.com/sql/sql_between.asp. If you want complete database -
    674     * independence you should avoid using between(). -
    675     * -
    676     * Example: -
    677     * <code> -
    678     * $q = new Doctrine_Query(); -
    679     * $q->select('u.*') -
    680     *   ->from('User u') -
    681     *   ->where($q->expr->between('id', 1, 5)); -
    682     * </code> -
    683     * -
    684     * @param string $expression the value to compare to -
    685     * @param string $value1 the lower value to compare with -
    686     * @param string $value2 the higher value to compare with -
    687     * @return string logical expression -
    688     */ -
    689    public function between($expression, $value1, $value2) -
    690    { -
    691        $expression = $this->getIdentifier($expression); -
    692        $value1 = $this->getIdentifier($value1); -
    693        $value2 = $this->getIdentifier($value2); -
    694        return $expression . ' BETWEEN ' .$value1 . ' AND ' . $value2; -
    695    } -
    696 -
    697    /** -
    698     * Returns global unique identifier -
    699     * -
    700     * @return string to get global unique identifier -
    701     */ -
    702    public function guid() -
    703    { -
    704        throw new Doctrine_Expression_Exception('method not implemented'); -
    705    } -
    706 -
    707    /** -
    708     * returns arcus cosine SQL string -
    709     * -
    710     * @return string -
    711     */ -
    712    public function acos($value) -
    713    { -
    714        return 'ACOS(' . $value . ')'; -
    715    } -
    716 -
    717    /** -
    718     * __call -
    719     * -
    720     * for all native RDBMS functions the function name itself is returned -
    721     */ -
    722    public function __call($m, $a)  -
    723    { -
    724        if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_EXPR) { -
    725            throw new Doctrine_Expression_Exception('Unknown expression ' . $m); -
    726        } -
    727        return $m . '(' . implode(', ', $a) . ')'; -
    728    } -
    729}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Expression_Exception.html b/tests_old/coverage/Doctrine_Expression_Exception.html deleted file mode 100644 index 369e031df..000000000 --- a/tests_old/coverage/Doctrine_Expression_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Expression_Exception - - -

    Coverage for Doctrine_Expression_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Expression_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Expression -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Expression_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Expression_Mock.html b/tests_old/coverage/Doctrine_Expression_Mock.html deleted file mode 100644 index 8d0b1a37a..000000000 --- a/tests_old/coverage/Doctrine_Expression_Mock.html +++ /dev/null @@ -1,116 +0,0 @@ - - - Coverage for Doctrine_Expression_Mock - - -

    Coverage for Doctrine_Expression_Mock

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * Doctrine_Expression_Mock -
    24 * Mock driver that is used for testing purposes -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Expression -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34class Doctrine_Expression_Mock extends Doctrine_Expression_Driver -
    35{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Expression_Mysql.html b/tests_old/coverage/Doctrine_Expression_Mysql.html deleted file mode 100644 index 318cc1765..000000000 --- a/tests_old/coverage/Doctrine_Expression_Mysql.html +++ /dev/null @@ -1,350 +0,0 @@ - - - Coverage for Doctrine_Expression_Mysql - - -

    Coverage for Doctrine_Expression_Mysql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mysql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Expression_Driver'); -
    22/** -
    23 * Doctrine_Expression_Mysql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Expression -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Expression_Mysql extends Doctrine_Expression_Driver -
    34{ -
    35    /** -
    36     * returns the regular expression operator -
    37     * -
    38     * @return string -
    39     */ -
    40    public function regexp() -
    41    { -
    42        return 'RLIKE'; -
    43    } -
    44 -
    45    /** -
    46     * return string to call a function to get random value inside an SQL statement -
    47     * -
    48     * @return string to generate float between 0 and 1 -
    49     */ -
    50    public function random() -
    51    { -
    52        return 'RAND()'; -
    53    } -
    54 -
    55    /** -
    56     * build a pattern matching string -
    57     * -
    58     * EXPERIMENTAL -
    59     * -
    60     * WARNING: this function is experimental and may change signature at -
    61     * any time until labelled as non-experimental -
    62     * -
    63     * @access public -
    64     * -
    65     * @param array $pattern even keys are strings, odd are patterns (% and _) -
    66     * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future) -
    67     * @param string $field optional field name that is being matched against -
    68     *                  (might be required when emulating ILIKE) -
    69     * -
    70     * @return string SQL pattern -
    71     */ -
    72    public function matchPattern($pattern, $operator = null, $field = null) -
    73    { -
    74        $match = ''; -
    75        if ( ! is_null($operator)) { -
    76            $field = is_null($field) ? '' : $field.' '; -
    77            $operator = strtoupper($operator); -
    78            switch ($operator) { -
    79                // case insensitive -
    80                case 'ILIKE': -
    81                    $match = $field.'LIKE '; -
    82                    break; -
    83                // case sensitive -
    84                case 'LIKE': -
    85                    $match = $field.'LIKE BINARY '; -
    86                    break; -
    87                default: -
    88                    throw new Doctrine_Expression_Mysql_Exception('not a supported operator type:'. $operator); -
    89            } -
    90        } -
    91        $match.= "'"; -
    92        foreach ($pattern as $key => $value) { -
    93            if ($key % 2) { -
    94                $match .= $value; -
    95            } else { -
    96                $match .= $this->conn->escapePattern($this->conn->escape($value)); -
    97            } -
    98        } -
    99        $match.= "'"; -
    100        $match.= $this->patternEscapeString(); -
    101        return $match; -
    102    } -
    103 -
    104    /** -
    105     * Returns global unique identifier -
    106     * -
    107     * @return string to get global unique identifier -
    108     */ -
    109    public function guid() -
    110    { -
    111        return 'UUID()'; -
    112    } -
    113}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Expression_Pgsql.html b/tests_old/coverage/Doctrine_Expression_Pgsql.html deleted file mode 100644 index f4764b0cd..000000000 --- a/tests_old/coverage/Doctrine_Expression_Pgsql.html +++ /dev/null @@ -1,689 +0,0 @@ - - - Coverage for Doctrine_Expression_Pgsql - - -

    Coverage for Doctrine_Expression_Pgsql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Pgsql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Expression_Driver'); -
    22/** -
    23 * Doctrine_Expression_Pgsql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Expression -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver -
    34{ -
    35    /** -
    36     * Returns the md5 sum of a field. -
    37     * -
    38     * Note: Not SQL92, but common functionality -
    39     * -
    40     * md5() works with the default PostgreSQL 8 versions. -
    41     * -
    42     * If you are using PostgreSQL 7.x or older you need -
    43     * to make sure that the digest procedure is installed. -
    44     * If you use RPMS (Redhat and Mandrake) install the postgresql-contrib -
    45     * package. You must then install the procedure by running this shell command: -
    46     * <code> -
    47     * psql [dbname] < /usr/share/pgsql/contrib/pgcrypto.sql -
    48     * </code> -
    49     * You should make sure you run this as the postgres user. -
    50     * -
    51     * @return string -
    52     */ -
    53    public function md5($column) -
    54    { -
    55        $column = $this->getIdentifier($column); -
    56 -
    57        if ($this->version > 7) { -
    58            return 'MD5(' . $column . ')'; -
    59        } else { -
    60            return 'encode(digest(' . $column .', md5), hex)'; -
    61        } -
    62    } -
    63 -
    64    /** -
    65     * Returns part of a string. -
    66     * -
    67     * Note: Not SQL92, but common functionality. -
    68     * -
    69     * @param string $value the target $value the string or the string column. -
    70     * @param int $from extract from this characeter. -
    71     * @param int $len extract this amount of characters. -
    72     * @return string sql that extracts part of a string. -
    73     */ -
    74    public function substring($value, $from, $len = null) -
    75    { -
    76        $value = $this->getIdentifier($value); -
    77 -
    78        if ($len === null) { -
    79            $len = $this->getIdentifier($len); -
    80            return 'SUBSTR(' . $value . ', ' . $from . ')'; -
    81        } else { -
    82            return 'SUBSTR(' . $value . ', ' . $from . ', ' . $len . ')'; -
    83        } -
    84    } -
    85 -
    86    /** -
    87     * Returns a series of strings concatinated -
    88     * -
    89     * concat() accepts an arbitrary number of parameters. Each parameter -
    90     * must contain an expression or an array with expressions. -
    91     * -
    92     * @param string|array(string) strings that will be concatinated. -
    93     * @return string -
    94     */ -
    95 -
    96 -
    97    /** -
    98     * PostgreSQLs AGE(<timestamp1> [, <timestamp2>]) function. -
    99     * -
    100     * @param string $timestamp1 timestamp to subtract from NOW() -
    101     * @param string $timestamp2 optional; if given: subtract arguments -
    102     * @return string -
    103     */ -
    104    public function age($timestamp1, $timestamp2 = null) { -
    105        if ( $timestamp2 == null ) { -
    106            return 'AGE(' . $timestamp1 . ')'; -
    107        } -
    108        return 'AGE(' . $timestamp1 . ', ' . $timestamp2 . ')'; -
    109    } -
    110 -
    111    /** -
    112     * PostgreSQLs DATE_PART( <text>, <time> ) function. -
    113     * -
    114     * @param string $text what to extract -
    115     * @param string $time timestamp or interval to extract from -
    116     * @return string -
    117     */ -
    118    public function date_part($text, $time) { -
    119        return 'DATE_PART(' . $text . ', ' . $time . ')'; -
    120    } -
    121 -
    122 -
    123    /** -
    124     * PostgreSQLs TO_CHAR( <time>, <text> ) function. -
    125     * -
    126     * @param string $time timestamp or interval -
    127     * @param string $text how to the format the output -
    128     * @return string -
    129     */ -
    130    public function to_char($time, $text) { -
    131        return 'TO_CHAR(' . $time . ', ' . $text . ')'; -
    132    } -
    133 -
    134    /** -
    135     * PostgreSQLs CONCAT() function -
    136     * -
    137     * @param  an array of values -
    138     * @return string -
    139     */ -
    140    public function concat() -
    141    { -
    142        $args = func_get_args(); -
    143 -
    144        return join(' || ' , $args); -
    145    } -
    146 -
    147    /** -
    148     * Returns the SQL string to return the current system date and time. -
    149     * -
    150     * @return string -
    151     */ -
    152    public function now() -
    153    { -
    154        return 'LOCALTIMESTAMP(0)'; -
    155    } -
    156 -
    157    /** -
    158     * regexp -
    159     * -
    160     * @return string           the regular expression operator -
    161     */ -
    162    public function regexp() -
    163    { -
    164        return 'SIMILAR TO'; -
    165    } -
    166 -
    167    /** -
    168     * return string to call a function to get random value inside an SQL statement -
    169     * -
    170     * @return return string to generate float between 0 and 1 -
    171     * @access public -
    172     */ -
    173    public function random() -
    174    { -
    175        return 'RANDOM()'; -
    176    } -
    177 -
    178    /** -
    179     * build a pattern matching string -
    180     * -
    181     * EXPERIMENTAL -
    182     * -
    183     * WARNING: this function is experimental and may change signature at -
    184     * any time until labelled as non-experimental -
    185     * -
    186     * @access public -
    187     * -
    188     * @param array $pattern even keys are strings, odd are patterns (% and _) -
    189     * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future) -
    190     * @param string $field optional field name that is being matched against -
    191     *                  (might be required when emulating ILIKE) -
    192     * -
    193     * @return string SQL pattern -
    194     */ -
    195    public function matchPattern($pattern, $operator = null, $field = null) -
    196    { -
    197        $match = ''; -
    198        if ( ! is_null($operator)) { -
    199            $field = is_null($field) ? '' : $field.' '; -
    200            $operator = strtoupper($operator); -
    201            switch ($operator) { -
    202                // case insensitive -
    203            case 'ILIKE': -
    204                $match = $field.'ILIKE '; -
    205                break; -
    206                // case sensitive -
    207            case 'LIKE': -
    208                $match = $field.'LIKE '; -
    209                break; -
    210            default: -
    211                throw new Doctrine_Expression_Pgsql_Exception('not a supported operator type:'. $operator); -
    212            } -
    213        } -
    214        $match.= "'"; -
    215        foreach ($pattern as $key => $value) { -
    216            if ($key % 2) { -
    217                $match.= $value; -
    218            } else { -
    219                $match.= $this->conn->escapePattern($this->conn->escape($value)); -
    220            } -
    221        } -
    222        $match.= "'"; -
    223        $match.= $this->patternEscapeString(); -
    224        return $match; -
    225    } -
    226}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Expression_Sqlite.html b/tests_old/coverage/Doctrine_Expression_Sqlite.html deleted file mode 100644 index fdfaa5ac3..000000000 --- a/tests_old/coverage/Doctrine_Expression_Sqlite.html +++ /dev/null @@ -1,527 +0,0 @@ - - - Coverage for Doctrine_Expression_Sqlite - - -

    Coverage for Doctrine_Expression_Sqlite

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Sqlite.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Expression_Driver'); -
    22/** -
    23 * Doctrine_Expression_Sqlite -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Expression -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Expression_Sqlite extends Doctrine_Expression_Driver -
    34{ -
    35    /** -
    36     * Returns the md5 sum of the data that SQLite's md5() function receives. -
    37     * -
    38     * @param mixed $data -
    39     * @return string -
    40     */ -
    41    public static function md5Impl($data) -
    42    { -
    43        return md5($data); -
    44    } -
    45 -
    46    /** -
    47     * Returns the modules of the data that SQLite's mod() function receives. -
    48     * -
    49     * @param integer $dividend -
    50     * @param integer $divisor -
    51     * @return string -
    52     */ -
    53    public static function modImpl($dividend, $divisor) -
    54    { -
    55        return $dividend % $divisor; -
    56    } -
    57 -
    58    /** -
    59     * Returns a concatenation of the data that SQLite's concat() function receives. -
    60     * -
    61     * @return string -
    62     */ -
    63    public static function concatImpl() -
    64    { -
    65        $args = func_get_args(); -
    66        return join('', $args); -
    67    } -
    68 -
    69    /** -
    70     * locate -
    71     * returns the position of the first occurrence of substring $substr in string $str that -
    72     * SQLite's locate() function receives -
    73     * -
    74     * @param string $substr    literal string to find -
    75     * @param string $str       literal string -
    76     * @return string -
    77     */ -
    78    public static function locateImpl($substr, $str) -
    79    { -
    80        return strpos($str, $substr); -
    81    } -
    82    public static function sha1Impl($str) -
    83    { -
    84        return sha1($str); -
    85    } -
    86    public static function ltrimImpl($str) -
    87    { -
    88        return ltrim($str); -
    89    } -
    90    public static function rtrimImpl($str) -
    91    { -
    92        return rtrim($str); -
    93    } -
    94    public static function trimImpl($str) -
    95    { -
    96        return trim($str); -
    97    } -
    98 -
    99    /** -
    100     * returns the regular expression operator -
    101     * -
    102     * @return string -
    103     */ -
    104    public function regexp() -
    105    { -
    106        return 'RLIKE'; -
    107    } -
    108 -
    109    /** -
    110     * soundex -
    111     * Returns a string to call a function to compute the -
    112     * soundex encoding of a string -
    113     * -
    114     * The string "?000" is returned if the argument is NULL. -
    115     * -
    116     * @param string $value -
    117     * @return string   SQL soundex function with given parameter -
    118     */ -
    119    public function soundex($value) -
    120    { -
    121        return 'SOUNDEX(' . $value . ')'; -
    122    } -
    123 -
    124    /** -
    125     * Return string to call a variable with the current timestamp inside an SQL statement -
    126     * There are three special variables for current date and time. -
    127     * -
    128     * @return string       sqlite function as string -
    129     */ -
    130    public function now($type = 'timestamp') -
    131    { -
    132        switch ($type) { -
    133            case 'time': -
    134                return 'time(\'now\')'; -
    135            case 'date': -
    136                return 'date(\'now\')'; -
    137            case 'timestamp': -
    138            default: -
    139                return 'datetime(\'now\')'; -
    140        } -
    141    } -
    142 -
    143    /** -
    144     * return string to call a function to get random value inside an SQL statement -
    145     * -
    146     * @return string to generate float between 0 and 1 -
    147     */ -
    148    public function random() -
    149    { -
    150        return '((RANDOM() + 2147483648) / 4294967296)'; -
    151    } -
    152 -
    153    /** -
    154     * return string to call a function to get a substring inside an SQL statement -
    155     * -
    156     * Note: Not SQL92, but common functionality. -
    157     * -
    158     * SQLite only supports the 2 parameter variant of this function -
    159     * -
    160     * @param string $value         an sql string literal or column name/alias -
    161     * @param integer $position     where to start the substring portion -
    162     * @param integer $length       the substring portion length -
    163     * @return string               SQL substring function with given parameters -
    164     */ -
    165    public function substring($value, $position, $length = null) -
    166    { -
    167        if ($length !== null) { -
    168            return 'SUBSTR(' . $value . ', ' . $position . ', ' . $length . ')'; -
    169        } -
    170        return 'SUBSTR(' . $value . ', ' . $position . ', LENGTH(' . $value . '))'; -
    171    } -
    172}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Formatter.html b/tests_old/coverage/Doctrine_Formatter.html deleted file mode 100644 index 71b6dcf9e..000000000 --- a/tests_old/coverage/Doctrine_Formatter.html +++ /dev/null @@ -1,738 +0,0 @@ - - - Coverage for Doctrine_Formatter - - -

    Coverage for Doctrine_Formatter

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * Doctrine_Formatter -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Formatter -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Formatter extends Doctrine_Connection_Module -
    34{ -
    35    /** -
    36     * Quotes pattern (% and _) characters in a string) -
    37     * -
    38     * EXPERIMENTAL -
    39     * -
    40     * WARNING: this function is experimental and may change signature at -
    41     * any time until labelled as non-experimental -
    42     * -
    43     * @param   string  the input string to quote -
    44     * -
    45     * @return  string  quoted string -
    46     */ -
    47    public function escapePattern($text) -
    48    { -
    49        if ( ! $this->string_quoting['escape_pattern']) { -
    50            return $text; -
    51        } -
    52        $tmp = $this->conn->string_quoting; -
    53 -
    54        $text = str_replace($tmp['escape_pattern'],  -
    55            $tmp['escape_pattern'] . -
    56            $tmp['escape_pattern'], $text); -
    57 -
    58        foreach ($this->wildcards as $wildcard) { -
    59            $text = str_replace($wildcard, $tmp['escape_pattern'] . $wildcard, $text); -
    60        } -
    61        return $text; -
    62    } -
    63 -
    64    /** -
    65     * convertBooleans -
    66     * some drivers need the boolean values to be converted into integers -
    67     * when using DQL API -
    68     * -
    69     * This method takes care of that conversion -
    70     * -
    71     * @param array $item -
    72     * @return void -
    73     */ -
    74    public function convertBooleans($item) -
    75    { -
    76        if (is_array($item)) { -
    77            foreach ($item as $k => $value) { -
    78                if (is_bool($value)) { -
    79                    $item[$k] = (int) $value; -
    80                } -
    81            } -
    82        } else { -
    83            if (is_bool($item)) { -
    84                $item = (int) $item; -
    85            } -
    86        } -
    87        return $item; -
    88    } -
    89 -
    90    /** -
    91     * Quote a string so it can be safely used as a table or column name -
    92     * -
    93     * Delimiting style depends on which database driver is being used. -
    94     * -
    95     * NOTE: just because you CAN use delimited identifiers doesn't mean -
    96     * you SHOULD use them.  In general, they end up causing way more -
    97     * problems than they solve. -
    98     * -
    99     * Portability is broken by using the following characters inside -
    100     * delimited identifiers: -
    101     *   + backtick (<kbd>`</kbd>) -- due to MySQL -
    102     *   + double quote (<kbd>"</kbd>) -- due to Oracle -
    103     *   + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access -
    104     * -
    105     * Delimited identifiers are known to generally work correctly under -
    106     * the following drivers: -
    107     *   + mssql -
    108     *   + mysql -
    109     *   + mysqli -
    110     *   + oci8 -
    111     *   + pgsql -
    112     *   + sqlite -
    113     * -
    114     * InterBase doesn't seem to be able to use delimited identifiers -
    115     * via PHP 4.  They work fine under PHP 5. -
    116     * -
    117     * @param string $str           identifier name to be quoted -
    118     * @param bool $checkOption     check the 'quote_identifier' option -
    119     * -
    120     * @return string               quoted identifier string -
    121     */ -
    122    public function quoteIdentifier($str, $checkOption = true) -
    123    { -
    124        if ($checkOption && ! $this->conn->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER)) { -
    125            return $str; -
    126        } -
    127        $tmp = $this->conn->identifier_quoting; -
    128        $str = str_replace($tmp['end'], -
    129            $tmp['escape'] . -
    130            $tmp['end'], $str); -
    131 -
    132        return $tmp['start'] . $str . $tmp['end']; -
    133    } -
    134 -
    135    /** -
    136     * quote -
    137     * quotes given input parameter -
    138     * -
    139     * @param mixed $input      parameter to be quoted -
    140     * @param string $type -
    141     * @return mixed -
    142     */ -
    143    public function quote($input, $type = null) -
    144    { -
    145        if ($type == null) { -
    146            $type = gettype($input); -
    147        } -
    148        switch ($type) { -
    149        case 'integer': -
    150        case 'enum': -
    151        case 'boolean': -
    152        case 'double': -
    153        case 'float': -
    154        case 'bool': -
    155        case 'decimal': -
    156        case 'int': -
    157            return $input; -
    158        case 'array': -
    159        case 'object': -
    160            $input = serialize($input); -
    161        case 'string': -
    162        case 'char': -
    163        case 'varchar': -
    164        case 'text': -
    165        case 'gzip': -
    166        case 'blob': -
    167        case 'clob': -
    168            $this->conn->connect(); -
    169 -
    170            return $this->conn->getDbh()->quote($input); -
    171        } -
    172    } -
    173 -
    174    /** -
    175     * Removes any formatting in an sequence name using the 'seqname_format' option -
    176     * -
    177     * @param string $sqn string that containts name of a potential sequence -
    178     * @return string name of the sequence with possible formatting removed -
    179     */ -
    180    public function fixSequenceName($sqn) -
    181    { -
    182        $seqPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)',  $this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT)).'$/i'; -
    183        $seqName    = preg_replace($seqPattern, '\\1', $sqn); -
    184 -
    185        if ($seqName && ! strcasecmp($sqn, $this->getSequenceName($seqName))) { -
    186            return $seqName; -
    187        } -
    188        return $sqn; -
    189    } -
    190 -
    191    /** -
    192     * Removes any formatting in an index name using the 'idxname_format' option -
    193     * -
    194     * @param string $idx string that containts name of anl index -
    195     * @return string name of the index with possible formatting removed -
    196     */ -
    197    public function fixIndexName($idx) -
    198    { -
    199        $indexPattern   = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT)).'$/i'; -
    200        $indexName      = preg_replace($indexPattern, '\\1', $idx); -
    201        if ($indexName && ! strcasecmp($idx, $this->getIndexName($indexName))) { -
    202            return $indexName; -
    203        } -
    204        return $idx; -
    205    } -
    206 -
    207    /** -
    208     * adds sequence name formatting to a sequence name -
    209     * -
    210     * @param string    name of the sequence -
    211     * @return string   formatted sequence name -
    212     */ -
    213    public function getSequenceName($sqn) -
    214    { -
    215        return sprintf($this->conn->getAttribute(Doctrine::ATTR_SEQNAME_FORMAT), -
    216            preg_replace('/[^a-z0-9_\$.]/i', '_', $sqn)); -
    217    } -
    218 -
    219    /** -
    220     * adds index name formatting to a index name -
    221     * -
    222     * @param string    name of the index -
    223     * @return string   formatted index name -
    224     */ -
    225    public function getIndexName($idx) -
    226    { -
    227        return sprintf($this->conn->getAttribute(Doctrine::ATTR_IDXNAME_FORMAT), -
    228            preg_replace('/[^a-z0-9_\$]/i', '_', $idx)); -
    229    } -
    230 -
    231    /** -
    232     * adds table name formatting to a table name -
    233     * -
    234     * @param string    name of the table -
    235     * @return string   formatted table name -
    236     */ -
    237    public function getTableName($table) -
    238    { -
    239        return sprintf($this->conn->getAttribute(Doctrine::ATTR_TBLNAME_FORMAT), -
    240            preg_replace('/[^a-z0-9_\$]/i', '_', $table)); -
    241    } -
    242} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hook.html b/tests_old/coverage/Doctrine_Hook.html deleted file mode 100644 index 884fa9702..000000000 --- a/tests_old/coverage/Doctrine_Hook.html +++ /dev/null @@ -1,702 +0,0 @@ - - - Coverage for Doctrine_Hook - - -

    Coverage for Doctrine_Hook

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Hook.php 3189 2007-11-18 20:37:44Z meus $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hook -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Hook -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3189 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Hook -
    34{ -
    35    /** -
    36     * @var Doctrine_Query $query           the base query -
    37     */ -
    38    protected $query; -
    39 -
    40    /** -
    41     * @var array $joins                    the optional joins of the base query -
    42     */ -
    43    protected $joins; -
    44 -
    45    /** -
    46     * @var array $hooks                    hooks array -
    47     */ -
    48    protected $hooks        = array( -
    49                             'where', -
    50                             'orderby', -
    51                             'limit', -
    52                             'offset' -
    53                              ); -
    54 -
    55    /** -
    56     * @var array $fieldParsers             custom field parsers array -
    57     *                                      keys as field names in the format componentAlias.FieldName -
    58     *                                      values as parser names / objects -
    59     */ -
    60    protected $fieldParsers = array(); -
    61 -
    62    /** -
    63     * @var array $typeParsers              type parsers array -
    64     *                                      keys as type names and values as parser names / objects -
    65     */ -
    66    protected $typeParsers  = array( -
    67                              'char'      => 'Doctrine_Hook_WordLike', -
    68                              'string'    => 'Doctrine_Hook_WordLike', -
    69                              'varchar'   => 'Doctrine_Hook_WordLike', -
    70                              'integer'   => 'Doctrine_Hook_Integer', -
    71                              'enum'      => 'Doctrine_Hook_Integer', -
    72                              'time'      => 'Doctrine_Hook_Time', -
    73                              'date'      => 'Doctrine_Hook_Date', -
    74                              ); -
    75 -
    76    /** -
    77     * @param Doctrine_Query $query         the base query -
    78     */ -
    79    public function __construct($query) -
    80    { -
    81        if (is_string($query)) { -
    82            $this->query = new Doctrine_Query(); -
    83            $this->query->parseQuery($query); -
    84        } elseif ($query instanceof Doctrine_Query) { -
    85            $this->query = $query; -
    86        } else { -
    87            throw new Doctrine_Exception('Constructor argument should be either Doctrine_Query object or valid DQL query');           -
    88        } -
    89         -
    90        $this->query->getQuery(); -
    91    } -
    92 -
    93    /** -
    94     * getQuery -
    95     * -
    96     * @return Doctrine_Query       returns the query object associated with this hook -
    97     */ -
    98    public function getQuery() -
    99    { -
    100        return $this->query; -
    101    } -
    102 -
    103    /** -
    104     * setTypeParser -
    105     * -
    106     * @param string $type              type name -
    107     * @param string|object $parser     parser name or custom parser object -
    108     */ -
    109    public function setTypeParser($type, $parser)  -
    110    { -
    111        $this->typeParsers[$type] = $parser; -
    112    } -
    113 -
    114    /** -
    115     * setFieldParser -
    116     * -
    117     * @param string $field             field name -
    118     * @param string|object $parser     parser name or custom parser object -
    119     */ -
    120    public function setFieldParser($field, $parser) -
    121    { -
    122        $this->fieldParsers[$field] = $parser; -
    123    } -
    124 -
    125    /** -
    126     * hookWhere -
    127     * builds DQL query where part from given parameter array -
    128     * -
    129     * @param array $params         an associative array containing field -
    130     *                              names and their values -
    131     * @return boolean              whether or not the hooking was -
    132     */ -
    133    public function hookWhere($params) -
    134    { -
    135        if ( ! is_array($params)) { -
    136            return false; -
    137        } -
    138        foreach ($params as $name => $value) { -
    139            if ($value === '' || $value === '-') { -
    140                continue; -
    141            } -
    142            $e = explode('.', $name); -
    143 -
    144            if (count($e) == 2) { -
    145                list($alias, $column) = $e; -
    146 -
    147                $map   = $this->query->getAliasDeclaration($alias); -
    148                $table = $map['table']; -
    149 -
    150                if ( ! $table) { -
    151                    throw new Doctrine_Exception('Unknown alias ' . $alias); -
    152                } -
    153 -
    154                if ($def = $table->getDefinitionOf($column)) { -
    155 -
    156                $def[0] = gettype($value); -
    157                    if (isset($this->typeParsers[$def[0]])) { -
    158                        $name   = $this->typeParsers[$def[0]]; -
    159                        $parser = new $name; -
    160                    } -
    161 -
    162                    $parser->parse($alias, $column, $value); -
    163 -
    164                    $this->query->addWhere($parser->getCondition(), $parser->getParams()); -
    165                } -
    166            } -
    167        } -
    168 -
    169        return true; -
    170    } -
    171 -
    172    /** -
    173     * hookOrderBy -
    174     * builds DQL query orderby part from given parameter array -
    175     * -
    176     * @param array $params         an array containing all fields which the built query -
    177     *                              should be ordered by -
    178     * @return boolean              whether or not the hooking was successful -
    179     */ -
    180    public function hookOrderby($params) -
    181    { -
    182        if ( ! is_array($params)) { -
    183            return false; -
    184        } -
    185        foreach ($params as $name) { -
    186            $e = explode(' ', $name); -
    187 -
    188            $order = 'ASC'; -
    189 -
    190            if (count($e) > 1) { -
    191                $order = ($e[1] == 'DESC') ? 'DESC' : 'ASC'; -
    192            } -
    193 -
    194            $e = explode('.', $e[0]); -
    195 -
    196            if (count($e) == 2) { -
    197                list($alias, $column) = $e; -
    198 -
    199                $map   = $this->query->getAliasDeclaration($alias); -
    200                $table = $map['table']; -
    201 -
    202                if ($def = $table->getDefinitionOf($column)) {    -
    203                    $this->query->addOrderBy($alias . '.' . $column . ' ' . $order); -
    204                } -
    205            } -
    206        } -
    207        return true; -
    208    } -
    209 -
    210    /** -
    211     * set the hook limit  -
    212     *  -
    213     * @param integer $limit  -
    214     * @return void -
    215     */ -
    216    public function hookLimit($limit) -
    217    { -
    218        $this->query->limit((int) $limit); -
    219    } -
    220 -
    221    /** -
    222     * set the hook offset -
    223     * -
    224     * @param integer $offset -
    225     */ -
    226    public function hookOffset($offset) -
    227    { -
    228        $this->query->offset((int) $offset); -
    229    } -
    230} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hook_Equal.html b/tests_old/coverage/Doctrine_Hook_Equal.html deleted file mode 100644 index 447e3a2d0..000000000 --- a/tests_old/coverage/Doctrine_Hook_Equal.html +++ /dev/null @@ -1,167 +0,0 @@ - - - Coverage for Doctrine_Hook_Equal - - -

    Coverage for Doctrine_Hook_Equal

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Equal.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Hook_Parser'); -
    22/** -
    23 * Doctrine_Hook_Equal -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Hook -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Hook_Equal extends Doctrine_Hook_Parser -
    34{ -
    35    /** -
    36     * parse -
    37     * Parses given field and field value to DQL condition -
    38     * and parameters. This method should always return -
    39     * prepared statement conditions (conditions that use -
    40     * placeholders instead of literal values). -
    41     * -
    42     * @param string $alias     component alias -
    43     * @param string $field     the field name -
    44     * @param mixed $value      the value of the field -
    45     * @return void -
    46     */ -
    47    public function parse($alias, $field, $value) -
    48    { -
    49        $this->params    = (array) $value; -
    50        $this->condition = $alias . '.' . $field . ' = ?'; -
    51    } -
    52}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hook_Integer.html b/tests_old/coverage/Doctrine_Hook_Integer.html deleted file mode 100644 index f55a331bb..000000000 --- a/tests_old/coverage/Doctrine_Hook_Integer.html +++ /dev/null @@ -1,236 +0,0 @@ - - - Coverage for Doctrine_Hook_Integer - - -

    Coverage for Doctrine_Hook_Integer

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Integer.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Hook_Parser_Complex'); -
    22/** -
    23 * Doctrine_Hook_Integer -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Hook -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Hook_Integer extends Doctrine_Hook_Parser_Complex -
    34{ -
    35    /** -
    36     * parse -
    37     * Parses given field and field value to DQL condition -
    38     * and parameters. This method should always return -
    39     * prepared statement conditions (conditions that use -
    40     * placeholders instead of literal values). -
    41     * -
    42     * @param string $alias     component alias -
    43     * @param string $field     the field name -
    44     * @param mixed $value      the value of the field -
    45     * @return void -
    46     */ -
    47    public function parseSingle($alias, $field, $value) -
    48    { -
    49        $e = explode(' ', $value); -
    50 -
    51        foreach ($e as $v) { -
    52             $v = trim($v); -
    53 -
    54             $e2   = explode('-', $v); -
    55 -
    56            $name = $alias. '.' . $field; -
    57 -
    58             if (count($e2) == 1) { -
    59                 // one '-' found -
    60 -
    61                $a[] = $name . ' = ?'; -
    62 -
    63                $this->params[] = $v; -
    64            } else { -
    65                // more than one '-' found -
    66 -
    67                $a[] = '(' . $name . ' > ? AND ' . $name . ' < ?)'; -
    68 -
    69                $this->params += array($e2[0], $e2[1]); -
    70            } -
    71 -
    72        } -
    73        return implode(' OR ', $a); -
    74    } -
    75}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hook_Parser.html b/tests_old/coverage/Doctrine_Hook_Parser.html deleted file mode 100644 index 38db98424..000000000 --- a/tests_old/coverage/Doctrine_Hook_Parser.html +++ /dev/null @@ -1,212 +0,0 @@ - - - Coverage for Doctrine_Hook_Parser - - -

    Coverage for Doctrine_Hook_Parser

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Parser.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hook_Parser -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Hook -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33abstract class Doctrine_Hook_Parser -
    34{ -
    35    protected $condition; -
    36    protected $params = array(); -
    37 -
    38    public function getCondition() -
    39    { -
    40        return $this->condition; -
    41    } -
    42 -
    43    /** -
    44     * getParams -
    45     * returns the parameters associated with this parser -
    46     * -
    47     * @return array -
    48     */ -
    49    public function getParams() -
    50    { -
    51        return $this->params; -
    52    } -
    53 -
    54    /** -
    55     * parse -
    56     * Parses given field and field value to DQL condition -
    57     * and parameters. This method should always return -
    58     * prepared statement conditions (conditions that use -
    59     * placeholders instead of literal values). -
    60     * -
    61     * @param string $alias     component alias -
    62     * @param string $field     the field name -
    63     * @param mixed $value      the value of the field -
    64     * @return void -
    65     */ -
    66    abstract public function parse($alias, $field, $value); -
    67}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hook_Parser_Complex.html b/tests_old/coverage/Doctrine_Hook_Parser_Complex.html deleted file mode 100644 index 2e3eb8489..000000000 --- a/tests_old/coverage/Doctrine_Hook_Parser_Complex.html +++ /dev/null @@ -1,332 +0,0 @@ - - - Coverage for Doctrine_Hook_Parser_Complex - - -

    Coverage for Doctrine_Hook_Parser_Complex

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Complex.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Hook_Parser'); -
    22/** -
    23 * Doctrine_Hook_Parser_Complex -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Hook -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33abstract class Doctrine_Hook_Parser_Complex extends Doctrine_Hook_Parser -
    34{ -
    35    protected $_tokenizer; -
    36     -
    37    /** -
    38     * Constructor. -
    39     */ -
    40    public function __construct() -
    41    { -
    42        $this->_tokenizer = new Doctrine_Query_Tokenizer(); -
    43    } -
    44     -
    45    /** -
    46     * parse -
    47     * Parses given field and field value to DQL condition -
    48     * and parameters. This method should always return -
    49     * prepared statement conditions (conditions that use -
    50     * placeholders instead of literal values). -
    51     * -
    52     * @param string $alias     component alias -
    53     * @param string $field     the field name -
    54     * @param mixed $value      the value of the field -
    55     * @return void -
    56     */ -
    57    public function parse($alias, $field, $value) -
    58    { -
    59        $this->condition = $this->parseClause($alias, $field, $value); -
    60    } -
    61 -
    62    /** -
    63     * parseClause -
    64     * -
    65     * @param string $alias     component alias -
    66     * @param string $field     the field name -
    67     * @param mixed $value      the value of the field -
    68     * @return void -
    69     */ -
    70    public function parseClause($alias, $field, $value) -
    71    { -
    72        $parts = $this->_tokenizer->quoteExplode($value, ' AND '); -
    73 -
    74        if (count($parts) > 1) { -
    75            $ret = array(); -
    76            foreach ($parts as $part) { -
    77                $ret[] = $this->parseSingle($alias, $field, $part); -
    78            } -
    79 -
    80            $r = implode(' AND ', $ret); -
    81        } else { -
    82            $parts = $this->_tokenizer->quoteExplode($value, ' OR '); -
    83            if (count($parts) > 1) { -
    84                $ret = array(); -
    85                foreach ($parts as $part) { -
    86                    $ret[] = $this->parseClause($alias, $field, $part); -
    87                } -
    88 -
    89                $r = implode(' OR ', $ret); -
    90            } else { -
    91                $ret = $this->parseSingle($alias, $field, $parts[0]); -
    92                return $ret; -
    93            } -
    94        } -
    95        return '(' . $r . ')'; -
    96    } -
    97 -
    98    /** -
    99     * parseSingle -
    100     * -
    101     * @param string $alias     component alias -
    102     * @param string $field     the field name -
    103     * @param mixed $value      the value of the field -
    104     * @return void -
    105     */ -
    106    abstract public function parseSingle($alias, $field, $value); -
    107}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hook_WordLike.html b/tests_old/coverage/Doctrine_Hook_WordLike.html deleted file mode 100644 index 41a25ec31..000000000 --- a/tests_old/coverage/Doctrine_Hook_WordLike.html +++ /dev/null @@ -1,210 +0,0 @@ - - - Coverage for Doctrine_Hook_WordLike - - -

    Coverage for Doctrine_Hook_WordLike

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: WordLike.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Hook_Parser'); -
    22/** -
    23 * Doctrine_Hook_WordLike -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Hook -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Hook_WordLike extends Doctrine_Hook_Parser_Complex -
    34{ -
    35    /** -
    36     * parse -
    37     * Parses given field and field value to DQL condition -
    38     * and parameters. This method should always return -
    39     * prepared statement conditions (conditions that use -
    40     * placeholders instead of literal values). -
    41     * -
    42     * @param string $alias     component alias -
    43     * @param string $field     the field name -
    44     * @param mixed $value      the value of the field -
    45     * @return void -
    46     */ -
    47    public function parseSingle($alias, $field, $value) -
    48    { -
    49        if (strpos($value, "'") !== false) { -
    50            $value = $this->_tokenizer->bracketTrim($value, "'", "'"); -
    51         -
    52            $a[]   = $alias . '.' . $field . ' LIKE ?'; -
    53            $this->params[] = '%' . $value . '%'; -
    54 -
    55        } else { -
    56            $e2 = explode(' ',$value); -
    57     -
    58            foreach ($e2 as $v) { -
    59                $v = trim($v); -
    60                $a[] = $alias . '.' . $field . ' LIKE ?'; -
    61                $this->params[] = '%' . $v . '%'; -
    62            } -
    63        } -
    64        return implode(' OR ', $a); -
    65    } -
    66} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hydrate.html b/tests_old/coverage/Doctrine_Hydrate.html deleted file mode 100644 index 4890ea983..000000000 --- a/tests_old/coverage/Doctrine_Hydrate.html +++ /dev/null @@ -1,3852 +0,0 @@ - - - Coverage for Doctrine_Hydrate - - -

    Coverage for Doctrine_Hydrate

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Hydrate.php 3032 2007-10-29 19:50:16Z meus $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hydrate is a base class for Doctrine_RawSql and Doctrine_Query. -
    24 * Its purpose is to populate object graphs. -
    25 * -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Hydrate -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3032 $ -
    33 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    34 */ -
    35class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializable -
    36{ -
    37    /** -
    38     * QUERY TYPE CONSTANTS -
    39     */ -
    40 -
    41    /** -
    42     * constant for SELECT queries -
    43     */ -
    44    const SELECT = 0; -
    45 -
    46    /** -
    47     * constant for DELETE queries -
    48     */ -
    49    const DELETE = 1; -
    50 -
    51    /** -
    52     * constant for UPDATE queries -
    53     */ -
    54    const UPDATE = 2; -
    55 -
    56    /** -
    57     * constant for INSERT queries -
    58     */ -
    59    const INSERT = 3; -
    60 -
    61    /** -
    62     * constant for CREATE queries -
    63     */ -
    64    const CREATE = 4; -
    65 -
    66    /** -
    67     * @var array $params                       query input parameters -
    68     */ -
    69    protected $_params      = array('where' => array(), -
    70                                    'set' => array(), -
    71                                    'having' => array()); -
    72 -
    73    /** -
    74     * @var Doctrine_Connection $conn           Doctrine_Connection object -
    75     */ -
    76    protected $_conn; -
    77 -
    78    /** -
    79     * @var Doctrine_View $_view                Doctrine_View object, when set this object will use the -
    80     *                                          the query given by the view object for object population -
    81     */ -
    82    protected $_view; -
    83 -
    84    /** -
    85     * @var array $_aliasMap                    two dimensional array containing the map for query aliases -
    86     *      Main keys are component aliases -
    87     * -
    88     *          table               table object associated with given alias -
    89     * -
    90     *          relation            the relation object owned by the parent -
    91     * -
    92     *          parent              the alias of the parent -
    93     * -
    94     *          agg                 the aggregates of this component -
    95     * -
    96     *          map                 the name of the column / aggregate value this -
    97     *                              component is mapped to a collection -
    98     */ -
    99    protected $_aliasMap         = array(); -
    100 -
    101    /** -
    102     * -
    103     */ -
    104    protected $pendingAggregates = array(); -
    105 -
    106    /** -
    107     * @var array $aggregateMap             an array containing all aggregate aliases, keys as dql aliases -
    108     *                                      and values as sql aliases -
    109     */ -
    110    protected $aggregateMap      = array(); -
    111 -
    112    /** -
    113     * @var array $_options                 an array of options -
    114     */ -
    115    protected $_options    = array( -
    116                            'fetchMode'      => Doctrine::FETCH_RECORD, -
    117                            'parserCache'    => false, -
    118                            'resultSetCache' => false, -
    119                            ); -
    120 -
    121    /** -
    122     * @var string $_sql            cached SQL query -
    123     */ -
    124    protected $_sql; -
    125 -
    126    /** -
    127     * @var array $parts            SQL query string parts -
    128     */ -
    129    protected $parts = array( -
    130        'select'    => array(), -
    131        'distinct'  => false, -
    132        'forUpdate' => false, -
    133        'from'      => array(), -
    134        'set'       => array(), -
    135        'join'      => array(), -
    136        'where'     => array(), -
    137        'groupby'   => array(), -
    138        'having'    => array(), -
    139        'orderby'   => array(), -
    140        'limit'     => false, -
    141        'offset'    => false, -
    142        ); -
    143 -
    144    /** -
    145     * @var integer $type                   the query type -
    146     * -
    147     * @see Doctrine_Query::* constants -
    148     */ -
    149    protected $type            = self::SELECT; -
    150 -
    151    /** -
    152     * @var array -
    153     */ -
    154    protected $_cache; -
    155 -
    156    /** -
    157     * The current hydration mode. -
    158     */ -
    159    protected $_hydrationMode = Doctrine::HYDRATE_RECORD; -
    160 -
    161    /** -
    162     * @var boolean $_expireCache           a boolean value that indicates whether or not to force cache expiration -
    163     */ -
    164    protected $_expireCache     = false; -
    165 -
    166    protected $_timeToLive; -
    167 -
    168    protected $_tableAliases    = array(); -
    169 -
    170    /** -
    171     * @var array $_tableAliasSeeds         A simple array keys representing table aliases and values -
    172     *                                      as table alias seeds. The seeds are used for generating short table -
    173     *                                      aliases. -
    174     */ -
    175    protected $_tableAliasSeeds = array(); -
    176 -
    177    /** -
    178     * constructor -
    179     * -
    180     * @param Doctrine_Connection|null $connection -
    181     */ -
    182    public function __construct($connection = null) -
    183    { -
    184        if ( ! ($connection instanceof Doctrine_Connection)) { -
    185            $connection = Doctrine_Manager::getInstance()->getCurrentConnection(); -
    186        } -
    187        $this->_conn = $connection; -
    188    } -
    189 -
    190    /** -
    191     * getRootAlias -
    192     * returns the alias of the the root component -
    193     * -
    194     * @return array -
    195     */ -
    196    public function getRootAlias() -
    197    { -
    198        if ( ! $this->_aliasMap) { -
    199          $this->getSql(); -
    200        } -
    201         -
    202        reset($this->_aliasMap); -
    203 -
    204        return key($this->_aliasMap); -
    205    } -
    206 -
    207    /** -
    208     * getRootDeclaration -
    209     * returns the root declaration -
    210     * -
    211     * @return array -
    212     */ -
    213    public function getRootDeclaration() -
    214    { -
    215        $map = reset($this->_aliasMap); -
    216 -
    217        return $map; -
    218    } -
    219 -
    220    /** -
    221     * getRoot -
    222     * returns the root component for this object -
    223     * -
    224     * @return Doctrine_Table       root components table -
    225     */ -
    226    public function getRoot() -
    227    { -
    228        $map = reset($this->_aliasMap); -
    229 -
    230        if ( ! isset($map['table'])) { -
    231            throw new Doctrine_Hydrate_Exception('Root component not initialized.'); -
    232        } -
    233 -
    234        return $map['table']; -
    235    } -
    236 -
    237    /** -
    238     * getSql -
    239     * return the sql associated with this object -
    240     * -
    241     * @return string   sql query string -
    242     */ -
    243    public function getSql() -
    244    { -
    245        return $this->getQuery(); -
    246    } -
    247 -
    248    /** -
    249     * useCache -
    250     * -
    251     * @param Doctrine_Cache_Interface|bool $driver      cache driver -
    252     * @param integer $timeToLive                        how long the cache entry is valid -
    253     * @return Doctrine_Hydrate         this object -
    254     */ -
    255    public function useCache($driver = true, $timeToLive = null) -
    256    { -
    257        if ($driver !== null) { -
    258            if ($driver !== true) { -
    259                if ( ! ($driver instanceof Doctrine_Cache_Interface)) { -
    260                    $msg = 'First argument should be instance of Doctrine_Cache_Interface or null.'; -
    261 -
    262                    throw new Doctrine_Hydrate_Exception($msg); -
    263                } -
    264            } -
    265        } -
    266        $this->_cache = $driver; -
    267 -
    268        return $this->setCacheLifeSpan($timeToLive); -
    269    } -
    270 -
    271    /** -
    272     * expireCache -
    273     * -
    274     * @param boolean $expire       whether or not to force cache expiration -
    275     * @return Doctrine_Hydrate     this object -
    276     */ -
    277    public function expireCache($expire = true) -
    278    { -
    279        $this->_expireCache = true; -
    280 -
    281        return $this; -
    282    } -
    283 -
    284    /** -
    285     * setCacheLifeSpan -
    286     * -
    287     * @param integer $timeToLive   how long the cache entry is valid -
    288     * @return Doctrine_Hydrate     this object -
    289     */ -
    290    public function setCacheLifeSpan($timeToLive) -
    291    { -
    292        if ($timeToLive !== null) { -
    293            $timeToLive = (int) $timeToLive; -
    294        } -
    295        $this->_timeToLive = $timeToLive; -
    296 -
    297        return $this; -
    298    } -
    299 -
    300    /** -
    301     * getCacheDriver -
    302     * returns the cache driver associated with this object -
    303     * -
    304     * @return Doctrine_Cache_Interface|boolean|null    cache driver -
    305     */ -
    306    public function getCacheDriver() -
    307    { -
    308        if ($this->_cache instanceof Doctrine_Cache_Interface) { -
    309            return $this->_cache; -
    310        } else { -
    311            return $this->_conn->getCacheDriver(); -
    312        } -
    313    } -
    314 -
    315    /** -
    316     * Sets the fetchmode. -
    317     * -
    318     * @param integer $fetchmode  One of the Doctrine::HYDRATE_* constants. -
    319     */ -
    320    public function setHydrationMode($hydrationMode) -
    321    { -
    322        $this->_hydrationMode = $hydrationMode; -
    323        return $this; -
    324    } -
    325 -
    326    /** -
    327     * serialize -
    328     * this method is automatically called when this Doctrine_Hydrate is serialized -
    329     * -
    330     * @return array    an array of serialized properties -
    331     */ -
    332    public function serialize() -
    333    { -
    334        $vars = get_object_vars($this); -
    335 -
    336    } -
    337 -
    338    /** -
    339     * unseralize -
    340     * this method is automatically called everytime a Doctrine_Hydrate object is unserialized -
    341     * -
    342     * @param string $serialized                Doctrine_Record as serialized string -
    343     * @return void -
    344     */ -
    345    public function unserialize($serialized) -
    346    { -
    347 -
    348    } -
    349 -
    350    /** -
    351     * generateNewTableAlias -
    352     * generates a new alias from given table alias -
    353     * -
    354     * @param string $tableAlias    table alias from which to generate the new alias from -
    355     * @return string               the created table alias -
    356     */ -
    357    public function generateNewTableAlias($tableAlias) -
    358    { -
    359        if (isset($this->_tableAliases[$tableAlias])) { -
    360            // generate a new alias -
    361            $name = substr($tableAlias, 0, 1); -
    362            $i    = ((int) substr($tableAlias, 1)); -
    363 -
    364            if ($i == 0) { -
    365                $i = 1; -
    366            } -
    367 -
    368            $newIndex  = ($this->_tableAliasSeeds[$name] + $i); -
    369 -
    370            return $name . $newIndex; -
    371        } -
    372 -
    373        return $tableAlias; -
    374    } -
    375 -
    376    /** -
    377     * hasTableAlias -
    378     * whether or not this object has given tableAlias -
    379     * -
    380     * @param string $tableAlias    the table alias to be checked -
    381     * @return boolean              true if this object has given alias, otherwise false -
    382     */ -
    383    public function hasTableAlias($tableAlias) -
    384    { -
    385        return (isset($this->_tableAliases[$tableAlias])); -
    386    } -
    387 -
    388    /** -
    389     * getComponentAlias -
    390     * get component alias associated with given table alias -
    391     * -
    392     * @param string $tableAlias    the table alias that identifies the component alias -
    393     * @return string               component alias -
    394     */ -
    395    public function getComponentAlias($tableAlias) -
    396    { -
    397        if ( ! isset($this->_tableAliases[$tableAlias])) { -
    398            throw new Doctrine_Hydrate_Exception('Unknown table alias ' . $tableAlias); -
    399        } -
    400        return $this->_tableAliases[$tableAlias]; -
    401    } -
    402 -
    403    /** -
    404     * getTableAliasSeed -
    405     * returns the alias seed for given table alias -
    406     * -
    407     * @param string $tableAlias    table alias that identifies the alias seed -
    408     * @return integer              table alias seed -
    409     */ -
    410    public function getTableAliasSeed($tableAlias) -
    411    { -
    412        if ( ! isset($this->_tableAliasSeeds[$tableAlias])) { -
    413            return 0; -
    414        } -
    415        return $this->_tableAliasSeeds[$tableAlias]; -
    416    } -
    417 -
    418    /** -
    419     * generateTableAlias -
    420     * generates a table alias from given table name and associates  -
    421     * it with given component alias -
    422     * -
    423     * @param string $componentAlias    the component alias to be associated with generated table alias -
    424     * @param string $tableName         the table name from which to generate the table alias -
    425     * @return string                   the generated table alias -
    426     */ -
    427    public function generateTableAlias($componentAlias, $tableName) -
    428    { -
    429        $char   = strtolower(substr($tableName, 0, 1)); -
    430 -
    431        $alias  = $char; -
    432 -
    433        if ( ! isset($this->_tableAliasSeeds[$alias])) { -
    434            $this->_tableAliasSeeds[$alias] = 1; -
    435        } -
    436 -
    437        while (isset($this->_tableAliases[$alias])) { -
    438            if ( ! isset($this->_tableAliasSeeds[$alias])) { -
    439                $this->_tableAliasSeeds[$alias] = 1; -
    440            } -
    441            $alias = $char . ++$this->_tableAliasSeeds[$alias]; -
    442        } -
    443 -
    444        $this->_tableAliases[$alias] = $componentAlias; -
    445 -
    446        return $alias; -
    447    } -
    448 -
    449    /** -
    450     * getTableAliases -
    451     * returns all table aliases -
    452     * -
    453     * @return array        table aliases as an array -
    454     */ -
    455    public function getTableAliases() -
    456    { -
    457        return $this->_tableAliases; -
    458    } -
    459 -
    460    /**  -
    461     * addTableAlias -
    462     * adds an alias for table and associates it with given component alias -
    463     * -
    464     * @param string $componentAlias    the alias for the query component associated with given tableAlias -
    465     * @param string $tableAlias        the table alias to be added -
    466     * @return Doctrine_Hydrate -
    467     */ -
    468    public function addTableAlias($tableAlias, $componentAlias) -
    469    { -
    470        $this->_tableAliases[$tableAlias] = $componentAlias; -
    471 -
    472        return $this; -
    473    } -
    474 -
    475    /** -
    476     * getTableAlias -
    477     * some database such as Oracle need the identifier lengths to be < ~30 chars -
    478     * hence Doctrine creates as short identifier aliases as possible -
    479     * -
    480     * this method is used for the creation of short table aliases, its also -
    481     * smart enough to check if an alias already exists for given component (componentAlias) -
    482     * -
    483     * @param string $componentAlias    the alias for the query component to search table alias for -
    484     * @param string $tableName         the table name from which the table alias is being created -
    485     * @return string                   the generated / fetched short alias -
    486     */ -
    487    public function getTableAlias($componentAlias, $tableName = null) -
    488    { -
    489        $alias = array_search($componentAlias, $this->_tableAliases); -
    490 -
    491        if ($alias !== false) { -
    492            return $alias; -
    493        } -
    494 -
    495        if ($tableName === null) { -
    496            throw new Doctrine_Hydrate_Exception("Couldn't get short alias for " . $componentAlias); -
    497        } -
    498 -
    499        return $this->generateTableAlias($componentAlias, $tableName); -
    500    } -
    501 -
    502    /** -
    503     * addQueryPart -
    504     * adds a query part in the query part array -
    505     * -
    506     * @param string $name          the name of the query part to be added -
    507     * @param string $part          query part string -
    508     * @throws Doctrine_Hydrate_Exception   if trying to add unknown query part -
    509     * @return Doctrine_Hydrate     this object -
    510     */ -
    511    public function addQueryPart($name, $part) -
    512    { -
    513        if ( ! isset($this->parts[$name])) { -
    514            throw new Doctrine_Hydrate_Exception('Unknown query part ' . $name); -
    515        } -
    516        if (is_array($part)) { -
    517            $this->parts[$name] = array_merge($this->parts[$name], $part); -
    518        } else { -
    519            $this->parts[$name][] = $part; -
    520        } -
    521        return $this; -
    522    } -
    523 -
    524    /** -
    525     * setQueryPart -
    526     * sets a query part in the query part array -
    527     * -
    528     * @param string $name          the name of the query part to be set -
    529     * @param string $part          query part string -
    530     * @throws Doctrine_Hydrate_Exception   if trying to set unknown query part -
    531     * @return Doctrine_Hydrate     this object -
    532     */ -
    533    public function getQueryPart($part) -
    534    { -
    535        if ( ! isset($this->parts[$part])) { -
    536            throw new Doctrine_Hydrate_Exception('Unknown query part ' . $part); -
    537        } -
    538 -
    539        return $this->parts[$part]; -
    540    } -
    541 -
    542    /** -
    543     * removeQueryPart -
    544     * removes a query part from the query part array -
    545     * -
    546     * @param string $name          the name of the query part to be removed -
    547     * @throws Doctrine_Hydrate_Exception   if trying to remove unknown query part -
    548     * @return Doctrine_Hydrate     this object -
    549     */ -
    550    public function removeQueryPart($name) -
    551    { -
    552        if (isset($this->parts[$name])) { -
    553            if ($name == 'limit' || $name == 'offset') { -
    554                $this->parts[$name] = false; -
    555            } else { -
    556                $this->parts[$name] = array(); -
    557            } -
    558        } else { -
    559            throw new Doctrine_Hydrate_Exception('Unknown query part ' . $name); -
    560        } -
    561        return $this; -
    562    } -
    563 -
    564    /** -
    565     * setQueryPart -
    566     * sets a query part in the query part array -
    567     * -
    568     * @param string $name          the name of the query part to be set -
    569     * @param string $part          query part string -
    570     * @throws Doctrine_Hydrate_Exception   if trying to set unknown query part -
    571     * @return Doctrine_Hydrate     this object -
    572     */ -
    573    public function setQueryPart($name, $part) -
    574    { -
    575        if ( ! isset($this->parts[$name])) { -
    576            throw new Doctrine_Hydrate_Exception('Unknown query part ' . $name); -
    577        } -
    578 -
    579        if ($name !== 'limit' && $name !== 'offset') { -
    580            if (is_array($part)) { -
    581                $this->parts[$name] = $part; -
    582            } else { -
    583                $this->parts[$name] = array($part); -
    584            } -
    585        } else { -
    586            $this->parts[$name] = $part; -
    587        } -
    588 -
    589        return $this; -
    590    } -
    591 -
    592    /** -
    593     * hasAliasDeclaration -
    594     * whether or not this object has a declaration for given component alias -
    595     * -
    596     * @param string $componentAlias    the component alias the retrieve the declaration from -
    597     * @return boolean -
    598     */ -
    599    public function hasAliasDeclaration($componentAlias) -
    600    { -
    601        return isset($this->_aliasMap[$componentAlias]); -
    602    } -
    603 -
    604    /** -
    605     * getAliasDeclaration -
    606     * get the declaration for given component alias -
    607     * -
    608     * @param string $componentAlias    the component alias the retrieve the declaration from -
    609     * @return array                    the alias declaration -
    610     */ -
    611    public function getAliasDeclaration($componentAlias) -
    612    { -
    613        if ( ! isset($this->_aliasMap[$componentAlias])) { -
    614            throw new Doctrine_Hydrate_Exception('Unknown component alias ' . $componentAlias); -
    615        } -
    616 -
    617        return $this->_aliasMap[$componentAlias]; -
    618    } -
    619 -
    620    /** -
    621     * copyAliases -
    622     * copy aliases from another Hydrate object -
    623     * -
    624     * this method is needed by DQL subqueries which need the aliases -
    625     * of the parent query -
    626     * -
    627     * @param Doctrine_Hydrate $query   the query object from which the -
    628     *                                  aliases are copied from -
    629     * @return Doctrine_Hydrate         this object -
    630     */ -
    631    public function copyAliases(Doctrine_Hydrate $query) -
    632    { -
    633        $this->_tableAliases = $query->_tableAliases; -
    634        $this->_aliasMap     = $query->_aliasMap; -
    635        $this->_tableAliasSeeds = $query->_tableAliasSeeds; -
    636        return $this; -
    637    } -
    638 -
    639    /** -
    640     * createSubquery -
    641     * creates a subquery -
    642     * -
    643     * @return Doctrine_Hydrate -
    644     */ -
    645    public function createSubquery() -
    646    { -
    647        $class = get_class($this); -
    648        $obj   = new $class(); -
    649 -
    650        // copy the aliases to the subquery -
    651        $obj->copyAliases($this); -
    652 -
    653        // this prevents the 'id' being selected, re ticket #307 -
    654        $obj->isSubquery(true); -
    655 -
    656        return $obj; -
    657    } -
    658 -
    659    /** -
    660     * limitSubqueryUsed -
    661     * whether or not limit subquery was used -
    662     * -
    663     * @return boolean -
    664     */ -
    665    public function isLimitSubqueryUsed() -
    666    { -
    667        return false; -
    668    } -
    669 -
    670    /** -
    671     * clear -
    672     * resets all the variables -
    673     * -
    674     * @return void -
    675     */ -
    676    protected function clear() -
    677    { -
    678        $this->parts = array( -
    679                    'select'    => array(), -
    680                    'distinct'  => false, -
    681                    'forUpdate' => false, -
    682                    'from'      => array(), -
    683                    'set'       => array(), -
    684                    'join'      => array(), -
    685                    'where'     => array(), -
    686                    'groupby'   => array(), -
    687                    'having'    => array(), -
    688                    'orderby'   => array(), -
    689                    'limit'     => false, -
    690                    'offset'    => false, -
    691                    ); -
    692        $this->inheritanceApplied = false; -
    693    } -
    694 -
    695    /** -
    696     * getConnection -
    697     * -
    698     * @return Doctrine_Connection -
    699     */ -
    700    public function getConnection() -
    701    { -
    702        return $this->_conn; -
    703    } -
    704 -
    705    /** -
    706     * setView -
    707     * sets a database view this query object uses -
    708     * this method should only be called internally by doctrine -
    709     * -
    710     * @param Doctrine_View $view       database view -
    711     * @return void -
    712     */ -
    713    public function setView(Doctrine_View $view) -
    714    { -
    715        $this->_view = $view; -
    716    } -
    717 -
    718    /** -
    719     * getView -
    720     * returns the view associated with this query object (if any) -
    721     * -
    722     * @return Doctrine_View        the view associated with this query object -
    723     */ -
    724    public function getView() -
    725    { -
    726        return $this->_view; -
    727    } -
    728 -
    729    /** -
    730     * getParams -
    731     * -
    732     * @return array -
    733     */ -
    734    public function getParams() -
    735    { -
    736        return array_merge($this->_params['set'], $this->_params['where'], $this->_params['having']); -
    737    } -
    738 -
    739    /** -
    740     * setParams -
    741     * -
    742     * @param array $params -
    743     */ -
    744    public function setParams(array $params = array()) { -
    745        $this->_params = $params; -
    746    } -
    747    public function convertEnums($params) -
    748    { -
    749        return $params; -
    750    } -
    751 -
    752    /** -
    753     * setAliasMap -
    754     * sets the whole component alias map -
    755     * -
    756     * @param array $map            alias map -
    757     * @return Doctrine_Hydrate     this object -
    758     */ -
    759    public function setAliasMap(array $map) -
    760    { -
    761        $this->_aliasMap = $map; -
    762 -
    763        return $this; -
    764    } -
    765 -
    766    /** -
    767     * getAliasMap -
    768     * returns the component alias map -
    769     * -
    770     * @return array    component alias map -
    771     */ -
    772    public function getAliasMap() -
    773    { -
    774        return $this->_aliasMap; -
    775    } -
    776 -
    777    /** -
    778     * getCachedForm -
    779     * returns the cached form of this query for given resultSet -
    780     * -
    781     * @param array $resultSet -
    782     * @return string           serialized string representation of this query -
    783     */ -
    784    public function getCachedForm(array $resultSet) -
    785    { -
    786        $map = ''; -
    787 -
    788        foreach ($this->getAliasMap() as $k => $v) { -
    789            if ( ! isset($v['parent'])) { -
    790                $map[$k][] = $v['table']->getComponentName(); -
    791            } else { -
    792                $map[$k][] = $v['parent'] . '.' . $v['relation']->getAlias(); -
    793            } -
    794            if (isset($v['agg'])) { -
    795                $map[$k][] = $v['agg']; -
    796            } -
    797        } -
    798 -
    799        return serialize(array($resultSet, $map, $this->getTableAliases())); -
    800    } -
    801    public function _execute($params) -
    802    { -
    803        $params = $this->_conn->convertBooleans($params); -
    804 -
    805        if ( ! $this->_view) { -
    806            $query = $this->getQuery($params); -
    807        } else { -
    808            $query = $this->_view->getSelectSql(); -
    809        } -
    810 -
    811        $params = $this->convertEnums($params); -
    812 -
    813        if ($this->isLimitSubqueryUsed() && -
    814            $this->_conn->getAttribute(Doctrine::ATTR_DRIVER_NAME) !== 'mysql') { -
    815 -
    816            $params = array_merge($params, $params); -
    817        } -
    818 -
    819        if ($this->type !== self::SELECT) { -
    820            return $this->_conn->exec($query, $params); -
    821        } -
    822 -
    823        $stmt = $this->_conn->execute($query, $params); -
    824        return $stmt; -
    825    } -
    826 -
    827    /** -
    828     * execute -
    829     * executes the query and populates the data set -
    830     * -
    831     * @param string $params -
    832     * @return Doctrine_Collection            the root collection -
    833     */ -
    834    public function execute($params = array(), $hydrationMode = null) -
    835    { -
    836        $params = array_merge($this->_params['set'],  -
    837                              $this->_params['where'], -
    838                              $this->_params['having'],  -
    839                              $params); -
    840        if ($this->_cache) { -
    841            $cacheDriver = $this->getCacheDriver(); -
    842 -
    843            $dql  = $this->getDql(); -
    844            // calculate hash for dql query -
    845            $hash = md5($dql . var_export($params, true)); -
    846 -
    847            $cached = ($this->_expireCache) ? false : $cacheDriver->fetch($hash); -
    848 -
    849 -
    850            if ($cached === false) { -
    851                // cache miss -
    852                $stmt = $this->_execute($params); -
    853                $array = $this->parseData2($stmt, Doctrine::HYDRATE_ARRAY); -
    854 -
    855                $cached = $this->getCachedForm($array); -
    856 -
    857                $cacheDriver->save($hash, $cached, $this->_timeToLive); -
    858            } else { -
    859                $cached = unserialize($cached); -
    860                $this->_tableAliases = $cached[2]; -
    861                $array = $cached[0]; -
    862 -
    863                $map   = array(); -
    864                foreach ($cached[1] as $k => $v) { -
    865                    $e = explode('.', $v[0]); -
    866                    if (count($e) === 1) { -
    867                        $map[$k]['table'] = $this->_conn->getTable($e[0]); -
    868                    } else { -
    869                        $map[$k]['parent']   = $e[0]; -
    870                        $map[$k]['relation'] = $map[$e[0]]['table']->getRelation($e[1]); -
    871                        $map[$k]['table']    = $map[$k]['relation']->getTable(); -
    872                    } -
    873                    if (isset($v[1])) { -
    874                        $map[$k]['agg'] = $v[1]; -
    875                    } -
    876                } -
    877                $this->_aliasMap = $map; -
    878            } -
    879        } else { -
    880            $stmt = $this->_execute($params); -
    881 -
    882            if (is_integer($stmt)) { -
    883                return $stmt; -
    884            } -
    885             -
    886            $array = $this->parseData2($stmt, $hydrationMode); -
    887        } -
    888        return $array; -
    889    } -
    890 -
    891    /** -
    892     * getType -
    893     * -
    894     * returns the type of this query object -
    895     * by default the type is Doctrine_Hydrate::SELECT but if update() or delete() -
    896     * are being called the type is Doctrine_Hydrate::UPDATE and Doctrine_Hydrate::DELETE, -
    897     * respectively -
    898     * -
    899     * @see Doctrine_Hydrate::SELECT -
    900     * @see Doctrine_Hydrate::UPDATE -
    901     * @see Doctrine_Hydrate::DELETE -
    902     * -
    903     * @return integer      return the query type -
    904     */ -
    905    public function getType() -
    906    { -
    907        return $this->type; -
    908    } -
    909 -
    910    /** -
    911     * applyInheritance -
    912     * applies column aggregation inheritance to DQL / SQL query -
    913     * -
    914     * @return string -
    915     */ -
    916    public function applyInheritance() -
    917    { -
    918        // get the inheritance maps -
    919        $array = array(); -
    920 -
    921        foreach ($this->_aliasMap as $componentAlias => $data) { -
    922            $tableAlias = $this->getTableAlias($componentAlias); -
    923            $array[$tableAlias][] = $data['table']->inheritanceMap; -
    924        } -
    925 -
    926        // apply inheritance maps -
    927        $str = ''; -
    928        $c = array(); -
    929 -
    930        $index = 0; -
    931        foreach ($array as $tableAlias => $maps) { -
    932            $a = array(); -
    933 -
    934            // don't use table aliases if the query isn't a select query -
    935            if ($this->type !== Doctrine_Query::SELECT) { -
    936                $tableAlias = ''; -
    937            } else { -
    938                $tableAlias .= '.'; -
    939            } -
    940 -
    941            foreach ($maps as $map) { -
    942                $b = array(); -
    943                foreach ($map as $field => $value) { -
    944                    $identifier = $this->_conn->quoteIdentifier($tableAlias . $field); -
    945 -
    946                    if ($index > 0) { -
    947                        $b[] = '(' . $identifier . ' = ' . $this->_conn->quote($value) -
    948                             . ' OR ' . $identifier . ' IS NULL)'; -
    949                    } else { -
    950                        $b[] = $identifier . ' = ' . $this->_conn->quote($value); -
    951                    } -
    952                } -
    953 -
    954                if ( ! empty($b)) { -
    955                    $a[] = implode(' AND ', $b); -
    956                } -
    957            } -
    958 -
    959            if ( ! empty($a)) { -
    960                $c[] = implode(' AND ', $a); -
    961            } -
    962            $index++; -
    963        } -
    964 -
    965        $str .= implode(' AND ', $c); -
    966 -
    967        return $str; -
    968    } -
    969 -
    970    /** -
    971     * fetchArray -
    972     * Convenience method to execute using array fetching as hydration mode. -
    973     * -
    974     * @param string $params -
    975     * @return array -
    976     */ -
    977    public function fetchArray($params = array()) { -
    978        return $this->execute($params, Doctrine::HYDRATE_ARRAY); -
    979    } -
    980 -
    981    /** -
    982     * fetchOne -
    983     * Convenience method to execute the query and return the first item -
    984     * of the collection. -
    985     * -
    986     * @param string $params Parameters -
    987     * @param int $hydrationMode Hydration mode -
    988     * @return mixed Array or Doctrine_Collection or false if no result. -
    989     */ -
    990    public function fetchOne($params = array(), $hydrationMode = null) -
    991    { -
    992        if (is_null($hydrationMode)) { -
    993            $hydrationMode = $this->_hydrationMode; -
    994        } -
    995 -
    996        $collection = $this->execute($params, $hydrationMode); -
    997 -
    998        if (count($collection) === 0) { -
    999            return false; -
    1000        } -
    1001 -
    1002        switch ($hydrationMode) { -
    1003            case Doctrine::HYDRATE_RECORD: -
    1004                return $collection->getFirst(); -
    1005            case Doctrine::HYDRATE_ARRAY: -
    1006                return array_shift($collection); -
    1007        } -
    1008 -
    1009        return false; -
    1010    } -
    1011 -
    1012    /** -
    1013     * parseData -
    1014     * parses the data returned by statement object -
    1015     * -
    1016     * This is method defines the core of Doctrine object population algorithm -
    1017     * hence this method strives to be as fast as possible -
    1018     * -
    1019     * The key idea is the loop over the rowset only once doing all the needed operations -
    1020     * within this massive loop. -
    1021     * -
    1022     * @param mixed $stmt -
    1023     * @return array -
    1024     */ -
    1025    public function parseData2($stmt, $hydrationMode) -
    1026    { -
    1027        if ($hydrationMode == Doctrine::HYDRATE_NONE) { -
    1028            return $stmt->fetchAll(PDO::FETCH_NUM); -
    1029        } -
    1030         -
    1031        $cache = array(); -
    1032        $rootMap   = reset($this->_aliasMap); -
    1033        $rootAlias = key($this->_aliasMap); -
    1034        $componentName = $rootMap['table']->getComponentName(); -
    1035        $isSimpleQuery = count($this->_aliasMap) <= 1; -
    1036         -
    1037        if ($hydrationMode === null) { -
    1038            $hydrationMode = $this->_hydrationMode; -
    1039        } -
    1040 -
    1041        if ($hydrationMode === Doctrine::HYDRATE_ARRAY) { -
    1042            $driver = new Doctrine_Hydrate_Array(); -
    1043        } else { -
    1044            $driver = new Doctrine_Hydrate_Record(); -
    1045        } -
    1046 -
    1047        $array = $driver->getElementCollection($componentName); -
    1048 -
    1049        if ($stmt === false || $stmt === 0) { -
    1050            return $array; -
    1051        } -
    1052 -
    1053        $event = new Doctrine_Event(null, Doctrine_Event::HYDRATE, null); -
    1054 -
    1055        // for every getRecordListener() there is a little bit  -
    1056        // logic behind it, hence calling it multiple times on -
    1057        // large result sets can be quite expensive. -
    1058        // So for efficiency we use little listener caching here -
    1059        foreach ($this->_aliasMap as $alias => $data) { -
    1060            $componentName = $data['table']->getComponentName(); -
    1061            $listeners[$componentName] = $data['table']->getRecordListener(); -
    1062            $identifierMap[$alias] = array(); -
    1063            $currData[$alias] = array(); -
    1064            $prev[$alias] = array(); -
    1065            $id[$alias] = ''; -
    1066        } -
    1067 -
    1068        while ($data = $stmt->fetch(Doctrine::FETCH_ASSOC)) { -
    1069            $currData  = array(); -
    1070            $identifiable = array(); -
    1071 -
    1072            foreach ($data as $key => $value) { -
    1073 -
    1074                // The following little cache solution ensures that field aliases are -
    1075                // parsed only once. This increases speed on large result sets by an order -
    1076                // of magnitude. -
    1077                if ( ! isset($cache[$key])) { -
    1078                    $e = explode('__', $key); -
    1079                    $cache[$key]['field'] = $field = strtolower(array_pop($e)); -
    1080                    $cache[$key]['alias'] = $this->_tableAliases[strtolower(implode('__', $e))]; -
    1081                } -
    1082 -
    1083                $map   = $this->_aliasMap[$cache[$key]['alias']]; -
    1084                $table = $map['table']; -
    1085                $alias = $cache[$key]['alias']; -
    1086                $field = $cache[$key]['field']; -
    1087 -
    1088                if (isset($this->_aliasMap[$alias]['agg'][$field])) { -
    1089                    $field = $this->_aliasMap[$alias]['agg'][$field]; -
    1090                } -
    1091 -
    1092 -
    1093                if ($table->isIdentifier($field)) { -
    1094                    $id[$alias] .= '|' . $value; -
    1095                } -
    1096 -
    1097                $currData[$alias][$field] = $table->prepareValue($field, $value); -
    1098 -
    1099                if ($value !== null) { -
    1100                    $identifiable[$alias] = true; -
    1101                } -
    1102            } -
    1103 -
    1104            // dealing with root component -
    1105            $table = $this->_aliasMap[$rootAlias]['table']; -
    1106            $componentName = $table->getComponentName(); -
    1107            $event->set('data', $currData[$rootAlias]); -
    1108            $listeners[$componentName]->preHydrate($event); -
    1109            $element = $driver->getElement($currData[$rootAlias], $componentName); -
    1110 -
    1111            $oneToOne = false; -
    1112 -
    1113            if ($isSimpleQuery) { -
    1114                $index = false; -
    1115            } else { -
    1116                $index = isset($identifierMap[$rootAlias][$id[$rootAlias]]) ? -
    1117                         $identifierMap[$rootAlias][$id[$rootAlias]] : false; -
    1118            } -
    1119 -
    1120            if ($index === false) { -
    1121                $event->set('data', $element); -
    1122                $listeners[$componentName]->postHydrate($event); -
    1123 -
    1124                if (isset($this->_aliasMap[$rootAlias]['map'])) { -
    1125                    $key = $this->_aliasMap[$rootAlias]['map']; -
    1126 -
    1127                    if (isset($array[$key])) { -
    1128                        throw new Doctrine_Hydrate_Exception("Couldn't hydrate. Found non-unique key mapping."); -
    1129                    } -
    1130 -
    1131                    if ( ! isset($element[$key])) { -
    1132                        throw new Doctrine_Hydrate_Exception("Couldn't hydrate. Found a non-existent key."); -
    1133                    } -
    1134 -
    1135                    $array[$element[$key]] = $element; -
    1136                } else { -
    1137                    $array[] = $element; -
    1138                } -
    1139 -
    1140                $identifierMap[$rootAlias][$id[$rootAlias]] = $driver->getLastKey($array); -
    1141            } -
    1142 -
    1143            $this->_setLastElement($prev, $array, $index, $rootAlias, $oneToOne); -
    1144            unset($currData[$rootAlias]); -
    1145 -
    1146            foreach ($currData as $alias => $data) { -
    1147                $index = false; -
    1148                $map   = $this->_aliasMap[$alias]; -
    1149                $table = $this->_aliasMap[$alias]['table']; -
    1150                $componentName = $table->getComponentName(); -
    1151                $event->set('data', $data); -
    1152                $listeners[$componentName]->preHydrate($event); -
    1153 -
    1154                $element = $driver->getElement($data, $componentName); -
    1155 -
    1156                $parent   = $map['parent']; -
    1157                $relation = $map['relation']; -
    1158                $componentAlias = $map['relation']->getAlias(); -
    1159 -
    1160                $path = $parent . '.' . $alias; -
    1161 -
    1162                if ( ! isset($prev[$parent])) { -
    1163                    break; -
    1164                } -
    1165 -
    1166                // check the type of the relation -
    1167                if ( ! $relation->isOneToOne()) { -
    1168                    // initialize the collection -
    1169 -
    1170                    if ($driver->initRelated($prev[$parent], $componentAlias)) { -
    1171 -
    1172                        // append element -
    1173                        if (isset($identifiable[$alias])) { -
    1174                            if ($isSimpleQuery) { -
    1175                                $index = false; -
    1176                            } else { -
    1177                                $index = isset($identifierMap[$path][$id[$parent]][$id[$alias]]) ? -
    1178                                         $identifierMap[$path][$id[$parent]][$id[$alias]] : false; -
    1179                            } -
    1180 -
    1181                            if ($index === false) { -
    1182                                $event->set('data', $element); -
    1183                                $listeners[$componentName]->postHydrate($event); -
    1184 -
    1185                                if (isset($map['map'])) { -
    1186                                    $key = $map['map']; -
    1187                                    if (isset($prev[$parent][$componentAlias][$key])) { -
    1188                                        throw new Doctrine_Hydrate_Exception("Couldn't hydrate. Found non-unique key mapping."); -
    1189                                    } -
    1190                                    if ( ! isset($element[$key])) { -
    1191                                        throw new Doctrine_Hydrate_Exception("Couldn't hydrate. Found a non-existent key."); -
    1192                                    } -
    1193                                    $prev[$parent][$componentAlias][$element[$key]] = $element; -
    1194                                } else { -
    1195                                    $prev[$parent][$componentAlias][] = $element; -
    1196                                } -
    1197 -
    1198                                $identifierMap[$path][$id[$parent]][$id[$alias]] = $driver->getLastKey($prev[$parent][$componentAlias]); -
    1199                            } -
    1200                        } -
    1201                        // register collection for later snapshots -
    1202                        $driver->registerCollection($prev[$parent][$componentAlias]); -
    1203                    } -
    1204                } else { -
    1205                    if ( ! isset($identifiable[$alias])) { -
    1206                        $prev[$parent][$componentAlias] = $driver->getNullPointer(); -
    1207                    } else { -
    1208                        $prev[$parent][$componentAlias] = $element; -
    1209                    } -
    1210                    $oneToOne = true; -
    1211                } -
    1212                $coll =& $prev[$parent][$componentAlias]; -
    1213                $this->_setLastElement($prev, $coll, $index, $alias, $oneToOne); -
    1214                $id[$alias] = ''; -
    1215            } -
    1216            $id[$rootAlias] = ''; -
    1217        } -
    1218 -
    1219        $driver->flush(); -
    1220 -
    1221        $stmt->closeCursor(); -
    1222        return $array; -
    1223    } -
    1224 -
    1225    /** -
    1226     * _setLastElement -
    1227     * -
    1228     * sets the last element of given data array / collection -
    1229     * as previous element -
    1230     * -
    1231     * @param boolean|integer $index -
    1232     * @return void -
    1233     */ -
    1234    public function _setLastElement(&$prev, &$coll, $index, $alias, $oneToOne) -
    1235    { -
    1236        if ($coll === self::$_null) { -
    1237            return false; -
    1238        } -
    1239        if ($index !== false) { -
    1240            $prev[$alias] =& $coll[$index]; -
    1241        } else { -
    1242            // first check the count (we do not want to get the last element -
    1243            // of an empty collection/array) -
    1244            if (count($coll) > 0) { -
    1245                if (is_array($coll)) { -
    1246                    if ($oneToOne) { -
    1247                        $prev[$alias] =& $coll; -
    1248                    } else { -
    1249                        end($coll); -
    1250                        $prev[$alias] =& $coll[key($coll)]; -
    1251                    } -
    1252                } else { -
    1253                    $prev[$alias] = $coll->getLast(); -
    1254                } -
    1255            } else { -
    1256                if (isset($prev[$alias])) { -
    1257                    unset($prev[$alias]); -
    1258                } -
    1259            } -
    1260        } -
    1261    } -
    1262 -
    1263    /** -
    1264     * @return string                   returns a string representation of this object -
    1265     */ -
    1266    public function __toString() -
    1267    { -
    1268        return Doctrine_Lib::formatSql($this->getQuery()); -
    1269    } -
    1270 -
    1271    /** -
    1272     * Return the parts -
    1273     * -
    1274     * @return array The parts -
    1275     */ -
    1276    public function getParts() -
    1277    { -
    1278        return $this->parts; -
    1279    } -
    1280} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hydrate_Array.html b/tests_old/coverage/Doctrine_Hydrate_Array.html deleted file mode 100644 index 61bd3198d..000000000 --- a/tests_old/coverage/Doctrine_Hydrate_Array.html +++ /dev/null @@ -1,231 +0,0 @@ - - - Coverage for Doctrine_Hydrate_Array - - -

    Coverage for Doctrine_Hydrate_Array

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hydrate_Array -
    24 * defines an array fetching strategy for Doctrine_Hydrate -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Hydrate -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34class Doctrine_Hydrate_Array -
    35{ -
    36    public function getElementCollection($component) -
    37    { -
    38        return array(); -
    39    } -
    40    public function getElement(array $data, $component) -
    41    { -
    42        return $data; -
    43    } -
    44    public function isIdentifiable(array $data, Doctrine_Table $table) -
    45    { -
    46        return ( ! empty($data)); -
    47    } -
    48    public function registerCollection($coll) -
    49    { -
    50 -
    51    } -
    52    public function initRelated(array &$data, $name) -
    53    { -
    54        if ( ! isset($data[$name])) { -
    55            $data[$name] = array(); -
    56        } -
    57        return true; -
    58    } -
    59    public function getNullPointer()  -
    60    { -
    61        return null;     -
    62    } -
    63    public function getLastKey(&$data) -
    64    { -
    65        end($data); -
    66        return key($data); -
    67    } -
    68 -
    69    public function flush() -
    70    { -
    71         -
    72    } -
    73} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hydrate_Record.html b/tests_old/coverage/Doctrine_Hydrate_Record.html deleted file mode 100644 index 6fd342038..000000000 --- a/tests_old/coverage/Doctrine_Hydrate_Record.html +++ /dev/null @@ -1,390 +0,0 @@ - - - Coverage for Doctrine_Hydrate_Record - - -

    Coverage for Doctrine_Hydrate_Record

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hydrate_Record  -
    24 * defines a record fetching strategy for Doctrine_Hydrate -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Hydrate -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34class Doctrine_Hydrate_Record extends Doctrine_Locator_Injectable -
    35{ -
    36    protected $_collections = array(); -
    37     -
    38    protected $_records = array(); -
    39     -
    40    protected $_tables = array(); -
    41 -
    42    public function getElementCollection($component) -
    43    { -
    44        $coll = new Doctrine_Collection($component); -
    45        $this->_collections[] = $coll; -
    46 -
    47        return $coll; -
    48    } -
    49 -
    50    public function getLastKey($coll)  -
    51    { -
    52        $coll->end(); -
    53         -
    54        return $coll->key(); -
    55    } -
    56    public function initRelated($record, $name) -
    57    { -
    58        if ( ! is_array($record)) { -
    59            $record[$name]; -
    60 -
    61            return true; -
    62        } -
    63        return false; -
    64    } -
    65    public function registerCollection(Doctrine_Collection $coll) -
    66    { -
    67        $this->_collections[] = $coll; -
    68    } -
    69 -
    70    /** -
    71     * isIdentifiable -
    72     * returns whether or not a given data row is identifiable (it contains -
    73     * all primary key fields specified in the second argument) -
    74     * -
    75     * @param array $row -
    76     * @param Doctrine_Table $table -
    77     * @return boolean -
    78     */ -
    79    public function isIdentifiable(array $row, Doctrine_Table $table) -
    80    { -
    81        $primaryKeys = $table->getIdentifier(); -
    82 -
    83        if (is_array($primaryKeys)) { -
    84            foreach ($primaryKeys as $id) { -
    85                if ( ! isset($row[$id])) { -
    86                    return false; -
    87                } -
    88            } -
    89        } else { -
    90            if ( ! isset($row[$primaryKeys])) { -
    91                return false; -
    92            } -
    93        } -
    94        return true; -
    95    } -
    96    public function getNullPointer()  -
    97    { -
    98        return self::$_null; -
    99    } -
    100    public function getElement(array $data, $component) -
    101    { -
    102        if ( ! isset($this->_tables[$component])) { -
    103            $this->_tables[$component] = Doctrine_Manager::getInstance()->getTable($component); -
    104            $this->_tables[$component]->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, false); -
    105        } -
    106        $this->_tables[$component]->setData($data); -
    107        $record = $this->_tables[$component]->getRecord(); -
    108 -
    109        if ( ! isset($this->_records[$record->getOid()]) ) { -
    110            $record->clearRelated(); -
    111            $this->_records[$record->getOid()] = $record; -
    112        } -
    113 -
    114        return $record; -
    115    } -
    116    public function flush() -
    117    { -
    118        // take snapshots from all initialized collections -
    119        foreach ($this->_collections as $key => $coll) { -
    120            $coll->takeSnapshot(); -
    121        } -
    122        foreach ($this->_tables as $table) { -
    123            $table->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, true); -
    124        } -
    125    } -
    126} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hydrator.html b/tests_old/coverage/Doctrine_Hydrator.html deleted file mode 100644 index 497431085..000000000 --- a/tests_old/coverage/Doctrine_Hydrator.html +++ /dev/null @@ -1,1002 +0,0 @@ - - - Coverage for Doctrine_Hydrator - - -

    Coverage for Doctrine_Hydrator

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Hydrate.php 3192 2007-11-19 17:55:23Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hydrate is a base class for Doctrine_RawSql and Doctrine_Query. -
    24 * Its purpose is to populate object graphs. -
    25 * -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Hydrate -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3192 $ -
    33 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    34 */ -
    35class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract -
    36{     -
    37    /** -
    38     * hydrateResultSet -
    39     * parses the data returned by statement object -
    40     * -
    41     * This is method defines the core of Doctrine's object population algorithm -
    42     * hence this method strives to be as fast as possible -
    43     * -
    44     * The key idea is the loop over the rowset only once doing all the needed operations -
    45     * within this massive loop. -
    46     * -
    47     * @todo: Detailed documentation. Refactor (too long & nesting level). -
    48     * -
    49     * @param mixed $stmt -
    50     * @param array $tableAliases  Array that maps table aliases (SQL alias => DQL alias) -
    51     * @param array $aliasMap  Array that maps DQL aliases to their components -
    52     *                         (DQL alias => array( -
    53     *                              'table' => Table object, -
    54     *                              'parent' => Parent DQL alias (if any), -
    55     *                              'relation' => Relation object (if any), -
    56     *                              'map' => Custom index to use as the key in the result (if any) -
    57     *                              ) -
    58     *                         ) -
    59     * @return array -
    60     */ -
    61    public function hydrateResultSet($stmt, $tableAliases, $hydrationMode = null) -
    62    { -
    63        //$s = microtime(true); -
    64         -
    65        $this->_tableAliases = $tableAliases; -
    66         -
    67        if ($hydrationMode == Doctrine::HYDRATE_NONE) { -
    68            return $stmt->fetchAll(PDO::FETCH_NUM); -
    69        } -
    70         -
    71        if ($hydrationMode === null) { -
    72            $hydrationMode = $this->_hydrationMode; -
    73        } -
    74 -
    75        if ($hydrationMode === Doctrine::HYDRATE_ARRAY) { -
    76            $driver = new Doctrine_Hydrator_ArrayDriver(); -
    77        } else { -
    78            $driver = new Doctrine_Hydrator_RecordDriver(); -
    79        } -
    80 -
    81        $event = new Doctrine_Event(null, Doctrine_Event::HYDRATE, null); -
    82 -
    83 -
    84        // Used variables during hydration -
    85        reset($this->_queryComponents); -
    86        $rootAlias = key($this->_queryComponents); -
    87        $rootComponentName = $this->_queryComponents[$rootAlias]['table']->getComponentName(); -
    88        // if only one component is involved we can make our lives easier -
    89        $isSimpleQuery = count($this->_queryComponents) <= 1; -
    90        // Holds the resulting hydrated data structure -
    91        $result = array(); -
    92        // Holds hydration listeners that get called during hydration -
    93        $listeners = array(); -
    94        // Lookup map to quickly discover/lookup existing records in the result  -
    95        $identifierMap = array(); -
    96        // Holds for each component the last previously seen element in the result set -
    97        $prev = array(); -
    98        // holds the values of the identifier/primary key fields of components, -
    99        // separated by a pipe '|' and grouped by component alias (r, u, i, ... whatever) -
    100        $id = array();  -
    101         -
    102        $result = $driver->getElementCollection($rootComponentName); -
    103 -
    104        if ($stmt === false || $stmt === 0) { -
    105            return $result; -
    106        } -
    107 -
    108        // Initialize -
    109        foreach ($this->_queryComponents as $dqlAlias => $data) { -
    110            $componentName = $data['table']->getComponentName(); -
    111            $listeners[$componentName] = $data['table']->getRecordListener(); -
    112            $identifierMap[$dqlAlias] = array(); -
    113            $prev[$dqlAlias] = array(); -
    114            $id[$dqlAlias] = ''; -
    115        } -
    116         -
    117        // Process result set -
    118        $cache = array(); -
    119        while ($data = $stmt->fetch(Doctrine::FETCH_ASSOC)) { -
    120            $nonemptyComponents = array(); -
    121            $rowData = $this->_gatherRowData($data, $cache, $id, $nonemptyComponents); -
    122 -
    123            // -
    124            // hydrate the data of the root component from the current row -
    125            // -
    126            $table = $this->_queryComponents[$rootAlias]['table']; -
    127            $componentName = $table->getComponentName(); -
    128            $event->set('data', $rowData[$rootAlias]); -
    129            $listeners[$componentName]->preHydrate($event); -
    130            $element = $driver->getElement($rowData[$rootAlias], $componentName); -
    131            $index = false; -
    132             -
    133            // Check for an existing element -
    134            if ($isSimpleQuery || ! isset($identifierMap[$rootAlias][$id[$rootAlias]])) { -
    135                $event->set('data', $element); -
    136                $listeners[$componentName]->postHydrate($event); -
    137 -
    138                // do we need to index by a custom field? -
    139                if ($field = $this->_getCustomIndexField($rootAlias)) { -
    140                    if (isset($result[$field])) { -
    141                        throw new Doctrine_Hydrator_Exception("Couldn't hydrate. Found non-unique key mapping."); -
    142                    } else if ( ! isset($element[$field])) { -
    143                        throw new Doctrine_Hydrator_Exception("Couldn't hydrate. Found a non-existent key."); -
    144                    } -
    145                    $result[$element[$field]] = $element; -
    146                } else { -
    147                    $result[] = $element; -
    148                } -
    149 -
    150                $identifierMap[$rootAlias][$id[$rootAlias]] = $driver->getLastKey($result); -
    151            } else { -
    152                $index = $identifierMap[$rootAlias][$id[$rootAlias]]; -
    153            } -
    154 -
    155            $this->_setLastElement($prev, $result, $index, $rootAlias, false); -
    156            unset($rowData[$rootAlias]); -
    157             -
    158            // end hydrate data of the root component for the current row -
    159             -
    160             -
    161            // $prev[$rootAlias] now points to the last element in $result. -
    162            // now hydrate the rest of the data found in the current row, that belongs to other -
    163            // (related) components. -
    164            $oneToOne = false; -
    165            foreach ($rowData as $dqlAlias => $data) { -
    166                $index = false; -
    167                $map   = $this->_queryComponents[$dqlAlias]; -
    168                $table = $map['table']; -
    169                $componentName = $table->getComponentName(); -
    170                $event->set('data', $data); -
    171                $listeners[$componentName]->preHydrate($event); -
    172 -
    173                $element = $driver->getElement($data, $componentName); -
    174 -
    175                $parent   = $map['parent']; -
    176                $relation = $map['relation']; -
    177                $relationAlias = $map['relation']->getAlias(); -
    178 -
    179                $path = $parent . '.' . $dqlAlias; -
    180 -
    181                if ( ! isset($prev[$parent])) { -
    182                    break; -
    183                } -
    184                 -
    185                // check the type of the relation -
    186                if ( ! $relation->isOneToOne() && $driver->initRelated($prev[$parent], $relationAlias)) { -
    187                    // append element -
    188                    if (isset($nonemptyComponents[$dqlAlias])) { -
    189                        if ($isSimpleQuery || ! isset($identifierMap[$path][$id[$parent]][$id[$dqlAlias]])) { -
    190                            $event->set('data', $element); -
    191                            $listeners[$componentName]->postHydrate($event); -
    192 -
    193                            if ($field = $this->_getCustomIndexField($dqlAlias)) { -
    194                                if (isset($prev[$parent][$relationAlias][$field])) { -
    195                                    throw new Doctrine_Hydrator_Exception("Couldn't hydrate. Found non-unique key mapping."); -
    196                                } else if ( ! isset($element[$field])) { -
    197                                    throw new Doctrine_Hydrator_Exception("Couldn't hydrate. Found a non-existent key."); -
    198                                } -
    199                                $prev[$parent][$relationAlias][$element[$field]] = $element; -
    200                            } else { -
    201                                $prev[$parent][$relationAlias][] = $element; -
    202                            } -
    203 -
    204                            $identifierMap[$path][$id[$parent]][$id[$dqlAlias]] = $driver->getLastKey($prev[$parent][$relationAlias]); -
    205                        } else { -
    206                            $index = $identifierMap[$path][$id[$parent]][$id[$dqlAlias]]; -
    207                        } -
    208                    } -
    209                    // register collection for later snapshots -
    210                    $driver->registerCollection($prev[$parent][$relationAlias]); -
    211                } else { -
    212                    // 1-1 relation -
    213                    $oneToOne = true;  -
    214                    if ( ! isset($nonemptyComponents[$dqlAlias])) { -
    215                        $prev[$parent][$relationAlias] = $driver->getNullPointer(); -
    216                    } else { -
    217                        $prev[$parent][$relationAlias] = $element; -
    218                    } -
    219                } -
    220                $coll =& $prev[$parent][$relationAlias]; -
    221                $this->_setLastElement($prev, $coll, $index, $dqlAlias, $oneToOne); -
    222                $id[$dqlAlias] = ''; -
    223            } -
    224            $id[$rootAlias] = ''; -
    225        } -
    226         -
    227        $stmt->closeCursor(); -
    228         -
    229        $driver->flush(); -
    230         -
    231        //$e = microtime(true); -
    232        //echo 'Hydration took: ' . ($e - $s) . ' for '.count($result).' records<br />'; -
    233 -
    234        return $result; -
    235    } -
    236 -
    237    /** -
    238     * _setLastElement -
    239     * -
    240     * sets the last element of given data array / collection -
    241     * as previous element -
    242     * -
    243     * @param boolean|integer $index -
    244     * @return void -
    245     * @todo Detailed documentation -
    246     */ -
    247    protected function _setLastElement(&$prev, &$coll, $index, $dqlAlias, $oneToOne) -
    248    { -
    249        if ($coll === self::$_null) { -
    250            return false; -
    251        } -
    252         -
    253        if ($index !== false) { -
    254            // Link element at $index to previous element for the component  -
    255            // identified by the DQL alias $alias -
    256            $prev[$dqlAlias] =& $coll[$index]; -
    257            return; -
    258        } -
    259         -
    260        if (is_array($coll) && $coll) { -
    261            if ($oneToOne) { -
    262                $prev[$dqlAlias] =& $coll; -
    263            } else { -
    264                end($coll); -
    265                $prev[$dqlAlias] =& $coll[key($coll)]; -
    266            } -
    267        } else if (count($coll) > 0) { -
    268            $prev[$dqlAlias] = $coll->getLast(); -
    269        } else if (isset($prev[$dqlAlias])) { -
    270            unset($prev[$dqlAlias]); -
    271        } -
    272    } -
    273     -
    274    /** -
    275     * Puts the fields of a data row into a new array, grouped by the component -
    276     * they belong to. The column names in the result set are mapped to their  -
    277     * field names during this procedure. -
    278     *  -
    279     * @return array  An array with all the fields (name => value) of the data row,  -
    280     *                grouped by their component (alias). -
    281     */ -
    282    protected function _gatherRowData(&$data, &$cache, &$id, &$nonemptyComponents) -
    283    { -
    284        $rowData = array(); -
    285 -
    286        foreach ($data as $key => $value) { -
    287            // Parse each column name only once. Cache the results. -
    288            if ( ! isset($cache[$key])) { -
    289                $e = explode('__', $key); -
    290                $last = strtolower(array_pop($e)); -
    291                $cache[$key]['dqlAlias'] = $this->_tableAliases[strtolower(implode('__', $e))]; -
    292                $fieldName = $this->_queryComponents[$cache[$key]['dqlAlias']]['table']->getFieldName($last); -
    293                $cache[$key]['fieldName'] = $fieldName; -
    294            } -
    295 -
    296            $map   = $this->_queryComponents[$cache[$key]['dqlAlias']]; -
    297            $table = $map['table']; -
    298            $dqlAlias = $cache[$key]['dqlAlias']; -
    299            $fieldName = $cache[$key]['fieldName']; -
    300 -
    301            if (isset($this->_queryComponents[$dqlAlias]['agg'][$fieldName])) { -
    302                $fieldName = $this->_queryComponents[$dqlAlias]['agg'][$fieldName]; -
    303            } -
    304 -
    305            if ($table->isIdentifier($fieldName)) { -
    306                $id[$dqlAlias] .= '|' . $value; -
    307            } -
    308 -
    309            $rowData[$dqlAlias][$fieldName] = $table->prepareValue($fieldName, $value); -
    310 -
    311            if ( ! isset($nonemptyComponents[$dqlAlias]) && $value !== null) { -
    312                $nonemptyComponents[$dqlAlias] = true; -
    313            } -
    314        } -
    315         -
    316        return $rowData; -
    317    } -
    318     -
    319    /**  -
    320     * Gets the custom field used for indexing for the specified component alias. -
    321     *  -
    322     * @return string  The field name of the field used for indexing or NULL -
    323     *                 if the component does not use any custom field indices. -
    324     */ -
    325    protected function _getCustomIndexField($alias) -
    326    { -
    327        return isset($this->_queryComponents[$alias]['map']) ? $this->_queryComponents[$alias]['map'] : null; -
    328    } -
    329     -
    330} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hydrator_Abstract.html b/tests_old/coverage/Doctrine_Hydrator_Abstract.html deleted file mode 100644 index 49abe1425..000000000 --- a/tests_old/coverage/Doctrine_Hydrator_Abstract.html +++ /dev/null @@ -1,357 +0,0 @@ - - - Coverage for Doctrine_Hydrator_Abstract - - -

    Coverage for Doctrine_Hydrator_Abstract

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Hydrate.php 3192 2007-11-19 17:55:23Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hydrator_Abstract -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Hydrate -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3192 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33abstract class Doctrine_Hydrator_Abstract extends Doctrine_Locator_Injectable -
    34{ -
    35    /** -
    36     * @var array $_aliasMap                    two dimensional array containing the map for query aliases -
    37     *      Main keys are component aliases -
    38     * -
    39     *          table               table object associated with given alias -
    40     * -
    41     *          relation            the relation object owned by the parent -
    42     * -
    43     *          parent              the alias of the parent -
    44     * -
    45     *          agg                 the aggregates of this component -
    46     * -
    47     *          map                 the name of the column / aggregate value this -
    48     *                              component is mapped to a collection -
    49     */ -
    50    protected $_queryComponents = array(); -
    51 -
    52    /** -
    53     * The current hydration mode. -
    54     */ -
    55    protected $_hydrationMode = Doctrine::HYDRATE_RECORD; -
    56 -
    57    /** -
    58     * constructor -
    59     * -
    60     * @param Doctrine_Connection|null $connection -
    61     */ -
    62    public function __construct() {} -
    63 -
    64    /** -
    65     * Sets the fetchmode. -
    66     * -
    67     * @param integer $fetchmode  One of the Doctrine::HYDRATE_* constants. -
    68     */ -
    69    public function setHydrationMode($hydrationMode) -
    70    { -
    71        $this->_hydrationMode = $hydrationMode; -
    72    } -
    73 -
    74    /** -
    75     * setAliasMap -
    76     * sets the whole component alias map -
    77     * -
    78     * @param array $map            alias map -
    79     * @return Doctrine_Hydrate     this object -
    80     */ -
    81    public function setQueryComponents(array $queryComponents) -
    82    { -
    83        $this->_queryComponents = $queryComponents; -
    84    } -
    85 -
    86    /** -
    87     * getAliasMap -
    88     * returns the component alias map -
    89     * -
    90     * @return array    component alias map -
    91     */ -
    92    public function getQueryComponents() -
    93    { -
    94        return $this->_queryComponents; -
    95    } -
    96 -
    97    /** -
    98     * parseData -
    99     * parses the data returned by statement object -
    100     * -
    101     * This is method defines the core of Doctrine object population algorithm -
    102     * hence this method strives to be as fast as possible -
    103     * -
    104     * The key idea is the loop over the rowset only once doing all the needed operations -
    105     * within this massive loop. -
    106     * -
    107     * @todo: Can we refactor this function so that it is not so long and  -
    108     * nested? -
    109     * -
    110     * @param mixed $stmt -
    111     * @return array -
    112     */ -
    113    abstract public function hydrateResultSet($stmt, $tableAliases, $hydrationMode = null); -
    114     -
    115} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hydrator_ArrayDriver.html b/tests_old/coverage/Doctrine_Hydrator_ArrayDriver.html deleted file mode 100644 index 432a6b6ed..000000000 --- a/tests_old/coverage/Doctrine_Hydrator_ArrayDriver.html +++ /dev/null @@ -1,231 +0,0 @@ - - - Coverage for Doctrine_Hydrator_ArrayDriver - - -

    Coverage for Doctrine_Hydrator_ArrayDriver

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hydrate_Array -
    24 * defines an array fetching strategy for Doctrine_Hydrate -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Hydrate -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34class Doctrine_Hydrator_ArrayDriver -
    35{ -
    36    public function getElementCollection($component) -
    37    { -
    38        return array(); -
    39    } -
    40    public function getElement(array $data, $component) -
    41    { -
    42        return $data; -
    43    } -
    44    public function isIdentifiable(array $data, Doctrine_Table $table) -
    45    { -
    46        return ( ! empty($data)); -
    47    } -
    48    public function registerCollection($coll) -
    49    { -
    50 -
    51    } -
    52    public function initRelated(array &$data, $name) -
    53    { -
    54        if ( ! isset($data[$name])) { -
    55            $data[$name] = array(); -
    56        } -
    57        return true; -
    58    } -
    59    public function getNullPointer()  -
    60    { -
    61        return null;     -
    62    } -
    63    public function getLastKey(&$data) -
    64    { -
    65        end($data); -
    66        return key($data); -
    67    } -
    68 -
    69    public function flush() -
    70    { -
    71         -
    72    } -
    73} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Hydrator_RecordDriver.html b/tests_old/coverage/Doctrine_Hydrator_RecordDriver.html deleted file mode 100644 index 569c80a65..000000000 --- a/tests_old/coverage/Doctrine_Hydrator_RecordDriver.html +++ /dev/null @@ -1,414 +0,0 @@ - - - Coverage for Doctrine_Hydrator_RecordDriver - - -

    Coverage for Doctrine_Hydrator_RecordDriver

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Hydrate_Record  -
    24 * defines a record fetching strategy for Doctrine_Hydrate -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Hydrate -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34class Doctrine_Hydrator_RecordDriver extends Doctrine_Locator_Injectable -
    35{ -
    36    protected $_collections = array(); -
    37     -
    38    protected $_records = array(); -
    39     -
    40    protected $_tables = array(); -
    41 -
    42    public function getElementCollection($component) -
    43    { -
    44        $coll = new Doctrine_Collection($component); -
    45        $this->_collections[] = $coll; -
    46 -
    47        return $coll; -
    48    } -
    49 -
    50    public function getLastKey($coll)  -
    51    { -
    52        $coll->end(); -
    53         -
    54        return $coll->key(); -
    55    } -
    56     -
    57    public function initRelated($record, $name) -
    58    { -
    59        return true; -
    60        /* -
    61        if ( ! is_array($record)) { -
    62            $record[$name]; -
    63            return true; -
    64        } -
    65        return false; -
    66        */ -
    67    } -
    68     -
    69    public function registerCollection(Doctrine_Collection $coll) -
    70    { -
    71        $this->_collections[] = $coll; -
    72    } -
    73 -
    74    /** -
    75     * isIdentifiable -
    76     * returns whether or not a given data row is identifiable (it contains -
    77     * all primary key fields specified in the second argument) -
    78     * -
    79     * @param array $row -
    80     * @param Doctrine_Table $table -
    81     * @return boolean -
    82     */ -
    83    public function isIdentifiable(array $row, Doctrine_Table $table) -
    84    { -
    85        $primaryKeys = $table->getIdentifierColumnNames(); -
    86 -
    87        if (is_array($primaryKeys)) { -
    88            foreach ($primaryKeys as $id) { -
    89                if ( ! isset($row[$id])) { -
    90                    return false; -
    91                } -
    92            } -
    93        } else { -
    94            if ( ! isset($row[$primaryKeys])) { -
    95                return false; -
    96            } -
    97        } -
    98        return true; -
    99    } -
    100     -
    101    public function getNullPointer()  -
    102    { -
    103        return self::$_null; -
    104    } -
    105     -
    106    public function getElement(array $data, $component) -
    107    { -
    108        if ( ! isset($this->_tables[$component])) { -
    109            $this->_tables[$component] = Doctrine_Manager::getInstance()->getTable($component); -
    110            $this->_tables[$component]->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, false); -
    111        } -
    112         -
    113        $this->_tables[$component]->setData($data); -
    114        $record = $this->_tables[$component]->getRecord(); -
    115 -
    116        if ( ! isset($this->_records[$record->getOid()]) ) { -
    117            $record->clearRelated(); -
    118            $this->_records[$record->getOid()] = $record; -
    119        } -
    120 -
    121        return $record; -
    122    } -
    123     -
    124    public function flush() -
    125    { -
    126        // take snapshots from all initialized collections -
    127        foreach ($this->_collections as $key => $coll) { -
    128            $coll->takeSnapshot(); -
    129        } -
    130        foreach ($this->_tables as $table) { -
    131            $table->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, true); -
    132        } -
    133    } -
    134} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_I18n.html b/tests_old/coverage/Doctrine_I18n.html deleted file mode 100644 index 46d50eba2..000000000 --- a/tests_old/coverage/Doctrine_I18n.html +++ /dev/null @@ -1,348 +0,0 @@ - - - Coverage for Doctrine_I18n - - -

    Coverage for Doctrine_I18n

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_I18n -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  I18n -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_I18n extends Doctrine_Plugin -
    34{ -
    35    protected $_options = array( -
    36                            'className'     => '%CLASS%Translation', -
    37                            'fields'        => array(), -
    38                            'generateFiles' => false, -
    39                            'table'         => false, -
    40                            'pluginTable'   => false, -
    41                            'children'      => array(), -
    42                            ); -
    43 -
    44    /** -
    45     * __construct -
    46     * -
    47     * @param string $options  -
    48     * @return void -
    49     */ -
    50    public function __construct($options) -
    51    { -
    52        $this->_options = array_merge($this->_options, $options); -
    53    } -
    54 -
    55    /** -
    56     * buildDefinition -
    57     * -
    58     * @param object $Doctrine_Table  -
    59     * @return void -
    60     */ -
    61    public function buildDefinition() -
    62    { -
    63       if (empty($this->_options['fields'])) { -
    64           throw new Doctrine_I18n_Exception('Fields not set.'); -
    65       } -
    66 -
    67        $name = $this->_options['table']->getComponentName(); -
    68 -
    69        $columns = array(); -
    70 -
    71        $options = array('className' => $this->_options['className']); -
    72 -
    73        $fk = $this->buildForeignKeys($this->_options['table']); -
    74 -
    75        $cols = $this->_options['table']->getColumns(); -
    76 -
    77        foreach ($cols as $column => $definition) { -
    78            if (in_array($column, $this->_options['fields'])) { -
    79                $columns[$column] = $definition; -
    80                $this->_options['table']->removeColumn($column); -
    81            } -
    82        } -
    83 -
    84        $columns['lang'] = array('type'    => 'string', -
    85                                 'length'  => 2, -
    86                                 'fixed'   => true, -
    87                                 'primary' => true); -
    88 -
    89        $local = (count($fk) > 1) ? array_keys($fk) : key($fk); -
    90 -
    91        $relations = array($name => array('local' => $local, -
    92                                          'foreign' => $this->_options['table']->getIdentifier(), -
    93                                          'onDelete' => 'CASCADE', -
    94                                          'onUpdate' => 'CASCADE')); -
    95 -
    96 -
    97        $columns += $fk; -
    98 -
    99        $options = array('className' => $this->_options['className'], -
    100                         'queryParts' => array('indexBy' => 'lang')); -
    101 -
    102        $this->generateClass($options, $columns, $relations); -
    103 -
    104        $this->_options['pluginTable'] = $this->_options['table']->getConnection()->getTable($this->_options['className']); -
    105         -
    106        $this->_options['pluginTable']->bindQueryPart('indexBy', 'lang'); -
    107 -
    108        $this->generateChildDefinitions(); -
    109 -
    110        return true; -
    111    } -
    112} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Import.html b/tests_old/coverage/Doctrine_Import.html deleted file mode 100644 index b3e89049c..000000000 --- a/tests_old/coverage/Doctrine_Import.html +++ /dev/null @@ -1,692 +0,0 @@ - - - Coverage for Doctrine_Import - - -

    Coverage for Doctrine_Import

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Import.php 3062 2007-11-01 23:54:27Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * class Doctrine_Import -
    24 * Main responsible of performing import operation. Delegates database schema -
    25 * reading to a reader object and passes the result to a builder object which -
    26 * builds a Doctrine data model. -
    27 * -
    28 * @package     Doctrine -
    29 * @subpackage  Import -
    30 * @link        www.phpdoctrine.org -
    31 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    32 * @since       1.0 -
    33 * @version     $Revision: 3062 $ -
    34 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    35 * @author      Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com> -
    36 */ -
    37class Doctrine_Import extends Doctrine_Connection_Module -
    38{ -
    39    protected $sql = array(); -
    40 -
    41    /** -
    42     * lists all databases -
    43     * -
    44     * @return array -
    45     */ -
    46    public function listDatabases() -
    47    { -
    48        if ( ! isset($this->sql['listDatabases'])) { -
    49            throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    50        } -
    51 -
    52        return $this->conn->fetchColumn($this->sql['listDatabases']); -
    53    } -
    54 -
    55    /** -
    56     * lists all availible database functions -
    57     * -
    58     * @return array -
    59     */ -
    60    public function listFunctions() -
    61    { -
    62        if ( ! isset($this->sql['listFunctions'])) { -
    63            throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    64        } -
    65 -
    66        return $this->conn->fetchColumn($this->sql['listFunctions']); -
    67    } -
    68 -
    69    /** -
    70     * lists all database triggers -
    71     * -
    72     * @param string|null $database -
    73     * @return array -
    74     */ -
    75    public function listTriggers($database = null) -
    76    { -
    77        throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    78    } -
    79 -
    80    /** -
    81     * lists all database sequences -
    82     * -
    83     * @param string|null $database -
    84     * @return array -
    85     */ -
    86    public function listSequences($database = null) -
    87    { -
    88        if ( ! isset($this->sql['listSequences'])) { -
    89            throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    90        } -
    91 -
    92        return $this->conn->fetchColumn($this->sql['listSequences']); -
    93    } -
    94 -
    95    /** -
    96     * lists table constraints -
    97     * -
    98     * @param string $table     database table name -
    99     * @return array -
    100     */ -
    101    public function listTableConstraints($table) -
    102    { -
    103        throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    104    } -
    105 -
    106    /** -
    107     * lists table constraints -
    108     * -
    109     * @param string $table     database table name -
    110     * @return array -
    111     */ -
    112    public function listTableColumns($table) -
    113    { -
    114        throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    115    } -
    116 -
    117    /** -
    118     * lists table constraints -
    119     * -
    120     * @param string $table     database table name -
    121     * @return array -
    122     */ -
    123    public function listTableIndexes($table) -
    124    { -
    125        throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    126    } -
    127 -
    128    /** -
    129     * lists tables -
    130     * -
    131     * @param string|null $database -
    132     * @return array -
    133     */ -
    134    public function listTables($database = null) -
    135    { -
    136        throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    137    } -
    138 -
    139    /** -
    140     * lists table triggers -
    141     * -
    142     * @param string $table     database table name -
    143     * @return array -
    144     */ -
    145    public function listTableTriggers($table) -
    146    { -
    147        throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    148    } -
    149 -
    150    /** -
    151     * lists table views -
    152     * -
    153     * @param string $table     database table name -
    154     * @return array -
    155     */ -
    156    public function listTableViews($table) -
    157    { -
    158        throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    159    } -
    160 -
    161    /** -
    162     * lists database users -
    163     * -
    164     * @return array -
    165     */ -
    166    public function listUsers() -
    167    { -
    168        if ( ! isset($this->sql['listUsers'])) { -
    169            throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    170        } -
    171 -
    172        return $this->conn->fetchColumn($this->sql['listUsers']); -
    173    } -
    174 -
    175    /** -
    176     * lists database views -
    177     * -
    178     * @param string|null $database -
    179     * @return array -
    180     */ -
    181    public function listViews($database = null) -
    182    { -
    183        if ( ! isset($this->sql['listViews'])) { -
    184            throw new Doctrine_Import_Exception(__FUNCTION__ . ' not supported by this driver.'); -
    185        } -
    186 -
    187        return $this->conn->fetchColumn($this->sql['listViews']); -
    188    } -
    189 -
    190    /** -
    191     * importSchema -
    192     * -
    193     * method for importing existing schema to Doctrine_Record classes -
    194     * -
    195     * @param string $directory -
    196     * @param array $databases -
    197     * @return array                the names of the imported classes -
    198     */ -
    199    public function importSchema($directory, array $databases = array(), array $options = array()) -
    200    { -
    201        $connections = Doctrine_Manager::getInstance()->getConnections(); -
    202         -
    203        foreach ($connections as $name => $connection) { -
    204          // Limit the databases to the ones specified by $databases. -
    205          // Check only happens if array is not empty -
    206          if ( ! empty($databases) && !in_array($name, $databases)) { -
    207            continue; -
    208          } -
    209           -
    210          $builder = new Doctrine_Import_Builder(); -
    211          $builder->setTargetPath($directory); -
    212          $builder->setOptions($options); -
    213 -
    214          $classes = array(); -
    215          foreach ($connection->import->listTables() as $table) { -
    216              $builder->buildRecord(array('tableName' => $table, -
    217                                          'className' => Doctrine::classify($table)), -
    218                                          $connection->import->listTableColumns($table), -
    219                                          array()); -
    220         -
    221              $classes[] = Doctrine::classify($table); -
    222          } -
    223        } -
    224         -
    225        return $classes; -
    226    } -
    227}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Import_Builder.html b/tests_old/coverage/Doctrine_Import_Builder.html deleted file mode 100644 index e59cf4461..000000000 --- a/tests_old/coverage/Doctrine_Import_Builder.html +++ /dev/null @@ -1,2502 +0,0 @@ - - - Coverage for Doctrine_Import_Builder - - -

    Coverage for Doctrine_Import_Builder

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Builder.php 3174 2007-11-15 23:26:29Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Import_Builder -
    24 * -
    25 * Import builder is responsible of building Doctrine_Record classes -
    26 * based on a database schema. -
    27 * -
    28 * @package     Doctrine -
    29 * @subpackage  Import -
    30 * @link        www.phpdoctrine.org -
    31 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    32 * @since       1.0 -
    33 * @version     $Revision: 3174 $ -
    34 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    35 * @author      Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com> -
    36 * @author      Nicolas Bérard-Nault <nicobn@php.net> -
    37 * @author      Jonathan H. Wage <jwage@mac.com> -
    38 */ -
    39class Doctrine_Import_Builder -
    40{ -
    41    /** -
    42     * Path -
    43     *  -
    44     * the path where imported files are being generated -
    45     * -
    46     * @var string $_path -
    47     */ -
    48    protected $_path = ''; -
    49     -
    50    /** -
    51     * packagesPrefix -
    52     * -
    53     * @var string -
    54     */ -
    55    protected $_packagesPrefix = 'Package'; -
    56 -
    57    /** -
    58     * packagesPath -
    59     * -
    60     * @var string -
    61     */ -
    62    protected $_packagesPath = ''; -
    63     -
    64    /** -
    65     * suffix -
    66     *  -
    67     * File suffix to use when writing class definitions -
    68     * -
    69     * @var string $suffix -
    70     */ -
    71    protected $_suffix = '.php'; -
    72 -
    73    /** -
    74     * generateBaseClasses -
    75     *  -
    76     * Bool true/false for whether or not to generate base classes -
    77     * -
    78     * @var string $suffix -
    79     */ -
    80    protected $_generateBaseClasses = true; -
    81     -
    82    /** -
    83     * generateTableClasses -
    84     * -
    85     * @var string -
    86     */ -
    87    protected $_generateTableClasses = true; -
    88     -
    89    /** -
    90     * baseClassesDirectory -
    91     *  -
    92     * Directory to put the generate base classes in -
    93     * -
    94     * @var string $suffix -
    95     */ -
    96    protected $_baseClassesDirectory = 'generated'; -
    97     -
    98    /** -
    99     * baseClassName -
    100     * -
    101     * @var string -
    102     */ -
    103    protected $_baseClassName = 'Doctrine_Record'; -
    104     -
    105    /** -
    106     * tpl -
    107     * -
    108     * Class template used for writing classes -
    109     * -
    110     * @var $_tpl -
    111     */ -
    112    protected static $_tpl; -
    113 -
    114    /** -
    115     * __construct -
    116     * -
    117     * @return void -
    118     */ -
    119    public function __construct() -
    120    { -
    121        $this->loadTemplate(); -
    122    } -
    123 -
    124    /** -
    125     * setTargetPath -
    126     * -
    127     * @param string path   the path where imported files are being generated -
    128     * @return -
    129     */ -
    130    public function setTargetPath($path) -
    131    { -
    132        if ( ! $this->_packagesPath) { -
    133            $this->setPackagesPath($path . DIRECTORY_SEPARATOR . 'packages'); -
    134        } -
    135 -
    136        $this->_path = $path; -
    137    } -
    138     -
    139    /** -
    140     * setPackagePath -
    141     * -
    142     * @param string $packagesPrefix  -
    143     * @return void -
    144     */ -
    145    public function setPackagesPrefix($packagesPrefix) -
    146    { -
    147        $this->_packagesPrefix = $packagesPrefix; -
    148    } -
    149 -
    150    /** -
    151     * setPackagesPath -
    152     * -
    153     * @param string $packagesPath  -
    154     * @return void -
    155     */ -
    156    public function setPackagesPath($packagesPath) -
    157    { -
    158        $this->_packagesPath = $packagesPath; -
    159    } -
    160     -
    161    /** -
    162     * generateBaseClasses -
    163     * -
    164     * Specify whether or not to generate classes which extend from generated base classes -
    165     * -
    166     * @param string $bool -
    167     * @return void -
    168     */ -
    169    public function generateBaseClasses($bool = null) -
    170    { -
    171        if ($bool !== null) { -
    172            $this->_generateBaseClasses = $bool; -
    173        } -
    174 -
    175        return $this->_generateBaseClasses; -
    176    } -
    177     -
    178    /** -
    179     * generateTableClasses -
    180     * -
    181     * Specify whether or not to generate table classes which extend from Doctrine_Table -
    182     * -
    183     * @param string $bool -
    184     * @return void -
    185     */ -
    186    public function generateTableClasses($bool = null) -
    187    { -
    188        if ($bool !== null) { -
    189            $this->_generateTableClasses = $bool; -
    190        } -
    191 -
    192        return $this->_generateTableClasses; -
    193    } -
    194 -
    195    /** -
    196     * setBaseClassesDirectory -
    197     * -
    198     * @return void -
    199     */ -
    200    public function setBaseClassesDirectory($baseClassesDirectory) -
    201    { -
    202        $this->_baseClassesDirectory; -
    203    } -
    204     -
    205    /** -
    206     * setBaseClassName -
    207     * -
    208     * @package default -
    209     */ -
    210    public function setBaseClassName($className) -
    211    { -
    212        $this->_baseClassName = $className; -
    213    } -
    214     -
    215    /** -
    216     * setSuffix -
    217     * -
    218     * @param string $suffix  -
    219     * @return void -
    220     */ -
    221    public function setSuffix($suffix) -
    222    { -
    223        $this->_suffix = $suffix; -
    224    } -
    225 -
    226    /** -
    227     * getTargetPath -
    228     * -
    229     * @return string       the path where imported files are being generated -
    230     */ -
    231    public function getTargetPath() -
    232    { -
    233        return $this->_path; -
    234    } -
    235 -
    236    /** -
    237     * setOptions -
    238     * -
    239     * @param string $options  -
    240     * @return void -
    241     */ -
    242    public function setOptions($options) -
    243    { -
    244        if (!empty($options)) { -
    245            foreach ($options as $key => $value) { -
    246                $this->setOption($key, $value); -
    247            } -
    248        } -
    249    } -
    250 -
    251    /** -
    252     * setOption -
    253     * -
    254     * @param string $key  -
    255     * @param string $value  -
    256     * @return void -
    257     */ -
    258    public function setOption($key, $value) -
    259    { -
    260        $name = 'set' . Doctrine::classify($key); -
    261         -
    262        if (method_exists($this, $name)) { -
    263            $this->$name($value); -
    264        } else { -
    265            $key = '_' . $key; -
    266            $this->$key = $value; -
    267        } -
    268    } -
    269 -
    270    /** -
    271     * loadTemplate -
    272     *  -
    273     * Loads the class template used for generating classes -
    274     * -
    275     * @return void -
    276     */ -
    277    public function loadTemplate()  -
    278    { -
    279        if (isset(self::$_tpl)) { -
    280            return; -
    281        } -
    282 -
    283        self::$_tpl =<<<END -
    284/** -
    285 * This class has been auto-generated by the Doctrine ORM Framework -
    286 */ -
    287%sclass %s extends %s -
    288{ -
    289%s -
    290%s -
    291%s -
    292} -
    293END; -
    294    } -
    295 -
    296    /* -
    297     * Build the accessors -
    298     * -
    299     * @param  string $table -
    300     * @param  array  $columns -
    301     */ -
    302    public function buildAccessors(array $options, array $columns) -
    303    { -
    304        $ret = ''; -
    305        foreach ($columns as $name => $column) { -
    306            // getters -
    307            $ret .= "\n  public function get".Doctrine::classify($name)."(\$load = true)\n"; -
    308            $ret .= "  {\n"; -
    309            $ret .= "    return \$this->get('{$name}', \$load);\n"; -
    310            $ret .= "  }\n"; -
    311 -
    312            // setters -
    313            $ret .= "\n  public function set".Doctrine::classify($name)."(\${$name}, \$load = true)\n"; -
    314            $ret .= "  {\n"; -
    315            $ret .= "    return \$this->set('{$name}', \${$name}, \$load);\n"; -
    316            $ret .= "  }\n"; -
    317        } -
    318 -
    319        return $ret; -
    320    } -
    321 -
    322    /* -
    323     * Build the table definition of a Doctrine_Record object -
    324     * -
    325     * @param  string $table -
    326     * @param  array  $tableColumns -
    327     */ -
    328    public function buildTableDefinition(array $options, array $columns, array $relations, array $indexes, array $attributes, array $tableOptions) -
    329    { -
    330        $ret = array(); -
    331         -
    332        $i = 0; -
    333         -
    334        if (isset($options['inheritance']['extends']) && !(isset($options['override_parent']) && $options['override_parent'] == false)) { -
    335            $ret[$i] = "    parent::setTableDefinition();"; -
    336            $i++; -
    337        } -
    338         -
    339        if (isset($options['tableName']) && !empty($options['tableName'])) { -
    340            $ret[$i] = "    ".'$this->setTableName(\''. $options['tableName'].'\');'; -
    341             -
    342            $i++; -
    343        } -
    344         -
    345        foreach ($columns as $name => $column) { -
    346            $ret[$i] = "    ".'$this->hasColumn(\'' . $name . '\', \'' . $column['type'] . '\''; -
    347             -
    348            if ($column['length']) { -
    349                $ret[$i] .= ', ' . $column['length']; -
    350            } else { -
    351                $ret[$i] .= ', null'; -
    352            } -
    353 -
    354            $options = $column; -
    355            $unset = array('name', 'type', 'length', 'ptype'); -
    356            foreach ($options as $key => $value) { -
    357                if (in_array($key, $unset) || $value === null) { -
    358                    unset($options[$key]); -
    359                } -
    360            } -
    361             -
    362            $ret[$i] .= ', ' . var_export($options, true); -
    363             -
    364            $ret[$i] .= ');'; -
    365 -
    366            if ($i < (count($columns) - 1)) { -
    367                $ret[$i] .= PHP_EOL; -
    368            } -
    369            $i++; -
    370        } -
    371         -
    372        $ret[$i] = $this->buildIndexes($indexes); -
    373        $i++; -
    374         -
    375        $ret[$i] = $this->buildAttributes($attributes); -
    376        $i++; -
    377         -
    378        $ret[$i] = $this->buildTableOptions($tableOptions); -
    379         -
    380        $code = implode("\n", $ret); -
    381        $code = trim($code); -
    382         -
    383        if ($code) { -
    384          return "\n  public function setTableDefinition()"."\n  {\n    ".$code."\n  }"; -
    385        } -
    386    } -
    387 -
    388    /** -
    389     * buildTemplates -
    390     * -
    391     * @param string $array  -
    392     * @return void -
    393     */ -
    394    public function buildTemplates(array $templates) -
    395    { -
    396        $build = ''; -
    397        foreach ($templates as $name => $options) { -
    398             -
    399            if (is_array($options) && !empty($options)) { -
    400                $optionsPhp = var_export($options, true); -
    401             -
    402                $build .= "    \$this->loadTemplate('" . $name . "', " . $optionsPhp . ");\n"; -
    403            } else { -
    404                if (isset($templates[0])) { -
    405                    $build .= "    \$this->loadTemplate('" . $options . "');\n"; -
    406                } else { -
    407                    $build .= "    \$this->loadTemplate('" . $name . "');\n"; -
    408                } -
    409            } -
    410        } -
    411         -
    412        return $build; -
    413    } -
    414 -
    415    /** -
    416     * buildActAs -
    417     * -
    418     * @param string $array  -
    419     * @return void -
    420     */ -
    421    public function buildActAs(array $actAs) -
    422    { -
    423        $build = ''; -
    424        foreach ($actAs as $name => $options) { -
    425            if (is_array($options) && !empty($options)) { -
    426                $optionsPhp = var_export($options, true); -
    427                 -
    428                $build .= "    \$this->actAs('" . $name . "', " . $optionsPhp . ");\n"; -
    429            } else { -
    430                if (isset($actAs[0])) { -
    431                    $build .= "    \$this->actAs('" . $options . "');\n"; -
    432                } else { -
    433                    $build .= "    \$this->actAs('" . $name . "');\n"; -
    434                } -
    435            } -
    436        } -
    437         -
    438        return $build; -
    439    } -
    440 -
    441    /** -
    442     * buildAttributes -
    443     * -
    444     * @param string $array  -
    445     * @return void -
    446     */ -
    447    public function buildAttributes(array $attributes) -
    448    { -
    449        $build = "\n"; -
    450        foreach ($attributes as $key => $value) { -
    451           -
    452            if (is_bool($value)) -
    453            { -
    454              $values = $value ? 'true':'false'; -
    455            } else { -
    456                if ( ! is_array($value)) { -
    457                    $value = array($value); -
    458                } -
    459             -
    460                $values = ''; -
    461                foreach ($value as $attr) { -
    462                    $values .= "Doctrine::" . strtoupper($key) . "_" . strtoupper($attr) . ' ^ '; -
    463                } -
    464                 -
    465                // Trim last ^ -
    466                $values = substr($values, 0, strlen($values) - 3); -
    467            } -
    468             -
    469            $build .= "    \$this->setAttribute(Doctrine::ATTR_" . strtoupper($key) . ", " . $values . ");\n"; -
    470        } -
    471         -
    472        return $build; -
    473    } -
    474     -
    475    /** -
    476     * buildTableOptions -
    477     * -
    478     * @param string $array  -
    479     * @return void -
    480     */ -
    481    public function buildTableOptions(array $options) -
    482    { -
    483        $build = ''; -
    484        foreach ($options as $name => $value) { -
    485            $build .= "    \$this->option('$name', " . var_export($value, true) . ");\n"; -
    486        } -
    487         -
    488        return $build; -
    489    } -
    490 -
    491    /** -
    492     * buildIndexes -
    493     * -
    494     * @param string $array  -
    495     * @return void -
    496     */ -
    497    public function buildIndexes(array $indexes) -
    498    { -
    499      $build = ''; -
    500 -
    501      foreach ($indexes as $indexName => $definitions) { -
    502          $build .= "\n    \$this->index('" . $indexName . "'"; -
    503          $build .= ', ' . var_export($definitions, true); -
    504          $build .= ');'; -
    505      } -
    506 -
    507      return $build; -
    508    } -
    509 -
    510    /** -
    511     * buildSetUp -
    512     * -
    513     * @param  array $options  -
    514     * @param  array $columns  -
    515     * @param  array $relations  -
    516     * @return string -
    517     */ -
    518    public function buildSetUp(array $options, array $columns, array $relations, array $templates, array $actAs) -
    519    { -
    520        $ret = array(); -
    521        $i = 0; -
    522         -
    523        if (isset($options['inheritance']['extends']) && !(isset($options['override_parent']) && $options['override_parent'] == false)) { -
    524            $ret[$i] = "    parent::setUp();"; -
    525            $i++; -
    526        } -
    527         -
    528        foreach ($relations as $name => $relation) { -
    529            $class = isset($relation['class']) ? $relation['class']:$name; -
    530            $alias = (isset($relation['alias']) && $relation['alias'] !== $relation['class']) ? ' as ' . $relation['alias'] : ''; -
    531 -
    532            if ( ! isset($relation['type'])) { -
    533                $relation['type'] = Doctrine_Relation::ONE; -
    534            } -
    535 -
    536            if ($relation['type'] === Doctrine_Relation::ONE ||  -
    537                $relation['type'] === Doctrine_Relation::ONE_COMPOSITE) { -
    538                $ret[$i] = "    ".'$this->hasOne(\'' . $class . $alias . '\''; -
    539            } else { -
    540                $ret[$i] = "    ".'$this->hasMany(\'' . $class . $alias . '\''; -
    541            } -
    542             -
    543            $a = array(); -
    544 -
    545            if (isset($relation['refClass'])) { -
    546                $a[] = '\'refClass\' => ' . var_export($relation['refClass'], true); -
    547            } -
    548             -
    549            if (isset($relation['deferred']) && $relation['deferred']) { -
    550                $a[] = '\'default\' => ' . var_export($relation['deferred'], true); -
    551            } -
    552             -
    553            if (isset($relation['local']) && $relation['local']) { -
    554                $a[] = '\'local\' => ' . var_export($relation['local'], true); -
    555            } -
    556             -
    557            if (isset($relation['foreign']) && $relation['foreign']) { -
    558                $a[] = '\'foreign\' => ' . var_export($relation['foreign'], true); -
    559            } -
    560             -
    561            if (isset($relation['onDelete']) && $relation['onDelete']) { -
    562                $a[] = '\'onDelete\' => ' . var_export($relation['onDelete'], true); -
    563            } -
    564             -
    565            if (isset($relation['onUpdate']) && $relation['onUpdate']) { -
    566                $a[] = '\'onUpdate\' => ' . var_export($relation['onUpdate'], true); -
    567            } -
    568             -
    569            if (isset($relation['equal']) && $relation['equal']) {  -
    570                $a[] = '\'equal\' => ' . var_export($relation['equal'], true);  -
    571            } -
    572             -
    573            if ( ! empty($a)) { -
    574                $ret[$i] .= ', ' . 'array('; -
    575                $length = strlen($ret[$i]); -
    576                $ret[$i] .= implode(',' . PHP_EOL . str_repeat(' ', $length), $a) . ')'; -
    577            } -
    578             -
    579            $ret[$i] .= ');'."\n"; -
    580            $i++; -
    581        } -
    582         -
    583        if (isset($options['inheritance']['keyField']) && isset($options['inheritance']['keyValue'])) { -
    584            $i++; -
    585            $ret[$i] = "    ".'$this->setInheritanceMap(array(\''.$options['inheritance']['keyField'].'\' => \''.$options['inheritance']['keyValue'].'\'));'; -
    586        } -
    587         -
    588        $ret[$i] = $this->buildTemplates($templates); -
    589        $i++; -
    590         -
    591        $ret[$i] = $this->buildActAs($actAs); -
    592        $i++; -
    593         -
    594        $code = implode("\n", $ret); -
    595        $code = trim($code); -
    596         -
    597        if ($code) { -
    598          return "\n  public function setUp()\n  {\n    ".$code."\n  }"; -
    599        } -
    600    } -
    601 -
    602    /** -
    603     * buildDefinition -
    604     * -
    605     * @param array $options  -
    606     * @param array $columns  -
    607     * @param array $relations  -
    608     * @param array $indexes  -
    609     * @param array $attributes  -
    610     * @param array $templates  -
    611     * @param array $actAs  -
    612     * @return string -
    613     */ -
    614    public function buildDefinition(array $options, array $columns, array $relations = array(), array $indexes = array(), $attributes = array(), array $templates = array(), array $actAs = array(), array $tableOptions = array()) -
    615    { -
    616        if ( ! isset($options['className'])) { -
    617            throw new Doctrine_Import_Builder_Exception('Missing class name.'); -
    618        } -
    619 -
    620        $abstract = isset($options['abstract']) && $options['abstract'] === true ? 'abstract ':null; -
    621        $className = $options['className']; -
    622        $extends = isset($options['inheritance']['extends']) ? $options['inheritance']['extends']:$this->_baseClassName; -
    623 -
    624        if ( ! (isset($options['no_definition']) && $options['no_definition'] === true)) { -
    625            $definition = $this->buildTableDefinition($options, $columns, $relations, $indexes, $attributes, $tableOptions); -
    626            $setUp = $this->buildSetUp($options, $columns, $relations, $templates, $actAs); -
    627        } else { -
    628            $definition = null; -
    629            $setUp = null; -
    630        } -
    631         -
    632        $accessors = (isset($options['generate_accessors']) && $options['generate_accessors'] === true) ? $this->buildAccessors($options, $columns):null; -
    633         -
    634        $content = sprintf(self::$_tpl, $abstract, -
    635                                       $className, -
    636                                       $extends, -
    637                                       $definition, -
    638                                       $setUp, -
    639                                       $accessors); -
    640         -
    641        return $content; -
    642    } -
    643 -
    644    /** -
    645     * buildRecord -
    646     * -
    647     * @param array $options  -
    648     * @param array $columns  -
    649     * @param array $relations  -
    650     * @param array $indexes  -
    651     * @param array $attributes  -
    652     * @param array $templates  -
    653     * @param array $actAs  -
    654     * @return void= -
    655     */ -
    656    public function buildRecord(array $options, array $columns, array $relations = array(), array $indexes = array(), array $attributes = array(), array $templates = array(), array $actAs = array(), array $tableOptions = array()) -
    657    { -
    658        if ( !isset($options['className'])) { -
    659            throw new Doctrine_Import_Builder_Exception('Missing class name.'); -
    660        } -
    661 -
    662        if ($this->generateBaseClasses()) { -
    663            $options['is_package'] = (isset($options['package']) && $options['package']) ? true:false; -
    664             -
    665            if ($options['is_package']) { -
    666                $e = explode('.', $options['package']); -
    667                $options['package_name'] = $e[0]; -
    668                unset($e[0]); -
    669                 -
    670                $options['package_path'] = implode(DIRECTORY_SEPARATOR, $e); -
    671            } -
    672             -
    673            // Top level definition that extends from all the others -
    674            $topLevel = $options; -
    675            unset($topLevel['tableName']); -
    676             -
    677            // If we have a package then we need to make this extend the package definition and not the base definition -
    678            // The package definition will then extends the base definition -
    679            $topLevel['inheritance']['extends'] = (isset($topLevel['package']) && $topLevel['package']) ? $this->_packagesPrefix . $topLevel['className']:'Base' . $topLevel['className']; -
    680            $topLevel['no_definition'] = true; -
    681            $topLevel['generate_once'] = true; -
    682            $topLevel['is_main_class'] = true; -
    683            unset($topLevel['connection']); -
    684 -
    685            // Package level definition that extends from the base definition -
    686            if (isset($options['package'])) { -
    687                 -
    688                $packageLevel = $options; -
    689                $packageLevel['className'] = $topLevel['inheritance']['extends']; -
    690                $packageLevel['inheritance']['extends'] = 'Base' . $topLevel['className']; -
    691                $packageLevel['no_definition'] = true; -
    692                $packageLevel['abstract'] = true; -
    693                $packageLevel['override_parent'] = true; -
    694                $packageLevel['generate_once'] = true; -
    695                $packageLevel['is_package_class'] = true; -
    696                unset($packageLevel['connection']); -
    697            } -
    698 -
    699            $baseClass = $options; -
    700            $baseClass['className'] = 'Base' . $baseClass['className']; -
    701            $baseClass['abstract'] = true; -
    702            $baseClass['override_parent'] = true; -
    703            $baseClass['is_base_class'] = true; -
    704 -
    705            $this->writeDefinition($baseClass, $columns, $relations, $indexes, $attributes, $templates, $actAs, $tableOptions); -
    706             -
    707            if (!empty($packageLevel)) { -
    708                $this->writeDefinition($packageLevel); -
    709            } -
    710             -
    711            $this->writeDefinition($topLevel); -
    712        } else { -
    713            $this->writeDefinition($options, $columns, $relations, $indexes, $attributes, $templates, $actAs, $tableOptions); -
    714        } -
    715    } -
    716     -
    717    /** -
    718     * writeTableDefinition -
    719     * -
    720     * @return void -
    721     */ -
    722    public function writeTableDefinition($className, $path, $options = array()) -
    723    { -
    724        $className = $className . 'Table'; -
    725         -
    726        $content  = '<?php' . PHP_EOL; -
    727        $content .= sprintf(self::$_tpl, false, -
    728                                       $className, -
    729                                       isset($options['extends']) ? $options['extends']:'Doctrine_Table', -
    730                                       null, -
    731                                       null, -
    732                                       null -
    733                                       ); -
    734         -
    735        Doctrine::makeDirectories($path); -
    736         -
    737        $writePath = $path . DIRECTORY_SEPARATOR . $className . $this->_suffix; -
    738         -
    739        if (!file_exists($writePath)) { -
    740            file_put_contents($writePath, $content); -
    741        } -
    742    } -
    743     -
    744    /** -
    745     * writeDefinition -
    746     * -
    747     * @param array $options  -
    748     * @param array $columns  -
    749     * @param array $relations  -
    750     * @param array $indexes  -
    751     * @param array $attributes  -
    752     * @param array $templates  -
    753     * @param array $actAs  -
    754     * @return void -
    755     */ -
    756    public function writeDefinition(array $options, array $columns = array(), array $relations = array(), array $indexes = array(), array $attributes = array(), array $templates = array(), array $actAs = array(), array $tableOptions = array()) -
    757    { -
    758        $definition = $this->buildDefinition($options, $columns, $relations, $indexes, $attributes, $templates, $actAs, $tableOptions); -
    759 -
    760        $fileName = $options['className'] . $this->_suffix; -
    761 -
    762        $packagesPath = $this->_packagesPath ? $this->_packagesPath:$this->_path; -
    763 -
    764        // If this is a main class that either extends from Base or Package class -
    765        if (isset($options['is_main_class']) && $options['is_main_class']) { -
    766            // If is package then we need to put it in a package subfolder -
    767            if (isset($options['is_package']) && $options['is_package']) { -
    768                $writePath = $this->_path . DIRECTORY_SEPARATOR . $options['package_name']; -
    769                 -
    770                $this->writeTableDefinition($options['className'], $writePath, array('extends' => $options['inheritance']['extends'] . 'Table')); -
    771            // Otherwise lets just put it in the root of the path -
    772            } else { -
    773                $writePath = $this->_path; -
    774                 -
    775                $this->writeTableDefinition($options['className'], $writePath); -
    776            } -
    777        } -
    778 -
    779        // If is the package class then we need to make the path to the complete package -
    780        if (isset($options['is_package_class']) && $options['is_package_class']) { -
    781            $path = str_replace('.', DIRECTORY_SEPARATOR, trim($options['package'])); -
    782             -
    783            $writePath = $packagesPath . DIRECTORY_SEPARATOR . $path; -
    784             -
    785            $this->writeTableDefinition($options['className'], $writePath); -
    786        } -
    787         -
    788        // If it is the base class of the doctrine record definition -
    789        if (isset($options['is_base_class']) && $options['is_base_class']) { -
    790            // If it is a part of a package then we need to put it in a package subfolder -
    791            if (isset($options['is_package']) && $options['is_package']) { -
    792                $writePath  = $this->_path . DIRECTORY_SEPARATOR . $options['package_name'] . DIRECTORY_SEPARATOR . $this->_baseClassesDirectory; -
    793            // Otherwise lets just put it in the root generated folder -
    794            } else { -
    795                $writePath = $this->_path . DIRECTORY_SEPARATOR . $this->_baseClassesDirectory; -
    796            } -
    797        } -
    798 -
    799        if (isset($writePath)) { -
    800            Doctrine::makeDirectories($writePath); -
    801             -
    802            $writePath .= DIRECTORY_SEPARATOR . $fileName; -
    803        } else { -
    804            Doctrine::makeDirectories($this->_path); -
    805             -
    806            $writePath = $this->_path . DIRECTORY_SEPARATOR . $fileName; -
    807        } -
    808 -
    809        $code = "<?php" . PHP_EOL; -
    810 -
    811        if (isset($options['connection']) && $options['connection']) { -
    812            $code .= "// Connection Component Binding\n"; -
    813            $code .= "Doctrine_Manager::getInstance()->bindComponent('" . $options['connectionClassName'] . "', '" . $options['connection'] . "');\n"; -
    814        } -
    815 -
    816        $code .= PHP_EOL . $definition; -
    817 -
    818        if (isset($options['generate_once']) && $options['generate_once'] === true) { -
    819            if (!file_exists($writePath)) { -
    820                $bytes = file_put_contents($writePath, $code); -
    821            } -
    822        } else { -
    823            $bytes = file_put_contents($writePath, $code); -
    824        } -
    825 -
    826        if (isset($bytes) && $bytes === false) { -
    827            throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $writePath); -
    828        } -
    829    } -
    830} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Import_Firebird.html b/tests_old/coverage/Doctrine_Import_Firebird.html deleted file mode 100644 index 785a0d902..000000000 --- a/tests_old/coverage/Doctrine_Import_Firebird.html +++ /dev/null @@ -1,395 +0,0 @@ - - - Coverage for Doctrine_Import_Firebird - - -

    Coverage for Doctrine_Import_Firebird

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Firebird.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Import'); -
    22/** -
    23  * @package     Doctrine -
    24  * @subpackage  Import -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lorenzo Alberton <l.alberton@quipo.it> (PEAR MDB2 Interbase driver) -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @version     $Revision: 2963 $ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Import_Firebird extends Doctrine_Import -
    34{ -
    35    /** -
    36     * list all tables in the current database -
    37     * -
    38     * @return array        data array -
    39     */ -
    40    public function listTables($database = null) -
    41    { -
    42        $query = 'SELECT RDB$RELATION_NAME FROM RDB$RELATIONS WHERE RDB$SYSTEM_FLAG=0 AND RDB$VIEW_BLR IS NULL'; -
    43 -
    44        return $this->conn->fetchColumn($query); -
    45    } -
    46 -
    47    /** -
    48     * list all fields in a tables in the current database -
    49     * -
    50     * @param string $table name of table that should be used in method -
    51     * @return mixed data array on success, a MDB2 error on failure -
    52     * @access public -
    53     */ -
    54    public function listTableFields($table) -
    55    { -
    56        $table = $this->conn->quote(strtoupper($table), 'text'); -
    57        $query = 'SELECT RDB$FIELD_NAME FROM RDB$RELATION_FIELDS WHERE UPPER(RDB$RELATION_NAME) = ' . $table; -
    58 -
    59        return $this->conn->fetchColumn($query); -
    60    } -
    61 -
    62    /** -
    63     * list all users -
    64     * -
    65     * @return array            data array containing all database users -
    66     */ -
    67    public function listUsers() -
    68    { -
    69        return $this->conn->fetchColumn('SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES'); -
    70    } -
    71 -
    72    /** -
    73     * list the views in the database -
    74     * -
    75     * @return array            data array containing all database views -
    76     */ -
    77    public function listViews($database = null) -
    78    { -
    79        return $this->conn->fetchColumn('SELECT DISTINCT RDB$VIEW_NAME FROM RDB$VIEW_RELATIONS'); -
    80    } -
    81 -
    82    /** -
    83     * list the views in the database that reference a given table -
    84     * -
    85     * @param string $table     table for which all references views should be found -
    86     * @return array            data array containing all views for given table -
    87     */ -
    88    public function listTableViews($table) -
    89    { -
    90        $query  = 'SELECT DISTINCT RDB$VIEW_NAME FROM RDB$VIEW_RELATIONS'; -
    91        $table  = $this->conn->quote(strtoupper($table), 'text'); -
    92        $query .= ' WHERE UPPER(RDB$RELATION_NAME) = ' . $table; -
    93 -
    94        return $this->conn->fetchColumn($query); -
    95    } -
    96 -
    97    /** -
    98     * list all functions in the current database -
    99     * -
    100     * @return array              data array containing all availible functions -
    101     */ -
    102    public function listFunctions() -
    103    { -
    104        $query = 'SELECT RDB$FUNCTION_NAME FROM RDB$FUNCTIONS WHERE RDB$SYSTEM_FLAG IS NULL'; -
    105 -
    106        return $this->conn->fetchColumn($query); -
    107    } -
    108 -
    109    /** -
    110     * This function will be called to get all triggers of the -
    111     * current database ($this->conn->getDatabase()) -
    112     * -
    113     * @param  string $table      The name of the table from the -
    114     *                            previous database to query against. -
    115     * @return array              data array containing all triggers for given table -
    116     */ -
    117    public function listTableTriggers($table) -
    118    { -
    119        $query = 'SELECT RDB$TRIGGER_NAME FROM RDB$TRIGGERS WHERE RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0'; -
    120 -
    121        if ( ! is_null($table)) { -
    122            $table = $this->conn->quote(strtoupper($table), 'text'); -
    123            $query .= ' WHERE UPPER(RDB$RELATION_NAME) = ' . $table; -
    124        } -
    125 -
    126        return $this->conn->fetchColumn($query); -
    127    } -
    128}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Import_Mssql.html b/tests_old/coverage/Doctrine_Import_Mssql.html deleted file mode 100644 index 32ffc3dad..000000000 --- a/tests_old/coverage/Doctrine_Import_Mssql.html +++ /dev/null @@ -1,608 +0,0 @@ - - - Coverage for Doctrine_Import_Mssql - - -

    Coverage for Doctrine_Import_Mssql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mssql.php 3018 2007-10-26 14:56:03Z ppetermann $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Import'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  Import -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    28 * @author      Frank M. Kromann <frank@kromann.info> (PEAR MDB2 Mssql driver) -
    29 * @author      David Coallier <davidc@php.net> (PEAR MDB2 Mssql driver) -
    30 * @version     $Revision: 3018 $ -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 */ -
    34class Doctrine_Import_Mssql extends Doctrine_Import -
    35{ -
    36    /** -
    37     * lists all database sequences -
    38     * -
    39     * @param string|null $database -
    40     * @return array -
    41     */ -
    42    public function listSequences($database = null) -
    43    { -
    44        $query = "SELECT name FROM sysobjects WHERE xtype = 'U'"; -
    45        $tableNames = $this->conn->fetchColumn($query); -
    46 -
    47        return array_map(array($this->conn->formatter, 'fixSequenceName'), $tableNames); -
    48    } -
    49 -
    50    /** -
    51     * lists table constraints -
    52     * -
    53     * @param string $table     database table name -
    54     * @return array -
    55     */ -
    56    public function listTableColumns($table) -
    57    { -
    58        $sql     = 'EXEC sp_columns @table_name = ' . $this->conn->quoteIdentifier($table, true); -
    59        $result  = $this->conn->fetchAssoc($sql); -
    60        $columns = array(); -
    61 -
    62        foreach ($result as $key => $val) { -
    63            $val = array_change_key_case($val, CASE_LOWER); -
    64 -
    65            if (strstr($val['type_name'], ' ')) { -
    66                list($type, $identity) = explode(' ', $val['type_name']); -
    67            } else { -
    68                $type = $val['type_name']; -
    69                $identity = ''; -
    70            } -
    71 -
    72            if ($type == 'varchar') { -
    73                $type .= '(' . $val['length'] . ')'; -
    74            } -
    75 -
    76            $decl = $this->conn->dataDict->getPortableDeclaration($val); -
    77 -
    78            $description  = array( -
    79                'name'      => $val['column_name'], -
    80                'ntype'     => $type, -
    81                'type'      => $decl['type'][0], -
    82                'alltypes'  => $decl['type'], -
    83                'length'    => $decl['length'], -
    84                'fixed'     => $decl['fixed'], -
    85                'unsigned'  => $decl['unsigned'], -
    86                'notnull'   => (bool) ($val['is_nullable'] === 'NO'), -
    87                'default'   => $val['column_def'], -
    88                'primary'   => (strtolower($identity) == 'identity'), -
    89            ); -
    90            $columns[$val['column_name']] = $description; -
    91        } -
    92 -
    93        return $columns; -
    94    } -
    95 -
    96    /** -
    97     * lists table constraints -
    98     * -
    99     * @param string $table     database table name -
    100     * @return array -
    101     */ -
    102    public function listTableIndexes($table) -
    103    { -
    104 -
    105    } -
    106 -
    107    /** -
    108     * lists tables -
    109     * -
    110     * @param string|null $database -
    111     * @return array -
    112     */ -
    113    public function listTables($database = null) -
    114    { -
    115        $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; -
    116 -
    117        return $this->conn->fetchColumn($sql); -
    118    } -
    119 -
    120    /** -
    121     * lists all triggers -
    122     * -
    123     * @return array -
    124     */ -
    125    public function listTriggers($database = null) -
    126    { -
    127        $query = "SELECT name FROM sysobjects WHERE xtype = 'TR'"; -
    128 -
    129        $result = $this->conn->fetchColumn($query); -
    130 -
    131        return $result; -
    132    } -
    133 -
    134    /** -
    135     * lists table triggers -
    136     * -
    137     * @param string $table     database table name -
    138     * @return array -
    139     */ -
    140    public function listTableTriggers($table) -
    141    { -
    142        $table = $this->conn->quote($table, 'text'); -
    143        $query = "SELECT name FROM sysobjects WHERE xtype = 'TR' AND object_name(parent_obj) = " . $table; -
    144 -
    145        $result = $this->conn->fetchColumn($query); -
    146 -
    147        return $result; -
    148    } -
    149 -
    150    /** -
    151     * lists table views -
    152     * -
    153     * @param string $table     database table name -
    154     * @return array -
    155     */ -
    156    public function listTableViews($table) -
    157    { -
    158        $keyName = 'INDEX_NAME'; -
    159        $pkName = 'PK_NAME'; -
    160        if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_FIX_CASE) { -
    161            if ($this->conn->getAttribute(Doctrine::ATTR_FIELD_CASE) == CASE_LOWER) { -
    162                $keyName = strtolower($keyName); -
    163                $pkName  = strtolower($pkName); -
    164            } else { -
    165                $keyName = strtoupper($keyName); -
    166                $pkName  = strtoupper($pkName); -
    167            } -
    168        } -
    169        $table = $this->conn->quote($table, 'text'); -
    170        $query = 'EXEC sp_statistics @table_name = ' . $table; -
    171        $indexes = $this->conn->fetchColumn($query, $keyName); -
    172 -
    173        $query = 'EXEC sp_pkeys @table_name = ' . $table; -
    174        $pkAll = $this->conn->fetchColumn($query, $pkName); -
    175 -
    176        $result = array(); -
    177 -
    178        foreach ($indexes as $index) { -
    179            if ( ! in_array($index, $pkAll) && $index != null) { -
    180                $result[] = $this->conn->formatter->fixIndexName($index); -
    181            } -
    182        } -
    183 -
    184        return $result; -
    185    } -
    186 -
    187    /** -
    188     * lists database views -
    189     * -
    190     * @param string|null $database -
    191     * @return array -
    192     */ -
    193    public function listViews($database = null) -
    194    { -
    195        $query = "SELECT name FROM sysobjects WHERE xtype = 'V'"; -
    196 -
    197        return $this->conn->fetchColumn($query); -
    198    } -
    199}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Import_Oracle.html b/tests_old/coverage/Doctrine_Import_Oracle.html deleted file mode 100644 index eb5c9fa81..000000000 --- a/tests_old/coverage/Doctrine_Import_Oracle.html +++ /dev/null @@ -1,729 +0,0 @@ - - - Coverage for Doctrine_Import_Oracle - - -

    Coverage for Doctrine_Import_Oracle

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Oracle.php 3159 2007-11-15 05:16:31Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Import'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  Import -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @version     $Revision: 3159 $ -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 */ -
    31class Doctrine_Import_Oracle extends Doctrine_Import -
    32{ -
    33    /** -
    34     * lists all databases -
    35     * -
    36     * @return array -
    37     */ -
    38    public function listDatabases() -
    39    { -
    40        if ( ! $this->conn->getAttribute(Doctrine::ATTR_EMULATE_DATABASE)) { -
    41            throw new Doctrine_Import_Exception('database listing is only supported if the "emulate_database" option is enabled'); -
    42        } -
    43        /** -
    44        if ($this->conn->options['database_name_prefix']) { -
    45            $query = 'SELECT SUBSTR(username, '; -
    46            $query.= (strlen($this->conn->getAttribute(['database_name_prefix'])+1); -
    47            $query.= ") FROM sys.dba_users WHERE username LIKE '"; -
    48            $query.= $this->conn->options['database_name_prefix']."%'"; -
    49        } else { -
    50        */ -
    51        $query   = 'SELECT username FROM sys.dba_users'; -
    52 -
    53        $result2 = $this->conn->standaloneQuery($query); -
    54        $result  = $result2->fetchColumn(); -
    55 -
    56        return $result; -
    57    } -
    58 -
    59    /** -
    60     * lists all availible database functions -
    61     * -
    62     * @return array -
    63     */ -
    64    public function listFunctions() -
    65    { -
    66        $query = "SELECT name FROM sys.user_source WHERE line = 1 AND type = 'FUNCTION'"; -
    67 -
    68        return $this->conn->fetchColumn($query); -
    69    } -
    70 -
    71    /** -
    72     * lists all database triggers -
    73     * -
    74     * @param string|null $database -
    75     * @return array -
    76     */ -
    77    public function listTriggers($database = null) -
    78    { -
    79 -
    80    } -
    81 -
    82    /** -
    83     * lists all database sequences -
    84     * -
    85     * @param string|null $database -
    86     * @return array -
    87     */ -
    88    public function listSequences($database = null) -
    89    { -
    90        $query = "SELECT sequence_name FROM sys.user_sequences"; -
    91 -
    92        $tableNames = $this->conn->fetchColumn($query); -
    93 -
    94        return array_map(array($this->conn->formatter, 'fixSequenceName'), $tableNames); -
    95    } -
    96 -
    97    /** -
    98     * lists table constraints -
    99     * -
    100     * @param string $table     database table name -
    101     * @return array -
    102     */ -
    103    public function listTableConstraints($table) -
    104    { -
    105        $table = $this->conn->quote($table, 'text'); -
    106 -
    107        $query = 'SELECT index_name name FROM user_constraints' -
    108               . ' WHERE table_name = ' . $table . ' OR table_name = ' . strtoupper($table); -
    109 -
    110        $constraints = $this->conn->fetchColumn($query); -
    111 -
    112        return array_map(array($this->conn->formatter, 'fixIndexName'), $constraints); -
    113    } -
    114 -
    115    /** -
    116     * lists table constraints -
    117     * -
    118     * @param string $table     database table name -
    119     * @return array -
    120     */ -
    121    public function listTableColumns($table) -
    122    { -
    123        $table  = strtoupper($table); -
    124        $sql    = "SELECT column_name, data_type, data_length, nullable, data_default, data_scale, data_precision FROM all_tab_columns" -
    125                . " WHERE table_name = '" . $table . "' ORDER BY column_name"; -
    126 -
    127        $result = $this->conn->fetchAssoc($sql); -
    128 -
    129        $descr = array(); -
    130 -
    131        foreach($result as $val) { -
    132            $val = array_change_key_case($val, CASE_LOWER); -
    133            $decl = $this->conn->dataDict->getPortableDeclaration($val); -
    134 -
    135 -
    136            $descr[$val['column_name']] = array( -
    137               'name'       => $val['column_name'], -
    138               'notnull'    => (bool) ($val['nullable'] === 'N'), -
    139               'ntype'      => $val['data_type'], -
    140               'type'       => $decl['type'][0], -
    141               'alltypes'   => $decl['type'], -
    142               'fixed'      => $decl['fixed'], -
    143               'unsigned'   => $decl['unsigned'], -
    144               'default'    => $val['data_default'], -
    145               'length'     => $val['data_length'], -
    146               'precision'  => $val['data_precision'], -
    147               'scale'      => $val['scale'], -
    148            ); -
    149        } -
    150 -
    151        return $descr; -
    152    } -
    153 -
    154    /** -
    155     * lists table constraints -
    156     * -
    157     * @param string $table     database table name -
    158     * @return array -
    159     */ -
    160    public function listTableIndexes($table) -
    161    { -
    162        $table = $this->conn->quote($table, 'text'); -
    163        $query = 'SELECT index_name name FROM user_indexes' -
    164               . ' WHERE table_name = ' . $table . ' OR table_name = ' . strtoupper($table) -
    165               . ' AND generated = ' . $this->conn->quote('N', 'text'); -
    166 -
    167        $indexes = $this->conn->fetchColumn($query); -
    168 -
    169        return array_map(array($this->conn->formatter, 'fixIndexName'), $indexes); -
    170    } -
    171 -
    172    /** -
    173     * lists tables -
    174     * -
    175     * @param string|null $database -
    176     * @return array -
    177     */ -
    178    public function listTables($database = null) -
    179    { -
    180        $query = 'SELECT table_name FROM sys.user_tables'; -
    181        return $this->conn->fetchColumn($query); -
    182    } -
    183 -
    184    /** -
    185     * lists table triggers -
    186     * -
    187     * @param string $table     database table name -
    188     * @return array -
    189     */ -
    190    public function listTableTriggers($table) -
    191    { -
    192 -
    193    } -
    194 -
    195    /** -
    196     * lists table views -
    197     * -
    198     * @param string $table     database table name -
    199     * @return array -
    200     */ -
    201    public function listTableViews($table) -
    202    { -
    203 -
    204    } -
    205 -
    206    /** -
    207     * lists database users -
    208     * -
    209     * @return array -
    210     */ -
    211    public function listUsers() -
    212    { -
    213        /** -
    214        if ($this->conn->options['emulate_database'] && $this->conn->options['database_name_prefix']) { -
    215            $query = 'SELECT SUBSTR(username, '; -
    216            $query.= (strlen($this->conn->options['database_name_prefix'])+1); -
    217            $query.= ") FROM sys.dba_users WHERE username NOT LIKE '"; -
    218            $query.= $this->conn->options['database_name_prefix']."%'"; -
    219        } else { -
    220        */ -
    221 -
    222        $query = 'SELECT username FROM sys.dba_users'; -
    223        //} -
    224 -
    225        return $this->conn->fetchColumn($query); -
    226    } -
    227 -
    228    /** -
    229     * lists database views -
    230     * -
    231     * @param string|null $database -
    232     * @return array -
    233     */ -
    234    public function listViews($database = null) -
    235    { -
    236        $query = 'SELECT view_name FROM sys.user_views'; -
    237        return $this->conn->fetchColumn($query); -
    238    } -
    239} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Import_Pgsql.html b/tests_old/coverage/Doctrine_Import_Pgsql.html deleted file mode 100644 index 2f46ab352..000000000 --- a/tests_old/coverage/Doctrine_Import_Pgsql.html +++ /dev/null @@ -1,734 +0,0 @@ - - - Coverage for Doctrine_Import_Pgsql - - -

    Coverage for Doctrine_Import_Pgsql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Pgsql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Import'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  Import -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Paul Cooper <pgc@ucecom.com> -
    28 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    29 * @version     $Revision: 2963 $ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Import_Pgsql extends Doctrine_Import -
    34{ -
    35 -
    36    protected $sql = array( -
    37                        'listDatabases' => 'SELECT datname FROM pg_database', -
    38                        'listFunctions' => "SELECT -
    39                                                proname -
    40                                            FROM -
    41                                                pg_proc pr, -
    42                                                pg_type tp -
    43                                            WHERE -
    44                                                tp.oid = pr.prorettype -
    45                                                AND pr.proisagg = FALSE -
    46                                                AND tp.typname <> 'trigger' -
    47                                                AND pr.pronamespace IN -
    48                                                    (SELECT oid FROM pg_namespace -
    49                                                     WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema'", -
    50                        'listSequences' => "SELECT -
    51                                                relname -
    52                                            FROM -
    53                                                pg_class -
    54                                            WHERE relkind = 'S' AND relnamespace IN -
    55                                                (SELECT oid FROM pg_namespace -
    56                                                 WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema')", -
    57                        'listTables'    => "SELECT -
    58                                                c.relname AS table_name -
    59                                            FROM pg_class c, pg_user u -
    60                                            WHERE c.relowner = u.usesysid -
    61                                                AND c.relkind = 'r' -
    62                                                AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) -
    63                                                AND c.relname !~ '^(pg_|sql_)' -
    64                                            UNION -
    65                                            SELECT c.relname AS table_name -
    66                                            FROM pg_class c -
    67                                            WHERE c.relkind = 'r' -
    68                                                AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) -
    69                                                AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) -
    70                                                AND c.relname !~ '^pg_'", -
    71                        'listViews'     => 'SELECT viewname FROM pg_views', -
    72                        'listUsers'     => 'SELECT usename FROM pg_user', -
    73                        'listTableConstraints' => "SELECT -
    74                                                        relname -
    75                                                   FROM -
    76                                                        pg_class -
    77                                                   WHERE oid IN ( -
    78                                                        SELECT indexrelid -
    79                                                        FROM pg_index, pg_class -
    80                                                        WHERE pg_class.relname = %s -
    81                                                            AND pg_class.oid = pg_index.indrelid -
    82                                                            AND (indisunique = 't' OR indisprimary = 't') -
    83                                                        )", -
    84                        'listTableIndexes'     => "SELECT -
    85                                                        relname -
    86                                                   FROM -
    87                                                        pg_class -
    88                                                   WHERE oid IN ( -
    89                                                        SELECT indexrelid -
    90                                                        FROM pg_index, pg_class -
    91                                                        WHERE pg_class.relname = %s -
    92                                                            AND pg_class.oid=pg_index.indrelid -
    93                                                            AND indisunique != 't' -
    94                                                            AND indisprimary != 't' -
    95                                                        )", -
    96                        'listTableColumns'     => "SELECT -
    97                                                        a.attnum, -
    98                                                        a.attname AS field, -
    99                                                        t.typname AS type, -
    100                                                        format_type(a.atttypid, a.atttypmod) AS complete_type, -
    101                                                        a.attnotnull AS isnotnull, -
    102                                                        (SELECT 't' -
    103                                                          FROM pg_index -
    104                                                          WHERE c.oid = pg_index.indrelid -
    105                                                          AND pg_index.indkey[0] = a.attnum -
    106                                                          AND pg_index.indisprimary = 't' -
    107                                                        ) AS pri, -
    108                                                        (SELECT pg_attrdef.adsrc -
    109                                                          FROM pg_attrdef -
    110                                                          WHERE c.oid = pg_attrdef.adrelid -
    111                                                          AND pg_attrdef.adnum=a.attnum -
    112                                                        ) AS default -
    113                                                  FROM pg_attribute a, pg_class c, pg_type t -
    114                                                  WHERE c.relname = %s -
    115                                                        AND a.attnum > 0 -
    116                                                        AND a.attrelid = c.oid -
    117                                                        AND a.atttypid = t.oid -
    118                                                  ORDER BY a.attnum", -
    119                        ); -
    120 -
    121    /** -
    122     * lists all database triggers -
    123     * -
    124     * @param string|null $database -
    125     * @return array -
    126     */ -
    127    public function listTriggers($database = null) -
    128    { -
    129 -
    130    } -
    131 -
    132    /** -
    133     * lists table constraints -
    134     * -
    135     * @param string $table     database table name -
    136     * @return array -
    137     */ -
    138    public function listTableConstraints($table) -
    139    { -
    140        $table = $this->conn->quote($table); -
    141        $query = sprintf($this->sql['listTableConstraints'], $table); -
    142 -
    143        return $this->conn->fetchColumn($query); -
    144    } -
    145 -
    146    /** -
    147     * lists table constraints -
    148     * -
    149     * @param string $table     database table name -
    150     * @return array -
    151     */ -
    152    public function listTableColumns($table) -
    153    { -
    154        $table = $this->conn->quote($table); -
    155        $query = sprintf($this->sql['listTableColumns'], $table); -
    156        $result = $this->conn->fetchAssoc($query); -
    157 -
    158        $columns     = array(); -
    159        foreach ($result as $key => $val) { -
    160            $val = array_change_key_case($val, CASE_LOWER); -
    161 -
    162            if (strtolower($val['type']) === 'varchar') { -
    163                // get length from varchar definition -
    164                $length = preg_replace('~.*\(([0-9]*)\).*~', '$1', $val['complete_type']); -
    165                $val['length'] = $length; -
    166            } -
    167             -
    168            $decl = $this->conn->dataDict->getPortableDeclaration($val); -
    169 -
    170            $description = array( -
    171                'name'      => $val['field'], -
    172                'ntype'     => $val['type'], -
    173                'type'      => $decl['type'][0], -
    174                'alltypes'  => $decl['type'], -
    175                'length'    => $decl['length'], -
    176                'fixed'     => $decl['fixed'], -
    177                'unsigned'  => $decl['unsigned'], -
    178                'notnull'   => ($val['isnotnull'] == ''), -
    179                'default'   => $val['default'], -
    180                'primary'   => ($val['pri'] == 't'), -
    181            ); -
    182            $columns[$val['field']] = $description; -
    183        } -
    184        return $columns; -
    185    } -
    186 -
    187    /** -
    188     * list all indexes in a table -
    189     * -
    190     * @param string $table     database table name -
    191     * @return array -
    192     */ -
    193    public function listTableIndexes($table) -
    194    { -
    195        $table = $this->conn->quote($table); -
    196        $query = sprintf($this->sql['listTableIndexes'], $table); -
    197 -
    198        return $this->conn->fetchColumn($query); -
    199    } -
    200 -
    201    /** -
    202     * lists tables -
    203     * -
    204     * @param string|null $database -
    205     * @return array -
    206     */ -
    207    public function listTables($database = null) -
    208    { -
    209        return $this->conn->fetchColumn($this->sql['listTables']); -
    210    } -
    211 -
    212    /** -
    213     * lists table triggers -
    214     * -
    215     * @param string $table     database table name -
    216     * @return array -
    217     */ -
    218    public function listTableTriggers($table) -
    219    { -
    220        $query = 'SELECT trg.tgname AS trigger_name -
    221                    FROM pg_trigger trg, -
    222                         pg_class tbl -
    223                   WHERE trg.tgrelid = tbl.oid'; -
    224        if ($table !== null) { -
    225            $table = $this->conn->quote(strtoupper($table), 'string'); -
    226            $query .= " AND tbl.relname = $table"; -
    227        } -
    228        return $this->conn->fetchColumn($query); -
    229    } -
    230 -
    231    /** -
    232     * list the views in the database that reference a given table -
    233     * -
    234     * @param string $table     database table name -
    235     * @return array -
    236     */ -
    237    public function listTableViews($table) -
    238    { -
    239        return $this->conn->fetchColumn($query); -
    240    } -
    241}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Import_Schema.html b/tests_old/coverage/Doctrine_Import_Schema.html deleted file mode 100644 index 82333df3b..000000000 --- a/tests_old/coverage/Doctrine_Import_Schema.html +++ /dev/null @@ -1,1451 +0,0 @@ - - - Coverage for Doctrine_Import_Schema - - -

    Coverage for Doctrine_Import_Schema

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 * $Id: Schema.php 1838 2007-06-26 00:58:21Z nicobn $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * class Doctrine_Import_Schema -
    24 * -
    25 * Different methods to import a XML schema. The logic behind using two different -
    26 * methods is simple. Some people will like the idea of producing Doctrine_Record -
    27 * objects directly, which is totally fine. But in fast and growing application, -
    28 * table definitions tend to be a little bit more volatile. importArr() can be used -
    29 * to output a table definition in a PHP file. This file can then be stored -
    30 * independantly from the object itself. -
    31 * -
    32 * @package     Doctrine -
    33 * @subpackage  Import -
    34 * @link        www.phpdoctrine.org -
    35 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    36 * @version     $Revision: 1838 $ -
    37 * @author      Nicolas Bérard-Nault <nicobn@gmail.com> -
    38 * @author      Jonathan H. Wage <jonwage@gmail.com> -
    39 */ -
    40class Doctrine_Import_Schema -
    41{ -
    42    protected $_relations = array(); -
    43    protected $_options = array('packagesPrefix'        =>  'Package', -
    44                                'packagesPath'          =>  '', -
    45                                'generateBaseClasses'   =>  true, -
    46                                'generateTableClasses'  =>  true, -
    47                                'baseClassesDirectory'  =>  'generated', -
    48                                'baseClassName'         =>  'Doctrine_Record', -
    49                                'suffix'                =>  '.php'); -
    50     -
    51    /** -
    52     * getOption -
    53     * -
    54     * @param string $name  -
    55     * @return void -
    56     */ -
    57    public function getOption($name) -
    58    { -
    59        if (isset($this->_options[$name]))   { -
    60            return $this->_options[$name]; -
    61        } -
    62    } -
    63     -
    64    /** -
    65     * setOption -
    66     * -
    67     * @param string $name  -
    68     * @param string $value  -
    69     * @return void -
    70     */ -
    71    public function setOption($name, $value) -
    72    { -
    73        if (isset($this->_options[$name])) { -
    74            $this->_options[$name] = $value; -
    75        } -
    76    } -
    77     -
    78    /** -
    79     * setOptions -
    80     * -
    81     * @param string $options  -
    82     * @return void -
    83     */ -
    84    public function setOptions($options) -
    85    { -
    86        if (!empty($options)) { -
    87          $this->_options = $options; -
    88        } -
    89    } -
    90 -
    91    /** -
    92     * buildSchema -
    93     * -
    94     * Loop throug directories of schema files and part them all in to one complete array of schema information -
    95     * -
    96     * @param  string   $schema Array of schema files or single schema file. Array of directories with schema files or single directory -
    97     * @param  string   $format Format of the files we are parsing and building from -
    98     * @return array    $array -
    99     */ -
    100    public function buildSchema($schema, $format) -
    101    { -
    102        $array = array(); -
    103 -
    104        foreach ((array) $schema AS $s) { -
    105            if (is_file($s)) { -
    106                $array = array_merge($array, $this->parseSchema($s, $format)); -
    107            } else if (is_dir($s)) { -
    108                $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($s), -
    109                                                      RecursiveIteratorIterator::LEAVES_ONLY); -
    110 -
    111                foreach ($it as $file) { -
    112                    $e = explode('.', $file->getFileName()); -
    113                    if (end($e) === $format) { -
    114                        $array = array_merge($array, $this->parseSchema($file->getPathName(), $format)); -
    115                    } -
    116                } -
    117            } else { -
    118              $array = array_merge($array, $this->parseSchema($s, $format)); -
    119            } -
    120        } -
    121 -
    122        $this->_buildRelationships($array); -
    123 -
    124        return $array; -
    125    } -
    126 -
    127    /** -
    128     * importSchema -
    129     * -
    130     * A method to import a Schema and translate it into a Doctrine_Record object -
    131     * -
    132     * @param  string $schema       The file containing the XML schema -
    133     * @param  string $directory    The directory where the Doctrine_Record class will be written -
    134     * @param  array $models        Optional array of models to import -
    135     * -
    136     * @return void -
    137     */ -
    138    public function importSchema($schema, $format = 'yml', $directory = null, $models = array()) -
    139    { -
    140        $builder = new Doctrine_Import_Builder(); -
    141        $builder->setTargetPath($directory); -
    142         -
    143        foreach ($this->_options as $key => $value) { -
    144            if ($value) { -
    145                $builder->setOption($key, $value); -
    146            } -
    147        } -
    148         -
    149        $array = $this->buildSchema($schema, $format); -
    150 -
    151        foreach ($array as $name => $properties) { -
    152            if ( ! empty($models) && !in_array($properties['className'], $models)) { -
    153                continue; -
    154            } -
    155             -
    156            $options = $this->getOptions($properties); -
    157            $columns = $this->getColumns($properties); -
    158            $relations = $this->getRelations($properties); -
    159            $indexes = $this->getIndexes($properties); -
    160            $attributes = $this->getAttributes($properties); -
    161            $templates = $this->getTemplates($properties); -
    162            $actAs = $this->getActAs($properties); -
    163            $tableOptions = $this->getTableOptions($properties); -
    164             -
    165            $builder->buildRecord($options, $columns, $relations, $indexes, $attributes, $templates, $actAs, $tableOptions); -
    166        } -
    167    } -
    168 -
    169    /** -
    170     * getOptions -
    171     * -
    172     * @param string $properties Array of table properties -
    173     * @param string $directory  Directory we are writing the class to -
    174     * @return array $options    Array of options from a parse schemas properties -
    175     */ -
    176    public function getOptions($properties) -
    177    { -
    178        $options = array(); -
    179        $options['className'] = $properties['className']; -
    180        $options['tableName'] = isset($properties['tableName']) ? $properties['tableName']:null; -
    181        $options['connection'] = isset($properties['connection']) ? $properties['connection']:null; -
    182        $options['connectionClassName'] = isset($properties['connection']) ? $properties['className']:null; -
    183        $options['package'] = $properties['package']; -
    184         -
    185        if (isset($properties['inheritance'])) { -
    186            $options['inheritance'] = $properties['inheritance']; -
    187        } -
    188 -
    189        return $options; -
    190    } -
    191 -
    192    /** -
    193     * getColumns -
    194     * -
    195     * Get array of columns from table properties -
    196     * -
    197     * @param  string $properties Array of table properties -
    198     * @return array  $columns    Array of columns -
    199     */ -
    200    public function getColumns($properties) -
    201    { -
    202        return isset($properties['columns']) ? $properties['columns']:array(); -
    203    } -
    204 -
    205    /** -
    206     * getRelations -
    207     *  -
    208     * Get array of relations from table properties -
    209     * -
    210     * @param  string $properties Array of tables properties -
    211     * @return array  $relations  Array of relations -
    212     */ -
    213    public function getRelations($properties) -
    214    { -
    215        $all_relations = isset($this->_relations[$properties['className']]) ? $this->_relations[$properties['className']]:array(); -
    216         -
    217        // This is for checking for duplicates between alias-relations and a auto-generated relations to ensure the result set of unique relations -
    218        $exist_relations = array(); -
    219        $unique_relations = array(); -
    220        foreach ($all_relations as $relation) { -
    221            if (!in_array($relation['class'], $exist_relations)) { -
    222                $exist_relations[] = $relation['class']; -
    223                $unique_relations = array_merge($unique_relations, array($relation['alias'] => $relation)); -
    224            } else { -
    225                // check to see if this relationship is not autogenerated, if it's not, then the user must have explicitly declared it -
    226                if (!isset($relation['autogenerated']) || $relation['autogenerated'] != true) { -
    227                    $unique_relations = array_merge($unique_relations, array($relation['alias'] => $relation)); -
    228                } -
    229            } -
    230        } -
    231         -
    232        return $unique_relations; -
    233    } -
    234 -
    235    /** -
    236     * getIndexes -
    237     * -
    238     * Get array of indexes from table properties -
    239     * -
    240     * @param  string $properties Array of table properties -
    241     * @return array  $index -
    242     */ -
    243    public function getIndexes($properties) -
    244    { -
    245        return isset($properties['indexes']) ? $properties['indexes']:array();; -
    246    } -
    247 -
    248    /** -
    249     * getAttributes -
    250     * -
    251     * Get array of attributes from table properties -
    252     * -
    253     * @param  string $properties Array of tables properties  -
    254     * @return array  $attributes -
    255     */ -
    256    public function getAttributes($properties) -
    257    { -
    258        return isset($properties['attributes']) ? $properties['attributes']:array(); -
    259    } -
    260 -
    261    /** -
    262     * getTemplates -
    263     * -
    264     * Get array of templates from table properties -
    265     * -
    266     * @param  string $properties Array of table properties -
    267     * @return array  $templates  Array of table templates -
    268     */ -
    269    public function getTemplates($properties) -
    270    { -
    271        return isset($properties['templates']) ? $properties['templates']:array(); -
    272    } -
    273 -
    274    /** -
    275     * getActAs -
    276     * -
    277     * Get array of actAs definitions from table properties -
    278     * -
    279     * @param  string $properties Array of table properties -
    280     * @return array  $actAs      Array of actAs definitions from table properties -
    281     */ -
    282    public function getActAs($properties) -
    283    { -
    284        return isset($properties['actAs']) ? $properties['actAs']:array(); -
    285    } -
    286     -
    287    /** -
    288     * getTableOptions -
    289     * -
    290     * @param string $properties  -
    291     * @return void -
    292     */ -
    293    public function getTableOptions($properties) -
    294    { -
    295        return isset($properties['options']) ? $properties['options']:array(); -
    296    } -
    297 -
    298    /** -
    299     * parseSchema -
    300     * -
    301     * A method to parse a Schema and translate it into a property array. -
    302     * The function returns that property array. -
    303     * -
    304     * @param  string $schema   Path to the file containing the schema -
    305     * @return array  $build    Built array of schema information -
    306     */ -
    307    public function parseSchema($schema, $type) -
    308    { -
    309        $array = Doctrine_Parser::load($schema, $type); -
    310         -
    311        $build = array(); -
    312         -
    313        foreach ($array as $className => $table) { -
    314            $columns = array(); -
    315             -
    316            $className = isset($table['className']) ? (string) $table['className']:(string) $className; -
    317             -
    318            if (isset($table['tableName']) && $table['tableName']) { -
    319                $tableName = $table['tableName']; -
    320            } else { -
    321                if (isset($table['inheritance']['extends']) && isset($table['inheritance']['extends']['keyType']) && isset($table['inheritance']['extends']['keyValue'])) { -
    322                    $tableName = null; -
    323                } else { -
    324                    $tableName = Doctrine::tableize($className); -
    325                } -
    326            } -
    327             -
    328            $columns = isset($table['columns']) ? $table['columns']:array(); -
    329            $columns = isset($table['fields']) ? $table['fields']:$columns; -
    330             -
    331            if ( ! empty($columns)) { -
    332                foreach ($columns as $columnName => $field) { -
    333                    $colDesc = array(); -
    334                    $colDesc['name'] = $columnName; -
    335                     -
    336                    $e = explode('(', $field['type']); -
    337                    if (isset($e[0]) && isset($e[1])) { -
    338                        $colDesc['type'] = $e[0]; -
    339                        $colDesc['length'] = substr($e[1], 0, strlen($e[1]) - 1); -
    340                    } else { -
    341                        $colDesc['type'] = isset($field['type']) ? (string) $field['type']:null; -
    342                        $colDesc['length'] = isset($field['length']) ? (int) $field['length']:null; -
    343                        $colDesc['length'] = isset($field['size']) ? (int) $field['size']:$colDesc['length']; -
    344                    } -
    345                     -
    346                    $colDesc['ptype'] = isset($field['ptype']) ? (string) $field['ptype']:(string) $colDesc['type']; -
    347                    $colDesc['fixed'] = isset($field['fixed']) ? (int) $field['fixed']:null; -
    348                    $colDesc['primary'] = isset($field['primary']) ? (bool) (isset($field['primary']) && $field['primary']):null; -
    349                    $colDesc['default'] = isset($field['default']) ? $field['default']:null; -
    350                    $colDesc['autoincrement'] = isset($field['autoincrement']) ? (bool) (isset($field['autoincrement']) && $field['autoincrement']):null; -
    351                    $colDesc['autoincrement'] = isset($field['autoinc']) ? (bool) (isset($field['autoinc']) && $field['autoinc']):$colDesc['autoincrement']; -
    352                    $colDesc['values'] = isset($field['values']) ? (array) $field['values']:null; -
    353                     -
    354                    $validators = Doctrine::getValidators(); -
    355                     -
    356                    foreach ($validators as $validator) { -
    357                        if (isset($field[$validator])) { -
    358                            $colDesc[$validator] = $field[$validator]; -
    359                        } -
    360                    } -
    361                     -
    362                    $columns[(string) $colDesc['name']] = $colDesc; -
    363                } -
    364            } -
    365             -
    366            $build[$className]['connection'] = isset($table['connection']) ? $table['connection']:null; -
    367            $build[$className]['className'] = $className; -
    368            $build[$className]['tableName'] = $tableName; -
    369            $build[$className]['columns'] = $columns; -
    370            $build[$className]['relations'] = isset($table['relations']) ? $table['relations']:array(); -
    371            $build[$className]['indexes'] = isset($table['indexes']) ? $table['indexes']:array(); -
    372            $build[$className]['attributes'] = isset($table['attributes']) ? $table['attributes']:array(); -
    373            $build[$className]['templates'] = isset($table['templates']) ? $table['templates']:array(); -
    374            $build[$className]['actAs'] = isset($table['actAs']) ? $table['actAs']:array(); -
    375            $build[$className]['options'] = isset($table['options']) ? $table['options']:array(); -
    376            $build[$className]['package'] = isset($table['package']) ? $table['package']:null; -
    377             -
    378            if (isset($table['inheritance'])) { -
    379                $build[$className]['inheritance'] = $table['inheritance']; -
    380            } -
    381        } -
    382         -
    383        return $build; -
    384    } -
    385 -
    386    /** -
    387     * buildRelationships -
    388     * -
    389     * Loop through an array of schema information and build all the necessary relationship information -
    390     * Will attempt to auto complete relationships and simplify the amount of information required for defining a relationship -
    391     * -
    392     * @param  string $array  -
    393     * @return void -
    394     */ -
    395    protected function _buildRelationships(&$array) -
    396    { -
    397        foreach ($array as $name => $properties) { -
    398            if ( ! isset($properties['relations'])) { -
    399                continue; -
    400            } -
    401             -
    402            $className = $properties['className']; -
    403            $relations = $properties['relations']; -
    404             -
    405            foreach ($relations as $alias => $relation) { -
    406                $class = isset($relation['class']) ? $relation['class']:$alias; -
    407                 -
    408                // Attempt to guess the local and foreign -
    409                if (isset($relation['refClass'])) { -
    410                    $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine::tableize($name) . '_id'; -
    411                    $relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:Doctrine::tableize($class) . '_id'; -
    412                } else { -
    413                    $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine::tableize($class) . '_id'; -
    414                    $relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:'id'; -
    415                } -
    416             -
    417                $relation['alias'] = isset($relation['alias']) ? $relation['alias'] : $alias; -
    418                $relation['class'] = $class; -
    419                 -
    420                if (isset($relation['refClass'])) { -
    421                    $relation['type'] = 'many'; -
    422                } -
    423                 -
    424                if (isset($relation['type']) && $relation['type']) { -
    425                    $relation['type'] = $relation['type'] === 'one' ? Doctrine_Relation::ONE:Doctrine_Relation::MANY; -
    426                } else { -
    427                    $relation['type'] = Doctrine_Relation::ONE; -
    428                } -
    429 -
    430                if (isset($relation['foreignType']) && $relation['foreignType']) { -
    431                    $relation['foreignType'] = $relation['foreignType'] === 'one' ? Doctrine_Relation::ONE:Doctrine_Relation::MANY; -
    432                } -
    433                 -
    434                $this->_relations[$className][$alias] = $relation; -
    435            } -
    436        } -
    437         -
    438        // Now we fix all the relationships and auto-complete opposite ends of relationships -
    439        $this->_fixRelationships(); -
    440    } -
    441 -
    442    /** -
    443     * fixRelationships -
    444     * -
    445     * Loop through all relationships building the opposite ends of each relationship -
    446     * -
    447     * @return void -
    448     */ -
    449    protected function _fixRelationships() -
    450    { -
    451        foreach($this->_relations as $className => $relations) { -
    452            foreach ($relations AS $alias => $relation) { -
    453                $newRelation = array(); -
    454                $newRelation['foreign'] = $relation['local']; -
    455                $newRelation['local'] = $relation['foreign']; -
    456                $newRelation['class'] = isset($relation['foreignClass']) ? $relation['foreignClass']:$className; -
    457                $newRelation['alias'] = isset($relation['foreignAlias']) ? $relation['foreignAlias']:$className; -
    458                 -
    459                // this is so that we know that this relation was autogenerated and -
    460                // that we do not need to include it if it is explicitly declared in the schema by the users. -
    461                $newRelation['autogenerated'] = true;  -
    462                 -
    463                if (isset($relation['refClass'])) { -
    464                    $newRelation['refClass'] = $relation['refClass']; -
    465                    $newRelation['type'] = isset($relation['foreignType']) ? $relation['foreignType']:$relation['type']; -
    466                } else {                 -
    467                    if(isset($relation['foreignType'])) { -
    468                        $newRelation['type'] = $relation['foreignType']; -
    469                    } else { -
    470                        $newRelation['type'] = $relation['type'] === Doctrine_Relation::ONE ? Doctrine_Relation::MANY:Doctrine_Relation::ONE; -
    471                    } -
    472                } -
    473                 -
    474                if (!isset($this->_relations[$relation['class']][$newRelation['alias']])) { -
    475                    $this->_relations[$relation['class']][$newRelation['alias']] = $newRelation; -
    476                } -
    477            } -
    478        } -
    479    } -
    480}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Import_Sqlite.html b/tests_old/coverage/Doctrine_Import_Sqlite.html deleted file mode 100644 index c8902a5f0..000000000 --- a/tests_old/coverage/Doctrine_Import_Sqlite.html +++ /dev/null @@ -1,731 +0,0 @@ - - - Coverage for Doctrine_Import_Sqlite - - -

    Coverage for Doctrine_Import_Sqlite

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Sqlite.php 3018 2007-10-26 14:56:03Z ppetermann $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Import'); -
    22/** -
    23 * @package     Doctrine -
    24 * @subpackage  Import -
    25 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    28 * @version     $Revision: 3018 $ -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 */ -
    32class Doctrine_Import_Sqlite extends Doctrine_Import -
    33{ -
    34    /** -
    35     * lists all databases -
    36     * -
    37     * @return array -
    38     */ -
    39    public function listDatabases() -
    40    { -
    41 -
    42    } -
    43 -
    44    /** -
    45     * lists all availible database functions -
    46     * -
    47     * @return array -
    48     */ -
    49    public function listFunctions() -
    50    { -
    51 -
    52    } -
    53 -
    54    /** -
    55     * lists all database triggers -
    56     * -
    57     * @param string|null $database -
    58     * @return array -
    59     */ -
    60    public function listTriggers($database = null) -
    61    { -
    62 -
    63    } -
    64 -
    65    /** -
    66     * lists all database sequences -
    67     * -
    68     * @param string|null $database -
    69     * @return array -
    70     */ -
    71    public function listSequences($database = null) -
    72    { -
    73        $query      = "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL ORDER BY name"; -
    74        $tableNames = $this->conn->fetchColumn($query); -
    75 -
    76        $result = array(); -
    77        foreach ($tableNames as $tableName) { -
    78            if ($sqn = $this->conn->fixSequenceName($tableName, true)) { -
    79                $result[] = $sqn; -
    80            } -
    81        } -
    82        if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_FIX_CASE) { -
    83            $result = array_map(($this->conn->getAttribute(Doctrine::ATTR_FIELD_CASE) == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result); -
    84        } -
    85        return $result; -
    86    } -
    87 -
    88    /** -
    89     * lists table constraints -
    90     * -
    91     * @param string $table     database table name -
    92     * @return array -
    93     */ -
    94    public function listTableConstraints($table) -
    95    { -
    96        $table = $this->conn->quote($table, 'text'); -
    97 -
    98        $query = "SELECT sql FROM sqlite_master WHERE type='index' AND "; -
    99 -
    100        if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_FIX_CASE) { -
    101            $query .= 'LOWER(tbl_name) = ' . strtolower($table); -
    102        } else { -
    103            $query .= 'tbl_name = ' . $table; -
    104        } -
    105        $query  .= ' AND sql NOT NULL ORDER BY name'; -
    106        $indexes = $this->conn->fetchColumn($query); -
    107 -
    108        $result = array(); -
    109        foreach ($indexes as $sql) { -
    110            if (preg_match("/^create unique index ([^ ]+) on /i", $sql, $tmp)) { -
    111                $index = $this->conn->formatter->fixIndexName($tmp[1]); -
    112                if ( ! empty($index)) { -
    113                    $result[$index] = true; -
    114                } -
    115            } -
    116        } -
    117 -
    118        if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_FIX_CASE) { -
    119            $result = array_change_key_case($result, $this->conn->getAttribute(Doctrine::ATTR_FIELD_CASE)); -
    120        } -
    121        return array_keys($result); -
    122    } -
    123 -
    124    /** -
    125     * lists table constraints -
    126     * -
    127     * @param string $table     database table name -
    128     * @return array -
    129     */ -
    130    public function listTableColumns($table) -
    131    { -
    132        $sql    = 'PRAGMA table_info(' . $table . ')'; -
    133        $result = $this->conn->fetchAll($sql); -
    134 -
    135        $description = array(); -
    136        $columns     = array(); -
    137        foreach ($result as $key => $val) { -
    138            $val = array_change_key_case($val, CASE_LOWER); -
    139            $decl = $this->conn->dataDict->getPortableDeclaration($val); -
    140 -
    141            $description = array( -
    142                    'name'      => $val['name'], -
    143                    'ntype'     => $val['type'], -
    144                    'type'      => $decl['type'][0], -
    145                    'alltypes'  => $decl['type'], -
    146                    'notnull'   => (bool) $val['notnull'], -
    147                    'default'   => $val['dflt_value'], -
    148                    'primary'   => (bool) $val['pk'], -
    149                    'length'    => null, -
    150                    'scale'     => null, -
    151                    'precision' => null, -
    152                    'unsigned'  => null, -
    153                    ); -
    154            $columns[$val['name']] = $description; -
    155        } -
    156        return $columns; -
    157    } -
    158 -
    159    /** -
    160     * lists table constraints -
    161     * -
    162     * @param string $table     database table name -
    163     * @return array -
    164     */ -
    165    public function listTableIndexes($table) -
    166    { -
    167        $sql  = 'PRAGMA index_list(' . $table . ')'; -
    168        return $this->conn->fetchColumn($sql); -
    169   } -
    170    /** -
    171     * lists tables -
    172     * -
    173     * @param string|null $database -
    174     * @return array -
    175     */ -
    176    public function listTables($database = null) -
    177    { -
    178        $sql = "SELECT name FROM sqlite_master WHERE type = 'table' " -
    179             . "UNION ALL SELECT name FROM sqlite_temp_master " -
    180             . "WHERE type = 'table' ORDER BY name"; -
    181 -
    182        return $this->conn->fetchColumn($sql); -
    183    } -
    184 -
    185    /** -
    186     * lists table triggers -
    187     * -
    188     * @param string $table     database table name -
    189     * @return array -
    190     */ -
    191    public function listTableTriggers($table) -
    192    { -
    193 -
    194    } -
    195 -
    196    /** -
    197     * lists table views -
    198     * -
    199     * @param string $table     database table name -
    200     * @return array -
    201     */ -
    202    public function listTableViews($table) -
    203    { -
    204        $query = "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL"; -
    205        $views = $db->fetchAll($query); -
    206 -
    207        $result = array(); -
    208        foreach ($views as $row) { -
    209            if (preg_match("/^create view .* \bfrom\b\s+\b{$table}\b /i", $row['sql'])) { -
    210                if ( ! empty($row['name'])) { -
    211                    $result[$row['name']] = true; -
    212                } -
    213            } -
    214        } -
    215        return $result; -
    216    } -
    217 -
    218    /** -
    219     * lists database users -
    220     * -
    221     * @return array -
    222     */ -
    223    public function listUsers() -
    224    { -
    225 -
    226    } -
    227 -
    228    /** -
    229     * lists database views -
    230     * -
    231     * @param string|null $database -
    232     * @return array -
    233     */ -
    234    public function listViews($database = null) -
    235    { -
    236        $query = "SELECT name FROM sqlite_master WHERE type='view' AND sql NOT NULL"; -
    237 -
    238        return $this->conn->fetchColumn($query); -
    239    } -
    240}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Lib.html b/tests_old/coverage/Doctrine_Lib.html deleted file mode 100644 index ab97d2db0..000000000 --- a/tests_old/coverage/Doctrine_Lib.html +++ /dev/null @@ -1,813 +0,0 @@ - - - Coverage for Doctrine_Lib - - -

    Coverage for Doctrine_Lib

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Lib.php 3189 2007-11-18 20:37:44Z meus $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Lib has not commonly used static functions, mostly for debugging purposes -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Lib -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3189 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Lib -
    34{ -
    35    /** -
    36     * @param integer $state                the state of record -
    37     * @see Doctrine_Record::STATE_* constants -
    38     * @return string                       string representation of given state -
    39     */ -
    40    public static function getRecordStateAsString($state) -
    41    { -
    42        switch ($state) { -
    43        case Doctrine_Record::STATE_PROXY: -
    44            return "proxy"; -
    45            break; -
    46        case Doctrine_Record::STATE_CLEAN: -
    47            return "persistent clean"; -
    48            break; -
    49        case Doctrine_Record::STATE_DIRTY: -
    50            return "persistent dirty"; -
    51            break; -
    52        case Doctrine_Record::STATE_TDIRTY: -
    53            return "transient dirty"; -
    54            break; -
    55        case Doctrine_Record::STATE_TCLEAN: -
    56            return "transient clean"; -
    57            break; -
    58        } -
    59    } -
    60 -
    61    /** -
    62     * returns a string representation of Doctrine_Record object -
    63     * @param Doctrine_Record $record -
    64     * @return string -
    65     */ -
    66    public static function getRecordAsString(Doctrine_Record $record) -
    67    { -
    68        $r[] = '<pre>'; -
    69        $r[] = 'Component  : ' . $record->getTable()->getComponentName(); -
    70        $r[] = 'ID         : ' . $record->obtainIdentifier(); -
    71        $r[] = 'References : ' . count($record->getReferences()); -
    72        $r[] = 'State      : ' . Doctrine_Lib::getRecordStateAsString($record->getState()); -
    73        $r[] = 'OID        : ' . $record->getOID(); -
    74        $r[] = 'data       : ' . Doctrine::dump($record->getData(), false); -
    75        $r[] = '</pre>'; -
    76        return implode("\n",$r)."<br />"; -
    77    } -
    78 -
    79    /** -
    80     * Return an collection of records as XML.  -
    81     *  -
    82     * @see getRecordAsXml for options to set in the record class to control this. -
    83     * -
    84     * @param Doctrine_Collection $collection -
    85     * @param SimpleXMLElement $xml -
    86     * @return string Xml as string  -
    87     */ -
    88    public static function getCollectionAsXml(Doctrine_Collection $collection, SimpleXMLElement $incomming_xml = null) { -
    89 -
    90        $collectionName = Doctrine_Lib::plurelize($collection->getTable()->tableName); -
    91        if ( $collection->count() != 0) { -
    92            $record = $collection[0]; -
    93            $xml_options = $record->option("xml"); -
    94            if ( isset($xml_options["collection_name"])) { -
    95                $collectionName = $xml_options["collection_name"]; -
    96            } -
    97        } -
    98 -
    99        if ( ! isset($incomming_xml)) { -
    100            $new_xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><" . $collectionName . "></" . $collectionName . ">"; -
    101            $xml = new SimpleXMLElement($new_xml_string); -
    102        } else { -
    103            $xml = $incomming_xml->addChild($collectionName); -
    104        } -
    105        foreach ($collection as $key => $record) { -
    106            Doctrine_Lib::getRecordAsXml($record, $xml); -
    107        } -
    108        return $xml->asXML(); -
    109    } -
    110 -
    111    public static function plurelize($string) { -
    112        return $string . "s"; -
    113    } -
    114 -
    115    /** -
    116     * Return a recrd as XML.  -
    117     * -
    118     * In order to control how this is done set the "xml" option in a record.  -
    119     * This option is an array that has the keys "ignore_fields" and "include_relations". Both of these are arrays that list the name of fields/relations to include/process.  -
    120     * -
    121     * If you want to insert this xml as a part inside another xml send a  -
    122     * SimpleXMLElement to the function. Because of the nature of SimpleXML the  -
    123     * content you add to this element will be avilable after the function is  -
    124     * complete. -
    125     * -
    126     * @param Doctrine_Record $record -
    127     * @param SimpleXMLElement $xml -
    128     * @return string Xml as string -
    129     */ -
    130    public static function getRecordAsXml(Doctrine_Record $record, SimpleXMlElement $incomming_xml = NULL) -
    131    { -
    132        $recordname = $record->getTable()->tableName; -
    133        if ( !isset($incomming_xml)) { -
    134            $new_xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><" . $recordname . "></" . $recordname . ">"; -
    135            $xml = new SimpleXMLElement($new_xml_string); -
    136        } else { -
    137            $xml = $incomming_xml->addChild($recordname); -
    138 } -
    139        $xml_options = $record->option("xml"); -
    140        if ( isset($xml_options["record_name"])) { -
    141            $recordname = $xml_options["record_name"]; -
    142        } -
    143        foreach ($record->getData() as $field => $value) { -
    144            if ((isset($xml_options["ignore_fields"]) && !in_array($field, $xml_options["ignore_fields"])) || !isset($xml_options["ignore_fields"])) { -
    145                if ($value instanceOf Doctrine_Null) { -
    146                    $xml->addChild($field); -
    147                } else {     -
    148                    $xml->addChild($field, $value); -
    149                } -
    150            } -
    151        } -
    152        if ( ! isset($xml_options["include_relations"])) { -
    153            return $xml->asXML(); -
    154        } -
    155        $relations = $record->getTable()->getRelations(); -
    156        foreach ($relations as $name => $relation) { -
    157            if (in_array($name, $xml_options["include_relations"])) { -
    158                $relation_type = $relation->getType(); -
    159                $related_records = $record->get($name); -
    160                if ($relation_type == Doctrine_Relation::ONE && $related_records instanceOf Doctrine_Record) { -
    161                    Doctrine_Lib::getRecordAsXml($related_records, $xml); -
    162                } else { -
    163                    Doctrine_Lib::getCollectionAsXml($related_records, $xml); -
    164                } -
    165            } -
    166        } -
    167        return $xml->asXML(); -
    168    } -
    169 -
    170 -
    171    /** -
    172     * getStateAsString -
    173     * returns a given connection state as string -
    174     * @param integer $state        connection state -
    175     */ -
    176    public static function getConnectionStateAsString($state) -
    177    { -
    178        switch ($state) { -
    179        case Doctrine_Transaction::STATE_SLEEP: -
    180            return "open"; -
    181            break; -
    182        case Doctrine_Transaction::STATE_BUSY: -
    183            return "busy"; -
    184            break; -
    185        case Doctrine_Transaction::STATE_ACTIVE: -
    186            return "active"; -
    187            break; -
    188        } -
    189    } -
    190 -
    191    /** -
    192     * returns a string representation of Doctrine_Connection object -
    193     * @param Doctrine_Connection $connection -
    194     * @return string -
    195     */ -
    196    public static function getConnectionAsString(Doctrine_Connection $connection) -
    197    { -
    198        $r[] = '<pre>'; -
    199        $r[] = 'Doctrine_Connection object'; -
    200        $r[] = 'State               : ' . Doctrine_Lib::getConnectionStateAsString($connection->transaction->getState()); -
    201        $r[] = 'Open Transactions   : ' . $connection->transaction->getTransactionLevel(); -
    202        $r[] = 'Table in memory     : ' . $connection->count(); -
    203        $r[] = 'Driver name         : ' . $connection->getAttribute(Doctrine::ATTR_DRIVER_NAME); -
    204 -
    205        $r[] = "</pre>"; -
    206        return implode("\n",$r)."<br>"; -
    207    } -
    208 -
    209    /** -
    210     * returns a string representation of Doctrine_Table object -
    211     * @param Doctrine_Table $table -
    212     * @return string -
    213     */ -
    214    public static function getTableAsString(Doctrine_Table $table) -
    215    { -
    216        $r[] = "<pre>"; -
    217        $r[] = "Component   : ".$table->getComponentName(); -
    218        $r[] = "Table       : ".$table->getTableName(); -
    219        $r[] = "</pre>"; -
    220        return implode("\n",$r)."<br>"; -
    221    } -
    222 -
    223    /** -
    224     * formatSql  -
    225     *  -
    226     * @todo: What about creating a config varialbe for the color? -
    227     * @param mixed $sql  -
    228     * @return string the formated sql -
    229     */ -
    230    public static function formatSql($sql) -
    231    { -
    232        $e = explode("\n",$sql); -
    233        $color = "367FAC"; -
    234        $l = $sql; -
    235        $l = str_replace("SELECT ", "<font color='$color'><b>SELECT </b></font><br \>  ",$l); -
    236        $l = str_replace("FROM ", "<font color='$color'><b>FROM </b></font><br \>",$l); -
    237        $l = str_replace(" LEFT JOIN ", "<br \><font color='$color'><b> LEFT JOIN </b></font>",$l); -
    238        $l = str_replace(" INNER JOIN ", "<br \><font color='$color'><b> INNER JOIN </b></font>",$l); -
    239        $l = str_replace(" WHERE ", "<br \><font color='$color'><b> WHERE </b></font>",$l); -
    240        $l = str_replace(" GROUP BY ", "<br \><font color='$color'><b> GROUP BY </b></font>",$l); -
    241        $l = str_replace(" HAVING ", "<br \><font color='$color'><b> HAVING </b></font>",$l); -
    242        $l = str_replace(" AS ", "<font color='$color'><b> AS </b></font><br \>  ",$l); -
    243        $l = str_replace(" ON ", "<font color='$color'><b> ON </b></font>",$l); -
    244        $l = str_replace(" ORDER BY ", "<font color='$color'><b> ORDER BY </b></font><br \>",$l); -
    245        $l = str_replace(" LIMIT ", "<font color='$color'><b> LIMIT </b></font><br \>",$l); -
    246        $l = str_replace(" OFFSET ", "<font color='$color'><b> OFFSET </b></font><br \>",$l); -
    247        $l = str_replace("  ", "<dd>",$l); -
    248 -
    249        return $l; -
    250    } -
    251 -
    252    /** -
    253     * returns a string representation of Doctrine_Collection object -
    254     * @param Doctrine_Collection $collection -
    255     * @return string -
    256     */ -
    257    public static function getCollectionAsString(Doctrine_Collection $collection) -
    258    { -
    259        $r[] = "<pre>"; -
    260        $r[] = get_class($collection); -
    261        $r[] = 'data : ' . Doctrine::dump($collection->getData(), false); -
    262        //$r[] = 'snapshot : ' . Doctrine::dump($collection->getSnapshot()); -
    263 -
    264        $r[] = "</pre>"; -
    265        return implode("\n",$r); -
    266    } -
    267} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Locator_Injectable.html b/tests_old/coverage/Doctrine_Locator_Injectable.html deleted file mode 100644 index 0ff1abc47..000000000 --- a/tests_old/coverage/Doctrine_Locator_Injectable.html +++ /dev/null @@ -1,459 +0,0 @@ - - - Coverage for Doctrine_Locator_Injectable - - -

    Coverage for Doctrine_Locator_Injectable

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/** -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.net>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Locator_Injectable -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Doctrine_Locator -
    27 * @category    Locator -
    28 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL -
    29 * @link        http://www.phpdoctrine.net -
    30 * @author      Janne Vanhala <jpvanhal@cc.hut.fi> -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 * @author      Eevert Saukkokoski <dmnEe0@gmail.com> -
    33 * @version     $Revision$ -
    34 * @since       1.0 -
    35 */ -
    36class Doctrine_Locator_Injectable -
    37{ -
    38    /** -
    39     * @var Doctrine_Locator      the locator object -
    40     */ -
    41    protected $_locator; -
    42 -
    43    /** -
    44     * @var array               an array of bound resources -
    45     */ -
    46    protected $_resources = array(); -
    47 -
    48    /** -
    49     * @var Doctrine_Null $null     Doctrine_Null object, used for extremely fast null value checking -
    50     */ -
    51    protected static $_null; -
    52 -
    53    /** -
    54     * setLocator -
    55     * this method can be used for setting the locator object locally -
    56     * -
    57     * @param Doctrine_Locator                the locator object -
    58     * @return Doctrine_Locator_Injectable    this instance -
    59     */ -
    60    public function setLocator(Doctrine_Locator $locator) -
    61    { -
    62        $this->_locator = $locator; -
    63        return $this; -
    64    } -
    65 -
    66    /** -
    67     * getLocator -
    68     * returns the locator associated with this object -
    69     *  -
    70     * if there are no locator locally associated then -
    71     * this method tries to fetch the current global locator -
    72     * -
    73     * @return Doctrine_Locator -
    74     */ -
    75    public function getLocator() -
    76    { -
    77        if ( ! isset($this->_locator)) { -
    78            $this->_locator = Doctrine_Locator::instance(); -
    79 -
    80        } -
    81        return $this->_locator; -
    82    } -
    83 -
    84    /** -
    85     * locate -
    86     * locates a resource by given name and returns it -
    87     * -
    88     * if the resource cannot be found locally this method tries -
    89     * to use the global locator for finding the resource -
    90     * -
    91     * @see Doctrine_Locator::locate() -
    92     * @throws Doctrine_Locator_Exception     if the resource could not be found -
    93     * @param string $name                  the name of the resource -
    94     * @return mixed                        the located resource -
    95     */ -
    96    public function locate($name) -
    97    { -
    98        if (isset($this->_resources[$name])) { -
    99            if (is_object($this->_resources[$name])) { -
    100                return $this->_resources[$name]; -
    101            } else { -
    102                // get the name of the concrete implementation -
    103                $concreteImpl = $this->_resources[$name]; -
    104                 -
    105                return $this->getLocator()->locate($concreteImpl); -
    106            } -
    107        } else { -
    108            return $this->getLocator()->locate($name); -
    109        } -
    110    } -
    111 -
    112    /** -
    113     * bind -
    114     * binds a resource to a name -
    115     * -
    116     * @param string $name      the name of the resource to bind -
    117     * @param mixed $value      the value of the resource -
    118     * @return Doctrine_Locator   this object -
    119     */ -
    120    public function bind($name, $resource) -
    121    { -
    122        $this->_resources[$name] = $resource; -
    123         -
    124        return $this;     -
    125    } -
    126 -
    127    /** -
    128     * initNullObject -
    129     * initializes the null object -
    130     * -
    131     * @param Doctrine_Null $null -
    132     * @return void -
    133     */ -
    134    public static function initNullObject(Doctrine_Null $null) -
    135    { -
    136        self::$_null = $null; -
    137    } -
    138 -
    139    /** -
    140     * getNullObject -
    141     * returns the null object associated with this object -
    142     * -
    143     * @return Doctrine_Null -
    144     */ -
    145    public static function getNullObject() -
    146    { -
    147        return self::$_null; -
    148    } -
    149} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Manager.html b/tests_old/coverage/Doctrine_Manager.html deleted file mode 100644 index ff50feefb..000000000 --- a/tests_old/coverage/Doctrine_Manager.html +++ /dev/null @@ -1,2082 +0,0 @@ - - - Coverage for Doctrine_Manager - - -

    Coverage for Doctrine_Manager

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Manager.php 3223 2007-11-25 19:07:30Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * -
    24 * Doctrine_Manager is the base component of all doctrine based projects. -
    25 * It opens and keeps track of all connections (database connections). -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Manager -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3223 $ -
    33 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    34 */ -
    35class Doctrine_Manager extends Doctrine_Configurable implements Countable, IteratorAggregate -
    36{ -
    37    /** -
    38     * @var array $connections          an array containing all the opened connections -
    39     */ -
    40    protected $_connections   = array(); -
    41 -
    42    /** -
    43     * @var array $bound                an array containing all components that have a bound connection -
    44     */ -
    45    protected $_bound         = array(); -
    46 -
    47    /** -
    48     * @var integer $index              the incremented index -
    49     */ -
    50    protected $_index         = 0; -
    51 -
    52    /** -
    53     * @var integer $currIndex          the current connection index -
    54     */ -
    55    protected $_currIndex     = 0; -
    56 -
    57    /** -
    58     * @var string $root                root directory -
    59     */ -
    60    protected $_root; -
    61 -
    62    /** -
    63     * @var Doctrine_Query_Registry     the query registry -
    64     */ -
    65    protected $_queryRegistry; -
    66     -
    67    protected static $driverMap = array('oci' => 'oracle'); -
    68 -
    69    /** -
    70     * constructor -
    71     * -
    72     * this is private constructor (use getInstance to get an instance of this class) -
    73     */ -
    74    private function __construct() -
    75    { -
    76        $this->_root = dirname(__FILE__); -
    77 -
    78        Doctrine_Locator_Injectable::initNullObject(new Doctrine_Null); -
    79    } -
    80 -
    81    /** -
    82     * setDefaultAttributes -
    83     * sets default attributes -
    84     * -
    85     * @todo I do not understand the flow here. Explain or refactor? -
    86     * @return boolean -
    87     */ -
    88    public function setDefaultAttributes() -
    89    { -
    90        static $init = false; -
    91        if ( ! $init) { -
    92            $init = true; -
    93            $attributes = array( -
    94                        Doctrine::ATTR_CACHE                    => null, -
    95                        Doctrine::ATTR_RESULT_CACHE             => null, -
    96                        Doctrine::ATTR_QUERY_CACHE              => null, -
    97                        Doctrine::ATTR_LOAD_REFERENCES          => true, -
    98                        Doctrine::ATTR_LISTENER                 => new Doctrine_EventListener(), -
    99                        Doctrine::ATTR_RECORD_LISTENER          => new Doctrine_Record_Listener(), -
    100                        Doctrine::ATTR_THROW_EXCEPTIONS         => true, -
    101                        Doctrine::ATTR_VALIDATE                 => Doctrine::VALIDATE_NONE, -
    102                        Doctrine::ATTR_QUERY_LIMIT              => Doctrine::LIMIT_RECORDS, -
    103                        Doctrine::ATTR_IDXNAME_FORMAT           => "%s_idx", -
    104                        Doctrine::ATTR_SEQNAME_FORMAT           => "%s_seq", -
    105                        Doctrine::ATTR_TBLNAME_FORMAT           => "%s", -
    106                        Doctrine::ATTR_QUOTE_IDENTIFIER         => false, -
    107                        Doctrine::ATTR_SEQCOL_NAME              => 'id', -
    108                        Doctrine::ATTR_PORTABILITY              => Doctrine::PORTABILITY_ALL, -
    109                        Doctrine::ATTR_EXPORT                   => Doctrine::EXPORT_ALL, -
    110                        Doctrine::ATTR_DECIMAL_PLACES           => 2, -
    111                        Doctrine::ATTR_DEFAULT_PARAM_NAMESPACE  => 'doctrine', -
    112                        );  -
    113            foreach ($attributes as $attribute => $value) { -
    114                $old = $this->getAttribute($attribute); -
    115                if ($old === null) { -
    116                    $this->setAttribute($attribute,$value); -
    117                } -
    118            } -
    119            return true; -
    120        } -
    121        return false; -
    122    } -
    123 -
    124    /** -
    125     * returns the root directory of Doctrine -
    126     * -
    127     * @return string -
    128     */ -
    129    final public function getRoot() -
    130    { -
    131        return $this->_root; -
    132    } -
    133 -
    134    /** -
    135     * getInstance -
    136     * returns an instance of this class -
    137     * (this class uses the singleton pattern) -
    138     * -
    139     * @return Doctrine_Manager -
    140     */ -
    141    public static function getInstance() -
    142    { -
    143        static $instance; -
    144        if ( ! isset($instance)) { -
    145            $instance = new self(); -
    146        } -
    147        return $instance; -
    148    } -
    149 -
    150    /** -
    151     * getQueryRegistry -
    152     * lazy-initializes the query registry object and returns it -
    153     * -
    154     * @return Doctrine_Query_Registry -
    155     */ -
    156    public function getQueryRegistry() -
    157    { -
    158     if ( ! isset($this->_queryRegistry)) { -
    159        $this->_queryRegistry = new Doctrine_Query_Registry; -
    160     } -
    161        return $this->_queryRegistry; -
    162    } -
    163 -
    164    /** -
    165     * setQueryRegistry -
    166     * sets the query registry -
    167     * -
    168     * @return Doctrine_Manager     this object -
    169     */ -
    170    public function setQueryRegistry(Doctrine_Query_Registry $registry) -
    171    { -
    172        $this->_queryRegistry = $registry; -
    173         -
    174        return $this; -
    175    } -
    176 -
    177    /** -
    178     * fetch -
    179     * fetches data using the provided queryKey and  -
    180     * the associated query in the query registry -
    181     * -
    182     * if no query for given queryKey is being found a  -
    183     * Doctrine_Query_Registry exception is being thrown -
    184     * -
    185     * @param string $queryKey      the query key -
    186     * @param array $params         prepared statement params (if any) -
    187     * @return mixed                the fetched data -
    188     */ -
    189    public function find($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) -
    190    { -
    191        return Doctrine_Manager::getInstance() -
    192                            ->getQueryRegistry() -
    193                            ->get($queryKey) -
    194                            ->execute($params, $hydrationMode); -
    195    } -
    196 -
    197    /** -
    198     * fetchOne -
    199     * fetches data using the provided queryKey and  -
    200     * the associated query in the query registry -
    201     * -
    202     * if no query for given queryKey is being found a  -
    203     * Doctrine_Query_Registry exception is being thrown -
    204     * -
    205     * @param string $queryKey      the query key -
    206     * @param array $params         prepared statement params (if any) -
    207     * @return mixed                the fetched data -
    208     */ -
    209    public function findOne($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) -
    210    { -
    211        return Doctrine_Manager::getInstance() -
    212                            ->getQueryRegistry() -
    213                            ->get($queryKey) -
    214                            ->fetchOne($params, $hydrationMode); -
    215    } -
    216 -
    217    /** -
    218     * connection -
    219     * -
    220     * if the adapter parameter is set this method acts as -
    221     * a short cut for Doctrine_Manager::getInstance()->openConnection($adapter, $name); -
    222     * -
    223     * if the adapter paramater is not set this method acts as -
    224     * a short cut for Doctrine_Manager::getInstance()->getCurrentConnection() -
    225     * -
    226     * @param PDO|Doctrine_Adapter_Interface $adapter   database driver -
    227     * @param string $name                              name of the connection, if empty numeric key is used -
    228     * @throws Doctrine_Manager_Exception               if trying to bind a connection with an existing name -
    229     * @return Doctrine_Connection -
    230     */ -
    231    public static function connection($adapter = null, $name = null) -
    232    { -
    233        if ($adapter == null) { -
    234            return Doctrine_Manager::getInstance()->getCurrentConnection(); -
    235        } else { -
    236            return Doctrine_Manager::getInstance()->openConnection($adapter, $name); -
    237        } -
    238    } -
    239 -
    240    /** -
    241     * openConnection -
    242     * opens a new connection and saves it to Doctrine_Manager->connections -
    243     * -
    244     * @param PDO|Doctrine_Adapter_Interface $adapter   database driver -
    245     * @param string $name                              name of the connection, if empty numeric key is used -
    246     * @throws Doctrine_Manager_Exception               if trying to bind a connection with an existing name -
    247     * @throws Doctrine_Manager_Exception               if trying to open connection for unknown driver -
    248     * @return Doctrine_Connection -
    249     */ -
    250    public function openConnection($adapter, $name = null, $setCurrent = true) -
    251    { -
    252        if (is_object($adapter)) { -
    253            if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) { -
    254                throw new Doctrine_Manager_Exception("First argument should be an instance of PDO or implement Doctrine_Adapter_Interface"); -
    255            } -
    256 -
    257            $driverName = $adapter->getAttribute(Doctrine::ATTR_DRIVER_NAME); -
    258        } elseif (is_array($adapter)) { -
    259            if ( ! isset($adapter[0])) { -
    260                throw new Doctrine_Manager_Exception('Empty data source name given.'); -
    261            } -
    262            $e = explode(':', $adapter[0]); -
    263 -
    264            if ($e[0] == 'uri') { -
    265                $e[0] = 'odbc'; -
    266            } -
    267 -
    268            $parts['dsn']    = $adapter[0]; -
    269            $parts['scheme'] = $e[0]; -
    270            $parts['user']   = (isset($adapter[1])) ? $adapter[1] : null; -
    271            $parts['pass']   = (isset($adapter[2])) ? $adapter[2] : null; -
    272             -
    273            $driverName = $e[0]; -
    274            $adapter = $parts; -
    275        } else { -
    276            $parts = $this->parseDsn($adapter); -
    277             -
    278            $driverName = $parts['scheme']; -
    279             -
    280            $adapter = $parts; -
    281        } -
    282 -
    283        // initialize the default attributes -
    284        $this->setDefaultAttributes(); -
    285 -
    286        if ($name !== null) { -
    287            $name = (string) $name; -
    288            if (isset($this->_connections[$name])) { -
    289                return $this->_connections[$name]; -
    290            } -
    291        } else { -
    292            $name = $this->_index; -
    293            $this->_index++; -
    294        } -
    295 -
    296 -
    297        $drivers = array('mysql'    => 'Doctrine_Connection_Mysql', -
    298                         'sqlite'   => 'Doctrine_Connection_Sqlite', -
    299                         'pgsql'    => 'Doctrine_Connection_Pgsql', -
    300                         'oci'      => 'Doctrine_Connection_Oracle', -
    301                         'oci8'     => 'Doctrine_Connection_Oracle', -
    302                         'oracle'   => 'Doctrine_Connection_Oracle', -
    303                         'mssql'    => 'Doctrine_Connection_Mssql', -
    304                         'dblib'    => 'Doctrine_Connection_Mssql', -
    305                         'firebird' => 'Doctrine_Connection_Firebird', -
    306                         'informix' => 'Doctrine_Connection_Informix', -
    307                         'mock'     => 'Doctrine_Connection_Mock'); -
    308        if ( ! isset($drivers[$driverName])) { -
    309            throw new Doctrine_Manager_Exception('Unknown driver ' . $driverName); -
    310        } -
    311         -
    312        $className = $drivers[$driverName]; -
    313        $conn = new $className($this, $adapter); -
    314 -
    315        $this->_connections[$name] = $conn; -
    316 -
    317        if ($setCurrent) { -
    318            $this->_currIndex = $name; -
    319        } -
    320        return $this->_connections[$name]; -
    321    } -
    322     -
    323    /** -
    324     * parsePdoDsn  -
    325     *  -
    326     * @param array $dsn An array of dsn information  -
    327     * @return array The array parsed -
    328     */ -
    329    public function parsePdoDsn($dsn) -
    330    { -
    331        $parts = array(); -
    332         -
    333        $names = array('dsn', 'scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment'); -
    334 -
    335        foreach ($names as $name) { -
    336            if ( ! isset($parts[$name])) { -
    337                $parts[$name] = null; -
    338            } -
    339        } -
    340         -
    341        $e = explode(':', $dsn); -
    342        $parts['scheme'] = $e[0]; -
    343        $parts['dsn'] = $dsn; -
    344         -
    345        $e = explode(';', $e[1]); -
    346        foreach ($e as $string) { -
    347            list($key, $value) = explode('=', $string); -
    348            $parts[$key] = $value; -
    349        } -
    350         -
    351        return $parts; -
    352    } -
    353 -
    354    /** -
    355     * parseDsn -
    356     * -
    357     * @param string $dsn -
    358     * @return array Parsed contents of DSN -
    359     */ -
    360    public function parseDsn($dsn) -
    361    { -
    362 -
    363 -
    364        //fix linux sqlite dsn so that it will parse correctly -
    365        $dsn = str_replace("///", "/", $dsn); -
    366 -
    367        // silence any warnings -
    368        $parts = @parse_url($dsn); -
    369 -
    370        $names = array('dsn', 'scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment'); -
    371 -
    372        foreach ($names as $name) { -
    373            if ( ! isset($parts[$name])) { -
    374                $parts[$name] = null; -
    375            } -
    376        } -
    377 -
    378        if (count($parts) == 0 || ! isset($parts['scheme'])) { -
    379            throw new Doctrine_Manager_Exception('Empty data source name'); -
    380        } -
    381 -
    382        switch ($parts['scheme']) { -
    383            case 'sqlite': -
    384            case 'sqlite2': -
    385            case 'sqlite3': -
    386                if (isset($parts['host']) && $parts['host'] == ':memory') { -
    387                    $parts['database'] = ':memory:'; -
    388                    $parts['dsn']      = 'sqlite::memory:'; -
    389                } else { -
    390                    //fix windows dsn we have to add host: to path and set host to null -
    391                    if (isset($parts['host'])) { -
    392                        $parts['path'] = $parts['host'] . ":" . $parts["path"]; -
    393                        $parts["host"] = null; -
    394                    } -
    395                    $parts['database'] = $parts['path']; -
    396                    $parts['dsn'] = $parts['scheme'] . ':' . $parts['path']; -
    397                } -
    398 -
    399                break; -
    400             -
    401            case 'mssql': -
    402            case 'dblib': -
    403                if ( ! isset($parts['path']) || $parts['path'] == '/') { -
    404                    throw new Doctrine_Manager_Exception('No database available in data source name'); -
    405                } -
    406                if (isset($parts['path'])) { -
    407                    $parts['database'] = substr($parts['path'], 1); -
    408                } -
    409                if ( ! isset($parts['host'])) { -
    410                    throw new Doctrine_Manager_Exception('No hostname set in data source name'); -
    411                } -
    412                 -
    413                if (isset(self::$driverMap[$parts['scheme']])) { -
    414                    $parts['scheme'] = self::$driverMap[$parts['scheme']]; -
    415                } -
    416 -
    417                $parts['dsn'] = $parts['scheme'] . ':host=' -
    418                              . $parts['host'] . (isset($parts['port']) ? ':' . $parts['port']:null) . ';dbname=' -
    419                              . $parts['database']; -
    420                 -
    421                break; -
    422 -
    423            case 'mysql': -
    424            case 'informix': -
    425            case 'oci8': -
    426            case 'oci': -
    427            case 'firebird': -
    428            case 'pgsql': -
    429            case 'odbc': -
    430            case 'mock': -
    431            case 'oracle': -
    432                if ( ! isset($parts['path']) || $parts['path'] == '/') { -
    433                    throw new Doctrine_Manager_Exception('No database available in data source name'); -
    434                } -
    435                if (isset($parts['path'])) { -
    436                    $parts['database'] = substr($parts['path'], 1); -
    437                } -
    438                if ( ! isset($parts['host'])) { -
    439                    throw new Doctrine_Manager_Exception('No hostname set in data source name'); -
    440                } -
    441                 -
    442                if (isset(self::$driverMap[$parts['scheme']])) { -
    443                    $parts['scheme'] = self::$driverMap[$parts['scheme']]; -
    444                } -
    445 -
    446                $parts['dsn'] = $parts['scheme'] . ':host=' -
    447                              . $parts['host'] . (isset($parts['port']) ? ';port=' . $parts['port']:null) . ';dbname=' -
    448                              . $parts['database']; -
    449                 -
    450                break; -
    451            default: -
    452                throw new Doctrine_Manager_Exception('Unknown driver '.$parts['scheme']); -
    453        } -
    454 -
    455 -
    456        return $parts; -
    457    } -
    458 -
    459    /** -
    460     * getConnection -
    461     * @param integer $index -
    462     * @return object Doctrine_Connection -
    463     * @throws Doctrine_Manager_Exception   if trying to get a non-existent connection -
    464     */ -
    465    public function getConnection($name) -
    466    { -
    467        if ( ! isset($this->_connections[$name])) { -
    468            throw new Doctrine_Manager_Exception('Unknown connection: ' . $name); -
    469        } -
    470 -
    471        return $this->_connections[$name]; -
    472    } -
    473 -
    474    /** -
    475     * getComponentAlias -
    476     * retrieves the alias for given component name -
    477     * if the alias couldn't be found, this method returns the given -
    478     * component name -
    479     * -
    480     * @param string $componentName -
    481     * @return string                   the component alias -
    482     */ -
    483    public function getComponentAlias($componentName) -
    484    { -
    485        if (isset($this->componentAliases[$componentName])) { -
    486            return $this->componentAliases[$componentName]; -
    487        } -
    488 -
    489        return $componentName; -
    490    } -
    491 -
    492    /** -
    493     * sets an alias for given component name -
    494     * very useful when building a large framework with a possibility -
    495     * to override any given class -
    496     * -
    497     * @param string $componentName         the name of the component -
    498     * @param string $alias -
    499     * @return Doctrine_Manager -
    500     */ -
    501    public function setComponentAlias($componentName, $alias) -
    502    { -
    503        $this->componentAliases[$componentName] = $alias; -
    504 -
    505        return $this; -
    506    } -
    507 -
    508    /** -
    509     * getConnectionName -
    510     * -
    511     * @param Doctrine_Connection $conn     connection object to be searched for -
    512     * @return string                       the name of the connection -
    513     */ -
    514    public function getConnectionName(Doctrine_Connection $conn) -
    515    { -
    516        return array_search($conn, $this->_connections, true); -
    517    } -
    518 -
    519    /** -
    520     * bindComponent -
    521     * binds given component to given connection -
    522     * this means that when ever the given component uses a connection -
    523     * it will be using the bound connection instead of the current connection -
    524     * -
    525     * @param string $componentName -
    526     * @param string $connectionName -
    527     * @return boolean -
    528     */ -
    529    public function bindComponent($componentName, $connectionName) -
    530    { -
    531        $this->_bound[$componentName] = $connectionName; -
    532    } -
    533 -
    534    /** -
    535     * getConnectionForComponent -
    536     * -
    537     * @param string $componentName -
    538     * @return Doctrine_Connection -
    539     */ -
    540    public function getConnectionForComponent($componentName = null) -
    541    { -
    542        if (isset($this->_bound[$componentName])) { -
    543            return $this->getConnection($this->_bound[$componentName]); -
    544        } -
    545        return $this->getCurrentConnection(); -
    546    } -
    547 -
    548    /** -
    549     * getTable -
    550     * this is the same as Doctrine_Connection::getTable() except -
    551     * that it works seamlessly in multi-server/connection environment -
    552     * -
    553     * @see Doctrine_Connection::getTable() -
    554     * @param string $componentName -
    555     * @return Doctrine_Table -
    556     */ -
    557    public function getTable($componentName) -
    558    { -
    559        return $this->getConnectionForComponent($componentName)->getTable($componentName); -
    560    } -
    561 -
    562    /** -
    563     * table -
    564     * this is the same as Doctrine_Connection::getTable() except -
    565     * that it works seamlessly in multi-server/connection environment -
    566     * -
    567     * @see Doctrine_Connection::getTable() -
    568     * @param string $componentName -
    569     * @return Doctrine_Table -
    570     */ -
    571    public static function table($componentName) -
    572    { -
    573        return Doctrine_Manager::getInstance() -
    574               ->getConnectionForComponent($componentName) -
    575               ->getTable($componentName); -
    576    } -
    577 -
    578    /** -
    579     * closes the connection -
    580     * -
    581     * @param Doctrine_Connection $connection -
    582     * @return void -
    583     */ -
    584    public function closeConnection(Doctrine_Connection $connection) -
    585    { -
    586        $connection->close(); -
    587 -
    588        $key = array_search($connection, $this->_connections, true); -
    589 -
    590        if ($key !== false) { -
    591            unset($this->_connections[$key]); -
    592        } -
    593        $this->_currIndex = key($this->_connections); -
    594 -
    595        unset($connection); -
    596    } -
    597 -
    598    /** -
    599     * getConnections -
    600     * returns all opened connections -
    601     * -
    602     * @return array -
    603     */ -
    604    public function getConnections() -
    605    { -
    606        return $this->_connections; -
    607    } -
    608 -
    609    /** -
    610     * setCurrentConnection -
    611     * sets the current connection to $key -
    612     * -
    613     * @param mixed $key                        the connection key -
    614     * @throws InvalidKeyException -
    615     * @return void -
    616     */ -
    617    public function setCurrentConnection($key) -
    618    { -
    619        $key = (string) $key; -
    620        if ( ! isset($this->_connections[$key])) { -
    621            throw new InvalidKeyException(); -
    622        } -
    623        $this->_currIndex = $key; -
    624    } -
    625 -
    626    /** -
    627     * contains -
    628     * whether or not the manager contains specified connection -
    629     * -
    630     * @param mixed $key                        the connection key -
    631     * @return boolean -
    632     */ -
    633    public function contains($key) -
    634    { -
    635        return isset($this->_connections[$key]); -
    636    } -
    637 -
    638    /** -
    639     * count -
    640     * returns the number of opened connections -
    641     * -
    642     * @return integer -
    643     */ -
    644    public function count() -
    645    { -
    646        return count($this->_connections); -
    647    } -
    648 -
    649    /** -
    650     * getIterator -
    651     * returns an ArrayIterator that iterates through all connections -
    652     * -
    653     * @return ArrayIterator -
    654     */ -
    655    public function getIterator() -
    656    { -
    657        return new ArrayIterator($this->_connections); -
    658    } -
    659 -
    660    /** -
    661     * getCurrentConnection -
    662     * returns the current connection -
    663     * -
    664     * @throws Doctrine_Connection_Exception       if there are no open connections -
    665     * @return Doctrine_Connection -
    666     */ -
    667    public function getCurrentConnection() -
    668    { -
    669        $i = $this->_currIndex; -
    670        if ( ! isset($this->_connections[$i])) { -
    671            throw new Doctrine_Connection_Exception(); -
    672        } -
    673        return $this->_connections[$i]; -
    674    } -
    675 -
    676    /** -
    677     * __toString -
    678     * returns a string representation of this object -
    679     * -
    680     * @return string -
    681     */ -
    682    public function __toString() -
    683    { -
    684        $r[] = "<pre>"; -
    685        $r[] = "Doctrine_Manager"; -
    686        $r[] = "Connections : ".count($this->_connections); -
    687        $r[] = "</pre>"; -
    688        return implode("\n",$r); -
    689    } -
    690} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Manager_Exception.html b/tests_old/coverage/Doctrine_Manager_Exception.html deleted file mode 100644 index 7b98c6776..000000000 --- a/tests_old/coverage/Doctrine_Manager_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Manager_Exception - - -

    Coverage for Doctrine_Manager_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Manager_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Manager -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Manager_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Migration.html b/tests_old/coverage/Doctrine_Migration.html deleted file mode 100644 index a77cdbf48..000000000 --- a/tests_old/coverage/Doctrine_Migration.html +++ /dev/null @@ -1,1773 +0,0 @@ - - - Coverage for Doctrine_Migration - - -

    Coverage for Doctrine_Migration

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Migration.php 1080 2007-02-10 18:17:08Z jwage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Migration -
    24 * -
    25 * this class represents a database view -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Migration -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 1080 $ -
    33 * @author      Jonathan H. Wage <jwage@mac.com> -
    34 */ -
    35class Doctrine_Migration -
    36{ -
    37    protected $_changes = array('created_tables'      =>  array(), -
    38                                'renamed_tables'      =>  array(), -
    39                                'created_constraints' =>  array(), -
    40                                'dropped_fks'         =>  array(), -
    41                                'created_fks'         =>  array(), -
    42                                'dropped_constraints' =>  array(), -
    43                                'removed_indexes'     =>  array(), -
    44                                'dropped_tables'      =>  array(), -
    45                                'added_columns'       =>  array(), -
    46                                'renamed_columns'     =>  array(), -
    47                                'changed_columns'     =>  array(), -
    48                                'removed_columns'     =>  array(), -
    49                                'added_indexes'       =>  array()), -
    50              $_migrationTableName = 'migration_version', -
    51              $_migrationClassesDirectory = array(), -
    52              $_migrationClasses = array(), -
    53              $_loadedMigrations = array(); -
    54 -
    55    /** -
    56     * construct -
    57     * -
    58     * Specify the path to the directory with the migration classes. -
    59     * The classes will be loaded and the migration table will be created if it does not already exist -
    60     * -
    61     * @param string $directory  -
    62     * @return void -
    63     */ -
    64    public function __construct($directory = null) -
    65    { -
    66        if ($directory != null) { -
    67            $this->_migrationClassesDirectory = $directory; -
    68             -
    69            $this->loadMigrationClasses(); -
    70             -
    71            $this->createMigrationTable(); -
    72        } -
    73    } -
    74 -
    75    /** -
    76     * getTableName -
    77     * -
    78     * @return void -
    79     */ -
    80    public function getTableName() -
    81    { -
    82        return $this->_migrationTableName; -
    83    } -
    84 -
    85    /** -
    86     * setTableName -
    87     * -
    88     * @param string $tableName  -
    89     * @return void -
    90     */ -
    91    public function setTableName($tableName) -
    92    { -
    93        $this->_migrationTableName = Doctrine_Manager::connection() -
    94                ->formatter->getTableName($tableName); -
    95    } -
    96 -
    97    /** -
    98     * createMigrationTable -
    99     *  -
    100     * Creates the migration table used to store the current version -
    101     * -
    102     * @return void -
    103     */ -
    104    protected function createMigrationTable() -
    105    { -
    106        $conn = Doctrine_Manager::connection(); -
    107         -
    108        try { -
    109            $conn->export->createTable($this->_migrationTableName, array('version' => array('type' => 'integer', 'size' => 11))); -
    110             -
    111            return true; -
    112        } catch(Exception $e) { -
    113            return false; -
    114        } -
    115    } -
    116 -
    117 -
    118    /** -
    119     * loadMigrationClassesFromDirectory  -
    120     *  -
    121     * refactored out from loadMigrationClasses -
    122     * $param array An array of classes -
    123     * @return void -
    124     */ -
    125    public function loadMigrationClassesFromDirectory($classes){ -
    126        foreach ((array) $this->_migrationClassesDirectory as $dir) { -
    127            $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), -
    128                RecursiveIteratorIterator::LEAVES_ONLY); -
    129 -
    130            foreach ($it as $file) { -
    131                $e = explode('.', $file->getFileName()); -
    132                if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) { -
    133                    if ( ! in_array($file->getFileName(), $this->_loadedMigrations)) { -
    134                        require_once($file->getPathName()); -
    135 -
    136                        $requiredClass = array_diff(get_declared_classes(), $classes); -
    137                        $requiredClass = end($requiredClass); -
    138 -
    139                        if ($requiredClass) { -
    140                            $this->_loadedMigrations[$requiredClass] = $file->getFileName(); -
    141                        } -
    142                    } -
    143                } -
    144            } -
    145        } -
    146    } -
    147 -
    148    /** -
    149     * loadMigrationClasses -
    150     * -
    151     * Loads the migration classes for the directory specified by the constructor -
    152     * -
    153     * @return void -
    154     */ -
    155    protected function loadMigrationClasses() -
    156    { -
    157        if ($this->_migrationClasses) { -
    158            return $this->_migrationClasses; -
    159        } -
    160         -
    161        $classes = get_declared_classes(); -
    162         -
    163        if ($this->_migrationClassesDirectory !== null) { -
    164            $this->loadMigrationClassesFromDirectory($classes); -
    165        } -
    166 -
    167         -
    168        $parent = new ReflectionClass('Doctrine_Migration'); -
    169         -
    170        foreach ($this->_loadedMigrations as $name => $fileName) { -
    171            $class = new ReflectionClass($name); -
    172             -
    173            while ($class->isSubclassOf($parent)) { -
    174 -
    175                $class = $class->getParentClass(); -
    176                if ($class === false) { -
    177                    break; -
    178                } -
    179            } -
    180             -
    181            if ($class === false) { -
    182                continue; -
    183            } -
    184             -
    185            $e = explode('_', $fileName); -
    186            $classMigrationNum = (int) $e[0]; -
    187             -
    188            $this->_migrationClasses[$classMigrationNum] = array('className' => $name, 'fileName' => $fileName); -
    189        } -
    190         -
    191        return $this->_migrationClasses; -
    192    } -
    193 -
    194    /** -
    195     * getMigrationClasses -
    196     * -
    197     * @return void -
    198     */ -
    199    public function getMigrationClasses() -
    200    { -
    201        return $this->_migrationClasses; -
    202    } -
    203 -
    204    /** -
    205     * setCurrentVersion -
    206     * -
    207     * Sets the current version in the migration table -
    208     * -
    209     * @param string $number  -
    210     * @return void -
    211     */ -
    212    protected function setCurrentVersion($number) -
    213    { -
    214        $conn = Doctrine_Manager::connection(); -
    215         -
    216        if ($this->hasMigrated()) { -
    217            $conn->exec("UPDATE " . $this->_migrationTableName . " SET version = $number"); -
    218        } else { -
    219            $conn->exec("INSERT INTO " . $this->_migrationTableName . " (version) VALUES ($number)"); -
    220        } -
    221    } -
    222 -
    223    /** -
    224     * getCurrentVersion -
    225     * -
    226     * Get the current version of the database -
    227     * -
    228     * @return void -
    229     */ -
    230    public function getCurrentVersion() -
    231    { -
    232        $conn = Doctrine_Manager::connection(); -
    233         -
    234        $result = $conn->fetchColumn("SELECT version FROM " . $this->_migrationTableName); -
    235         -
    236        return isset($result[0]) ? $result[0]:0; -
    237    } -
    238 -
    239    /** -
    240     * hasMigrated -
    241     * -
    242     * Returns true/false for whether or not this database has been migrated in the past -
    243     * -
    244     * @return void -
    245     */ -
    246    public function hasMigrated() -
    247    { -
    248        $conn = Doctrine_Manager::connection(); -
    249         -
    250        $result = $conn->fetchColumn("SELECT version FROM " . $this->_migrationTableName); -
    251         -
    252        return isset($result[0]) ? true:false;  -
    253    } -
    254 -
    255    /** -
    256     * getLatestVersion -
    257     * -
    258     * Gets the latest possible version from the loaded migration classes -
    259     * -
    260     * @return void -
    261     */ -
    262    public function getLatestVersion() -
    263    { -
    264        $this->loadMigrationClasses(); -
    265         -
    266        $versions = array(); -
    267        foreach (array_keys($this->_migrationClasses) as $classMigrationNum) { -
    268            $versions[$classMigrationNum] = $classMigrationNum; -
    269        } -
    270         -
    271        rsort($versions); -
    272         -
    273        return isset($versions[0]) ? $versions[0]:0; -
    274    } -
    275 -
    276    /** -
    277     * getNextVersion -
    278     * -
    279     * @return integer $nextVersion -
    280     */ -
    281    public function getNextVersion() -
    282    { -
    283        return $this->getLatestVersion() + 1; -
    284    } -
    285 -
    286    /** -
    287     * getMigrationClass -
    288     * -
    289     * Get instance of migration class for $num -
    290     * -
    291     * @param string $num  -
    292     * @return void -
    293     */ -
    294    protected function getMigrationClass($num) -
    295    { -
    296        foreach ($this->_migrationClasses as $classMigrationNum => $info) { -
    297            $className = $info['className']; -
    298             -
    299            if ($classMigrationNum == $num) { -
    300                return new $className(); -
    301            } -
    302        } -
    303         -
    304        throw new Doctrine_Migration_Exception('Could not find migration class for migration step: '.$num); -
    305    } -
    306 -
    307    /** -
    308     * doMigrateStep -
    309     * -
    310     * Perform migration directory for the specified version. Loads migration classes and performs the migration then processes the changes -
    311     * -
    312     * @param string $direction  -
    313     * @param string $num  -
    314     * @return void -
    315     */ -
    316    protected function doMigrateStep($direction, $num) -
    317    { -
    318        $migrate = $this->getMigrationClass($num); -
    319         -
    320        $migrate->doMigrate($direction); -
    321    } -
    322 -
    323    /** -
    324     * doMigrate -
    325     *  -
    326     * Perform migration for a migration class. Executes the up or down method then processes the changes -
    327     * -
    328     * @param string $direction  -
    329     * @return void -
    330     */ -
    331    protected function doMigrate($direction) -
    332    { -
    333        if (! method_exists($this, $direction)) { -
    334            return; -
    335        } -
    336        $this->$direction(); -
    337 -
    338        foreach ($this->_changes as $type => $changes) { -
    339            $process = new Doctrine_Migration_Process(); -
    340            $funcName = 'process' . Doctrine::classify($type); -
    341 -
    342            if ( ! empty($changes)) { -
    343                $process->$funcName($changes);  -
    344            } -
    345        } -
    346    } -
    347 -
    348    /** -
    349     * migrate -
    350     * -
    351     * Perform a migration chain by specifying the $from and $to. -
    352     * If you do not specify a $from or $to then it will attempt to migrate from the current version to the latest version -
    353     * -
    354     * @param string $from  -
    355     * @param string $to  -
    356     * @return void -
    357     */ -
    358    public function migrate($to = null) -
    359    { -
    360        $from = $this->getCurrentVersion(); -
    361         -
    362        // If nothing specified then lets assume we are migrating from the current version to the latest version -
    363        if ($to === null) { -
    364            $to = $this->getLatestVersion(); -
    365        } -
    366         -
    367        if ($from == $to) { -
    368            throw new Doctrine_Migration_Exception('Already at version # ' . $to); -
    369        } -
    370         -
    371        $direction = $from > $to ? 'down':'up'; -
    372         -
    373        if ($direction === 'up') { -
    374            for ($i = $from + 1; $i <= $to; $i++) { -
    375                $this->doMigrateStep($direction, $i); -
    376            } -
    377        } else { -
    378            for ($i = $from; $i > $to; $i--) { -
    379                $this->doMigrateStep($direction, $i); -
    380            } -
    381        } -
    382         -
    383        $this->setCurrentVersion($to); -
    384         -
    385        return $to; -
    386    } -
    387 -
    388    /** -
    389     * addChange -
    390     * -
    391     * @param string $type  -
    392     * @param string $array  -
    393     * @return void -
    394     */ -
    395    protected function addChange($type, array $change = array()) -
    396    { -
    397        $this->_changes[$type][] = $change; -
    398    } -
    399 -
    400    /** -
    401     * createTable -
    402     * -
    403     * @param string $tableName  -
    404     * @param string $array  -
    405     * @param string $array  -
    406     * @return void -
    407     */ -
    408    public function createTable($tableName, array $fields = array(), array $options = array()) -
    409    { -
    410        $options = get_defined_vars(); -
    411         -
    412        $this->addChange('created_tables', $options); -
    413    } -
    414 -
    415    /** -
    416     * dropTable -
    417     * -
    418     * @param string $tableName  -
    419     * @return void -
    420     */ -
    421    public function dropTable($tableName) -
    422    { -
    423        $options = get_defined_vars(); -
    424         -
    425        $this->addChange('dropped_tables', $options); -
    426    } -
    427 -
    428    /** -
    429     * renameTable -
    430     * -
    431     * @param string $oldTableName  -
    432     * @param string $newTableName  -
    433     * @return void -
    434     */ -
    435    public function renameTable($oldTableName, $newTableName) -
    436    { -
    437        $options = get_defined_vars(); -
    438         -
    439        $this->addChange('renamed_tables', $options); -
    440    } -
    441 -
    442    /** -
    443     * createConstraint -
    444     * -
    445     * @param string $tableName -
    446     * @param string $constraintName -
    447     * @return void -
    448     */ -
    449    public function createConstraint($tableName, $constraintName, array $definition) -
    450    { -
    451        $options = get_defined_vars(); -
    452         -
    453        $this->addChange('created_constraints', $options); -
    454    } -
    455 -
    456    /** -
    457     * dropConstraint -
    458     * -
    459     * @param string $tableName -
    460     * @param string $constraintName -
    461     * @return void -
    462     */ -
    463    public function dropConstraint($tableName, $constraintName, $primary = false) -
    464    { -
    465        $options = get_defined_vars(); -
    466         -
    467        $this->addChange('dropped_constraints', $options); -
    468    } -
    469 -
    470    /** -
    471     * createForeignKey -
    472     * -
    473     * @param string $tableName -
    474     * @param string $constraintName -
    475     * @return void -
    476     */ -
    477    public function createForeignKey($tableName, array $definition) -
    478    { -
    479        $options = get_defined_vars(); -
    480         -
    481        $this->addChange('created_fks', $options); -
    482    } -
    483 -
    484    /** -
    485     * dropForeignKey -
    486     * -
    487     * @param string $tableName -
    488     * @param string $constraintName -
    489     * @return void -
    490     */ -
    491    public function dropForeignKey($tableName, $fkName) -
    492    { -
    493        $options = get_defined_vars(); -
    494         -
    495        $this->addChange('dropped_fks', $options); -
    496    } -
    497 -
    498    /** -
    499     * addColumn -
    500     * -
    501     * @param string $tableName  -
    502     * @param string $columnName  -
    503     * @param string $type  -
    504     * @param string $array  -
    505     * @return void -
    506     */ -
    507    public function addColumn($tableName, $columnName, $type, array $options = array()) -
    508    { -
    509        $options = get_defined_vars(); -
    510         -
    511        $this->addChange('added_columns', $options); -
    512    } -
    513 -
    514    /** -
    515     * renameColumn -
    516     * -
    517     * @param string $tableName  -
    518     * @param string $oldColumnName  -
    519     * @param string $newColumnName  -
    520     * @return void -
    521     */ -
    522    public function renameColumn($tableName, $oldColumnName, $newColumnName) -
    523    { -
    524        $options = get_defined_vars(); -
    525         -
    526        $this->addChange('renamed_columns', $options); -
    527    } -
    528 -
    529    /** -
    530     * renameColumn -
    531     * -
    532     * @param string $tableName  -
    533     * @param string $columnName  -
    534     * @param string $type  -
    535     * @param string $array  -
    536     * @return void -
    537     */ -
    538    public function changeColumn($tableName, $columnName, $type, array $options = array()) -
    539    { -
    540        $options = get_defined_vars(); -
    541         -
    542        $this->addChange('changed_columns', $options); -
    543    } -
    544 -
    545    /** -
    546     * removeColumn -
    547     * -
    548     * @param string $tableName  -
    549     * @param string $columnName  -
    550     * @return void -
    551     */ -
    552    public function removeColumn($tableName, $columnName) -
    553    { -
    554        $options = get_defined_vars(); -
    555         -
    556        $this->addChange('removed_columns', $options); -
    557    } -
    558 -
    559    /** -
    560     * addIndex -
    561     * -
    562     * @param string $tableName  -
    563     * @param string $indexName  -
    564     * @param string $array  -
    565     * @return void -
    566     */ -
    567    public function addIndex($tableName, $indexName, array $definition) -
    568    { -
    569        $options = get_defined_vars(); -
    570         -
    571        $this->addChange('added_indexes', $options); -
    572    } -
    573 -
    574    /** -
    575     * removeIndex -
    576     * -
    577     * @param string $tableName  -
    578     * @param string $indexName  -
    579     * @return void -
    580     */ -
    581    public function removeIndex($tableName, $indexName) -
    582    { -
    583        $options = get_defined_vars(); -
    584         -
    585        $this->addChange('removed_indexes', $options); -
    586    } -
    587} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Migration_Process.html b/tests_old/coverage/Doctrine_Migration_Process.html deleted file mode 100755 index 0bdd4c455..000000000 --- a/tests_old/coverage/Doctrine_Migration_Process.html +++ /dev/null @@ -1,764 +0,0 @@ - - - Coverage for Doctrine_Migration_Process - - -

    Coverage for Doctrine_Migration_Process

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Process.php 1080 2007-02-10 18:17:08Z jwage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Migration_Process -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Migration -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1080 $ -
    31 * @author      Jonathan H. Wage <jwage@mac.com> -
    32 */ -
    33class Doctrine_Migration_Process -
    34{ -
    35    /** -
    36     * getConnection -
    37     * -
    38     * @param string $tableName  -
    39     * @return void -
    40     */ -
    41    public function getConnection($tableName) -
    42    { -
    43        return Doctrine::getConnectionByTableName($tableName); -
    44    } -
    45 -
    46    /** -
    47     * processCreatedTables -
    48     * -
    49     * @param string $tables  -
    50     * @return void -
    51     */ -
    52    public function processCreatedTables($tables) -
    53    { -
    54        foreach ($tables as $table) { -
    55            $conn = $this->getConnection($table['tableName']); -
    56             -
    57            $conn->export->createTable($table['tableName'], $table['fields'], $table['options']); -
    58        } -
    59    } -
    60 -
    61    /** -
    62     * processDroppedTables -
    63     * -
    64     * @param string $tables  -
    65     * @return void -
    66     */ -
    67    public function processDroppedTables($tables) -
    68    { -
    69        foreach ($tables as $table) { -
    70            $conn = $this->getConnection($table['tableName']); -
    71             -
    72            $conn->export->dropTable($table['tableName']); -
    73        } -
    74    } -
    75 -
    76    /** -
    77     * processRenamedTables -
    78     * -
    79     * @param string $tables  -
    80     * @return void -
    81     */ -
    82    public function processRenamedTables($tables) -
    83    { -
    84        foreach ($tables as $table) { -
    85            $conn = $this->getConnection($table['newTableName']); -
    86             -
    87            $conn->export->alterTable($table['oldTableName'], array('name' => $table['newTableName'])); -
    88        } -
    89    } -
    90 -
    91    /** -
    92     * processAddedColumns -
    93     * -
    94     * @param string $columns  -
    95     * @return void -
    96     */ -
    97    public function processAddedColumns($columns) -
    98    { -
    99        foreach ($columns as $column) { -
    100            $conn = $this->getConnection($column['tableName']); -
    101             -
    102            $options = array(); -
    103            $options = $column['options']; -
    104            $options['type'] = $column['type']; -
    105             -
    106            $conn->export->alterTable($column['tableName'], array('add' => array($column['columnName'] => $options))); -
    107        } -
    108    } -
    109 -
    110    /** -
    111     * processRenamedColumns -
    112     * -
    113     * @param string $columns  -
    114     * @return void -
    115     */ -
    116    public function processRenamedColumns($columns) -
    117    { -
    118        foreach ($columns as $column) { -
    119            $conn = $this->getConnection($column['tableName']); -
    120             -
    121            $columnList = $conn->import->listTableColumns($column['tableName']); -
    122            if (isset($columnList[$column['oldColumnName']])) { -
    123             $conn->export->alterTable($column['tableName'],  -
    124                                       array('rename' => array($column['oldColumnName'] => array('name' => $column['newColumnName'], -
    125                                        'definition'=>$columnList[$column['oldColumnName']])))); -
    126            } -
    127        } -
    128    } -
    129 -
    130    /** -
    131     * processChangedColumns -
    132     * -
    133     * @param string $columns  -
    134     * @return void -
    135     */ -
    136    public function processChangedColumns($columns) -
    137    { -
    138        foreach ($columns as $column) { -
    139            $conn = $this->getConnection($column['tableName']); -
    140             -
    141            $options = array(); -
    142            $options = $column['options']; -
    143            $options['type'] = $column['type']; -
    144             -
    145            $conn->export->alterTable($column['tableName'], array('change' => array($column['columnName'] => array('definition' => $options)))); -
    146        }   -
    147    } -
    148 -
    149    /** -
    150     * processRemovedColumns -
    151     * -
    152     * @param string $columns  -
    153     * @return void -
    154     */ -
    155    public function processRemovedColumns($columns) -
    156    { -
    157        foreach ($columns as $column) { -
    158            $conn = $this->getConnection($column['tableName']); -
    159             -
    160            $conn->export->alterTable($column['tableName'], array('remove' => array($column['columnName'] => array()))); -
    161        } -
    162    } -
    163 -
    164    /** -
    165     * processAddexIndexes -
    166     * -
    167     * @param string $indexes  -
    168     * @return void -
    169     */ -
    170    public function processAddedIndexes($indexes) -
    171    { -
    172        foreach ($indexes as $index) { -
    173            $conn = $this->getConnection($index['tableName']); -
    174             -
    175            $conn->export->createIndex($index['tableName'], $index['indexName'], $index['definition']); -
    176        } -
    177    } -
    178 -
    179    /** -
    180     * processRemovedIndexes -
    181     * -
    182     * @param string $indexes  -
    183     * @return void -
    184     */ -
    185    public function processRemovedIndexes($indexes) -
    186    { -
    187        foreach ($indexes as $index) { -
    188            $conn = $this->getConnection($index['tableName']); -
    189             -
    190            $conn->export->dropIndex($index['tableName'], $index['indexName']); -
    191        }  -
    192    } -
    193 -
    194    /** -
    195     * processCreatedConstraints -
    196     * -
    197     * @param string $constraints  -
    198     * @return void -
    199     */ -
    200    public function processCreatedConstraints($constraints) -
    201    { -
    202        foreach ($constraints as $constraint) { -
    203            $conn = $this->getConnection($constraint['tableName']); -
    204            $conn->export->createConstraint($constraint['tableName'], $constraint['constraintName'], -
    205                    $constraint['definition']); -
    206        } -
    207    } -
    208 -
    209    /** -
    210     * processDroppedConstraints -
    211     * -
    212     * @param string $constraints  -
    213     * @return void -
    214     */ -
    215    public function processDroppedConstraints($constraints) -
    216    { -
    217        foreach ($constraints as $constraint) { -
    218            $conn = $this->getConnection($constraint['tableName']); -
    219            $conn->export->dropConstraint($constraint['tableName'], $constraint['constraintName'], -
    220                    $constraint['primary']); -
    221        } -
    222    } -
    223 -
    224    /** -
    225     * processCreatedFks -
    226     * -
    227     * @param string $foreignKeys  -
    228     * @return void -
    229     */ -
    230    public function processCreatedFks($foreignKeys) -
    231    { -
    232        foreach ($foreignKeys as $fk) { -
    233            $conn = $this->getConnection($fk['tableName']); -
    234            $conn->export->createForeignKey($fk['tableName'], $fk['definition']); -
    235        } -
    236    } -
    237 -
    238    /** -
    239     * processDroppedFks -
    240     * -
    241     * @param string $foreignKeys  -
    242     * @return void -
    243     */ -
    244    public function processDroppedFks($foreignKeys) -
    245    { -
    246        foreach ($foreignKeys as $fk) { -
    247            $conn = $this->getConnection($fk['tableName']); -
    248            $conn->export->dropForeignKey($fk['tableName'], $fk['fkName']); -
    249        } -
    250    } -
    251}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Node.html b/tests_old/coverage/Doctrine_Node.html deleted file mode 100644 index c2e56e389..000000000 --- a/tests_old/coverage/Doctrine_Node.html +++ /dev/null @@ -1,554 +0,0 @@ - - - Coverage for Doctrine_Node - - -

    Coverage for Doctrine_Node

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Node.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Node -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Node -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Joe Simms <joe.simms@websites4.com> -
    32 */ -
    33class Doctrine_Node implements IteratorAggregate -
    34{ -
    35    /** -
    36     * @param object    $record   reference to associated Doctrine_Record instance -
    37     */ -
    38    protected $record; -
    39 -
    40    /** -
    41     * @param array     $options -
    42     */ -
    43    protected $options; -
    44 -
    45    /** -
    46     * @param string     $iteratorType  (Pre | Post | Level) -
    47     */ -
    48    protected $iteratorType; -
    49 -
    50    /** -
    51     * @param array     $iteratorOptions -
    52     */ -
    53    protected $iteratorOptions; -
    54 -
    55    /** -
    56     * The tree to which the node belongs. -
    57     * -
    58     * @var unknown_type -
    59     */ -
    60    protected $_tree; -
    61 -
    62    /** -
    63     * contructor, creates node with reference to record and any options -
    64     * -
    65     * @param object $record                    instance of Doctrine_Record -
    66     * @param array $options                    options -
    67     */ -
    68    public function __construct(Doctrine_Record $record, $options) -
    69    { -
    70        $this->record = $record; -
    71        $this->options = $options; -
    72         -
    73        // Make sure that the tree object of the root component is used in the case -
    74        // of column aggregation inheritance. -
    75        $class = $record->getTable()->getComponentName(); -
    76        $table = $record->getTable(); -
    77        if ($table->getOption('inheritanceMap')) { -
    78            $subclasses = $table->getOption('subclasses'); -
    79            while (in_array($class, $subclasses)) { -
    80                $class = get_parent_class($class); -
    81            } -
    82        } -
    83        if ($class != $table->getComponentName()) { -
    84            $this->_tree = $table->getConnection()->getTable($class)->getTree(); -
    85        } else { -
    86            $this->_tree = $table->getTree(); -
    87        } -
    88    } -
    89 -
    90    /** -
    91     * factory method to return node instance based upon chosen implementation -
    92     * -
    93     * @param object $record                    instance of Doctrine_Record -
    94     * @param string $impName                   implementation (NestedSet, AdjacencyList, MaterializedPath) -
    95     * @param array $options                    options -
    96     * @return object $options                  instance of Doctrine_Node -
    97     */ -
    98    public static function factory(Doctrine_Record $record, $implName, $options = array()) -
    99    { -
    100        $class = 'Doctrine_Node_' . $implName; -
    101 -
    102        if ( ! class_exists($class)) { -
    103            throw new Doctrine_Node_Exception("The class $class must exist and extend Doctrine_Node"); -
    104        } -
    105 -
    106        return new $class($record, $options); -
    107    } -
    108 -
    109    /** -
    110     * setter for record attribute -
    111     * -
    112     * @param object $record                    instance of Doctrine_Record -
    113     */ -
    114    public function setRecord(Doctrine_Record $record) -
    115    { -
    116        $this->record = $record; -
    117    } -
    118 -
    119    /** -
    120     * getter for record attribute -
    121     * -
    122     * @return object                           instance of Doctrine_Record -
    123     */ -
    124    public function getRecord() -
    125    { -
    126        return $this->record; -
    127    } -
    128 -
    129    /** -
    130     * convenience function for getIterator -
    131     * -
    132     * @param string $type                      type of iterator (Pre | Post | Level) -
    133     * @param array $options                    options -
    134     */ -
    135    public function traverse($type = 'Pre', $options = array()) -
    136    { -
    137        return $this->getIterator($type, $options); -
    138    } -
    139 -
    140    /** -
    141     * get iterator -
    142     * -
    143     * @param string $type                      type of iterator (Pre | Post | Level) -
    144     * @param array $options                    options -
    145     */ -
    146    public function getIterator($type = null, $options = null) -
    147    { -
    148        if ($type === null) { -
    149            $type = (isset($this->iteratorType) ? $this->iteratorType : 'Pre'); -
    150        } -
    151 -
    152        if ($options === null) { -
    153            $options = (isset($this->iteratorOptions) ? $this->iteratorOptions : array()); -
    154        } -
    155 -
    156        $implName = $this->record->getTable()->getOption('treeImpl'); -
    157        $iteratorClass = 'Doctrine_Node_' . $implName . '_' . ucfirst(strtolower($type)) . 'OrderIterator'; -
    158 -
    159        return new $iteratorClass($this->record, $options); -
    160    } -
    161 -
    162    /** -
    163     * sets node's iterator type -
    164     * -
    165     * @param int -
    166     */ -
    167    public function setIteratorType($type) -
    168    { -
    169        $this->iteratorType = $type; -
    170    } -
    171 -
    172    /** -
    173     * sets node's iterator options -
    174     * -
    175     * @param int -
    176     */ -
    177    public function setIteratorOptions($options) -
    178    { -
    179        $this->iteratorOptions = $options; -
    180    } -
    181}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Node_NestedSet.html b/tests_old/coverage/Doctrine_Node_NestedSet.html deleted file mode 100644 index cfa83898c..000000000 --- a/tests_old/coverage/Doctrine_Node_NestedSet.html +++ /dev/null @@ -1,2993 +0,0 @@ - - - Coverage for Doctrine_Node_NestedSet - - -

    Coverage for Doctrine_Node_NestedSet

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *    $Id: NestedSet.php 2967 2007-10-21 09:00:40Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Node_NestedSet -
    24 * -
    25 * @package    Doctrine -
    26 * @subpackage Node -
    27 * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link       www.phpdoctrine.org -
    29 * @since      1.0 -
    30 * @version    $Revision: 2967 $ -
    31 * @author     Joe Simms <joe.simms@websites4.com> -
    32 * @author     Roman Borschel <roman@code-factory.org>      -
    33 */ -
    34class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Interface -
    35{ -
    36    /** -
    37     * test if node has previous sibling -
    38     * -
    39     * @return bool             -
    40     */ -
    41    public function hasPrevSibling() -
    42    { -
    43        return $this->isValidNode($this->getPrevSibling());         -
    44    } -
    45 -
    46    /** -
    47     * test if node has next sibling -
    48     * -
    49     * @return bool             -
    50     */  -
    51    public function hasNextSibling() -
    52    { -
    53        return $this->isValidNode($this->getNextSibling());         -
    54    } -
    55 -
    56    /** -
    57     * test if node has children -
    58     * -
    59     * @return bool             -
    60     */ -
    61    public function hasChildren() -
    62    { -
    63        return (($this->getRightValue() - $this->getLeftValue() ) >1 );         -
    64    } -
    65 -
    66    /** -
    67     * test if node has parent -
    68     * -
    69     * @return bool             -
    70     */ -
    71    public function hasParent() -
    72    { -
    73        return !$this->isRoot(); -
    74    } -
    75 -
    76    /** -
    77     * gets record of prev sibling or empty record -
    78     * -
    79     * @return object     Doctrine_Record             -
    80     */ -
    81    public function getPrevSibling() -
    82    { -
    83        $baseAlias = $this->_tree->getBaseAlias(); -
    84        $q = $this->_tree->getBaseQuery(); -
    85        $q = $q->addWhere("$baseAlias.rgt = ?", $this->getLeftValue() - 1); -
    86        $q = $this->_tree->returnQueryWithRootId($q, $this->getRootValue()); -
    87        $result = $q->execute(); -
    88 -
    89        if (count($result) <= 0) { -
    90            return false; -
    91        } -
    92         -
    93        if ($result instanceof Doctrine_Collection) { -
    94            $sibling = $result->getFirst(); -
    95        } else if (is_array($result)) { -
    96            $sibling = array_shift($result); -
    97        } -
    98         -
    99        return $sibling; -
    100    } -
    101 -
    102    /** -
    103     * gets record of next sibling or empty record -
    104     * -
    105     * @return object     Doctrine_Record             -
    106     */ -
    107    public function getNextSibling() -
    108    { -
    109        $baseAlias = $this->_tree->getBaseAlias(); -
    110        $q = $this->_tree->getBaseQuery(); -
    111        $q = $q->addWhere("$baseAlias.lft = ?", $this->getRightValue() + 1); -
    112        $q = $this->_tree->returnQueryWithRootId($q, $this->getRootValue()); -
    113        $result = $q->execute(); -
    114 -
    115        if (count($result) <= 0) { -
    116            return false; -
    117        } -
    118         -
    119        if ($result instanceof Doctrine_Collection) { -
    120            $sibling = $result->getFirst(); -
    121        } else if (is_array($result)) { -
    122            $sibling = array_shift($result); -
    123        } -
    124         -
    125        return $sibling; -
    126    } -
    127 -
    128    /** -
    129     * gets siblings for node -
    130     * -
    131     * @return array     array of sibling Doctrine_Record objects             -
    132     */ -
    133    public function getSiblings($includeNode = false) -
    134    { -
    135        $parent = $this->getParent(); -
    136        $siblings = array(); -
    137        if ($parent->exists()) { -
    138            foreach ($parent->getNode()->getChildren() as $child) { -
    139                if ($this->isEqualTo($child) && !$includeNode) { -
    140                    continue; -
    141                } -
    142                $siblings[] = $child; -
    143            }         -
    144        } -
    145        return $siblings; -
    146    } -
    147 -
    148    /** -
    149     * gets record of first child or empty record -
    150     * -
    151     * @return object     Doctrine_Record             -
    152     */ -
    153    public function getFirstChild() -
    154    { -
    155        $baseAlias = $this->_tree->getBaseAlias(); -
    156        $q = $this->_tree->getBaseQuery(); -
    157        $q->addWhere("$baseAlias.lft = ?", $this->getLeftValue() + 1); -
    158        $this->_tree->returnQueryWithRootId($q, $this->getRootValue()); -
    159        $result = $q->execute(); -
    160 -
    161        if (count($result) <= 0) { -
    162            return false; -
    163        } -
    164         -
    165        if ($result instanceof Doctrine_Collection) { -
    166            $child = $result->getFirst(); -
    167        } else if (is_array($result)) { -
    168            $child = array_shift($result); -
    169        } -
    170         -
    171        return $child;        -
    172    } -
    173 -
    174    /** -
    175     * gets record of last child or empty record -
    176     * -
    177     * @return object     Doctrine_Record             -
    178     */ -
    179    public function getLastChild() -
    180    { -
    181        $baseAlias = $this->_tree->getBaseAlias(); -
    182        $q = $this->_tree->getBaseQuery(); -
    183        $q->addWhere("$baseAlias.rgt = ?", $this->getRightValue() - 1); -
    184        $this->_tree->returnQueryWithRootId($q, $this->getRootValue()); -
    185        $result = $q->execute(); -
    186 -
    187        if (count($result) <= 0) { -
    188            return false; -
    189        } -
    190         -
    191        if ($result instanceof Doctrine_Collection) { -
    192            $child = $result->getFirst(); -
    193        } else if (is_array($result)) { -
    194            $child = array_shift($result); -
    195        } -
    196         -
    197        return $child;       -
    198    } -
    199 -
    200    /** -
    201     * gets children for node (direct descendants only) -
    202     * -
    203     * @return mixed The children of the node or FALSE if the node has no children.                -
    204     */ -
    205    public function getChildren() -
    206    {  -
    207        return $this->getDescendants(1); -
    208    } -
    209 -
    210    /** -
    211     * gets descendants for node (direct descendants only) -
    212     * -
    213     * @return mixed  The descendants of the node or FALSE if the node has no descendants. -
    214     * @todo Currently all descendants are fetched, no matter the depth. Maybe there is a better -
    215     *       solution with less overhead.       -
    216     */ -
    217    public function getDescendants($depth = null, $includeNode = false) -
    218    { -
    219        $baseAlias = $this->_tree->getBaseAlias(); -
    220        $q = $this->_tree->getBaseQuery(); -
    221        $params = array($this->record->get('lft'), $this->record->get('rgt')); -
    222         -
    223        if ($includeNode) { -
    224            $q->addWhere("$baseAlias.lft >= ? AND $baseAlias.rgt <= ?", $params)->addOrderBy("$baseAlias.lft asc"); -
    225        } else { -
    226            $q->addWhere("$baseAlias.lft > ? AND $baseAlias.rgt < ?", $params)->addOrderBy("$baseAlias.lft asc"); -
    227        } -
    228         -
    229        if ($depth !== null) { -
    230            $q->addWhere("$baseAlias.level <= ?", $this->record['level'] + $depth); -
    231        } -
    232         -
    233        $q = $this->_tree->returnQueryWithRootId($q, $this->getRootValue()); -
    234        $result = $q->execute(); -
    235 -
    236        if (count($result) <= 0) { -
    237            return false; -
    238        } -
    239 -
    240        return $result; -
    241    } -
    242 -
    243    /** -
    244     * gets record of parent or empty record -
    245     * -
    246     * @return object     Doctrine_Record             -
    247     */ -
    248    public function getParent() -
    249    { -
    250        $baseAlias = $this->_tree->getBaseAlias(); -
    251        $q = $this->_tree->getBaseQuery(); -
    252        $q->addWhere("$baseAlias.lft < ? AND $baseAlias.rgt > ?", array($this->getLeftValue(), $this->getRightValue())) -
    253                ->addOrderBy("$baseAlias.rgt asc"); -
    254        $q = $this->_tree->returnQueryWithRootId($q, $this->getRootValue()); -
    255        $result = $q->execute(); -
    256         -
    257        if (count($result) <= 0) { -
    258            return false; -
    259        } -
    260                -
    261        if ($result instanceof Doctrine_Collection) { -
    262            $parent = $result->getFirst(); -
    263        } else if (is_array($result)) { -
    264            $parent = array_shift($result); -
    265        } -
    266         -
    267        return $parent; -
    268    } -
    269 -
    270    /** -
    271     * gets ancestors for node -
    272     * -
    273     * @param integer $deth  The depth 'upstairs'. -
    274     * @return mixed  The ancestors of the node or FALSE if the node has no ancestors (this  -
    275     *                basically means it's a root node).                 -
    276     */ -
    277    public function getAncestors($depth = null) -
    278    { -
    279        $baseAlias = $this->_tree->getBaseAlias(); -
    280        $q = $this->_tree->getBaseQuery(); -
    281        $q->addWhere("$baseAlias.lft < ? AND $baseAlias.rgt > ?", array($this->getLeftValue(), $this->getRightValue())) -
    282                ->addOrderBy("$baseAlias.lft asc"); -
    283        if ($depth !== null) { -
    284            $q->addWhere("$baseAlias.level >= ?", $this->record['level'] - $depth); -
    285        } -
    286        $q = $this->_tree->returnQueryWithRootId($q, $this->getRootValue()); -
    287        $ancestors = $q->execute(); -
    288        if (count($ancestors) <= 0) { -
    289            return false; -
    290        } -
    291        return $ancestors; -
    292    } -
    293 -
    294    /** -
    295     * gets path to node from root, uses record::toString() method to get node names -
    296     * -
    297     * @param string     $seperator     path seperator -
    298     * @param bool     $includeNode     whether or not to include node at end of path -
    299     * @return string     string representation of path                 -
    300     */      -
    301    public function getPath($seperator = ' > ', $includeRecord = false) -
    302    { -
    303        $path = array(); -
    304        $ancestors = $this->getAncestors(); -
    305        foreach ($ancestors as $ancestor) { -
    306            $path[] = $ancestor->__toString(); -
    307        } -
    308        if ($includeRecord) { -
    309            $path[] = $this->getRecord()->__toString(); -
    310        } -
    311             -
    312        return implode($seperator, $path); -
    313    } -
    314 -
    315    /** -
    316     * gets number of children (direct descendants) -
    317     * -
    318     * @return int             -
    319     */      -
    320    public function getNumberChildren() -
    321    { -
    322        return count($this->getChildren()); -
    323    } -
    324 -
    325    /** -
    326     * gets number of descendants (children and their children) -
    327     * -
    328     * @return int             -
    329     */ -
    330    public function getNumberDescendants() -
    331    { -
    332        return ($this->getRightValue() - $this->getLeftValue() - 1) / 2; -
    333    } -
    334 -
    335    /** -
    336     * inserts node as parent of dest record -
    337     * -
    338     * @return bool -
    339     * @todo Wrap in transaction           -
    340     */ -
    341    public function insertAsParentOf(Doctrine_Record $dest) -
    342    { -
    343        // cannot insert a node that has already has a place within the tree -
    344        if ($this->isValidNode()) { -
    345            return false; -
    346        } -
    347        // cannot insert as parent of root -
    348        if ($dest->getNode()->isRoot()) { -
    349            return false; -
    350        } -
    351        $newRoot = $dest->getNode()->getRootValue(); -
    352        $this->shiftRLValues($dest->getNode()->getLeftValue(), 1, $newRoot); -
    353        $this->shiftRLValues($dest->getNode()->getRightValue() + 2, 1, $newRoot); -
    354         -
    355        $newLeft = $dest->getNode()->getLeftValue(); -
    356        $newRight = $dest->getNode()->getRightValue() + 2; -
    357 -
    358        $this->record['level'] = $dest['level'] - 1; -
    359        $this->insertNode($newLeft, $newRight, $newRoot); -
    360         -
    361        return true; -
    362    } -
    363 -
    364    /** -
    365     * inserts node as previous sibling of dest record -
    366     * -
    367     * @return bool -
    368     * @todo Wrap in transaction        -
    369     */ -
    370    public function insertAsPrevSiblingOf(Doctrine_Record $dest) -
    371    { -
    372        // cannot insert a node that has already has a place within the tree -
    373        if ($this->isValidNode()) -
    374            return false; -
    375 -
    376        $newLeft = $dest->getNode()->getLeftValue(); -
    377        $newRight = $dest->getNode()->getLeftValue() + 1; -
    378        $newRoot = $dest->getNode()->getRootValue(); -
    379         -
    380        $this->shiftRLValues($newLeft, 2, $newRoot); -
    381        $this->record['level'] = $dest['level']; -
    382        $this->insertNode($newLeft, $newRight, $newRoot); -
    383        // update destination left/right values to prevent a refresh -
    384        // $dest->getNode()->setLeftValue($dest->getNode()->getLeftValue() + 2); -
    385        // $dest->getNode()->setRightValue($dest->getNode()->getRightValue() + 2); -
    386                         -
    387        return true; -
    388    } -
    389 -
    390    /** -
    391     * inserts node as next sibling of dest record -
    392     * -
    393     * @return bool -
    394     * @todo Wrap in transaction            -
    395     */     -
    396    public function insertAsNextSiblingOf(Doctrine_Record $dest) -
    397    { -
    398        // cannot insert a node that has already has a place within the tree -
    399        if ($this->isValidNode()) -
    400            return false; -
    401 -
    402        $newLeft = $dest->getNode()->getRightValue() + 1; -
    403        $newRight = $dest->getNode()->getRightValue() + 2; -
    404        $newRoot = $dest->getNode()->getRootValue(); -
    405 -
    406        $this->shiftRLValues($newLeft, 2, $newRoot); -
    407        $this->record['level'] = $dest['level']; -
    408        $this->insertNode($newLeft, $newRight, $newRoot); -
    409 -
    410        // update destination left/right values to prevent a refresh -
    411        // no need, node not affected -
    412 -
    413        return true; -
    414    } -
    415 -
    416    /** -
    417     * inserts node as first child of dest record -
    418     * -
    419     * @return bool -
    420     * @todo Wrap in transaction          -
    421     */ -
    422    public function insertAsFirstChildOf(Doctrine_Record $dest) -
    423    { -
    424        // cannot insert a node that has already has a place within the tree -
    425        if ($this->isValidNode()) -
    426            return false; -
    427 -
    428        $newLeft = $dest->getNode()->getLeftValue() + 1; -
    429        $newRight = $dest->getNode()->getLeftValue() + 2; -
    430        $newRoot = $dest->getNode()->getRootValue(); -
    431 -
    432        $this->shiftRLValues($newLeft, 2, $newRoot); -
    433        $this->record['level'] = $dest['level'] + 1; -
    434        $this->insertNode($newLeft, $newRight, $newRoot); -
    435         -
    436        // update destination left/right values to prevent a refresh -
    437        // $dest->getNode()->setRightValue($dest->getNode()->getRightValue() + 2); -
    438 -
    439        return true; -
    440    } -
    441 -
    442    /** -
    443     * inserts node as last child of dest record -
    444     * -
    445     * @return bool -
    446     * @todo Wrap in transaction             -
    447     */ -
    448    public function insertAsLastChildOf(Doctrine_Record $dest) -
    449    { -
    450        // cannot insert a node that has already has a place within the tree -
    451        if ($this->isValidNode()) -
    452            return false; -
    453 -
    454        $newLeft = $dest->getNode()->getRightValue(); -
    455        $newRight = $dest->getNode()->getRightValue() + 1; -
    456        $newRoot = $dest->getNode()->getRootValue(); -
    457 -
    458        $this->shiftRLValues($newLeft, 2, $newRoot); -
    459        $this->record['level'] = $dest['level'] + 1; -
    460        $this->insertNode($newLeft, $newRight, $newRoot); -
    461 -
    462        // update destination left/right values to prevent a refresh -
    463        // $dest->getNode()->setRightValue($dest->getNode()->getRightValue() + 2); -
    464         -
    465        return true; -
    466    } -
    467 -
    468    /** -
    469     * Accomplishes moving of nodes between different trees. -
    470     * Used by the move* methods if the root values of the two nodes are different. -
    471     * -
    472     * @param Doctrine_Record $dest -
    473     * @param unknown_type $newLeftValue -
    474     * @param unknown_type $moveType -
    475     * @todo Better exception handling/wrapping -
    476     */ -
    477    private function _moveBetweenTrees(Doctrine_Record $dest, $newLeftValue, $moveType) -
    478    { -
    479        $conn = $this->record->getTable()->getConnection(); -
    480             -
    481            try { -
    482                $conn->beginTransaction(); -
    483                 -
    484                // Move between trees: Detach from old tree & insert into new tree -
    485                $newRoot = $dest->getNode()->getRootValue(); -
    486                $oldRoot = $this->getRootValue(); -
    487                $oldLft = $this->getLeftValue(); -
    488                $oldRgt = $this->getRightValue(); -
    489                $oldLevel = $this->record['level']; -
    490                 -
    491                // Prepare target tree for insertion, make room -
    492                $this->shiftRlValues($newLeftValue, $oldRgt - $oldLft - 1, $newRoot); -
    493                 -
    494                // Set new root id for this node -
    495                $this->setRootValue($newRoot); -
    496                $this->record->save(); -
    497                 -
    498                // Close gap in old tree -
    499                $first = $oldRgt + 1; -
    500                $delta = $oldLft - $oldRgt - 1; -
    501                $this->shiftRLValues($first, $delta, $oldRoot); -
    502                 -
    503                // Insert this node as a new node -
    504                $this->setRightValue(0); -
    505                $this->setLeftValue(0); -
    506                 -
    507                switch ($moveType) { -
    508                    case 'moveAsPrevSiblingOf': -
    509                        $this->insertAsPrevSiblingOf($dest); -
    510                    break; -
    511                    case 'moveAsFirstChildOf': -
    512                        $this->insertAsFirstChildOf($dest); -
    513                    break; -
    514                    case 'moveAsNextSiblingOf': -
    515                        $this->insertAsNextSiblingOf($dest); -
    516                    break; -
    517                    case 'moveAsLastChildOf': -
    518                        $this->insertAsLastChildOf($dest); -
    519                    break; -
    520                    default: -
    521                        throw new Exception("Unknown move operation: $moveType."); -
    522                } -
    523                 -
    524                $diff = $oldRgt - $oldLft; -
    525                $this->setRightValue($this->getLeftValue() + ($oldRgt - $oldLft)); -
    526                $this->record->save(); -
    527                 -
    528                $newLevel = $this->record['level']; -
    529                $levelDiff = $newLevel - $oldLevel; -
    530                 -
    531                // Relocate descendants of the node -
    532                $diff = $this->getLeftValue() - $oldLft; -
    533                $componentName = $this->_tree->getBaseComponent(); -
    534                $rootColName = $this->_tree->getAttribute('rootColumnName'); -
    535 -
    536                // Update lft/rgt/root/level for all descendants -
    537                $q = new Doctrine_Query($conn); -
    538                $q = $q->update($componentName) -
    539                        ->set($componentName . '.lft', 'lft + ?', $diff) -
    540                        ->set($componentName . '.rgt', 'rgt + ?', $diff) -
    541                        ->set($componentName . '.level', 'level + ?', $levelDiff) -
    542                        ->set($componentName . '.' . $rootColName, '?', $newRoot) -
    543                        ->where($componentName . '.lft > ? AND ' . $componentName . '.rgt < ?', -
    544                        array($oldLft, $oldRgt)); -
    545                $q = $this->_tree->returnQueryWithRootId($q, $oldRoot); -
    546                $q->execute(); -
    547                 -
    548                $conn->commit(); -
    549            } catch (Exception $e) { -
    550                $conn->rollback(); -
    551                throw $e; -
    552            } -
    553    } -
    554 -
    555    /** -
    556     * moves node as prev sibling of dest record -
    557     *  -
    558     */      -
    559    public function moveAsPrevSiblingOf(Doctrine_Record $dest) -
    560    { -
    561        if ($dest->getNode()->getRootValue() != $this->getRootValue()) { -
    562            // Move between trees -
    563            $this->_moveBetweenTrees($dest, $dest->getNode()->getLeftValue(), __FUNCTION__); -
    564        } else { -
    565            // Move within the tree -
    566            $oldLevel = $this->record['level']; -
    567            $this->record['level'] = $dest['level']; -
    568            $this->updateNode($dest->getNode()->getLeftValue(), $this->record['level'] - $oldLevel); -
    569        } -
    570    } -
    571 -
    572    /** -
    573     * moves node as next sibling of dest record -
    574     *         -
    575     */ -
    576    public function moveAsNextSiblingOf(Doctrine_Record $dest) -
    577    { -
    578        if ($dest->getNode()->getRootValue() != $this->getRootValue()) { -
    579            // Move between trees -
    580            $this->_moveBetweenTrees($dest, $dest->getNode()->getRightValue() + 1, __FUNCTION__); -
    581        } else { -
    582            // Move within tree -
    583            $oldLevel = $this->record['level']; -
    584            $this->record['level'] = $dest['level']; -
    585            $this->updateNode($dest->getNode()->getRightValue() + 1, $this->record['level'] - $oldLevel); -
    586        } -
    587    } -
    588 -
    589    /** -
    590     * moves node as first child of dest record -
    591     *             -
    592     */ -
    593    public function moveAsFirstChildOf(Doctrine_Record $dest) -
    594    { -
    595        if ($dest->getNode()->getRootValue() != $this->getRootValue()) { -
    596            // Move between trees -
    597            $this->_moveBetweenTrees($dest, $dest->getNode()->getLeftValue() + 1, __FUNCTION__); -
    598        } else { -
    599            // Move within tree -
    600            $oldLevel = $this->record['level']; -
    601            $this->record['level'] = $dest['level'] + 1; -
    602            $this->updateNode($dest->getNode()->getLeftValue() + 1, $this->record['level'] - $oldLevel); -
    603        } -
    604    } -
    605 -
    606    /** -
    607     * moves node as last child of dest record -
    608     *         -
    609     */ -
    610    public function moveAsLastChildOf(Doctrine_Record $dest) -
    611    { -
    612        if ($dest->getNode()->getRootValue() != $this->getRootValue()) { -
    613            // Move between trees -
    614            $this->_moveBetweenTrees($dest, $dest->getNode()->getRightValue(), __FUNCTION__); -
    615        } else { -
    616            // Move within tree -
    617            $oldLevel = $this->record['level']; -
    618            $this->record['level'] = $dest['level'] + 1; -
    619            $this->updateNode($dest->getNode()->getRightValue(), $this->record['level'] - $oldLevel); -
    620        } -
    621    } -
    622 -
    623    /** -
    624     * Makes this node a root node. Only used in multiple-root trees. -
    625     * -
    626     * @todo Exception handling/wrapping -
    627     */ -
    628    public function makeRoot($newRootId) -
    629    { -
    630        // TODO: throw exception instead? -
    631        if ($this->getLeftValue() == 1 || ! $this->_tree->getAttribute('hasManyRoots')) { -
    632            return false; -
    633        } -
    634         -
    635        $oldRgt = $this->getRightValue(); -
    636        $oldLft = $this->getLeftValue(); -
    637        $oldRoot = $this->getRootValue(); -
    638        $oldLevel = $this->record['level']; -
    639         -
    640        try { -
    641            $conn = $this->record->getTable()->getConnection(); -
    642            $conn->beginTransaction(); -
    643             -
    644            // Detach from old tree (close gap in old tree) -
    645            $first = $oldRgt + 1; -
    646            $delta = $oldLft - $oldRgt - 1; -
    647            $this->shiftRLValues($first, $delta, $this->getRootValue()); -
    648             -
    649            // Set new lft/rgt/root/level values for root node -
    650            $this->setLeftValue(1); -
    651            $this->setRightValue($oldRgt - $oldLft + 1); -
    652            $this->setRootValue($newRootId); -
    653            $this->record['level'] = 0; -
    654             -
    655            // Update descendants lft/rgt/root/level values -
    656            $diff = 1 - $oldLft; -
    657            $newRoot = $newRootId; -
    658            $componentName = $this->_tree->getBaseComponent(); -
    659            $rootColName = $this->_tree->getAttribute('rootColumnName'); -
    660            $q = new Doctrine_Query($conn); -
    661            $q = $q->update($componentName) -
    662                    ->set($componentName . '.lft', 'lft + ?', $diff) -
    663                    ->set($componentName . '.rgt', 'rgt + ?', $diff) -
    664                    ->set($componentName . '.level', 'level - ?', $oldLevel) -
    665                    ->set($componentName . '.' . $rootColName, '?', $newRoot) -
    666                    ->where($componentName . '.lft > ? AND ' . $componentName . '.rgt < ?', -
    667                    array($oldLft, $oldRgt)); -
    668            $q = $this->_tree->returnQueryWithRootId($q, $oldRoot); -
    669            $q->execute(); -
    670             -
    671            $conn->commit(); -
    672             -
    673        } catch (Exception $e) { -
    674            $conn->rollback(); -
    675            throw $e; -
    676        } -
    677    } -
    678 -
    679    /** -
    680     * adds node as last child of record -
    681     *         -
    682     */ -
    683    public function addChild(Doctrine_Record $record) -
    684    { -
    685        $record->getNode()->insertAsLastChildOf($this->getRecord()); -
    686    } -
    687 -
    688    /** -
    689     * determines if node is leaf -
    690     * -
    691     * @return bool             -
    692     */ -
    693    public function isLeaf() -
    694    { -
    695        return (($this->getRightValue() - $this->getLeftValue()) == 1); -
    696    } -
    697 -
    698    /** -
    699     * determines if node is root -
    700     * -
    701     * @return bool             -
    702     */ -
    703    public function isRoot() -
    704    { -
    705        return ($this->getLeftValue() == 1); -
    706    } -
    707 -
    708    /** -
    709     * determines if node is equal to subject node -
    710     * -
    711     * @return bool             -
    712     */     -
    713    public function isEqualTo(Doctrine_Record $subj) -
    714    { -
    715        return (($this->getLeftValue() == $subj->getNode()->getLeftValue()) && -
    716                ($this->getRightValue() == $subj->getNode()->getRightValue()) &&  -
    717                ($this->getRootValue() == $subj->getNode()->getRootValue()) -
    718                ); -
    719    } -
    720 -
    721    /** -
    722     * determines if node is child of subject node -
    723     * -
    724     * @return bool -
    725     */ -
    726    public function isDescendantOf(Doctrine_Record $subj) -
    727    { -
    728        return (($this->getLeftValue() > $subj->getNode()->getLeftValue()) && -
    729                ($this->getRightValue() < $subj->getNode()->getRightValue()) && -
    730                ($this->getRootValue() == $subj->getNode()->getRootValue())); -
    731    } -
    732 -
    733    /** -
    734     * determines if node is child of or sibling to subject node -
    735     * -
    736     * @return bool             -
    737     */ -
    738    public function isDescendantOfOrEqualTo(Doctrine_Record $subj) -
    739    { -
    740        return (($this->getLeftValue() >= $subj->getNode()->getLeftValue()) && -
    741                ($this->getRightValue() <= $subj->getNode()->getRightValue()) && -
    742                ($this->getRootValue() == $subj->getNode()->getRootValue())); -
    743    } -
    744 -
    745    /** -
    746     * determines if node is valid -
    747     * -
    748     * @return bool -
    749     */ -
    750    public function isValidNode($record = null) -
    751    { -
    752        if ($record === null) { -
    753          return ($this->getRightValue() > $this->getLeftValue()); -
    754        } else if ( $record instanceof Doctrine_Record ) { -
    755          return ($record->getNode()->getRightValue() > $record->getNode()->getLeftValue()); -
    756        } else { -
    757          return false; -
    758        } -
    759    } -
    760 -
    761    /** -
    762     * deletes node and it's descendants -
    763     * @todo Delete more efficiently. Wrap in transaction if needed.       -
    764     */ -
    765    public function delete() -
    766    { -
    767        // TODO: add the setting whether or not to delete descendants or relocate children -
    768        $oldRoot = $this->getRootValue(); -
    769        $q = $this->_tree->getBaseQuery(); -
    770         -
    771        $baseAlias = $this->_tree->getBaseAlias(); -
    772        $componentName = $this->_tree->getBaseComponent(); -
    773 -
    774        $q = $q->addWhere("$baseAlias.lft >= ? AND $baseAlias.rgt <= ?", array($this->getLeftValue(), $this->getRightValue())); -
    775 -
    776        $q = $this->_tree->returnQueryWithRootId($q, $oldRoot); -
    777         -
    778        $coll = $q->execute(); -
    779 -
    780        $coll->delete(); -
    781 -
    782        $first = $this->getRightValue() + 1; -
    783        $delta = $this->getLeftValue() - $this->getRightValue() - 1; -
    784        $this->shiftRLValues($first, $delta, $oldRoot); -
    785         -
    786        return true;  -
    787    } -
    788 -
    789    /** -
    790     * sets node's left and right values and save's it -
    791     * -
    792     * @param int     $destLeft     node left value -
    793     * @param int        $destRight    node right value -
    794     */     -
    795    private function insertNode($destLeft = 0, $destRight = 0, $destRoot = 1) -
    796    { -
    797        $this->setLeftValue($destLeft); -
    798        $this->setRightValue($destRight); -
    799        $this->setRootValue($destRoot); -
    800        $this->record->save();     -
    801    } -
    802 -
    803    /** -
    804     * move node's and its children to location $destLeft and updates rest of tree -
    805     * -
    806     * @param int     $destLeft    destination left value -
    807     * @todo Wrap in transaction -
    808     */ -
    809    private function updateNode($destLeft, $levelDiff) -
    810    {  -
    811        $componentName = $this->_tree->getBaseComponent(); -
    812        $left = $this->getLeftValue(); -
    813        $right = $this->getRightValue(); -
    814        $rootId = $this->getRootValue(); -
    815 -
    816        $treeSize = $right - $left + 1; -
    817 -
    818        // Make room in the new branch -
    819        $this->shiftRLValues($destLeft, $treeSize, $rootId); -
    820 -
    821        if ($left >= $destLeft) { // src was shifted too? -
    822            $left += $treeSize; -
    823            $right += $treeSize; -
    824        } -
    825 -
    826        // update level for descendants -
    827        $q = new Doctrine_Query(); -
    828        $q = $q->update($componentName) -
    829                ->set($componentName . '.level', 'level + ?') -
    830                ->where($componentName . '.lft > ? AND ' . $componentName . '.rgt < ?', -
    831                        array($levelDiff, $left, $right)); -
    832        $q = $this->_tree->returnQueryWithRootId($q, $rootId); -
    833        $q->execute(); -
    834         -
    835        // now there's enough room next to target to move the subtree -
    836        $this->shiftRLRange($left, $right, $destLeft - $left, $rootId); -
    837 -
    838        // correct values after source (close gap in old tree) -
    839        $this->shiftRLValues($right + 1, -$treeSize, $rootId); -
    840 -
    841        $this->record->save(); -
    842        $this->record->refresh(); -
    843    } -
    844 -
    845    /** -
    846     * adds '$delta' to all Left and Right values that are >= '$first'. '$delta' can also be negative. -
    847     * -
    848     * @param int $first         First node to be shifted -
    849     * @param int $delta         Value to be shifted by, can be negative -
    850     */     -
    851    private function shiftRlValues($first, $delta, $rootId = 1) -
    852    { -
    853        $qLeft  = new Doctrine_Query(); -
    854        $qRight = new Doctrine_Query(); -
    855 -
    856        // shift left columns -
    857        $componentName = $this->_tree->getBaseComponent(); -
    858        $qLeft = $qLeft->update($componentName) -
    859                                ->set($componentName . '.lft', 'lft + ?') -
    860                                ->where($componentName . '.lft >= ?', array($delta, $first)); -
    861         -
    862        $qLeft = $this->_tree->returnQueryWithRootId($qLeft, $rootId); -
    863         -
    864        $resultLeft = $qLeft->execute(); -
    865         -
    866        // shift right columns -
    867        $resultRight = $qRight->update($componentName) -
    868                                ->set($componentName . '.rgt', 'rgt + ?') -
    869                                ->where($componentName . '.rgt >= ?', array($delta, $first)); -
    870 -
    871        $qRight = $this->_tree->returnQueryWithRootId($qRight, $rootId); -
    872 -
    873        $resultRight = $qRight->execute(); -
    874    } -
    875 -
    876    /** -
    877     * adds '$delta' to all Left and Right values that are >= '$first' and <= '$last'.  -
    878     * '$delta' can also be negative. -
    879     * -
    880     * @param int $first     First node to be shifted (L value) -
    881     * @param int $last     Last node to be shifted (L value) -
    882     * @param int $delta         Value to be shifted by, can be negative -
    883     */  -
    884    private function shiftRlRange($first, $last, $delta, $rootId = 1) -
    885    { -
    886        $qLeft  = new Doctrine_Query(); -
    887        $qRight = new Doctrine_Query(); -
    888 -
    889        // shift left column values -
    890        $componentName = $this->_tree->getBaseComponent(); -
    891        $qLeft = $qLeft->update($componentName) -
    892                                ->set($componentName . '.lft', 'lft + ?') -
    893                                ->where($componentName . '.lft >= ? AND ' . $componentName . '.lft <= ?', array($delta, $first, $last)); -
    894         -
    895        $qLeft = $this->_tree->returnQueryWithRootId($qLeft, $rootId); -
    896 -
    897        $resultLeft = $qLeft->execute(); -
    898         -
    899        // shift right column values -
    900        $qRight = $qRight->update($componentName) -
    901                                ->set($componentName . '.rgt', 'rgt + ?') -
    902                                ->where($componentName . '.rgt >= ? AND ' . $componentName . '.rgt <= ?', array($delta, $first, $last)); -
    903 -
    904        $qRight = $this->_tree->returnQueryWithRootId($qRight, $rootId); -
    905 -
    906        $resultRight = $qRight->execute(); -
    907    } -
    908 -
    909    /** -
    910     * gets record's left value -
    911     * -
    912     * @return int             -
    913     */      -
    914    public function getLeftValue() -
    915    { -
    916        return $this->record->get('lft'); -
    917    } -
    918 -
    919    /** -
    920     * sets record's left value -
    921     * -
    922     * @param int             -
    923     */      -
    924    public function setLeftValue($lft) -
    925    { -
    926        $this->record->set('lft', $lft);         -
    927    } -
    928 -
    929    /** -
    930     * gets record's right value -
    931     * -
    932     * @return int             -
    933     */      -
    934    public function getRightValue() -
    935    { -
    936        return $this->record->get('rgt');         -
    937    } -
    938 -
    939    /** -
    940     * sets record's right value -
    941     * -
    942     * @param int             -
    943     */     -
    944    public function setRightValue($rgt) -
    945    { -
    946        $this->record->set('rgt', $rgt);          -
    947    } -
    948 -
    949    /** -
    950     * gets level (depth) of node in the tree -
    951     * -
    952     * @return int             -
    953     */     -
    954    public function getLevel() -
    955    { -
    956        if ( ! isset($this->record['level'])) { -
    957            $baseAlias = $this->_tree->getBaseAlias(); -
    958            $componentName = $this->_tree->getBaseComponent(); -
    959            $q = $this->_tree->getBaseQuery(); -
    960            $q = $q->addWhere("$baseAlias.lft < ? AND $baseAlias.rgt > ?", array($this->getLeftValue(), $this->getRightValue())); -
    961 -
    962            $q = $this->_tree->returnQueryWithRootId($q, $this->getRootValue()); -
    963             -
    964            $coll = $q->execute(); -
    965 -
    966            $this->record['level'] = count($coll) ? count($coll) : 0; -
    967        } -
    968        return $this->record['level']; -
    969    } -
    970 -
    971    /** -
    972     * get records root id value -
    973     *             -
    974     */      -
    975    public function getRootValue() -
    976    { -
    977        if ($this->_tree->getAttribute('hasManyRoots')) { -
    978            return $this->record->get($this->_tree->getAttribute('rootColumnName')); -
    979        } -
    980        return 1; -
    981    } -
    982 -
    983    /** -
    984     * sets records root id value -
    985     * -
    986     * @param int             -
    987     */ -
    988    public function setRootValue($value) -
    989    { -
    990        if ($this->_tree->getAttribute('hasManyRoots')) { -
    991            $this->record->set($this->_tree->getAttribute('rootColumnName'), $value);    -
    992        }     -
    993    } -
    994}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Null.html b/tests_old/coverage/Doctrine_Null.html deleted file mode 100644 index 9583d2104..000000000 --- a/tests_old/coverage/Doctrine_Null.html +++ /dev/null @@ -1,149 +0,0 @@ - - - Coverage for Doctrine_Null - - -

    Coverage for Doctrine_Null

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Null.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Null -
    24 * -
    25 * Simple empty class representing a null value -
    26 * used for extra fast null value testing with isset() rather than array_key_exists() -
    27 * -
    28 * @package     Doctrine -
    29 * @subpackage  Null -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 2963 $ -
    34 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    35 */ -
    36final class Doctrine_Null -
    37{  -
    38    public function exists() -
    39    { -
    40        return false;     -
    41    } -
    42    public function __toString() -
    43    { -
    44        return ''; -
    45    } -
    46}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Parser.html b/tests_old/coverage/Doctrine_Parser.html deleted file mode 100644 index 39994451c..000000000 --- a/tests_old/coverage/Doctrine_Parser.html +++ /dev/null @@ -1,458 +0,0 @@ - - - Coverage for Doctrine_Parser - - -

    Coverage for Doctrine_Parser

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Parser.php 1080 2007-02-10 18:17:08Z jwage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Parser -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Parser -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1080 $ -
    31 * @author      Jonathan H. Wage <jwage@mac.com> -
    32 */ -
    33abstract class Doctrine_Parser -
    34{ -
    35    /** -
    36     * loadData -
    37     * -
    38     * Override in the parser driver -
    39     * -
    40     * @param string $array  -
    41     * @return void -
    42     * @author Jonathan H. Wage -
    43     */ -
    44    abstract public function loadData($array); -
    45 -
    46    /** -
    47     * dumpData -
    48     * -
    49     * Override in the praser driver -
    50     * -
    51     * @param string $array  -
    52     * @param string $path  -
    53     * @return void -
    54     * @author Jonathan H. Wage -
    55     */ -
    56    abstract public function dumpData($array, $path = null); -
    57 -
    58    /** -
    59     * getParser -
    60     * -
    61     * Get instance of the specified parser -
    62     * -
    63     * @param string $type  -
    64     * @return void -
    65     * @author Jonathan H. Wage -
    66     */ -
    67    static public function getParser($type) -
    68    { -
    69        $class = 'Doctrine_Parser_'.ucfirst($type); -
    70 -
    71        return new $class; -
    72    } -
    73 -
    74    /** -
    75     * load -
    76     * -
    77     * Interface for loading and parsing data from a file -
    78     * -
    79     * @param string $path  -
    80     * @param string $type  -
    81     * @return void -
    82     * @author Jonathan H. Wage -
    83     */ -
    84    static public function load($path, $type = 'xml') -
    85    { -
    86        $parser = self::getParser($type); -
    87 -
    88        return $parser->loadData($path); -
    89    } -
    90 -
    91    /** -
    92     * dump -
    93     * -
    94     * Interface for pulling and dumping data to a file -
    95     * -
    96     * @param string $array  -
    97     * @param string $path  -
    98     * @param string $type  -
    99     * @return void -
    100     * @author Jonathan H. Wage -
    101     */ -
    102    static public function dump($array, $type = 'xml', $path = null) -
    103    { -
    104        $parser = self::getParser($type); -
    105 -
    106        return $parser->dumpData($array, $path); -
    107    } -
    108 -
    109    /** -
    110     * doLoad -
    111     * -
    112     * Get contents whether it is the path to a file file or a string of txt. -
    113     * Either should allow php code in it. -
    114     * -
    115     * @param string $path  -
    116     * @return void -
    117     */ -
    118    public function doLoad($path) -
    119    { -
    120        ob_start(); -
    121        if ( ! file_exists($path)) { -
    122            $contents = $path; -
    123            $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'dparser_' . microtime(); -
    124 -
    125            file_put_contents($path, $contents); -
    126        } -
    127 -
    128        include($path); -
    129        $contents = ob_get_clean(); -
    130 -
    131        return $contents; -
    132    } -
    133 -
    134    /** -
    135     * doDump -
    136     * -
    137     * @param string $data  -
    138     * @param string $path  -
    139     * @return void -
    140     */ -
    141    public function doDump($data, $path = null) -
    142    { -
    143      if ($path !== null) { -
    144            return file_put_contents($path, $data); -
    145        } else { -
    146            return $data; -
    147        } -
    148    } -
    149}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Parser_Yml.html b/tests_old/coverage/Doctrine_Parser_Yml.html deleted file mode 100644 index edb8d99a4..000000000 --- a/tests_old/coverage/Doctrine_Parser_Yml.html +++ /dev/null @@ -1,233 +0,0 @@ - - - Coverage for Doctrine_Parser_Yml - - -

    Coverage for Doctrine_Parser_Yml

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2require_once('spyc.php'); -
    3 -
    4/* -
    5 *  $Id: Yml.php 1080 2007-02-10 18:17:08Z jwage $ -
    6 * -
    7 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    8 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    9 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    10 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    11 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    12 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    13 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    14 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    15 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    16 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    17 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    18 * -
    19 * This software consists of voluntary contributions made by many individuals -
    20 * and is licensed under the LGPL. For more information, see -
    21 * <http://www.phpdoctrine.org>. -
    22 */ -
    23 -
    24/** -
    25 * Doctrine_Parser_Yml -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Parser -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 1080 $ -
    33 * @author      Jonathan H. Wage <jwage@mac.com> -
    34 */ -
    35class Doctrine_Parser_Yml extends Doctrine_Parser -
    36{ -
    37    /** -
    38     * dumpData -
    39     * -
    40     * Dump an array of data to a specified path or return -
    41     *  -
    42     * @param  string $array Array of data to dump to yaml -
    43     * @param  string $path  Path to dump the yaml to -
    44     * @return string $yaml -
    45     * @return void -
    46     */ -
    47    public function dumpData($array, $path = null) -
    48    { -
    49        $spyc = new Doctrine_Spyc(); -
    50         -
    51        $data = $spyc->dump($array, false, false); -
    52         -
    53        return $this->doDump($data, $path); -
    54    } -
    55 -
    56    /** -
    57     * loadData -
    58     * -
    59     * Load and parse data from a yml file -
    60     *  -
    61     * @param  string  $path  Path to load yaml data from -
    62     * @return array   $array Array of parsed yaml data -
    63     */ -
    64    public function loadData($path) -
    65    { -
    66        $contents = $this->doLoad($path); -
    67 -
    68        $spyc = new Doctrine_Spyc(); -
    69         -
    70        $array = $spyc->load($contents); -
    71         -
    72        return $array; -
    73    } -
    74}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Plugin.html b/tests_old/coverage/Doctrine_Plugin.html deleted file mode 100644 index e6cda19cd..000000000 --- a/tests_old/coverage/Doctrine_Plugin.html +++ /dev/null @@ -1,729 +0,0 @@ - - - Coverage for Doctrine_Plugin - - -

    Coverage for Doctrine_Plugin

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Plugin -
    24 * -
    25 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    26 * @package     Doctrine -
    27 * @subpackage  Plugin -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision$ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33abstract class Doctrine_Plugin -
    34{ -
    35    /** -
    36     * @var array $_options     an array of plugin specific options -
    37     */ -
    38    protected $_options = array('generateFiles' => false, -
    39                                'identifier'    => false, -
    40                                'generateFiles' => false, -
    41                                'table'         => false, -
    42                                'pluginTable'   => false, -
    43                                'children'      => array(),); -
    44 -
    45    /** -
    46     * __get -
    47     * an alias for getOption -
    48     * -
    49     * @param string $option -
    50     */ -
    51    public function __get($option) -
    52    { -
    53        if (isset($this->_options[$option])) { -
    54            return $this->_options[$option]; -
    55        } -
    56        return null; -
    57    } -
    58 -
    59    /** -
    60     * __isset -
    61     * -
    62     * @param string $option -
    63     */ -
    64    public function __isset($option)  -
    65    { -
    66        return isset($this->_options[$option]); -
    67    } -
    68 -
    69    /** -
    70     * returns the value of an option -
    71     * -
    72     * @param $option       the name of the option to retrieve -
    73     * @return mixed        the value of the option -
    74     */ -
    75    public function getOption($name) -
    76    { -
    77        if ( ! isset($this->_options[$name])) { -
    78            throw new Doctrine_Plugin_Exception('Unknown option ' . $name); -
    79        } -
    80         -
    81        return $this->_options[$name]; -
    82    } -
    83 -
    84    /** -
    85     * sets given value to an option -
    86     * -
    87     * @param $option       the name of the option to be changed -
    88     * @param $value        the value of the option -
    89     * @return Doctrine_Plugin  this object -
    90     */ -
    91    public function setOption($name, $value) -
    92    { -
    93        $this->_options[$name] = $value; -
    94         -
    95        return $this; -
    96    } -
    97 -
    98    public function addChild(Doctrine_Template $template) -
    99    { -
    100        $this->_options['children'][] = $template; -
    101    } -
    102 -
    103    /** -
    104     * returns all options and their associated values -
    105     * -
    106     * @return array    all options as an associative array -
    107     */ -
    108    public function getOptions() -
    109    { -
    110        return $this->_options; -
    111    } -
    112 -
    113    public function buildPluginDefinition(Doctrine_Table $table) -
    114    { -
    115     $this->_options['table'] = $table; -
    116 -
    117        $this->_options['className'] = str_replace('%CLASS%', -
    118                                                   $this->_options['table']->getComponentName(), -
    119                                                   $this->_options['className']); -
    120 -
    121        // check that class doesn't exist (otherwise we cannot create it) -
    122        if (class_exists($this->_options['className'])) { -
    123            return false; -
    124        } -
    125         -
    126        $this->buildDefinition(); -
    127    } -
    128     -
    129    abstract public function buildDefinition(); -
    130 -
    131    public function buildForeignKeys(Doctrine_Table $table) -
    132    { -
    133        $id = $table->getIdentifier(); -
    134 -
    135        $fk = array(); -
    136        foreach ((array) $id as $column) { -
    137            $def = $table->getDefinitionOf($column); -
    138 -
    139            unset($def['autoincrement']); -
    140            unset($def['sequence']); -
    141            unset($def['unique']); -
    142 -
    143            $fk[$column] = $def; -
    144        } -
    145         -
    146        return $fk; -
    147    } -
    148 -
    149    public function generateChildDefinitions() -
    150    { -
    151        foreach ($this->_options['children'] as $child) { -
    152            $this->_options['pluginTable']->addTemplate(get_class($child), $child); -
    153 -
    154            $child->setTable($this->_options['pluginTable']); -
    155             -
    156            $child->setUp(); -
    157        } -
    158    } -
    159 -
    160    /** -
    161     * generates foreign keys for the plugin table based on the owner table -
    162     * -
    163     * the foreign keys generated by this method can be used for  -
    164     * setting the relations between the owner and the plugin classes -
    165     * -
    166     * @param Doctrine_Table $table     the table object that owns the plugin -
    167     * @return array                    an array of foreign key definitions -
    168     */ -
    169    public function generateForeignKeys(Doctrine_Table $table) -
    170    { -
    171        $fk = array(); -
    172 -
    173        foreach ((array) $table->getIdentifier() as $column) { -
    174            $def = $table->getDefinitionOf($column); -
    175 -
    176            unset($def['autoincrement']); -
    177            unset($def['sequence']); -
    178            unset($def['primary']); -
    179 -
    180            $col = $column; -
    181 -
    182            $def['primary'] = true; -
    183            $fk[$col] = $def; -
    184        } -
    185        return $fk; -
    186    } -
    187 -
    188    /** -
    189     * generates a relation array to given table -
    190     * -
    191     * this method can be used for generating the relation from the plugin  -
    192     * table to the owner table -
    193     * -
    194     * @param Doctrine_Table $table     the table object to construct the relation to -
    195     * @param array $foreignKeys        an array of foreign keys -
    196     * @return array                    the generated relation array -
    197     */ -
    198    public function generateRelation(Doctrine_Table $table, array $foreignKeys) -
    199    { -
    200        $local = (count($foreignKeys) > 1) ? array_keys($foreignKeys) : key($foreignKeys); -
    201         -
    202        $relation = array($table->getComponentName() =>  -
    203                        array('local'    => $local, -
    204                              'foreign'  => $table->getIdentifier(), -
    205                              'onDelete' => 'CASCADE', -
    206                              'onUpdate' => 'CASCADE')); -
    207 -
    208        return $relation; -
    209    } -
    210 -
    211    /** -
    212     * generates the class definition for plugin class -
    213     * -
    214     * @param array $options    plugin class options, keys representing the option names  -
    215     *                          and values as option values -
    216     * @param array $columns    the plugin class columns, keys representing the column names -
    217     *                          and values as column definitions -
    218     * @param array $relations  the bound relations of the plugin class -
    219     * @return void -
    220     */ -
    221    public function generateClass($options, $columns, $relations) -
    222    { -
    223        $builder = new Doctrine_Import_Builder(); -
    224 -
    225        if ($this->_options['generateFiles']) { -
    226            if (isset($this->_options['generatePath']) && $this->_options['generatePath']) { -
    227                $builder->setTargetPath($this->_options['generatePath']); -
    228 -
    229                $builder->buildRecord($options, $columns, $relations); -
    230            } else { -
    231                throw new Doctrine_Plugin_Exception('If you wish to generate files then you must specify the path to generate the files in.'); -
    232            } -
    233        } else { -
    234            $def = $builder->buildDefinition($options, $columns, $relations); -
    235 -
    236            eval($def); -
    237        } -
    238    } -
    239} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query.html b/tests_old/coverage/Doctrine_Query.html deleted file mode 100644 index 85e83e63c..000000000 --- a/tests_old/coverage/Doctrine_Query.html +++ /dev/null @@ -1,5763 +0,0 @@ - - - Coverage for Doctrine_Query - - -

    Coverage for Doctrine_Query

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Query.php 3221 2007-11-25 15:57:08Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Abstract'); -
    22/** -
    23 * Doctrine_Query -
    24 * A Doctrine_Query object represents a DQL query. It is used to query databases for -
    25 * data in an object-oriented fashion. A DQL query understands relations and inheritance -
    26 * and is dbms independant. -
    27 * -
    28 * @package     Doctrine -
    29 * @subpackage  Query -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 3221 $ -
    34 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    35 * @todo        Proposal: This class does far too much. It should have only 1 task: Collecting -
    36 *              the DQL query parts and the query parameters (the query state and caching options/methods -
    37 *              can remain here, too). -
    38 *              The actual SQL construction could be done by a separate object (Doctrine_Query_SqlBuilder?) -
    39 *              whose task it is to convert DQL into SQL. -
    40 *              Furthermore the SqlBuilder? can then use other objects (Doctrine_Query_Tokenizer?), -
    41 *              (Doctrine_Query_Parser(s)?) to accomplish his work. Doctrine_Query does not need -
    42 *              to know the tokenizer/parsers. There could be extending -
    43 *              implementations of SqlBuilder? that cover the specific SQL dialects. -
    44 *              This would release Doctrine_Connection and the Doctrine_Connection_xxx classes -
    45 *              from this tedious task. -
    46 *              This would also largely reduce the currently huge interface of Doctrine_Query(_Abstract) -
    47 *              and better hide all these transformation internals from the public Query API. -
    48 * -
    49 * @internal    The lifecycle of a Query object is the following: -
    50 *              After construction the query object is empty. Through using the fluent -
    51 *              query interface the user fills the query object with DQL parts and query parameters. -
    52 *              These get collected in {@link $_dqlParts} and {@link $_params}, respectively. -
    53 *              When the query is executed the first time, or when {@link getSqlQuery()} -
    54 *              is called the first time, the collected DQL parts get parsed and the resulting -
    55 *              connection-driver specific SQL is generated. The generated SQL parts are -
    56 *              stored in {@link $_sqlParts} and the final resulting SQL query is stored in -
    57 *              {@link $_sql}. -
    58 */ -
    59class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Serializable -
    60{ -
    61    /** -
    62     * @var array  The DQL keywords. -
    63     */ -
    64    protected static $_keywords  = array('ALL',  -
    65                                         'AND',  -
    66                                         'ANY',  -
    67                                         'AS',  -
    68                                         'ASC',  -
    69                                         'AVG',  -
    70                                         'BETWEEN',  -
    71                                         'BIT_LENGTH',  -
    72                                         'BY',  -
    73                                         'CHARACTER_LENGTH',  -
    74                                         'CHAR_LENGTH',  -
    75                                         'CURRENT_DATE', -
    76                                         'CURRENT_TIME',  -
    77                                         'CURRENT_TIMESTAMP',  -
    78                                         'DELETE',  -
    79                                         'DESC',  -
    80                                         'DISTINCT',  -
    81                                         'EMPTY',  -
    82                                         'EXISTS',  -
    83                                         'FALSE',  -
    84                                         'FETCH',  -
    85                                         'FROM',  -
    86                                         'GROUP',  -
    87                                         'HAVING',  -
    88                                         'IN',  -
    89                                         'INDEXBY',  -
    90                                         'INNER',  -
    91                                         'IS',  -
    92                                         'JOIN', -
    93                                         'LEFT',  -
    94                                         'LIKE',  -
    95                                         'LOWER', -
    96                                         'MEMBER', -
    97                                         'MOD', -
    98                                         'NEW',  -
    99                                         'NOT',  -
    100                                         'NULL',  -
    101                                         'OBJECT',  -
    102                                         'OF',  -
    103                                         'OR',  -
    104                                         'ORDER',  -
    105                                         'OUTER',  -
    106                                         'POSITION',  -
    107                                         'SELECT',  -
    108                                         'SOME', -
    109                                         'TRIM',  -
    110                                         'TRUE',  -
    111                                         'UNKNOWN',  -
    112                                         'UPDATE',  -
    113                                         'WHERE'); -
    114     -
    115    /** -
    116     * @var array -
    117     */ -
    118    protected $_subqueryAliases = array(); -
    119     -
    120    /** -
    121     * @var array $_aggregateAliasMap       an array containing all aggregate aliases, keys as dql aliases -
    122     *                                      and values as sql aliases -
    123     */ -
    124    protected $_aggregateAliasMap      = array(); -
    125     -
    126    /** -
    127     * @var array -
    128     */ -
    129    protected $_pendingAggregates = array(); -
    130 -
    131    /** -
    132     * @param boolean $needsSubquery -
    133     */ -
    134    protected $_needsSubquery = false; -
    135 -
    136    /** -
    137     * @param boolean $isSubquery           whether or not this query object is a subquery of another  -
    138     *                                      query object -
    139     */ -
    140    protected $_isSubquery; -
    141 -
    142    /** -
    143     * @var array $_neededTables            an array containing the needed table aliases -
    144     */ -
    145    protected $_neededTables = array(); -
    146 -
    147    /** -
    148     * @var array $pendingSubqueries        SELECT part subqueries, these are called pending subqueries since -
    149     *                                      they cannot be parsed directly (some queries might be correlated) -
    150     */ -
    151    protected $_pendingSubqueries = array(); -
    152 -
    153    /** -
    154     * @var array $_pendingFields           an array of pending fields (fields waiting to be parsed) -
    155     */ -
    156    protected $_pendingFields = array(); -
    157 -
    158    /** -
    159     * @var array $_parsers                 an array of parser objects, each DQL query part has its own parser -
    160     */ -
    161    protected $_parsers = array(); -
    162 -
    163    /** -
    164     * @var array $_pendingJoinConditions    an array containing pending joins -
    165     */ -
    166    protected $_pendingJoinConditions = array(); -
    167     -
    168    /** -
    169     * @var array -
    170     */ -
    171    protected $_expressionMap = array(); -
    172     -
    173    /** -
    174     * @var string $_sql            cached SQL query -
    175     */ -
    176    protected $_sql; -
    177     -
    178 -
    179    /** -
    180     * create -
    181     * returns a new Doctrine_Query object -
    182     * -
    183     * @param Doctrine_Connection $conn     optional connection parameter -
    184     * @return Doctrine_Query -
    185     */ -
    186    public static function create($conn = null) -
    187    { -
    188        return new Doctrine_Query($conn); -
    189    } -
    190     -
    191    /** -
    192     * Resets the query to the state just after it has been instantiated. -
    193     */ -
    194    public function reset() -
    195    { -
    196        $this->_pendingJoinConditions = array(); -
    197        $this->_pendingSubqueries = array(); -
    198        $this->_pendingFields = array(); -
    199        $this->_neededTables = array(); -
    200        $this->_expressionMap = array(); -
    201        $this->_subqueryAliases = array(); -
    202        $this->_needsSubquery = false; -
    203        $this->_isLimitSubqueryUsed = false; -
    204    } -
    205 -
    206    /** -
    207     * createSubquery -
    208     * creates a subquery -
    209     * -
    210     * @return Doctrine_Hydrate -
    211     */ -
    212    public function createSubquery() -
    213    { -
    214        $class = get_class($this); -
    215        $obj   = new $class(); -
    216 -
    217        // copy the aliases to the subquery -
    218        $obj->copyAliases($this); -
    219 -
    220        // this prevents the 'id' being selected, re ticket #307 -
    221        $obj->isSubquery(true); -
    222 -
    223        return $obj; -
    224    } -
    225 -
    226    /** -
    227     * _addPendingJoinCondition -
    228     * -
    229     * @param string $componentAlias    component alias -
    230     * @param string $joinCondition     dql join condition -
    231     * @return Doctrine_Query           this object -
    232     */ -
    233    protected function _addPendingJoinCondition($componentAlias, $joinCondition) -
    234    { -
    235        $this->_pendingJoins[$componentAlias] = $joinCondition; -
    236    } -
    237 -
    238    /** -
    239     * addEnumParam -
    240     * sets input parameter as an enumerated parameter -
    241     * -
    242     * @param string $key   the key of the input parameter -
    243     * @return Doctrine_Query -
    244     */ -
    245    public function addEnumParam($key, $table = null, $column = null) -
    246    { -
    247        $array = (isset($table) || isset($column)) ? array($table, $column) : array(); -
    248 -
    249        if ($key === '?') { -
    250            $this->_enumParams[] = $array; -
    251        } else { -
    252            $this->_enumParams[$key] = $array; -
    253        } -
    254    } -
    255 -
    256    /** -
    257     * getEnumParams -
    258     * get all enumerated parameters -
    259     * -
    260     * @return array    all enumerated parameters -
    261     */ -
    262    public function getEnumParams() -
    263    { -
    264        return $this->_enumParams; -
    265    } -
    266     -
    267    /** -
    268     * getDql -
    269     * returns the DQL query that is represented by this query object. -
    270     * -
    271     * the query is built from $_dqlParts -
    272     * -
    273     * @return string   the DQL query -
    274     */ -
    275    public function getDql() -
    276    { -
    277        $q = ''; -
    278        $q .= ( ! empty($this->_dqlParts['select']))?  'SELECT '    . implode(', ', $this->_dqlParts['select']) : ''; -
    279        $q .= ( ! empty($this->_dqlParts['from']))?    ' FROM '     . implode(' ', $this->_dqlParts['from']) : ''; -
    280        $q .= ( ! empty($this->_dqlParts['where']))?   ' WHERE '    . implode(' AND ', $this->_dqlParts['where']) : ''; -
    281        $q .= ( ! empty($this->_dqlParts['groupby']))? ' GROUP BY ' . implode(', ', $this->_dqlParts['groupby']) : ''; -
    282        $q .= ( ! empty($this->_dqlParts['having']))?  ' HAVING '   . implode(' AND ', $this->_dqlParts['having']) : ''; -
    283        $q .= ( ! empty($this->_dqlParts['orderby']))? ' ORDER BY ' . implode(', ', $this->_dqlParts['orderby']) : ''; -
    284        $q .= ( ! empty($this->_dqlParts['limit']))?   ' LIMIT '    . implode(' ', $this->_dqlParts['limit']) : ''; -
    285        $q .= ( ! empty($this->_dqlParts['offset']))?  ' OFFSET '   . implode(' ', $this->_dqlParts['offset']) : ''; -
    286 -
    287        return $q; -
    288    } -
    289     -
    290    /** -
    291     * getParams -
    292     * -
    293     * @return array -
    294     */ -
    295    public function getParams() -
    296    { -
    297        return array_merge($this->_params['set'], $this->_params['where'], $this->_params['having']); -
    298    } -
    299     -
    300    /** -
    301     * setParams -
    302     * -
    303     * @param array $params -
    304     */ -
    305    public function setParams(array $params = array()) { -
    306        $this->_params = $params; -
    307    } -
    308     -
    309    /** -
    310     * fetchArray -
    311     * Convenience method to execute using array fetching as hydration mode. -
    312     * -
    313     * @param string $params -
    314     * @return array -
    315     */ -
    316    public function fetchArray($params = array()) { -
    317        return $this->execute($params, Doctrine::HYDRATE_ARRAY); -
    318    } -
    319     -
    320    /** -
    321     * fetchOne -
    322     * Convenience method to execute the query and return the first item -
    323     * of the collection. -
    324     * -
    325     * @param string $params Parameters -
    326     * @param int $hydrationMode Hydration mode -
    327     * @return mixed Array or Doctrine_Collection or false if no result. -
    328     */ -
    329    public function fetchOne($params = array(), $hydrationMode = null) -
    330    { -
    331        $collection = $this->execute($params, $hydrationMode); -
    332 -
    333        if (count($collection) === 0) { -
    334            return false; -
    335        } -
    336 -
    337        if ($collection instanceof Doctrine_Collection) { -
    338            return $collection->getFirst(); -
    339        } else if (is_array($collection)) { -
    340            return array_shift($collection); -
    341        } -
    342 -
    343        return false; -
    344    } -
    345 -
    346    /** -
    347     * isSubquery -
    348     * if $bool parameter is set this method sets the value of -
    349     * Doctrine_Query::$isSubquery. If this value is set to true -
    350     * the query object will not load the primary key fields of the selected -
    351     * components. -
    352     * -
    353     * If null is given as the first parameter this method retrieves the current -
    354     * value of Doctrine_Query::$isSubquery. -
    355     * -
    356     * @param boolean $bool     whether or not this query acts as a subquery -
    357     * @return Doctrine_Query|bool -
    358     */ -
    359    public function isSubquery($bool = null) -
    360    { -
    361        if ($bool === null) { -
    362            return $this->_isSubquery; -
    363        } -
    364 -
    365        $this->_isSubquery = (bool) $bool; -
    366        return $this; -
    367    } -
    368 -
    369    /** -
    370     * getAggregateAlias -
    371     * -
    372     * @param string $dqlAlias      the dql alias of an aggregate value -
    373     * @return string -
    374     * @deprecated -
    375     */ -
    376    public function getAggregateAlias($dqlAlias) -
    377    { -
    378        return $this->getSqlAggregateAlias($dqlAlias); -
    379    } -
    380     -
    381    /** -
    382     * getSqlAggregateAlias -
    383     * -
    384     * @param string $dqlAlias      the dql alias of an aggregate value -
    385     * @return string -
    386     */ -
    387    public function getSqlAggregateAlias($dqlAlias) -
    388    { -
    389        if (isset($this->_aggregateAliasMap[$dqlAlias])) { -
    390            // mark the expression as used -
    391            $this->_expressionMap[$dqlAlias][1] = true; -
    392 -
    393            return $this->_aggregateAliasMap[$dqlAlias]; -
    394        } else if ( ! empty($this->_pendingAggregates)) { -
    395            $this->processPendingAggregates(); -
    396 -
    397            return $this->getSqlAggregateAlias($dqlAlias); -
    398        } else { -
    399             throw new Doctrine_Query_Exception('Unknown aggregate alias: ' . $dqlAlias); -
    400        } -
    401    } -
    402 -
    403    /** -
    404     * parseQueryPart -
    405     * parses given DQL query part -
    406     * -
    407     * @param string $queryPartName     the name of the query part -
    408     * @param string $queryPart         query part to be parsed -
    409     * @param boolean $append           whether or not to append the query part to its stack -
    410     *                                  if false is given, this method will overwrite  -
    411     *                                  the given query part stack with $queryPart -
    412     * @return Doctrine_Query           this object -
    413     */ -
    414    /*protected function parseQueryPart($queryPartName, $queryPart, $append = false)  -
    415    { -
    416        if ($this->_state === self::STATE_LOCKED) { -
    417            throw new Doctrine_Query_Exception('This query object is locked. No query parts can be manipulated.'); -
    418        } -
    419 -
    420        // sanity check -
    421        if ($queryPart === '' || $queryPart === null) { -
    422            throw new Doctrine_Query_Exception('Empty ' . $queryPartName . ' part given.'); -
    423        } -
    424 -
    425        // add query part to the dql part array -
    426        if ($append) { -
    427            $this->_dqlParts[$queryPartName][] = $queryPart; -
    428        } else { -
    429            $this->_dqlParts[$queryPartName] = array($queryPart); -
    430        } -
    431 -
    432        if ($this->_state === self::STATE_DIRECT) { -
    433            $parser = $this->_getParser($queryPartName); -
    434 -
    435            $sql = $parser->parse($queryPart); -
    436 -
    437            if (isset($sql)) { -
    438                if ($append) { -
    439                    $this->addSqlQueryPart($queryPartName, $sql); -
    440                } else { -
    441                    $this->setSqlQueryPart($queryPartName, $sql); -
    442                } -
    443            } -
    444        } -
    445 -
    446        $this->_state = Doctrine_Query::STATE_DIRTY; -
    447 -
    448        return $this; -
    449    }*/ -
    450 -
    451    /** -
    452     * getDqlPart -
    453     * returns a specific DQL query part. -
    454     * -
    455     * @param string $queryPart     the name of the query part -
    456     * @return string   the DQL query part -
    457     * @todo Description: List which query parts exist or point to the method/property -
    458     *       where they are listed. -
    459     */ -
    460    public function getDqlPart($queryPart) -
    461    { -
    462        if ( ! isset($this->_dqlParts[$queryPart])) { -
    463           throw new Doctrine_Query_Exception('Unknown query part ' . $queryPart); -
    464        } -
    465 -
    466        return $this->_dqlParts[$queryPart]; -
    467    } -
    468 -
    469    /** -
    470     * processPendingFields -
    471     * the fields in SELECT clause cannot be parsed until the components -
    472     * in FROM clause are parsed, hence this method is called everytime a  -
    473     * specific component is being parsed. -
    474     * -
    475     * @throws Doctrine_Query_Exception     if unknown component alias has been given -
    476     * @param string $componentAlias        the alias of the component -
    477     * @return void -
    478     * @todo Description: What is a 'pending field' (and are there non-pending fields, too)? -
    479     *       What is 'processed'? (Meaning: What information is gathered & stored away) -
    480     */ -
    481    public function processPendingFields($componentAlias) -
    482    { -
    483        $tableAlias = $this->getTableAlias($componentAlias); -
    484        $table      = $this->_queryComponents[$componentAlias]['table']; -
    485 -
    486        if ( ! isset($this->_pendingFields[$componentAlias])) { -
    487            return; -
    488        } -
    489 -
    490        $fields = $this->_pendingFields[$componentAlias]; -
    491 -
    492 -
    493        // check for wildcards -
    494        if (in_array('*', $fields)) { -
    495            //echo "<br />";Doctrine::dump($table->getColumnNames()); echo "<br />"; -
    496            $fields = $table->getFieldNames(); -
    497        } else { -
    498            // only auto-add the primary key fields if this query object is not -
    499            // a subquery of another query object -
    500            if ( ! $this->_isSubquery) { -
    501                $fields = array_unique(array_merge((array) $table->getIdentifier(), $fields)); -
    502            } -
    503        } -
    504         -
    505        $sql = array(); -
    506        foreach ($fields as $fieldName) { -
    507            $columnName = $table->getColumnName($fieldName); -
    508            if (($owner = $table->getColumnOwner($columnName)) !== null &&  -
    509                    $owner !== $table->getComponentName()) { -
    510 -
    511                $parent = $this->_conn->getTable($owner); -
    512                $columnName = $parent->getColumnName($fieldName); -
    513                $parentAlias = $this->getTableAlias($componentAlias . '.' . $parent->getComponentName()); -
    514                $sql[] = $this->_conn->quoteIdentifier($parentAlias . '.' . $columnName) -
    515                       . ' AS ' -
    516                       . $this->_conn->quoteIdentifier($tableAlias . '__' . $columnName); -
    517            } else { -
    518                $columnName = $table->getColumnName($fieldName); -
    519                $sql[] = $this->_conn->quoteIdentifier($tableAlias . '.' . $columnName) -
    520                       . ' AS ' -
    521                       . $this->_conn->quoteIdentifier($tableAlias . '__' . $columnName); -
    522            } -
    523        } -
    524 -
    525        $this->_neededTables[] = $tableAlias; -
    526        //Doctrine::dump(implode(', ', $sql)); -
    527        //echo "<br /><br />"; -
    528        return implode(', ', $sql); -
    529    } -
    530 -
    531    /** -
    532     * parseSelectField -
    533     * -
    534     * @throws Doctrine_Query_Exception     if unknown component alias has been given -
    535     * @return void -
    536     * @todo Description: Explain what this method does. Is there a relation to parseSelect()? -
    537     *       (It doesnt seem to get called from there...?). In what circumstances is this method -
    538     *       used? -
    539     */ -
    540    public function parseSelectField($field) -
    541    { -
    542        $terms = explode('.', $field); -
    543 -
    544        if (isset($terms[1])) { -
    545            $componentAlias = $terms[0]; -
    546            $field = $terms[1]; -
    547        } else { -
    548            reset($this->_queryComponents); -
    549            $componentAlias = key($this->_queryComponents); -
    550            $fields = $terms[0]; -
    551        } -
    552 -
    553        $tableAlias = $this->getTableAlias($componentAlias); -
    554        $table      = $this->_queryComponents[$componentAlias]['table']; -
    555 -
    556 -
    557        // check for wildcards -
    558        if ($field === '*') { -
    559            $sql = array(); -
    560 -
    561            foreach ($table->getColumnNames() as $field) { -
    562                $sql[] = $this->parseSelectField($componentAlias . '.' . $field); -
    563            } -
    564 -
    565            return implode(', ', $sql); -
    566        } else { -
    567            $name = $table->getColumnName($field); -
    568     -
    569            $this->_neededTables[] = $tableAlias; -
    570     -
    571            return $this->_conn->quoteIdentifier($tableAlias . '.' . $name) -
    572                   . ' AS ' -
    573                   . $this->_conn->quoteIdentifier($tableAlias . '__' . $name); -
    574        } -
    575    } -
    576 -
    577    /** -
    578     * getExpressionOwner -
    579     * returns the component alias for owner of given expression -
    580     * -
    581     * @param string $expr      expression from which to get to owner from -
    582     * @return string           the component alias -
    583     * @todo Description: What does it mean if a component is an 'owner' of an expression? -
    584     *       What kind of 'expression' are we talking about here? -
    585     */ -
    586    public function getExpressionOwner($expr) -
    587    { -
    588        if (strtoupper(substr(trim($expr, '( '), 0, 6)) !== 'SELECT') { -
    589            preg_match_all("/[a-z0-9_]+\.[a-z0-9_]+[\.[a-z0-9]+]*/i", $expr, $matches); -
    590 -
    591            $match = current($matches); -
    592 -
    593            if (isset($match[0])) { -
    594                $terms = explode('.', $match[0]); -
    595 -
    596                return $terms[0]; -
    597            } -
    598        } -
    599        return $this->getRootAlias(); -
    600 -
    601    } -
    602 -
    603    /** -
    604     * parseSelect -
    605     * parses the query select part and -
    606     * adds selected fields to pendingFields array -
    607     * -
    608     * @param string $dql -
    609     * @todo Description: What information is extracted (and then stored)? -
    610     */ -
    611    public function parseSelect($dql) -
    612    { -
    613        $refs = $this->_tokenizer->sqlExplode($dql, ','); -
    614 -
    615        $pos   = strpos(trim($refs[0]), ' '); -
    616        $first = substr($refs[0], 0, $pos); -
    617 -
    618        // check for DISTINCT keyword -
    619        if ($first === 'DISTINCT') { -
    620            $this->_sqlParts['distinct'] = true; -
    621 -
    622            $refs[0] = substr($refs[0], ++$pos); -
    623        } -
    624 -
    625        $parsedComponents = array(); -
    626 -
    627        foreach ($refs as $reference) { -
    628            $reference = trim($reference); -
    629 -
    630            if (empty($reference)) { -
    631                continue; -
    632            } -
    633 -
    634            $terms = $this->_tokenizer->sqlExplode($reference, ' '); -
    635 -
    636            $pos   = strpos($terms[0], '('); -
    637 -
    638            if (count($terms) > 1 || $pos !== false) { -
    639                $expression = array_shift($terms); -
    640                $alias = array_pop($terms); -
    641 -
    642                if ( ! $alias) { -
    643                    $alias = substr($expression, 0, $pos); -
    644                } -
    645 -
    646                $componentAlias = $this->getExpressionOwner($expression); -
    647                $expression = $this->parseClause($expression); -
    648 -
    649                $tableAlias = $this->getTableAlias($componentAlias); -
    650 -
    651                $index    = count($this->_aggregateAliasMap); -
    652 -
    653                $sqlAlias = $this->_conn->quoteIdentifier($tableAlias . '__' . $index); -
    654 -
    655                $this->_sqlParts['select'][] = $expression . ' AS ' . $sqlAlias; -
    656 -
    657                $this->_aggregateAliasMap[$alias] = $sqlAlias; -
    658                $this->_expressionMap[$alias][0] = $expression; -
    659 -
    660                $this->_queryComponents[$componentAlias]['agg'][$index] = $alias; -
    661 -
    662                $this->_neededTables[] = $tableAlias; -
    663            } else { -
    664                $e = explode('.', $terms[0]); -
    665 -
    666                if (isset($e[1])) { -
    667                    $componentAlias = $e[0]; -
    668                    $field = $e[1]; -
    669                } else { -
    670                    reset($this->_queryComponents); -
    671                    $componentAlias = key($this->_queryComponents); -
    672                    $field = $e[0]; -
    673                } -
    674 -
    675                $this->_pendingFields[$componentAlias][] = $field; -
    676            } -
    677        } -
    678    } -
    679 -
    680    /** -
    681     * parseClause -
    682     * parses given DQL clause -
    683     * -
    684     * this method handles five tasks: -
    685     * -
    686     * 1. Converts all DQL functions to their native SQL equivalents -
    687     * 2. Converts all component references to their table alias equivalents -
    688     * 3. Converts all field names to actual column names -
    689     * 4. Quotes all identifiers -
    690     * 5. Parses nested clauses and subqueries recursively -
    691     * -
    692     * @return string   SQL string -
    693     * @todo Description: What is a 'dql clause' (and what not)? -
    694     *       Refactor: Too long & nesting level -
    695     */ -
    696    public function parseClause($clause) -
    697    { -
    698     $clause = trim($clause); -
    699 -
    700     if (is_numeric($clause)) { -
    701        return $clause; -
    702     } -
    703 -
    704        $terms = $this->_tokenizer->clauseExplode($clause, array(' ', '+', '-', '*', '/')); -
    705 -
    706        $str = ''; -
    707        foreach ($terms as $term) { -
    708            $pos = strpos($term[0], '('); -
    709             -
    710            if ($pos !== false) { -
    711                $name = substr($term[0], 0, $pos); -
    712                if ($name !== '') { -
    713                    $argStr = substr($term[0], ($pos + 1), -1); -
    714 -
    715                    $args   = array(); -
    716                    // parse args -
    717 -
    718                    foreach ($this->_tokenizer->sqlExplode($argStr, ',') as $expr) { -
    719                       $args[] = $this->parseClause($expr); -
    720                    } -
    721 -
    722                    // convert DQL function to its RDBMS specific equivalent -
    723                    try { -
    724                        $expr = call_user_func_array(array($this->_conn->expression, $name), $args); -
    725                    } catch (Doctrine_Expression_Exception $e) { -
    726                        throw new Doctrine_Query_Exception('Unknown function ' . $expr . '.'); -
    727                    } -
    728                    $term[0] = $expr; -
    729                } else { -
    730                    $trimmed = trim($this->_tokenizer->bracketTrim($term[0])); -
    731 -
    732                    // check for possible subqueries -
    733                    if (substr($trimmed, 0, 4) == 'FROM' || substr($trimmed, 0, 6) == 'SELECT') { -
    734                        // parse subquery -
    735                        $trimmed = $this->createSubquery()->parseDqlQuery($trimmed)->getQuery(); -
    736                    } else { -
    737                        // parse normal clause -
    738                        $trimmed = $this->parseClause($trimmed); -
    739                    } -
    740 -
    741                    $term[0] = '(' . $trimmed . ')'; -
    742                } -
    743            } else { -
    744                if (substr($term[0], 0, 1) !== "'" && substr($term[0], -1) !== "'") { -
    745                     -
    746                    if (strpos($term[0], '.') !== false) { -
    747                        if ( ! is_numeric($term[0])) { -
    748                            $e = explode('.', $term[0]); -
    749 -
    750                            $field = array_pop($e); -
    751 -
    752                            if ($this->getType() === Doctrine_Query::SELECT) { -
    753                                $componentAlias = implode('.', $e); -
    754     -
    755                                if (empty($componentAlias)) { -
    756                                    $componentAlias = $this->getRootAlias(); -
    757                                } -
    758     -
    759                                $this->load($componentAlias); -
    760 -
    761                                // check the existence of the component alias -
    762                                if ( ! isset($this->_queryComponents[$componentAlias])) { -
    763                                    throw new Doctrine_Query_Exception('Unknown component alias ' . $componentAlias); -
    764                                } -
    765 -
    766                                $table = $this->_queryComponents[$componentAlias]['table']; -
    767 -
    768                                $def = $table->getDefinitionOf($field); -
    769 -
    770                                // get the actual field name from alias -
    771                                $field = $table->getColumnName($field); -
    772 -
    773                                // check column existence -
    774                                if ( ! $def) { -
    775                                    throw new Doctrine_Query_Exception('Unknown column ' . $field); -
    776                                } -
    777                                 -
    778                                if (isset($def['owner'])) { -
    779                                    $componentAlias = $componentAlias . '.' . $def['owner']; -
    780                                } -
    781 -
    782                                $tableAlias = $this->getTableAlias($componentAlias); -
    783 -
    784                                // build sql expression -
    785                                $term[0] = $this->_conn->quoteIdentifier($tableAlias) -
    786                                         . '.' -
    787                                         . $this->_conn->quoteIdentifier($field); -
    788                            } else { -
    789                                // build sql expression -
    790                                $term[0] = $this->_conn->quoteIdentifier($field); -
    791                            } -
    792                        } -
    793                    } else { -
    794 -
    795                        if ( ! empty($term[0]) && -
    796                             ! in_array(strtoupper($term[0]), self::$_keywords) && -
    797                             ! is_numeric($term[0])) { -
    798 -
    799                            $componentAlias = $this->getRootAlias(); -
    800 -
    801                            $found = false; -
    802 -
    803                            if ($componentAlias !== false &&  -
    804                                $componentAlias !== null) { -
    805                                $table = $this->_queryComponents[$componentAlias]['table']; -
    806 -
    807                                // check column existence -
    808                                if ($table->hasColumn($term[0])) { -
    809                                    $found = true; -
    810 -
    811 -
    812                                    $def = $table->getDefinitionOf($term[0]); -
    813 -
    814                                    // get the actual column name from alias -
    815                                    $term[0] = $table->getColumnName($term[0]); -
    816 -
    817 -
    818                                    if (isset($def['owner'])) { -
    819                                        $componentAlias = $componentAlias . '.' . $def['owner']; -
    820                                    } -
    821 -
    822                                    $tableAlias = $this->getTableAlias($componentAlias); -
    823 -
    824                                    $tableAlias = $this->getTableAlias($componentAlias); -
    825 -
    826                                    if ($this->getType() === Doctrine_Query::SELECT) { -
    827                                        // build sql expression -
    828                                        $term[0] = $this->_conn->quoteIdentifier($tableAlias) -
    829                                                 . '.' -
    830                                                 . $this->_conn->quoteIdentifier($term[0]); -
    831                                    } else { -
    832                                        // build sql expression -
    833                                        $term[0] = $this->_conn->quoteIdentifier($term[0]); -
    834                                    } -
    835                                } else { -
    836                                    $found = false; -
    837                                } -
    838                            } -
    839 -
    840                            if ( ! $found) { -
    841                                $term[0] = $this->getSqlAggregateAlias($term[0]); -
    842                            } -
    843                        } -
    844                    } -
    845                } -
    846            } -
    847 -
    848            $str .= $term[0] . $term[1]; -
    849        } -
    850        return $str; -
    851    } -
    852 -
    853    /** -
    854     * parseAggregateFunction -
    855     * parses an aggregate function and returns the parsed form -
    856     * -
    857     * @see Doctrine_Expression -
    858     * @param string $expr                  DQL aggregate function -
    859     * @throws Doctrine_Query_Exception     if unknown aggregate function given -
    860     * @return array                        parsed form of given function -
    861     */ -
    862    public function parseAggregateFunction($expr, $nestedCall = false) -
    863    { -
    864        $e    = $this->_tokenizer->bracketExplode($expr, ' '); -
    865        $func = $e[0]; -
    866 -
    867        $pos  = strpos($func, '('); -
    868        if ($pos === false) { -
    869            return $expr; -
    870        } -
    871 -
    872        // get the name of the function -
    873        $name   = substr($func, 0, $pos); -
    874        $argStr = substr($func, ($pos + 1), -1); -
    875 -
    876        $args   = array(); -
    877        // parse args -
    878        foreach ($this->_tokenizer->bracketExplode($argStr, ',') as $expr) { -
    879           $args[] = $this->parseAggregateFunction($expr, true); -
    880        } -
    881 -
    882        // convert DQL function to its RDBMS specific equivalent -
    883        try { -
    884            $expr = call_user_func_array(array($this->_conn->expression, $name), $args); -
    885        } catch (Doctrine_Expression_Exception $e) { -
    886            throw new Doctrine_Query_Exception('Unknown function ' . $func . '.'); -
    887        } -
    888 -
    889        if ( ! $nestedCall) { -
    890            // try to find all component references -
    891            preg_match_all("/[a-z0-9_]+\.[a-z0-9_]+[\.[a-z0-9]+]*/i", $argStr, $m); -
    892 -
    893            if (isset($e[1])) { -
    894                if (strtoupper($e[1]) === 'AS') { -
    895                    if ( ! isset($e[2])) { -
    896                        throw new Doctrine_Query_Exception('Missing aggregate function alias.'); -
    897                    } -
    898                    $alias = $e[2]; -
    899                } else { -
    900                    $alias = $e[1]; -
    901                } -
    902            } else { -
    903                $alias = substr($expr, 0, strpos($expr, '(')); -
    904            } -
    905 -
    906            $this->_pendingAggregates[] = array($expr, $m[0], $alias); -
    907        } -
    908 -
    909        return $expr; -
    910    } -
    911 -
    912    /** -
    913     * processPendingSubqueries -
    914     * processes pending subqueries -
    915     * -
    916     * subqueries can only be processed when the query is fully constructed -
    917     * since some subqueries may be correlated -
    918     * -
    919     * @return void -
    920     * @todo Better description. i.e. What is a 'pending subquery'? What does 'processed' mean? -
    921     *       (parsed? sql is constructed? some information is gathered?) -
    922     */ -
    923    public function processPendingSubqueries() -
    924    { -
    925        foreach ($this->_pendingSubqueries as $value) { -
    926            list($dql, $alias) = $value; -
    927 -
    928            $subquery = $this->createSubquery(); -
    929 -
    930            $sql = $subquery->parseDqlQuery($dql, false)->getQuery(); -
    931 -
    932            reset($this->_queryComponents); -
    933            $componentAlias = key($this->_queryComponents); -
    934            $tableAlias = $this->getTableAlias($componentAlias); -
    935 -
    936            $sqlAlias = $tableAlias . '__' . count($this->_aggregateAliasMap); -
    937 -
    938            $this->_sqlParts['select'][] = '(' . $sql . ') AS ' . $this->_conn->quoteIdentifier($sqlAlias); -
    939 -
    940            $this->_aggregateAliasMap[$alias] = $sqlAlias; -
    941            $this->_queryComponents[$componentAlias]['agg'][] = $alias; -
    942        } -
    943        $this->_pendingSubqueries = array(); -
    944    } -
    945 -
    946    /** -
    947     * processPendingAggregates -
    948     * processes pending aggregate values for given component alias -
    949     * -
    950     * @return void -
    951     * @todo Better description. i.e. What is a 'pending aggregate'? What does 'processed' mean? -
    952     */ -
    953    public function processPendingAggregates() -
    954    { -
    955        // iterate trhough all aggregates -
    956        foreach ($this->_pendingAggregates as $aggregate) { -
    957            list ($expression, $components, $alias) = $aggregate; -
    958 -
    959            $tableAliases = array(); -
    960 -
    961            // iterate through the component references within the aggregate function -
    962            if ( ! empty ($components)) { -
    963                foreach ($components as $component) { -
    964 -
    965                    if (is_numeric($component)) { -
    966                        continue; -
    967                    } -
    968 -
    969                    $e = explode('.', $component); -
    970 -
    971                    $field = array_pop($e); -
    972                    $componentAlias = implode('.', $e); -
    973 -
    974                    // check the existence of the component alias -
    975                    if ( ! isset($this->_queryComponents[$componentAlias])) { -
    976                        throw new Doctrine_Query_Exception('Unknown component alias ' . $componentAlias); -
    977                    } -
    978 -
    979                    $table = $this->_queryComponents[$componentAlias]['table']; -
    980 -
    981                    $field = $table->getColumnName($field); -
    982 -
    983                    // check column existence -
    984                    if ( ! $table->hasColumn($field)) { -
    985                        throw new Doctrine_Query_Exception('Unknown column ' . $field); -
    986                    } -
    987 -
    988                    $sqlTableAlias = $this->getSqlTableAlias($componentAlias); -
    989 -
    990                    $tableAliases[$sqlTableAlias] = true; -
    991 -
    992                    // build sql expression -
    993 -
    994                    $identifier = $this->_conn->quoteIdentifier($sqlTableAlias . '.' . $field); -
    995                    $expression = str_replace($component, $identifier, $expression); -
    996                } -
    997            } -
    998 -
    999            if (count($tableAliases) !== 1) { -
    1000                $componentAlias = reset($this->_tableAliasMap); -
    1001                $tableAlias = key($this->_tableAliasMap); -
    1002            } -
    1003 -
    1004            $index    = count($this->_aggregateAliasMap); -
    1005            $sqlAlias = $this->_conn->quoteIdentifier($tableAlias . '__' . $index); -
    1006 -
    1007            $this->_sqlParts['select'][] = $expression . ' AS ' . $sqlAlias; -
    1008 -
    1009            $this->_aggregateAliasMap[$alias] = $sqlAlias; -
    1010            $this->_expressionMap[$alias][0] = $expression; -
    1011 -
    1012            $this->_queryComponents[$componentAlias]['agg'][$index] = $alias; -
    1013 -
    1014            $this->_neededTables[] = $tableAlias; -
    1015        } -
    1016        // reset the state -
    1017        $this->_pendingAggregates = array(); -
    1018    } -
    1019 -
    1020    /** -
    1021     * _buildSqlQueryBase -
    1022     * returns the base of the generated sql query -
    1023     * On mysql driver special strategy has to be used for DELETE statements -
    1024     * (where is this special strategy??) -
    1025     * -
    1026     * @return string       the base of the generated sql query -
    1027     */ -
    1028    protected function _buildSqlQueryBase() -
    1029    { -
    1030        switch ($this->_type) { -
    1031            case self::DELETE: -
    1032                $q = 'DELETE FROM '; -
    1033            break; -
    1034            case self::UPDATE: -
    1035                $q = 'UPDATE '; -
    1036            break; -
    1037            case self::SELECT: -
    1038                $distinct = ($this->_sqlParts['distinct']) ? 'DISTINCT ' : ''; -
    1039                $q = 'SELECT ' . $distinct . implode(', ', $this->_sqlParts['select']) . ' FROM '; -
    1040            break; -
    1041        } -
    1042        return $q; -
    1043    } -
    1044 -
    1045    /** -
    1046     * _buildSqlFromPart -
    1047     * builds the from part of the query and returns it -
    1048     * -
    1049     * @return string   the query sql from part -
    1050     */ -
    1051    protected function _buildSqlFromPart() -
    1052    { -
    1053        $q = ''; -
    1054        foreach ($this->_sqlParts['from'] as $k => $part) { -
    1055            if ($k === 0) { -
    1056                $q .= $part; -
    1057                continue; -
    1058            } -
    1059             -
    1060            // preserve LEFT JOINs only if needed -
    1061 // Check if it's JOIN, if not add a comma separator instead of space -
    1062            if (!preg_match('/\bJOIN\b/i', $part) && !isset($this->_pendingJoinConditions[$k])) { -
    1063                $q .= ', ' . $part; -
    1064            } else { -
    1065                if (substr($part, 0, 9) === 'LEFT JOIN') { -
    1066                    $e = explode(' ', $part); -
    1067 -
    1068                    $aliases = array_merge($this->_subqueryAliases, -
    1069                                array_keys($this->_neededTables)); -
    1070 -
    1071                    if ( ! in_array($e[3], $aliases) && -
    1072                        ! in_array($e[2], $aliases) && -
    1073 -
    1074                        ! empty($this->_pendingFields)) { -
    1075                        continue; -
    1076                    } -
    1077 -
    1078                } -
    1079 -
    1080                if (isset($this->_pendingJoinConditions[$k])) { -
    1081                    $parser = new Doctrine_Query_JoinCondition($this, $this->_tokenizer); -
    1082 -
    1083                    if (strpos($part, ' ON ') !== false) { -
    1084                        $part .= ' AND '; -
    1085                    } else { -
    1086                        $part .= ' ON '; -
    1087                    } -
    1088                    $part .= $parser->parse($this->_pendingJoinConditions[$k]); -
    1089 -
    1090                    unset($this->_pendingJoinConditions[$k]); -
    1091                } -
    1092 -
    1093                $q .= ' ' . $part; -
    1094            } -
    1095 -
    1096            $this->_sqlParts['from'][$k] = $part; -
    1097        } -
    1098        return $q; -
    1099    } -
    1100 -
    1101    /** -
    1102     * preQuery -
    1103     * -
    1104     * Empty template method to provide Query subclasses with the possibility -
    1105     * to hook into the query building procedure, doing any custom / specialized -
    1106     * query building procedures that are neccessary. -
    1107     * -
    1108     * @return void -
    1109     */ -
    1110    public function preQuery() -
    1111    { -
    1112 -
    1113    } -
    1114 -
    1115    /** -
    1116     * postQuery -
    1117     * -
    1118     * Empty template method to provide Query subclasses with the possibility -
    1119     * to hook into the query building procedure, doing any custom / specialized -
    1120     * post query procedures (for example logging) that are neccessary. -
    1121     * -
    1122     * @return void -
    1123     */ -
    1124    public function postQuery() -
    1125    { -
    1126 -
    1127    } -
    1128 -
    1129    /** -
    1130     * builds the sql query from the given parameters and applies things such as -
    1131     * column aggregation inheritance and limit subqueries if needed -
    1132     * -
    1133     * @param array $params             an array of prepared statement params (needed only in mysql driver -
    1134     *                                  when limit subquery algorithm is used) -
    1135     * @return string                   the built sql query -
    1136     */ -
    1137    public function getSqlQuery($params = array()) -
    1138    { -
    1139        if ($this->_state !== self::STATE_DIRTY) { -
    1140           return $this->_sql; -
    1141        } -
    1142 -
    1143        // reset the state -
    1144        if ( ! $this->isSubquery()) { -
    1145            $this->_queryComponents = array(); -
    1146            $this->_pendingAggregates = array(); -
    1147            $this->_aggregateAliasMap = array(); -
    1148        } -
    1149        $this->reset(); -
    1150 -
    1151        // invoke the preQuery hook -
    1152        $this->preQuery(); -
    1153 -
    1154        // process the DQL parts => generate the SQL parts. -
    1155        // this will also populate the $_queryComponents. -
    1156        foreach ($this->_dqlParts as $queryPartName => $queryParts) { -
    1157            $this->_processDqlQueryPart($queryPartName, $queryParts); -
    1158        } -
    1159        $this->_state = self::STATE_CLEAN; -
    1160         -
    1161        $params = $this->convertEnums($params);         -
    1162 -
    1163 -
    1164        // Proceed with the generated SQL -
    1165         -
    1166        if (empty($this->_sqlParts['from'])) { -
    1167            return false; -
    1168        } -
    1169 -
    1170        $needsSubQuery = false; -
    1171        $subquery = ''; -
    1172        $map = reset($this->_queryComponents); -
    1173        $table = $map['table']; -
    1174        $rootAlias = key($this->_queryComponents); -
    1175 -
    1176        if ( ! empty($this->_sqlParts['limit']) && $this->_needsSubquery && -
    1177                $table->getAttribute(Doctrine::ATTR_QUERY_LIMIT) == Doctrine::LIMIT_RECORDS) { -
    1178            $this->_isLimitSubqueryUsed = true; -
    1179            $needsSubQuery = true; -
    1180        } -
    1181 -
    1182        $sql = array(); -
    1183        foreach ($this->_queryComponents as $alias => $map) { -
    1184            $fieldSql = $this->processPendingFields($alias); -
    1185            if ( ! empty($fieldSql)) { -
    1186                $sql[] = $fieldSql; -
    1187            } -
    1188        } -
    1189        if ( ! empty($sql)) { -
    1190            array_unshift($this->_sqlParts['select'], implode(', ', $sql)); -
    1191        } -
    1192 -
    1193        $this->_pendingFields = array(); -
    1194 -
    1195        // build the basic query -
    1196        $q  = $this->_buildSqlQueryBase(); -
    1197        $q .= $this->_buildSqlFromPart(); -
    1198 -
    1199        if ( ! empty($this->_sqlParts['set'])) { -
    1200            $q .= ' SET ' . implode(', ', $this->_sqlParts['set']); -
    1201        } -
    1202 -
    1203 -
    1204        $string = $this->applyInheritance(); -
    1205 -
    1206        // apply inheritance to WHERE part -
    1207        if ( ! empty($string)) { -
    1208            if (substr($string, 0, 1) === '(' && substr($string, -1) === ')') { -
    1209                $this->_sqlParts['where'][] = $string; -
    1210            } else { -
    1211                $this->_sqlParts['where'][] = '(' . $string . ')'; -
    1212            } -
    1213        } -
    1214 -
    1215        $modifyLimit = true; -
    1216        if ( ! empty($this->_sqlParts['limit']) || ! empty($this->_sqlParts['offset'])) { -
    1217 -
    1218            if ($needsSubQuery) { -
    1219                $subquery = $this->getLimitSubquery(); -
    1220                // what about composite keys? -
    1221                $idColumnName = $table->getColumnName($table->getIdentifier()); -
    1222                switch (strtolower($this->_conn->getName())) { -
    1223                    case 'mysql': -
    1224                        // mysql doesn't support LIMIT in subqueries -
    1225                        $list     = $this->_conn->execute($subquery, $params)->fetchAll(Doctrine::FETCH_COLUMN); -
    1226                        $subquery = implode(', ', array_map(array($this->_conn, 'quote'), $list)); -
    1227                        break; -
    1228                    case 'pgsql': -
    1229                        // pgsql needs special nested LIMIT subquery -
    1230                        $subquery = 'SELECT doctrine_subquery_alias.' . $idColumnName . ' FROM (' . $subquery . ') AS doctrine_subquery_alias'; -
    1231                        break; -
    1232                } -
    1233 -
    1234                $field = $this->getSqlTableAlias($rootAlias) . '.' . $idColumnName; -
    1235 -
    1236                // only append the subquery if it actually contains something -
    1237                if ($subquery !== '') { -
    1238                    array_unshift($this->_sqlParts['where'], $this->_conn->quoteIdentifier($field) . ' IN (' . $subquery . ')'); -
    1239                } -
    1240 -
    1241                $modifyLimit = false; -
    1242            } -
    1243        } -
    1244 -
    1245        $q .= ( ! empty($this->_sqlParts['where']))?   ' WHERE '    . implode(' AND ', $this->_sqlParts['where']) : ''; -
    1246        $q .= ( ! empty($this->_sqlParts['groupby']))? ' GROUP BY ' . implode(', ', $this->_sqlParts['groupby'])  : ''; -
    1247        $q .= ( ! empty($this->_sqlParts['having']))?  ' HAVING '   . implode(' AND ', $this->_sqlParts['having']): ''; -
    1248        $q .= ( ! empty($this->_sqlParts['orderby']))? ' ORDER BY ' . implode(', ', $this->_sqlParts['orderby'])  : ''; -
    1249 -
    1250        if ($modifyLimit) { -
    1251            $q = $this->_conn->modifyLimitQuery($q, $this->_sqlParts['limit'], $this->_sqlParts['offset']); -
    1252        } -
    1253 -
    1254        // return to the previous state -
    1255        if ( ! empty($string)) { -
    1256            array_pop($this->_sqlParts['where']); -
    1257        } -
    1258        if ($needsSubQuery) { -
    1259            array_shift($this->_sqlParts['where']); -
    1260        } -
    1261        $this->_sql = $q; -
    1262 -
    1263        return $q; -
    1264    } -
    1265 -
    1266    /** -
    1267     * getLimitSubquery -
    1268     * this is method is used by the record limit algorithm -
    1269     * -
    1270     * when fetching one-to-many, many-to-many associated data with LIMIT clause -
    1271     * an additional subquery is needed for limiting the number of returned records instead -
    1272     * of limiting the number of sql result set rows -
    1273     * -
    1274     * @return string       the limit subquery -
    1275     * @todo A little refactor to make the method easier to understand & maybe shorter? -
    1276     */ -
    1277    public function getLimitSubquery() -
    1278    { -
    1279        $map    = reset($this->_queryComponents); -
    1280        $table  = $map['table']; -
    1281        $componentAlias = key($this->_queryComponents); -
    1282 -
    1283        // get short alias -
    1284        $alias      = $this->getTableAlias($componentAlias); -
    1285        // what about composite keys? -
    1286        $primaryKey = $alias . '.' . $table->getColumnName($table->getIdentifier()); -
    1287 -
    1288        // initialize the base of the subquery -
    1289        $subquery   = 'SELECT DISTINCT ' . $this->_conn->quoteIdentifier($primaryKey); -
    1290 -
    1291        $driverName = $this->_conn->getAttribute(Doctrine::ATTR_DRIVER_NAME); -
    1292 -
    1293        // pgsql needs the order by fields to be preserved in select clause -
    1294        if ($driverName == 'pgsql') { -
    1295            foreach ($this->_sqlParts['orderby'] as $part) { -
    1296                $part = trim($part); -
    1297                $e = $this->_tokenizer->bracketExplode($part, ' '); -
    1298                $part = trim($e[0]); -
    1299 -
    1300                if (strpos($part, '.') === false) { -
    1301                    continue; -
    1302                } -
    1303 -
    1304                // don't add functions -
    1305                if (strpos($part, '(') !== false) { -
    1306                    continue; -
    1307                } -
    1308 -
    1309                // don't add primarykey column (its already in the select clause) -
    1310                if ($part !== $primaryKey) { -
    1311                    $subquery .= ', ' . $part; -
    1312                } -
    1313            } -
    1314        } -
    1315 -
    1316        if ($driverName == 'mysql' || $driverName == 'pgsql') { -
    1317            foreach ($this->_expressionMap as $dqlAlias => $expr) { -
    1318                if (isset($expr[1])) { -
    1319                    $subquery .= ', ' . $expr[0] . ' AS ' . $this->_aggregateAliasMap[$dqlAlias]; -
    1320                } -
    1321            } -
    1322        } -
    1323 -
    1324        $subquery .= ' FROM'; -
    1325 -
    1326        foreach ($this->_sqlParts['from'] as $part) { -
    1327            // preserve LEFT JOINs only if needed -
    1328            if (substr($part, 0, 9) === 'LEFT JOIN') { -
    1329                $e = explode(' ', $part); -
    1330 -
    1331                if (empty($this->_sqlParts['orderby']) && empty($this->_sqlParts['where'])) { -
    1332                    continue; -
    1333                } -
    1334            } -
    1335 -
    1336            $subquery .= ' ' . $part; -
    1337        } -
    1338 -
    1339        // all conditions must be preserved in subquery -
    1340        $subquery .= ( ! empty($this->_sqlParts['where']))?   ' WHERE '    . implode(' AND ', $this->_sqlParts['where'])  : ''; -
    1341        $subquery .= ( ! empty($this->_sqlParts['groupby']))? ' GROUP BY ' . implode(', ', $this->_sqlParts['groupby'])   : ''; -
    1342        $subquery .= ( ! empty($this->_sqlParts['having']))?  ' HAVING '   . implode(' AND ', $this->_sqlParts['having']) : ''; -
    1343 -
    1344        $subquery .= ( ! empty($this->_sqlParts['orderby']))? ' ORDER BY ' . implode(', ', $this->_sqlParts['orderby'])   : ''; -
    1345 -
    1346        // add driver specific limit clause -
    1347        $subquery = $this->_conn->modifyLimitQuery($subquery, $this->_sqlParts['limit'], $this->_sqlParts['offset']); -
    1348 -
    1349        $parts = $this->_tokenizer->quoteExplode($subquery, ' ', "'", "'"); -
    1350 -
    1351        foreach ($parts as $k => $part) { -
    1352            if (strpos($part, ' ') !== false) { -
    1353                continue; -
    1354            } -
    1355 -
    1356            $part = trim($part, "\"'`"); -
    1357 -
    1358            if ($this->hasSqlTableAlias($part)) { -
    1359                $parts[$k] = $this->_conn->quoteIdentifier($this->generateNewSqlTableAlias($part)); -
    1360                continue; -
    1361            } -
    1362 -
    1363            if (strpos($part, '.') === false) { -
    1364                continue; -
    1365            } -
    1366            preg_match_all("/[a-zA-Z0-9_]+\.[a-z0-9_]+/i", $part, $m); -
    1367 -
    1368            foreach ($m[0] as $match) { -
    1369                $e = explode('.', $match); -
    1370                $e[0] = $this->generateNewSqlTableAlias($e[0]); -
    1371 -
    1372                $parts[$k] = str_replace($match, implode('.', $e), $parts[$k]); -
    1373            } -
    1374        } -
    1375 -
    1376        if ($driverName == 'mysql' || $driverName == 'pgsql') { -
    1377            foreach ($parts as $k => $part) { -
    1378                if (strpos($part, "'") !== false) { -
    1379                    continue; -
    1380                } -
    1381                if (strpos($part, '__') == false) { -
    1382                    continue; -
    1383                } -
    1384 -
    1385                preg_match_all("/[a-zA-Z0-9_]+\_\_[a-z0-9_]+/i", $part, $m); -
    1386 -
    1387                foreach ($m[0] as $match) { -
    1388                    $e = explode('__', $match); -
    1389                    $e[0] = $this->generateNewTableAlias($e[0]); -
    1390 -
    1391                    $parts[$k] = str_replace($match, implode('__', $e), $parts[$k]); -
    1392                } -
    1393            } -
    1394        } -
    1395 -
    1396        $subquery = implode(' ', $parts); -
    1397        return $subquery; -
    1398    } -
    1399 -
    1400    /** -
    1401     * DQL PARSER -
    1402     * parses a DQL query -
    1403     * first splits the query in parts and then uses individual -
    1404     * parsers for each part -
    1405     * -
    1406     * @param string $query                 DQL query -
    1407     * @param boolean $clear                whether or not to clear the aliases -
    1408     * @throws Doctrine_Query_Exception     if some generic parsing error occurs -
    1409     * @return Doctrine_Query -
    1410     */ -
    1411    public function parseDqlQuery($query, $clear = true) -
    1412    { -
    1413        if ($clear) { -
    1414            $this->clear(); -
    1415        } -
    1416 -
    1417        $query = trim($query); -
    1418        $query = str_replace("\n", ' ', $query); -
    1419        $query = str_replace("\r", ' ', $query); -
    1420 -
    1421        $parts = $this->_tokenizer->tokenizeQuery($query); -
    1422 -
    1423        foreach ($parts as $partName => $subParts) { -
    1424            $subParts = trim($subParts); -
    1425            $partName = strtolower($partName); -
    1426            switch ($partName) { -
    1427                case 'create': -
    1428                    $this->_type = self::CREATE; -
    1429                break; -
    1430                case 'insert': -
    1431                    $this->_type = self::INSERT; -
    1432                break; -
    1433                case 'delete': -
    1434                    $this->_type = self::DELETE; -
    1435                break; -
    1436                case 'select': -
    1437                    $this->_type = self::SELECT; -
    1438                    $this->_addDqlQueryPart($partName, $subParts); -
    1439                break; -
    1440                case 'update': -
    1441                    $this->_type = self::UPDATE; -
    1442                    $partName = 'from'; -
    1443                case 'from': -
    1444                    $this->_addDqlQueryPart($partName, $subParts); -
    1445                break; -
    1446                case 'set': -
    1447                    $this->_addDqlQueryPart($partName, $subParts, true); -
    1448                break; -
    1449                case 'group': -
    1450                case 'order': -
    1451                    $partName .= 'by'; -
    1452                case 'where': -
    1453                case 'having': -
    1454                case 'limit': -
    1455                case 'offset': -
    1456                    $this->_addDqlQueryPart($partName, $subParts); -
    1457                break; -
    1458            } -
    1459        } -
    1460 -
    1461        return $this; -
    1462    } -
    1463     -
    1464    /** -
    1465     * @todo Describe & refactor... too long and nested. -
    1466     */ -
    1467    public function load($path, $loadFields = true) -
    1468    { -
    1469     if (isset($this->_queryComponents[$path])) { -
    1470        return $this->_queryComponents[$path]; -
    1471     } -
    1472        $e = $this->_tokenizer->quoteExplode($path, ' INDEXBY '); -
    1473 -
    1474        $mapWith = null; -
    1475        if (count($e) > 1) { -
    1476            $mapWith = trim($e[1]); -
    1477 -
    1478            $path = $e[0]; -
    1479        } -
    1480 -
    1481        // parse custom join conditions -
    1482        $e = explode(' ON ', $path); -
    1483 -
    1484        $joinCondition = ''; -
    1485 -
    1486        if (count($e) > 1) { -
    1487            $joinCondition = $e[1]; -
    1488            $overrideJoin = true; -
    1489            $path = $e[0]; -
    1490        } else { -
    1491            $e = explode(' WITH ', $path); -
    1492 -
    1493            if (count($e) > 1) { -
    1494                $joinCondition = $e[1]; -
    1495                $path = $e[0]; -
    1496            } -
    1497            $overrideJoin = false; -
    1498        } -
    1499 -
    1500        $tmp            = explode(' ', $path); -
    1501        $componentAlias = $originalAlias = (count($tmp) > 1) ? end($tmp) : null; -
    1502 -
    1503        $e = preg_split("/[.:]/", $tmp[0], -1); -
    1504 -
    1505        $fullPath = $tmp[0]; -
    1506        $prevPath = ''; -
    1507        $fullLength = strlen($fullPath); -
    1508 -
    1509        if (isset($this->_queryComponents[$e[0]])) { -
    1510            $table = $this->_queryComponents[$e[0]]['table']; -
    1511            $componentAlias = $e[0]; -
    1512 -
    1513            $prevPath = $parent = array_shift($e); -
    1514        } -
    1515 -
    1516        foreach ($e as $key => $name) { -
    1517            // get length of the previous path -
    1518            $length = strlen($prevPath); -
    1519 -
    1520            // build the current component path -
    1521            $prevPath = ($prevPath) ? $prevPath . '.' . $name : $name; -
    1522 -
    1523            $delimeter = substr($fullPath, $length, 1); -
    1524 -
    1525            // if an alias is not given use the current path as an alias identifier -
    1526            if (strlen($prevPath) === $fullLength && isset($originalAlias)) { -
    1527                $componentAlias = $originalAlias; -
    1528            } else { -
    1529                $componentAlias = $prevPath; -
    1530            } -
    1531 -
    1532            // if the current alias already exists, skip it -
    1533            if (isset($this->_queryComponents[$componentAlias])) { -
    1534                continue; -
    1535            } -
    1536 -
    1537            if ( ! isset($table)) { -
    1538                // process the root of the path -
    1539 -
    1540                $table = $this->loadRoot($name, $componentAlias); -
    1541            } else { -
    1542                $join = ($delimeter == ':') ? 'INNER JOIN ' : 'LEFT JOIN '; -
    1543 -
    1544                $relation = $table->getRelation($name); -
    1545                $localTable = $table; -
    1546 -
    1547                $table    = $relation->getTable(); -
    1548                $this->_queryComponents[$componentAlias] = array('table'    => $table, -
    1549                                                          'parent'   => $parent, -
    1550                                                          'relation' => $relation, -
    1551                                                          'map'      => null); -
    1552                if ( ! $relation->isOneToOne()) { -
    1553                   $this->_needsSubquery = true; -
    1554                } -
    1555 -
    1556                $localAlias   = $this->getTableAlias($parent, $table->getTableName()); -
    1557                $foreignAlias = $this->getTableAlias($componentAlias, $relation->getTable()->getTableName()); -
    1558                $localSql     = $this->_conn->quoteIdentifier($table->getTableName()) -
    1559                              . ' ' -
    1560                              . $this->_conn->quoteIdentifier($localAlias); -
    1561 -
    1562                $foreignSql   = $this->_conn->quoteIdentifier($relation->getTable()->getTableName()) -
    1563                              . ' ' -
    1564                              . $this->_conn->quoteIdentifier($foreignAlias); -
    1565 -
    1566                $map = $relation->getTable()->inheritanceMap; -
    1567 -
    1568                if ( ! $loadFields || ! empty($map) || $joinCondition) { -
    1569                    $this->_subqueryAliases[] = $foreignAlias; -
    1570                } -
    1571 -
    1572                if ($relation instanceof Doctrine_Relation_Association) { -
    1573                    $asf = $relation->getAssociationTable(); -
    1574 -
    1575                    $assocTableName = $asf->getTableName(); -
    1576 -
    1577                    if ( ! $loadFields || ! empty($map) || $joinCondition) { -
    1578                        $this->_subqueryAliases[] = $assocTableName; -
    1579                    } -
    1580 -
    1581                    $assocPath = $prevPath . '.' . $asf->getComponentName(); -
    1582 -
    1583                    $this->_queryComponents[$assocPath] = array('parent' => $prevPath, 'relation' => $relation, 'table' => $asf); -
    1584 -
    1585                    $assocAlias = $this->getTableAlias($assocPath, $asf->getTableName()); -
    1586 -
    1587                    $queryPart = $join . $assocTableName . ' ' . $assocAlias; -
    1588 -
    1589                    $queryPart .= ' ON ' . $localAlias -
    1590                                . '.' -
    1591                                . $localTable->getIdentifier() // what about composite keys? -
    1592                                . ' = ' -
    1593                                . $assocAlias . '.' . $relation->getLocal(); -
    1594 -
    1595                    if ($relation->isEqual()) { -
    1596                        // equal nest relation needs additional condition -
    1597                        $queryPart .= ' OR ' . $localAlias -
    1598                                    . '.' -
    1599                                    . $table->getColumnName($table->getIdentifier()) -
    1600                                    . ' = ' -
    1601                                    . $assocAlias . '.' . $relation->getForeign(); -
    1602                    } -
    1603 -
    1604                    $this->_sqlParts['from'][] = $queryPart; -
    1605 -
    1606                    $queryPart = $join . $foreignSql; -
    1607 -
    1608                    if ( ! $overrideJoin) { -
    1609                        $queryPart .= ' ON '; -
    1610 -
    1611                        if ($relation->isEqual()) { -
    1612                            $queryPart .= '('; -
    1613                        } -
    1614 -
    1615                        $queryPart .= $this->_conn->quoteIdentifier($foreignAlias . '.' . $relation->getTable()->getIdentifier()) -
    1616                                    . ' = ' -
    1617                                    . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeign()); -
    1618 -
    1619                        if ($relation->isEqual()) { -
    1620                            $queryPart .= ' OR ' -
    1621                                        . $this->_conn->quoteIdentifier($foreignAlias . '.' . $table->getColumnName($table->getIdentifier())) -
    1622                                        . ' = '  -
    1623                                        . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal()) -
    1624                                        . ') AND '  -
    1625                                        . $this->_conn->quoteIdentifier($foreignAlias . '.' . $table->getIdentifier()) -
    1626                                        . ' != '   -
    1627                                        . $this->_conn->quoteIdentifier($localAlias . '.' . $table->getIdentifier()); -
    1628                        } -
    1629                    } -
    1630                } else { -
    1631 -
    1632                    $queryPart = $join . $foreignSql; -
    1633 -
    1634                    if ( ! $overrideJoin) { -
    1635                        $queryPart .= ' ON ' -
    1636                                   . $this->_conn->quoteIdentifier($localAlias . '.' . $relation->getLocal()) -
    1637                                   . ' = '  -
    1638                                   . $this->_conn->quoteIdentifier($foreignAlias . '.' . $relation->getForeign()); -
    1639                    } -
    1640                } -
    1641 -
    1642                $queryPart .= $this->buildInheritanceJoinSql($table->getComponentName(), $componentAlias); -
    1643 -
    1644                $this->_sqlParts['from'][$componentAlias] = $queryPart; -
    1645                if ( ! empty($joinCondition)) { -
    1646                    $this->_pendingJoinConditions[$componentAlias] = $joinCondition; -
    1647                } -
    1648            } -
    1649            if ($loadFields) { -
    1650 -
    1651                $restoreState = false; -
    1652                // load fields if necessary -
    1653                if ($loadFields && empty($this->_dqlParts['select'])) { -
    1654                    $this->_pendingFields[$componentAlias] = array('*'); -
    1655                } -
    1656            } -
    1657            $parent = $prevPath; -
    1658        } -
    1659         -
    1660        $table = $this->_queryComponents[$componentAlias]['table']; -
    1661 -
    1662        $indexBy = null; -
    1663 -
    1664        if (isset($mapWith)) { -
    1665            $e = explode('.', $mapWith); -
    1666 -
    1667            if (isset($e[1])) { -
    1668                $indexBy = $e[1]; -
    1669            } -
    1670        } elseif ($table->getBoundQueryPart('indexBy') !== null) { -
    1671            $indexBy = $table->getBoundQueryPart('indexBy'); -
    1672        } -
    1673 -
    1674        if ($indexBy !== null) { -
    1675            if ( ! $table->hasColumn($indexBy)) { -
    1676                throw new Doctrine_Query_Exception("Couldn't use key mapping. Column " . $indexBy . " does not exist."); -
    1677            } -
    1678     -
    1679            $this->_queryComponents[$componentAlias]['map'] = $table->getColumnName($indexBy); -
    1680        } -
    1681        return $this->_queryComponents[$componentAlias]; -
    1682    } -
    1683 -
    1684    /** -
    1685     * loadRoot -
    1686     * -
    1687     * @param string $name -
    1688     * @param string $componentAlias -
    1689     * @todo DESCRIBE ME! -
    1690     */ -
    1691    public function loadRoot($name, $componentAlias) -
    1692    { -
    1693        // get the connection for the component -
    1694        $this->_conn = Doctrine_Manager::getInstance() -
    1695                      ->getConnectionForComponent($name); -
    1696 -
    1697        $table = $this->_conn->getTable($name); -
    1698        $tableName = $table->getTableName(); -
    1699 -
    1700        // get the short alias for this table -
    1701        $tableAlias = $this->getTableAlias($componentAlias, $tableName); -
    1702        // quote table name -
    1703        $queryPart = $this->_conn->quoteIdentifier($tableName); -
    1704 -
    1705        if ($this->_type === self::SELECT) { -
    1706            $queryPart .= ' ' . $this->_conn->quoteIdentifier($tableAlias); -
    1707        } -
    1708         -
    1709        $this->_tableAliasMap[$tableAlias] = $componentAlias; -
    1710 -
    1711        $queryPart .= $this->buildInheritanceJoinSql($name, $componentAlias); -
    1712 -
    1713        $this->_sqlParts['from'][] = $queryPart; -
    1714 -
    1715        $this->_queryComponents[$componentAlias] = array('table' => $table, 'map' => null); -
    1716 -
    1717        return $table; -
    1718    } -
    1719     -
    1720    /** -
    1721     * @todo DESCRIBE ME! -
    1722     */ -
    1723    public function buildInheritanceJoinSql($name, $componentAlias) -
    1724    { -
    1725        // get the connection for the component -
    1726        $this->_conn = Doctrine_Manager::getInstance()->getConnectionForComponent($name); -
    1727 -
    1728        $table = $this->_conn->getTable($name); -
    1729        $tableName = $table->getTableName(); -
    1730 -
    1731        // get the short alias for this table -
    1732        $tableAlias = $this->getTableAlias($componentAlias, $tableName); -
    1733         -
    1734        $queryPart = ''; -
    1735 -
    1736        foreach ($table->getOption('joinedParents') as $parent) { -
    1737         $parentTable = $this->_conn->getTable($parent); -
    1738 -
    1739            $parentAlias = $componentAlias . '.' . $parent; -
    1740 -
    1741            // get the short alias for the parent table -
    1742            $parentTableAlias = $this->getTableAlias($parentAlias, $parentTable->getTableName()); -
    1743 -
    1744            $queryPart .= ' LEFT JOIN ' . $this->_conn->quoteIdentifier($parentTable->getTableName()) -
    1745                        . ' ' . $this->_conn->quoteIdentifier($parentTableAlias) . ' ON '; -
    1746             -
    1747            //Doctrine::dump($table->getIdentifier()); -
    1748            foreach ((array) $table->getIdentifier() as $identifier) { -
    1749                $column = $table->getColumnName($identifier); -
    1750 -
    1751                $queryPart .= $this->_conn->quoteIdentifier($tableAlias)  -
    1752                            . '.' . $this->_conn->quoteIdentifier($column) -
    1753                            . ' = ' . $this->_conn->quoteIdentifier($parentTableAlias) -
    1754                            . '.' . $this->_conn->quoteIdentifier($column); -
    1755            } -
    1756        } -
    1757         -
    1758        return $queryPart; -
    1759    } -
    1760 -
    1761    /** -
    1762     * count -
    1763     * fetches the count of the query -
    1764     * -
    1765     * This method executes the main query without all the -
    1766     * selected fields, ORDER BY part, LIMIT part and OFFSET part. -
    1767     * -
    1768     * Example: -
    1769     * Main query:  -
    1770     *      SELECT u.*, p.phonenumber FROM User u -
    1771     *          LEFT JOIN u.Phonenumber p  -
    1772     *          WHERE p.phonenumber = '123 123' LIMIT 10 -
    1773     * -
    1774     * The modified DQL query: -
    1775     *      SELECT COUNT(DISTINCT u.id) FROM User u -
    1776     *          LEFT JOIN u.Phonenumber p -
    1777     *          WHERE p.phonenumber = '123 123' -
    1778     * -
    1779     * @param array $params        an array of prepared statement parameters -
    1780     * @return integer             the count of this query -
    1781     */ -
    1782    public function count($params = array()) -
    1783    { -
    1784        // triggers dql parsing/processing -
    1785        $this->getQuery(); // this is ugly -
    1786 -
    1787        // initialize temporary variables -
    1788        $where  = $this->_sqlParts['where']; -
    1789        $having = $this->_sqlParts['having']; -
    1790        $groupby = $this->_sqlParts['groupby']; -
    1791        $map = reset($this->_queryComponents); -
    1792        $componentAlias = key($this->_queryComponents); -
    1793        $table = $map['table']; -
    1794 -
    1795        // build the query base -
    1796        $q  = 'SELECT COUNT(DISTINCT ' . $this->getTableAlias($componentAlias) -
    1797              . '.' . implode(',', (array) $table->getIdentifier()) -
    1798              . ') AS num_results'; -
    1799 -
    1800        foreach ($this->_sqlParts['select'] as $field) { -
    1801            if (strpos($field, '(') !== false) { -
    1802                $q .= ', ' . $field; -
    1803            } -
    1804        } -
    1805 -
    1806        $q .= ' FROM ' . $this->_buildSqlFromPart(); -
    1807 -
    1808        // append column aggregation inheritance (if needed) -
    1809        $string = $this->applyInheritance(); -
    1810 -
    1811        if ( ! empty($string)) { -
    1812            $where[] = $string; -
    1813        } -
    1814        // append conditions -
    1815        $q .= ( ! empty($where)) ?  ' WHERE '  . implode(' AND ', $where) : ''; -
    1816        $q .= ( ! empty($groupby)) ?  ' GROUP BY '  . implode(', ', $groupby) : ''; -
    1817        $q .= ( ! empty($having)) ? ' HAVING ' . implode(' AND ', $having): ''; -
    1818 -
    1819        if ( ! is_array($params)) { -
    1820            $params = array($params); -
    1821        } -
    1822        // append parameters -
    1823        $params = array_merge($this->_params['where'], $this->_params['having'], $params); -
    1824 -
    1825        $params = $this->convertEnums($params); -
    1826 -
    1827        $results = $this->getConnection()->fetchAll($q, $params); -
    1828 -
    1829        if (count($results) > 1) { -
    1830            $count = 0; -
    1831            foreach ($results as $result) { -
    1832                $count += $result['num_results']; -
    1833            } -
    1834        } else { -
    1835            $count = isset($results[0]) ? $results[0]['num_results']:0; -
    1836        } -
    1837 -
    1838        return (int) $count; -
    1839    } -
    1840 -
    1841    /** -
    1842     * query -
    1843     * query the database with DQL (Doctrine Query Language) -
    1844     * -
    1845     * @param string $query      DQL query -
    1846     * @param array $params      prepared statement parameters -
    1847     * @param int $hydrationMode Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD -
    1848     * @see Doctrine::FETCH_* constants -
    1849     * @return mixed -
    1850     */ -
    1851    public function query($query, $params = array(), $hydrationMode = null) -
    1852    { -
    1853        $this->parseDqlQuery($query); -
    1854        return $this->execute($params, $hydrationMode); -
    1855    } -
    1856 -
    1857    /** -
    1858     * Copies a Doctrine_Query object. -
    1859     * -
    1860     * @param Doctrine_Query   Doctrine query instance. -
    1861     *                         If ommited the instance itself will be used as source. -
    1862     * @return Doctrine_Query  Copy of the Doctrine_Query instance. -
    1863     */ -
    1864    public function copy(Doctrine_Query $query = null) -
    1865    { -
    1866        if ( ! $query) { -
    1867            $query = $this; -
    1868        } -
    1869 -
    1870        $new = new Doctrine_Query(); -
    1871        $new->_dqlParts = $query->_dqlParts; -
    1872        $new->_params = $query->_params; -
    1873        $new->_hydrator = $query->_hydrator; -
    1874 -
    1875        return $new; -
    1876    } -
    1877 -
    1878    /** -
    1879     * Frees the resources used by the query object. It especially breaks a  -
    1880     * cyclic reference between the query object and it's parsers. This enables -
    1881     * PHP's current GC to reclaim the memory. -
    1882     * This method can therefore be used to reduce memory usage when creating a lot -
    1883     * of query objects during a request. -
    1884     * -
    1885     * @return Doctrine_Query   this object -
    1886     */ -
    1887    public function free() -
    1888    { -
    1889        $this->reset(); -
    1890        $this->_parsers = array(); -
    1891        $this->_dqlParts = array(); -
    1892        $this->_enumParams = array(); -
    1893    } -
    1894     -
    1895    /** -
    1896     * serialize -
    1897     * this method is automatically called when this Doctrine_Hydrate is serialized -
    1898     * -
    1899     * @return array    an array of serialized properties -
    1900     */ -
    1901    public function serialize() -
    1902    { -
    1903        $vars = get_object_vars($this); -
    1904    } -
    1905 -
    1906    /** -
    1907     * unseralize -
    1908     * this method is automatically called everytime a Doctrine_Hydrate object is unserialized -
    1909     * -
    1910     * @param string $serialized                Doctrine_Record as serialized string -
    1911     * @return void -
    1912     */ -
    1913    public function unserialize($serialized) -
    1914    { -
    1915 -
    1916    } -
    1917} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Abstract.html b/tests_old/coverage/Doctrine_Query_Abstract.html deleted file mode 100644 index d72b6ce8f..000000000 --- a/tests_old/coverage/Doctrine_Query_Abstract.html +++ /dev/null @@ -1,5319 +0,0 @@ - - - Coverage for Doctrine_Query_Abstract - - -

    Coverage for Doctrine_Query_Abstract

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Query.php 1393 2007-05-19 17:49:16Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Hydrate'); -
    22/** -
    23 * Doctrine_Query_Abstract -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1393 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 * @todo        See {@link Doctrine_Query}  -
    33 */ -
    34abstract class Doctrine_Query_Abstract -
    35{ -
    36    /** -
    37     * QUERY TYPE CONSTANTS -
    38     */ -
    39 -
    40    /** -
    41     * constant for SELECT queries -
    42     */ -
    43    const SELECT = 0; -
    44 -
    45    /** -
    46     * constant for DELETE queries -
    47     */ -
    48    const DELETE = 1; -
    49 -
    50    /** -
    51     * constant for UPDATE queries -
    52     */ -
    53    const UPDATE = 2; -
    54 -
    55    /** -
    56     * constant for INSERT queries -
    57     */ -
    58    const INSERT = 3; -
    59 -
    60    /** -
    61     * constant for CREATE queries -
    62     */ -
    63    const CREATE = 4; -
    64     -
    65    /** @todo document the query states (and the transitions between them). */ -
    66    /** -
    67     * A query object is in CLEAN state when it has NO unparsed/unprocessed DQL parts. -
    68     */ -
    69    const STATE_CLEAN  = 1; -
    70     -
    71    /** -
    72     * A query object is in state DIRTY when it has DQL parts that have not yet been  -
    73     * parsed/processed. -
    74     */ -
    75    const STATE_DIRTY  = 2; -
    76     -
    77    /** -
    78     * A query is in DIRECT state when ... ? -
    79     */ -
    80    const STATE_DIRECT = 3; -
    81     -
    82    /** -
    83     * A query object is on LOCKED state when ... ? -
    84     */ -
    85    const STATE_LOCKED = 4; -
    86     -
    87    /** -
    88     * @var array  Table alias map. Keys are SQL aliases and values DQL aliases.  -
    89     */ -
    90    protected $_tableAliasMap = array(); -
    91     -
    92    /** -
    93     * @var Doctrine_View  The view object used by this query, if any. -
    94     */ -
    95    protected $_view; -
    96     -
    97    /** -
    98     * @var integer $_state   The current state of this query. -
    99     */ -
    100    protected $_state = Doctrine_Query::STATE_CLEAN; -
    101 -
    102    /** -
    103     * @var array $params  The parameters of this query. -
    104     */ -
    105    protected $_params = array('where' => array(), -
    106                               'set' => array(), -
    107                               'having' => array()); -
    108     -
    109    /* Caching properties */ -
    110    /**  -
    111     * @var Doctrine_Cache_Interface  The cache driver used for caching result sets. -
    112     */ -
    113    protected $_resultCache;  -
    114    /** -
    115     * @var boolean $_expireResultCache  A boolean value that indicates whether or not -
    116     *                                   expire the result cache. -
    117     */ -
    118    protected $_expireResultCache = false; -
    119    protected $_resultCacheTTL; -
    120     -
    121    /**  -
    122     * @var Doctrine_Cache_Interface  The cache driver used for caching queries. -
    123     */ -
    124    protected $_queryCache; -
    125    protected $_expireQueryCache = false; -
    126    protected $_queryCacheTTL; -
    127     -
    128     -
    129    /** -
    130     * @var Doctrine_Connection  The connection used by this query object. -
    131     */ -
    132    protected $_conn; -
    133     -
    134     -
    135    /** -
    136     * @var array $_sqlParts  The SQL query string parts. Filled during the DQL parsing process. -
    137     */ -
    138    protected $_sqlParts = array( -
    139            'select'    => array(), -
    140            'distinct'  => false, -
    141            'forUpdate' => false, -
    142            'from'      => array(), -
    143            'set'       => array(), -
    144            'join'      => array(), -
    145            'where'     => array(), -
    146            'groupby'   => array(), -
    147            'having'    => array(), -
    148            'orderby'   => array(), -
    149            'limit'     => false, -
    150            'offset'    => false, -
    151            ); -
    152             -
    153    /** -
    154     * @var array $_dqlParts                an array containing all DQL query parts -
    155     */ -
    156    protected $_dqlParts = array( -
    157                            'from'      => array(), -
    158                            'select'    => array(), -
    159                            'forUpdate' => false, -
    160                            'set'       => array(), -
    161                            'join'      => array(), -
    162                            'where'     => array(), -
    163                            'groupby'   => array(), -
    164                            'having'    => array(), -
    165                            'orderby'   => array(), -
    166                            'limit'     => array(), -
    167                            'offset'    => array(), -
    168                            ); -
    169             -
    170     -
    171    /** -
    172     * @var array $_queryComponents   Two dimensional array containing the components of this query, -
    173     *                                informations about their relations and other related information. -
    174     *                                The components are constructed during query parsing. -
    175     * -
    176     *      Keys are component aliases and values the following: -
    177     * -
    178     *          table               table object associated with given alias -
    179     * -
    180     *          relation            the relation object owned by the parent -
    181     * -
    182     *          parent              the alias of the parent -
    183     * -
    184     *          agg                 the aggregates of this component -
    185     * -
    186     *          map                 the name of the column / aggregate value this -
    187     *                              component is mapped to a collection -
    188     */ -
    189    protected $_queryComponents = array(); -
    190     -
    191    /** -
    192     * @var integer $type                   the query type -
    193     * -
    194     * @see Doctrine_Query::* constants -
    195     */ -
    196    protected $_type = self::SELECT; -
    197     -
    198    /** -
    199     * @var Doctrine_Hydrator   The hydrator object used to hydrate query results. -
    200     */ -
    201    protected $_hydrator; -
    202     -
    203    /** -
    204     * @var Doctrine_Query_Tokenizer  The tokenizer that is used during the query parsing process. -
    205     */ -
    206    protected $_tokenizer; -
    207     -
    208    /** -
    209     * @var Doctrine_Query_Parser  The parser that is used for query parsing. -
    210     */ -
    211    protected $_parser; -
    212     -
    213    /** -
    214     * @var array $_tableAliasSeeds         A simple array keys representing table aliases and values -
    215     *                                      table alias seeds. The seeds are used for generating short table -
    216     *                                      aliases. -
    217     */ -
    218    protected $_tableAliasSeeds = array(); -
    219     -
    220    /** -
    221     * @var array $_options                 an array of options -
    222     */ -
    223    protected $_options    = array( -
    224                            'fetchMode'      => Doctrine::FETCH_RECORD -
    225                            ); -
    226     -
    227    /** -
    228     * @var array $_enumParams              an array containing the keys of the parameters that should be enumerated -
    229     */ -
    230    protected $_enumParams = array(); -
    231     -
    232    /** -
    233     * @var boolean -
    234     */ -
    235    protected $_isLimitSubqueryUsed = false; -
    236     -
    237     -
    238    /** -
    239     * Constructor. -
    240     * -
    241     * @param Doctrine_Connection  The connection object the query will use. -
    242     * @param Doctrine_Hydrator_Abstract  The hydrator that will be used for generating result sets. -
    243     */ -
    244    public function __construct(Doctrine_Connection $connection = null, -
    245            Doctrine_Hydrator_Abstract $hydrator = null) -
    246    { -
    247        if ($connection === null) { -
    248            $connection = Doctrine_Manager::getInstance()->getCurrentConnection(); -
    249        } -
    250        if ($hydrator === null) { -
    251            $hydrator = new Doctrine_Hydrator(); -
    252        } -
    253        $this->_conn = $connection; -
    254        $this->_hydrator = $hydrator; -
    255        $this->_tokenizer = new Doctrine_Query_Tokenizer(); -
    256    } -
    257     -
    258    /** -
    259     * setOption -
    260     * -
    261     * @param string $name      option name -
    262     * @param string $value     option value -
    263     * @return Doctrine_Query   this object -
    264     */ -
    265    public function setOption($name, $value) -
    266    { -
    267        if ( ! isset($this->_options[$name])) { -
    268            throw new Doctrine_Query_Exception('Unknown option ' . $name); -
    269        } -
    270        $this->_options[$name] = $value; -
    271    } -
    272     -
    273    /** -
    274     * hasTableAlias -
    275     * whether or not this object has given tableAlias -
    276     * -
    277     * @param string $tableAlias    the table alias to be checked -
    278     * @return boolean              true if this object has given alias, otherwise false -
    279     * @deprecated -
    280     */ -
    281    public function hasTableAlias($sqlTableAlias) -
    282    { -
    283        return $this->hasSqlTableAlias($sqlTableAlias); -
    284    } -
    285     -
    286    /** -
    287     * hasSqlTableAlias -
    288     * whether or not this object has given tableAlias -
    289     * -
    290     * @param string $tableAlias    the table alias to be checked -
    291     * @return boolean              true if this object has given alias, otherwise false -
    292     */ -
    293    public function hasSqlTableAlias($sqlTableAlias) -
    294    { -
    295        return (isset($this->_tableAliasMap[$sqlTableAlias])); -
    296    } -
    297     -
    298    /** -
    299     * getTableAliases -
    300     * returns all table aliases -
    301     * -
    302     * @return array        table aliases as an array -
    303     * @deprecated -
    304     */ -
    305    public function getTableAliases() -
    306    { -
    307        return $this->getTableAliasMap(); -
    308    } -
    309     -
    310    /** -
    311     * getTableAliasMap -
    312     * returns all table aliases -
    313     * -
    314     * @return array        table aliases as an array -
    315     */ -
    316    public function getTableAliasMap() -
    317    { -
    318        return $this->_tableAliasMap; -
    319    } -
    320     -
    321    /** -
    322     * getQueryPart -
    323     * gets a query part from the query part array -
    324     * -
    325     * @param string $name          the name of the query part to be set -
    326     * @param string $part          query part string -
    327     * @throws Doctrine_Query_Exception   if trying to set unknown query part -
    328     * @return Doctrine_Query_Abstract  this object -
    329     * @deprecated -
    330     */ -
    331    public function getQueryPart($part) -
    332    { -
    333        return $this->getSqlQueryPart($part); -
    334    } -
    335     -
    336    /** -
    337     * getSqlQueryPart -
    338     * gets an SQL query part from the SQL query part array -
    339     * -
    340     * @param string $name          the name of the query part to be set -
    341     * @param string $part          query part string -
    342     * @throws Doctrine_Query_Exception   if trying to set unknown query part -
    343     * @return Doctrine_Hydrate     this object -
    344     */ -
    345    public function getSqlQueryPart($part) -
    346    { -
    347        if ( ! isset($this->_sqlParts[$part])) { -
    348            throw new Doctrine_Query_Exception('Unknown SQL query part ' . $part); -
    349        } -
    350        return $this->_sqlParts[$part]; -
    351    } -
    352     -
    353    /** -
    354     * setQueryPart -
    355     * sets a query part in the query part array -
    356     * -
    357     * @param string $name          the name of the query part to be set -
    358     * @param string $part          query part string -
    359     * @throws Doctrine_Query_Exception   if trying to set unknown query part -
    360     * @return Doctrine_Hydrate     this object -
    361     * @deprecated -
    362     */ -
    363    public function setQueryPart($name, $part) -
    364    { -
    365        return $this->setSqlQueryPart($name, $part); -
    366    } -
    367     -
    368    /** -
    369     * setSqlQueryPart -
    370     * sets an SQL query part in the SQL query part array -
    371     * -
    372     * @param string $name          the name of the query part to be set -
    373     * @param string $part          query part string -
    374     * @throws Doctrine_Query_Exception   if trying to set unknown query part -
    375     * @return Doctrine_Hydrate     this object -
    376     */ -
    377    public function setSqlQueryPart($name, $part) -
    378    { -
    379        if ( ! isset($this->_sqlParts[$name])) { -
    380            throw new Doctrine_Query_Exception('Unknown query part ' . $name); -
    381        } -
    382 -
    383        if ($name !== 'limit' && $name !== 'offset') { -
    384            if (is_array($part)) { -
    385                $this->_sqlParts[$name] = $part; -
    386            } else { -
    387                $this->_sqlParts[$name] = array($part); -
    388            } -
    389        } else { -
    390            $this->_sqlParts[$name] = $part; -
    391        } -
    392 -
    393        return $this; -
    394    } -
    395     -
    396    /** -
    397     * addQueryPart -
    398     * adds a query part in the query part array -
    399     * -
    400     * @param string $name          the name of the query part to be added -
    401     * @param string $part          query part string -
    402     * @throws Doctrine_Query_Exception   if trying to add unknown query part -
    403     * @return Doctrine_Hydrate     this object -
    404     * @deprecated -
    405     */ -
    406    public function addQueryPart($name, $part) -
    407    { -
    408        return $this->addSqlQueryPart($name, $part); -
    409    } -
    410     -
    411    /** -
    412     * addSqlQueryPart -
    413     * adds an SQL query part to the SQL query part array -
    414     * -
    415     * @param string $name          the name of the query part to be added -
    416     * @param string $part          query part string -
    417     * @throws Doctrine_Query_Exception   if trying to add unknown query part -
    418     * @return Doctrine_Hydrate     this object -
    419     */ -
    420    public function addSqlQueryPart($name, $part) -
    421    { -
    422        if ( ! isset($this->_sqlParts[$name])) { -
    423            throw new Doctrine_Query_Exception('Unknown query part ' . $name); -
    424        } -
    425        if (is_array($part)) { -
    426            $this->_sqlParts[$name] = array_merge($this->_sqlParts[$name], $part); -
    427        } else { -
    428            $this->_sqlParts[$name][] = $part; -
    429        } -
    430        return $this; -
    431    } -
    432     -
    433    /** -
    434     * removeQueryPart -
    435     * removes a query part from the query part array -
    436     * -
    437     * @param string $name          the name of the query part to be removed -
    438     * @throws Doctrine_Query_Exception   if trying to remove unknown query part -
    439     * @return Doctrine_Hydrate     this object -
    440     * @deprecated -
    441     */ -
    442    public function removeQueryPart($name) -
    443    { -
    444        return $this->removeSqlQueryPart($name); -
    445    } -
    446     -
    447    /** -
    448     * removeSqlQueryPart -
    449     * removes a query part from the query part array -
    450     * -
    451     * @param string $name          the name of the query part to be removed -
    452     * @throws Doctrine_Query_Exception   if trying to remove unknown query part -
    453     * @return Doctrine_Hydrate     this object -
    454     */ -
    455    public function removeSqlQueryPart($name) -
    456    { -
    457        try { -
    458        if ( ! isset($this->_sqlParts[$name])) { -
    459            throw new Doctrine_Query_Exception('Unknown query part ' . $name); -
    460        }} -
    461        catch (Exception $e) {echo $e->getTraceAsString(); echo "<br /><br /><br />";} -
    462 -
    463        if ($name == 'limit' || $name == 'offset') { -
    464                $this->_sqlParts[$name] = false; -
    465        } else { -
    466                $this->_sqlParts[$name] = array(); -
    467        } -
    468        return $this; -
    469    } -
    470     -
    471    /** -
    472     * setView -
    473     * sets a database view this query object uses -
    474     * this method should only be called internally by doctrine -
    475     * -
    476     * @param Doctrine_View $view       database view -
    477     * @return void -
    478     */ -
    479    public function setView(Doctrine_View $view) -
    480    { -
    481        $this->_view = $view; -
    482    } -
    483     -
    484    /** -
    485     * getView -
    486     * returns the view associated with this query object (if any) -
    487     * -
    488     * @return Doctrine_View        the view associated with this query object -
    489     */ -
    490    public function getView() -
    491    { -
    492        return $this->_view; -
    493    } -
    494     -
    495    /** -
    496     * limitSubqueryUsed -
    497     * -
    498     * @return boolean -
    499     */ -
    500    public function isLimitSubqueryUsed() -
    501    { -
    502        return $this->_isLimitSubqueryUsed; -
    503    } -
    504     -
    505    /** -
    506     * convertEnums -
    507     * convert enum parameters to their integer equivalents -
    508     * -
    509     * @return array    converted parameter array -
    510     */ -
    511    public function convertEnums($params) -
    512    { -
    513        foreach ($this->_enumParams as $key => $values) { -
    514            if (isset($params[$key])) { -
    515                if ( ! empty($values)) { -
    516                    $params[$key] = $values[0]->enumIndex($values[1], $params[$key]); -
    517                } -
    518            } -
    519        } -
    520        return $params; -
    521    } -
    522     -
    523    /** -
    524     * applyInheritance -
    525     * applies column aggregation inheritance to DQL / SQL query -
    526     * -
    527     * @return string -
    528     */ -
    529    public function applyInheritance() -
    530    { -
    531        // get the inheritance maps -
    532        $array = array(); -
    533 -
    534        foreach ($this->_queryComponents as $componentAlias => $data) { -
    535            $tableAlias = $this->getSqlTableAlias($componentAlias); -
    536            $array[$tableAlias][] = $data['table']->inheritanceMap; -
    537        } -
    538 -
    539        // apply inheritance maps -
    540        $str = ''; -
    541        $c = array(); -
    542 -
    543        $index = 0; -
    544        foreach ($array as $tableAlias => $maps) { -
    545            $a = array(); -
    546 -
    547            // don't use table aliases if the query isn't a select query -
    548            if ($this->_type !== Doctrine_Query::SELECT) { -
    549                $tableAlias = ''; -
    550            } else { -
    551                $tableAlias .= '.'; -
    552            } -
    553 -
    554            foreach ($maps as $map) { -
    555                $b = array(); -
    556                foreach ($map as $field => $value) { -
    557                    $identifier = $this->_conn->quoteIdentifier($tableAlias . $field); -
    558 -
    559                    if ($index > 0) { -
    560                        $b[] = '(' . $identifier . ' = ' . $this->_conn->quote($value) -
    561                             . ' OR ' . $identifier . ' IS NULL)'; -
    562                    } else { -
    563                        $b[] = $identifier . ' = ' . $this->_conn->quote($value); -
    564                    } -
    565                } -
    566 -
    567                if ( ! empty($b)) { -
    568                    $a[] = implode(' AND ', $b); -
    569                } -
    570            } -
    571 -
    572            if ( ! empty($a)) { -
    573                $c[] = implode(' AND ', $a); -
    574            } -
    575            $index++; -
    576        } -
    577 -
    578        $str .= implode(' AND ', $c); -
    579 -
    580        return $str; -
    581    } -
    582     -
    583    /** -
    584     * getTableAlias -
    585     * some database such as Oracle need the identifier lengths to be < ~30 chars -
    586     * hence Doctrine creates as short identifier aliases as possible -
    587     * -
    588     * this method is used for the creation of short table aliases, its also -
    589     * smart enough to check if an alias already exists for given component (componentAlias) -
    590     * -
    591     * @param string $componentAlias    the alias for the query component to search table alias for -
    592     * @param string $tableName         the table name from which the table alias is being created -
    593     * @return string                   the generated / fetched short alias -
    594     * @deprecated -
    595     */ -
    596    public function getTableAlias($componentAlias, $tableName = null) -
    597    { -
    598        return $this->getSqlTableAlias($componentAlias, $tableName); -
    599    } -
    600     -
    601    /** -
    602     * getSqlTableAlias -
    603     * some database such as Oracle need the identifier lengths to be < ~30 chars -
    604     * hence Doctrine creates as short identifier aliases as possible -
    605     * -
    606     * this method is used for the creation of short table aliases, its also -
    607     * smart enough to check if an alias already exists for given component (componentAlias) -
    608     * -
    609     * @param string $componentAlias    the alias for the query component to search table alias for -
    610     * @param string $tableName         the table name from which the table alias is being created -
    611     * @return string                   the generated / fetched short alias -
    612     */ -
    613    public function getSqlTableAlias($componentAlias, $tableName = null) -
    614    { -
    615        $alias = array_search($componentAlias, $this->_tableAliasMap); -
    616 -
    617        if ($alias !== false) { -
    618            return $alias; -
    619        } -
    620 -
    621        if ($tableName === null) { -
    622            throw new Doctrine_Query_Exception("Couldn't get short alias for " . $componentAlias); -
    623        } -
    624 -
    625        return $this->generateTableAlias($componentAlias, $tableName); -
    626    } -
    627     -
    628    /** -
    629     * generateNewTableAlias -
    630     * generates a new alias from given table alias -
    631     * -
    632     * @param string $tableAlias    table alias from which to generate the new alias from -
    633     * @return string               the created table alias -
    634     * @deprecated -
    635     */ -
    636    public function generateNewTableAlias($oldAlias) -
    637    { -
    638        return $this->generateNewSqlTableAlias($oldAlias); -
    639    } -
    640     -
    641    /** -
    642     * generateNewSqlTableAlias -
    643     * generates a new alias from given table alias -
    644     * -
    645     * @param string $tableAlias    table alias from which to generate the new alias from -
    646     * @return string               the created table alias -
    647     */ -
    648    public function generateNewSqlTableAlias($oldAlias) -
    649    { -
    650        if (isset($this->_tableAliasMap[$oldAlias])) { -
    651            // generate a new alias -
    652            $name = substr($oldAlias, 0, 1); -
    653            $i    = ((int) substr($oldAlias, 1)); -
    654 -
    655            if ($i == 0) { -
    656                $i = 1; -
    657            } -
    658 -
    659            $newIndex  = ($this->_tableAliasSeeds[$name] + $i); -
    660 -
    661            return $name . $newIndex; -
    662        } -
    663 -
    664        return $oldAlias; -
    665    } -
    666     -
    667    /** -
    668     * getTableAliasSeed -
    669     * returns the alias seed for given table alias -
    670     * -
    671     * @param string $tableAlias    table alias that identifies the alias seed -
    672     * @return integer              table alias seed -
    673     * @deprecated -
    674     */ -
    675    public function getTableAliasSeed($sqlTableAlias) -
    676    { -
    677        return $this->getSqlTableAliasSeed($sqlTableAlias); -
    678    } -
    679     -
    680    /** -
    681     * getSqlTableAliasSeed -
    682     * returns the alias seed for given table alias -
    683     * -
    684     * @param string $tableAlias    table alias that identifies the alias seed -
    685     * @return integer              table alias seed -
    686     */ -
    687    public function getSqlTableAliasSeed($sqlTableAlias) -
    688    { -
    689        if ( ! isset($this->_tableAliasSeeds[$sqlTableAlias])) { -
    690            return 0; -
    691        } -
    692        return $this->_tableAliasSeeds[$sqlTableAlias]; -
    693    } -
    694     -
    695    /** -
    696     * hasAliasDeclaration -
    697     * whether or not this object has a declaration for given component alias -
    698     * -
    699     * @param string $componentAlias    the component alias the retrieve the declaration from -
    700     * @return boolean -
    701     */ -
    702    public function hasAliasDeclaration($componentAlias) -
    703    { -
    704        return isset($this->_queryComponents[$componentAlias]); -
    705    } -
    706     -
    707    /** -
    708     * getAliasDeclaration -
    709     * get the declaration for given component alias -
    710     * -
    711     * @param string $componentAlias    the component alias the retrieve the declaration from -
    712     * @return array                    the alias declaration -
    713     * @deprecated -
    714     */ -
    715    public function getAliasDeclaration($componentAlias) -
    716    { -
    717        return $this->getQueryComponent($componentAlias); -
    718    } -
    719     -
    720    /** -
    721     * getQueryComponent -
    722     * get the declaration for given component alias -
    723     * -
    724     * @param string $componentAlias    the component alias the retrieve the declaration from -
    725     * @return array                    the alias declaration -
    726     */ -
    727    public function getQueryComponent($componentAlias) -
    728    { -
    729        if ( ! isset($this->_queryComponents[$componentAlias])) { -
    730            throw new Doctrine_Query_Exception('Unknown component alias ' . $componentAlias); -
    731        } -
    732 -
    733        return $this->_queryComponents[$componentAlias]; -
    734    } -
    735     -
    736    /** -
    737     * copyAliases -
    738     * copy aliases from another Hydrate object -
    739     * -
    740     * this method is needed by DQL subqueries which need the aliases -
    741     * of the parent query -
    742     * -
    743     * @param Doctrine_Hydrate $query   the query object from which the -
    744     *                                  aliases are copied from -
    745     * @return Doctrine_Hydrate         this object -
    746     */ -
    747    public function copyAliases(Doctrine_Query_Abstract $query) -
    748    { -
    749        $this->_tableAliasMap = $query->_tableAliasMap; -
    750        $this->_queryComponents     = $query->_queryComponents; -
    751        $this->_tableAliasSeeds = $query->_tableAliasSeeds; -
    752        return $this; -
    753    } -
    754     -
    755    /** -
    756     * getRootAlias -
    757     * returns the alias of the the root component -
    758     * -
    759     * @return array -
    760     */ -
    761    public function getRootAlias() -
    762    { -
    763        if ( ! $this->_queryComponents) { -
    764          $this->getSql(); -
    765        } -
    766        reset($this->_queryComponents); -
    767 -
    768        return key($this->_queryComponents); -
    769    } -
    770     -
    771    /** -
    772     * getRootDeclaration -
    773     * returns the root declaration -
    774     * -
    775     * @return array -
    776     */ -
    777    public function getRootDeclaration() -
    778    { -
    779        $map = reset($this->_queryComponents); -
    780        return $map; -
    781    } -
    782     -
    783    /** -
    784     * getRoot -
    785     * returns the root component for this object -
    786     * -
    787     * @return Doctrine_Table       root components table -
    788     */ -
    789    public function getRoot() -
    790    { -
    791        $map = reset($this->_queryComponents); -
    792 -
    793        if ( ! isset($map['table'])) { -
    794            throw new Doctrine_Query_Exception('Root component not initialized.'); -
    795        } -
    796 -
    797        return $map['table']; -
    798    } -
    799     -
    800    /** -
    801     * generateTableAlias -
    802     * generates a table alias from given table name and associates  -
    803     * it with given component alias -
    804     * -
    805     * @param string $componentAlias    the component alias to be associated with generated table alias -
    806     * @param string $tableName         the table name from which to generate the table alias -
    807     * @return string                   the generated table alias -
    808     * @deprecated -
    809     */ -
    810    public function generateTableAlias($componentAlias, $tableName) -
    811    { -
    812        return $this->generateSqlTableAlias($componentAlias, $tableName); -
    813    } -
    814     -
    815    /** -
    816     * generateSqlTableAlias -
    817     * generates a table alias from given table name and associates  -
    818     * it with given component alias -
    819     * -
    820     * @param string $componentAlias    the component alias to be associated with generated table alias -
    821     * @param string $tableName         the table name from which to generate the table alias -
    822     * @return string                   the generated table alias -
    823     */ -
    824    public function generateSqlTableAlias($componentAlias, $tableName) -
    825    { -
    826        $char   = strtolower(substr($tableName, 0, 1)); -
    827 -
    828        $alias  = $char; -
    829 -
    830        if ( ! isset($this->_tableAliasSeeds[$alias])) { -
    831            $this->_tableAliasSeeds[$alias] = 1; -
    832        } -
    833 -
    834        while (isset($this->_tableAliasMap[$alias])) { -
    835            if ( ! isset($this->_tableAliasSeeds[$alias])) { -
    836                $this->_tableAliasSeeds[$alias] = 1; -
    837            } -
    838            $alias = $char . ++$this->_tableAliasSeeds[$alias]; -
    839        } -
    840 -
    841        $this->_tableAliasMap[$alias] = $componentAlias; -
    842 -
    843        return $alias; -
    844    } -
    845     -
    846    /** -
    847     * getComponentAlias -
    848     * get component alias associated with given table alias -
    849     * -
    850     * @param string $sqlTableAlias    the SQL table alias that identifies the component alias -
    851     * @return string               component alias -
    852     */ -
    853    public function getComponentAlias($sqlTableAlias) -
    854    { -
    855        if ( ! isset($this->_tableAliasMap[$sqlTableAlias])) { -
    856            throw new Doctrine_Query_Exception('Unknown table alias ' . $sqlTableAlias); -
    857        } -
    858        return $this->_tableAliasMap[$sqlTableAlias]; -
    859    } -
    860     -
    861    /** -
    862     * _execute  -
    863     *  -
    864     * @param array $params  -
    865     * @return PDOStatement  The executed PDOStatement. -
    866     */ -
    867    protected function _execute($params) -
    868    { -
    869        $params = $this->_conn->convertBooleans($params); -
    870 -
    871        if ( ! $this->_view) { -
    872            if ($this->_queryCache || $this->_conn->getAttribute(Doctrine::ATTR_QUERY_CACHE)) { -
    873                $queryCacheDriver = $this->getQueryCacheDriver(); -
    874                // calculate hash for dql query -
    875                $dql = $this->getDql();  -
    876                $hash = md5($dql . 'DOCTRINE_QUERY_CACHE_SALT'); -
    877                $cached = $queryCacheDriver->fetch($hash); -
    878                if ($cached) { -
    879                    $query = $this->_constructQueryFromCache($cached); -
    880                } else { -
    881                    $query = $this->getSqlQuery($params); -
    882                    $serializedQuery = $this->getCachedForm($query); -
    883                    $queryCacheDriver->save($hash, $serializedQuery, $this->_queryCacheTTL); -
    884                } -
    885            } else { -
    886                $query = $this->getSqlQuery($params); -
    887            } -
    888        } else { -
    889            $query = $this->_view->getSelectSql(); -
    890        } -
    891 -
    892        $params = $this->convertEnums($params); -
    893 -
    894        if ($this->isLimitSubqueryUsed() && -
    895                $this->_conn->getAttribute(Doctrine::ATTR_DRIVER_NAME) !== 'mysql') { -
    896            $params = array_merge($params, $params); -
    897        } -
    898 -
    899        if ($this->_type !== self::SELECT) { -
    900            return $this->_conn->exec($query, $params); -
    901        } -
    902 -
    903        $stmt = $this->_conn->execute($query, $params); -
    904        return $stmt; -
    905    } -
    906 -
    907    /** -
    908     * execute -
    909     * executes the query and populates the data set -
    910     * -
    911     * @param string $params -
    912     * @return Doctrine_Collection            the root collection -
    913     */ -
    914    public function execute($params = array(), $hydrationMode = null) -
    915    { -
    916        $params = array_merge($this->_params['set'],  -
    917                              $this->_params['where'], -
    918                              $this->_params['having'],  -
    919                              $params); -
    920         -
    921        if ($this->_resultCache) { -
    922            $cacheDriver = $this->getResultCacheDriver(); -
    923 -
    924            $dql = $this->getDql(); -
    925            // calculate hash for dql query -
    926            $hash = md5($dql . var_export($params, true)); -
    927 -
    928            $cached = ($this->_expireResultCache) ? false : $cacheDriver->fetch($hash); -
    929 -
    930            if ($cached === false) { -
    931                // cache miss -
    932                $stmt = $this->_execute($params); -
    933                $this->_hydrator->setQueryComponents($this->_queryComponents); -
    934                $result = $this->_hydrator->hydrateResultSet($stmt, $this->_tableAliasMap, -
    935                        Doctrine::HYDRATE_ARRAY); -
    936 -
    937                $cached = $this->getCachedForm($result); -
    938                $cacheDriver->save($hash, $cached, $this->_resultCacheTTL); -
    939                return $result; -
    940            } else { -
    941                return $this->_constructQueryFromCache($cached); -
    942            } -
    943        } else { -
    944            $stmt = $this->_execute($params); -
    945 -
    946            if (is_integer($stmt)) { -
    947                return $stmt; -
    948            } -
    949             -
    950            $this->_hydrator->setQueryComponents($this->_queryComponents); -
    951            return $this->_hydrator->hydrateResultSet($stmt, $this->_tableAliasMap, $hydrationMode); -
    952        } -
    953    } -
    954     -
    955    /** -
    956     * Constructs the query from the cached form. -
    957     *  -
    958     * @param string  The cached query, in a serialized form. -
    959     * @return array  The custom component that was cached together with the essential -
    960     *                query data. This can be either a result set (result caching) -
    961     *                or an SQL query string (query caching). -
    962     */ -
    963    protected function _constructQueryFromCache($cached) -
    964    { -
    965        $cached = unserialize($cached); -
    966        $this->_tableAliasMap = $cached[2]; -
    967        $customComponent = $cached[0]; -
    968 -
    969        $queryComponents = array(); -
    970        $cachedComponents = $cached[1]; -
    971        foreach ($cachedComponents as $alias => $components) { -
    972            $e = explode('.', $components[0]); -
    973            if (count($e) === 1) { -
    974                $queryComponents[$alias]['table'] = $this->_conn->getTable($e[0]); -
    975            } else { -
    976                $queryComponents[$alias]['parent'] = $e[0]; -
    977                $queryComponents[$alias]['relation'] = $queryComponents[$e[0]]['table']->getRelation($e[1]); -
    978                $queryComponents[$alias]['table'] = $queryComponents[$alias]['relation']->getTable(); -
    979            } -
    980            if (isset($v[1])) { -
    981                $queryComponents[$alias]['agg'] = $components[1]; -
    982            } -
    983            if (isset($v[2])) { -
    984                $queryComponents[$alias]['map'] = $components[2]; -
    985            } -
    986        } -
    987        $this->_queryComponents = $queryComponents; -
    988         -
    989        return $customComponent; -
    990    } -
    991     -
    992    /** -
    993     * getCachedForm -
    994     * returns the cached form of this query for given resultSet -
    995     * -
    996     * @param array $resultSet -
    997     * @return string           serialized string representation of this query -
    998     */ -
    999    public function getCachedForm($customComponent = null) -
    1000    { -
    1001        $componentInfo = array(); -
    1002 -
    1003        foreach ($this->getQueryComponents() as $alias => $components) { -
    1004            if ( ! isset($components['parent'])) { -
    1005                $componentInfo[$alias][] = $components['table']->getComponentName(); -
    1006            } else { -
    1007                $componentInfo[$alias][] = $components['parent'] . '.' . $components['relation']->getAlias(); -
    1008            } -
    1009            if (isset($components['agg'])) { -
    1010                $componentInfo[$alias][] = $components['agg']; -
    1011            } -
    1012            if (isset($components['map'])) { -
    1013                $componentInfo[$alias][] = $components['map']; -
    1014            } -
    1015        } -
    1016         -
    1017        return serialize(array($customComponent, $componentInfo, $this->getTableAliasMap())); -
    1018    } -
    1019     -
    1020    /** -
    1021     * addSelect -
    1022     * adds fields to the SELECT part of the query -
    1023     * -
    1024     * @param string $select        Query SELECT part -
    1025     * @return Doctrine_Query -
    1026     */ -
    1027    public function addSelect($select) -
    1028    { -
    1029        return $this->_addDqlQueryPart('select', $select, true); -
    1030    } -
    1031     -
    1032    /**  -
    1033     * addTableAlias -
    1034     * adds an alias for table and associates it with given component alias -
    1035     * -
    1036     * @param string $componentAlias    the alias for the query component associated with given tableAlias -
    1037     * @param string $tableAlias        the table alias to be added -
    1038     * @return Doctrine_Hydrate -
    1039     * @deprecated -
    1040     */ -
    1041    public function addTableAlias($tableAlias, $componentAlias) -
    1042    { -
    1043        return $this->addSqlTableAlias($tableAlias, $componentAlias); -
    1044    } -
    1045     -
    1046    /**  -
    1047     * addSqlTableAlias -
    1048     * adds an SQL table alias and associates it a component alias -
    1049     * -
    1050     * @param string $componentAlias    the alias for the query component associated with given tableAlias -
    1051     * @param string $tableAlias        the table alias to be added -
    1052     * @return Doctrine_Query_Abstract -
    1053     */ -
    1054    public function addSqlTableAlias($sqlTableAlias, $componentAlias) -
    1055    { -
    1056        $this->_tableAliasMap[$sqlTableAlias] = $componentAlias; -
    1057        return $this; -
    1058    } -
    1059 -
    1060    /** -
    1061     * addFrom -
    1062     * adds fields to the FROM part of the query -
    1063     * -
    1064     * @param string $from        Query FROM part -
    1065     * @return Doctrine_Query -
    1066     */ -
    1067    public function addFrom($from) -
    1068    { -
    1069        return $this->_addDqlQueryPart('from', $from, true); -
    1070    } -
    1071 -
    1072    /** -
    1073     * addWhere -
    1074     * adds conditions to the WHERE part of the query -
    1075     * -
    1076     * @param string $where         Query WHERE part -
    1077     * @param mixed $params         an array of parameters or a simple scalar -
    1078     * @return Doctrine_Query -
    1079     */ -
    1080    public function addWhere($where, $params = array()) -
    1081    { -
    1082        if (is_array($params)) { -
    1083            $this->_params['where'] = array_merge($this->_params['where'], $params); -
    1084        } else { -
    1085            $this->_params['where'][] = $params; -
    1086        } -
    1087        return $this->_addDqlQueryPart('where', $where, true); -
    1088    } -
    1089 -
    1090    /** -
    1091     * whereIn -
    1092     * adds IN condition to the query WHERE part -
    1093     * -
    1094     * @param string $expr          the operand of the IN -
    1095     * @param mixed $params         an array of parameters or a simple scalar -
    1096     * @param boolean $not          whether or not to use NOT in front of IN -
    1097     * @return Doctrine_Query -
    1098     */ -
    1099    public function whereIn($expr, $params = array(), $not = false) -
    1100    { -
    1101        $params = (array) $params; -
    1102        $a = array(); -
    1103        foreach ($params as $k => $value) { -
    1104            if ($value instanceof Doctrine_Expression) { -
    1105                $value = $value->getSql(); -
    1106                unset($params[$k]); -
    1107            } else { -
    1108                $value = '?';           -
    1109            } -
    1110            $a[] = $value; -
    1111        } -
    1112 -
    1113        $this->_params['where'] = array_merge($this->_params['where'], $params); -
    1114 -
    1115        $where = $expr . ($not === true ? ' NOT ':'') . ' IN (' . implode(', ', $a) . ')'; -
    1116 -
    1117        return $this->_addDqlQueryPart('where', $where, true); -
    1118    } -
    1119 -
    1120    /** -
    1121     * whereNotIn -
    1122     * adds NOT IN condition to the query WHERE part -
    1123     * -
    1124     * @param string $expr          the operand of the NOT IN -
    1125     * @param mixed $params         an array of parameters or a simple scalar -
    1126     * @return Doctrine_Query -
    1127     */ -
    1128    public function whereNotIn($expr, $params = array()) -
    1129    { -
    1130        return $this->whereIn($expr, $params, true); -
    1131    }  -
    1132 -
    1133    /** -
    1134     * addGroupBy -
    1135     * adds fields to the GROUP BY part of the query -
    1136     * -
    1137     * @param string $groupby       Query GROUP BY part -
    1138     * @return Doctrine_Query -
    1139     */ -
    1140    public function addGroupBy($groupby) -
    1141    { -
    1142        return $this->_addDqlQueryPart('groupby', $groupby, true); -
    1143    } -
    1144 -
    1145    /** -
    1146     * addHaving -
    1147     * adds conditions to the HAVING part of the query -
    1148     * -
    1149     * @param string $having        Query HAVING part -
    1150     * @param mixed $params         an array of parameters or a simple scalar -
    1151     * @return Doctrine_Query -
    1152     */ -
    1153    public function addHaving($having, $params = array()) -
    1154    { -
    1155        if (is_array($params)) { -
    1156            $this->_params['having'] = array_merge($this->_params['having'], $params); -
    1157        } else { -
    1158            $this->_params['having'][] = $params; -
    1159        } -
    1160        return $this->_addDqlQueryPart('having', $having, true); -
    1161    } -
    1162 -
    1163    /** -
    1164     * addOrderBy -
    1165     * adds fields to the ORDER BY part of the query -
    1166     * -
    1167     * @param string $orderby       Query ORDER BY part -
    1168     * @return Doctrine_Query -
    1169     */ -
    1170    public function addOrderBy($orderby) -
    1171    { -
    1172        return $this->_addDqlQueryPart('orderby', $orderby, true); -
    1173    } -
    1174 -
    1175    /** -
    1176     * select -
    1177     * sets the SELECT part of the query -
    1178     * -
    1179     * @param string $select        Query SELECT part -
    1180     * @return Doctrine_Query -
    1181     */ -
    1182    public function select($select) -
    1183    { -
    1184        return $this->_addDqlQueryPart('select', $select); -
    1185    } -
    1186 -
    1187    /** -
    1188     * distinct -
    1189     * Makes the query SELECT DISTINCT. -
    1190     * -
    1191     * @param bool $flag            Whether or not the SELECT is DISTINCT (default true). -
    1192     * @return Doctrine_Query -
    1193     */ -
    1194    public function distinct($flag = true) -
    1195    {    -
    1196        $this->_sqlParts['distinct'] = (bool) $flag; -
    1197        return $this; -
    1198    } -
    1199 -
    1200    /** -
    1201     * forUpdate -
    1202     * Makes the query SELECT FOR UPDATE. -
    1203     * -
    1204     * @param bool $flag            Whether or not the SELECT is FOR UPDATE (default true). -
    1205     * @return Doctrine_Query -
    1206     */ -
    1207    public function forUpdate($flag = true) -
    1208    { -
    1209        $this->_sqlParts[self::FOR_UPDATE] = (bool) $flag; -
    1210        return $this; -
    1211    } -
    1212 -
    1213    /** -
    1214     * delete -
    1215     * sets the query type to DELETE -
    1216     * -
    1217     * @return Doctrine_Query -
    1218     */ -
    1219    public function delete() -
    1220    { -
    1221        $this->_type = self::DELETE; -
    1222        return $this; -
    1223    } -
    1224 -
    1225    /** -
    1226     * update -
    1227     * sets the UPDATE part of the query -
    1228     * -
    1229     * @param string $update        Query UPDATE part -
    1230     * @return Doctrine_Query -
    1231     */ -
    1232    public function update($update) -
    1233    { -
    1234        $this->_type = self::UPDATE; -
    1235        return $this->_addDqlQueryPart('from', $update); -
    1236    } -
    1237 -
    1238    /** -
    1239     * set -
    1240     * sets the SET part of the query -
    1241     * -
    1242     * @param string $update        Query UPDATE part -
    1243     * @return Doctrine_Query -
    1244     */ -
    1245    public function set($key, $value, $params = null) -
    1246    { -
    1247        if (is_array($key)) { -
    1248            foreach ($key as $k => $v) { -
    1249                $this->set($k, '?', array($v));                                -
    1250            } -
    1251            return $this; -
    1252        } else { -
    1253            if ($params !== null) { -
    1254                if (is_array($params)) { -
    1255                    $this->_params['set'] = array_merge($this->_params['set'], $params); -
    1256                } else { -
    1257                    $this->_params['set'][] = $params; -
    1258                } -
    1259            } -
    1260            return $this->_addDqlQueryPart('set', $key . ' = ' . $value, true); -
    1261        } -
    1262    } -
    1263 -
    1264    /** -
    1265     * from -
    1266     * sets the FROM part of the query -
    1267     * -
    1268     * @param string $from          Query FROM part -
    1269     * @return Doctrine_Query -
    1270     */ -
    1271    public function from($from) -
    1272    { -
    1273        return $this->_addDqlQueryPart('from', $from); -
    1274    } -
    1275 -
    1276    /** -
    1277     * innerJoin -
    1278     * appends an INNER JOIN to the FROM part of the query -
    1279     * -
    1280     * @param string $join         Query INNER JOIN -
    1281     * @return Doctrine_Query -
    1282     */ -
    1283    public function innerJoin($join) -
    1284    { -
    1285        return $this->_addDqlQueryPart('from', 'INNER JOIN ' . $join, true); -
    1286    } -
    1287 -
    1288    /** -
    1289     * leftJoin -
    1290     * appends a LEFT JOIN to the FROM part of the query -
    1291     * -
    1292     * @param string $join         Query LEFT JOIN -
    1293     * @return Doctrine_Query -
    1294     */ -
    1295    public function leftJoin($join) -
    1296    { -
    1297        return $this->_addDqlQueryPart('from', 'LEFT JOIN ' . $join, true); -
    1298    } -
    1299 -
    1300    /** -
    1301     * groupBy -
    1302     * sets the GROUP BY part of the query -
    1303     * -
    1304     * @param string $groupby      Query GROUP BY part -
    1305     * @return Doctrine_Query -
    1306     */ -
    1307    public function groupBy($groupby) -
    1308    { -
    1309        return $this->_addDqlQueryPart('groupby', $groupby); -
    1310    } -
    1311 -
    1312    /** -
    1313     * where -
    1314     * sets the WHERE part of the query -
    1315     * -
    1316     * @param string $join         Query WHERE part -
    1317     * @param mixed $params        an array of parameters or a simple scalar -
    1318     * @return Doctrine_Query -
    1319     */ -
    1320    public function where($where, $params = array()) -
    1321    { -
    1322        $this->_params['where'] = array(); -
    1323        if (is_array($params)) { -
    1324            $this->_params['where'] = $params; -
    1325        } else { -
    1326            $this->_params['where'][] = $params; -
    1327        } -
    1328 -
    1329        return $this->_addDqlQueryPart('where', $where); -
    1330    } -
    1331 -
    1332    /** -
    1333     * having -
    1334     * sets the HAVING part of the query -
    1335     * -
    1336     * @param string $having       Query HAVING part -
    1337     * @param mixed $params        an array of parameters or a simple scalar -
    1338     * @return Doctrine_Query -
    1339     */ -
    1340    public function having($having, $params = array()) -
    1341    { -
    1342        $this->_params['having'] = array(); -
    1343        if (is_array($params)) { -
    1344            $this->_params['having'] = $params; -
    1345        } else { -
    1346            $this->_params['having'][] = $params; -
    1347        } -
    1348         -
    1349        return $this->_addDqlQueryPart('having', $having); -
    1350    } -
    1351 -
    1352    /** -
    1353     * orderBy -
    1354     * sets the ORDER BY part of the query -
    1355     * -
    1356     * @param string $orderby      Query ORDER BY part -
    1357     * @return Doctrine_Query -
    1358     */ -
    1359    public function orderBy($orderby) -
    1360    { -
    1361        return $this->_addDqlQueryPart('orderby', $orderby); -
    1362    } -
    1363 -
    1364    /** -
    1365     * limit -
    1366     * sets the Query query limit -
    1367     * -
    1368     * @param integer $limit        limit to be used for limiting the query results -
    1369     * @return Doctrine_Query -
    1370     */ -
    1371    public function limit($limit) -
    1372    { -
    1373        return $this->_addDqlQueryPart('limit', $limit); -
    1374    } -
    1375 -
    1376    /** -
    1377     * offset -
    1378     * sets the Query query offset -
    1379     * -
    1380     * @param integer $offset       offset to be used for paginating the query -
    1381     * @return Doctrine_Query -
    1382     */ -
    1383    public function offset($offset) -
    1384    { -
    1385        return $this->_addDqlQueryPart('offset', $offset); -
    1386    } -
    1387     -
    1388    /** -
    1389     * getSql -
    1390     * shortcut for {@link getSqlQuery()}. -
    1391     * -
    1392     * @return string   sql query string -
    1393     */ -
    1394    public function getSql() -
    1395    { -
    1396        return $this->getSqlQuery(); -
    1397    } -
    1398     -
    1399    /** -
    1400     * clear -
    1401     * resets all the variables -
    1402     * -
    1403     * @return void -
    1404     */ -
    1405    protected function clear() -
    1406    { -
    1407        $this->_sqlParts = array( -
    1408                    'select'    => array(), -
    1409                    'distinct'  => false, -
    1410                    'forUpdate' => false, -
    1411                    'from'      => array(), -
    1412                    'set'       => array(), -
    1413                    'join'      => array(), -
    1414                    'where'     => array(), -
    1415                    'groupby'   => array(), -
    1416                    'having'    => array(), -
    1417                    'orderby'   => array(), -
    1418                    'limit'     => false, -
    1419                    'offset'    => false, -
    1420                    ); -
    1421    } -
    1422     -
    1423    public function setHydrationMode($hydrationMode) -
    1424    { -
    1425        $this->_hydrator->setHydrationMode($hydrationMode); -
    1426        return $this; -
    1427    } -
    1428     -
    1429    /** -
    1430     * @deprecated -
    1431     */ -
    1432    public function getAliasMap() -
    1433    { -
    1434        return $this->_queryComponents; -
    1435    } -
    1436     -
    1437    /** -
    1438     * Gets the components of this query. -
    1439     */ -
    1440    public function getQueryComponents() -
    1441    { -
    1442        return $this->_queryComponents; -
    1443    } -
    1444     -
    1445    /** -
    1446     * Return the SQL parts. -
    1447     * -
    1448     * @return array The parts -
    1449     * @deprecated -
    1450     */ -
    1451    public function getParts() -
    1452    { -
    1453        return $this->getSqlParts(); -
    1454    } -
    1455     -
    1456    /** -
    1457     * Return the SQL parts. -
    1458     * -
    1459     * @return array The parts -
    1460     */ -
    1461    public function getSqlParts() -
    1462    { -
    1463        return $this->_sqlParts; -
    1464    } -
    1465     -
    1466    /** -
    1467     * getType -
    1468     * -
    1469     * returns the type of this query object -
    1470     * by default the type is Doctrine_Query_Abstract::SELECT but if update() or delete() -
    1471     * are being called the type is Doctrine_Query_Abstract::UPDATE and Doctrine_Query_Abstract::DELETE, -
    1472     * respectively -
    1473     * -
    1474     * @see Doctrine_Query_Abstract::SELECT -
    1475     * @see Doctrine_Query_Abstract::UPDATE -
    1476     * @see Doctrine_Query_Abstract::DELETE -
    1477     * -
    1478     * @return integer      return the query type -
    1479     */ -
    1480    public function getType() -
    1481    { -
    1482        return $this->_type; -
    1483    } -
    1484     -
    1485    /** -
    1486     * useCache -
    1487     * -
    1488     * @param Doctrine_Cache_Interface|bool $driver      cache driver -
    1489     * @param integer $timeToLive                        how long the cache entry is valid -
    1490     * @return Doctrine_Hydrate         this object -
    1491     * @deprecated Use useResultCache() -
    1492     */ -
    1493    public function useCache($driver = true, $timeToLive = null) -
    1494    { -
    1495        return $this->useResultCache($driver, $timeToLive); -
    1496    } -
    1497     -
    1498    /** -
    1499     * useResultCache -
    1500     * -
    1501     * @param Doctrine_Cache_Interface|bool $driver      cache driver -
    1502     * @param integer $timeToLive                        how long the cache entry is valid -
    1503     * @return Doctrine_Hydrate         this object -
    1504     */ -
    1505    public function useResultCache($driver = true, $timeToLive = null) -
    1506    { -
    1507        if ($driver !== null && $driver !== true && ! ($driver instanceOf Doctrine_Cache_Interface)){ -
    1508            $msg = 'First argument should be instance of Doctrine_Cache_Interface or null.'; -
    1509            throw new Doctrine_Query_Exception($msg); -
    1510        } -
    1511        $this->_resultCache = $driver; -
    1512 -
    1513        return $this->setResultCacheLifeSpan($timeToLive); -
    1514    } -
    1515     -
    1516    /** -
    1517     * useQueryCache -
    1518     * -
    1519     * @param Doctrine_Cache_Interface|bool $driver      cache driver -
    1520     * @param integer $timeToLive                        how long the cache entry is valid -
    1521     * @return Doctrine_Hydrate         this object -
    1522     */ -
    1523    public function useQueryCache(Doctrine_Cache_Interface $driver, $timeToLive = null) -
    1524    { -
    1525        $this->_queryCache = $driver; -
    1526        return $this->setQueryCacheLifeSpan($timeToLive); -
    1527    } -
    1528     -
    1529    /** -
    1530     * expireCache -
    1531     * -
    1532     * @param boolean $expire       whether or not to force cache expiration -
    1533     * @return Doctrine_Hydrate     this object -
    1534     * @deprecated Use expireResultCache() -
    1535     */ -
    1536    public function expireCache($expire = true) -
    1537    { -
    1538        return $this->expireResultCache($expire); -
    1539    } -
    1540     -
    1541    /** -
    1542     * expireCache -
    1543     * -
    1544     * @param boolean $expire       whether or not to force cache expiration -
    1545     * @return Doctrine_Hydrate     this object -
    1546     */ -
    1547    public function expireResultCache($expire = true) -
    1548    { -
    1549        $this->_expireResultCache = true; -
    1550        return $this; -
    1551    } -
    1552     -
    1553    /** -
    1554     * expireQueryCache -
    1555     * -
    1556     * @param boolean $expire       whether or not to force cache expiration -
    1557     * @return Doctrine_Hydrate     this object -
    1558     */ -
    1559    public function expireQueryCache($expire = true) -
    1560    { -
    1561        $this->_expireQueryCache = true; -
    1562        return $this; -
    1563    } -
    1564     -
    1565    /** -
    1566     * setCacheLifeSpan -
    1567     * -
    1568     * @param integer $timeToLive   how long the cache entry is valid -
    1569     * @return Doctrine_Hydrate     this object -
    1570     * @deprecated Use setResultCacheLifeSpan() -
    1571     */ -
    1572    public function setCacheLifeSpan($timeToLive) -
    1573    { -
    1574        return $this->setResultCacheLifeSpan($timeToLive); -
    1575    } -
    1576     -
    1577    /** -
    1578     * setResultCacheLifeSpan -
    1579     * -
    1580     * @param integer $timeToLive   how long the cache entry is valid -
    1581     * @return Doctrine_Hydrate     this object -
    1582     */ -
    1583    public function setResultCacheLifeSpan($timeToLive) -
    1584    { -
    1585        if ($timeToLive !== null) { -
    1586            $timeToLive = (int) $timeToLive; -
    1587        } -
    1588        $this->_resultCacheTTL = $timeToLive; -
    1589 -
    1590        return $this; -
    1591    } -
    1592     -
    1593    /** -
    1594     * setQueryCacheLifeSpan -
    1595     * -
    1596     * @param integer $timeToLive   how long the cache entry is valid -
    1597     * @return Doctrine_Hydrate     this object -
    1598     */ -
    1599    public function setQueryCacheLifeSpan($timeToLive) -
    1600    { -
    1601        if ($timeToLive !== null) { -
    1602            $timeToLive = (int) $timeToLive; -
    1603        } -
    1604        $this->_queryCacheTTL = $timeToLive; -
    1605 -
    1606        return $this; -
    1607    } -
    1608     -
    1609    /** -
    1610     * getCacheDriver -
    1611     * returns the cache driver associated with this object -
    1612     * -
    1613     * @return Doctrine_Cache_Interface|boolean|null    cache driver -
    1614     * @deprecated Use getResultCacheDriver() -
    1615     */ -
    1616    public function getCacheDriver() -
    1617    { -
    1618        return $this->getResultCacheDriver(); -
    1619    } -
    1620     -
    1621    /** -
    1622     * getResultCacheDriver -
    1623     * returns the cache driver used for caching result sets -
    1624     * -
    1625     * @return Doctrine_Cache_Interface|boolean|null    cache driver -
    1626     */ -
    1627    public function getResultCacheDriver() -
    1628    { -
    1629        if ($this->_resultCache instanceof Doctrine_Cache_Interface) { -
    1630            return $this->_resultCache; -
    1631        } else { -
    1632            return $this->_conn->getResultCacheDriver(); -
    1633        } -
    1634    } -
    1635     -
    1636    /** -
    1637     * getQueryCacheDriver -
    1638     * returns the cache driver used for caching queries -
    1639     * -
    1640     * @return Doctrine_Cache_Interface|boolean|null    cache driver -
    1641     */ -
    1642    public function getQueryCacheDriver() -
    1643    { -
    1644        if ($this->_queryCache instanceof Doctrine_Cache_Interface) { -
    1645            return $this->_queryCache; -
    1646        } else { -
    1647            return $this->_conn->getQueryCacheDriver(); -
    1648        } -
    1649    } -
    1650     -
    1651    /** -
    1652     * getConnection -
    1653     * -
    1654     * @return Doctrine_Connection -
    1655     */ -
    1656    public function getConnection() -
    1657    { -
    1658        return $this->_conn; -
    1659    } -
    1660     -
    1661    /**  -
    1662     * Adds a DQL part to the internal parts collection. -
    1663     *  -
    1664     * @param string $queryPartName  The name of the query part. -
    1665     * @param string $queryPart      The actual query part to add. -
    1666     * @param boolean $append        Whether to append $queryPart to already existing -
    1667     *                               parts under the same $queryPartName. Defaults to FALSE -
    1668     *                               (previously added parts with the same name get overridden). -
    1669     */ -
    1670    protected function _addDqlQueryPart($queryPartName, $queryPart, $append = false) -
    1671    { -
    1672        if ($append) { -
    1673            $this->_dqlParts[$queryPartName][] = $queryPart; -
    1674        } else { -
    1675            $this->_dqlParts[$queryPartName] = array($queryPart); -
    1676        } -
    1677         -
    1678        $this->_state = Doctrine_Query::STATE_DIRTY; -
    1679        return $this;      -
    1680    } -
    1681     -
    1682    /** -
    1683     * _processDqlQueryPart -
    1684     * parses given query part -
    1685     * -
    1686     * @param string $queryPartName     the name of the query part -
    1687     * @param array $queryParts         an array containing the query part data -
    1688     * @return Doctrine_Query           this object -
    1689     * @todo Better description. "parses given query part" ??? Then wheres the difference -
    1690     *       between process/parseQueryPart? I suppose this does something different. -
    1691     */ -
    1692    protected function _processDqlQueryPart($queryPartName, $queryParts) -
    1693    { -
    1694        $this->removeSqlQueryPart($queryPartName); -
    1695 -
    1696        if (is_array($queryParts) && ! empty($queryParts)) { -
    1697            foreach ($queryParts as $queryPart) { -
    1698                $parser = $this->_getParser($queryPartName); -
    1699                $sql = $parser->parse($queryPart); -
    1700                if (isset($sql)) { -
    1701                    if ($queryPartName == 'limit' || $queryPartName == 'offset') { -
    1702                        $this->setSqlQueryPart($queryPartName, $sql); -
    1703                    } else { -
    1704                        $this->addSqlQueryPart($queryPartName, $sql); -
    1705                    } -
    1706                } -
    1707            } -
    1708        } -
    1709    } -
    1710     -
    1711    /** -
    1712     * _getParser -
    1713     * parser lazy-loader -
    1714     * -
    1715     * @throws Doctrine_Query_Exception     if unknown parser name given -
    1716     * @return Doctrine_Query_Part -
    1717     * @todo Doc/Description: What is the parameter for? Which parsers are available? -
    1718     */ -
    1719    protected function _getParser($name) -
    1720    { -
    1721        if ( ! isset($this->_parsers[$name])) { -
    1722            $class = 'Doctrine_Query_' . ucwords(strtolower($name)); -
    1723 -
    1724            Doctrine::autoload($class); -
    1725 -
    1726            if ( ! class_exists($class)) { -
    1727                throw new Doctrine_Query_Exception('Unknown parser ' . $name); -
    1728            } -
    1729 -
    1730            $this->_parsers[$name] = new $class($this, $this->_tokenizer); -
    1731        } -
    1732 -
    1733        return $this->_parsers[$name]; -
    1734    } -
    1735     -
    1736    /** -
    1737     * Gets the SQL query that corresponds to this query object. -
    1738     * The returned SQL syntax depends on the connection driver that is used  -
    1739     * by this query object at the time of this method call. -
    1740     * -
    1741     * @param array $params -
    1742     */ -
    1743    abstract public function getSqlQuery($params = array()); -
    1744     -
    1745    /** -
    1746     * parseDqlQuery -
    1747     * parses a dql query -
    1748     * -
    1749     * @param string $query         query to be parsed -
    1750     * @return Doctrine_Query_Abstract  this object -
    1751     */ -
    1752    abstract public function parseDqlQuery($query); -
    1753     -
    1754    /** -
    1755     * @deprecated -
    1756     */ -
    1757    public function parseQuery($query) -
    1758    { -
    1759        return $this->parseDqlQuery($query); -
    1760    } -
    1761     -
    1762    /** -
    1763     * @deprecated -
    1764     */ -
    1765    public function getQuery($params = array()) -
    1766    { -
    1767        return $this->getSqlQuery($params); -
    1768    } -
    1769} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Check.html b/tests_old/coverage/Doctrine_Query_Check.html deleted file mode 100644 index c4ef0a88d..000000000 --- a/tests_old/coverage/Doctrine_Query_Check.html +++ /dev/null @@ -1,518 +0,0 @@ - - - Coverage for Doctrine_Query_Check - - -

    Coverage for Doctrine_Query_Check

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: From.php 1080 2007-02-10 18:17:08Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Query_Check -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1080 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Check -
    34{ -
    35    /** -
    36     * @var Doctrine_Table $table           Doctrine_Table object -
    37     */ -
    38    protected $table; -
    39 -
    40    /** -
    41     * @var string $sql                     database specific sql CHECK constraint definition  -
    42     *                                      parsed from the given dql CHECK definition -
    43     */ -
    44    protected $sql; -
    45     -
    46    protected $_tokenizer; -
    47 -
    48    /** -
    49     * @param Doctrine_Table|string $table  Doctrine_Table object -
    50     */ -
    51    public function __construct($table) -
    52    { -
    53        if ( ! ($table instanceof Doctrine_Table)) { -
    54            $table = Doctrine_Manager::getInstance() -
    55                        ->getCurrentConnection() -
    56                        ->getTable($table); -
    57        } -
    58        $this->table = $table; -
    59        $this->_tokenizer = new Doctrine_Query_Tokenizer(); -
    60    } -
    61 -
    62    /** -
    63     * getTable -
    64     * returns the table object associated with this object -
    65     * -
    66     * @return Doctrine_Connection -
    67     */ -
    68    public function getTable() -
    69    { -
    70        return $this->table; -
    71    } -
    72 -
    73    /** -
    74     * parse -
    75     * -
    76     * @param string $dql       DQL CHECK constraint definition -
    77     * @return string -
    78     */ -
    79    public function parse($dql) -
    80    { -
    81        $this->sql = $this->parseClause($dql); -
    82    } -
    83 -
    84    /** -
    85     * parseClause -
    86     * -
    87     * @param string $alias     component alias -
    88     * @param string $field     the field name -
    89     * @param mixed $value      the value of the field -
    90     * @return void -
    91     */ -
    92    public function parseClause($dql) -
    93    { -
    94        $parts = $this->_tokenizer->sqlExplode($dql, ' AND '); -
    95 -
    96        if (count($parts) > 1) { -
    97            $ret = array(); -
    98            foreach ($parts as $part) { -
    99                $ret[] = $this->parseSingle($part); -
    100            } -
    101 -
    102            $r = implode(' AND ', $ret); -
    103        } else { -
    104            $parts = $this->_tokenizer->quoteExplode($dql, ' OR '); -
    105            if (count($parts) > 1) { -
    106                $ret = array(); -
    107                foreach ($parts as $part) { -
    108                    $ret[] = $this->parseClause($part); -
    109                } -
    110 -
    111                $r = implode(' OR ', $ret); -
    112            } else { -
    113                $ret = $this->parseSingle($dql); -
    114                return $ret; -
    115            } -
    116        } -
    117        return '(' . $r . ')'; -
    118    } -
    119     -
    120    public function parseSingle($part) -
    121    { -
    122        $e = explode(' ', $part); -
    123         -
    124        $e[0] = $this->parseFunction($e[0]); -
    125 -
    126        switch ($e[1]) { -
    127            case '>': -
    128            case '<': -
    129            case '=': -
    130            case '!=': -
    131            case '<>': -
    132 -
    133            break; -
    134            default: -
    135                throw new Doctrine_Query_Exception('Unknown operator ' . $e[1]); -
    136        } -
    137 -
    138        return implode(' ', $e); -
    139    } -
    140    public function parseFunction($dql)  -
    141    { -
    142        if (($pos = strpos($dql, '(')) !== false) { -
    143            $func  = substr($dql, 0, $pos); -
    144            $value = substr($dql, ($pos + 1), -1); -
    145             -
    146            $expr  = $this->table->getConnection()->expression; -
    147 -
    148            if ( ! method_exists($expr, $func)) { -
    149                throw new Doctrine_Query_Exception('Unknown function ' . $func); -
    150            } -
    151             -
    152            $func  = $expr->$func($value); -
    153        } -
    154        return $func; -
    155    } -
    156 -
    157    /** -
    158     * getSql -
    159     * -
    160     * returns database specific sql CHECK constraint definition -
    161     * parsed from the given dql CHECK definition -
    162     * -
    163     * @return string -
    164     */ -
    165    public function getSql() -
    166    { -
    167        return $this->sql; -
    168    } -
    169}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Condition.html b/tests_old/coverage/Doctrine_Query_Condition.html deleted file mode 100644 index 2d8696439..000000000 --- a/tests_old/coverage/Doctrine_Query_Condition.html +++ /dev/null @@ -1,348 +0,0 @@ - - - Coverage for Doctrine_Query_Condition - - -

    Coverage for Doctrine_Query_Condition

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Condition.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Part'); -
    22/** -
    23 * Doctrine_Query_Condition -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33abstract class Doctrine_Query_Condition extends Doctrine_Query_Part -
    34{ -
    35    /** -
    36     * DQL CONDITION PARSER -
    37     * parses the join condition/where/having part of the query string -
    38     * -
    39     * @param string $str -
    40     * @return string -
    41     */ -
    42    public function parse($str) -
    43    { -
    44        $tmp = trim($str); -
    45 -
    46        $parts = $this->_tokenizer->bracketExplode($str, array(' \&\& ', ' AND '), '(', ')'); -
    47 -
    48        if (count($parts) > 1) { -
    49            $ret = array(); -
    50            foreach ($parts as $part) { -
    51                $part = $this->_tokenizer->bracketTrim($part, '(', ')'); -
    52                $ret[] = $this->parse($part); -
    53            } -
    54            $r = implode(' AND ', $ret); -
    55        } else { -
    56 -
    57            $parts = $this->_tokenizer->bracketExplode($str, array(' \|\| ', ' OR '), '(', ')'); -
    58            if (count($parts) > 1) { -
    59                $ret = array(); -
    60                foreach ($parts as $part) { -
    61                    $part = $this->_tokenizer->bracketTrim($part, '(', ')'); -
    62                    $ret[] = $this->parse($part); -
    63                } -
    64                $r = implode(' OR ', $ret); -
    65            } else { -
    66                if (substr($parts[0],0,1) == '(' && substr($parts[0], -1) == ')') { -
    67                    return $this->parse(substr($parts[0], 1, -1)); -
    68                } else { -
    69                    return $this->load($parts[0]); -
    70                } -
    71            } -
    72        } -
    73 -
    74        return '(' . $r . ')'; -
    75    } -
    76 -
    77 -
    78 -
    79    /** -
    80     * parses a literal value and returns the parsed value -
    81     * -
    82     * boolean literals are parsed to integers -
    83     * components are parsed to associated table aliases -
    84     * -
    85     * @param string $value         literal value to be parsed -
    86     * @return string -
    87     */ -
    88    public function parseLiteralValue($value) -
    89    { -
    90        // check that value isn't a string -
    91        if (strpos($value, '\'') === false) { -
    92            // parse booleans -
    93            $value = $this->query->getConnection() -
    94                     ->dataDict->parseBoolean($value); -
    95 -
    96            $a = explode('.', $value); -
    97 -
    98            if (count($a) > 1) { -
    99            // either a float or a component.. -
    100 -
    101                if ( ! is_numeric($a[0])) { -
    102                    // a component found -
    103                    $value = $this->query->getTableAlias($a[0]). '.' . $a[1]; -
    104                } -
    105            } -
    106        } else { -
    107            // string literal found -
    108        } -
    109 -
    110        return $value; -
    111    } -
    112} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Exception.html b/tests_old/coverage/Doctrine_Query_Exception.html deleted file mode 100644 index a84e296fb..000000000 --- a/tests_old/coverage/Doctrine_Query_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Query_Exception - - -

    Coverage for Doctrine_Query_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Query_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_From.html b/tests_old/coverage/Doctrine_Query_From.html deleted file mode 100644 index 4dae572d4..000000000 --- a/tests_old/coverage/Doctrine_Query_From.html +++ /dev/null @@ -1,278 +0,0 @@ - - - Coverage for Doctrine_Query_From - - -

    Coverage for Doctrine_Query_From

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: From.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload("Doctrine_Query_Part"); -
    22/** -
    23 * Doctrine_Query_From -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_From extends Doctrine_Query_Part -
    34{ -
    35    /** -
    36     * DQL FROM PARSER -
    37     * parses the FROM part of the query string -
    38     * -
    39     * @param string $str -
    40     * @return void -
    41     */ -
    42    public function parse($str) -
    43    {         -
    44        $str = trim($str); -
    45        $parts = $this->_tokenizer->bracketExplode($str, 'JOIN'); -
    46 -
    47        $operator = false; -
    48 -
    49        switch (trim($parts[0])) { -
    50            case 'INNER': -
    51                $operator = ':'; -
    52            case 'LEFT': -
    53                array_shift($parts); -
    54            break; -
    55        } -
    56 -
    57        $last = ''; -
    58 -
    59        foreach ($parts as $k => $part) { -
    60            $part = trim($part); -
    61 -
    62            if (empty($part)) { -
    63                continue; -
    64            } -
    65 -
    66            $e = explode(' ', $part); -
    67 -
    68            if (end($e) == 'INNER' || end($e) == 'LEFT') { -
    69                $last = array_pop($e); -
    70            } -
    71            $part = implode(' ', $e); -
    72 -
    73            foreach ($this->_tokenizer->bracketExplode($part, ',') as $reference) { -
    74                $reference = trim($reference); -
    75                $e = explode(' ', $reference); -
    76                $e2 = explode('.', $e[0]); -
    77 -
    78                if ($operator) { -
    79                    $e[0] = array_shift($e2) . $operator . implode('.', $e2); -
    80                } -
    81                 -
    82                $table = $this->query->load(implode(' ', $e)); -
    83            } -
    84 -
    85            $operator = ($last == 'INNER') ? ':' : '.'; -
    86        } -
    87        return null; -
    88    } -
    89}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Groupby.html b/tests_old/coverage/Doctrine_Query_Groupby.html deleted file mode 100644 index 7e559e794..000000000 --- a/tests_old/coverage/Doctrine_Query_Groupby.html +++ /dev/null @@ -1,207 +0,0 @@ - - - Coverage for Doctrine_Query_Groupby - - -

    Coverage for Doctrine_Query_Groupby

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Groupby.php 3041 2007-10-30 19:10:18Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Part'); -
    22/** -
    23 * Doctrine_Query_Groupby -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3041 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Groupby extends Doctrine_Query_Part -
    34{ -
    35    /** -
    36     * DQL GROUP BY PARSER -
    37     * parses the group by part of the query string -
    38     * -
    39     * @param string $str -
    40     * @return void -
    41     */ -
    42    public function parse($str, $append = false) -
    43    { -
    44        $r = array(); -
    45        foreach (explode(',', $str) as $reference) { -
    46            $reference = trim($reference); -
    47             -
    48            /** -
    49            if (count($e) > 1) { -
    50                $field = array_pop($e); -
    51                $ref   = implode('.', $e); -
    52                $this->query->load($ref); -
    53 -
    54                $r[] = $this->query->getTableAlias($ref) . '.' . $field; -
    55            } else { -
    56                $alias = end($e); -
    57 -
    58                $r[] = $this->query->getAggregateAlias($alias); -
    59            } -
    60            */ -
    61            $r[] = $this->query->parseClause($reference); -
    62        } -
    63        return implode(', ', $r); -
    64    } -
    65} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Having.html b/tests_old/coverage/Doctrine_Query_Having.html deleted file mode 100644 index 44b37d0f1..000000000 --- a/tests_old/coverage/Doctrine_Query_Having.html +++ /dev/null @@ -1,306 +0,0 @@ - - - Coverage for Doctrine_Query_Having - - -

    Coverage for Doctrine_Query_Having

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Having.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Condition'); -
    22/** -
    23 * Doctrine_Query_Having -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Having extends Doctrine_Query_Condition -
    34{ -
    35    /** -
    36     * DQL Aggregate Function parser -
    37     * -
    38     * @param string $func -
    39     * @return mixed -
    40     */ -
    41    private function parseAggregateFunction($func) -
    42    { -
    43        $pos = strpos($func, '('); -
    44 -
    45        if ($pos !== false) { -
    46            $funcs  = array(); -
    47 -
    48            $name   = substr($func, 0, $pos); -
    49            $func   = substr($func, ($pos + 1), -1); -
    50            $params = $this->_tokenizer->bracketExplode($func, ',', '(', ')'); -
    51 -
    52            foreach ($params as $k => $param) { -
    53                $params[$k] = $this->parseAggregateFunction($param); -
    54            } -
    55 -
    56            $funcs = $name . '(' . implode(', ', $params) . ')'; -
    57 -
    58            return $funcs; -
    59 -
    60        } else { -
    61            if ( ! is_numeric($func)) { -
    62                $a = explode('.', $func); -
    63 -
    64                if (count($a) > 1) { -
    65                    $field     = array_pop($a); -
    66                    $reference = implode('.', $a); -
    67                    $map       = $this->query->load($reference, false); -
    68                    $field     = $map['table']->getColumnName($field); -
    69                    $func      = $this->query->getTableAlias($reference) . '.' . $field; -
    70                } else { -
    71                    $field = end($a); -
    72                    $func  = $this->query->getAggregateAlias($field); -
    73                } -
    74                return $func; -
    75            } else { -
    76                return $func; -
    77            } -
    78        } -
    79    } -
    80 -
    81 -
    82    /** -
    83     * load -
    84     * returns the parsed query part -
    85     * -
    86     * @param string $having -
    87     * @return string -
    88     */ -
    89    final public function load($having) -
    90    { -
    91        $tokens = $this->_tokenizer->bracketExplode($having, ' ', '(', ')'); -
    92        $part = $this->parseAggregateFunction(array_shift($tokens)); -
    93        $operator  = array_shift($tokens); -
    94        $value     = implode(' ', $tokens); -
    95        $part .= ' ' . $operator . ' ' . $value; -
    96        return $part; -
    97    } -
    98} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_JoinCondition.html b/tests_old/coverage/Doctrine_Query_JoinCondition.html deleted file mode 100644 index 22abebeff..000000000 --- a/tests_old/coverage/Doctrine_Query_JoinCondition.html +++ /dev/null @@ -1,323 +0,0 @@ - - - Coverage for Doctrine_Query_JoinCondition - - -

    Coverage for Doctrine_Query_JoinCondition

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: JoinCondition.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Part'); -
    22/** -
    23 * Doctrine_Query_JoinCondition -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_JoinCondition extends Doctrine_Query_Condition  -
    34{ -
    35    public function load($condition)  -
    36    { -
    37        $condition = trim($condition); -
    38 -
    39        $e = $this->_tokenizer->sqlExplode($condition); -
    40 -
    41        if (count($e) > 2) { -
    42            $a         = explode('.', $e[0]); -
    43            $field     = array_pop($a); -
    44            $reference = implode('.', $a); -
    45            $operator  = $e[1]; -
    46            $value     = $e[2]; -
    47 -
    48            $alias     = $this->query->getTableAlias($reference); -
    49            $map       = $this->query->getAliasDeclaration($reference); -
    50            $table     = $map['table']; -
    51            // check if value is enumerated value -
    52            $enumIndex = $table->enumIndex($field, trim($value, "'")); -
    53 -
    54 -
    55            if (substr($value, 0, 1) == '(') { -
    56                // trim brackets -
    57                $trimmed   = $this->_tokenizer->bracketTrim($value); -
    58 -
    59                if (substr($trimmed, 0, 4) == 'FROM' || substr($trimmed, 0, 6) == 'SELECT') { -
    60                    // subquery found -
    61                    $q = $this->query->createSubquery(); -
    62                    $value = '(' . $q->parseQuery($trimmed)->getQuery() . ')'; -
    63                } elseif (substr($trimmed, 0, 4) == 'SQL:') { -
    64                    $value = '(' . substr($trimmed, 4) . ')'; -
    65                } else { -
    66                    // simple in expression found -
    67                    $e     = $this->_tokenizer->sqlExplode($trimmed, ','); -
    68 -
    69                    $value = array(); -
    70                    foreach ($e as $part) { -
    71                        $index   = $table->enumIndex($field, trim($part, "'")); -
    72                        if ($index !== false) { -
    73                            $value[] = $index; -
    74                        } else { -
    75                            $value[] = $this->parseLiteralValue($part); -
    76                        } -
    77                    } -
    78                    $value = '(' . implode(', ', $value) . ')'; -
    79                } -
    80            } else { -
    81                if ($enumIndex !== false) { -
    82                    $value = $enumIndex; -
    83                } else { -
    84                    $value = $this->parseLiteralValue($value); -
    85                } -
    86            } -
    87 -
    88            switch ($operator) { -
    89                case '<': -
    90                case '>': -
    91                case '=': -
    92                case '!=': -
    93                    if ($enumIndex !== false) { -
    94                        $value  = $enumIndex; -
    95                    } -
    96                default: -
    97                    $condition  = $alias . '.' . $field . ' ' -
    98                                . $operator . ' ' . $value; -
    99            } -
    100 -
    101        } -
    102        return $condition; -
    103    } -
    104}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Limit.html b/tests_old/coverage/Doctrine_Query_Limit.html deleted file mode 100644 index 0e50b65df..000000000 --- a/tests_old/coverage/Doctrine_Query_Limit.html +++ /dev/null @@ -1,128 +0,0 @@ - - - Coverage for Doctrine_Query_Limit - - -

    Coverage for Doctrine_Query_Limit

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Where.php 1352 2007-05-15 10:07:05Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Query_Limit -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1352 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Limit extends Doctrine_Query_Part -
    34{ -
    35    public function parse($limit)  -
    36    { -
    37        return (int) $limit; -
    38    } -
    39}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Offset.html b/tests_old/coverage/Doctrine_Query_Offset.html deleted file mode 100644 index 07994616c..000000000 --- a/tests_old/coverage/Doctrine_Query_Offset.html +++ /dev/null @@ -1,128 +0,0 @@ - - - Coverage for Doctrine_Query_Offset - - -

    Coverage for Doctrine_Query_Offset

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Where.php 1352 2007-05-15 10:07:05Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Query_Offset -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1352 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Offset extends Doctrine_Query_Part -
    34{ -
    35    public function parse($offset) -
    36    { -
    37        return (int) $offset; -
    38    } -
    39}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Orderby.html b/tests_old/coverage/Doctrine_Query_Orderby.html deleted file mode 100644 index affd99034..000000000 --- a/tests_old/coverage/Doctrine_Query_Orderby.html +++ /dev/null @@ -1,171 +0,0 @@ - - - Coverage for Doctrine_Query_Orderby - - -

    Coverage for Doctrine_Query_Orderby

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Orderby.php 3041 2007-10-30 19:10:18Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Part'); -
    22/** -
    23 * Doctrine_Query_Orderby -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3041 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Orderby extends Doctrine_Query_Part -
    34{ -
    35    /** -
    36     * DQL ORDER BY PARSER -
    37     * parses the order by part of the query string -
    38     * -
    39     * @param string $str -
    40     * @return void -
    41     */ -
    42    public function parse($str, $append = false) -
    43    { -
    44        $ret = array(); -
    45 -
    46        foreach (explode(',', trim($str)) as $r) { -
    47            $r = $this->query->parseClause($r); -
    48 -
    49            $ret[] = $r; -
    50        } -
    51        return $ret; -
    52    } -
    53} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Part.html b/tests_old/coverage/Doctrine_Query_Part.html deleted file mode 100644 index a7311b4cd..000000000 --- a/tests_old/coverage/Doctrine_Query_Part.html +++ /dev/null @@ -1,195 +0,0 @@ - - - Coverage for Doctrine_Query_Part - - -

    Coverage for Doctrine_Query_Part

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Part.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Query_Part -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33abstract class Doctrine_Query_Part -
    34{ -
    35    /** -
    36     * @var Doctrine_Query $query           the query object associated with this parser -
    37     */ -
    38    protected $query; -
    39     -
    40    protected $_tokenizer; -
    41 -
    42    /** -
    43     * @param Doctrine_Query $query         the query object associated with this parser -
    44     */ -
    45    public function __construct($query, Doctrine_Query_Tokenizer $tokenizer = null) -
    46    { -
    47        $this->query = $query; -
    48        if ( ! $tokenizer) { -
    49            $tokenizer = new Doctrine_Query_Tokenizer(); -
    50        } -
    51        $this->_tokenizer = $tokenizer; -
    52    } -
    53 -
    54    /** -
    55     * @return Doctrine_Query $query        the query object associated with this parser -
    56     */ -
    57    public function getQuery() -
    58    { -
    59        return $this->query; -
    60    } -
    61} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Registry.html b/tests_old/coverage/Doctrine_Query_Registry.html deleted file mode 100644 index 9ca0fe93c..000000000 --- a/tests_old/coverage/Doctrine_Query_Registry.html +++ /dev/null @@ -1,221 +0,0 @@ - - - Coverage for Doctrine_Query_Registry - - -

    Coverage for Doctrine_Query_Registry

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Query_Registry -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 */ -
    33class Doctrine_Query_Registry -
    34{ -
    35    protected $_queries = array(); -
    36 -
    37    public function add($key, $query) -
    38    { -
    39     if (strpos($key, '/') === false) { -
    40            $this->_queries[$key] = $query; -
    41        } else { -
    42            // namespace found -
    43             -
    44            $e = explode('/', $key); -
    45 -
    46            $this->_queries[$e[0]][$e[1]] = $query; -
    47        } -
    48    } -
    49     -
    50    public function get($key, $namespace = null) -
    51    { -
    52        if (isset($namespace)) { -
    53            if ( ! isset($this->_queries[$namespace][$key])) { -
    54                throw new Doctrine_Query_Registry_Exception('A query with the name ' . $namespace . '/' . $key . ' does not exist.'); -
    55            } -
    56            $query = $this->_queries[$namespace][$key]; -
    57        } else { -
    58            if ( ! isset($this->_queries[$key])) { -
    59                throw new Doctrine_Query_Registry_Exception('A query with the name ' . $key . ' does not exist.'); -
    60            } -
    61            $query = $this->_queries[$key]; -
    62        } -
    63         -
    64        if ( ! ($query instanceof Doctrine_Query)) { -
    65            $query = Doctrine_Query::create()->parseQuery($query); -
    66        } -
    67         -
    68        return $query; -
    69    } -
    70}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Select.html b/tests_old/coverage/Doctrine_Query_Select.html deleted file mode 100644 index 6aa360c84..000000000 --- a/tests_old/coverage/Doctrine_Query_Select.html +++ /dev/null @@ -1,128 +0,0 @@ - - - Coverage for Doctrine_Query_Select - - -

    Coverage for Doctrine_Query_Select

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: From.php 1080 2007-02-10 18:17:08Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload("Doctrine_Query_Part"); -
    22/** -
    23 * Doctrine_Query_Select -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1080 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Select extends Doctrine_Query_Part -
    34{ -
    35    public function parse($dql)  -
    36    { -
    37        $this->query->parseSelect($dql); -
    38    } -
    39}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Set.html b/tests_old/coverage/Doctrine_Query_Set.html deleted file mode 100644 index 506605659..000000000 --- a/tests_old/coverage/Doctrine_Query_Set.html +++ /dev/null @@ -1,191 +0,0 @@ - - - Coverage for Doctrine_Query_Set - - -

    Coverage for Doctrine_Query_Set

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Set.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Part'); -
    22/** -
    23 * Doctrine_Query -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Set extends Doctrine_Query_Part -
    34{ -
    35    public function parse($dql) -
    36    { -
    37     $terms = $this->_tokenizer->sqlExplode($dql, ' '); -
    38     -
    39     foreach ($terms as $term) { -
    40 -
    41            preg_match_all("/[a-z0-9_]+\.[a-z0-9_]+[\.[a-z0-9]+]*/i", $term, $m); -
    42     -
    43            if (isset($m[0])) { -
    44                foreach ($m[0] as $part) { -
    45                    $e   = explode('.', trim($part)); -
    46                    $field = array_pop($e); -
    47         -
    48                    $reference = implode('.', $e); -
    49         -
    50                    $alias = $this->query->getTableAlias($reference); -
    51                    $map   = $this->query->getAliasDeclaration($reference); -
    52         -
    53                    $dql = str_replace($part, $map['table']->getColumnName($field), $dql); -
    54                } -
    55            } -
    56        } -
    57 -
    58        return $dql; -
    59    } -
    60}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Tokenizer.html b/tests_old/coverage/Doctrine_Query_Tokenizer.html deleted file mode 100644 index e33c3c661..000000000 --- a/tests_old/coverage/Doctrine_Query_Tokenizer.html +++ /dev/null @@ -1,1163 +0,0 @@ - - - Coverage for Doctrine_Query_Tokenizer - - -

    Coverage for Doctrine_Query_Tokenizer

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Query_Tokenizer -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @todo Give the tokenizer state, make it better work together with Doctrine_Query and maybe -
    32 *       take out commonly used string manipulation methods -
    33 *       into a stateless StringUtil? class. This tokenizer should be concerned with tokenizing -
    34 *       DQL strings. -
    35 */ -
    36class Doctrine_Query_Tokenizer  -
    37{ -
    38     -
    39    /** -
    40     * tokenizeQuery -
    41     * splits the given dql query into an array where keys -
    42     * represent different query part names and values are -
    43     * arrays splitted using sqlExplode method -
    44     * -
    45     * example: -
    46     * -
    47     * parameter: -
    48     *      $query = "SELECT u.* FROM User u WHERE u.name LIKE ?" -
    49     * returns: -
    50     *      array('select' => array('u.*'), -
    51     *            'from'   => array('User', 'u'), -
    52     *            'where'  => array('u.name', 'LIKE', '?')) -
    53     * -
    54     * @param string $query                 DQL query -
    55     * @throws Doctrine_Query_Exception     if some generic parsing error occurs -
    56     * @return array                        an array containing the query string parts -
    57     */ -
    58    public function tokenizeQuery($query) -
    59    { -
    60        $parts = array(); -
    61        $tokens = $this->sqlExplode($query, ' '); -
    62 -
    63        foreach ($tokens as $index => $token) { -
    64            $token = trim($token); -
    65            switch (strtolower($token)) { -
    66                case 'delete': -
    67                case 'update': -
    68                case 'select': -
    69                case 'set': -
    70                case 'from': -
    71                case 'where': -
    72                case 'limit': -
    73                case 'offset': -
    74                case 'having': -
    75                    $p = $token; -
    76                    //$parts[$token] = array(); -
    77                    $parts[$token] = ''; -
    78                break; -
    79                case 'order': -
    80                case 'group': -
    81                    $i = ($index + 1); -
    82                    if (isset($tokens[$i]) && strtolower($tokens[$i]) === 'by') { -
    83                        $p = $token; -
    84                        $parts[$token] = ''; -
    85                        //$parts[$token] = array(); -
    86                    } else { -
    87                        $parts[$p] .= "$token "; -
    88                        //$parts[$p][] = $token; -
    89                    } -
    90                break; -
    91                case 'by': -
    92                    continue; -
    93                default: -
    94                    if ( ! isset($p)) { -
    95                        throw new Doctrine_Query_Tokenizer_Exception( -
    96                                "Couldn't tokenize query. Encountered invalid token: '$token'."); -
    97                    } -
    98 -
    99                    $parts[$p] .= "$token "; -
    100                    //$parts[$p][] = $token; -
    101            } -
    102        } -
    103        return $parts; -
    104    } -
    105     -
    106    /** -
    107     * trims brackets -
    108     * -
    109     * @param string $str -
    110     * @param string $e1        the first bracket, usually '(' -
    111     * @param string $e2        the second bracket, usually ')' -
    112     */ -
    113    public function bracketTrim($str, $e1 = '(', $e2 = ')') -
    114    { -
    115        if (substr($str, 0, 1) === $e1 && substr($str, -1) === $e2) { -
    116            return substr($str, 1, -1); -
    117        } else { -
    118            return $str; -
    119        } -
    120    } -
    121 -
    122    /** -
    123     * bracketExplode -
    124     * -
    125     * example: -
    126     * -
    127     * parameters: -
    128     *      $str = (age < 20 AND age > 18) AND email LIKE 'John@example.com' -
    129     *      $d = ' AND ' -
    130     *      $e1 = '(' -
    131     *      $e2 = ')' -
    132     * -
    133     * would return an array: -
    134     *      array("(age < 20 AND age > 18)", -
    135     *            "email LIKE 'John@example.com'") -
    136     * -
    137     * @param string $str -
    138     * @param string $d         the delimeter which explodes the string -
    139     * @param string $e1        the first bracket, usually '(' -
    140     * @param string $e2        the second bracket, usually ')' -
    141     * -
    142     */ -
    143    public function bracketExplode($str, $d = ' ', $e1 = '(', $e2 = ')') -
    144    { -
    145        if (is_array($d)) { -
    146            $a = preg_split('#('.implode('|', $d).')#', $str); -
    147            $d = stripslashes($d[0]); -
    148        } else { -
    149            $a = explode($d, $str); -
    150        } -
    151 -
    152        $i = 0; -
    153        $term = array(); -
    154        foreach($a as $key=>$val) { -
    155            if (empty($term[$i])) { -
    156                $term[$i] = trim($val); -
    157                $s1 = substr_count($term[$i], $e1); -
    158                $s2 = substr_count($term[$i], $e2); -
    159                 -
    160                if ($s1 == $s2) { -
    161                    $i++; -
    162                } -
    163            } else { -
    164                $term[$i] .= $d . trim($val); -
    165                $c1 = substr_count($term[$i], $e1); -
    166                $c2 = substr_count($term[$i], $e2); -
    167                 -
    168                if ($c1 == $c2) {  -
    169                    $i++; -
    170                } -
    171            } -
    172        } -
    173        return $term; -
    174    } -
    175 -
    176    /** -
    177     * quoteExplode -
    178     * -
    179     * example: -
    180     * -
    181     * parameters: -
    182     *      $str = email LIKE 'John@example.com' -
    183     *      $d = ' LIKE ' -
    184     * -
    185     * would return an array: -
    186     *      array("email", "LIKE", "'John@example.com'") -
    187     * -
    188     * @param string $str -
    189     * @param string $d         the delimeter which explodes the string -
    190     */ -
    191    public function quoteExplode($str, $d = ' ') -
    192    { -
    193        if (is_array($d)) { -
    194            $a = preg_split('/('.implode('|', $d).')/', $str); -
    195            $d = stripslashes($d[0]); -
    196        } else { -
    197            $a = explode($d, $str); -
    198        } -
    199 -
    200        $i = 0; -
    201        $term = array(); -
    202        foreach ($a as $key => $val) { -
    203            if (empty($term[$i])) { -
    204                $term[$i] = trim($val); -
    205 -
    206                if ( ! (substr_count($term[$i], "'") & 1)) { -
    207                    $i++; -
    208                } -
    209            } else { -
    210                $term[$i] .= $d . trim($val); -
    211 -
    212                if ( ! (substr_count($term[$i], "'") & 1)) { -
    213                    $i++; -
    214                } -
    215            } -
    216        } -
    217        return $term; -
    218    } -
    219 -
    220    /** -
    221     * sqlExplode -
    222     * -
    223     * explodes a string into array using custom brackets and -
    224     * quote delimeters -
    225     * -
    226     * -
    227     * example: -
    228     * -
    229     * parameters: -
    230     *      $str = "(age < 20 AND age > 18) AND name LIKE 'John Doe'" -
    231     *      $d   = ' ' -
    232     *      $e1  = '(' -
    233     *      $e2  = ')' -
    234     * -
    235     * would return an array: -
    236     *      array('(age < 20 AND age > 18)', -
    237     *            'name', -
    238     *            'LIKE', -
    239     *            'John Doe') -
    240     * -
    241     * @param string $str -
    242     * @param string $d         the delimeter which explodes the string -
    243     * @param string $e1        the first bracket, usually '(' -
    244     * @param string $e2        the second bracket, usually ')' -
    245     * -
    246     * @return array -
    247     */ -
    248    public function sqlExplode($str, $d = ' ', $e1 = '(', $e2 = ')') -
    249    { -
    250        if ($d == ' ') { -
    251            $d = array(' ', '\s'); -
    252        } -
    253        if (is_array($d)) { -
    254            $d = array_map('preg_quote', $d); -
    255 -
    256            if (in_array(' ', $d)) { -
    257                $d[] = '\s'; -
    258            } -
    259 -
    260            $split = '#(' . implode('|', $d) . ')#'; -
    261 -
    262            $str = preg_split($split, $str); -
    263            $d = stripslashes($d[0]); -
    264        } else { -
    265            $str = explode($d, $str); -
    266        } -
    267 -
    268        $i = 0; -
    269        $term = array(); -
    270 -
    271        foreach ($str as $key => $val) { -
    272            if (empty($term[$i])) { -
    273                $term[$i] = trim($val); -
    274 -
    275                $s1 = substr_count($term[$i], $e1); -
    276                $s2 = substr_count($term[$i], $e2); -
    277 -
    278                if (strpos($term[$i], '(') !== false) { -
    279                    if ($s1 == $s2) { -
    280                        $i++; -
    281                    } -
    282                } else { -
    283                    if ( ! (substr_count($term[$i], "'") & 1) && -
    284                         ! (substr_count($term[$i], "\"") & 1)) { -
    285                        $i++; -
    286                    } -
    287                } -
    288            } else { -
    289                $term[$i] .= $d . trim($val); -
    290                $c1 = substr_count($term[$i], $e1); -
    291                $c2 = substr_count($term[$i], $e2); -
    292 -
    293                if (strpos($term[$i], '(') !== false) { -
    294                    if ($c1 == $c2) { -
    295                        $i++; -
    296                    } -
    297                } else { -
    298                    if ( ! (substr_count($term[$i], "'") & 1) && -
    299                         ! (substr_count($term[$i], "\"") & 1)) { -
    300                        $i++; -
    301                    } -
    302                } -
    303            } -
    304        } -
    305        return $term; -
    306    } -
    307 -
    308    /** -
    309     * clauseExplode -
    310     * -
    311     * explodes a string into array using custom brackets and -
    312     * quote delimeters -
    313     * -
    314     * -
    315     * example: -
    316     * -
    317     * parameters: -
    318     *      $str = "(age < 20 AND age > 18) AND name LIKE 'John Doe'" -
    319     *      $d   = ' ' -
    320     *      $e1  = '(' -
    321     *      $e2  = ')' -
    322     * -
    323     * would return an array: -
    324     *      array('(age < 20 AND age > 18)', -
    325     *            'name', -
    326     *            'LIKE', -
    327     *            'John Doe') -
    328     * -
    329     * @param string $str -
    330     * @param string $d         the delimeter which explodes the string -
    331     * @param string $e1        the first bracket, usually '(' -
    332     * @param string $e2        the second bracket, usually ')' -
    333     * -
    334     * @return array -
    335     */ -
    336    public function clauseExplode($str, array $d, $e1 = '(', $e2 = ')') -
    337    { -
    338        if (is_array($d)) { -
    339            $d = array_map('preg_quote', $d); -
    340 -
    341            if (in_array(' ', $d)) { -
    342                $d[] = '\s'; -
    343            } -
    344 -
    345            $split = '#(' . implode('|', $d) . ')#'; -
    346 -
    347            $str = preg_split($split, $str, -1, PREG_SPLIT_DELIM_CAPTURE); -
    348        } -
    349 -
    350        $i = 0; -
    351        $term = array(); -
    352 -
    353        foreach ($str as $key => $val) { -
    354            if ($key & 1) { -
    355                if (isset($term[($i - 1)]) && ! is_array($term[($i - 1)])) { -
    356                    $term[($i - 1)] = array($term[($i - 1)], $val); -
    357                } -
    358                continue; -
    359            } -
    360            if (empty($term[$i])) { -
    361                $term[$i] = $val; -
    362            } else { -
    363                $term[$i] .= $str[($key - 1)] . $val; -
    364            } -
    365 -
    366            $c1 = substr_count($term[$i], $e1); -
    367            $c2 = substr_count($term[$i], $e2); -
    368 -
    369            if (strpos($term[$i], '(') !== false) { -
    370                if ($c1 == $c2) { -
    371                    $i++; -
    372                } -
    373            } else { -
    374                if ( ! (substr_count($term[$i], "'") & 1) && -
    375                     ! (substr_count($term[$i], "\"") & 1)) { -
    376                    $i++; -
    377                } -
    378            } -
    379        } -
    380        $term[$i - 1] = array($term[$i - 1], ''); -
    381 -
    382        return $term; -
    383    } -
    384}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Query_Where.html b/tests_old/coverage/Doctrine_Query_Where.html deleted file mode 100644 index 7facd727b..000000000 --- a/tests_old/coverage/Doctrine_Query_Where.html +++ /dev/null @@ -1,522 +0,0 @@ - - - Coverage for Doctrine_Query_Where - - -

    Coverage for Doctrine_Query_Where

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Where.php 3212 2007-11-24 18:58:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Condition'); -
    22/** -
    23 * Doctrine_Query_Where -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Query -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3212 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Query_Where extends Doctrine_Query_Condition -
    34{ -
    35    public function load($where)  -
    36    { -
    37        $where = $this->_tokenizer->bracketTrim(trim($where)); -
    38        $conn  = $this->query->getConnection(); -
    39        $terms = $this->_tokenizer->sqlExplode($where);   -
    40 -
    41        if (count($terms) > 1) { -
    42            if (substr($where, 0, 6) == 'EXISTS') { -
    43                return $this->parseExists($where, true); -
    44            } elseif (substr($where, 0, 10) == 'NOT EXISTS') { -
    45                return $this->parseExists($where, false); -
    46            } -
    47        } -
    48 -
    49        if (count($terms) < 3) { -
    50            $terms = $this->_tokenizer->sqlExplode($where, array('=', '<', '<>', '>', '!=')); -
    51        } -
    52 -
    53        if (count($terms) > 1) { -
    54            $first = array_shift($terms); -
    55            $value = array_pop($terms); -
    56            $operator = trim(substr($where, strlen($first), -strlen($value))); -
    57            $table = null; -
    58            $field = null; -
    59 -
    60            if (strpos($first, "'") === false && strpos($first, '(') === false) { -
    61                // normal field reference found -
    62                $a = explode('.', $first); -
    63         -
    64                $field = array_pop($a); -
    65                $reference = implode('.', $a); -
    66                 -
    67                if (empty($reference)) { -
    68                    $map = $this->query->getRootDeclaration();   -
    69                     -
    70                    $alias = $this->query->getTableAlias($this->query->getRootAlias()); -
    71                    $table = $map['table']; -
    72                } else { -
    73                    $map = $this->query->load($reference, false); -
    74     -
    75                    $alias = $this->query->getTableAlias($reference); -
    76                    $table = $map['table']; -
    77                } -
    78            } -
    79            $first = $this->query->parseClause($first); -
    80 -
    81            $sql = $first . ' ' . $operator . ' ' . $this->parseValue($value, $table, $field); -
    82         -
    83            return $sql;   -
    84        } else { -
    85 -
    86        } -
    87    } -
    88 -
    89    public function parseValue($value, Doctrine_Table $table = null, $field = null) -
    90    { -
    91        if (substr($value, 0, 1) == '(') { -
    92            // trim brackets -
    93            $trimmed = $this->_tokenizer->bracketTrim($value); -
    94 -
    95            if (substr($trimmed, 0, 4) == 'FROM' || -
    96                substr($trimmed, 0, 6) == 'SELECT') { -
    97 -
    98                // subquery found -
    99                $q     = new Doctrine_Query(); -
    100                $value = '(' . $this->query->createSubquery()->parseQuery($trimmed, false)->getQuery() . ')'; -
    101 -
    102            } elseif (substr($trimmed, 0, 4) == 'SQL:') { -
    103                $value = '(' . substr($trimmed, 4) . ')'; -
    104            } else { -
    105                // simple in expression found -
    106                $e = $this->_tokenizer->sqlExplode($trimmed, ','); -
    107 -
    108                $value = array(); -
    109 -
    110                $index = false; -
    111 -
    112                foreach ($e as $part) { -
    113                    if (isset($table) && isset($field)) { -
    114                        $index = $table->enumIndex($field, trim($part, "'")); -
    115                    } -
    116 -
    117                    if ($index !== false) { -
    118                        $value[] = $index; -
    119                    } else { -
    120                        $value[] = $this->parseLiteralValue($part); -
    121                    } -
    122                } -
    123 -
    124                $value = '(' . implode(', ', $value) . ')'; -
    125            } -
    126        } else if (substr($value, 0, 1) == ':' || $value === '?') { -
    127            // placeholder found -
    128            if (isset($table) && isset($field) && $table->getTypeOf($field) == 'enum') { -
    129                $this->query->addEnumParam($value, $table, $field); -
    130            } else { -
    131                $this->query->addEnumParam($value, null, null); -
    132            } -
    133        } else { -
    134            $enumIndex = false; -
    135            if (isset($table) && isset($field)) { -
    136                // check if value is enumerated value -
    137                $enumIndex = $table->enumIndex($field, trim($value, "'")); -
    138            } -
    139 -
    140            if ($enumIndex !== false) { -
    141                $value = $enumIndex; -
    142            } else { -
    143                $value = $this->parseLiteralValue($value); -
    144            } -
    145        } -
    146        return $value; -
    147    } -
    148 -
    149    /** -
    150     * parses an EXISTS expression -
    151     * -
    152     * @param string $where         query where part to be parsed -
    153     * @param boolean $negation     whether or not to use the NOT keyword -
    154     * @return string -
    155     */ -
    156    public function parseExists($where, $negation) -
    157    { -
    158        $operator = ($negation) ? 'EXISTS' : 'NOT EXISTS'; -
    159 -
    160        $pos = strpos($where, '('); -
    161 -
    162        if ($pos == false) { -
    163            throw new Doctrine_Query_Exception('Unknown expression, expected a subquery with () -marks'); -
    164        } -
    165 -
    166        $sub = $this->_tokenizer->bracketTrim(substr($where, $pos)); -
    167 -
    168        return $operator . ' (' . $this->query->createSubquery()->parseQuery($sub, false)->getQuery() . ')'; -
    169    } -
    170} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_RawSql.html b/tests_old/coverage/Doctrine_RawSql.html deleted file mode 100644 index 66d12ef59..000000000 --- a/tests_old/coverage/Doctrine_RawSql.html +++ /dev/null @@ -1,1002 +0,0 @@ - - - Coverage for Doctrine_RawSql - - -

    Coverage for Doctrine_RawSql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: RawSql.php 3209 2007-11-24 18:11:09Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Query_Abstract'); -
    22/** -
    23 * Doctrine_RawSql -
    24 * -
    25 * Doctrine_RawSql is an implementation of Doctrine_Query_Abstract that skips the entire -
    26 * DQL parsing procedure. The "DQL" that is passed to a RawSql query object for execution -
    27 * is considered to be plain SQL and will be used "as is". The only query part that is special -
    28 * in a RawSql query is the SELECT part, which has a special syntax that provides Doctrine -
    29 * with the necessary information to properly hydrate the query results. -
    30 * -
    31 * @package     Doctrine -
    32 * @subpackage  RawSql -
    33 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    34 * @link        www.phpdoctrine.org -
    35 * @since       1.0 -
    36 * @version     $Revision: 3209 $ -
    37 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    38 */ -
    39class Doctrine_RawSql extends Doctrine_Query_Abstract -
    40{ -
    41    /** -
    42     * @var array $fields -
    43     */ -
    44    private $fields = array(); -
    45     -
    46    /** -
    47     * @deprecated -
    48     */ -
    49    public function parseQueryPart($queryPartName, $queryPart, $append = false) -
    50    { -
    51        return $this->parseDqlQueryPart($queryPartName, $queryPart, $append); -
    52    } -
    53 -
    54    /** -
    55     * parseDqlQueryPart -
    56     * parses given DQL query part. Overrides Doctrine_Query_Abstract::parseDqlQueryPart(). -
    57     * This implementation does no parsing at all, except of the SELECT portion of the query -
    58     * which is special in RawSql queries. The entire remaining parts are used "as is", so -
    59     * the user of the RawSql query is responsible for writing SQL that is portable between -
    60     * different DBMS. -
    61     * -
    62     * @param string $queryPartName     the name of the query part -
    63     * @param string $queryPart         query part to be parsed -
    64     * @param boolean $append           whether or not to append the query part to its stack -
    65     *                                  if false is given, this method will overwrite -
    66     *                                  the given query part stack with $queryPart -
    67     * @return Doctrine_Query           this object -
    68     */ -
    69  public function parseDqlQueryPart($queryPartName, $queryPart, $append = false) -
    70    { -
    71        if ($queryPartName == 'select') { -
    72          $this->_parseSelectFields($queryPart); -
    73          return $this; -
    74      } -
    75      if ( ! isset($this->parts[$queryPartName])) { -
    76          $this->_sqlParts[$queryPartName] = array(); -
    77      } -
    78      -
    79      if ( ! $append) { -
    80          $this->_sqlParts[$queryPartName] = array($queryPart); -
    81      } else { -
    82          $this->_sqlParts[$queryPartName][] = $queryPart; -
    83      } -
    84      return $this; -
    85    } -
    86     -
    87    /** -
    88     * Adds a DQL query part. Overrides Doctrine_Query_Abstract::_addDqlQueryPart(). -
    89     * This implementation for RawSql parses the new parts right away, generating the SQL. -
    90     */ -
    91    protected function _addDqlQueryPart($queryPartName, $queryPart, $append = false) -
    92    { -
    93        return $this->parseQueryPart($queryPartName, $queryPart, $append); -
    94    } -
    95     -
    96    /** -
    97     * Add select parts to fields. -
    98     * -
    99     * @param $queryPart sting The name of the querypart -
    100     */ -
    101    private function _parseSelectFields($queryPart){ -
    102        preg_match_all('/{([^}{]*)}/U', $queryPart, $m); -
    103        $this->fields = $m[1]; -
    104        $this->_sqlParts['select'] = array(); -
    105    } -
    106     -
    107    /** -
    108     * parseDqlQuery -
    109     * parses an sql query and adds the parts to internal array. -
    110     * Overrides Doctrine_Query_Abstract::parseDqlQuery(). -
    111     * This implementation simply tokenizes the provided query string and uses them -
    112     * as SQL parts right away. -
    113     * -
    114     * @param string $query     query to be parsed -
    115     * @return Doctrine_RawSql  this object -
    116     */ -
    117    public function parseDqlQuery($query) -
    118    { -
    119        $this->_parseSelectFields($query); -
    120        $this->clear(); -
    121 -
    122        $tokens = $this->_tokenizer->sqlExplode($query, ' '); -
    123 -
    124        $parts = array(); -
    125        foreach ($tokens as $key => $part) { -
    126            $partLowerCase = strtolower($part); -
    127            switch ($partLowerCase) { -
    128                case 'select': -
    129                case 'from': -
    130                case 'where': -
    131                case 'limit': -
    132                case 'offset': -
    133                case 'having': -
    134                    $type = $partLowerCase; -
    135                    if ( ! isset($parts[$partLowerCase])) { -
    136                        $parts[$partLowerCase] = array(); -
    137                    } -
    138                    break; -
    139                case 'order': -
    140                case 'group': -
    141                    $i = $key + 1; -
    142                    if (isset($tokens[$i]) && strtolower($tokens[$i]) === 'by') { -
    143                        $type = $partLowerCase . 'by'; -
    144                        $parts[$type] = array(); -
    145                    } else { -
    146                        //not a keyword so we add it to the previous type -
    147                        $parts[$type][] = $part; -
    148                    } -
    149                    break; -
    150                case 'by': -
    151                    continue; -
    152                default: -
    153                    //not a keyword so we add it to the previous type. -
    154                    if ( ! isset($parts[$type][0])) { -
    155                        $parts[$type][0] = $part; -
    156                    } else { -
    157                        // why does this add to index 0 and not append to the  -
    158                        // array. If it had done that one could have used  -
    159                        // parseQueryPart. -
    160                        $parts[$type][0] .= ' '.$part; -
    161                    } -
    162            } -
    163        } -
    164 -
    165        $this->_sqlParts = $parts; -
    166        $this->_sqlParts['select'] = array(); -
    167 -
    168        return $this; -
    169    } -
    170 -
    171    /** -
    172     * getSqlQuery -
    173     * builds the sql query. -
    174     * -
    175     * @return string       the built sql query -
    176     */ -
    177    public function getSqlQuery($params = array()) -
    178    {         -
    179        $select = array(); -
    180 -
    181        foreach ($this->fields as $field) { -
    182            $e = explode('.', $field); -
    183            if ( ! isset($e[1])) { -
    184                throw new Doctrine_RawSql_Exception('All selected fields in Sql query must be in format tableAlias.fieldName'); -
    185            } -
    186            // try to auto-add component -
    187            if ( ! $this->hasSqlTableAlias($e[0])) { -
    188                try { -
    189                    $this->addComponent($e[0], ucwords($e[0])); -
    190                } catch (Doctrine_Exception $exception) { -
    191                    throw new Doctrine_RawSql_Exception('The associated component for table alias ' . $e[0] . ' couldn\'t be found.'); -
    192                } -
    193            } -
    194 -
    195            $componentAlias = $this->getComponentAlias($e[0]); -
    196             -
    197            if ($e[1] == '*') { -
    198                foreach ($this->_queryComponents[$componentAlias]['table']->getColumnNames() as $name) { -
    199                    $field = $e[0] . '.' . $name; -
    200 -
    201                    $select[$componentAlias][$field] = $field . ' AS ' . $e[0] . '__' . $name; -
    202                } -
    203            } else { -
    204                $field = $e[0] . '.' . $e[1]; -
    205                $select[$componentAlias][$field] = $field . ' AS ' . $e[0] . '__' . $e[1]; -
    206            } -
    207        } -
    208 -
    209        // force-add all primary key fields -
    210 -
    211        foreach ($this->getTableAliasMap() as $tableAlias => $componentAlias) { -
    212            $map = $this->_queryComponents[$componentAlias]; -
    213 -
    214            foreach ((array) $map['table']->getIdentifier() as $key) { -
    215                $field = $tableAlias . '.' . $key; -
    216 -
    217                if ( ! isset($this->_sqlParts['select'][$field])) { -
    218                    $select[$componentAlias][$field] = $field . ' AS ' . $tableAlias . '__' . $key; -
    219                } -
    220            } -
    221        } -
    222         -
    223        // first add the fields of the root component -
    224        reset($this->_queryComponents); -
    225        $componentAlias = key($this->_queryComponents); -
    226 -
    227        $q = 'SELECT ' . implode(', ', $select[$componentAlias]); -
    228        unset($select[$componentAlias]); -
    229 -
    230        foreach ($select as $component => $fields) { -
    231            if ( ! empty($fields)) { -
    232                $q .= ', ' . implode(', ', $fields); -
    233            } -
    234        } -
    235 -
    236        $string = $this->applyInheritance(); -
    237        if ( ! empty($string)) { -
    238            $this->_sqlParts['where'][] = $string; -
    239        } -
    240        $copy = $this->_sqlParts; -
    241        unset($copy['select']); -
    242 -
    243        $q .= ( ! empty($this->_sqlParts['from']))?    ' FROM '     . implode(' ', $this->_sqlParts['from']) : ''; -
    244        $q .= ( ! empty($this->_sqlParts['where']))?   ' WHERE '    . implode(' AND ', $this->_sqlParts['where']) : ''; -
    245        $q .= ( ! empty($this->_sqlParts['groupby']))? ' GROUP BY ' . implode(', ', $this->_sqlParts['groupby']) : ''; -
    246        $q .= ( ! empty($this->_sqlParts['having']))?  ' HAVING '   . implode(' AND ', $this->_sqlParts['having']) : ''; -
    247        $q .= ( ! empty($this->_sqlParts['orderby']))? ' ORDER BY ' . implode(', ', $this->_sqlParts['orderby']) : ''; -
    248        $q .= ( ! empty($this->_sqlParts['limit']))?   ' LIMIT ' . implode(' ', $this->_sqlParts['limit']) : ''; -
    249        $q .= ( ! empty($this->_sqlParts['offset']))?  ' OFFSET ' . implode(' ', $this->_sqlParts['offset']) : ''; -
    250 -
    251        if ( ! empty($string)) { -
    252            array_pop($this->_sqlParts['where']); -
    253        } -
    254        return $q; -
    255    } -
    256 -
    257    /** -
    258     * getFields -
    259     * returns the fields associated with this parser -
    260     * -
    261     * @return array    all the fields associated with this parser -
    262     */ -
    263    public function getFields() -
    264    { -
    265        return $this->fields; -
    266    } -
    267 -
    268    /** -
    269     * addComponent -
    270     * -
    271     * @param string $tableAlias -
    272     * @param string $componentName -
    273     * @return Doctrine_RawSql -
    274     */ -
    275    public function addComponent($tableAlias, $path) -
    276    { -
    277        $tmp           = explode(' ', $path); -
    278        $originalAlias = (count($tmp) > 1) ? end($tmp) : null; -
    279 -
    280        $e = explode('.', $tmp[0]); -
    281 -
    282        $fullPath = $tmp[0]; -
    283        $fullLength = strlen($fullPath); -
    284 -
    285        $table = null; -
    286 -
    287        $currPath = ''; -
    288 -
    289        if (isset($this->_queryComponents[$e[0]])) { -
    290            $table = $this->_queryComponents[$e[0]]['table']; -
    291 -
    292            $currPath = $parent = array_shift($e); -
    293        } -
    294 -
    295        foreach ($e as $k => $component) { -
    296            // get length of the previous path -
    297            $length = strlen($currPath); -
    298 -
    299            // build the current component path -
    300            $currPath = ($currPath) ? $currPath . '.' . $component : $component; -
    301 -
    302            $delimeter = substr($fullPath, $length, 1); -
    303 -
    304            // if an alias is not given use the current path as an alias identifier -
    305            if (strlen($currPath) === $fullLength && isset($originalAlias)) { -
    306                $componentAlias = $originalAlias; -
    307            } else { -
    308                $componentAlias = $currPath; -
    309            } -
    310            if ( ! isset($table)) { -
    311                $conn = Doctrine_Manager::getInstance() -
    312                        ->getConnectionForComponent($component); -
    313                         -
    314                $table = $conn->getTable($component); -
    315                $this->_queryComponents[$componentAlias] = array('table' => $table); -
    316            } else { -
    317                $relation = $table->getRelation($component); -
    318 -
    319                $this->_queryComponents[$componentAlias] = array('table'    => $relation->getTable(), -
    320                                                          'parent'   => $parent, -
    321                                                          'relation' => $relation); -
    322            } -
    323            $this->addSqlTableAlias($tableAlias, $componentAlias); -
    324 -
    325            $parent = $currPath; -
    326        } -
    327 -
    328        return $this; -
    329    } -
    330} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_RawSql_Exception.html b/tests_old/coverage/Doctrine_RawSql_Exception.html deleted file mode 100644 index aa895b3d6..000000000 --- a/tests_old/coverage/Doctrine_RawSql_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_RawSql_Exception - - -

    Coverage for Doctrine_RawSql_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_RawSql_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  RawSql -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_RawSql_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record.html b/tests_old/coverage/Doctrine_Record.html deleted file mode 100644 index be48c0584..000000000 --- a/tests_old/coverage/Doctrine_Record.html +++ /dev/null @@ -1,5016 +0,0 @@ - - - Coverage for Doctrine_Record - - -

    Coverage for Doctrine_Record

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Record.php 3192 2007-11-19 17:55:23Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Record_Abstract'); -
    22/** -
    23 * Doctrine_Record -
    24 * All record classes should inherit this super class -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Record -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3192 $ -
    33 */ -
    34abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Countable, IteratorAggregate, Serializable -
    35{ -
    36    /** -
    37     * STATE CONSTANTS -
    38     */ -
    39 -
    40    /** -
    41     * DIRTY STATE -
    42     * a Doctrine_Record is in dirty state when its properties are changed -
    43     */ -
    44    const STATE_DIRTY       = 1; -
    45 -
    46    /** -
    47     * TDIRTY STATE -
    48     * a Doctrine_Record is in transient dirty state when it is created  -
    49     * and some of its fields are modified but it is NOT yet persisted into database -
    50     */ -
    51    const STATE_TDIRTY      = 2; -
    52 -
    53    /** -
    54     * CLEAN STATE -
    55     * a Doctrine_Record is in clean state when all of its properties are loaded from the database -
    56     * and none of its properties are changed -
    57     */ -
    58    const STATE_CLEAN       = 3; -
    59 -
    60    /** -
    61     * PROXY STATE -
    62     * a Doctrine_Record is in proxy state when its properties are not fully loaded -
    63     */ -
    64    const STATE_PROXY       = 4; -
    65 -
    66    /** -
    67     * NEW TCLEAN -
    68     * a Doctrine_Record is in transient clean state when it is created and none of its fields are modified -
    69     */ -
    70    const STATE_TCLEAN      = 5; -
    71 -
    72    /** -
    73     * LOCKED STATE -
    74     * a Doctrine_Record is temporarily locked during deletes and saves -
    75     * -
    76     * This state is used internally to ensure that circular deletes -
    77     * and saves will not cause infinite loops -
    78     */ -
    79    const STATE_LOCKED     = 6; -
    80 -
    81    /** -
    82     * @var Doctrine_Node_<TreeImpl>        node object -
    83     */ -
    84    protected $_node; -
    85 -
    86    /** -
    87     * @var integer $_id                    the primary keys of this object -
    88     */ -
    89    protected $_id           = array(); -
    90 -
    91    /** -
    92     * @var array $_data                    the record data -
    93     */ -
    94    protected $_data         = array(); -
    95 -
    96    /** -
    97     * @var array $_values                  the values array, aggregate values and such are mapped into this array -
    98     */ -
    99    protected $_values       = array(); -
    100 -
    101    /** -
    102     * @var integer $_state                 the state of this record -
    103     * @see STATE_* constants -
    104     */ -
    105    protected $_state; -
    106 -
    107    /** -
    108     * @var array $_modified                an array containing field names that have been modified -
    109     * @todo Better name? $_modifiedFields? -
    110     */ -
    111    protected $_modified     = array(); -
    112 -
    113    /** -
    114     * @var Doctrine_Validator_ErrorStack   error stack object -
    115     */ -
    116    protected $_errorStack; -
    117 -
    118    /** -
    119     * @var array $_references              an array containing all the references -
    120     */ -
    121    protected $_references     = array(); -
    122 -
    123    /** -
    124     * @var integer $index                  this index is used for creating object identifiers -
    125     */ -
    126    private static $_index = 1; -
    127 -
    128    /** -
    129     * @var integer $oid                    object identifier, each Record object has a unique object identifier -
    130     */ -
    131    private $_oid; -
    132 -
    133    /** -
    134     * constructor -
    135     * @param Doctrine_Table|null $table       a Doctrine_Table object or null, -
    136     *                                         if null the table object is retrieved from current connection -
    137     * -
    138     * @param boolean $isNewEntry              whether or not this record is transient -
    139     * -
    140     * @throws Doctrine_Connection_Exception   if object is created using the new operator and there are no -
    141     *                                         open connections -
    142     * @throws Doctrine_Record_Exception       if the cleanData operation fails somehow -
    143     */ -
    144    public function __construct($table = null, $isNewEntry = false) -
    145    { -
    146        if (isset($table) && $table instanceof Doctrine_Table) { -
    147            $this->_table = $table; -
    148            $exists = ( ! $isNewEntry); -
    149        } else { -
    150            $class = get_class($this); -
    151            // get the table of this class -
    152            $this->_table = Doctrine_Manager::getInstance()->getTable($class); -
    153            $exists = false; -
    154        } -
    155 -
    156        // Check if the current connection has the records table in its registry -
    157        // If not this record is only used for creating table definition and setting up -
    158        // relations. -
    159        if ( ! $this->_table->getConnection()->hasTable($this->_table->getComponentName())) { -
    160            return; -
    161        } -
    162 -
    163        $this->_oid = self::$_index; -
    164 -
    165        self::$_index++; -
    166 -
    167        // get the data array -
    168        $this->_data = $this->_table->getData(); -
    169 -
    170        // get the column count -
    171        $count = count($this->_data); -
    172 -
    173        $this->_values = $this->cleanData($this->_data); -
    174 -
    175        $this->prepareIdentifiers($exists); -
    176 -
    177        if ( ! $exists) { -
    178            if ($count > count($this->_values)) { -
    179                $this->_state = Doctrine_Record::STATE_TDIRTY; -
    180            } else { -
    181                $this->_state = Doctrine_Record::STATE_TCLEAN; -
    182            } -
    183 -
    184            // set the default values for this record -
    185            $this->assignDefaultValues(); -
    186        } else { -
    187            $this->_state = Doctrine_Record::STATE_CLEAN; -
    188 -
    189            if ($count < $this->_table->getColumnCount()) { -
    190                $this->_state  = Doctrine_Record::STATE_PROXY; -
    191            } -
    192        } -
    193 -
    194        $this->_errorStack = new Doctrine_Validator_ErrorStack(get_class($this)); -
    195 -
    196        $repository = $this->_table->getRepository(); -
    197        $repository->add($this); -
    198         -
    199        $this->construct(); -
    200         -
    201    } -
    202 -
    203    /** -
    204     * _index -
    205     * -
    206     * @return integer -
    207     */ -
    208    public static function _index() -
    209    { -
    210        return self::$_index; -
    211    } -
    212 -
    213    /** -
    214     * setUp -
    215     * this method is used for setting up relations and attributes -
    216     * it should be implemented by child classes -
    217     * -
    218     * @return void -
    219     */ -
    220    public function setUp() -
    221    { } -
    222    /** -
    223     * construct -
    224     * Empty template method to provide concrete Record classes with the possibility -
    225     * to hook into the constructor procedure -
    226     * -
    227     * @return void -
    228     */ -
    229    public function construct() -
    230    { } -
    231    /** -
    232     * getOid -
    233     * returns the object identifier -
    234     * -
    235     * @return integer -
    236     */ -
    237    public function getOid() -
    238    { -
    239        return $this->_oid; -
    240    } -
    241    public function oid() -
    242    { -
    243        return $this->_oid; -
    244    } -
    245 -
    246    /** -
    247     * isValid -
    248     * -
    249     * @return boolean  whether or not this record is valid -
    250     */ -
    251    public function isValid() -
    252    { -
    253        if ( ! $this->_table->getAttribute(Doctrine::ATTR_VALIDATE)) { -
    254            return true; -
    255        } -
    256        // Clear the stack from any previous errors. -
    257        $this->_errorStack->clear(); -
    258 -
    259        // Run validation process -
    260        $validator = new Doctrine_Validator(); -
    261        $validator->validateRecord($this); -
    262        $this->validate(); -
    263        if ($this->_state == self::STATE_TDIRTY || $this->_state == self::STATE_TCLEAN) { -
    264            $this->validateOnInsert(); -
    265        } else { -
    266            $this->validateOnUpdate(); -
    267        } -
    268 -
    269        return $this->_errorStack->count() == 0 ? true : false; -
    270    } -
    271 -
    272    /** -
    273     * Empty template method to provide concrete Record classes with the possibility -
    274     * to hook into the validation procedure, doing any custom / specialized -
    275     * validations that are neccessary. -
    276     */ -
    277    protected function validate() -
    278    { } -
    279    /** -
    280     * Empty template method to provide concrete Record classes with the possibility -
    281     * to hook into the validation procedure only when the record is going to be -
    282     * updated. -
    283     */ -
    284    protected function validateOnUpdate() -
    285    { } -
    286    /** -
    287     * Empty template method to provide concrete Record classes with the possibility -
    288     * to hook into the validation procedure only when the record is going to be -
    289     * inserted into the data store the first time. -
    290     */ -
    291    protected function validateOnInsert() -
    292    { } -
    293    /** -
    294     * Empty template method to provide concrete Record classes with the possibility -
    295     * to hook into the serializing procedure. -
    296     */ -
    297    public function preSerialize($event) -
    298    { } -
    299    /** -
    300     * Empty template method to provide concrete Record classes with the possibility -
    301     * to hook into the serializing procedure. -
    302     */ -
    303    public function postSerialize($event) -
    304    { } -
    305    /** -
    306     * Empty template method to provide concrete Record classes with the possibility -
    307     * to hook into the serializing procedure. -
    308     */ -
    309    public function preUnserialize($event) -
    310    { } -
    311    /** -
    312     * Empty template method to provide concrete Record classes with the possibility -
    313     * to hook into the serializing procedure. -
    314     */ -
    315    public function postUnserialize($event) -
    316    { } -
    317    /** -
    318     * Empty template method to provide concrete Record classes with the possibility -
    319     * to hook into the saving procedure. -
    320     */ -
    321    public function preSave($event) -
    322    { } -
    323    /** -
    324     * Empty template method to provide concrete Record classes with the possibility -
    325     * to hook into the saving procedure. -
    326     */ -
    327    public function postSave($event) -
    328    { } -
    329    /** -
    330     * Empty template method to provide concrete Record classes with the possibility -
    331     * to hook into the deletion procedure. -
    332     */ -
    333    public function preDelete($event) -
    334    { } -
    335    /** -
    336     * Empty template method to provide concrete Record classes with the possibility -
    337     * to hook into the deletion procedure. -
    338     */ -
    339    public function postDelete($event) -
    340    { } -
    341    /** -
    342     * Empty template method to provide concrete Record classes with the possibility -
    343     * to hook into the saving procedure only when the record is going to be -
    344     * updated. -
    345     */ -
    346    public function preUpdate($event) -
    347    { } -
    348    /** -
    349     * Empty template method to provide concrete Record classes with the possibility -
    350     * to hook into the saving procedure only when the record is going to be -
    351     * updated. -
    352     */ -
    353    public function postUpdate($event) -
    354    { } -
    355    /** -
    356     * Empty template method to provide concrete Record classes with the possibility -
    357     * to hook into the saving procedure only when the record is going to be -
    358     * inserted into the data store the first time. -
    359     */ -
    360    public function preInsert($event) -
    361    { } -
    362    /** -
    363     * Empty template method to provide concrete Record classes with the possibility -
    364     * to hook into the saving procedure only when the record is going to be -
    365     * inserted into the data store the first time. -
    366     */ -
    367    public function postInsert($event) -
    368    { } -
    369    /** -
    370     * getErrorStack -
    371     * -
    372     * @return Doctrine_Validator_ErrorStack    returns the errorStack associated with this record -
    373     */ -
    374    public function getErrorStack() -
    375    { -
    376        return $this->_errorStack; -
    377    } -
    378 -
    379    /** -
    380     * errorStack -
    381     * assigns / returns record errorStack -
    382     * -
    383     * @param Doctrine_Validator_ErrorStack          errorStack to be assigned for this record -
    384     * @return void|Doctrine_Validator_ErrorStack    returns the errorStack associated with this record -
    385     */ -
    386    public function errorStack($stack = null) -
    387    { -
    388        if ($stack !== null) { -
    389            if ( ! ($stack instanceof Doctrine_Validator_ErrorStack)) { -
    390               throw new Doctrine_Record_Exception('Argument should be an instance of Doctrine_Validator_ErrorStack.'); -
    391            } -
    392            $this->_errorStack = $stack; -
    393        } else { -
    394            return $this->_errorStack; -
    395        } -
    396    } -
    397 -
    398    /** -
    399     * setDefaultValues -
    400     * sets the default values for records internal data -
    401     * -
    402     * @param boolean $overwrite                whether or not to overwrite the already set values -
    403     * @return boolean -
    404     */ -
    405    public function assignDefaultValues($overwrite = false) -
    406    { -
    407        if ( ! $this->_table->hasDefaultValues()) { -
    408            return false; -
    409        } -
    410        foreach ($this->_data as $column => $value) { -
    411            $default = $this->_table->getDefaultValueOf($column); -
    412 -
    413            if ($default === null) { -
    414                continue; -
    415            } -
    416             -
    417            if ($value === self::$_null || $overwrite) { -
    418                $this->_data[$column] = $default; -
    419                $this->_modified[]    = $column; -
    420                $this->_state = Doctrine_Record::STATE_TDIRTY; -
    421            } -
    422        } -
    423    } -
    424 -
    425    /** -
    426     * cleanData -
    427     * -
    428     * @param array $data       data array to be cleaned -
    429     * @return integer -
    430     * @todo Better description. What exactly does this "cleaning" involve? -
    431     */ -
    432    public function cleanData(&$data) -
    433    { -
    434        $tmp = $data; -
    435        $data = array(); -
    436 -
    437        foreach ($this->getTable()->getFieldNames() as $fieldName) { -
    438            if ( ! isset($tmp[$fieldName])) { -
    439                $data[$fieldName] = self::$_null; -
    440            } else { -
    441                $data[$fieldName] = $tmp[$fieldName]; -
    442            } -
    443            unset($tmp[$fieldName]); -
    444        } -
    445 -
    446        return $tmp; -
    447    } -
    448 -
    449    /** -
    450     * hydrate -
    451     * hydrates this object from given array -
    452     * -
    453     * @param array $data -
    454     * @return boolean -
    455     */ -
    456    public function hydrate(array $data) -
    457    { -
    458        $this->_values = array_merge($this->_values, $this->cleanData($data)); -
    459        $this->_data   = array_merge($this->_data, $data); -
    460        $this->prepareIdentifiers(true); -
    461    } -
    462 -
    463    /** -
    464     * prepareIdentifiers -
    465     * prepares identifiers for later use -
    466     * -
    467     * @param boolean $exists               whether or not this record exists in persistent data store -
    468     * @return void -
    469     */ -
    470    private function prepareIdentifiers($exists = true) -
    471    { -
    472        switch ($this->_table->getIdentifierType()) { -
    473            case Doctrine::IDENTIFIER_AUTOINC: -
    474            case Doctrine::IDENTIFIER_SEQUENCE: -
    475            case Doctrine::IDENTIFIER_NATURAL: -
    476                $name = $this->_table->getIdentifier(); -
    477                if (is_array($name)) { -
    478                    $name = $name[0]; -
    479                } -
    480                if ($exists) { -
    481                    if (isset($this->_data[$name]) && $this->_data[$name] !== self::$_null) { -
    482                        $this->_id[$name] = $this->_data[$name]; -
    483                    } -
    484                } -
    485                break; -
    486            case Doctrine::IDENTIFIER_COMPOSITE: -
    487                $names = $this->_table->getIdentifier(); -
    488 -
    489                foreach ($names as $name) { -
    490                    if ($this->_data[$name] === self::$_null) { -
    491                        $this->_id[$name] = null; -
    492                    } else { -
    493                        $this->_id[$name] = $this->_data[$name]; -
    494                    } -
    495                } -
    496                break; -
    497        } -
    498    } -
    499 -
    500    /** -
    501     * serialize -
    502     * this method is automatically called when this Doctrine_Record is serialized -
    503     * -
    504     * @return array -
    505     */ -
    506    public function serialize() -
    507    { -
    508        $event = new Doctrine_Event($this, Doctrine_Event::RECORD_SERIALIZE); -
    509 -
    510        $this->preSerialize($event); -
    511 -
    512        $vars = get_object_vars($this); -
    513 -
    514        unset($vars['_references']); -
    515        unset($vars['_table']); -
    516        unset($vars['_errorStack']); -
    517        unset($vars['_filter']); -
    518        unset($vars['_node']); -
    519 -
    520        $name = $this->_table->getIdentifier(); -
    521        $this->_data = array_merge($this->_data, $this->_id); -
    522 -
    523        foreach ($this->_data as $k => $v) { -
    524            if ($v instanceof Doctrine_Record && $this->_table->getTypeOf($k) != 'object') { -
    525                unset($vars['_data'][$k]); -
    526            } elseif ($v === self::$_null) { -
    527                unset($vars['_data'][$k]); -
    528            } else { -
    529                switch ($this->_table->getTypeOf($k)) { -
    530                    case 'array': -
    531                    case 'object': -
    532                        $vars['_data'][$k] = serialize($vars['_data'][$k]); -
    533                        break; -
    534                    case 'gzip': -
    535                        $vars['_data'][$k] = gzcompress($vars['_data'][$k]); -
    536                        break; -
    537                    case 'enum': -
    538                        $vars['_data'][$k] = $this->_table->enumIndex($k, $vars['_data'][$k]); -
    539                        break; -
    540                } -
    541            } -
    542        } -
    543 -
    544        $str = serialize($vars); -
    545         -
    546        $this->postSerialize($event); -
    547 -
    548        return $str; -
    549    } -
    550 -
    551    /** -
    552     * unseralize -
    553     * this method is automatically called everytime a Doctrine_Record object is unserialized -
    554     * -
    555     * @param string $serialized                Doctrine_Record as serialized string -
    556     * @throws Doctrine_Record_Exception        if the cleanData operation fails somehow -
    557     * @return void -
    558     */ -
    559    public function unserialize($serialized) -
    560    { -
    561        $event = new Doctrine_Event($this, Doctrine_Event::RECORD_UNSERIALIZE); -
    562 -
    563        $this->preUnserialize($event); -
    564 -
    565        $manager    = Doctrine_Manager::getInstance(); -
    566        $connection = $manager->getConnectionForComponent(get_class($this)); -
    567 -
    568        $this->_oid = self::$_index; -
    569        self::$_index++; -
    570 -
    571        $this->_table = $connection->getTable(get_class($this)); -
    572 -
    573        $array = unserialize($serialized); -
    574 -
    575        foreach($array as $k => $v) { -
    576            $this->$k = $v; -
    577        } -
    578 -
    579        foreach ($this->_data as $k => $v) { -
    580 -
    581            switch ($this->_table->getTypeOf($k)) { -
    582                case 'array': -
    583                case 'object': -
    584                    $this->_data[$k] = unserialize($this->_data[$k]); -
    585                    break; -
    586                case 'gzip': -
    587                   $this->_data[$k] = gzuncompress($this->_data[$k]); -
    588                    break; -
    589                case 'enum': -
    590                    $this->_data[$k] = $this->_table->enumValue($k, $this->_data[$k]); -
    591                    break; -
    592                 -
    593            } -
    594        } -
    595         -
    596        $this->_table->getRepository()->add($this); -
    597 -
    598        $this->cleanData($this->_data); -
    599 -
    600        $this->prepareIdentifiers($this->exists()); -
    601         -
    602        $this->postUnserialize($event); -
    603    } -
    604 -
    605    /** -
    606     * state -
    607     * returns / assigns the state of this record -
    608     * -
    609     * @param integer|string $state                 if set, this method tries to set the record state to $state -
    610     * @see Doctrine_Record::STATE_* constants -
    611     * -
    612     * @throws Doctrine_Record_State_Exception      if trying to set an unknown state -
    613     * @return null|integer -
    614     */ -
    615    public function state($state = null) -
    616    { -
    617        if ($state == null) { -
    618            return $this->_state; -
    619        } -
    620        $err = false; -
    621        if (is_integer($state)) { -
    622            if ($state >= 1 && $state <= 6) { -
    623                $this->_state = $state; -
    624            } else { -
    625                $err = true; -
    626            } -
    627        } else if (is_string($state)) { -
    628            $upper = strtoupper($state); -
    629             -
    630            $const = 'Doctrine_Record::STATE_' . $upper; -
    631            if (defined($const)) { -
    632                $this->_state = constant($const);   -
    633            } else { -
    634                $err = true; -
    635            } -
    636        } -
    637 -
    638        if ($this->_state === Doctrine_Record::STATE_TCLEAN || -
    639                $this->_state === Doctrine_Record::STATE_CLEAN) { -
    640            $this->_modified = array(); -
    641        } -
    642 -
    643        if ($err) { -
    644            throw new Doctrine_Record_State_Exception('Unknown record state ' . $state); -
    645        } -
    646    } -
    647 -
    648    /** -
    649     * refresh -
    650     * refresh internal data from the database -
    651     * -
    652     * @throws Doctrine_Record_Exception        When the refresh operation fails (when the database row -
    653     *                                          this record represents does not exist anymore) -
    654     * @return boolean -
    655     */ -
    656    public function refresh() -
    657    { -
    658        $id = $this->identifier(); -
    659        if ( ! is_array($id)) { -
    660            $id = array($id); -
    661        } -
    662        if (empty($id)) { -
    663            return false; -
    664        } -
    665        $id = array_values($id); -
    666 -
    667        // Use FETCH_ARRAY to avoid clearing object relations -
    668        $record = $this->getTable()->find($id, Doctrine::FETCH_ARRAY); -
    669 -
    670        if ($record === false) { -
    671            throw new Doctrine_Record_Exception('Failed to refresh. Record does not exist.'); -
    672        } -
    673 -
    674        $this->hydrate($record); -
    675 -
    676        $this->_modified = array(); -
    677 -
    678        $this->prepareIdentifiers(); -
    679 -
    680        $this->_state = Doctrine_Record::STATE_CLEAN; -
    681 -
    682        return $this; -
    683    } -
    684 -
    685    /** -
    686     * refresh -
    687     * refres data of related objects from the database -
    688     * -
    689     * @param string $name              name of a related component. -
    690     *                                  if set, this method only refreshes the specified related component -
    691     * -
    692     * @return Doctrine_Record          this object -
    693     */ -
    694    public function refreshRelated($name = null) -
    695    { -
    696        if (is_null($name)) { -
    697            foreach ($this->_table->getRelations() as $rel) { -
    698                $this->_references[$rel->getAlias()] = $rel->fetchRelatedFor($this); -
    699            } -
    700        } else { -
    701            $rel = $this->_table->getRelation($name); -
    702            $this->_references[$name] = $rel->fetchRelatedFor($this); -
    703        } -
    704    } -
    705 -
    706    /** -
    707     * clearRelated -
    708     * unsets all the relationships this object has -
    709     * -
    710     * (references to related objects still remain on Table objects) -
    711     */ -
    712    public function clearRelated() -
    713    { -
    714        $this->_references = array(); -
    715    } -
    716 -
    717    /** -
    718     * getTable -
    719     * returns the table object for this record -
    720     * -
    721     * @return Doctrine_Table        a Doctrine_Table object -
    722     */ -
    723    public function getTable() -
    724    { -
    725        return $this->_table; -
    726    } -
    727 -
    728    /** -
    729     * getData -
    730     * return all the internal data -
    731     * -
    732     * @return array                        an array containing all the properties -
    733     */ -
    734    public function getData() -
    735    { -
    736        return $this->_data; -
    737    } -
    738 -
    739    /** -
    740     * rawGet -
    741     * returns the value of a property, if the property is not yet loaded -
    742     * this method does NOT load it -
    743     * -
    744     * @param $name                         name of the property -
    745     * @throws Doctrine_Record_Exception    if trying to get an unknown property -
    746     * @return mixed -
    747     */ -
    748    public function rawGet($fieldName) -
    749    { -
    750        if ( ! isset($this->_data[$fieldName])) { -
    751            throw new Doctrine_Record_Exception('Unknown property '. $fieldName); -
    752        } -
    753        if ($this->_data[$fieldName] === self::$_null) { -
    754            return null; -
    755        } -
    756 -
    757        return $this->_data[$fieldName]; -
    758    } -
    759 -
    760    /** -
    761     * load -
    762     * loads all the uninitialized properties from the database -
    763     * -
    764     * @return boolean -
    765     */ -
    766    public function load() -
    767    { -
    768        // only load the data from database if the Doctrine_Record is in proxy state -
    769        if ($this->_state == Doctrine_Record::STATE_PROXY) { -
    770            $this->refresh(); -
    771            $this->_state = Doctrine_Record::STATE_CLEAN; -
    772            return true; -
    773        } -
    774        return false; -
    775    } -
    776 -
    777    /** -
    778     * get -
    779     * returns a value of a property or a related component -
    780     * -
    781     * @param mixed $name                       name of the property or related component -
    782     * @param boolean $load                     whether or not to invoke the loading procedure -
    783     * @throws Doctrine_Record_Exception        if trying to get a value of unknown property / related component -
    784     * @return mixed -
    785     */ -
    786    public function get($fieldName, $load = true) -
    787    { -
    788        $value = self::$_null; -
    789 -
    790        if (isset($this->_data[$fieldName])) { -
    791            // check if the value is the Doctrine_Null object located in self::$_null) -
    792            if ($this->_data[$fieldName] === self::$_null && $load) { -
    793                $this->load(); -
    794            } -
    795 -
    796            if ($this->_data[$fieldName] === self::$_null) { -
    797                $value = null; -
    798            } else { -
    799                $value = $this->_data[$fieldName]; -
    800            } -
    801            return $value; -
    802        } -
    803 -
    804        if (isset($this->_values[$fieldName])) { -
    805            return $this->_values[$fieldName]; -
    806        } -
    807 -
    808        try { -
    809            if ( ! isset($this->_references[$fieldName]) && $load) { -
    810 -
    811                $rel = $this->_table->getRelation($fieldName); -
    812 -
    813                $this->_references[$fieldName] = $rel->fetchRelatedFor($this); -
    814            } -
    815            return $this->_references[$fieldName]; -
    816 -
    817        } catch (Doctrine_Table_Exception $e) {  -
    818            foreach ($this->_table->getFilters() as $filter) { -
    819                if (($value = $filter->filterGet($this, $fieldName, $value)) !== null) { -
    820                    return $value; -
    821                } -
    822            } -
    823        } -
    824    } -
    825 -
    826    /** -
    827     * mapValue -
    828     * This simple method is used for mapping values to $values property. -
    829     * Usually this method is used internally by Doctrine for the mapping of -
    830     * aggregate values. -
    831     * -
    832     * @param string $name                  the name of the mapped value -
    833     * @param mixed $value                  mixed value to be mapped -
    834     * @return void -
    835     */ -
    836    public function mapValue($name, $value) -
    837    { -
    838        $this->_values[$name] = $value; -
    839    } -
    840 -
    841    /** -
    842     * set -
    843     * method for altering properties and Doctrine_Record references -
    844     * if the load parameter is set to false this method will not try to load uninitialized record data -
    845     * -
    846     * @param mixed $name                   name of the property or reference -
    847     * @param mixed $value                  value of the property or reference -
    848     * @param boolean $load                 whether or not to refresh / load the uninitialized record data -
    849     * -
    850     * @throws Doctrine_Record_Exception    if trying to set a value for unknown property / related component -
    851     * @throws Doctrine_Record_Exception    if trying to set a value of wrong type for related component -
    852     * -
    853     * @return Doctrine_Record -
    854     */ -
    855    public function set($fieldName, $value, $load = true) -
    856    { -
    857        if (isset($this->_data[$fieldName])) { -
    858            if ($value instanceof Doctrine_Record) { -
    859                $type = $this->_table->getTypeOf($fieldName); -
    860 -
    861                $id = $value->getIncremented(); -
    862 -
    863                if ($id !== null && $type !== 'object') { -
    864                    $value = $id; -
    865                } -
    866            } -
    867 -
    868            if ($load) { -
    869                $old = $this->get($fieldName, $load); -
    870            } else { -
    871                $old = $this->_data[$fieldName]; -
    872            } -
    873 -
    874            if ($old !== $value) { -
    875                if ($value === null) { -
    876                    $value = self::$_null; -
    877                } -
    878 -
    879                $this->_data[$fieldName] = $value; -
    880                $this->_modified[] = $fieldName; -
    881                switch ($this->_state) { -
    882                    case Doctrine_Record::STATE_CLEAN: -
    883                        $this->_state = Doctrine_Record::STATE_DIRTY; -
    884                        break; -
    885                    case Doctrine_Record::STATE_TCLEAN: -
    886                        $this->_state = Doctrine_Record::STATE_TDIRTY; -
    887                        break; -
    888                } -
    889            } -
    890        } else { -
    891            try { -
    892                $this->coreSetRelated($fieldName, $value); -
    893            } catch (Doctrine_Table_Exception $e) { -
    894                foreach ($this->_table->getFilters() as $filter) { -
    895                    if (($value = $filter->filterSet($this, $fieldName, $value)) !== null) { -
    896                        return $value; -
    897                    } -
    898                } -
    899            } -
    900        } -
    901    } -
    902     -
    903    /** -
    904     * DESCRIBE WHAT THIS METHOD DOES, PLEASE! -
    905     * @todo Refactor. What about composite keys? -
    906     */ -
    907    public function coreSetRelated($name, $value) -
    908    { -
    909        $rel = $this->_table->getRelation($name); -
    910 -
    911        // one-to-many or one-to-one relation -
    912        if ($rel instanceof Doctrine_Relation_ForeignKey || -
    913            $rel instanceof Doctrine_Relation_LocalKey) { -
    914            if ( ! $rel->isOneToOne()) { -
    915                // one-to-many relation found -
    916                if ( ! ($value instanceof Doctrine_Collection)) { -
    917                    throw new Doctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references."); -
    918                } -
    919                if (isset($this->_references[$name])) { -
    920                    $this->_references[$name]->setData($value->getData()); -
    921                    return $this; -
    922                } -
    923            } else { -
    924                if ($value !== self::$_null) { -
    925                    $relatedTable = $value->getTable(); -
    926                    $foreignFieldName = $relatedTable->getFieldName($rel->getForeign()); -
    927                    $localFieldName = $this->_table->getFieldName($rel->getLocal()); -
    928                     -
    929                    // one-to-one relation found -
    930                    if ( ! ($value instanceof Doctrine_Record)) { -
    931                        throw new Doctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Record or Doctrine_Null when setting one-to-one references."); -
    932                    } -
    933                    if ($rel instanceof Doctrine_Relation_LocalKey) { -
    934                        if ( ! empty($foreignFieldName) && $foreignFieldName != $value->getTable()->getIdentifier()) { -
    935                            $this->set($localFieldName, $value->rawGet($foreignFieldName), false); -
    936                        } else { -
    937                            $this->set($localFieldName, $value, false); -
    938                        } -
    939                    } else { -
    940                        $value->set($foreignFieldName, $this, false); -
    941                    } -
    942                } -
    943            } -
    944 -
    945        } else if ($rel instanceof Doctrine_Relation_Association) { -
    946            // join table relation found -
    947            if ( ! ($value instanceof Doctrine_Collection)) { -
    948                throw new Doctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Collection when setting many-to-many references."); -
    949            } -
    950        } -
    951 -
    952        $this->_references[$name] = $value; -
    953    } -
    954 -
    955    /** -
    956     * contains -
    957     * -
    958     * @param string $name -
    959     * @return boolean -
    960     */ -
    961    public function contains($fieldName) -
    962    { -
    963        if (isset($this->_data[$fieldName])) { -
    964            return true; -
    965        } -
    966        if (isset($this->_id[$fieldName])) { -
    967            return true; -
    968        } -
    969        if (isset($this->_values[$fieldName])) { -
    970            return true;                                       -
    971        } -
    972        if (isset($this->_references[$fieldName]) &&  -
    973            $this->_references[$fieldName] !== self::$_null) { -
    974 -
    975            return true; -
    976        } -
    977        return false; -
    978    } -
    979 -
    980    /** -
    981     * @param string $name -
    982     * @return void -
    983     */ -
    984    public function __unset($fieldName) -
    985    { -
    986        if (isset($this->_data[$fieldName])) { -
    987            $this->_data[$fieldName] = array(); -
    988        } -
    989        // todo: what to do with references ? -
    990    } -
    991 -
    992    /** -
    993     * applies the changes made to this object into database -
    994     * this method is smart enough to know if any changes are made -
    995     * and whether to use INSERT or UPDATE statement -
    996     * -
    997     * this method also saves the related components -
    998     * -
    999     * @param Doctrine_Connection $conn                 optional connection parameter -
    1000     * @return void -
    1001     */ -
    1002    public function save(Doctrine_Connection $conn = null) -
    1003    { -
    1004        if ($conn === null) { -
    1005            $conn = $this->_table->getConnection(); -
    1006        } -
    1007        $conn->unitOfWork->saveGraph($this); -
    1008    } -
    1009 -
    1010    /** -
    1011     * Tries to save the object and all its related components. -
    1012     * In contrast to Doctrine_Record::save(), this method does not -
    1013     * throw an exception when validation fails but returns TRUE on -
    1014     * success or FALSE on failure. -
    1015     *  -
    1016     * @param Doctrine_Connection $conn                 optional connection parameter -
    1017     * @return TRUE if the record was saved sucessfully without errors, FALSE otherwise. -
    1018     */ -
    1019    public function trySave(Doctrine_Connection $conn = null) { -
    1020        try { -
    1021            $this->save($conn); -
    1022            return true; -
    1023        } catch (Doctrine_Validator_Exception $ignored) { -
    1024            return false; -
    1025        } -
    1026    } -
    1027 -
    1028    /** -
    1029     * replace -
    1030     * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT -
    1031     * query, except that if there is already a row in the table with the same -
    1032     * key field values, the REPLACE query just updates its values instead of -
    1033     * inserting a new row. -
    1034     * -
    1035     * The REPLACE type of query does not make part of the SQL standards. Since -
    1036     * practically only MySQL and SQLIte implement it natively, this type of -
    1037     * query isemulated through this method for other DBMS using standard types -
    1038     * of queries inside a transaction to assure the atomicity of the operation. -
    1039     * -
    1040     * @param Doctrine_Connection $conn             optional connection parameter -
    1041     * @throws Doctrine_Connection_Exception        if some of the key values was null -
    1042     * @throws Doctrine_Connection_Exception        if there were no key fields -
    1043     * @throws Doctrine_Connection_Exception        if something fails at database level -
    1044     * @return integer                              number of rows affected -
    1045     */ -
    1046    public function replace(Doctrine_Connection $conn = null) -
    1047    { -
    1048        if ($conn === null) { -
    1049            $conn = $this->_table->getConnection(); -
    1050        } -
    1051 -
    1052        return $conn->replace($this->_table, $this->getPrepared(), $this->_id); -
    1053    } -
    1054 -
    1055    /** -
    1056     * returns an array of modified fields and associated values -
    1057     * @return array -
    1058     * @todo What about a better name? getModifiedFields? -
    1059     */ -
    1060    public function getModified() -
    1061    { -
    1062        $a = array(); -
    1063 -
    1064        foreach ($this->_modified as $k => $v) { -
    1065            $a[$v] = $this->_data[$v]; -
    1066        } -
    1067        return $a; -
    1068    } -
    1069     -
    1070    /** -
    1071     * REDUNDANT? -
    1072     */ -
    1073    public function modifiedFields() -
    1074    { -
    1075        $a = array(); -
    1076 -
    1077        foreach ($this->_modified as $k => $v) { -
    1078            $a[$v] = $this->_data[$v]; -
    1079        } -
    1080        return $a; -
    1081    } -
    1082 -
    1083    /** -
    1084     * getPrepared -
    1085     * -
    1086     * returns an array of modified fields and values with data preparation -
    1087     * adds column aggregation inheritance and converts Records into primary key values -
    1088     * -
    1089     * @param array $array -
    1090     * @return array -
    1091     * @todo What about a little bit more expressive name? getPreparedData? -
    1092     */ -
    1093    public function getPrepared(array $array = array())  -
    1094    { -
    1095        $a = array(); -
    1096 -
    1097        if (empty($array)) { -
    1098            $modifiedFields = $this->_modified; -
    1099        } -
    1100 -
    1101        foreach ($modifiedFields as $field) { -
    1102            $type = $this->_table->getTypeOf($field); -
    1103 -
    1104            if ($this->_data[$field] === self::$_null) { -
    1105                $a[$field] = null; -
    1106                continue; -
    1107            } -
    1108 -
    1109            switch ($type) { -
    1110                case 'array': -
    1111                case 'object': -
    1112                    $a[$field] = serialize($this->_data[$field]); -
    1113                    break; -
    1114                case 'gzip': -
    1115                    $a[$field] = gzcompress($this->_data[$field],5); -
    1116                    break; -
    1117                case 'boolean': -
    1118                    $a[$field] = $this->getTable()->getConnection()->convertBooleans($this->_data[$field]); -
    1119                break; -
    1120                case 'enum': -
    1121                    $a[$field] = $this->_table->enumIndex($field, $this->_data[$field]); -
    1122                    break; -
    1123                default: -
    1124                    if ($this->_data[$field] instanceof Doctrine_Record) { -
    1125                        $this->_data[$field] = $this->_data[$field]->getIncremented(); -
    1126                    } -
    1127                    /** TODO: -
    1128                    if ($this->_data[$v] === null) { -
    1129                        throw new Doctrine_Record_Exception('Unexpected null value.'); -
    1130                    } -
    1131                    */ -
    1132 -
    1133                    $a[$field] = $this->_data[$field]; -
    1134            } -
    1135        } -
    1136        $map = $this->_table->inheritanceMap; -
    1137        foreach ($map as $k => $v) { -
    1138            $old = $this->get($k, false); -
    1139 -
    1140            if ((string) $old !== (string) $v || $old === null) { -
    1141                $a[$k] = $v; -
    1142                $this->_data[$k] = $v; -
    1143            } -
    1144        } -
    1145 -
    1146        return $a; -
    1147    } -
    1148 -
    1149    /** -
    1150     * count -
    1151     * this class implements countable interface -
    1152     * -
    1153     * @return integer          the number of columns in this record -
    1154     */ -
    1155    public function count() -
    1156    { -
    1157        return count($this->_data); -
    1158    } -
    1159 -
    1160    /** -
    1161     * alias for count() -
    1162     * -
    1163     * @return integer          the number of columns in this record -
    1164     */ -
    1165    public function columnCount() -
    1166    { -
    1167        return $this->count(); -
    1168    } -
    1169 -
    1170    /** -
    1171     * toArray -
    1172     * returns the record as an array -
    1173     * -
    1174     * @param boolean $deep - Return also the relations -
    1175     * @return array -
    1176     */ -
    1177    public function toArray($deep = false, $prefixKey = false) -
    1178    { -
    1179        $a = array(); -
    1180 -
    1181        foreach ($this as $column => $value) { -
    1182            if ($value === self::$_null || is_object($value)) { -
    1183                $value = null; -
    1184            } -
    1185            $a[$column] = $value; -
    1186        } -
    1187        if ($this->_table->getIdentifierType() ==  Doctrine::IDENTIFIER_AUTOINC) { -
    1188            $i      = $this->_table->getIdentifier(); -
    1189            $a[$i]  = $this->getIncremented(); -
    1190        } -
    1191        if ($deep) { -
    1192            foreach ($this->_references as $key => $relation) { -
    1193                if ( ! $relation instanceof Doctrine_Null) { -
    1194                    $a[$key] = $relation->toArray($deep, $prefixKey); -
    1195                } -
    1196            } -
    1197        } -
    1198        return array_merge($a, $this->_values); -
    1199    } -
    1200    public function fromArray($array) -
    1201    { -
    1202        if (is_array($array)) { -
    1203            foreach ($array as $key => $value) { -
    1204                if ($this->getTable()->hasRelation($key)) { -
    1205                    $this->$key->fromArray($value); -
    1206                } else if($this->getTable()->hasColumn($key)) { -
    1207                    $this->set($key, $value); -
    1208                } -
    1209            } -
    1210        } -
    1211    } -
    1212    public function exportTo($type, $deep = false) -
    1213    { -
    1214        if ($type == 'array') { -
    1215            return $this->toArray($deep); -
    1216        } else { -
    1217            return Doctrine_Parser::dump($this->toArray($deep, true), $type); -
    1218        } -
    1219    } -
    1220    public function importFrom($type, $data) -
    1221    { -
    1222        if ($type == 'array') { -
    1223            return $this->fromArray($data); -
    1224        } else { -
    1225            return $this->fromArray(Doctrine_Parser::load($data, $type)); -
    1226        } -
    1227    } -
    1228 -
    1229    /** -
    1230     * exists -
    1231     * returns true if this record is persistent, otherwise false -
    1232     * -
    1233     * @return boolean -
    1234     */ -
    1235    public function exists() -
    1236    { -
    1237        return ($this->_state !== Doctrine_Record::STATE_TCLEAN && -
    1238                $this->_state !== Doctrine_Record::STATE_TDIRTY); -
    1239    } -
    1240 -
    1241    /** -
    1242     * isModified -
    1243     * returns true if this record was modified, otherwise false -
    1244     * -
    1245     * @return boolean -
    1246     */ -
    1247    public function isModified() -
    1248    { -
    1249        return ($this->_state === Doctrine_Record::STATE_DIRTY || -
    1250                $this->_state === Doctrine_Record::STATE_TDIRTY); -
    1251    } -
    1252 -
    1253    /** -
    1254     * method for checking existence of properties and Doctrine_Record references -
    1255     * @param mixed $name               name of the property or reference -
    1256     * @return boolean -
    1257     */ -
    1258    public function hasRelation($fieldName) -
    1259    { -
    1260        if (isset($this->_data[$fieldName]) || isset($this->_id[$fieldName])) { -
    1261            return true; -
    1262        } -
    1263        return $this->_table->hasRelation($fieldName); -
    1264    } -
    1265 -
    1266    /** -
    1267     * getIterator -
    1268     * @return Doctrine_Record_Iterator     a Doctrine_Record_Iterator that iterates through the data -
    1269     */ -
    1270    public function getIterator() -
    1271    { -
    1272        return new Doctrine_Record_Iterator($this); -
    1273    } -
    1274 -
    1275    /** -
    1276     * deletes this data access object and all the related composites -
    1277     * this operation is isolated by a transaction -
    1278     * -
    1279     * this event can be listened by the onPreDelete and onDelete listeners -
    1280     * -
    1281     * @return boolean      true on success, false on failure -
    1282     */ -
    1283    public function delete(Doctrine_Connection $conn = null) -
    1284    { -
    1285        if ($conn == null) { -
    1286            $conn = $this->_table->getConnection(); -
    1287        } -
    1288        return $conn->unitOfWork->delete($this); -
    1289    } -
    1290 -
    1291    /** -
    1292     * copy -
    1293     * returns a copy of this object -
    1294     * -
    1295     * @return Doctrine_Record -
    1296     */ -
    1297    public function copy() -
    1298    { -
    1299        $data = $this->_data; -
    1300 -
    1301        if ($this->_table->getIdentifierType() === Doctrine::IDENTIFIER_AUTOINC) { -
    1302            $id = $this->_table->getIdentifier(); -
    1303 -
    1304            unset($data[$id]); -
    1305        } -
    1306 -
    1307        $ret = $this->_table->create($data); -
    1308        $modified = array(); -
    1309 -
    1310        foreach ($data as $key => $val) { -
    1311            if ( ! ($val instanceof Doctrine_Null)) { -
    1312                $ret->_modified[] = $key; -
    1313            } -
    1314        }  -
    1315 -
    1316        return $ret; -
    1317    } -
    1318 -
    1319    /** -
    1320     * copyDeep -
    1321     * returns a copy of this object and all its related objects -
    1322     * -
    1323     * @return Doctrine_Record -
    1324     */ -
    1325    public function copyDeep() { -
    1326        $copy = $this->copy(); -
    1327 -
    1328        foreach ($this->_references as $key => $value) { -
    1329            if ($value instanceof Doctrine_Collection) { -
    1330                foreach ($value as $record) { -
    1331                    $copy->{$key}[] = $record->copyDeep(); -
    1332                } -
    1333            } else { -
    1334                $copy->set($key, $value->copyDeep()); -
    1335            } -
    1336        } -
    1337        return $copy; -
    1338    } -
    1339 -
    1340    /** -
    1341     * assignIdentifier -
    1342     * -
    1343     * @param integer $id -
    1344     * @return void -
    1345     */ -
    1346    public function assignIdentifier($id = false) -
    1347    { -
    1348        if ($id === false) { -
    1349            $this->_id       = array(); -
    1350            $this->_data     = $this->cleanData($this->_data); -
    1351            $this->_state    = Doctrine_Record::STATE_TCLEAN; -
    1352            $this->_modified = array(); -
    1353        } elseif ($id === true) { -
    1354            $this->prepareIdentifiers(true); -
    1355            $this->_state    = Doctrine_Record::STATE_CLEAN; -
    1356            $this->_modified = array(); -
    1357        } else { -
    1358            $name = $this->_table->getIdentifier();    -
    1359            $this->_id[$name] = $id; -
    1360            $this->_data[$name] = $id; -
    1361            $this->_state     = Doctrine_Record::STATE_CLEAN; -
    1362            $this->_modified  = array(); -
    1363        } -
    1364    } -
    1365 -
    1366    /** -
    1367     * returns the primary keys of this object -
    1368     * -
    1369     * @return array -
    1370     */ -
    1371    public function identifier() -
    1372    { -
    1373        return $this->_id; -
    1374    } -
    1375 -
    1376    /** -
    1377     * returns the value of autoincremented primary key of this object (if any) -
    1378     * -
    1379     * @return integer -
    1380     * @todo Better name?  -
    1381     */ -
    1382    final public function getIncremented() -
    1383    { -
    1384        $id = current($this->_id); -
    1385        if ($id === false) { -
    1386            return null; -
    1387        } -
    1388 -
    1389        return $id; -
    1390    } -
    1391 -
    1392    /** -
    1393     * getLast -
    1394     * this method is used internally be Doctrine_Query -
    1395     * it is needed to provide compatibility between -
    1396     * records and collections -
    1397     * -
    1398     * @return Doctrine_Record -
    1399     */ -
    1400    public function getLast() -
    1401    { -
    1402        return $this; -
    1403    } -
    1404 -
    1405    /** -
    1406     * hasRefence -
    1407     * @param string $name -
    1408     * @return boolean -
    1409     */ -
    1410    public function hasReference($name) -
    1411    { -
    1412        return isset($this->_references[$name]); -
    1413    } -
    1414 -
    1415    /** -
    1416     * reference -
    1417     * -
    1418     * @param string $name -
    1419     */ -
    1420    public function reference($name) -
    1421    { -
    1422        if (isset($this->_references[$name])) { -
    1423            return $this->_references[$name]; -
    1424        } -
    1425    } -
    1426 -
    1427    /** -
    1428     * obtainReference -
    1429     * -
    1430     * @param string $name -
    1431     * @throws Doctrine_Record_Exception        if trying to get an unknown related component -
    1432     */ -
    1433    public function obtainReference($name) -
    1434    { -
    1435        if (isset($this->_references[$name])) { -
    1436            return $this->_references[$name]; -
    1437        } -
    1438        throw new Doctrine_Record_Exception("Unknown reference $name"); -
    1439    } -
    1440 -
    1441    /** -
    1442     * getReferences -
    1443     * @return array    all references -
    1444     */ -
    1445    public function getReferences() -
    1446    { -
    1447        return $this->_references; -
    1448    } -
    1449 -
    1450    /** -
    1451     * setRelated -
    1452     * -
    1453     * @param string $alias -
    1454     * @param Doctrine_Access $coll -
    1455     */ -
    1456    final public function setRelated($alias, Doctrine_Access $coll) -
    1457    { -
    1458        $this->_references[$alias] = $coll; -
    1459    } -
    1460 -
    1461    /** -
    1462     * loadReference -
    1463     * loads a related component -
    1464     * -
    1465     * @throws Doctrine_Table_Exception             if trying to load an unknown related component -
    1466     * @param string $name -
    1467     * @return void -
    1468     */ -
    1469    public function loadReference($name) -
    1470    { -
    1471        $rel = $this->_table->getRelation($name); -
    1472        $this->_references[$name] = $rel->fetchRelatedFor($this); -
    1473    } -
    1474 -
    1475    /** -
    1476     * merge -
    1477     * merges this record with an array of values -
    1478     * -
    1479     * @param array $values -
    1480     * @return void -
    1481     */ -
    1482    public function merge(array $values) -
    1483    { -
    1484        foreach ($this->_table->getFieldNames() as $fieldName) { -
    1485            try { -
    1486                if (isset($values[$fieldName])) { -
    1487                    $this->set($fieldName, $values[$fieldName]); -
    1488                } -
    1489            } catch (Doctrine_Exception $e) { -
    1490                // silence all exceptions -
    1491            } -
    1492        } -
    1493    } -
    1494 -
    1495    /** -
    1496     * call -
    1497     * -
    1498     * @param string|array $callback    valid callback -
    1499     * @param string $column            column name -
    1500     * @param mixed arg1 ... argN       optional callback arguments -
    1501     * @return Doctrine_Record -
    1502     */ -
    1503    public function call($callback, $column) -
    1504    { -
    1505        $args = func_get_args(); -
    1506        array_shift($args); -
    1507 -
    1508        if (isset($args[0])) { -
    1509            $fieldName = $args[0]; -
    1510            $args[0] = $this->get($fieldName); -
    1511 -
    1512            $newvalue = call_user_func_array($callback, $args); -
    1513 -
    1514            $this->_data[$fieldName] = $newvalue; -
    1515        } -
    1516        return $this; -
    1517    } -
    1518 -
    1519    /** -
    1520     * getter for node assciated with this record -
    1521     * -
    1522     * @return mixed if tree returns Doctrine_Node otherwise returns false -
    1523     */     -
    1524    public function getNode()  -
    1525    { -
    1526        if ( ! $this->_table->isTree()) { -
    1527            return false; -
    1528        } -
    1529 -
    1530        if ( ! isset($this->_node)) { -
    1531            $this->_node = Doctrine_Node::factory($this, -
    1532                                              $this->getTable()->getOption('treeImpl'), -
    1533                                              $this->getTable()->getOption('treeOptions') -
    1534                                              ); -
    1535        } -
    1536         -
    1537        return $this->_node; -
    1538    } -
    1539    /** -
    1540     * revert -
    1541     * reverts this record to given version, this method only works if versioning plugin -
    1542     * is enabled -
    1543     * -
    1544     * @throws Doctrine_Record_Exception    if given version does not exist -
    1545     * @param integer $version      an integer > 1 -
    1546     * @return Doctrine_Record      this object -
    1547     */ -
    1548    public function revert($version) -
    1549    { -
    1550        $data = $this->_table -
    1551                ->getTemplate('Doctrine_Template_Versionable') -
    1552                ->getAuditLog() -
    1553                ->getVersion($this, $version); -
    1554 -
    1555        if ( ! isset($data[0])) { -
    1556            throw new Doctrine_Record_Exception('Version ' . $version . ' does not exist!'); -
    1557        } -
    1558 -
    1559        $this->_data = $data[0]; -
    1560 -
    1561        return $this; -
    1562    } -
    1563    public function unshiftFilter(Doctrine_Record_Filter $filter) -
    1564    { -
    1565        return $this->_table->unshiftFilter($filter); -
    1566    } -
    1567    /** -
    1568     * unlink -
    1569     * removes links from this record to given records -
    1570     * if no ids are given, it removes all links -
    1571     * -
    1572     * @param string $alias     related component alias -
    1573     * @param array $ids        the identifiers of the related records -
    1574     * @return Doctrine_Record  this object -
    1575     */ -
    1576    public function unlink($alias, $ids = array()) -
    1577    { -
    1578        $ids = (array) $ids; -
    1579         -
    1580        $q = new Doctrine_Query(); -
    1581 -
    1582        $rel = $this->getTable()->getRelation($alias); -
    1583 -
    1584        if ($rel instanceof Doctrine_Relation_Association) { -
    1585            $q->delete() -
    1586              ->from($rel->getAssociationTable()->getComponentName()) -
    1587              ->where($rel->getLocal() . ' = ?', array_values($this->identifier())); -
    1588 -
    1589            if (count($ids) > 0) { -
    1590                $q->whereIn($rel->getForeign(), $ids); -
    1591            } -
    1592 -
    1593            $q->execute(); -
    1594 -
    1595        } else if ($rel instanceof Doctrine_Relation_ForeignKey) { -
    1596            $q->update($rel->getTable()->getComponentName()) -
    1597              ->set($rel->getForeign(), '?', array(null)) -
    1598              ->addWhere($rel->getForeign() . ' = ?', array_values($this->identifier())); -
    1599 -
    1600            if (count($ids) > 0) { -
    1601                $q->whereIn($rel->getTable()->getIdentifier(), $ids); -
    1602            } -
    1603 -
    1604            $q->execute(); -
    1605        } -
    1606        if (isset($this->_references[$alias])) { -
    1607            foreach ($this->_references[$alias] as $k => $record) { -
    1608                if (in_array(current($record->identifier()), $ids)) { -
    1609                    $this->_references[$alias]->remove($k); -
    1610                } -
    1611            } -
    1612            $this->_references[$alias]->takeSnapshot(); -
    1613        } -
    1614        return $this; -
    1615    } -
    1616 -
    1617    /** -
    1618     * __call -
    1619     * this method is a magic method that is being used for method overloading -
    1620     * -
    1621     * the function of this method is to try to find given method from the templates -
    1622     * this record is using and if it finds given method it will execute it -
    1623     * -
    1624     * So, in sense, this method replicates the usage of mixins (as seen in some programming languages) -
    1625     * -
    1626     * @param string $method        name of the method -
    1627     * @param array $args           method arguments -
    1628     * @return mixed                the return value of the given method -
    1629     */ -
    1630    public function __call($method, $args)  -
    1631    { -
    1632        if (($template = $this->_table->getMethodOwner($method)) !== false) { -
    1633            $template->setInvoker($this); -
    1634            return call_user_func_array(array($template, $method), $args); -
    1635        } -
    1636         -
    1637        foreach ($this->_table->getTemplates() as $template) { -
    1638            if (method_exists($template, $method)) { -
    1639                $template->setInvoker($this); -
    1640                $this->_table->setMethodOwner($method, $template); -
    1641                 -
    1642                return call_user_func_array(array($template, $method), $args); -
    1643            } -
    1644        } -
    1645         -
    1646        throw new Doctrine_Record_Exception('Unknown method ' . $method); -
    1647    } -
    1648 -
    1649    /** -
    1650     * used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE -
    1651     * -
    1652     */     -
    1653    public function deleteNode() { -
    1654        $this->getNode()->delete(); -
    1655    } -
    1656    public function toString() -
    1657    { -
    1658        return Doctrine::dump(get_object_vars($this)); -
    1659    } -
    1660 -
    1661    /** -
    1662     * returns a string representation of this object -
    1663     */ -
    1664    public function __toString() -
    1665    { -
    1666        return (string) $this->_oid; -
    1667    } -
    1668} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record_Abstract.html b/tests_old/coverage/Doctrine_Record_Abstract.html deleted file mode 100644 index 313c1fccf..000000000 --- a/tests_old/coverage/Doctrine_Record_Abstract.html +++ /dev/null @@ -1,1014 +0,0 @@ - - - Coverage for Doctrine_Record_Abstract - - -

    Coverage for Doctrine_Record_Abstract

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Access'); -
    22/** -
    23 * Doctrine_Record_Abstract -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Record -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 */ -
    33abstract class Doctrine_Record_Abstract extends Doctrine_Access -
    34{ -
    35    /** -
    36     * @param Doctrine_Table $_table     reference to associated Doctrine_Table instance -
    37     */ -
    38    protected $_table; -
    39 -
    40    /** -
    41     * addListener -
    42     * -
    43     * @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener -
    44     * @return Doctrine_Record -
    45     */ -
    46    public function addListener($listener, $name = null) -
    47    { -
    48        $this->_table->addRecordListener($listener, $name = null); -
    49 -
    50        return $this; -
    51    } -
    52 -
    53    /** -
    54     * getListener -
    55     * -
    56     * @return Doctrine_EventListener_Interface|Doctrine_Overloadable -
    57     */ -
    58    public function getListener() -
    59    { -
    60        return $this->_table->getRecordListener(); -
    61    } -
    62 -
    63    /** -
    64     * setListener -
    65     * -
    66     * @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener -
    67     * @return Doctrine_Record -
    68     */ -
    69    public function setListener($listener) -
    70    { -
    71        $this->_table->setRecordListener($listener); -
    72 -
    73        return $this; -
    74    } -
    75 -
    76    /** -
    77     * index -
    78     * defines or retrieves an index -
    79     * if the second parameter is set this method defines an index -
    80     * if not this method retrieves index named $name -
    81     * -
    82     * @param string $name              the name of the index -
    83     * @param array $definition         the definition array -
    84     * @return mixed -
    85     */ -
    86    public function index($name, array $definition = array()) -
    87    { -
    88        if ( ! $definition) { -
    89            return $this->_table->getIndex($name); -
    90        } else { -
    91            return $this->_table->addIndex($name, $definition); -
    92        } -
    93    } -
    94    public function setAttribute($attr, $value) -
    95    { -
    96        $this->_table->setAttribute($attr, $value); -
    97    } -
    98    public function setTableName($tableName) -
    99    { -
    100        $this->_table->setTableName($tableName); -
    101    } -
    102    public function setInheritanceMap($map) -
    103    { -
    104        $this->_table->setOption('inheritanceMap', $map); -
    105    } -
    106 -
    107    public function setSubclasses($map) -
    108    { -
    109        if (isset($map[get_class($this)])) { -
    110            $this->_table->setOption('inheritanceMap', $map[get_class($this)]); -
    111            return; -
    112        } -
    113        $this->_table->setOption('subclasses', array_keys($map)); -
    114        $conn = $this->_table->getConnection();  -
    115        foreach ($map as $key => $value) { -
    116            $table = $conn->getTable($key); -
    117            $table->setOption('inheritanceMap', $value); -
    118        } -
    119    } -
    120 -
    121    /** -
    122     * attribute -
    123     * sets or retrieves an option -
    124     * -
    125     * @see Doctrine::ATTR_* constants   availible attributes -
    126     * @param mixed $attr -
    127     * @param mixed $value -
    128     * @return mixed -
    129     */ -
    130    public function attribute($attr, $value) -
    131    { -
    132        if ($value == null) { -
    133            if (is_array($attr)) { -
    134                foreach ($attr as $k => $v) { -
    135                    $this->_table->setAttribute($k, $v); -
    136                } -
    137            } else { -
    138                return $this->_table->getAttribute($attr); -
    139            } -
    140        } else { -
    141            $this->_table->setAttribute($attr, $value); -
    142        }     -
    143    } -
    144 -
    145    /** -
    146     * option -
    147     * sets or retrieves an option -
    148     * -
    149     * @see Doctrine_Table::$options    availible options -
    150     * @param mixed $name               the name of the option -
    151     * @param mixed $value              options value -
    152     * @return mixed -
    153     */ -
    154    public function option($name, $value = null) -
    155    { -
    156        if ($value === null) { -
    157            if (is_array($name)) { -
    158                foreach ($name as $k => $v) { -
    159                    $this->_table->setOption($k, $v); -
    160                } -
    161            } else { -
    162                return $this->_table->getOption($name); -
    163            } -
    164        } else { -
    165            $this->_table->setOption($name, $value); -
    166        } -
    167    } -
    168 -
    169    /** -
    170     * ownsOne -
    171     * binds One-to-One composite relation -
    172     * -
    173     * @param string $componentName     the name of the related component -
    174     * @param string $options           relation options -
    175     * @see Doctrine_Relation::_$definition -
    176     * @return Doctrine_Record          this object -
    177     */ -
    178    public function ownsOne() -
    179    { -
    180        $this->_table->bind(func_get_args(), Doctrine_Relation::ONE_COMPOSITE); -
    181         -
    182        return $this; -
    183    } -
    184 -
    185    /** -
    186     * ownsMany -
    187     * binds One-to-Many / Many-to-Many composite relation -
    188     * -
    189     * @param string $componentName     the name of the related component -
    190     * @param string $options           relation options -
    191     * @see Doctrine_Relation::_$definition -
    192     * @return Doctrine_Record          this object -
    193     */ -
    194    public function ownsMany() -
    195    { -
    196        $this->_table->bind(func_get_args(), Doctrine_Relation::MANY_COMPOSITE); -
    197        return $this; -
    198    } -
    199 -
    200    /** -
    201     * hasOne -
    202     * binds One-to-One aggregate relation -
    203     * -
    204     * @param string $componentName     the name of the related component -
    205     * @param string $options           relation options -
    206     * @see Doctrine_Relation::_$definition -
    207     * @return Doctrine_Record          this object -
    208     */ -
    209    public function hasOne() -
    210    { -
    211        $this->_table->bind(func_get_args(), Doctrine_Relation::ONE_AGGREGATE); -
    212 -
    213        return $this; -
    214    } -
    215 -
    216    /** -
    217     * hasMany -
    218     * binds One-to-Many / Many-to-Many aggregate relation -
    219     * -
    220     * @param string $componentName     the name of the related component -
    221     * @param string $options           relation options -
    222     * @see Doctrine_Relation::_$definition -
    223     * @return Doctrine_Record          this object -
    224     */ -
    225    public function hasMany() -
    226    { -
    227        $this->_table->bind(func_get_args(), Doctrine_Relation::MANY_AGGREGATE); -
    228 -
    229        return $this; -
    230    } -
    231 -
    232    /** -
    233     * hasColumn -
    234     * sets a column definition -
    235     * -
    236     * @param string $name -
    237     * @param string $type -
    238     * @param integer $length -
    239     * @param mixed $options -
    240     * @return void -
    241     */ -
    242    public function hasColumn($name, $type, $length = 2147483647, $options = "") -
    243    { -
    244        $this->_table->setColumn($name, $type, $length, $options); -
    245    } -
    246    public function hasColumns(array $definitions) -
    247    { -
    248        foreach ($definitions as $name => $options) { -
    249            $this->hasColumn($name, $options['type'], $options['length'], $options); -
    250        } -
    251    }  -
    252    /** -
    253     * loadTemplate -
    254     * -
    255     * @param string $template -
    256     */ -
    257    public function loadTemplate($template, array $options = array()) -
    258    { -
    259        $this->actAs($template, $options); -
    260    } -
    261 -
    262    /** -
    263     * bindQueryParts -
    264     * binds query parts to given component -
    265     * -
    266     * @param array $queryParts         an array of pre-bound query parts -
    267     * @return Doctrine_Record          this object -
    268     */ -
    269    public function bindQueryParts(array $queryParts) -
    270    { -
    271     $this->_table->bindQueryParts($queryParts); -
    272 -
    273        return $this; -
    274    } -
    275 -
    276    /** -
    277     * actAs -
    278     * loads a given plugin  -
    279     * -
    280     * @param mixed $tpl -
    281     * @param array $options -
    282     */ -
    283    public function actAs($tpl, array $options = array()) -
    284    { -
    285 -
    286        if ( ! is_object($tpl)) { -
    287            if (class_exists($tpl, true)) { -
    288                $tpl = new $tpl($options); -
    289            } else { -
    290                $className = 'Doctrine_Template_' . $tpl; -
    291 -
    292                if ( ! class_exists($className, true)) { -
    293                    throw new Doctrine_Record_Exception("Couldn't load plugin."); -
    294                } -
    295 -
    296 -
    297                $tpl = new $className($options); -
    298            } -
    299        } -
    300 -
    301        if ( ! ($tpl instanceof Doctrine_Template)) { -
    302            throw new Doctrine_Record_Exception('Loaded plugin class is not an istance of Doctrine_Template.'); -
    303        } -
    304        $className = get_class($tpl); -
    305         -
    306        $this->_table->addTemplate($className, $tpl); -
    307 -
    308        $tpl->setTable($this->_table); -
    309        $tpl->setUp(); -
    310        $tpl->setTableDefinition(); -
    311 -
    312        return $this; -
    313    } -
    314 -
    315    /** -
    316     * check -
    317     * adds a check constraint -
    318     * -
    319     * @param mixed $constraint     either a SQL constraint portion or an array of CHECK constraints -
    320     * @param string $name          optional constraint name -
    321     * @return Doctrine_Record      this object -
    322     */ -
    323    public function check($constraint, $name = null) -
    324    { -
    325        if (is_array($constraint)) { -
    326            foreach ($constraint as $name => $def) { -
    327                $this->_table->addCheckConstraint($def, $name); -
    328            } -
    329        } else { -
    330            $this->_table->addCheckConstraint($constraint, $name); -
    331        } -
    332        return $this; -
    333    } -
    334} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record_Exception.html b/tests_old/coverage/Doctrine_Record_Exception.html deleted file mode 100644 index 878065e7f..000000000 --- a/tests_old/coverage/Doctrine_Record_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Record_Exception - - -

    Coverage for Doctrine_Record_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Record -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Record_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record_Filter.html b/tests_old/coverage/Doctrine_Record_Filter.html deleted file mode 100644 index 9ff7274aa..000000000 --- a/tests_old/coverage/Doctrine_Record_Filter.html +++ /dev/null @@ -1,197 +0,0 @@ - - - Coverage for Doctrine_Record_Filter - - -

    Coverage for Doctrine_Record_Filter

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Record.php 1298 2007-05-01 19:26:03Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Record_Filter -
    24 * Filters the record getters and setters -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Record -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 1298 $ -
    33 */ -
    34abstract class Doctrine_Record_Filter -
    35{ -
    36    protected $_table; -
    37 -
    38    public function setTable(Doctrine_Table $table) -
    39    { -
    40        $this->_table = $table; -
    41    } -
    42    public function getTable() -
    43    { -
    44        return $this->_table; -
    45    } -
    46 -
    47    /** -
    48     * filterSet -
    49     * defines an implementation for filtering the set() method of Doctrine_Record -
    50     * -
    51     * @param mixed $name                       name of the property or related component -
    52     */ -
    53    abstract public function filterSet(Doctrine_Record $record, $name, $value); -
    54 -
    55    /** -
    56     * filterGet -
    57     * defines an implementation for filtering the get() method of Doctrine_Record -
    58     * -
    59     * @param mixed $name                       name of the property or related component -
    60     */ -
    61    abstract public function filterGet(Doctrine_Record $record, $name); -
    62}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record_Filter_Compound.html b/tests_old/coverage/Doctrine_Record_Filter_Compound.html deleted file mode 100644 index 55d6db987..000000000 --- a/tests_old/coverage/Doctrine_Record_Filter_Compound.html +++ /dev/null @@ -1,311 +0,0 @@ - - - Coverage for Doctrine_Record_Filter_Compound - - -

    Coverage for Doctrine_Record_Filter_Compound

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Record.php 1298 2007-05-01 19:26:03Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Record_Filter_Compound -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Record -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 1298 $ -
    32 */ -
    33class Doctrine_Record_Filter_Compound extends Doctrine_Record_Filter -
    34{ -
    35    protected $_aliases = array(); -
    36 -
    37    public function __construct(array $aliases) -
    38    { -
    39        $this->_aliases = $aliases; -
    40    } -
    41    public function init() -
    42    { -
    43     // check that all aliases exist -
    44     foreach ($this->_aliases as $alias) { -
    45            $this->_table->getRelation($alias); -
    46     } -
    47    } -
    48 -
    49    /** -
    50     * filterSet -
    51     * defines an implementation for filtering the set() method of Doctrine_Record -
    52     * -
    53     * @param mixed $name                       name of the property or related component -
    54     */ -
    55    public function filterSet(Doctrine_Record $record, $name, $value) -
    56    { -
    57        foreach ($this->_aliases as $alias) { -
    58            if ( ! $record->exists()) { -
    59                if (isset($record[$alias][$name])) { -
    60                    $record[$alias][$name] = $value; -
    61                     -
    62                    return $record; -
    63                } -
    64            } else { -
    65                // we do not want to execute N + 1 queries here, hence we cannot use get() -
    66                if (($ref = $record->reference($alias)) !== null) { -
    67                    if (isset($ref[$name])) { -
    68                        $ref[$name] = $value; -
    69                    } -
    70                     -
    71                    return $record; -
    72                } -
    73            } -
    74        } -
    75    } -
    76 -
    77    /** -
    78     * filterGet -
    79     * defines an implementation for filtering the get() method of Doctrine_Record -
    80     * -
    81     * @param mixed $name                       name of the property or related component -
    82     */ -
    83    public function filterGet(Doctrine_Record $record, $name) -
    84    { -
    85        foreach ($this->_aliases as $alias) { -
    86            if ( ! $record->exists()) { -
    87                if (isset($record[$alias][$name])) { -
    88                    return $record[$alias][$name]; -
    89                } -
    90            } else { -
    91                // we do not want to execute N + 1 queries here, hence we cannot use get() -
    92                if (($ref = $record->reference($alias)) !== null) { -
    93                    if (isset($ref[$name])) { -
    94                        return $ref[$name]; -
    95                    } -
    96                } -
    97            } -
    98        } -
    99    } -
    100}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record_Filter_Standard.html b/tests_old/coverage/Doctrine_Record_Filter_Standard.html deleted file mode 100644 index 1b075d0d1..000000000 --- a/tests_old/coverage/Doctrine_Record_Filter_Standard.html +++ /dev/null @@ -1,182 +0,0 @@ - - - Coverage for Doctrine_Record_Filter_Standard - - -

    Coverage for Doctrine_Record_Filter_Standard

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Record.php 1298 2007-05-01 19:26:03Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Record_Filter_Standard -
    24 * Filters the record getters and setters -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Record -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 1298 $ -
    33 */ -
    34class Doctrine_Record_Filter_Standard extends Doctrine_Record_Filter -
    35{ -
    36    /** -
    37     * filterSet -
    38     * defines an implementation for filtering the set() method of Doctrine_Record -
    39     * -
    40     * @param mixed $name                       name of the property or related component -
    41     */ -
    42    public function filterSet(Doctrine_Record $record, $name, $value) -
    43    { -
    44        throw new Doctrine_Record_Exception('Unknown record property / related component \'' . $name . '\'.'); -
    45    } -
    46 -
    47    /** -
    48     * filterGet -
    49     * defines an implementation for filtering the get() method of Doctrine_Record -
    50     * -
    51     * @param mixed $name                       name of the property or related component -
    52     */ -
    53    public function filterGet(Doctrine_Record $record, $name) -
    54    { -
    55        throw new Doctrine_Record_Exception('Unknown record property / related component \'' . $name . '\'.'); -
    56    } -
    57}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record_Iterator.html b/tests_old/coverage/Doctrine_Record_Iterator.html deleted file mode 100644 index b286cf67f..000000000 --- a/tests_old/coverage/Doctrine_Record_Iterator.html +++ /dev/null @@ -1,254 +0,0 @@ - - - Coverage for Doctrine_Record_Iterator - - -

    Coverage for Doctrine_Record_Iterator

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Iterator.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Record_Iterator -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Record -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Record_Iterator extends ArrayIterator -
    34{ -
    35    /** -
    36     * @var Doctrine_Record $record -
    37     */ -
    38    private $record; -
    39 -
    40    /** -
    41     * @var Doctrine_Null $null -
    42     */ -
    43    private static $null; -
    44 -
    45    /** -
    46     * constructor -
    47     * -
    48     * @param Doctrine_Record $record -
    49     */ -
    50    public function __construct(Doctrine_Record $record) -
    51    { -
    52        $this->record = $record; -
    53        parent::__construct($record->getData()); -
    54    } -
    55 -
    56    /** -
    57     * initNullObject -
    58     * -
    59     * @param Doctrine_Null $null -
    60     */ -
    61    public static function initNullObject(Doctrine_Null $null) -
    62    { -
    63        self::$null = $null; -
    64    } -
    65 -
    66    /** -
    67     * current -
    68     * -
    69     * @return mixed -
    70     */ -
    71    public function current() -
    72    { -
    73        $value = parent::current(); -
    74 -
    75        if ($value === self::$null) { -
    76            return null; -
    77        } else { -
    78            return $value; -
    79        } -
    80    } -
    81}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record_Listener.html b/tests_old/coverage/Doctrine_Record_Listener.html deleted file mode 100644 index 9526fb833..000000000 --- a/tests_old/coverage/Doctrine_Record_Listener.html +++ /dev/null @@ -1,240 +0,0 @@ - - - Coverage for Doctrine_Record_Listener - - -

    Coverage for Doctrine_Record_Listener

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Record_Listener -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Record -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision$ -
    32 */ -
    33class Doctrine_Record_Listener implements Doctrine_Record_Listener_Interface -
    34{ -
    35    public function preSerialize(Doctrine_Event $event) -
    36    { } -
    37 -
    38    public function postSerialize(Doctrine_Event $event) -
    39    { } -
    40 -
    41    public function preUnserialize(Doctrine_Event $event) -
    42    { } -
    43 -
    44    public function postUnserialize(Doctrine_Event $event) -
    45    { } -
    46 -
    47    public function preSave(Doctrine_Event $event) -
    48    { } -
    49 -
    50    public function postSave(Doctrine_Event $event) -
    51    { } -
    52 -
    53    public function preDelete(Doctrine_Event $event) -
    54    { } -
    55 -
    56    public function postDelete(Doctrine_Event $event) -
    57    { } -
    58 -
    59    public function preUpdate(Doctrine_Event $event) -
    60    { } -
    61 -
    62    public function postUpdate(Doctrine_Event $event) -
    63    { } -
    64 -
    65    public function preInsert(Doctrine_Event $event) -
    66    { } -
    67 -
    68    public function postInsert(Doctrine_Event $event) -
    69    { } -
    70     -
    71    public function preHydrate(Doctrine_Event $event) -
    72    { } -
    73     -
    74    public function postHydrate(Doctrine_Event $event) -
    75    { } -
    76} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Record_Listener_Chain.html b/tests_old/coverage/Doctrine_Record_Listener_Chain.html deleted file mode 100644 index 6e960e38d..000000000 --- a/tests_old/coverage/Doctrine_Record_Listener_Chain.html +++ /dev/null @@ -1,579 +0,0 @@ - - - Coverage for Doctrine_Record_Listener_Chain - - -

    Coverage for Doctrine_Record_Listener_Chain

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Access'); -
    22 -
    23/** -
    24 * Doctrine_Record_Listener_Chain -
    25 * this class represents a chain of different listeners, -
    26 * useful for having multiple listeners listening the events at the same time -
    27 * -
    28 * @package     Doctrine -
    29 * @subpackage  Record -
    30 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    31 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    32 * @link        www.phpdoctrine.org -
    33 * @since       1.0 -
    34 * @version     $Revision$ -
    35 */ -
    36class Doctrine_Record_Listener_Chain extends Doctrine_Access implements Doctrine_Record_Listener_Interface -
    37{ -
    38    /** -
    39     * @var array $listeners        an array containing all listeners -
    40     */ -
    41    protected $_listeners = array(); -
    42 -
    43    /** -
    44     * add -
    45     * adds a listener to the chain of listeners -
    46     * -
    47     * @param object $listener -
    48     * @param string $name -
    49     * @return void -
    50     */ -
    51    public function add($listener, $name = null) -
    52    { -
    53        if ( ! ($listener instanceof Doctrine_Record_Listener_Interface) && -
    54             ! ($listener instanceof Doctrine_Overloadable)) { -
    55             -
    56            throw new Doctrine_EventListener_Exception("Couldn't add eventlistener. Record listeners should implement either Doctrine_EventListener_Interface or Doctrine_Overloadable"); -
    57        } -
    58        if ($name === null) { -
    59            $this->_listeners[] = $listener; -
    60        } else { -
    61            $this->_listeners[$name] = $listener; -
    62        } -
    63    } -
    64 -
    65    /** -
    66     * returns a Doctrine_Record_Listener on success -
    67     * and null on failure -
    68     * -
    69     * @param mixed $key -
    70     * @return mixed -
    71     */ -
    72    public function get($key) -
    73    { -
    74        if ( ! isset($this->_listeners[$key])) { -
    75            return null; -
    76        } -
    77        return $this->_listeners[$key]; -
    78    } -
    79 -
    80    /** -
    81     * set -
    82     * -
    83     * @param mixed $key -
    84     * @param Doctrine_Record_Listener $listener    listener to be added -
    85     * @return Doctrine_Record_Listener_Chain       this object -
    86     */ -
    87    public function set($key, Doctrine_EventListener $listener) -
    88    { -
    89        $this->_listeners[$key] = $listener; -
    90    } -
    91 -
    92    public function preSerialize(Doctrine_Event $event) -
    93    {  -
    94        foreach ($this->_listeners as $listener) { -
    95            $listener->preSerialize($event); -
    96        } -
    97    } -
    98 -
    99    public function postSerialize(Doctrine_Event $event) -
    100    {  -
    101        foreach ($this->_listeners as $listener) { -
    102            $listener->preSerialize($event); -
    103        } -
    104    } -
    105 -
    106    public function preUnserialize(Doctrine_Event $event) -
    107    {  -
    108        foreach ($this->_listeners as $listener) { -
    109            $listener->preUnserialize($event); -
    110        } -
    111    } -
    112 -
    113    public function postUnserialize(Doctrine_Event $event) -
    114    {  -
    115        foreach ($this->_listeners as $listener) { -
    116            $listener->postUnserialize($event); -
    117        } -
    118    } -
    119 -
    120    public function preSave(Doctrine_Event $event) -
    121    {  -
    122        foreach ($this->_listeners as $listener) { -
    123            $listener->preSave($event); -
    124        } -
    125    } -
    126 -
    127    public function postSave(Doctrine_Event $event) -
    128    {  -
    129        foreach ($this->_listeners as $listener) { -
    130            $listener->postSave($event); -
    131        } -
    132    } -
    133 -
    134    public function preDelete(Doctrine_Event $event) -
    135    {  -
    136        foreach ($this->_listeners as $listener) { -
    137            $listener->preDelete($event); -
    138        } -
    139    } -
    140 -
    141    public function postDelete(Doctrine_Event $event) -
    142    { -
    143        foreach ($this->_listeners as $listener) { -
    144            $listener->postDelete($event); -
    145        } -
    146    } -
    147 -
    148    public function preUpdate(Doctrine_Event $event) -
    149    {  -
    150        foreach ($this->_listeners as $listener) { -
    151            $listener->preUpdate($event); -
    152        } -
    153    } -
    154 -
    155    public function postUpdate(Doctrine_Event $event) -
    156    {  -
    157        foreach ($this->_listeners as $listener) { -
    158            $listener->postUpdate($event); -
    159        } -
    160    } -
    161 -
    162    public function preInsert(Doctrine_Event $event) -
    163    {  -
    164        foreach ($this->_listeners as $listener) { -
    165            $listener->preInsert($event); -
    166        } -
    167    } -
    168 -
    169    public function postInsert(Doctrine_Event $event) -
    170    {  -
    171        foreach ($this->_listeners as $listener) { -
    172            $listener->postInsert($event); -
    173        } -
    174    } -
    175     -
    176 -
    177    public function preHydrate(Doctrine_Event $event) -
    178    {  -
    179        foreach ($this->_listeners as $listener) { -
    180            $listener->preHydrate($event); -
    181        } -
    182    } -
    183    public function postHydrate(Doctrine_Event $event) -
    184    { -
    185        foreach ($this->_listeners as $listener) { -
    186            $listener->postHydrate($event); -
    187        } -
    188    } -
    189} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Relation.html b/tests_old/coverage/Doctrine_Relation.html deleted file mode 100644 index 64311ce08..000000000 --- a/tests_old/coverage/Doctrine_Relation.html +++ /dev/null @@ -1,1001 +0,0 @@ - - - Coverage for Doctrine_Relation - - -

    Coverage for Doctrine_Relation

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Relation.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Relation -
    24 * This class represents a relation between components -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Relation -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34abstract class Doctrine_Relation implements ArrayAccess -
    35{ -
    36    /** -
    37     * RELATION CONSTANTS -
    38     */ -
    39 -
    40    /** -
    41     * constant for ONE_TO_ONE and MANY_TO_ONE aggregate relationships -
    42     */ -
    43    const ONE_AGGREGATE         = 0; -
    44 -
    45    /** -
    46     * constant for ONE_TO_ONE and MANY_TO_ONE composite relationships -
    47     */ -
    48    const ONE_COMPOSITE         = 1; -
    49 -
    50    /** -
    51     * constant for MANY_TO_MANY and ONE_TO_MANY aggregate relationships -
    52     */ -
    53    const MANY_AGGREGATE        = 2; -
    54 -
    55    /** -
    56     * constant for MANY_TO_MANY and ONE_TO_MANY composite relationships -
    57     */ -
    58    const MANY_COMPOSITE        = 3; -
    59 -
    60    const ONE   = 0; -
    61    const MANY  = 2; -
    62     -
    63    protected $definition = array('alias'       => true, -
    64                                  'foreign'     => true, -
    65                                  'local'       => true, -
    66                                  'class'       => true, -
    67                                  'type'        => true, -
    68                                  'table'       => true, -
    69                                  'name'        => false, -
    70                                  'refTable'    => false, -
    71                                  'onDelete'    => false, -
    72                                  'onUpdate'    => false, -
    73                                  'deferred'    => false, -
    74                                  'deferrable'  => false, -
    75                                  'constraint'  => false, -
    76                                  'equal'       => false, -
    77                                  ); -
    78 -
    79    /** -
    80     * constructor -
    81     * -
    82     * @param array $definition         an associative array with the following structure: -
    83     *          name                    foreign key constraint name -
    84     * -
    85     *          local                   the local field(s) -
    86     * -
    87     *          foreign                 the foreign reference field(s) -
    88     * -
    89     *          table                   the foreign table object -
    90     * -
    91     *          refTable                the reference table object (if any) -
    92     * -
    93     *          onDelete                referential delete action -
    94     *   -
    95     *          onUpdate                referential update action -
    96     * -
    97     *          deferred                deferred constraint checking  -
    98     * -
    99     *          alias                   relation alias -
    100     * -
    101     *          type                    the relation type, either Doctrine_Relation::ONE or Doctrine_Relation::MANY -
    102     * -
    103     *          constraint              boolean value, true if the relation has an explicit referential integrity constraint -
    104     * -
    105     * The onDelete and onUpdate keys accept the following values: -
    106     * -
    107     * CASCADE: Delete or update the row from the parent table and automatically delete or -
    108     *          update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported. -
    109     *          Between two tables, you should not define several ON UPDATE CASCADE clauses that act on the same column -
    110     *          in the parent table or in the child table. -
    111     * -
    112     * SET NULL: Delete or update the row from the parent table and set the foreign key column or columns in the -
    113     *          child table to NULL. This is valid only if the foreign key columns do not have the NOT NULL qualifier  -
    114     *          specified. Both ON DELETE SET NULL and ON UPDATE SET NULL clauses are supported. -
    115     * -
    116     * NO ACTION: In standard SQL, NO ACTION means no action in the sense that an attempt to delete or update a primary  -
    117     *           key value is not allowed to proceed if there is a related foreign key value in the referenced table. -
    118     * -
    119     * RESTRICT: Rejects the delete or update operation for the parent table. NO ACTION and RESTRICT are the same as -
    120     *           omitting the ON DELETE or ON UPDATE clause. -
    121     * -
    122     * SET DEFAULT -
    123     */ -
    124    public function __construct(array $definition) -
    125    { -
    126        $def = array(); -
    127        foreach ($this->definition as $key => $val) { -
    128            if ( ! isset($definition[$key]) && $val) { -
    129                throw new Doctrine_Exception($key . ' is required!'); -
    130            } -
    131            if (isset($definition[$key])) { -
    132                $def[$key] = $definition[$key]; -
    133            } else { -
    134                $def[$key] = null;           -
    135            } -
    136        } -
    137 -
    138        $this->definition = $def; -
    139    } -
    140 -
    141    /** -
    142     * hasConstraint -
    143     * whether or not this relation has an explicit constraint -
    144     * -
    145     * @return boolean -
    146     */ -
    147    public function hasConstraint() -
    148    { -
    149        return ($this->definition['constraint'] || -
    150                ($this->definition['onUpdate']) || -
    151                ($this->definition['onDelete'])); -
    152    } -
    153    public function isDeferred() -
    154    { -
    155        return $this->definition['deferred']; -
    156    } -
    157 -
    158    public function isDeferrable() -
    159    { -
    160        return $this->definition['deferrable']; -
    161    } -
    162    public function isEqual() -
    163    { -
    164        return $this->definition['equal']; -
    165    } -
    166 -
    167    public function offsetExists($offset) -
    168    { -
    169        return isset($this->definition[$offset]); -
    170    } -
    171 -
    172    public function offsetGet($offset) -
    173    { -
    174        if (isset($this->definition[$offset])) { -
    175            return $this->definition[$offset]; -
    176        } -
    177         -
    178        return null; -
    179    } -
    180 -
    181    public function offsetSet($offset, $value) -
    182    { -
    183        if (isset($this->definition[$offset])) { -
    184            $this->definition[$offset] = $value; -
    185        } -
    186    } -
    187 -
    188    public function offsetUnset($offset) -
    189    { -
    190        $this->definition[$offset] = false; -
    191    } -
    192 -
    193    /** -
    194     * toArray -
    195     * -
    196     * @return array -
    197     */ -
    198    public function toArray()  -
    199    { -
    200        return $this->definition; -
    201    } -
    202 -
    203    /** -
    204     * getAlias -
    205     * returns the relation alias -
    206     * -
    207     * @return string -
    208     */ -
    209    final public function getAlias() -
    210    { -
    211        return $this->definition['alias']; -
    212    } -
    213 -
    214    /** -
    215     * getType -
    216     * returns the relation type, either 0 or 1 -
    217     * -
    218     * @see Doctrine_Relation MANY_* and ONE_* constants -
    219     * @return integer -
    220     */ -
    221    final public function getType() -
    222    { -
    223        return $this->definition['type']; -
    224    } -
    225 -
    226    /** -
    227     * getTable -
    228     * returns the foreign table object -
    229     * -
    230     * @return object Doctrine_Table -
    231     */ -
    232    final public function getTable() -
    233    { -
    234        return Doctrine_Manager::getInstance() -
    235               ->getConnectionForComponent($this->definition['class']) -
    236               ->getTable($this->definition['class']); -
    237    } -
    238 -
    239    /** -
    240     * getLocal -
    241     * returns the name of the local column -
    242     * -
    243     * @return string -
    244     */ -
    245    final public function getLocal() -
    246    { -
    247        return $this->definition['local']; -
    248    } -
    249 -
    250    /** -
    251     * getForeign -
    252     * returns the name of the foreignkey column where -
    253     * the localkey column is pointing at -
    254     * -
    255     * @return string -
    256     */ -
    257    final public function getForeign() -
    258    { -
    259        return $this->definition['foreign']; -
    260    } -
    261 -
    262    /** -
    263     * isComposite -
    264     * returns whether or not this relation is a composite relation -
    265     * -
    266     * @return boolean -
    267     */ -
    268    final public function isComposite() -
    269    { -
    270        return ($this->definition['type'] == Doctrine_Relation::ONE_COMPOSITE || -
    271                $this->definition['type'] == Doctrine_Relation::MANY_COMPOSITE); -
    272    } -
    273 -
    274    /** -
    275     * isOneToOne -
    276     * returns whether or not this relation is a one-to-one relation -
    277     * -
    278     * @return boolean -
    279     */ -
    280    final public function isOneToOne() -
    281    { -
    282        return ($this->definition['type'] == Doctrine_Relation::ONE_AGGREGATE || -
    283                $this->definition['type'] == Doctrine_Relation::ONE_COMPOSITE); -
    284    } -
    285 -
    286    /** -
    287     * getRelationDql -
    288     * -
    289     * @param integer $count -
    290     * @return string -
    291     */ -
    292    public function getRelationDql($count) -
    293    { -
    294        $component = $this->getTable()->getComponentName(); -
    295 -
    296        $dql  = 'FROM ' . $component -
    297              . ' WHERE ' . $component . '.' . $this->definition['foreign'] -
    298              . ' IN (' . substr(str_repeat('?, ', $count), 0, -2) . ')'; -
    299 -
    300        return $dql; -
    301    } -
    302 -
    303    /** -
    304     * fetchRelatedFor -
    305     * -
    306     * fetches a component related to given record -
    307     * -
    308     * @param Doctrine_Record $record -
    309     * @return Doctrine_Record|Doctrine_Collection -
    310     */ -
    311    abstract public function fetchRelatedFor(Doctrine_Record $record); -
    312 -
    313    /** -
    314     * __toString -
    315     * -
    316     * @return string -
    317     */ -
    318    public function __toString() -
    319    { -
    320        $r[] = "<pre>"; -
    321        foreach ($this->definition as $k => $v) { -
    322            if (is_object($v)) { -
    323                $v = 'Object(' . get_class($v) . ')'; -
    324            } -
    325            $r[] = $k . ' : ' . $v; -
    326        } -
    327        $r[] = "</pre>"; -
    328        return implode("\n", $r); -
    329    } -
    330}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Relation_Association.html b/tests_old/coverage/Doctrine_Relation_Association.html deleted file mode 100644 index 9e19e491a..000000000 --- a/tests_old/coverage/Doctrine_Relation_Association.html +++ /dev/null @@ -1,305 +0,0 @@ - - - Coverage for Doctrine_Relation_Association - - -

    Coverage for Doctrine_Relation_Association

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Association.php 3209 2007-11-24 18:11:09Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Relation'); -
    22/** -
    23 * Doctrine_Relation_Association    this class takes care of association mapping -
    24 *                         (= many-to-many relationships, where the relationship is handled with an additional relational table -
    25 *                         which holds 2 foreign keys) -
    26 * -
    27 * -
    28 * @package     Doctrine -
    29 * @subpackage  Relation -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 3209 $ -
    34 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    35 */ -
    36class Doctrine_Relation_Association extends Doctrine_Relation -
    37{ -
    38    /** -
    39     * @return Doctrine_Table -
    40     */ -
    41    public function getAssociationFactory() -
    42    { -
    43        return $this->definition['refTable']; -
    44    } -
    45    public function getAssociationTable() -
    46    { -
    47        return $this->definition['refTable']; -
    48    } -
    49 -
    50    /** -
    51     * getRelationDql -
    52     * -
    53     * @param integer $count -
    54     * @return string -
    55     */ -
    56    public function getRelationDql($count, $context = 'record') -
    57    { -
    58        $table = $this->definition['refTable']; -
    59        $component = $this->definition['refTable']->getComponentName(); -
    60         -
    61        switch ($context) { -
    62            case "record": -
    63                $sub  = substr(str_repeat("?, ", $count),0,-2); -
    64                $dql  = 'FROM ' . $this->getTable()->getComponentName(); -
    65                $dql .= '.' . $component; -
    66                $dql .= ' WHERE ' . $this->getTable()->getComponentName() -
    67                . '.' . $component . '.' . $this->definition['local'] . ' IN (' . $sub . ')'; -
    68                break; -
    69            case "collection": -
    70                $sub  = substr(str_repeat("?, ", $count),0,-2); -
    71                $dql  = 'FROM ' . $component . '.' . $this->getTable()->getComponentName(); -
    72                $dql .= ' WHERE ' . $component . '.' . $this->definition['local'] . ' IN (' . $sub . ')'; -
    73                break; -
    74        } -
    75 -
    76        return $dql; -
    77    } -
    78 -
    79    /** -
    80     * fetchRelatedFor -
    81     * -
    82     * fetches a component related to given record -
    83     * -
    84     * @param Doctrine_Record $record -
    85     * @return Doctrine_Record|Doctrine_Collection -
    86     */ -
    87    public function fetchRelatedFor(Doctrine_Record $record) -
    88    { -
    89        $id = $record->getIncremented(); -
    90        if (empty($id) || ! $this->definition['table']->getAttribute(Doctrine::ATTR_LOAD_REFERENCES)) { -
    91            $coll = new Doctrine_Collection($this->getTable()); -
    92        } else { -
    93            $coll = Doctrine_Query::create()->query($this->getRelationDql(1), array($id)); -
    94        } -
    95        $coll->setReference($record, $this); -
    96        return $coll; -
    97    } -
    98}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Relation_Exception.html b/tests_old/coverage/Doctrine_Relation_Exception.html deleted file mode 100644 index 41c0accd1..000000000 --- a/tests_old/coverage/Doctrine_Relation_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Relation_Exception - - -

    Coverage for Doctrine_Relation_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 1344 2007-05-12 23:27:16Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */         -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Relation_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Relation -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1344 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Relation_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Relation_ForeignKey.html b/tests_old/coverage/Doctrine_Relation_ForeignKey.html deleted file mode 100644 index e2838d73a..000000000 --- a/tests_old/coverage/Doctrine_Relation_ForeignKey.html +++ /dev/null @@ -1,308 +0,0 @@ - - - Coverage for Doctrine_Relation_ForeignKey - - -

    Coverage for Doctrine_Relation_ForeignKey

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: ForeignKey.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Relation'); -
    22/** -
    23 * Doctrine_Relation_ForeignKey -
    24 * This class represents a foreign key relation -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Relation -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2963 $ -
    33 */ -
    34class Doctrine_Relation_ForeignKey extends Doctrine_Relation -
    35{ -
    36    /** -
    37     * fetchRelatedFor -
    38     * -
    39     * fetches a component related to given record -
    40     * -
    41     * @param Doctrine_Record $record -
    42     * @return Doctrine_Record|Doctrine_Collection -
    43     */ -
    44    public function fetchRelatedFor(Doctrine_Record $record) -
    45    { -
    46        $id = array(); -
    47        foreach ((array) $this->definition['local'] as $local) { -
    48           $value = $record->get($local); -
    49           if (isset($value)) { -
    50               $id[] = $value; -
    51           } -
    52        } -
    53        if ($this->isOneToOne()) { -
    54            if ( ! $record->exists() || empty($id) ||  -
    55                 ! $this->definition['table']->getAttribute(Doctrine::ATTR_LOAD_REFERENCES)) { -
    56                 -
    57                $related = $this->getTable()->create(); -
    58            } else { -
    59                $dql  = 'FROM ' . $this->getTable()->getComponentName() -
    60                      . ' WHERE ' . $this->getCondition(); -
    61 -
    62                $coll = $this->getTable()->getConnection()->query($dql, $id); -
    63                $related = $coll[0]; -
    64            } -
    65 -
    66            $related->set($this->definition['foreign'], $record, false); -
    67 -
    68        } else { -
    69 -
    70            if ( ! $record->exists() || empty($id) ||  -
    71                 ! $this->definition['table']->getAttribute(Doctrine::ATTR_LOAD_REFERENCES)) { -
    72                 -
    73                $related = new Doctrine_Collection($this->getTable()); -
    74            } else { -
    75                $query      = $this->getRelationDql(1); -
    76                $related    = $this->getTable()->getConnection()->query($query, $id); -
    77            } -
    78            $related->setReference($record, $this); -
    79        } -
    80        return $related; -
    81    } -
    82 -
    83    /** -
    84     * getCondition -
    85     * -
    86     * @param string $alias -
    87     */ -
    88    public function getCondition($alias = null) -
    89    { -
    90        if ( ! $alias) { -
    91           $alias = $this->getTable()->getComponentName(); -
    92        } -
    93        $conditions = array(); -
    94        foreach ((array) $this->definition['foreign'] as $foreign) { -
    95            $conditions[] = $alias . '.' . $foreign . ' = ?'; -
    96        } -
    97        return implode(' AND ', $conditions); -
    98    } -
    99}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Relation_LocalKey.html b/tests_old/coverage/Doctrine_Relation_LocalKey.html deleted file mode 100644 index 76fbe231e..000000000 --- a/tests_old/coverage/Doctrine_Relation_LocalKey.html +++ /dev/null @@ -1,254 +0,0 @@ - - - Coverage for Doctrine_Relation_LocalKey - - -

    Coverage for Doctrine_Relation_LocalKey

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: LocalKey.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Relation'); -
    22/** -
    23 * Doctrine_Relation_LocalKey -
    24 * This class represents a local key relation -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Relation -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2963 $ -
    33 */ -
    34class Doctrine_Relation_LocalKey extends Doctrine_Relation -
    35{ -
    36    /** -
    37     * fetchRelatedFor -
    38     * -
    39     * fetches a component related to given record -
    40     * -
    41     * @param Doctrine_Record $record -
    42     * @return Doctrine_Record|Doctrine_Collection -
    43     */ -
    44    public function fetchRelatedFor(Doctrine_Record $record) -
    45    { -
    46        $id = $record->get($this->definition['local']); -
    47 -
    48        if (empty($id) || ! $this->definition['table']->getAttribute(Doctrine::ATTR_LOAD_REFERENCES)) { -
    49            $related = $this->getTable()->create(); -
    50        } else { -
    51            $dql  = 'FROM ' . $this->getTable()->getComponentName() -
    52                 . ' WHERE ' . $this->getCondition(); -
    53 -
    54            $related = $this->getTable() -
    55                            ->getConnection() -
    56                            ->query($dql, array($id)) -
    57                            ->getFirst(); -
    58             -
    59            if ( ! $related || empty($related)) { -
    60                $related = $this->getTable()->create(); -
    61            } -
    62        } -
    63 -
    64        $record->set($this->definition['local'], $related, false); -
    65 -
    66        return $related; -
    67    } -
    68 -
    69    /** -
    70     * getCondition -
    71     * -
    72     * @param string $alias -
    73     */ -
    74    public function getCondition($alias = null) -
    75    { -
    76        if ( ! $alias) { -
    77           $alias = $this->getTable()->getComponentName(); -
    78        } -
    79        return $alias . '.' . $this->definition['foreign'] . ' = ?'; -
    80    } -
    81}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Relation_Nest.html b/tests_old/coverage/Doctrine_Relation_Nest.html deleted file mode 100644 index 0289cb375..000000000 --- a/tests_old/coverage/Doctrine_Relation_Nest.html +++ /dev/null @@ -1,440 +0,0 @@ - - - Coverage for Doctrine_Relation_Nest - - -

    Coverage for Doctrine_Relation_Nest

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Self.php 1434 2007-05-22 15:57:17Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Relation_Association'); -
    22/** -
    23 * Doctrine_Relation_Association_Self -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Relation -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1434 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Relation_Nest extends Doctrine_Relation_Association -
    34{ -
    35    /** -
    36     * getRelationDql -
    37     * -
    38     * @param integer $count -
    39     * @return string -
    40     */ -
    41    public function getRelationDql($count, $context = 'record') -
    42    { -
    43        switch ($context) { -
    44            case 'record': -
    45                $sub    = 'SELECT '.$this->definition['foreign']  -
    46                        . ' FROM '.$this->definition['refTable']->getTableName() -
    47                        . ' WHERE '.$this->definition['local'] -
    48                        . ' = ?'; -
    49 -
    50                $sub2   = 'SELECT '.$this->definition['local'] -
    51                        . ' FROM '.$this->definition['refTable']->getTableName() -
    52                        . ' WHERE '.$this->definition['foreign'] -
    53                        . ' = ?'; -
    54 -
    55                $dql  = 'FROM ' . $this->definition['table']->getComponentName() -
    56                      . '.' . $this->definition['refTable']->getComponentName() -
    57                      . ' WHERE ' . $this->definition['table']->getComponentName() -
    58                      . '.' . $this->definition['table']->getIdentifier()  -
    59                      . ' IN (' . $sub . ')' -
    60                      . ' || ' . $this->definition['table']->getComponentName()  -
    61                      . '.' . $this->definition['table']->getIdentifier()  -
    62                      . ' IN (' . $sub2 . ')'; -
    63                break; -
    64            case 'collection': -
    65                $sub  = substr(str_repeat('?, ', $count),0,-2); -
    66                $dql  = 'FROM '.$this->definition['refTable']->getComponentName() -
    67                      . '.' . $this->definition['table']->getComponentName() -
    68                      . ' WHERE '.$this->definition['refTable']->getComponentName() -
    69                      . '.' . $this->definition['local'] . ' IN (' . $sub . ')'; -
    70        }; -
    71 -
    72        return $dql; -
    73    } -
    74 -
    75    /** -
    76    public function fetchRelatedFor(Doctrine_Record $record) -
    77    { -
    78        $id = $record->getIncremented(); -
    79 -
    80        if (empty($id) || ! $this->definition['table']->getAttribute(Doctrine::ATTR_LOAD_REFERENCES)) { -
    81            return new Doctrine_Collection($this->getTable()); -
    82        } else { -
    83            $q = new Doctrine_Query(); -
    84             -
    85            $c  = $this->getTable()->getComponentName(); -
    86            $a  = substr($c, 0, 1); -
    87            $c2 = $this->getAssociationTable()->getComponentName(); -
    88            $a2 = substr($c2, 0, 1); -
    89 -
    90            $q->from($c) -
    91              ->innerJoin($c . '.' . $c2) -
    92 -
    93            $sub = 'SELECT ' . $this->getForeign()  -
    94                 . ' FROM '  . $c2 -
    95                 . ' WHERE ' . $this->getLocal()  -
    96                 . ' = ?'; -
    97        } -
    98    } -
    99    */ -
    100 -
    101    public function fetchRelatedFor(Doctrine_Record $record) -
    102    { -
    103        $id = $record->getIncremented(); -
    104 -
    105 -
    106        if (empty($id) || ! $this->definition['table']->getAttribute(Doctrine::ATTR_LOAD_REFERENCES)) { -
    107            return new Doctrine_Collection($this->getTable()); -
    108        } else { -
    109            $q = new Doctrine_RawSql(); -
    110 -
    111            $assocTable = $this->getAssociationFactory()->getTableName(); -
    112            $tableName  = $record->getTable()->getTableName(); -
    113            $identifier = $record->getTable()->getIdentifier(); -
    114     -
    115            $sub = 'SELECT ' . $this->getForeign() -
    116                 . ' FROM ' . $assocTable  -
    117                 . ' WHERE ' . $this->getLocal()  -
    118                 . ' = ?'; -
    119 -
    120            $condition[] = $tableName . '.' . $identifier . ' IN (' . $sub . ')'; -
    121            $joinCondition[] = $tableName . '.' . $identifier . ' = ' . $assocTable . '.' . $this->getForeign(); -
    122 -
    123            if ($this->definition['equal']) { -
    124                $sub2   = 'SELECT ' . $this->getLocal() -
    125                        . ' FROM '  . $assocTable -
    126                        . ' WHERE ' . $this->getForeign() -
    127                        . ' = ?'; -
    128 -
    129                $condition[] = $tableName . '.' . $identifier . ' IN (' . $sub2 . ')'; -
    130                $joinCondition[] = $tableName . '.' . $identifier . ' = ' . $assocTable . '.' . $this->getLocal(); -
    131            } -
    132            $q->select('{'.$tableName.'.*}, {'.$assocTable.'.*}') -
    133              ->from($tableName . ' INNER JOIN ' . $assocTable . ' ON ' . implode(' OR ', $joinCondition)) -
    134              ->where(implode(' OR ', $condition)); -
    135            $q->addComponent($tableName,  $record->getTable()->getComponentName()); -
    136            $q->addComponent($assocTable, $record->getTable()->getComponentName(). '.' . $this->getAssociationFactory()->getComponentName()); -
    137 -
    138            $params = ($this->definition['equal']) ? array($id, $id) : array($id); -
    139 -
    140            return $q->execute($params); -
    141        } -
    142    } -
    143}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Relation_Parser.html b/tests_old/coverage/Doctrine_Relation_Parser.html deleted file mode 100644 index 27e7d816c..000000000 --- a/tests_old/coverage/Doctrine_Relation_Parser.html +++ /dev/null @@ -1,1481 +0,0 @@ - - - Coverage for Doctrine_Relation_Parser - - -

    Coverage for Doctrine_Relation_Parser

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Table.php 1397 2007-05-19 19:54:15Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Relation_Parser -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Relation -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision: 1397 $ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @todo Composite key support? -
    33 */ -
    34class Doctrine_Relation_Parser  -
    35{ -
    36    /** -
    37     * @var Doctrine_Table $_table          the table object this parser belongs to -
    38     */ -
    39    protected $_table; -
    40 -
    41    /** -
    42     * @var array $_relations               an array containing all the Doctrine_Relation objects for this table -
    43     */ -
    44    protected $_relations = array(); -
    45 -
    46    /** -
    47     * @var array $_pending                 relations waiting for parsing -
    48     */ -
    49    protected $_pending   = array(); -
    50 -
    51    /** -
    52     * constructor -
    53     * -
    54     * @param Doctrine_Table $table         the table object this parser belongs to -
    55     */ -
    56    public function __construct(Doctrine_Table $table)  -
    57    { -
    58        $this->_table = $table; -
    59    } -
    60 -
    61    /** -
    62     * getTable -
    63     * -
    64     * @return Doctrine_Table   the table object this parser belongs to -
    65     */ -
    66    public function getTable() -
    67    { -
    68        return $this->_table; -
    69    } -
    70 -
    71    /** -
    72     * getPendingRelation -
    73     * -
    74     * @return array            an array defining a pending relation -
    75     */ -
    76    public function getPendingRelation($name)  -
    77    { -
    78        if ( ! isset($this->_pending[$name])) { -
    79            throw new Doctrine_Relation_Exception('Unknown pending relation ' . $name); -
    80        } -
    81         -
    82        return $this->_pending[$name]; -
    83    } -
    84     -
    85    public function hasRelation($name) -
    86    { -
    87        if ( ! isset($this->_pending[$name]) && ! isset($this->_relations[$name])) { -
    88            return false; -
    89        } -
    90         -
    91        return true; -
    92    } -
    93 -
    94    /** -
    95     * binds a relation -
    96     * -
    97     * @param string $name -
    98     * @param string $field -
    99     * @return void -
    100     */ -
    101    public function bind($name, $options = array()) -
    102    { -
    103        if (isset($this->relations[$name])) { -
    104            unset($this->relations[$name]); -
    105        } -
    106 -
    107        /* looks like old code? -
    108        $lower = strtolower($name); -
    109        if ($this->_table->hasColumn($lower)) { -
    110            throw new Doctrine_Relation_Exception("Couldn't bind relation. Column with name " . $lower . ' already exists!'); -
    111        } -
    112        */ -
    113 -
    114        $e    = explode(' as ', $name); -
    115        $name = $e[0]; -
    116        $alias = isset($e[1]) ? $e[1] : $name; -
    117 -
    118        if ( ! isset($options['type'])) { -
    119            throw new Doctrine_Relation_Exception('Relation type not set.'); -
    120        } -
    121 -
    122        $this->_pending[$alias] = array_merge($options, array('class' => $name, 'alias' => $alias)); -
    123        /** -
    124        $m = Doctrine_Manager::getInstance(); -
    125 -
    126        if (isset($options['onDelete'])) { -
    127            $m->addDeleteAction($name, $this->_table->getComponentName(), $options['onDelete']); -
    128        } -
    129        if (isset($options['onUpdate'])) { -
    130            $m->addUpdateAction($name, $this->_table->getComponentName(), $options['onUpdate']); -
    131        } -
    132        */ -
    133 -
    134        return $this->_pending[$alias]; -
    135    } -
    136 -
    137    /** -
    138     * getRelation -
    139     * -
    140     * @param string $alias      relation alias -
    141     */ -
    142    public function getRelation($alias, $recursive = true) -
    143    { -
    144        if (isset($this->_relations[$alias])) { -
    145            return $this->_relations[$alias]; -
    146        } -
    147 -
    148        if (isset($this->_pending[$alias])) { -
    149            $def = $this->_pending[$alias]; -
    150            $identifierColumnNames = $this->_table->getIdentifierColumnNames(); -
    151            $idColumnName = array_pop($identifierColumnNames); -
    152         -
    153            // check if reference class name exists -
    154            // if it does we are dealing with association relation -
    155            if (isset($def['refClass'])) { -
    156                $def = $this->completeAssocDefinition($def); -
    157                $localClasses = array_merge($this->_table->getOption('parents'), array($this->_table->getComponentName())); -
    158 -
    159                if ( ! isset($this->_pending[$def['refClass']]) &&  -
    160                     ! isset($this->_relations[$def['refClass']])) { -
    161 -
    162                    $parser = $def['refTable']->getRelationParser(); -
    163                    if ( ! $parser->hasRelation($this->_table->getComponentName())) { -
    164                        $parser->bind($this->_table->getComponentName(), -
    165                                      array('type'    => Doctrine_Relation::ONE, -
    166                                            'local'   => $def['local'], -
    167                                            'foreign' => $idColumnName, -
    168                                            'localKey' => true, -
    169                                            )); -
    170                    } -
    171 -
    172                    if ( ! $this->hasRelation($def['refClass'])) { -
    173                        $this->bind($def['refClass'], array('type' => Doctrine_Relation::MANY, -
    174                                                            'foreign' => $def['local'], -
    175                                                            'local'   => $idColumnName)); -
    176                    } -
    177                } -
    178                if (in_array($def['class'], $localClasses)) { -
    179                    $rel = new Doctrine_Relation_Nest($def); -
    180                } else { -
    181                    $rel = new Doctrine_Relation_Association($def); -
    182                } -
    183            } else { -
    184                // simple foreign key relation -
    185                $def = $this->completeDefinition($def); -
    186 -
    187                if (isset($def['localKey'])) { -
    188                    $rel = new Doctrine_Relation_LocalKey($def); -
    189                } else { -
    190                    $rel = new Doctrine_Relation_ForeignKey($def); -
    191                } -
    192            } -
    193            if (isset($rel)) { -
    194                // unset pending relation -
    195                unset($this->_pending[$alias]); -
    196 -
    197                $this->_relations[$alias] = $rel; -
    198                return $rel; -
    199            } -
    200        } -
    201        if ($recursive) { -
    202            $this->getRelations(); -
    203 -
    204            return $this->getRelation($alias, false); -
    205        } else { -
    206            throw new Doctrine_Table_Exception('Unknown relation alias ' . $alias); -
    207        } -
    208    } -
    209 -
    210    /** -
    211     * getRelations -
    212     * returns an array containing all relation objects -
    213     * -
    214     * @return array        an array of Doctrine_Relation objects -
    215     */ -
    216    public function getRelations() -
    217    { -
    218        foreach ($this->_pending as $k => $v) { -
    219            $this->getRelation($k); -
    220        } -
    221 -
    222        return $this->_relations; -
    223    } -
    224 -
    225    /** -
    226     * getImpl -
    227     * returns the table class of the concrete implementation for given template -
    228     * if the given template is not a template then this method just returns the -
    229     * table class for the given record -
    230     * -
    231     * @param string $template -
    232     */ -
    233    public function getImpl($template) -
    234    { -
    235        $conn = $this->_table->getConnection(); -
    236 -
    237        if (in_array('Doctrine_Template', class_parents($template))) { -
    238            $impl = $this->_table->getImpl($template); -
    239             -
    240            if ($impl === null) { -
    241                throw new Doctrine_Relation_Parser_Exception("Couldn't find concrete implementation for template " . $template); -
    242            } -
    243        } else { -
    244            $impl = $template; -
    245        } -
    246 -
    247        return $conn->getTable($impl); -
    248    } -
    249 -
    250    /** -
    251     * Completes the given association definition -
    252     * -
    253     * @param array $def    definition array to be completed -
    254     * @return array        completed definition array -
    255     */ -
    256    public function completeAssocDefinition($def)  -
    257    { -
    258        $conn = $this->_table->getConnection(); -
    259        $def['table'] = $this->getImpl($def['class']); -
    260        $def['class'] = $def['table']->getComponentName(); -
    261        $def['refTable'] = $this->getImpl($def['refClass']); -
    262 -
    263        $id = $def['refTable']->getIdentifierColumnNames(); -
    264 -
    265        if (count($id) > 1) { -
    266            if ( ! isset($def['foreign'])) { -
    267                // foreign key not set -
    268                // try to guess the foreign key -
    269     -
    270                $def['foreign'] = ($def['local'] === $id[0]) ? $id[1] : $id[0]; -
    271            } -
    272            if ( ! isset($def['local'])) { -
    273                // foreign key not set -
    274                // try to guess the foreign key -
    275 -
    276                $def['local'] = ($def['foreign'] === $id[0]) ? $id[1] : $id[0]; -
    277            } -
    278        } else { -
    279 -
    280            if ( ! isset($def['foreign'])) { -
    281                // foreign key not set -
    282                // try to guess the foreign key -
    283     -
    284                $columns = $this->getIdentifiers($def['table']); -
    285     -
    286                $def['foreign'] = $columns; -
    287            } -
    288            if ( ! isset($def['local'])) { -
    289                // local key not set -
    290                // try to guess the local key -
    291                $columns = $this->getIdentifiers($this->_table); -
    292     -
    293                $def['local'] = $columns; -
    294            } -
    295        } -
    296        return $def; -
    297    } -
    298 -
    299    /**  -
    300     * getIdentifiers -
    301     * gives a list of identifiers from given table -
    302     * -
    303     * the identifiers are in format: -
    304     * [componentName].[identifier] -
    305     * -
    306     * @param Doctrine_Table $table     table object to retrieve identifiers from -
    307     */ -
    308    public function getIdentifiers(Doctrine_Table $table) -
    309    { -
    310        $componentNameToLower = strtolower($table->getComponentName()); -
    311        if (is_array($table->getIdentifier())) { -
    312            $columns = array();       -
    313            foreach ((array) $table->getIdentifierColumnNames() as $identColName) { -
    314                $columns[] = $componentNameToLower . '_' . $identColName; -
    315            } -
    316        } else { -
    317            $columns = $componentNameToLower . '_' . $table->getColumnName( -
    318                    $table->getIdentifier()); -
    319        } -
    320 -
    321        return $columns; -
    322    } -
    323 -
    324    /** -
    325     * guessColumns -
    326     * -
    327     * @param array $classes                    an array of class names -
    328     * @param Doctrine_Table $foreignTable      foreign table object -
    329     * @return array                            an array of column names -
    330     */ -
    331    public function guessColumns(array $classes, Doctrine_Table $foreignTable) -
    332    { -
    333        $conn = $this->_table->getConnection(); -
    334 -
    335        foreach ($classes as $class) { -
    336            try { -
    337                $table   = $conn->getTable($class); -
    338            } catch (Doctrine_Table_Exception $e) { -
    339                continue; -
    340            } -
    341            $columns = $this->getIdentifiers($table); -
    342            $found   = true; -
    343 -
    344            foreach ((array) $columns as $column) { -
    345                if ( ! $foreignTable->hasColumn($column)) { -
    346                    $found = false; -
    347                    break; -
    348                } -
    349            } -
    350            if ($found) { -
    351                break; -
    352            } -
    353        } -
    354         -
    355        if ( ! $found) { -
    356            throw new Doctrine_Relation_Exception("Couldn't find columns."); -
    357        } -
    358 -
    359        return $columns; -
    360    } -
    361 -
    362    /** -
    363     * Completes the given definition -
    364     * -
    365     * @param array $def    definition array to be completed -
    366     * @return array        completed definition array -
    367     * @todo Description: What does it mean to complete a definition? What is done (not how)? -
    368     *       Refactor (too long & nesting level) -
    369     */ -
    370    public function completeDefinition($def) -
    371    { -
    372        $conn = $this->_table->getConnection(); -
    373        $def['table'] = $this->getImpl($def['class']); -
    374        $def['class'] = $def['table']->getComponentName(); -
    375 -
    376        $foreignClasses = array_merge($def['table']->getOption('parents'), array($def['class'])); -
    377        $localClasses   = array_merge($this->_table->getOption('parents'), array($this->_table->getComponentName())); -
    378 -
    379        $localIdentifierColumnNames = $this->_table->getIdentifierColumnNames(); -
    380        $localIdColumnName = array_pop($localIdentifierColumnNames); -
    381        $foreignIdentifierColumnNames = $def['table']->getIdentifierColumnNames(); -
    382        $foreignIdColumnName = array_pop($foreignIdentifierColumnNames); -
    383 -
    384        if (isset($def['local'])) { -
    385            if ( ! isset($def['foreign'])) { -
    386                // local key is set, but foreign key is not -
    387                // try to guess the foreign key -
    388 -
    389                if ($def['local'] === $localIdColumnName) { -
    390                    $def['foreign'] = $this->guessColumns($localClasses, $def['table']); -
    391                } else { -
    392                    // the foreign field is likely to be the -
    393                    // identifier of the foreign class -
    394                    $def['foreign'] = $foreignIdColumnName; -
    395                    $def['localKey'] = true; -
    396                } -
    397            } else { -
    398                if ($def['local'] !== $localIdColumnName &&  -
    399                    $def['type'] == Doctrine_Relation::ONE) { -
    400                    $def['localKey'] = true; -
    401                } -
    402            } -
    403        } else { -
    404            if (isset($def['foreign'])) { -
    405                // local key not set, but foreign key is set -
    406                // try to guess the local key -
    407                if ($def['foreign'] === $foreignIdColumnName) { -
    408                    $def['localKey'] = true; -
    409                    try { -
    410                        $def['local'] = $this->guessColumns($foreignClasses, $this->_table); -
    411                    } catch (Doctrine_Relation_Exception $e) { -
    412                        $def['local'] = $localIdColumnName; -
    413                    } -
    414                } else { -
    415                    $def['local'] = $localIdColumnName; -
    416                } -
    417            } else { -
    418                // neither local or foreign key is being set -
    419                // try to guess both keys -
    420 -
    421                $conn = $this->_table->getConnection(); -
    422 -
    423                // the following loops are needed for covering inheritance -
    424                foreach ($localClasses as $class) { -
    425                    $table = $conn->getTable($class); -
    426                    $identifierColumnNames = $table->getIdentifierColumnNames(); -
    427                    $idColumnName = array_pop($identifierColumnNames); -
    428                    $column = strtolower($table->getComponentName()) -
    429                            . '_' . $idColumnName; -
    430 -
    431                    foreach ($foreignClasses as $class2) { -
    432                        $table2 = $conn->getTable($class2); -
    433                        if ($table2->hasColumn($column)) { -
    434                            $def['foreign'] = $column; -
    435                            $def['local'] = $idColumnName; -
    436                            return $def; -
    437                        } -
    438                    } -
    439                } -
    440 -
    441                foreach ($foreignClasses as $class) { -
    442                    $table  = $conn->getTable($class); -
    443                    $identifierColumnNames = $table->getIdentifierColumnNames(); -
    444                    $idColumnName = array_pop($identifierColumnNames); -
    445                    $column = strtolower($table->getComponentName()) -
    446                            . '_' . $idColumnName; -
    447                 -
    448                    foreach ($localClasses as $class2) { -
    449                        $table2 = $conn->getTable($class2); -
    450                        if ($table2->hasColumn($column)) { -
    451                            $def['foreign']  = $idColumnName; -
    452                            $def['local']    = $column; -
    453                            $def['localKey'] = true; -
    454                            return $def; -
    455                        } -
    456                    } -
    457                } -
    458 -
    459                // auto-add columns and auto-build relation -
    460                $columns = array(); -
    461                foreach ((array) $this->_table->getIdentifierColumnNames() as $id) { -
    462                    // ?? should this not be $this->_table->getComponentName() ?? -
    463                    $column = strtolower($table->getComponentName()) -
    464                            . '_' . $id; -
    465 -
    466                    $col = $this->_table->getColumnDefinition($id); -
    467                    $type = $col['type']; -
    468                    $length = $col['length']; -
    469 -
    470                    unset($col['type']); -
    471                    unset($col['length']); -
    472                    unset($col['autoincrement']); -
    473                    unset($col['sequence']); -
    474                    unset($col['primary']); -
    475 -
    476                    $def['table']->setColumn($column, $type, $length, $col); -
    477                     -
    478                    $columns[] = $column; -
    479                } -
    480                if (count($columns) > 1) { -
    481                    $def['foreign'] = $columns; -
    482                } else { -
    483                    $def['foreign'] = $columns[0]; -
    484                } -
    485                $def['local'] = $localIdColumnName; -
    486            } -
    487        } -
    488        return $def; -
    489    } -
    490}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Relation_Parser_Exception.html b/tests_old/coverage/Doctrine_Relation_Parser_Exception.html deleted file mode 100644 index 499fc0ced..000000000 --- a/tests_old/coverage/Doctrine_Relation_Parser_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Relation_Parser_Exception - - -

    Coverage for Doctrine_Relation_Parser_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */         -
    21Doctrine::autoload('Doctrine_Relation_Exception'); -
    22/** -
    23 * Doctrine_Relation_Parser_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Relation -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Relation_Parser_Exception extends Doctrine_Relation_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Search.html b/tests_old/coverage/Doctrine_Search.html deleted file mode 100644 index a1ecca30b..000000000 --- a/tests_old/coverage/Doctrine_Search.html +++ /dev/null @@ -1,891 +0,0 @@ - - - Coverage for Doctrine_Search - - -

    Coverage for Doctrine_Search

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Search -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Search -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision$ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Search extends Doctrine_Plugin -
    34{ -
    35    const INDEX_FILES = 0; -
    36 -
    37    const INDEX_TABLES = 1; -
    38 -
    39    protected $_options = array('generateFiles' => false, -
    40                                'type'          => self::INDEX_TABLES, -
    41                                'className'     => '%CLASS%Index', -
    42                                'generatePath'  => false, -
    43                                'resource'      => null, -
    44                                'batchUpdates'  => false, -
    45                                'pluginTable'   => false, -
    46                                'fields'        => array(), -
    47                                'connection'    => null); -
    48                                 -
    49    protected $_built = false; -
    50 -
    51     -
    52    /** -
    53     * __construct  -
    54     *  -
    55     * @param array $options  -
    56     * @return void -
    57     */ -
    58    public function __construct(array $options) -
    59    { -
    60        $this->_options = array_merge($this->_options, $options); -
    61         -
    62        if ( ! isset($this->_options['analyzer'])) { -
    63            $this->_options['analyzer'] = new Doctrine_Search_Analyzer_Standard(); -
    64        } -
    65        if ( ! isset($this->_options['connection'])) { -
    66            $this->_options['connection'] = Doctrine_Manager::connection(); -
    67        } -
    68    } -
    69 -
    70 -
    71    /** -
    72     * search  -
    73     *  -
    74     * @param string $query  -
    75     * @return Doctrine_Collection The collection of search results -
    76     */ -
    77    public function search($query) -
    78    { -
    79        $q = new Doctrine_Search_Query($this->_options['pluginTable']); -
    80         -
    81        $q->query($query); -
    82         -
    83        return $this->_options['connection']->fetchAll($q->getSql(), $q->getParams());; -
    84    } -
    85     -
    86    /** -
    87     * analyze  -
    88     *  -
    89     * @param string $text  -
    90     * @return void -
    91     */ -
    92    public function analyze($text) -
    93    { -
    94        return $this->_options['analyzer']->analyze($text); -
    95    } -
    96 -
    97    /** -
    98     * updateIndex -
    99     * updates the index -
    100     * -
    101     * @param Doctrine_Record $record -
    102     * @return integer -
    103     */ -
    104    public function updateIndex(array $data) -
    105    { -
    106        $this->buildDefinition();  -
    107 -
    108        $fields = $this->getOption('fields'); -
    109        $class  = $this->getOption('className'); -
    110        $name   = $this->getOption('resource')->getComponentName(); -
    111        $conn   = $this->getOption('resource')->getConnection(); -
    112        $identifier = $this->_options['resource']->getIdentifier(); -
    113         -
    114        $q = Doctrine_Query::create()->delete() -
    115                                     ->from($class); -
    116        foreach ((array) $identifier as $id) { -
    117            $q->addWhere($id . ' = ?', array($data[$id])); -
    118        } -
    119        $q->execute(); -
    120 -
    121        if ($this->_options['batchUpdates'] === true) { -
    122            $index = new $class();  -
    123 -
    124            foreach ((array) $this->_options['resource']->getIdentifier() as $id) { -
    125                $index->$id = $data[$id]; -
    126            } -
    127 -
    128            $index->save(); -
    129        } else { -
    130            foreach ($fields as $field) { -
    131 -
    132                $value = $data[$field]; -
    133 -
    134                $terms = $this->analyze($value); -
    135 -
    136                foreach ($terms as $pos => $term) { -
    137                    $index = new $class(); -
    138 -
    139                    $index->keyword = $term; -
    140                    $index->position = $pos; -
    141                    $index->field = $field; -
    142                    foreach ((array) $this->_options['resource']->getIdentifier() as $id) { -
    143                        $index->$id = $data[$id]; -
    144                    } -
    145 -
    146                    $index->save(); -
    147                } -
    148            } -
    149        } -
    150    } -
    151 -
    152    /** -
    153     * readTableData  -
    154     *  -
    155     * @param mixed $limit  -
    156     * @param mixed $offset  -
    157     * @return Doctrine_Collection The collection of results -
    158     */ -
    159    public function readTableData($limit = null, $offset = null) -
    160    { -
    161        $this->buildDefinition();  -
    162 -
    163        $conn      = $this->_options['resource']->getConnection(); -
    164        $tableName = $this->_options['resource']->getTableName(); -
    165        $id        = $this->_options['resource']->getIdentifier(); -
    166 -
    167        $query = 'SELECT * FROM ' . $conn->quoteIdentifier($tableName) -
    168               . ' WHERE ' . $conn->quoteIdentifier($id) -
    169               . ' IN (SELECT ' . $conn->quoteIdentifier($id) -
    170               . ' FROM ' . $conn->quoteIdentifier($this->_options['pluginTable']->getTableName()) -
    171               . ' WHERE keyword IS NULL)'; -
    172 -
    173        $query = $conn->modifyLimitQuery($query, $limit, $offset); -
    174 -
    175        return $conn->fetchAll($query); -
    176    } -
    177     -
    178 -
    179 -
    180    /** -
    181     * batchUpdateIndex  -
    182     *  -
    183     * @param mixed $limit  -
    184     * @param mixed $offset  -
    185     * @return void -
    186     */ -
    187    public function batchUpdateIndex($limit = null, $offset = null) -
    188    { -
    189        $this->buildDefinition(); -
    190 -
    191        $id        = $this->_options['resource']->getIdentifier(); -
    192        $class     = $this->_options['className']; -
    193        $fields    = $this->_options['fields']; -
    194        $conn      = $this->_options['connection']; -
    195        try { -
    196 -
    197            $conn->beginTransaction(); -
    198 -
    199            $rows = $this->readTableData($limit, $offset); -
    200 -
    201            foreach ($rows as $row) { -
    202                $ids[] = $row[$id]; -
    203            } -
    204 -
    205            $conn->exec('DELETE FROM '  -
    206                        . $conn->quoteIdentifier($this->_options['pluginTable']->getTableName()) -
    207                        . ' WHERE ' . $conn->quoteIdentifier($id) . ' IN (' . implode(', ', $ids) . ')'); -
    208                         -
    209            foreach ($rows as $row) { -
    210                foreach ($fields as $field) { -
    211                    $data  = $row[$field]; -
    212         -
    213                    $terms = $this->analyze($data); -
    214         -
    215                    foreach ($terms as $pos => $term) { -
    216                        $index = new $class(); -
    217         -
    218                        $index->keyword = $term; -
    219                        $index->position = $pos; -
    220                        $index->field = $field; -
    221                         -
    222                        foreach ((array) $id as $identifier) { -
    223                            $index->$identifier = $row[$identifier]; -
    224                        } -
    225     -
    226                        $index->save(); -
    227                    } -
    228                } -
    229            } -
    230 -
    231            $conn->commit(); -
    232        } catch (Doctrine_Exception $e) { -
    233            $conn->rollback(); -
    234        } -
    235    } -
    236 -
    237    /** -
    238     * buildDefinition  -
    239     *  -
    240     * @return void -
    241     */ -
    242    public function buildDefinition() -
    243    { -
    244     if ($this->_built) { -
    245            return true; -
    246     } -
    247        $this->_built = true; -
    248 -
    249        $componentName = $this->_options['resource']->getComponentName(); -
    250 -
    251        // check for placeholders -
    252        if (strpos($this->_options['className'], '%') !== false) { -
    253            $this->_options['className'] = str_replace('%CLASS%', $componentName, $this->_options['className']); -
    254        } -
    255 -
    256        $className = $this->getOption('className'); -
    257 -
    258        if (class_exists($className)) { -
    259            return false; -
    260        } -
    261 -
    262        $columns = array('keyword'  => array('type'    => 'string', -
    263                                             'length'  => 200, -
    264                                             'primary' => true, -
    265                                             ), -
    266                         'field'    => array('type'    => 'string', -
    267                                             'length'  => 50, -
    268                                             'primary' => true), -
    269                         'position' => array('type'    => 'integer', -
    270                                             'length'  => 8, -
    271                                             'primary' => true, -
    272                                             )); -
    273 -
    274        $id = $this->_options['resource']->getIdentifier(); -
    275 -
    276        $options = array('className' => $className); -
    277 -
    278        $fk = $this->generateForeignKeys($this->_options['resource']); -
    279        $columns += $fk; -
    280 -
    281        $relations = array(); -
    282        // only generate relations for database based searches -
    283        if ( ! $this instanceof Doctrine_Search_File) { -
    284            $relations = $this->generateRelation($this->_options['resource'], $fk); -
    285        } -
    286 -
    287        $this->generateClass($options, $columns, $relations); -
    288 -
    289        $this->_options['pluginTable'] = $this->_options['connection']->getTable($this->_options['className']); -
    290 -
    291        return true; -
    292    } -
    293} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Search_Analyzer_Standard.html b/tests_old/coverage/Doctrine_Search_Analyzer_Standard.html deleted file mode 100644 index dd00681a4..000000000 --- a/tests_old/coverage/Doctrine_Search_Analyzer_Standard.html +++ /dev/null @@ -1,906 +0,0 @@ - - - Coverage for Doctrine_Search_Analyzer_Standard - - -

    Coverage for Doctrine_Search_Analyzer_Standard

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Search_Analyzer_Standard -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Search -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision$ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Search_Analyzer_Standard implements Doctrine_Search_Analyzer_Interface -
    34{ -
    35    protected static $_stopwords = array( -
    36                            '0', -
    37                            '1', -
    38                            '2', -
    39                            '3', -
    40                            '4', -
    41                            '5', -
    42                            '6', -
    43                            '7', -
    44                            '8', -
    45                            '9', -
    46                            '10', -
    47                            'a', -
    48                            'about', -
    49                            'after', -
    50                            'all', -
    51                            'almost', -
    52                            'along', -
    53                            'also', -
    54                            'although', -
    55                            'amp', -
    56                            'an', -
    57                            'and', -
    58                            'another', -
    59                            'any', -
    60                            'are', -
    61                            'area', -
    62                            'arent', -
    63                            'around', -
    64                            'as', -
    65                            'at', -
    66                            'available', -
    67                            'back', -
    68                            'be', -
    69                            'because', -
    70                            'been', -
    71                            'before', -
    72                            'being', -
    73                            'best', -
    74                            'better', -
    75                            'big', -
    76                            'bit', -
    77                            'both', -
    78                            'but', -
    79                            'by', -
    80                            'c', -
    81                            'came', -
    82                            'can', -
    83                            'capable', -
    84                            'control', -
    85                            'could', -
    86                            'course', -
    87                            'd', -
    88                            'dan', -
    89                            'day', -
    90                            'decided', -
    91                            'did', -
    92                            'didn', -
    93                            'different', -
    94                            'div', -
    95                            'do', -
    96                            'doesn', -
    97                            'don', -
    98                            'down', -
    99                            'drive', -
    100                            'e', -
    101                            'each', -
    102                            'easily', -
    103                            'easy', -
    104                            'edition', -
    105                            'either', -
    106                            'end', -
    107                            'enough', -
    108                            'even', -
    109                            'every', -
    110                            'example', -
    111                            'few', -
    112                            'find', -
    113                            'first', -
    114                            'for', -
    115                            'found', -
    116                            'from', -
    117                            'get', -
    118                            'go', -
    119                            'going', -
    120                            'good', -
    121                            'got', -
    122                            'gt', -
    123                            'had', -
    124                            'hard', -
    125                            'has', -
    126                            'have', -
    127                            'he', -
    128                            'her', -
    129                            'here', -
    130                            'how', -
    131                            'i', -
    132                            'if', -
    133                            'in', -
    134                            'into', -
    135                            'is', -
    136                            'isn', -
    137                            'it', -
    138                            'just', -
    139                            'know', -
    140                            'last', -
    141                            'left', -
    142                            'li', -
    143                            'like', -
    144                            'little', -
    145                            'll', -
    146                            'long', -
    147                            'look', -
    148                            'lot', -
    149                            'lt', -
    150                            'm', -
    151                            'made', -
    152                            'make', -
    153                            'many', -
    154                            'mb', -
    155                            'me', -
    156                            'menu', -
    157                            'might', -
    158                            'mm', -
    159                            'more', -
    160                            'most', -
    161                            'much', -
    162                            'my', -
    163                            'name', -
    164                            'nbsp', -
    165                            'need', -
    166                            'new', -
    167                            'no', -
    168                            'not', -
    169                            'now', -
    170                            'number', -
    171                            'of', -
    172                            'off', -
    173                            'old', -
    174                            'on', -
    175                            'one', -
    176                            'only', -
    177                            'or', -
    178                            'original', -
    179                            'other', -
    180                            'our', -
    181                            'out', -
    182                            'over', -
    183                            'part', -
    184                            'place', -
    185                            'point', -
    186                            'pretty', -
    187                            'probably', -
    188                            'problem', -
    189                            'put', -
    190                            'quite', -
    191                            'quot', -
    192                            'r', -
    193                            're', -
    194                            'really', -
    195                            'results', -
    196                            'right', -
    197                            's', -
    198                            'same', -
    199                            'saw', -
    200                            'see', -
    201                            'set', -
    202                            'several', -
    203                            'she', -
    204                            'sherree', -
    205                            'should', -
    206                            'since', -
    207                            'size', -
    208                            'small', -
    209                            'so', -
    210                            'some', -
    211                            'something', -
    212                            'special', -
    213                            'still', -
    214                            'stuff', -
    215                            'such', -
    216                            'sure', -
    217                            'system', -
    218                            't', -
    219                            'take', -
    220                            'than', -
    221                            'that', -
    222                            'the', -
    223                            'their', -
    224                            'them', -
    225                            'then', -
    226                            'there', -
    227                            'these', -
    228                            'they', -
    229                            'thing', -
    230                            'things', -
    231                            'think', -
    232                            'this', -
    233                            'those', -
    234                            'though', -
    235                            'through', -
    236                            'time', -
    237                            'to', -
    238                            'today', -
    239                            'together', -
    240                            'too', -
    241                            'took', -
    242                            'two', -
    243                            'up', -
    244                            'us', -
    245                            'use', -
    246                            'used', -
    247                            'using', -
    248                            've', -
    249                            'very', -
    250                            'want', -
    251                            'was', -
    252                            'way', -
    253                            'we', -
    254                            'well', -
    255                            'went', -
    256                            'were', -
    257                            'what', -
    258                            'when', -
    259                            'where', -
    260                            'which', -
    261                            'while', -
    262                            'white', -
    263                            'who', -
    264                            'will', -
    265                            'with', -
    266                            'would', -
    267                            'yet', -
    268                            'you', -
    269                            'your', -
    270                            'yours' -
    271                            ); -
    272 -
    273    public function analyze($text) -
    274    { -
    275     $text = preg_replace('/[\'`´"]/', '', $text); -
    276        $text = preg_replace('/[^A-Za-z0-9]/', ' ', $text); -
    277        $text = str_replace('  ', ' ', $text); -
    278 -
    279        $terms = explode(' ', $text); -
    280         -
    281        $ret = array(); -
    282        if ( ! empty($terms)) { -
    283            foreach ($terms as $i => $term) { -
    284                if (empty($term)) { -
    285                    continue; -
    286                } -
    287                $lower = strtolower(trim($term)); -
    288 -
    289                if (in_array($lower, self::$_stopwords)) { -
    290                    continue; -
    291                } -
    292 -
    293                $ret[$i] = $lower; -
    294            } -
    295        } -
    296        return $ret; -
    297    } -
    298} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Search_Exception.html b/tests_old/coverage/Doctrine_Search_Exception.html deleted file mode 100644 index 4d71ad685..000000000 --- a/tests_old/coverage/Doctrine_Search_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Search_Exception - - -

    Coverage for Doctrine_Search_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Search_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Search -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision$ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Search_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Search_File.html b/tests_old/coverage/Doctrine_Search_File.html deleted file mode 100755 index 2403f0173..000000000 --- a/tests_old/coverage/Doctrine_Search_File.html +++ /dev/null @@ -1,216 +0,0 @@ - - - Coverage for Doctrine_Search_File - - -

    Coverage for Doctrine_Search_File

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Search -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Search -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision$ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Search_File extends Doctrine_Search -
    34{ -
    35    public function __construct(array $options = array()) -
    36    { -
    37        parent::__construct($options); -
    38 -
    39        if ( ! isset($this->_options['resource'])) { -
    40            $table = new Doctrine_Table('File', Doctrine_Manager::connection()); -
    41             -
    42            $table->setColumn('url', 'string', 255, array('primary' => true)); -
    43 -
    44            $this->_options['resource'] = $table; -
    45        } -
    46         -
    47        if (empty($this->_options['fields'])) { -
    48            $this->_options['fields'] = array('url', 'content'); -
    49        } -
    50         -
    51        $this->buildDefinition(); -
    52    } -
    53     -
    54    public function indexDirectory($dir) -
    55    { -
    56        $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), -
    57                                                RecursiveIteratorIterator::LEAVES_ONLY); -
    58                                                 -
    59        foreach ($it as $file) { -
    60            if (strpos($file, DIRECTORY_SEPARATOR . '.svn') !== false) { -
    61                continue;                                                           -
    62            } -
    63 -
    64            $this->updateIndex(array('url' => $file->getPathName(), -
    65                                     'content' => file_get_contents($file))); -
    66        } -
    67    } -
    68} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Search_Listener.html b/tests_old/coverage/Doctrine_Search_Listener.html deleted file mode 100644 index 9b68520ca..000000000 --- a/tests_old/coverage/Doctrine_Search_Listener.html +++ /dev/null @@ -1,180 +0,0 @@ - - - Coverage for Doctrine_Search_Listener - - -

    Coverage for Doctrine_Search_Listener

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Search_Listener -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Search -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision$ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Search_Listener extends Doctrine_Record_Listener  -
    34{ -
    35    protected $_search; -
    36 -
    37    public function __construct(Doctrine_Search $search) -
    38    { -
    39        $this->_search = $search; -
    40    } -
    41 -
    42    public function preUpdate(Doctrine_Event $event) -
    43    { -
    44    } -
    45 -
    46    public function postUpdate(Doctrine_Event $event) -
    47    { -
    48 -
    49    } -
    50    public function postInsert(Doctrine_Event $event) -
    51    { -
    52        $record = $event->getInvoker(); -
    53         -
    54        $this->_search->updateIndex($record->toArray()); -
    55    } -
    56} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Search_Query.html b/tests_old/coverage/Doctrine_Search_Query.html deleted file mode 100644 index 119ba67af..000000000 --- a/tests_old/coverage/Doctrine_Search_Query.html +++ /dev/null @@ -1,717 +0,0 @@ - - - Coverage for Doctrine_Search_Query - - -

    Coverage for Doctrine_Search_Query

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Hook.php 1939 2007-07-05 23:47:48Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Search_Query -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Search -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision$ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Search_Query -
    34{ -
    35 -
    36    /** -
    37     * @var Doctrine_Table $_table          the index table -
    38     */ -
    39    protected $_table = array(); -
    40     -
    41    protected $_sql = ''; -
    42     -
    43    protected $_params = array(); -
    44     -
    45    protected $_words = array(); -
    46     -
    47    protected $_tokenizer; -
    48 -
    49    protected $_condition; -
    50 -
    51    /** -
    52     * @param Doctrine_Table $_table        the index table -
    53     */ -
    54    public function __construct($table) -
    55    { -
    56        if (is_string($table)) { -
    57           $table = Doctrine_Manager::table($table); -
    58        } else { -
    59            if ( ! $table instanceof Doctrine_Table) { -
    60                throw new Doctrine_Search_Exception('Invalid argument type. Expected instance of Doctrine_Table.'); -
    61            } -
    62        } -
    63 -
    64        $this->_tokenizer = new Doctrine_Query_Tokenizer(); -
    65        $this->_table = $table; -
    66 -
    67        $foreignId = current(array_diff($this->_table->getColumnNames(), array('keyword', 'field', 'position'))); -
    68 -
    69        $this->_condition = $foreignId . ' %s (SELECT ' . $foreignId . ' FROM ' . $this->_table->getTableName() . ' WHERE '; -
    70    } -
    71 -
    72 -
    73    public function query($text) -
    74    { -
    75        $text = trim($text); -
    76 -
    77        $foreignId = current(array_diff($this->_table->getColumnNames(), array('keyword', 'field', 'position'))); -
    78 -
    79        $weighted = false; -
    80        if (strpos($text, '^') === false) { -
    81            $select = 'SELECT COUNT(keyword) AS relevance, ' . $foreignId; -
    82            $from = 'FROM ' . $this->_table->getTableName(); -
    83        } else { -
    84            // organize terms according weights -
    85            $weighted = true; -
    86 -
    87            $select = 'SELECT SUM(sub_relevance) AS relevance, ' . $foreignId; -
    88            $from = 'FROM ' ; -
    89        } -
    90         -
    91        $where = 'WHERE '; -
    92        $where .= $this->parseClause($text); -
    93 -
    94        $groupby = 'GROUP BY ' . $foreignId; -
    95        $orderby = 'ORDER BY relevance DESC'; -
    96 -
    97        $this->_sql = $select . ' ' . $from . ' ' . $where . ' ' . $groupby . ' ' . $orderby; -
    98    } -
    99 -
    100    public function parseClause($originalClause, $recursive = false) -
    101    { -
    102        $clause = $this->_tokenizer->bracketTrim($originalClause); -
    103         -
    104        $brackets = false; -
    105 -
    106        if ($clause !== $originalClause) { -
    107            $brackets = true; -
    108        } -
    109 -
    110        $foreignId = current(array_diff($this->_table->getColumnNames(), array('keyword', 'field', 'position'))); -
    111         -
    112        $terms = $this->_tokenizer->sqlExplode($clause, ' OR ', '(', ')'); -
    113 -
    114        $ret = array(); -
    115 -
    116        if (count($terms) > 1) { -
    117            $leavesOnly = true; -
    118 -
    119            foreach ($terms as $k => $term) { -
    120                if ($this->isExpression($term)) { -
    121                    $ret[$k] = $this->parseClause($term, true); -
    122                    $leavesOnly = false; -
    123                } else { -
    124                    $ret[$k] = $this->parseTerm($term); -
    125                } -
    126            } -
    127 -
    128            $return = implode(' OR ', $ret); -
    129 -
    130            if ($leavesOnly && $recursive) { -
    131                $return = sprintf($this->_condition, 'IN') . $return . ')'; -
    132                $brackets = false; -
    133            } -
    134        } else { -
    135            $terms = $this->_tokenizer->sqlExplode($clause, ' ', '(', ')'); -
    136             -
    137            if (count($terms) === 1 && ! $recursive) { -
    138                $return = $this->parseTerm($clause); -
    139            } else { -
    140                foreach ($terms as $k => $term) { -
    141                    $term = trim($term); -
    142     -
    143                    if ($term === 'AND') { -
    144                        continue; -
    145                    } -
    146     -
    147                    if (substr($term, 0, 1) === '-') { -
    148                        $operator = 'NOT IN'; -
    149                        $term = substr($term, 1); -
    150                    } else { -
    151                        $operator = 'IN'; -
    152                    } -
    153     -
    154                    if ($this->isExpression($term)) { -
    155                        $ret[$k] = $this->parseClause($term, true); -
    156                    } else { -
    157                        $ret[$k] = sprintf($this->_condition, $operator) . $this->parseTerm($term) . ')'; -
    158                    } -
    159                } -
    160                $return = implode(' AND ', $ret); -
    161            } -
    162        } -
    163 -
    164        if ($brackets) { -
    165            return '(' . $return . ')'; -
    166        } else { -
    167            return $return; -
    168        } -
    169    } -
    170    public function isExpression($term) -
    171    { -
    172        if (strpos($term, '(') !== false) { -
    173            return true; -
    174        } else { -
    175            $terms = $this->_tokenizer->quoteExplode($term); -
    176             -
    177            return (count($terms) > 1); -
    178        } -
    179    } -
    180 -
    181    public function parseTerm($term) -
    182    { -
    183        $negation = false; -
    184 -
    185        if (strpos($term, "'") === false) { -
    186            $where = $this->parseWord($term); -
    187        } else { -
    188            $term = trim($term, "' "); -
    189 -
    190            $terms = $this->_tokenizer->quoteExplode($term); -
    191            $where = $this->parseWord($terms[0]); -
    192 -
    193            foreach ($terms as $k => $word) { -
    194                if ($k === 0) { -
    195                    continue; -
    196                } -
    197                $where .= ' AND (position + ' . $k . ') = (SELECT position FROM ' . $this->_table->getTableName() . ' WHERE ' . $this->parseWord($word) . ')'; -
    198            } -
    199        } -
    200        return $where; -
    201    } -
    202    public function parseWord($word) -
    203    { -
    204        $this->_words[] = str_replace('*', '', $word); -
    205 -
    206        if (strpos($word, '?') !== false || -
    207            strpos($word, '*') !== false) { -
    208 -
    209            $word = str_replace('*', '%', $word); -
    210 -
    211            $where = 'keyword LIKE ?'; -
    212 -
    213            $params = array($word); -
    214        } else { -
    215            $where = 'keyword = ?'; -
    216        } -
    217 -
    218        $this->_params[] = $word; -
    219 -
    220        return $where; -
    221    } -
    222 -
    223    public function getWords() -
    224    { -
    225        return $this->_words; -
    226    } -
    227    public function getParams() -
    228    { -
    229        return $this->_params; -
    230    } -
    231    public function getSql() -
    232    { -
    233        return $this->_sql; -
    234    } -
    235} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Sequence.html b/tests_old/coverage/Doctrine_Sequence.html deleted file mode 100644 index ce61dc486..000000000 --- a/tests_old/coverage/Doctrine_Sequence.html +++ /dev/null @@ -1,233 +0,0 @@ - - - Coverage for Doctrine_Sequence - - -

    Coverage for Doctrine_Sequence

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Sequence.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * Doctrine_Sequence -
    24 * The base class for sequence handling drivers. -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Sequence -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2963 $ -
    33 */ -
    34class Doctrine_Sequence extends Doctrine_Connection_Module -
    35{ -
    36    /** -
    37     * Returns the next free id of a sequence -
    38     * -
    39     * @param string $seqName   name of the sequence -
    40     * @param bool              when true missing sequences are automatic created -
    41     * -
    42     * @return integer          next id in the given sequence -
    43     */ -
    44    public function nextId($seqName, $ondemand = true) -
    45    { -
    46        throw new Doctrine_Sequence_Exception('method not implemented'); -
    47    } -
    48 -
    49    /** -
    50     * Returns the autoincrement ID if supported or $id or fetches the current -
    51     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field) -
    52     * -
    53     * @param   string  name of the table into which a new row was inserted -
    54     * @param   string  name of the field into which a new row was inserted -
    55     */ -
    56    public function lastInsertId($table = null, $field = null) -
    57    { -
    58        throw new Doctrine_Sequence_Exception('method not implemented'); -
    59    } -
    60 -
    61    /** -
    62     * Returns the current id of a sequence -
    63     * -
    64     * @param string $seqName   name of the sequence -
    65     * -
    66     * @return integer          current id in the given sequence -
    67     */ -
    68    public function currId($seqName) -
    69    { -
    70        $this->warnings[] = 'database does not support getting current -
    71            sequence value, the sequence value was incremented'; -
    72        return $this->nextId($seqName); -
    73    } -
    74}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Sequence_Firebird.html b/tests_old/coverage/Doctrine_Sequence_Firebird.html deleted file mode 100644 index 6887aa055..000000000 --- a/tests_old/coverage/Doctrine_Sequence_Firebird.html +++ /dev/null @@ -1,332 +0,0 @@ - - - Coverage for Doctrine_Sequence_Firebird - - -

    Coverage for Doctrine_Sequence_Firebird

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Firebird.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Sequence'); -
    22/** -
    23 * Doctrine_Sequence_Firebird -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Sequence -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Sequence_Firebird extends Doctrine_Sequence -
    34{ -
    35    /** -
    36     * Returns the next free id of a sequence -
    37     * -
    38     * @param string $seqName   name of the sequence -
    39     * @param bool              when true missing sequences are automatic created -
    40     * -
    41     * @return integer          next id in the given sequence -
    42     */ -
    43    public function nextID($seqName, $onDemand = true) -
    44    { -
    45        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    46 -
    47        $query = 'SELECT GEN_ID(' . $sequenceName . ', 1) as the_value FROM RDB$DATABASE'; -
    48        try { -
    49         -
    50            $result = $this->conn->fetchOne($query); -
    51 -
    52        } catch(Doctrine_Connection_Exception $e) { -
    53            if ($onDemand && $e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { -
    54                // Since we are creating the sequence on demand -
    55                // we know the first id = 1 so initialize the -
    56                // sequence at 2 -
    57                try { -
    58                    $result = $this->conn->export->createSequence($seqName, 2); -
    59                } catch(Doctrine_Exception $e) { -
    60                    throw new Doctrine_Sequence_Exception('on demand sequence ' . $seqName . ' could not be created'); -
    61                } -
    62                // First ID of a newly created sequence is 1 -
    63                // return 1; -
    64                // BUT generators are not always reset, so return the actual value -
    65                return $this->currID($seqName); -
    66            } -
    67            throw $e; -
    68        } -
    69        return $result; -
    70    } -
    71 -
    72    /** -
    73     * Returns the autoincrement ID if supported or $id or fetches the current -
    74     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field) -
    75     * -
    76     * @param   string  name of the table into which a new row was inserted -
    77     * @param   string  name of the field into which a new row was inserted -
    78     */ -
    79    public function lastInsertId($table = null, $field = null) -
    80    { -
    81        return $this->conn->getDbh()->lastInsertId(); -
    82    } -
    83 -
    84    /** -
    85     * Returns the current id of a sequence -
    86     * -
    87     * @param string $seqName   name of the sequence -
    88     * -
    89     * @return integer          current id in the given sequence -
    90     */ -
    91    public function currId($seqName) -
    92    { -
    93        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    94         -
    95 -
    96        $query = 'SELECT GEN_ID(' . $sequenceName . ', 0) as the_value FROM RDB$DATABASE'; -
    97        try { -
    98            $value = $this->conn->fetchOne($query); -
    99        } catch(Doctrine_Connection_Exception $e) { -
    100            throw new Doctrine_Sequence_Exception('Unable to select from ' . $seqName); -
    101        } -
    102        if ( ! is_numeric($value)) { -
    103            throw new Doctrine_Sequence_Exception('could not find value in sequence table'); -
    104        } -
    105        return $value; -
    106    } -
    107}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Sequence_Mssql.html b/tests_old/coverage/Doctrine_Sequence_Mssql.html deleted file mode 100644 index 4bc2ba18b..000000000 --- a/tests_old/coverage/Doctrine_Sequence_Mssql.html +++ /dev/null @@ -1,482 +0,0 @@ - - - Coverage for Doctrine_Sequence_Mssql - - -

    Coverage for Doctrine_Sequence_Mssql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mssql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Sequence'); -
    22/** -
    23 * Doctrine_Sequence_Mssql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Sequence -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Sequence_Mssql extends Doctrine_Sequence -
    34{ -
    35    /** -
    36     * Returns the next free id of a sequence -
    37     * -
    38     * @param string $seqName   name of the sequence -
    39     * @param bool              when true missing sequences are automatic created -
    40     * -
    41     * @return integer          next id in the given sequence -
    42     */ -
    43    public function nextId($seqName, $onDemand = true) -
    44    { -
    45        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    46        $seqcolName   = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true); -
    47 -
    48 -
    49        if ($this->checkSequence($sequenceName)) { -
    50            $query = 'SET IDENTITY_INSERT ' . $sequenceName . ' OFF ' -
    51                   . 'INSERT INTO ' . $sequenceName . ' DEFAULT VALUES'; -
    52        } else { -
    53            $query = 'INSERT INTO ' . $sequenceName . ' (' . $seqcolName . ') VALUES (0)'; -
    54        } -
    55         -
    56        try { -
    57 -
    58            $this->conn->exec($query); -
    59 -
    60        } catch(Doctrine_Connection_Exception $e) { -
    61            if ($onDemand && $e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { -
    62                // Since we are creating the sequence on demand -
    63                // we know the first id = 1 so initialize the -
    64                // sequence at 2 -
    65                try { -
    66                    $result = $this->conn->export->createSequence($seqName, 2); -
    67                } catch(Doctrine_Exception $e) { -
    68                    throw new Doctrine_Sequence_Exception('on demand sequence ' . $seqName . ' could not be created'); -
    69                } -
    70                 -
    71                /** -
    72                 * This could actually be a table that starts at 18.. oh well.. -
    73                 * we will keep the fallback to return 1 in case we skip this.. which -
    74                 * should really not happen.. otherwise the returned values is biased. -
    75                 */ -
    76                if ($this->checkSequence($seqName)) { -
    77                    return $this->lastInsertId($seqName); -
    78                } -
    79                 -
    80                return 1; -
    81            } -
    82            throw $e; -
    83        } -
    84         -
    85        $value = $this->lastInsertId($sequenceName); -
    86 -
    87        if (is_numeric($value)) { -
    88            $query = 'DELETE FROM ' . $sequenceName . ' WHERE ' . $seqcolName . ' < ' . $value; -
    89             -
    90            try { -
    91                $this->conn->exec($query); -
    92            } catch (Doctrine_Connection_Exception $e) { -
    93                throw new Doctrine_Sequence_Exception('Could not delete previous sequence from ' . $sequenceName .  -
    94                                                      ' at ' . __FILE__ . ' in ' . __FUNCTION__ . ' with the message: ' . -
    95                                                      $e->getMessage()); -
    96            } -
    97        } -
    98        return $value; -
    99    } -
    100 -
    101    /** -
    102     * Checks if there's a sequence that exists. -
    103     * -
    104     * @param  string $seqName     The sequence name to verify. -
    105     * @return bool   $tableExists The value if the table exists or not -
    106     * @access private -
    107     */ -
    108    public function checkSequence($seqName) -
    109    { -
    110        $query = 'SELECT COUNT(1) FROM ' . $seqName; -
    111        try { -
    112            $this->conn->execute($query); -
    113        } catch (Doctrine_Connection_Exception $e) { -
    114            if ($e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { -
    115                return false; -
    116            } -
    117        } -
    118        return true; -
    119    } -
    120 -
    121    /** -
    122     * Returns the autoincrement ID if supported or $id or fetches the current -
    123     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field) -
    124     * -
    125     * @param   string  name of the table into which a new row was inserted -
    126     * @param   string  name of the field into which a new row was inserted -
    127     */ -
    128    public function lastInsertId($table = null, $field = null) -
    129    { -
    130        $serverInfo = $this->conn->getServerVersion(); -
    131        if (is_array($serverInfo) -
    132            && ! is_null($serverInfo['major']) -
    133            && $serverInfo['major'] >= 8) { -
    134 -
    135            $query = 'SELECT SCOPE_IDENTITY()'; -
    136 -
    137        } else { -
    138            $query = 'SELECT @@IDENTITY'; -
    139        } -
    140 -
    141        return $this->conn->fetchOne($query); -
    142    } -
    143 -
    144    /** -
    145     * Returns the current id of a sequence -
    146     * -
    147     * @param string $seqName   name of the sequence -
    148     * -
    149     * @return integer          current id in the given sequence -
    150     */ -
    151    public function currId($seqName) -
    152    { -
    153        $this->warnings[] = 'database does not support getting current -
    154            sequence value, the sequence value was incremented'; -
    155        return $this->nextId($seqName); -
    156    } -
    157}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Sequence_Mysql.html b/tests_old/coverage/Doctrine_Sequence_Mysql.html deleted file mode 100644 index 4ea2071c3..000000000 --- a/tests_old/coverage/Doctrine_Sequence_Mysql.html +++ /dev/null @@ -1,347 +0,0 @@ - - - Coverage for Doctrine_Sequence_Mysql - - -

    Coverage for Doctrine_Sequence_Mysql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mysql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Sequence'); -
    22/** -
    23 * Doctrine_Sequence_Mysql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Sequence -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Sequence_Mysql extends Doctrine_Sequence -
    34{ -
    35    /** -
    36     * Returns the next free id of a sequence -
    37     * -
    38     * @param string $seqName   name of the sequence -
    39     * @param bool              when true missing sequences are automatic created -
    40     * -
    41     * @return integer          next id in the given sequence -
    42     */ -
    43    public function nextId($seqName, $onDemand = true) -
    44    { -
    45        $sequenceName  = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    46        $seqcolName    = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true); -
    47        $query         = 'INSERT INTO ' . $sequenceName . ' (' . $seqcolName . ') VALUES (NULL)'; -
    48         -
    49        try { -
    50 -
    51            $this->conn->exec($query); -
    52 -
    53        } catch(Doctrine_Connection_Exception $e) { -
    54            if ($onDemand && $e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { -
    55                // Since we are creating the sequence on demand -
    56                // we know the first id = 1 so initialize the -
    57                // sequence at 2 -
    58                try { -
    59                    $result = $this->conn->export->createSequence($seqName, 2); -
    60                } catch(Doctrine_Exception $e) { -
    61                    throw new Doctrine_Sequence_Exception('on demand sequence ' . $seqName . ' could not be created'); -
    62                } -
    63                // First ID of a newly created sequence is 1 -
    64                return 1; -
    65            } -
    66            throw $e; -
    67        } -
    68 -
    69        $value = $this->lastInsertId(); -
    70 -
    71        if (is_numeric($value)) { -
    72            $query = 'DELETE FROM ' . $sequenceName . ' WHERE ' . $seqcolName . ' < ' . $value; -
    73            $this->conn->exec($query); -
    74            /** -
    75            TODO: is the following needed ? -
    76            if (PEAR::isError($result)) { -
    77                $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; -
    78            } -
    79            */ -
    80        } -
    81        return $value; -
    82    } -
    83 -
    84    /** -
    85     * Returns the autoincrement ID if supported or $id or fetches the current -
    86     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field) -
    87     * -
    88     * @param string  name of the table into which a new row was inserted -
    89     * @param string  name of the field into which a new row was inserted -
    90     * @return integer|boolean -
    91     */ -
    92    public function lastInsertId($table = null, $field = null) -
    93    { -
    94        return $this->conn->getDbh()->lastInsertId(); -
    95    } -
    96 -
    97    /** -
    98     * Returns the current id of a sequence -
    99     * -
    100     * @param string $seqName   name of the sequence -
    101     * -
    102     * @return integer          current id in the given sequence -
    103     */ -
    104    public function currId($seqName) -
    105    { -
    106        $sequenceName   = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    107        $seqcolName     = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true); -
    108        $query          = 'SELECT MAX(' . $seqcolName . ') FROM ' . $sequenceName; -
    109 -
    110        return (int) $this->conn->fetchOne($query); -
    111    } -
    112}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Sequence_Oracle.html b/tests_old/coverage/Doctrine_Sequence_Oracle.html deleted file mode 100644 index f67c3eef3..000000000 --- a/tests_old/coverage/Doctrine_Sequence_Oracle.html +++ /dev/null @@ -1,299 +0,0 @@ - - - Coverage for Doctrine_Sequence_Oracle - - -

    Coverage for Doctrine_Sequence_Oracle

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Oracle.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Sequence'); -
    22/** -
    23 * Doctrine_Sequence_Oracle -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Sequence -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Sequence_Oracle extends Doctrine_Sequence -
    34{ -
    35    /** -
    36     * Returns the next free id of a sequence -
    37     * -
    38     * @param string $seqName   name of the sequence -
    39     * @param bool onDemand     when true missing sequences are automatic created -
    40     * -
    41     * @return integer          next id in the given sequence -
    42     */ -
    43    public function nextID($seqName, $onDemand = true) -
    44    { -
    45        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    46        $query        = 'SELECT ' . $sequenceName . '.nextval FROM DUAL'; -
    47 -
    48        try { -
    49            $result = $this->conn->fetchOne($query); -
    50        } catch(Doctrine_Connection_Exception $e) { -
    51            if ($onDemand && $e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { -
    52 -
    53                try { -
    54                    $result = $this->conn->export->createSequence($seqName); -
    55                } catch(Doctrine_Exception $e) { -
    56                    throw new Doctrine_Sequence_Exception('on demand sequence ' . $seqName . ' could not be created'); -
    57                } -
    58                return $this->nextId($seqName, false); -
    59            } -
    60            throw $e; -
    61        } -
    62        return $result; -
    63    } -
    64 -
    65    /** -
    66     * Returns the autoincrement ID if supported or $id or fetches the current -
    67     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field) -
    68     * -
    69     * @param   string  name of the table into which a new row was inserted -
    70     * @param   string  name of the field into which a new row was inserted -
    71     */ -
    72    public function lastInsertID($table = null, $field = null) -
    73    { -
    74        $seqName = $table . (empty($field) ? '' : '_'.$field); -
    75        $sequenceName =  $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    76 -
    77        return $this->conn->fetchOne('SELECT ' . $sequenceName . '.currval'); -
    78    } -
    79 -
    80    /** -
    81     * Returns the current id of a sequence -
    82     * -
    83     * @param string $seqName   name of the sequence -
    84     * -
    85     * @return integer          current id in the given sequence -
    86     */ -
    87    public function currID($seqName) -
    88    { -
    89        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    90        $query   = 'SELECT (last_number-1) FROM user_sequences'; -
    91        $query  .= ' WHERE sequence_name=' . $this->conn->quote($sequenceName, 'text'); -
    92        $query  .= ' OR sequence_name=' . $this->conn->quote(strtoupper($sequenceName), 'text'); -
    93 -
    94        return $this->conn->fetchOne($query); -
    95    } -
    96}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Sequence_Pgsql.html b/tests_old/coverage/Doctrine_Sequence_Pgsql.html deleted file mode 100644 index 9aa6d34ca..000000000 --- a/tests_old/coverage/Doctrine_Sequence_Pgsql.html +++ /dev/null @@ -1,293 +0,0 @@ - - - Coverage for Doctrine_Sequence_Pgsql - - -

    Coverage for Doctrine_Sequence_Pgsql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Pgsql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Sequence'); -
    22/** -
    23 * Doctrine_Sequence_Pgsql -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Sequence -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Sequence_Pgsql extends Doctrine_Sequence -
    34{ -
    35    /** -
    36     * Returns the next free id of a sequence -
    37     * -
    38     * @param string $seqName   name of the sequence -
    39     * @param bool onDemand     when true missing sequences are automatic created -
    40     * -
    41     * @return integer          next id in the given sequence -
    42     */ -
    43    public function nextId($seqName, $onDemand = true) -
    44    { -
    45        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    46 -
    47        $query = "SELECT NEXTVAL('" . $sequenceName . "')"; -
    48        try { -
    49            $result = (int) $this->conn->fetchOne($query); -
    50        } catch(Doctrine_Connection_Exception $e) { -
    51            if ($onDemand && $e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { -
    52 -
    53                try { -
    54                    $result = $this->conn->export->createSequence($seqName); -
    55                } catch(Doctrine_Exception $e) { -
    56                    throw new Doctrine_Sequence_Exception('on demand sequence ' . $seqName . ' could not be created'); -
    57                } -
    58                return $this->nextId($seqName, false); -
    59            } -
    60        } -
    61        return $result; -
    62    } -
    63 -
    64    /** -
    65     * lastInsertId -
    66     * -
    67     * Returns the autoincrement ID if supported or $id or fetches the current -
    68     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field) -
    69     * -
    70     * @param   string  name of the table into which a new row was inserted -
    71     * @param   string  name of the field into which a new row was inserted -
    72     * @return integer      the autoincremented id -
    73     */ -
    74    public function lastInsertId($table = null, $field = null) -
    75    { -
    76        $seqName = $table . (empty($field) ? '' : '_' . $field); -
    77        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    78 -
    79        return (int) $this->conn->fetchOne("SELECT CURRVAL('" . $sequenceName . "')"); -
    80    } -
    81 -
    82    /** -
    83     * Returns the current id of a sequence -
    84     * -
    85     * @param string $seqName   name of the sequence -
    86     * -
    87     * @return integer          current id in the given sequence -
    88     */ -
    89    public function currId($seqName) -
    90    { -
    91        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    92        return (int) $this->conn->fetchOne('SELECT last_value FROM ' . $sequenceName); -
    93    } -
    94}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Sequence_Sqlite.html b/tests_old/coverage/Doctrine_Sequence_Sqlite.html deleted file mode 100644 index 20d47de9c..000000000 --- a/tests_old/coverage/Doctrine_Sequence_Sqlite.html +++ /dev/null @@ -1,353 +0,0 @@ - - - Coverage for Doctrine_Sequence_Sqlite - - -

    Coverage for Doctrine_Sequence_Sqlite

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Sqlite.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Sequence'); -
    22/** -
    23 * Doctrine_Sequence_Sqlite -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Sequence -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Sequence_Sqlite extends Doctrine_Sequence -
    34{ -
    35    /** -
    36     * Returns the next free id of a sequence -
    37     * -
    38     * @param string $seqName   name of the sequence -
    39     * @param bool $onDemand    when true missing sequences are automatic created -
    40     * -
    41     * @return integer          next id in the given sequence -
    42     */ -
    43    public function nextId($seqName, $onDemand = true) -
    44    { -
    45        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    46        $seqcolName   = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true); -
    47 -
    48        $query        = 'INSERT INTO ' . $sequenceName . ' (' . $seqcolName . ') VALUES (NULL)'; -
    49 -
    50        try { -
    51 -
    52            $this->conn->exec($query); -
    53 -
    54        } catch(Doctrine_Connection_Exception $e) { -
    55            if ($onDemand && $e->getPortableCode() == Doctrine::ERR_NOSUCHTABLE) { -
    56                // Since we are creating the sequence on demand -
    57                // we know the first id = 1 so initialize the -
    58                // sequence at 2 -
    59 -
    60                try { -
    61                    $result = $this->conn->export->createSequence($seqName, 2); -
    62                } catch(Doctrine_Exception $e) { -
    63                    throw new Doctrine_Sequence_Exception('on demand sequence ' . $seqName . ' could not be created'); -
    64                } -
    65                // First ID of a newly created sequence is 1 -
    66                return 1; -
    67            } -
    68            throw $e; -
    69        } -
    70 -
    71        $value = $this->conn->getDbh()->lastInsertId(); -
    72 -
    73        if (is_numeric($value)) { -
    74            $query = 'DELETE FROM ' . $sequenceName . ' WHERE ' . $seqcolName . ' < ' . $value; -
    75             -
    76            $this->conn->exec($query); -
    77            /** -
    78            TODO: is the following needed ? -
    79            $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; -
    80            */ -
    81        } -
    82        return $value; -
    83    } -
    84 -
    85    /** -
    86     * Returns the autoincrement ID if supported or $id or fetches the current -
    87     * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field) -
    88     * -
    89     * @param   string  name of the table into which a new row was inserted -
    90     * @param   string  name of the field into which a new row was inserted -
    91     * @return integer|boolean -
    92     */ -
    93    public function lastInsertId($table = null, $field = null) -
    94    { -
    95        return $this->conn->getDbh()->lastInsertId(); -
    96    } -
    97 -
    98    /** -
    99     * Returns the current id of a sequence -
    100     * -
    101     * @param string $seqName   name of the sequence -
    102     * -
    103     * @return integer          current id in the given sequence -
    104     */ -
    105    public function currId($seqName) -
    106    { -
    107        $sequenceName = $this->conn->quoteIdentifier($this->conn->formatter->getSequenceName($seqName), true); -
    108        $seqcolName   = $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME), true); -
    109 -
    110        $query        = 'SELECT MAX(' . $seqcolName . ') FROM ' . $sequenceName; -
    111 -
    112        return (int) $this->conn->fetchOne($query); -
    113    } -
    114}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Table.html b/tests_old/coverage/Doctrine_Table.html deleted file mode 100644 index 66e9b5784..000000000 --- a/tests_old/coverage/Doctrine_Table.html +++ /dev/null @@ -1,5718 +0,0 @@ - - - Coverage for Doctrine_Table - - -

    Coverage for Doctrine_Table

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Table.php 3206 2007-11-22 22:02:35Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Table   represents a database table -
    24 *                  each Doctrine_Table holds the information of foreignKeys and associations -
    25 * -
    26 * -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @package     Doctrine -
    29 * @subpackage  Table -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @version     $Revision: 3206 $ -
    32 * @link        www.phpdoctrine.org -
    33 * @since       1.0 -
    34 */ -
    35class Doctrine_Table extends Doctrine_Configurable implements Countable -
    36{ -
    37    /** -
    38     * @var array $data                                 temporary data which is then loaded into Doctrine_Record::$_data -
    39     */ -
    40    protected $_data             = array(); -
    41 -
    42    /** -
    43     * @var mixed $identifier   The field names of all fields that are part of the identifier/primary key -
    44     */ -
    45    protected $_identifier = array(); -
    46 -
    47    /** -
    48     * @see Doctrine_Identifier constants -
    49     * @var integer $identifierType                     the type of identifier this table uses -
    50     */ -
    51    protected $_identifierType; -
    52 -
    53    /** -
    54     * @var Doctrine_Connection $conn                   Doctrine_Connection object that created this table -
    55     */ -
    56    protected $_conn; -
    57 -
    58    /** -
    59     * @var array $identityMap                          first level cache -
    60     */ -
    61    protected $_identityMap        = array(); -
    62 -
    63    /** -
    64     * @var Doctrine_Table_Repository $repository       record repository -
    65     */ -
    66    protected $_repository; -
    67 -
    68    /** -
    69     * @var array $columns                  an array of column definitions, -
    70     *                                      keys are column names and values are column definitions -
    71     * -
    72     *                                      the definition array has atleast the following values: -
    73     * -
    74     *                                      -- type         the column type, eg. 'integer' -
    75     *                                      -- length       the column length, eg. 11 -
    76     * -
    77     *                                      additional keys: -
    78     *                                      -- notnull      whether or not the column is marked as notnull -
    79     *                                      -- values       enum values -
    80     *                                      -- notblank     notblank validator + notnull constraint -
    81     *                                      ... many more -
    82     */ -
    83    protected $_columns          = array(); -
    84 -
    85    /** -
    86     * @var array $_fieldNames            an array of field names. used to look up field names -
    87     *                                    from column names. -
    88     *                                    keys are column names and values are field names -
    89     */ -
    90    protected $_fieldNames    = array(); -
    91     -
    92    /** -
    93     *  -
    94     * @var array $_columnNames             an array of column names -
    95     *                                      keys are field names and values column names. -
    96     *                                      used to look up column names from field names. -
    97     *                                      this is the reverse lookup map of $_fieldNames. -
    98     */ -
    99    protected $_columnNames = array(); -
    100 -
    101    /** -
    102     * @var integer $columnCount            cached column count, Doctrine_Record uses this column count in when -
    103     *                                      determining its state -
    104     */ -
    105    protected $columnCount; -
    106 -
    107    /** -
    108     * @var boolean $hasDefaultValues       whether or not this table has default values -
    109     */ -
    110    protected $hasDefaultValues; -
    111 -
    112    /** -
    113     * @var array $options                  an array containing all options -
    114     * -
    115     *      -- name                         name of the component, for example component name of the GroupTable is 'Group' -
    116     * -
    117     *      -- parents                      the parent classes of this component -
    118     * -
    119     *      -- declaringClass               name of the table definition declaring class (when using inheritance the class -
    120     *                                      that defines the table structure can be any class in the inheritance hierarchy, -
    121     *                                      hence we need reflection to check out which class actually calls setTableDefinition) -
    122     * -
    123     *      -- tableName                    database table name, in most cases this is the same as component name but in some cases -
    124     *                                      where one-table-multi-class inheritance is used this will be the name of the inherited table -
    125     * -
    126     *      -- sequenceName                 Some databases need sequences instead of auto incrementation primary keys, -
    127     *                                      you can set specific sequence for your table by calling setOption('sequenceName', $seqName) -
    128     *                                      where $seqName is the name of the desired sequence -
    129     * -
    130     *      -- enumMap                      enum value arrays -
    131     * -
    132     *      -- inheritanceMap               inheritanceMap is used for inheritance mapping, keys representing columns and values -
    133     *                                      the column values that should correspond to child classes -
    134     * -
    135     *      -- type                         table type (mysql example: INNODB) -
    136     * -
    137     *      -- charset                      character set -
    138     * -
    139     *      -- foreignKeys                  the foreign keys of this table -
    140     * -
    141     *      -- checks                       the check constraints of this table, eg. 'price > dicounted_price' -
    142     * -
    143     *      -- collation                    collation attribute -
    144     * -
    145     *      -- indexes                      the index definitions of this table -
    146     * -
    147     *      -- treeImpl                     the tree implementation of this table (if any) -
    148     * -
    149     *      -- treeOptions                  the tree options -
    150     * -
    151     *      -- queryParts                   the bound query parts -
    152     * -
    153     *      -- versioning -
    154     */ -
    155    protected $_options      = array('name'           => null, -
    156                                     'tableName'      => null, -
    157                                     'sequenceName'   => null, -
    158                                     'inheritanceMap' => array(), -
    159                                     'enumMap'        => array(), -
    160                                     'type'           => null, -
    161                                     'charset'        => null, -
    162                                     'collation'      => null, -
    163                                     'treeImpl'       => null, -
    164                                     'treeOptions'    => null, -
    165                                     'indexes'        => array(), -
    166                                     'parents'        => array(), -
    167                                     'queryParts'     => array(), -
    168                                     'versioning'     => null, -
    169                                     ); -
    170 -
    171    /** -
    172     * @var Doctrine_Tree $tree                 tree object associated with this table -
    173     */ -
    174    protected $_tree; -
    175 -
    176    /** -
    177     * @var Doctrine_Relation_Parser $_parser   relation parser object -
    178     */ -
    179    protected $_parser; -
    180 -
    181    /** -
    182     * @var array $_templates                   an array containing all templates attached to this table -
    183     */ -
    184    protected $_templates   = array(); -
    185 -
    186    /** -
    187     * @var array $_filters                     an array containing all record filters attached to this table -
    188     */ -
    189    protected $_filters     = array(); -
    190 -
    191    /** -
    192     * @var array $_invokedMethods              method invoker cache -
    193     */ -
    194    protected $_invokedMethods = array(); -
    195 -
    196 -
    197 -
    198    /** -
    199     * the constructor -
    200     * -
    201     * @throws Doctrine_Connection_Exception    if there are no opened connections -
    202     * @param string $name                      the name of the component -
    203     * @param Doctrine_Connection $conn         the connection associated with this table -
    204     */ -
    205    public function __construct($name, Doctrine_Connection $conn, $initDefinition = false) -
    206    { -
    207        $this->_conn = $conn; -
    208 -
    209        $this->setParent($this->_conn); -
    210 -
    211        $this->_options['name'] = $name; -
    212        $this->_parser = new Doctrine_Relation_Parser($this); -
    213 -
    214        if ($initDefinition) { -
    215            $record = $this->initDefinition(); -
    216     -
    217            $this->initIdentifier(); -
    218     -
    219            $record->setUp(); -
    220     -
    221            // if tree, set up tree -
    222            if ($this->isTree()) { -
    223                $this->getTree()->setUp(); -
    224            } -
    225        } -
    226        $this->_filters[]  = new Doctrine_Record_Filter_Standard(); -
    227        $this->_repository = new Doctrine_Table_Repository($this); -
    228    } -
    229     -
    230    /** -
    231     * Initializes the in-memory table definition. -
    232     * -
    233     * @param string $name -
    234     */ -
    235    public function initDefinition() -
    236    {         -
    237        $name = $this->_options['name']; -
    238        if ( ! class_exists($name) || empty($name)) { -
    239            throw new Doctrine_Exception("Couldn't find class " . $name); -
    240        } -
    241        $record = new $name($this); -
    242 -
    243        $names = array(); -
    244 -
    245        $class = $name; -
    246 -
    247        // get parent classes -
    248 -
    249        do { -
    250            if ($class === 'Doctrine_Record') { -
    251                break; -
    252            } -
    253 -
    254            $name = $class; -
    255            $names[] = $name; -
    256        } while ($class = get_parent_class($class)); -
    257 -
    258        if ($class === false) { -
    259            throw new Doctrine_Table_Exception('Unknown component.'); -
    260        } -
    261 -
    262        // reverse names -
    263        $names = array_reverse($names); -
    264        // save parents -
    265        array_pop($names); -
    266        $this->_options['parents'] = $names; -
    267 -
    268        // create database table -
    269        if (method_exists($record, 'setTableDefinition')) { -
    270            $record->setTableDefinition(); -
    271            // get the declaring class of setTableDefinition method -
    272            $method = new ReflectionMethod($this->_options['name'], 'setTableDefinition'); -
    273            $class = $method->getDeclaringClass(); -
    274             -
    275        } else { -
    276            $class = new ReflectionClass($class); -
    277        } -
    278 -
    279        $this->_options['joinedParents'] = array(); -
    280 -
    281        foreach (array_reverse($this->_options['parents']) as $parent) { -
    282 -
    283            if ($parent === $class->getName()) { -
    284                continue; -
    285            } -
    286            $ref = new ReflectionClass($parent); -
    287             -
    288            if ($ref->isAbstract()) { -
    289                continue; -
    290            } -
    291            $parentTable = $this->_conn->getTable($parent); -
    292 -
    293            $found = false; -
    294            $parentColumns = $parentTable->getColumns(); -
    295 -
    296            foreach ($parentColumns as $columnName => $definition) { -
    297                if ( ! isset($definition['primary'])) { -
    298                    if (isset($this->_columns[$columnName])) { -
    299                        $found = true; -
    300                        break; -
    301                    } else { -
    302                        if ( ! isset($parentColumns[$columnName]['owner'])) { -
    303                            $parentColumns[$columnName]['owner'] = $parentTable->getComponentName(); -
    304                        } -
    305 -
    306                        $this->_options['joinedParents'][] = $parentColumns[$columnName]['owner']; -
    307                    } -
    308                } else { -
    309                    unset($parentColumns[$columnName]); -
    310                } -
    311            } -
    312 -
    313            if ($found) { -
    314                continue; -
    315            } -
    316 -
    317            foreach ($parentColumns as $columnName => $definition) {     -
    318                $fullName = $columnName . ' as ' . $parentTable->getFieldName($columnName); -
    319                $this->setColumn($fullName, $definition['type'], $definition['length'], $definition, true); -
    320            } -
    321 -
    322            break; -
    323        } -
    324         -
    325        $this->_options['joinedParents'] = array_values(array_unique($this->_options['joinedParents'])); -
    326 -
    327        $this->_options['declaringClass'] = $class; -
    328 -
    329        // set the table definition for the given tree implementation -
    330        if ($this->isTree()) { -
    331            $this->getTree()->setTableDefinition(); -
    332        } -
    333 -
    334        $this->columnCount = count($this->_columns); -
    335         -
    336        if ( ! isset($this->_options['tableName'])) { -
    337            $this->_options['tableName'] = Doctrine::tableize($class->getName()); -
    338        } -
    339         -
    340        return $record; -
    341    } -
    342     -
    343    /** -
    344     * Initializes the table identifier(s)/primary key(s) -
    345     * -
    346     */ -
    347    public function initIdentifier() -
    348    { -
    349        switch (count($this->_identifier)) { -
    350            case 0: -
    351                if ( ! empty($this->_options['joinedParents'])) { -
    352                    $root = current($this->_options['joinedParents']); -
    353                     -
    354                    $table = $this->_conn->getTable($root); -
    355                 -
    356                    $this->_identifier = $table->getIdentifier(); -
    357 -
    358                    $this->_identifierType = ($table->getIdentifierType() !== Doctrine::IDENTIFIER_AUTOINC) -
    359                                            ? $table->getIdentifierType() : Doctrine::IDENTIFIER_NATURAL; -
    360 -
    361                    // add all inherited primary keys -
    362                    foreach ((array) $this->_identifier as $id) { -
    363                        $definition = $table->getDefinitionOf($id); -
    364 -
    365                        // inherited primary keys shouldn't contain autoinc -
    366                        // and sequence definitions -
    367                        unset($definition['autoincrement']); -
    368                        unset($definition['sequence']); -
    369 -
    370                        // add the inherited primary key column -
    371                        $fullName = $id . ' as ' . $table->getFieldName($id); -
    372                        $this->setColumn($fullName, $definition['type'], $definition['length'], -
    373                                $definition, true); -
    374                    } -
    375                } else { -
    376                    $definition = array('type' => 'integer', -
    377                                        'length' => 20, -
    378                                        'autoincrement' => true, -
    379                                        'primary' => true); -
    380                    $this->setColumn('id', $definition['type'], $definition['length'], $definition, true); -
    381                    $this->_identifier = 'id'; -
    382                    $this->_identifierType = Doctrine::IDENTIFIER_AUTOINC; -
    383                } -
    384                $this->columnCount++; -
    385                break; -
    386            case 1: -
    387                foreach ($this->_identifier as $pk) { -
    388                    $columnName = $this->getColumnName($pk); -
    389                    $e = $this->_columns[$columnName]; -
    390 -
    391                    $found = false; -
    392 -
    393                    foreach ($e as $option => $value) { -
    394                        if ($found) { -
    395                            break; -
    396                        } -
    397 -
    398                        $e2 = explode(':', $option); -
    399 -
    400                        switch (strtolower($e2[0])) { -
    401                            case 'autoincrement': -
    402                            case 'autoinc': -
    403                                $this->_identifierType = Doctrine::IDENTIFIER_AUTOINC; -
    404                                $found = true; -
    405                                break; -
    406                            case 'seq': -
    407                            case 'sequence': -
    408                                $this->_identifierType = Doctrine::IDENTIFIER_SEQUENCE; -
    409                                $found = true; -
    410 -
    411                                if ($value) { -
    412                                    $this->_options['sequenceName'] = $value; -
    413                                } else { -
    414                                    if (($sequence = $this->getAttribute(Doctrine::ATTR_DEFAULT_SEQUENCE)) !== null) { -
    415                                        $this->_options['sequenceName'] = $sequence; -
    416                                    } else { -
    417                                        $this->_options['sequenceName'] = $this->_conn->getSequenceName($this->_options['tableName']); -
    418                                    } -
    419                                } -
    420                                break; -
    421                        } -
    422                    } -
    423                    if ( ! isset($this->_identifierType)) { -
    424                        $this->_identifierType = Doctrine::IDENTIFIER_NATURAL; -
    425                    } -
    426                } -
    427 -
    428                $this->_identifier = $pk; -
    429 -
    430                break; -
    431            default: -
    432                $this->_identifierType = Doctrine::IDENTIFIER_COMPOSITE; -
    433        } -
    434    } -
    435     -
    436    /** -
    437     * Gets the owner of a column. -
    438     * The owner of a column is the name of the component in a hierarchy that -
    439     * defines the column. -
    440     * -
    441     * @param string $columnName   The column name  -
    442     * @return string  The name of the owning/defining component -
    443     */ -
    444    public function getColumnOwner($columnName) -
    445    { -
    446        if (isset($this->_columns[$columnName]['owner'])) { -
    447            return $this->_columns[$columnName]['owner']; -
    448        } else { -
    449            return $this->getComponentName(); -
    450        } -
    451    } -
    452     -
    453    /** -
    454     * Checks whether a column is inherited from a component further up in the hierarchy. -
    455     * -
    456     * @param $columnName  The column name -
    457     * @return boolean  TRUE if column is inherited, FALSE otherwise. -
    458     */ -
    459    public function isInheritedColumn($columnName) -
    460    { -
    461        return (isset($this->_columns[$columnName]['owner'])); -
    462    } -
    463     -
    464    /** -
    465     * Checks whether a field is part of the table identifier/primary key field(s). -
    466     * -
    467     * @param string $fieldName  The field name -
    468     * @return boolean  TRUE if the field is part of the table identifier/primary key field(s),  -
    469     *                  FALSE otherwise. -
    470     */ -
    471    public function isIdentifier($fieldName) -
    472    { -
    473        return ($fieldName === $this->getIdentifier() ||  -
    474                in_array($fieldName, (array) $this->getIdentifier())); -
    475    } -
    476 -
    477    public function getMethodOwner($method) -
    478    { -
    479        return (isset($this->_invokedMethods[$method])) ? -
    480                      $this->_invokedMethods[$method] : false; -
    481    } -
    482     -
    483    public function setMethodOwner($method, $class) -
    484    { -
    485        $this->_invokedMethods[$method] = $class; -
    486    } -
    487 -
    488    /** -
    489     * getTemplates -
    490     * returns all templates attached to this table -
    491     * -
    492     * @return array     an array containing all templates -
    493     */ -
    494    public function getTemplates() -
    495    { -
    496        return $this->_templates; -
    497    } -
    498 -
    499    /** -
    500     * export -
    501     * exports this table to database based on column and option definitions -
    502     * -
    503     * @throws Doctrine_Connection_Exception    if some error other than Doctrine::ERR_ALREADY_EXISTS -
    504     *                                          occurred during the create table operation -
    505     * @return boolean                          whether or not the export operation was successful -
    506     *                                          false if table already existed in the database -
    507     */ -
    508    public function export() -
    509    { -
    510        $this->_conn->export->exportTable($this); -
    511    } -
    512 -
    513    /** -
    514     * getExportableFormat -
    515     * returns exportable presentation of this object -
    516     * -
    517     * @return array -
    518     */ -
    519    public function getExportableFormat($parseForeignKeys = true) -
    520    { -
    521        $columns = array(); -
    522        $primary = array(); -
    523 -
    524        foreach ($this->getColumns() as $name => $definition) { -
    525 -
    526            if (isset($definition['owner'])) { -
    527                continue; -
    528            } -
    529 -
    530            switch ($definition['type']) { -
    531                case 'enum': -
    532                    if (isset($definition['default'])) { -
    533                        $definition['default'] = $this->enumIndex($name, $definition['default']); -
    534                    } -
    535                    break; -
    536                case 'boolean': -
    537                    if (isset($definition['default'])) { -
    538                        $definition['default'] = $this->getConnection()->convertBooleans($definition['default']); -
    539                    } -
    540                    break; -
    541            } -
    542            $columns[$name] = $definition; -
    543 -
    544            if (isset($definition['primary']) && $definition['primary']) { -
    545                $primary[] = $name; -
    546            } -
    547        } -
    548        $options['foreignKeys'] = array(); -
    549 -
    550 -
    551        if ($parseForeignKeys && $this->getAttribute(Doctrine::ATTR_EXPORT) -
    552                & Doctrine::EXPORT_CONSTRAINTS) { -
    553 -
    554            $constraints = array(); -
    555 -
    556            $emptyIntegrity = array('onUpdate' => null, -
    557                                    'onDelete' => null); -
    558 -
    559            foreach ($this->getRelations() as $name => $relation) { -
    560                $fk = $relation->toArray(); -
    561                $fk['foreignTable'] = $relation->getTable()->getTableName(); -
    562 -
    563                if ($relation->getTable() === $this && in_array($relation->getLocal(), $primary)) { -
    564                    if ($relation->hasConstraint()) { -
    565                        throw new Doctrine_Table_Exception("Badly constructed integrity constraints."); -
    566                    } -
    567                    continue; -
    568                } -
    569 -
    570                $integrity = array('onUpdate' => $fk['onUpdate'], -
    571                                   'onDelete' => $fk['onDelete']); -
    572 -
    573                if ($relation instanceof Doctrine_Relation_LocalKey) { -
    574                    $def = array('local'        => $relation->getLocal(), -
    575                                 'foreign'      => $relation->getForeign(), -
    576                                 'foreignTable' => $relation->getTable()->getTableName()); -
    577 -
    578                    if (($key = array_search($def, $options['foreignKeys'])) === false) { -
    579                        $options['foreignKeys'][] = $def; -
    580                        $constraints[] = $integrity; -
    581                    } else { -
    582                        if ($integrity !== $emptyIntegrity) { -
    583                            $constraints[$key] = $integrity; -
    584                        } -
    585                    } -
    586                } -
    587            } -
    588 -
    589            foreach ($constraints as $k => $def) { -
    590                $options['foreignKeys'][$k] = array_merge($options['foreignKeys'][$k], $def); -
    591            } -
    592        } -
    593 -
    594        $options['primary'] = $primary; -
    595 -
    596        return array('tableName' => $this->getOption('tableName'), -
    597                     'columns'   => $columns, -
    598                     'options'   => array_merge($this->getOptions(), $options)); -
    599    } -
    600 -
    601    /** -
    602     * exportConstraints -
    603     * exports the constraints of this table into database based on option definitions -
    604     * -
    605     * @throws Doctrine_Connection_Exception    if something went wrong on db level -
    606     * @return void -
    607     */ -
    608    public function exportConstraints() -
    609    { -
    610        try { -
    611            $this->_conn->beginTransaction(); -
    612 -
    613            foreach ($this->_options['index'] as $index => $definition) { -
    614                $this->_conn->export->createIndex($this->_options['tableName'], $index, $definition); -
    615            } -
    616            $this->_conn->commit(); -
    617        } catch (Doctrine_Connection_Exception $e) { -
    618            $this->_conn->rollback(); -
    619            throw $e; -
    620        } -
    621    } -
    622 -
    623    /** -
    624     * getRelationParser -
    625     * return the relation parser associated with this table -
    626     * -
    627     * @return Doctrine_Relation_Parser     relation parser object -
    628     */ -
    629    public function getRelationParser() -
    630    { -
    631        return $this->_parser; -
    632    } -
    633 -
    634    /** -
    635     * __get -
    636     * an alias for getOption -
    637     * -
    638     * @param string $option -
    639     */ -
    640    public function __get($option) -
    641    { -
    642        if (isset($this->_options[$option])) { -
    643            return $this->_options[$option]; -
    644        } -
    645        return null; -
    646    } -
    647 -
    648    /** -
    649     * __isset -
    650     * -
    651     * @param string $option -
    652     */ -
    653    public function __isset($option) -
    654    { -
    655        return isset($this->_options[$option]); -
    656    } -
    657 -
    658    /** -
    659     * getOptions -
    660     * returns all options of this table and the associated values -
    661     * -
    662     * @return array    all options and their values -
    663     */ -
    664    public function getOptions() -
    665    { -
    666        return $this->_options; -
    667    } -
    668 -
    669    /** -
    670     * addForeignKey -
    671     * -
    672     * adds a foreignKey to this table -
    673     * -
    674     * @return void -
    675     */ -
    676    public function addForeignKey(array $definition) -
    677    { -
    678        $this->_options['foreignKeys'][] = $definition; -
    679    } -
    680 -
    681    /** -
    682     * addCheckConstraint -
    683     * -
    684     * adds a check constraint to this table -
    685     * -
    686     * @return void -
    687     */ -
    688    public function addCheckConstraint($definition, $name) -
    689    { -
    690        if (is_string($name)) { -
    691            $this->_options['checks'][$name] = $definition; -
    692        } else { -
    693            $this->_options['checks'][] = $definition; -
    694        } -
    695 -
    696        return $this; -
    697    } -
    698 -
    699    /** -
    700     * addIndex -
    701     * -
    702     * adds an index to this table -
    703     * -
    704     * @return void -
    705     */ -
    706    public function addIndex($index, array $definition) -
    707    { -
    708        $this->_options['indexes'][$index] = $definition; -
    709    } -
    710 -
    711    /** -
    712     * getIndex -
    713     * -
    714     * @return array|boolean        array on success, FALSE on failure -
    715     */ -
    716    public function getIndex($index) -
    717    { -
    718        if (isset($this->_options['indexes'][$index])) { -
    719            return $this->_options['indexes'][$index]; -
    720        } -
    721 -
    722        return false; -
    723    } -
    724     -
    725    /**  -
    726     * DESCRIBE WHAT THIS METHOD DOES, PLEASE! -
    727     * -
    728     * @todo Name proposal: addRelation -
    729     */ -
    730    public function bind($args, $type) -
    731    { -
    732        $options = array(); -
    733        $options['type'] = $type; -
    734 -
    735        if ( ! isset($args[1])) { -
    736            $args[1] = array(); -
    737        } -
    738 -
    739        // the following is needed for backwards compatibility -
    740        if (is_string($args[1])) { -
    741            if ( ! isset($args[2])) { -
    742                $args[2] = array(); -
    743            } elseif (is_string($args[2])) { -
    744                $args[2] = (array) $args[2]; -
    745            } -
    746 -
    747            $classes = array_merge($this->_options['parents'], array($this->getComponentName())); -
    748 -
    749 -
    750            $e = explode('.', $args[1]); -
    751            if (in_array($e[0], $classes)) { -
    752                if ($options['type'] >= Doctrine_Relation::MANY) { -
    753                    $options['foreign'] = $e[1]; -
    754                } else { -
    755                    $options['local'] = $e[1]; -
    756                } -
    757            } else { -
    758                $e2 = explode(' as ', $args[0]); -
    759                if ($e[0] !== $e2[0] && ( ! isset($e2[1]) || $e[0] !== $e2[1])) { -
    760                    $options['refClass'] = $e[0]; -
    761                } -
    762 -
    763                $options['foreign'] = $e[1]; -
    764            } -
    765 -
    766            $options = array_merge($args[2], $options); -
    767 -
    768            $this->_parser->bind($args[0], $options); -
    769        } else { -
    770            $options = array_merge($args[1], $options); -
    771            $this->_parser->bind($args[0], $options); -
    772        } -
    773    } -
    774 -
    775    /** -
    776     * hasRelation -
    777     * -
    778     * @param string $alias      the relation to check if exists -
    779     * @return boolean           true if the relation exists otherwise false -
    780     */ -
    781    public function hasRelation($alias) -
    782    { -
    783        return $this->_parser->hasRelation($alias); -
    784    } -
    785 -
    786    /** -
    787     * getRelation -
    788     * -
    789     * @param string $alias      relation alias -
    790     */ -
    791    public function getRelation($alias, $recursive = true) -
    792    { -
    793        return $this->_parser->getRelation($alias, $recursive); -
    794    } -
    795 -
    796    /** -
    797     * getRelations -
    798     * returns an array containing all relation objects -
    799     * -
    800     * @return array        an array of Doctrine_Relation objects -
    801     */ -
    802    public function getRelations() -
    803    { -
    804        return $this->_parser->getRelations(); -
    805    } -
    806 -
    807    /** -
    808     * createQuery -
    809     * creates a new Doctrine_Query object and adds the component name -
    810     * of this table as the query 'from' part -
    811     * -
    812     * @param string Optional alias name for component aliasing. -
    813     * -
    814     * @return Doctrine_Query -
    815     */ -
    816    public function createQuery($alias = '') -
    817    { -
    818        if ( ! empty($alias)) { -
    819            $alias = ' ' . trim($alias); -
    820        } -
    821        return Doctrine_Query::create($this->_conn)->from($this->getComponentName() . $alias); -
    822    } -
    823 -
    824    /** -
    825     * getRepository -
    826     * -
    827     * @return Doctrine_Table_Repository -
    828     */ -
    829    public function getRepository() -
    830    { -
    831        return $this->_repository; -
    832    } -
    833 -
    834    /** -
    835     * setOption -
    836     * sets an option and returns this object in order to -
    837     * allow flexible method chaining -
    838     * -
    839     * @see Doctrine_Table::$_options   for available options -
    840     * @param string $name              the name of the option to set -
    841     * @param mixed $value              the value of the option -
    842     * @return Doctrine_Table           this object -
    843     */ -
    844    public function setOption($name, $value) -
    845    { -
    846        switch ($name) { -
    847        case 'name': -
    848        case 'tableName': -
    849            break; -
    850        case 'enumMap': -
    851        case 'inheritanceMap': -
    852        case 'index': -
    853        case 'treeOptions': -
    854            if ( ! is_array($value)) { -
    855                throw new Doctrine_Table_Exception($name . ' should be an array.'); -
    856            } -
    857            break; -
    858        } -
    859        $this->_options[$name] = $value; -
    860    } -
    861 -
    862    /** -
    863     * getOption -
    864     * returns the value of given option -
    865     * -
    866     * @param string $name  the name of the option -
    867     * @return mixed        the value of given option -
    868     */ -
    869    public function getOption($name) -
    870    { -
    871        if (isset($this->_options[$name])) { -
    872            return $this->_options[$name]; -
    873        } -
    874        return null; -
    875    } -
    876 -
    877    /** -
    878     * getColumnName -
    879     * -
    880     * returns a column name for column alias -
    881     * if the actual name for the alias cannot be found -
    882     * this method returns the given alias -
    883     * -
    884     * @param string $alias         column alias -
    885     * @return string               column name -
    886     */ -
    887    public function getColumnName($fieldName) -
    888    { -
    889        if (isset($this->_columnNames[$fieldName])) { -
    890            return $this->_columnNames[$fieldName]; -
    891        } -
    892        return $fieldName; -
    893    } -
    894     -
    895    /** -
    896     * -
    897     * -
    898     */ -
    899    public function getColumnDefinition($columnName) -
    900    { -
    901        if ( ! isset($this->_columns[$columnName])) { -
    902            return false; -
    903        } -
    904        return $this->_columns[$columnName]; -
    905    } -
    906     -
    907    /** -
    908     * getColumnAlias -
    909     *  -
    910     * returns a column alias for a column name  -
    911     * if no alias can be found the column name is returned. -
    912     * -
    913     * @param string $columnName    column name -
    914     * @return string               column alias -
    915     */ -
    916    public function getFieldName($columnName) -
    917    { -
    918        if (isset($this->_fieldNames[$columnName])) { -
    919            return $this->_fieldNames[$columnName]; -
    920        } -
    921        return $columnName; -
    922    } -
    923 -
    924    /** -
    925     * setColumn -
    926     * -
    927     * @param string $name -
    928     * @param string $type -
    929     * @param integer $length -
    930     * @param mixed $options -
    931     * @param boolean $prepend   Whether to prepend or append the new column to the column list. -
    932     *                           By default the column gets appended. -
    933     * @throws Doctrine_Table_Exception     if trying use wrongly typed parameter -
    934     * @return void -
    935     */ -
    936    public function setColumn($name, $type, $length = null, $options = array(), $prepend = false) -
    937    { -
    938        if (is_string($options)) { -
    939            $options = explode('|', $options); -
    940        } -
    941 -
    942        foreach ($options as $k => $option) { -
    943            if (is_numeric($k)) { -
    944                if ( ! empty($option)) { -
    945                    $options[$option] = true; -
    946                } -
    947                unset($options[$k]); -
    948            } -
    949        } -
    950         -
    951        // extract column name & field name -
    952        $parts = explode(' as ', $name); -
    953        if (count($parts) > 1) { -
    954            $fieldName = $parts[1]; -
    955        } else { -
    956            $fieldName = $parts[0]; -
    957        } -
    958        $name = strtolower($parts[0]); -
    959        if ($prepend) { -
    960            $this->_columnNames = array_merge(array($fieldName => $name), $this->_columnNames); -
    961            $this->_fieldNames = array_merge(array($name => $fieldName), $this->_fieldNames); -
    962        } else { -
    963            $this->_columnNames[$fieldName] = $name; -
    964            $this->_fieldNames[$name] = $fieldName; -
    965        } -
    966 -
    967        if ($length == null) { -
    968            switch ($type) { -
    969                case 'string': -
    970                case 'clob': -
    971                case 'float': -
    972                case 'integer': -
    973                case 'array': -
    974                case 'object': -
    975                case 'blob': -
    976                case 'gzip': -
    977                    // use php int max -
    978                    $length = 2147483647; -
    979                break; -
    980                case 'boolean': -
    981                    $length = 1; -
    982                case 'date': -
    983                    // YYYY-MM-DD ISO 8601 -
    984                    $length = 10; -
    985                case 'time': -
    986                    // HH:NN:SS+00:00 ISO 8601 -
    987                    $length = 14; -
    988                case 'timestamp': -
    989                    // YYYY-MM-DDTHH:MM:SS+00:00 ISO 8601 -
    990                    $length = 25; -
    991                break; -
    992            } -
    993        } -
    994         -
    995        $options['type'] = $type; -
    996        $options['length'] = $length; -
    997         -
    998        if ($prepend) { -
    999            $this->_columns = array_merge(array($name => $options), $this->_columns); -
    1000        } else { -
    1001            $this->_columns[$name] = $options; -
    1002        } -
    1003 -
    1004        if (isset($options['primary'])) { -
    1005            if (isset($this->_identifier)) { -
    1006                $this->_identifier = (array) $this->_identifier;  -
    1007            } -
    1008            if ( ! in_array($fieldName, $this->_identifier)) { -
    1009                $this->_identifier[] = $fieldName; -
    1010            } -
    1011        } -
    1012        if (isset($options['default'])) { -
    1013            $this->hasDefaultValues = true; -
    1014        } -
    1015    } -
    1016 -
    1017    /** -
    1018     * hasDefaultValues -
    1019     * returns true if this table has default values, otherwise false -
    1020     * -
    1021     * @return boolean -
    1022     */ -
    1023    public function hasDefaultValues() -
    1024    { -
    1025        return $this->hasDefaultValues; -
    1026    } -
    1027 -
    1028    /** -
    1029     * getDefaultValueOf -
    1030     * returns the default value(if any) for given column -
    1031     * -
    1032     * @param string $fieldName -
    1033     * @return mixed -
    1034     */ -
    1035    public function getDefaultValueOf($fieldName) -
    1036    { -
    1037        $columnName = $this->getColumnName($fieldName); -
    1038        if ( ! isset($this->_columns[$columnName])) { -
    1039            throw new Doctrine_Table_Exception("Couldn't get default value. Column ".$columnName." doesn't exist."); -
    1040        } -
    1041        if (isset($this->_columns[$columnName]['default'])) { -
    1042            return $this->_columns[$columnName]['default']; -
    1043        } else { -
    1044            return null; -
    1045        } -
    1046    } -
    1047 -
    1048    /** -
    1049     * @return mixed -
    1050     */ -
    1051    public function getIdentifier() -
    1052    { -
    1053        return $this->_identifier; -
    1054    } -
    1055 -
    1056    /** -
    1057     * @return integer -
    1058     */ -
    1059    public function getIdentifierType() -
    1060    { -
    1061        return $this->_identifierType; -
    1062    } -
    1063 -
    1064    /** -
    1065     * hasColumn -
    1066     * @return boolean -
    1067     */ -
    1068    public function hasColumn($columnName) -
    1069    { -
    1070        return isset($this->_columns[$columnName]); -
    1071    } -
    1072 -
    1073    /** -
    1074     * sets the connection for this class -
    1075     * -
    1076     * @params Doctrine_Connection      a connection object  -
    1077     * @return Doctrine_Table           this object -
    1078     */ -
    1079    public function setConnection(Doctrine_Connection $conn) -
    1080    { -
    1081        $this->_conn = $conn; -
    1082 -
    1083        $this->setParent($this->_conn); -
    1084         -
    1085        return $this; -
    1086    } -
    1087 -
    1088    /** -
    1089     * returns the connection associated with this table (if any) -
    1090     * -
    1091     * @return Doctrine_Connection|null     the connection object -
    1092     */ -
    1093    public function getConnection() -
    1094    { -
    1095        return $this->_conn; -
    1096    } -
    1097 -
    1098    /** -
    1099     * creates a new record -
    1100     * -
    1101     * @param $array             an array where keys are field names and -
    1102     *                           values representing field values -
    1103     * @return Doctrine_Record   the created record object -
    1104     */ -
    1105    public function create(array $array = array())  -
    1106    { -
    1107        $record = new $this->_options['name']($this, true); -
    1108        $record->fromArray($array); -
    1109 -
    1110        return $record; -
    1111    } -
    1112 -
    1113    /** -
    1114     * finds a record by its identifier -
    1115     * -
    1116     * @param $id                       database row id -
    1117     * @param int $hydrationMode        Doctrine::HYDRATE_ARRAY or Doctrine::HYDRATE_RECORD -
    1118     * @return mixed                    Array or Doctrine_Record or false if no result -
    1119     */ -
    1120    public function find($id, $hydrationMode = null) -
    1121    { -
    1122        if (is_null($id)) { -
    1123            return false; -
    1124        } -
    1125 -
    1126        $id = is_array($id) ? array_values($id) : array($id); -
    1127 -
    1128        return $this->createQuery() -
    1129            ->where(implode(' = ? AND ', $this->getIdentifierColumnNames()) . ' = ?') -
    1130            ->fetchOne($id, $hydrationMode); -
    1131    } -
    1132 -
    1133    /** -
    1134     * findAll -
    1135     * returns a collection of records -
    1136     * -
    1137     * @param int $hydrationMode        Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD -
    1138     * @return Doctrine_Collection -
    1139     */ -
    1140    public function findAll($hydrationMode = null) -
    1141    { -
    1142        return $this->createQuery()->execute(array(), $hydrationMode); -
    1143    } -
    1144 -
    1145    /** -
    1146     * findByDql -
    1147     * finds records with given DQL where clause -
    1148     * returns a collection of records -
    1149     * -
    1150     * @param string $dql               DQL after WHERE clause -
    1151     * @param array $params             query parameters -
    1152     * @param int $hydrationMode        Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD -
    1153     * @return Doctrine_Collection -
    1154     */ -
    1155    public function findBySql($dql, array $params = array(), $hydrationMode = null) -
    1156    { -
    1157        return $this->createQuery()->where($dql)->execute($params, $hydrationMode); -
    1158    } -
    1159 -
    1160    public function findByDql($dql, array $params = array(), $hydrationMode = null) -
    1161    { -
    1162        return $this->findBySql($dql, $params, $hydrationMode); -
    1163    } -
    1164 -
    1165    /** -
    1166     * execute -
    1167     * fetches data using the provided queryKey and  -
    1168     * the associated query in the query registry -
    1169     * -
    1170     * if no query for given queryKey is being found a  -
    1171     * Doctrine_Query_Registry exception is being thrown -
    1172     * -
    1173     * @param string $queryKey      the query key -
    1174     * @param array $params         prepared statement params (if any) -
    1175     * @return mixed                the fetched data -
    1176     */ -
    1177    public function execute($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) -
    1178    { -
    1179        return Doctrine_Manager::getInstance() -
    1180                            ->getQueryRegistry() -
    1181                            ->get($queryKey, $this->getComponentName()) -
    1182                            ->execute($params, $hydrationMode); -
    1183    } -
    1184 -
    1185    /** -
    1186     * executeOne -
    1187     * fetches data using the provided queryKey and  -
    1188     * the associated query in the query registry -
    1189     * -
    1190     * if no query for given queryKey is being found a  -
    1191     * Doctrine_Query_Registry exception is being thrown -
    1192     * -
    1193     * @param string $queryKey      the query key -
    1194     * @param array $params         prepared statement params (if any) -
    1195     * @return mixed                the fetched data -
    1196     */ -
    1197    public function executeOne($queryKey, $params = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) -
    1198    { -
    1199        return Doctrine_Manager::getInstance() -
    1200                            ->getQueryRegistry() -
    1201                            ->get($queryKey, $this->getComponentName()) -
    1202                            ->fetchOne($params, $hydrationMode); -
    1203    } -
    1204 -
    1205    /** -
    1206     * clear -
    1207     * clears the first level cache (identityMap) -
    1208     * -
    1209     * @return void -
    1210     * @todo what about a more descriptive name? clearIdentityMap? -
    1211     */ -
    1212    public function clear() -
    1213    { -
    1214        $this->_identityMap = array(); -
    1215    } -
    1216 -
    1217    /** -
    1218     * addRecord -
    1219     * adds a record to identity map -
    1220     * -
    1221     * @param Doctrine_Record $record       record to be added -
    1222     * @return boolean -
    1223     * @todo Better name? registerRecord? -
    1224     */ -
    1225    public function addRecord(Doctrine_Record $record) -
    1226    { -
    1227        $id = implode(' ', $record->identifier()); -
    1228 -
    1229        if (isset($this->_identityMap[$id])) { -
    1230            return false; -
    1231        } -
    1232 -
    1233        $this->_identityMap[$id] = $record; -
    1234 -
    1235        return true; -
    1236    } -
    1237 -
    1238    /** -
    1239     * removeRecord -
    1240     * removes a record from the identity map, returning true if the record -
    1241     * was found and removed and false if the record wasn't found. -
    1242     * -
    1243     * @param Doctrine_Record $record       record to be removed -
    1244     * @return boolean -
    1245     */ -
    1246    public function removeRecord(Doctrine_Record $record) -
    1247    { -
    1248        $id = implode(' ', $record->identifier()); -
    1249 -
    1250        if (isset($this->_identityMap[$id])) { -
    1251            unset($this->_identityMap[$id]); -
    1252            return true; -
    1253        } -
    1254 -
    1255        return false; -
    1256    } -
    1257 -
    1258    /** -
    1259     * getRecord -
    1260     * first checks if record exists in identityMap, if not -
    1261     * returns a new record -
    1262     * -
    1263     * @return Doctrine_Record -
    1264     */ -
    1265    public function getRecord() -
    1266    { -
    1267        if ( ! empty($this->_data)) { -
    1268 -
    1269            $identifierFieldNames = $this->getIdentifier(); -
    1270 -
    1271            if ( ! is_array($identifierFieldNames)) { -
    1272                $identifierFieldNames = array($identifierFieldNames); -
    1273            } -
    1274 -
    1275            $found = false; -
    1276            foreach ($identifierFieldNames as $fieldName) { -
    1277                if ( ! isset($this->_data[$fieldName])) { -
    1278                    // primary key column not found return new record -
    1279                    $found = true; -
    1280                    break; -
    1281                } -
    1282                $id[] = $this->_data[$fieldName]; -
    1283            } -
    1284 -
    1285            if ($found) { -
    1286                $recordName = $this->getClassnameToReturn(); -
    1287                $record = new $recordName($this, true); -
    1288                $this->_data = array(); -
    1289                return $record; -
    1290            } -
    1291 -
    1292 -
    1293            $id = implode(' ', $id); -
    1294 -
    1295            if (isset($this->_identityMap[$id])) { -
    1296                $record = $this->_identityMap[$id]; -
    1297                $record->hydrate($this->_data); -
    1298            } else { -
    1299                $recordName = $this->getClassnameToReturn(); -
    1300                $record = new $recordName($this); -
    1301                $this->_identityMap[$id] = $record; -
    1302            } -
    1303            $this->_data = array(); -
    1304        } else { -
    1305            $recordName = $this->getClassnameToReturn(); -
    1306            $record = new $recordName($this, true); -
    1307        } -
    1308 -
    1309        return $record; -
    1310    } -
    1311 -
    1312    /** -
    1313     * Get the classname to return. Most often this is just the options['name'] -
    1314     * -
    1315     * Check the subclasses option and the inheritanceMap for each subclass to see -
    1316     * if all the maps in a subclass is met. If this is the case return that -
    1317     * subclass name. If no subclasses match or if there are no subclasses defined -
    1318     * return the name of the class for this tables record. -
    1319     * -
    1320     * @todo this function could use reflection to check the first time it runs -
    1321     * if the subclassing option is not set. -
    1322     * -
    1323     * @return string The name of the class to create -
    1324     * -
    1325     */ -
    1326    public function getClassnameToReturn() -
    1327    { -
    1328        if ( ! isset($this->_options['subclasses'])) { -
    1329            return $this->_options['name']; -
    1330        } -
    1331        foreach ($this->_options['subclasses'] as $subclass) { -
    1332            $table = $this->_conn->getTable($subclass); -
    1333            $inheritanceMap = $table->getOption('inheritanceMap'); -
    1334            $nomatch = false; -
    1335            foreach ($inheritanceMap as $key => $value) { -
    1336                if ( ! isset($this->_data[$key]) || $this->_data[$key] != $value) { -
    1337                    $nomatch = true; -
    1338                    break; -
    1339                } -
    1340            } -
    1341            if ( ! $nomatch) { -
    1342                return $table->getComponentName(); -
    1343            } -
    1344        } -
    1345        return $this->_options['name']; -
    1346    } -
    1347 -
    1348    /** -
    1349     * @param $id                       database row id -
    1350     * @throws Doctrine_Find_Exception -
    1351     */ -
    1352    final public function getProxy($id = null) -
    1353    { -
    1354        if ($id !== null) { -
    1355            $identifierColumnNames = $this->getIdentifierColumnNames(); -
    1356            $query = 'SELECT ' . implode(', ', (array) $identifierColumnNames) -
    1357                . ' FROM ' . $this->getTableName() -
    1358                . ' WHERE ' . implode(' = ? && ', (array) $identifierColumnNames) . ' = ?'; -
    1359            $query = $this->applyInheritance($query); -
    1360 -
    1361            $params = array_merge(array($id), array_values($this->_options['inheritanceMap'])); -
    1362 -
    1363            $this->_data = $this->_conn->execute($query, $params)->fetch(PDO::FETCH_ASSOC); -
    1364 -
    1365            if ($this->_data === false) -
    1366                return false; -
    1367        } -
    1368        return $this->getRecord(); -
    1369    } -
    1370 -
    1371    /** -
    1372     * applyInheritance -
    1373     * @param $where                    query where part to be modified -
    1374     * @return string                   query where part with column aggregation inheritance added -
    1375     */ -
    1376    final public function applyInheritance($where) -
    1377    { -
    1378        if ( ! empty($this->_options['inheritanceMap'])) { -
    1379            $a = array(); -
    1380            foreach ($this->_options['inheritanceMap'] as $field => $value) { -
    1381                $a[] = $this->getColumnName($field) . ' = ?'; -
    1382            } -
    1383            $i = implode(' AND ', $a); -
    1384            $where .= ' AND ' . $i; -
    1385        } -
    1386        return $where; -
    1387    } -
    1388 -
    1389    /** -
    1390     * count -
    1391     * -
    1392     * @return integer -
    1393     */ -
    1394    public function count() -
    1395    { -
    1396        $a = $this->_conn->execute('SELECT COUNT(1) FROM ' . $this->_options['tableName'])->fetch(Doctrine::FETCH_NUM); -
    1397        return current($a); -
    1398    } -
    1399 -
    1400    /** -
    1401     * @return Doctrine_Query  a Doctrine_Query object -
    1402     */ -
    1403    public function getQueryObject() -
    1404    { -
    1405        $graph = new Doctrine_Query($this->getConnection()); -
    1406        $graph->load($this->getComponentName()); -
    1407        return $graph; -
    1408    } -
    1409 -
    1410    /** -
    1411     * @param string $fieldName -
    1412     * @return array -
    1413     */ -
    1414    public function getEnumValues($fieldName) -
    1415    { -
    1416        $columnName = $this->getColumnName($fieldName); -
    1417        if (isset($this->_columns[$columnName]['values'])) { -
    1418            return $this->_columns[$columnName]['values']; -
    1419        } else { -
    1420            return array(); -
    1421        } -
    1422    } -
    1423 -
    1424    /** -
    1425     * enumValue -
    1426     * -
    1427     * @param string $field -
    1428     * @param integer $index -
    1429     * @return mixed -
    1430     */ -
    1431    public function enumValue($fieldName, $index) -
    1432    { -
    1433        if ($index instanceof Doctrine_Null) { -
    1434            return $index; -
    1435        } -
    1436         -
    1437        $columnName = $this->getColumnName($fieldName); -
    1438        if ( ! $this->_conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM) -
    1439            && isset($this->_columns[$columnName]['values'][$index]) -
    1440        ) { -
    1441            return $this->_columns[$columnName]['values'][$index]; -
    1442        } -
    1443 -
    1444        return $index; -
    1445    } -
    1446 -
    1447    /** -
    1448     * enumIndex -
    1449     * -
    1450     * @param string $field -
    1451     * @param mixed $value -
    1452     * @return mixed -
    1453     */ -
    1454    public function enumIndex($fieldName, $value) -
    1455    { -
    1456        $values = $this->getEnumValues($fieldName); -
    1457 -
    1458        $index = array_search($value, $values); -
    1459        if ($index === false || !$this->_conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) { -
    1460            return $index; -
    1461        } -
    1462        return $value; -
    1463    } -
    1464     -
    1465    /** -
    1466     * getColumnCount -
    1467     * -
    1468     * @return integer      the number of columns in this table -
    1469     */ -
    1470    public function getColumnCount() -
    1471    { -
    1472        return $this->columnCount; -
    1473    } -
    1474 -
    1475    /** -
    1476     * returns all columns and their definitions -
    1477     * -
    1478     * @return array -
    1479     */ -
    1480    public function getColumns() -
    1481    { -
    1482        return $this->_columns; -
    1483    } -
    1484 -
    1485    /** -
    1486     * removeColumn -
    1487     * removes given column -
    1488     * -
    1489     * @return boolean -
    1490     */ -
    1491    public function removeColumn($fieldName) -
    1492    { -
    1493     $columnName = array_search($fieldName, $this->_fieldNames); -
    1494 -
    1495        unset($this->_fieldNames[$columnName]); -
    1496 -
    1497        if (isset($this->_columns[$columnName])) { -
    1498            unset($this->_columns[$columnName]); -
    1499            return true; -
    1500        } -
    1501        $this->columnCount--; -
    1502         -
    1503        return false; -
    1504    } -
    1505 -
    1506    /** -
    1507     * returns an array containing all the column names. -
    1508     * -
    1509     * @return array -
    1510     */ -
    1511    public function getColumnNames(array $fieldNames = null) -
    1512    { -
    1513        if ($fieldNames === null) { -
    1514            return array_keys($this->_columns); -
    1515        } else { -
    1516           $columnNames = array(); -
    1517           foreach ($fieldNames as $fieldName) { -
    1518               $columnNames[] = $this->getColumnName($fieldName); -
    1519           } -
    1520           return $columnNames; -
    1521        } -
    1522    } -
    1523     -
    1524    /** -
    1525     * returns an array with all the identifier column names. -
    1526     * -
    1527     * @return array -
    1528     */ -
    1529    public function getIdentifierColumnNames() -
    1530    { -
    1531        return $this->getColumnNames((array) $this->getIdentifier()); -
    1532    } -
    1533     -
    1534    /** -
    1535     * returns an array containing all the field names. -
    1536     * -
    1537     * @return array -
    1538     */ -
    1539    public function getFieldNames() -
    1540    { -
    1541        return array_values($this->_fieldNames); -
    1542    } -
    1543 -
    1544    /** -
    1545     * getDefinitionOf -
    1546     * -
    1547     * @return mixed        array on success, false on failure -
    1548     */ -
    1549    public function getDefinitionOf($fieldName) -
    1550    { -
    1551        $columnName = $this->getColumnName($fieldName); -
    1552        return $this->getColumnDefinition($columnName); -
    1553    } -
    1554 -
    1555    /** -
    1556     * getTypeOf -
    1557     * -
    1558     * @return mixed        string on success, false on failure -
    1559     */ -
    1560    public function getTypeOf($fieldName) -
    1561    { -
    1562        $columnName = $this->getColumnName($fieldName); -
    1563        if (isset($this->_columns[$columnName])) { -
    1564            return $this->_columns[$columnName]['type']; -
    1565        } -
    1566        return false; -
    1567    } -
    1568 -
    1569    /** -
    1570     * setData -
    1571     * doctrine uses this function internally -
    1572     * users are strongly discouraged to use this function -
    1573     * -
    1574     * @param array $data               internal data -
    1575     * @return void -
    1576     */ -
    1577    public function setData(array $data) -
    1578    { -
    1579        $this->_data = $data; -
    1580    } -
    1581 -
    1582    /** -
    1583     * returns internal data, used by Doctrine_Record instances -
    1584     * when retrieving data from database -
    1585     * -
    1586     * @return array -
    1587     */ -
    1588    public function getData() -
    1589    { -
    1590        return $this->_data; -
    1591    } -
    1592 -
    1593    /** -
    1594     * prepareValue -
    1595     * this method performs special data preparation depending on -
    1596     * the type of the given column -
    1597     * -
    1598     * 1. It unserializes array and object typed columns -
    1599     * 2. Uncompresses gzip typed columns -
    1600     * 3. Gets the appropriate enum values for enum typed columns -
    1601     * 4. Initializes special null object pointer for null values (for fast column existence checking purposes) -
    1602     * -
    1603     * example: -
    1604     * <code type='php'> -
    1605     * $field = 'name'; -
    1606     * $value = null; -
    1607     * $table->prepareValue($field, $value); // Doctrine_Null -
    1608     * </code> -
    1609     * -
    1610     * @throws Doctrine_Table_Exception     if unserialization of array/object typed column fails or -
    1611     * @throws Doctrine_Table_Exception     if uncompression of gzip typed column fails         * -
    1612     * @param string $field     the name of the field -
    1613     * @param string $value     field value -
    1614     * @return mixed            prepared value -
    1615     */ -
    1616    public function prepareValue($fieldName, $value) -
    1617    { -
    1618        if ($value === self::$_null) { -
    1619            return self::$_null; -
    1620        } else if ($value === null) { -
    1621            return null; -
    1622        } else { -
    1623            $type = $this->getTypeOf($fieldName); -
    1624 -
    1625            switch ($type) { -
    1626                case 'array': -
    1627                case 'object': -
    1628                    if (is_string($value)) { -
    1629                        $value = unserialize($value); -
    1630 -
    1631                        if ($value === false) { -
    1632                            throw new Doctrine_Table_Exception('Unserialization of ' . $fieldName . ' failed.'); -
    1633                        } -
    1634                        return $value; -
    1635                    } -
    1636                break; -
    1637                case 'gzip': -
    1638                    $value = gzuncompress($value); -
    1639 -
    1640                    if ($value === false) { -
    1641                        throw new Doctrine_Table_Exception('Uncompressing of ' . $fieldName . ' failed.'); -
    1642                    } -
    1643                    return $value; -
    1644                break; -
    1645                case 'enum': -
    1646                    return $this->enumValue($fieldName, $value); -
    1647                break; -
    1648                case 'boolean': -
    1649                    return (boolean) $value; -
    1650                break; -
    1651                case 'integer': -
    1652                    // don't do any casting here PHP INT_MAX is smaller than what the databases support -
    1653                break; -
    1654            } -
    1655        } -
    1656        return $value; -
    1657    } -
    1658 -
    1659    /** -
    1660     * getTree -
    1661     * -
    1662     * getter for associated tree -
    1663     * -
    1664     * @return mixed  if tree return instance of Doctrine_Tree, otherwise returns false -
    1665     */ -
    1666    public function getTree() -
    1667    { -
    1668        if (isset($this->_options['treeImpl'])) { -
    1669            if ( ! $this->_tree) { -
    1670                $options = isset($this->_options['treeOptions']) ? $this->_options['treeOptions'] : array(); -
    1671                $this->_tree = Doctrine_Tree::factory($this, -
    1672                    $this->_options['treeImpl'], -
    1673                    $options -
    1674                ); -
    1675            } -
    1676            return $this->_tree; -
    1677        } -
    1678        return false; -
    1679    } -
    1680 -
    1681    /** -
    1682     * getComponentName -
    1683     * -
    1684     * @return void -
    1685     */ -
    1686    public function getComponentName() -
    1687    { -
    1688        return $this->_options['name']; -
    1689    } -
    1690 -
    1691    /** -
    1692     * getTableName -
    1693     * -
    1694     * @return void -
    1695     */ -
    1696    public function getTableName() -
    1697    { -
    1698        return $this->_options['tableName']; -
    1699    } -
    1700 -
    1701    /** -
    1702     * setTableName -
    1703     * -
    1704     * @param string $tableName  -
    1705     * @return void -
    1706     */ -
    1707    public function setTableName($tableName) -
    1708    { -
    1709        $this->setOption('tableName', $this->_conn->formatter->getTableName($tableName)); -
    1710    } -
    1711 -
    1712    /** -
    1713     * isTree -
    1714     * -
    1715     * determine if table acts as tree -
    1716     * -
    1717     * @return mixed  if tree return true, otherwise returns false -
    1718     */ -
    1719    public function isTree() -
    1720    { -
    1721        return ( ! is_null($this->_options['treeImpl'])) ? true : false; -
    1722    } -
    1723 -
    1724    /** -
    1725     * getTemplate -
    1726     * -
    1727     * @param string $template  -
    1728     * @return void -
    1729     */ -
    1730    public function getTemplate($template) -
    1731    { -
    1732        if ( ! isset($this->_templates[$template])) { -
    1733            throw new Doctrine_Table_Exception('Template ' . $template . ' not loaded'); -
    1734        } -
    1735 -
    1736        return $this->_templates[$template]; -
    1737    } -
    1738     -
    1739    public function hasTemplate($template) -
    1740    { -
    1741        return isset($this->_templates[$template]); -
    1742    } -
    1743 -
    1744    public function addTemplate($template, Doctrine_Template $impl) -
    1745    { -
    1746        $this->_templates[$template] = $impl; -
    1747 -
    1748        return $this; -
    1749    } -
    1750 -
    1751    /** -
    1752     * bindQueryParts -
    1753     * binds query parts to given component -
    1754     * -
    1755     * @param array $queryParts         an array of pre-bound query parts -
    1756     * @return Doctrine_Record          this object -
    1757     */ -
    1758    public function bindQueryParts(array $queryParts) -
    1759    { -
    1760     $this->_options['queryParts'] = $queryParts; -
    1761 -
    1762        return $this; -
    1763    } -
    1764 -
    1765    /** -
    1766     * bindQueryPart -
    1767     * binds given value to given query part -
    1768     * -
    1769     * @param string $queryPart -
    1770     * @param mixed $value -
    1771     * @return Doctrine_Record          this object -
    1772     */ -
    1773    public function bindQueryPart($queryPart, $value) -
    1774    { -
    1775     $this->_options['queryParts'][$queryPart] = $value; -
    1776 -
    1777        return $this; -
    1778    } -
    1779     -
    1780    /** -
    1781     * getBoundQueryPart -
    1782     * -
    1783     * @param string $queryPart  -
    1784     * @return string $queryPart -
    1785     */ -
    1786    public function getBoundQueryPart($queryPart) -
    1787    { -
    1788        if ( ! isset($this->_options['queryParts'][$queryPart])) { -
    1789            return null; -
    1790        } -
    1791 -
    1792        return $this->_options['queryParts'][$queryPart]; -
    1793    } -
    1794     -
    1795    /** -
    1796     * unshiftFilter -
    1797     * -
    1798     * @param  object Doctrine_Record_Filter $filter -
    1799     * @return object $this -
    1800     */ -
    1801    public function unshiftFilter(Doctrine_Record_Filter $filter) -
    1802    { -
    1803        $filter->setTable($this); -
    1804 -
    1805        $filter->init(); -
    1806 -
    1807        array_unshift($this->_filters, $filter); -
    1808 -
    1809        return $this; -
    1810    } -
    1811     -
    1812    /** -
    1813     * getFilters -
    1814     * -
    1815     * @return array $filters -
    1816     */ -
    1817    public function getFilters() -
    1818    { -
    1819        return $this->_filters; -
    1820    } -
    1821 -
    1822    /** -
    1823     * returns a string representation of this object -
    1824     * -
    1825     * @return string -
    1826     */ -
    1827    public function __toString() -
    1828    { -
    1829        return Doctrine_Lib::getTableAsString($this); -
    1830    } -
    1831     -
    1832    /** -
    1833     * findBy -
    1834     * -
    1835     * @param string $column  -
    1836     * @param string $value  -
    1837     * @param string $hydrationMode  -
    1838     * @return void -
    1839     */ -
    1840    protected function findBy($fieldName, $value, $hydrationMode = null) -
    1841    { -
    1842        return $this->createQuery()->where($fieldName . ' = ?')->execute(array($value), $hydrationMode); -
    1843    } -
    1844     -
    1845    /** -
    1846     * findOneBy -
    1847     * -
    1848     * @param string $column  -
    1849     * @param string $value  -
    1850     * @param string $hydrationMode  -
    1851     * @return void -
    1852     */ -
    1853    protected function findOneBy($fieldName, $value, $hydrationMode = null) -
    1854    { -
    1855        $results = $this->createQuery()->where($fieldName . ' = ?')->limit(1)->execute(array($value), $hydrationMode); -
    1856         -
    1857        return $hydrationMode === Doctrine::FETCH_ARRAY ? $results[0] : $results->getFirst(); -
    1858    } -
    1859     -
    1860    /** -
    1861     * __call -
    1862     * -
    1863     * Adds support for magic finders. -
    1864     * findByColumnName, findByRelationAlias -
    1865     * findById, findByContactId, etc. -
    1866     * -
    1867     * @return void -
    1868     */ -
    1869    public function __call($method, $arguments) -
    1870    { -
    1871        if (substr($method, 0, 6) == 'findBy') { -
    1872            $by = substr($method, 6, strlen($method)); -
    1873            $method = 'findBy'; -
    1874        } else if (substr($method, 0, 9) == 'findOneBy') { -
    1875            $by = substr($method, 9, strlen($method)); -
    1876            $method = 'findOneBy'; -
    1877        } -
    1878         -
    1879        if (isset($by)) { -
    1880            if ( ! isset($arguments[0])) { -
    1881                throw new Doctrine_Table_Exception('You must specify the value to findBy'); -
    1882            } -
    1883             -
    1884            $fieldName = Doctrine::tableize($by); -
    1885            $hydrationMode = isset($arguments[1]) ? $arguments[1]:null; -
    1886             -
    1887            if ($this->hasColumn($fieldName)) { -
    1888                return $this->$method($fieldName, $arguments[0], $hydrationMode); -
    1889            } else if ($this->hasRelation($by)) { -
    1890                $relation = $this->getRelation($by); -
    1891                 -
    1892                if ($relation['type'] === Doctrine_Relation::MANY) { -
    1893                    throw new Doctrine_Table_Exception('Cannot findBy many relationship.'); -
    1894                } -
    1895                 -
    1896                return $this->$method($relation['local'], $arguments[0], $hydrationMode); -
    1897            } else { -
    1898                throw new Doctrine_Table_Exception('Cannot find by: ' . $by . '. Invalid column or relationship alias.'); -
    1899            } -
    1900        } -
    1901    } -
    1902} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Table_Exception.html b/tests_old/coverage/Doctrine_Table_Exception.html deleted file mode 100644 index df6b35428..000000000 --- a/tests_old/coverage/Doctrine_Table_Exception.html +++ /dev/null @@ -1,134 +0,0 @@ - - - Coverage for Doctrine_Table_Exception - - -

    Coverage for Doctrine_Table_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * thrown when user tries to initialize a new instance of Doctrine_Table, -
    24 * while there already exists an instance of that table -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Table -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2702 $ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34class Doctrine_Table_Exception extends Doctrine_Exception -
    35{ -
    36    public function __construct($message = "Couldn't initialize table. One instance of this -
    37                            table already exists. Always use Doctrine_Session::getTable(\$name) -
    38                            to get on instance of a Doctrine_Table.") { -
    39        parent::__construct($message); -
    40    } -
    41}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Table_Repository.html b/tests_old/coverage/Doctrine_Table_Repository.html deleted file mode 100644 index 4dbec9dd3..000000000 --- a/tests_old/coverage/Doctrine_Table_Repository.html +++ /dev/null @@ -1,500 +0,0 @@ - - - Coverage for Doctrine_Table_Repository - - -

    Coverage for Doctrine_Table_Repository

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Repository.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Repository -
    24 * each record is added into Doctrine_Repository at the same time they are created, -
    25 * loaded from the database or retrieved from the cache -
    26 * -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @package     Doctrine -
    29 * @subpackage  Table -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 2963 $ -
    34 */ -
    35class Doctrine_Table_Repository implements Countable, IteratorAggregate -
    36{ -
    37    /** -
    38     * @var object Doctrine_Table $table -
    39     */ -
    40    private $table; -
    41 -
    42    /** -
    43     * @var array $registry -
    44     * an array of all records -
    45     * keys representing record object identifiers -
    46     */ -
    47    private $registry = array(); -
    48 -
    49    /** -
    50     * constructor -
    51     * -
    52     * @param Doctrine_Table $table -
    53     */ -
    54    public function __construct(Doctrine_Table $table) -
    55    { -
    56        $this->table = $table; -
    57    } -
    58 -
    59    /** -
    60     * getTable -
    61     * -
    62     * @return object Doctrine_Table -
    63     */ -
    64    public function getTable() -
    65    { -
    66        return $this->table; -
    67    } -
    68 -
    69    /** -
    70     * add -
    71     * -
    72     * @param Doctrine_Record $record       record to be added into registry -
    73     * @return boolean -
    74     */ -
    75    public function add(Doctrine_Record $record) -
    76    { -
    77        $oid = $record->getOID(); -
    78 -
    79        if (isset($this->registry[$oid])) { -
    80            return false; -
    81        } -
    82        $this->registry[$oid] = $record; -
    83 -
    84        return true; -
    85    } -
    86 -
    87    /** -
    88     * get -
    89     * @param integer $oid -
    90     * @throws Doctrine_Table_Repository_Exception -
    91     */ -
    92    public function get($oid) -
    93    { -
    94        if ( ! isset($this->registry[$oid])) { -
    95            throw new Doctrine_Table_Repository_Exception("Unknown object identifier"); -
    96        } -
    97        return $this->registry[$oid]; -
    98    } -
    99 -
    100    /** -
    101     * count -
    102     * Doctrine_Registry implements interface Countable -
    103     * @return integer                      the number of records this registry has -
    104     */ -
    105    public function count() -
    106    { -
    107        return count($this->registry); -
    108    } -
    109 -
    110    /** -
    111     * @param integer $oid                  object identifier -
    112     * @return boolean                      whether ot not the operation was successful -
    113     */ -
    114    public function evict($oid) -
    115    { -
    116        if ( ! isset($this->registry[$oid])) { -
    117            return false; -
    118        } -
    119        unset($this->registry[$oid]); -
    120        return true; -
    121    } -
    122 -
    123    /** -
    124     * @return integer                      number of records evicted -
    125     */ -
    126    public function evictAll() -
    127    { -
    128        $evicted = 0; -
    129        foreach ($this->registry as $oid=>$record) { -
    130            if ($this->evict($oid)) { -
    131                $evicted++; -
    132            } -
    133        } -
    134        return $evicted; -
    135    } -
    136 -
    137    /** -
    138     * getIterator -
    139     * @return ArrayIterator -
    140     */ -
    141    public function getIterator() -
    142    { -
    143        return new ArrayIterator($this->registry); -
    144    } -
    145 -
    146    /** -
    147     * contains -
    148     * @param integer $oid                  object identifier -
    149     */ -
    150    public function contains($oid) -
    151    { -
    152        return isset($this->registry[$oid]); -
    153    } -
    154 -
    155    /** -
    156     * loadAll -
    157     * @return void -
    158     */ -
    159    public function loadAll() -
    160    { -
    161        $this->table->findAll(); -
    162    } -
    163}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Template.html b/tests_old/coverage/Doctrine_Template.html deleted file mode 100644 index 349426085..000000000 --- a/tests_old/coverage/Doctrine_Template.html +++ /dev/null @@ -1,477 +0,0 @@ - - - Coverage for Doctrine_Template - - -

    Coverage for Doctrine_Template

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Record_Abstract'); -
    22/** -
    23 * Doctrine_Template -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Template -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Template extends Doctrine_Record_Abstract -
    34{ -
    35    /** -
    36     * @param Doctrine_Record $_invoker     the record that invoked the last delegated call -
    37     */ -
    38    protected $_invoker; -
    39     -
    40     -
    41    protected $_plugin; -
    42 -
    43    /** -
    44     * setTable -
    45     * -
    46     * @param Doctrine_Table $_table        the table object this Template belongs to -
    47     */ -
    48    public function setTable(Doctrine_Table $table) -
    49    { -
    50        $this->_table = $table; -
    51    } -
    52 -
    53    /** -
    54     * getTable -
    55     * returns the associated table object -
    56     * -
    57     * @return Doctrine_Table               the associated table object -
    58     */ -
    59    public function getTable() -
    60    { -
    61        return $this->_table; -
    62    } -
    63 -
    64    /** -
    65     * setInvoker -
    66     * -
    67     * sets the last used invoker -
    68     * -
    69     * @param Doctrine_Record $invoker      the record that invoked the last delegated call -
    70     * @return Doctrine_Template            this object -
    71     */ -
    72    public function setInvoker(Doctrine_Record $invoker) -
    73    { -
    74        $this->_invoker = $invoker; -
    75    } -
    76 -
    77    /** -
    78     * setInvoker -
    79     * returns the last used invoker -
    80     * -
    81     * @return Doctrine_Record              the record that invoked the last delegated call -
    82     */ -
    83    public function getInvoker() -
    84    { -
    85        return $this->_invoker; -
    86    } -
    87 -
    88    /** -
    89     * addChild  -
    90     * -
    91     * Adds a plugin as a child to this plugin -
    92     *  -
    93     * @param Doctrine_Template $template  -
    94     * @return Doctrine_Template. Chainable. -
    95     */ -
    96    public function addChild(Doctrine_Template $template) -
    97    { -
    98        $this->_plugin->addChild($template); -
    99         -
    100        return $this; -
    101    } -
    102 -
    103 -
    104    /** -
    105     * getPlugin  -
    106     *  -
    107     * @return void -
    108     */ -
    109    public function getPlugin() -
    110    { -
    111        return $this->_plugin; -
    112    } -
    113 -
    114    /** -
    115     * get  -
    116     *  -
    117     * @param mixed $name  -
    118     * @return void -
    119     */ -
    120    public function get($name)  -
    121    { -
    122        throw new Doctrine_Exception("Templates doesn't support accessors."); -
    123    } -
    124 -
    125    /** -
    126     * set  -
    127     *  -
    128     * @param mixed $name  -
    129     * @param mixed $value  -
    130     * @return void -
    131     */ -
    132    public function set($name, $value) -
    133    { -
    134        throw new Doctrine_Exception("Templates doesn't support accessors."); -
    135    } -
    136    /** -
    137     * setUp  -
    138     *  -
    139     * @return void -
    140     */ -
    141    public function setUp() -
    142    { -
    143 -
    144    } -
    145 -
    146    /** -
    147     * setTableDefinition  -
    148     *  -
    149     * @return void -
    150     */ -
    151    public function setTableDefinition() -
    152    { -
    153 -
    154    } -
    155} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Template_I18n.html b/tests_old/coverage/Doctrine_Template_I18n.html deleted file mode 100644 index ddfbaa4ac..000000000 --- a/tests_old/coverage/Doctrine_Template_I18n.html +++ /dev/null @@ -1,228 +0,0 @@ - - - Coverage for Doctrine_Template_I18n - - -

    Coverage for Doctrine_Template_I18n

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Template_I18n -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Template -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Template_I18n extends Doctrine_Template -
    34{ -
    35    /** -
    36     * __construct -
    37     * -
    38     * @param string $array  -
    39     * @return void -
    40     */ -
    41    public function __construct(array $options = array()) -
    42    { -
    43        $this->_plugin = new Doctrine_I18n($options); -
    44    } -
    45    /** -
    46     * setUp -
    47     * -
    48     * @return void -
    49     */ -
    50    public function setUp() -
    51    { -
    52        $name = $this->_table->getComponentName(); -
    53 -
    54        $this->_plugin->buildPluginDefinition($this->_table); -
    55 -
    56        $className = $this->_plugin->getOption('className'); -
    57 -
    58        $id = $this->_table->getIdentifier(); -
    59 -
    60        $this->hasMany($className . ' as Translation', array('local' => $id, 'foreign' => $id)); -
    61    } -
    62     -
    63    /** -
    64     * getI18n -
    65     * -
    66     * @return void -
    67     */ -
    68    public function getI18n() -
    69    { -
    70        return $this->_plugin; -
    71    } -
    72} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Template_Listener_Timestampable.html b/tests_old/coverage/Doctrine_Template_Listener_Timestampable.html deleted file mode 100644 index 751c498b0..000000000 --- a/tests_old/coverage/Doctrine_Template_Listener_Timestampable.html +++ /dev/null @@ -1,314 +0,0 @@ - - - Coverage for Doctrine_Template_Listener_Timestampable - - -

    Coverage for Doctrine_Template_Listener_Timestampable

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Template_Listener_Timestampable -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Template -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Template_Listener_Timestampable extends Doctrine_Record_Listener -
    34{ -
    35    /** -
    36     * Array of timestampable options -
    37     * -
    38     * @var string -
    39     */ -
    40    protected $_options = array(); -
    41     -
    42    /** -
    43     * __construct -
    44     * -
    45     * @param string $options  -
    46     * @return void -
    47     */ -
    48    public function __construct(array $options) -
    49    { -
    50        $this->_options = $options; -
    51    } -
    52     -
    53    /** -
    54     * preInsert -
    55     * -
    56     * @param object $Doctrine_Event  -
    57     * @return void -
    58     */ -
    59    public function preInsert(Doctrine_Event $event) -
    60    { -
    61        $createdName = $this->_options['created']['name']; -
    62        $updatedName = $this->_options['updated']['name']; -
    63         -
    64        $event->getInvoker()->$createdName = $this->getTimestamp('created'); -
    65        $event->getInvoker()->$updatedName = $this->getTimestamp('updated'); -
    66    } -
    67     -
    68    /** -
    69     * preUpdate -
    70     * -
    71     * @param object $Doctrine_Event  -
    72     * @return void -
    73     */ -
    74    public function preUpdate(Doctrine_Event $event) -
    75    { -
    76        $updatedName = $this->_options['updated']['name']; -
    77         -
    78        $event->getInvoker()->$updatedName = $this->getTimestamp('updated'); -
    79    } -
    80     -
    81    /** -
    82     * getTimestamp -
    83     * -
    84     * Gets the timestamp in the correct format -
    85     * -
    86     * @param string $type  -
    87     * @return void -
    88     */ -
    89    public function getTimestamp($type) -
    90    { -
    91        $options = $this->_options[$type]; -
    92         -
    93        if ($options['type'] == 'date') { -
    94            return date($options['format'], time()); -
    95        } else if ($options['type'] == 'timestamp') { -
    96            return date($options['format'], time()); -
    97        } else { -
    98            return time(); -
    99        } -
    100    } -
    101}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Template_NestedSet.html b/tests_old/coverage/Doctrine_Template_NestedSet.html deleted file mode 100644 index c8c055190..000000000 --- a/tests_old/coverage/Doctrine_Template_NestedSet.html +++ /dev/null @@ -1,152 +0,0 @@ - - - Coverage for Doctrine_Template_NestedSet - - -

    Coverage for Doctrine_Template_NestedSet

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Template_NestedSet -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Template -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Roman Borschel <roman@code-factory.org> -
    32 */ -
    33class Doctrine_Template_NestedSet extends Doctrine_Template -
    34{ -
    35    private $_options; -
    36     -
    37    public function __construct(array $options) -
    38    { -
    39        $this->_options = $options; -
    40    } -
    41     -
    42    public function setUp() -
    43    { -
    44        $this->_table->setOption('treeOptions', $this->_options); -
    45        $this->_table->setOption('treeImpl', 'NestedSet'); -
    46    } -
    47}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Template_Searchable.html b/tests_old/coverage/Doctrine_Template_Searchable.html deleted file mode 100644 index 60eecf710..000000000 --- a/tests_old/coverage/Doctrine_Template_Searchable.html +++ /dev/null @@ -1,213 +0,0 @@ - - - Coverage for Doctrine_Template_Searchable - - -

    Coverage for Doctrine_Template_Searchable

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Template_Searchable -
    24 * -
    25 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    26 * @package     Doctrine -
    27 * @subpackage  Template -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @version     $Revision$ -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 */ -
    33class Doctrine_Template_Searchable extends Doctrine_Template -
    34{      -
    35    public function __construct(array $options) -
    36    { -
    37        $this->_plugin = new Doctrine_Search($options);  -
    38    } -
    39     -
    40    public function getPlugin() -
    41    { -
    42        return $this->_plugin; -
    43    } -
    44 -
    45    public function setUp() -
    46    { -
    47        $id = $this->_table->getIdentifier(); -
    48        $name = $this->_table->getComponentName(); -
    49        $className = $this->_plugin->getOption('className'); -
    50 -
    51        if (strpos($className, '%CLASS%') !== false) { -
    52            $this->_plugin->setOption('className', str_replace('%CLASS%', $name, $className)); -
    53            $className = $this->_plugin->getOption('className'); -
    54        } -
    55        $this->_plugin->setOption('resource', $this->_table); -
    56        $this->_plugin->buildDefinition(); -
    57 -
    58        $this->hasMany($className, array('local' => $id, 'foreign' => $id)); -
    59 -
    60        $this->addListener(new Doctrine_Search_Listener($this->_plugin)); -
    61    } -
    62 -
    63    public function batchUpdateIndex($limit = null, $offset = null) -
    64    { -
    65        $this->_plugin->batchUpdateIndex($limit, $offset); -
    66    } -
    67} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Template_Sluggable.html b/tests_old/coverage/Doctrine_Template_Sluggable.html deleted file mode 100644 index 95b421d9f..000000000 --- a/tests_old/coverage/Doctrine_Template_Sluggable.html +++ /dev/null @@ -1,222 +0,0 @@ - - - Coverage for Doctrine_Template_Sluggable - - -

    Coverage for Doctrine_Template_Sluggable

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Template_Sluggable -
    24 * -
    25 * Easily create a slug for each record based on a specified set of fields -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Template -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision$ -
    33 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    34 */ -
    35class Doctrine_Template_Sluggable extends Doctrine_Template -
    36{ -
    37    /** -
    38     * Array of timestampable options -
    39     * -
    40     * @var string -
    41     */ -
    42    protected $_options = array('name'    =>  'slug', -
    43                                'type'    =>  'clob', -
    44                                'length'  =>  null, -
    45                                'options' =>  array(), -
    46                                'fields'  =>  array()); -
    47     -
    48    /** -
    49     * __construct -
    50     * -
    51     * @param string $array  -
    52     * @return void -
    53     */ -
    54    public function __construct(array $options) -
    55    { -
    56        $this->_options = array_merge($options, $this->_options); -
    57    } -
    58     -
    59    /** -
    60     * setTableDefinition -
    61     * -
    62     * @return void -
    63     */ -
    64    public function setTableDefinition() -
    65    { -
    66        $this->hasColumn($this->_options['name'], $this->_options['type'], $this->_options['length'], $this->_options['options']); -
    67         -
    68        $this->addListener(new Doctrine_Template_Listener_Sluggable($this->_options)); -
    69    } -
    70} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Template_Timestampable.html b/tests_old/coverage/Doctrine_Template_Timestampable.html deleted file mode 100644 index 24a4045e1..000000000 --- a/tests_old/coverage/Doctrine_Template_Timestampable.html +++ /dev/null @@ -1,233 +0,0 @@ - - - Coverage for Doctrine_Template_Timestampable - - -

    Coverage for Doctrine_Template_Timestampable

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Template_Timestampable -
    24 * -
    25 * Easily add created and updated at timestamps to your doctrine records -
    26 * -
    27 * @package     Doctrine -
    28 * @subpackage  Template -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision$ -
    33 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    34 */ -
    35class Doctrine_Template_Timestampable extends Doctrine_Template -
    36{ -
    37    /** -
    38     * Array of timestampable options -
    39     * -
    40     * @var string -
    41     */ -
    42    protected $_options = array('created' =>  array('name'    =>  'created_at', -
    43                                                    'type'    =>  'timestamp', -
    44                                                    'format'  =>  'Y-m-d H:i:s', -
    45                                                    'options' =>  array()), -
    46                                'updated' =>  array('name'    =>  'updated_at', -
    47                                                    'type'    =>  'timestamp', -
    48                                                    'format'  =>  'Y-m-d H:i:s', -
    49                                                    'options' =>  array())); -
    50     -
    51    /** -
    52     * __construct -
    53     * -
    54     * @param string $array  -
    55     * @return void -
    56     */ -
    57    public function __construct(array $options) -
    58    { -
    59        $this->_options = array_merge($options, $this->_options); -
    60    } -
    61     -
    62    /** -
    63     * setTableDefinition -
    64     * -
    65     * @return void -
    66     */ -
    67    public function setTableDefinition() -
    68    { -
    69        $this->hasColumn($this->_options['created']['name'], $this->_options['created']['type'], null, $this->_options['created']['name']); -
    70        $this->hasColumn($this->_options['updated']['name'], $this->_options['updated']['type'], null, $this->_options['updated']['name']); -
    71         -
    72        $this->addListener(new Doctrine_Template_Listener_Timestampable($this->_options)); -
    73    } -
    74}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Template_Versionable.html b/tests_old/coverage/Doctrine_Template_Versionable.html deleted file mode 100644 index 8d2357283..000000000 --- a/tests_old/coverage/Doctrine_Template_Versionable.html +++ /dev/null @@ -1,168 +0,0 @@ - - - Coverage for Doctrine_Template_Versionable - - -

    Coverage for Doctrine_Template_Versionable

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Template_Versionable -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Template -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Template_Versionable extends Doctrine_Template -
    34{ -
    35    public function __construct(array $options) -
    36    { -
    37        $this->_plugin = new Doctrine_AuditLog($options); -
    38    } -
    39    public function setUp() -
    40    { -
    41        $this->_plugin->buildPluginDefinition($this->_table); -
    42 -
    43        $this->hasColumn('version', 'integer', 8); -
    44 -
    45        $this->addListener(new Doctrine_AuditLog_Listener($this->_plugin)); -
    46    } -
    47    public function getAuditLog() -
    48    { -
    49        return $this->_plugin; -
    50    } -
    51 -
    52} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Tokenizer.html b/tests_old/coverage/Doctrine_Tokenizer.html deleted file mode 100644 index e4ce1432e..000000000 --- a/tests_old/coverage/Doctrine_Tokenizer.html +++ /dev/null @@ -1,951 +0,0 @@ - - - Coverage for Doctrine_Tokenizer - - -

    Coverage for Doctrine_Tokenizer

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: From.php 1080 2007-02-10 18:17:08Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Tokenizer -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Tokenizer -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1080 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Tokenizer  -
    34{ -
    35    /** -
    36     * trims brackets -
    37     * -
    38     * @param string $str -
    39     * @param string $e1        the first bracket, usually '(' -
    40     * @param string $e2        the second bracket, usually ')' -
    41     */ -
    42    public static function bracketTrim($str, $e1 = '(', $e2 = ')') -
    43    { -
    44        if (substr($str, 0, 1) === $e1 && substr($str, -1) === $e2) { -
    45            return substr($str, 1, -1); -
    46        } else { -
    47            return $str; -
    48        } -
    49    } -
    50 -
    51    /** -
    52     * bracketExplode -
    53     * -
    54     * example: -
    55     * -
    56     * parameters: -
    57     *      $str = (age < 20 AND age > 18) AND email LIKE 'John@example.com' -
    58     *      $d = ' AND ' -
    59     *      $e1 = '(' -
    60     *      $e2 = ')' -
    61     * -
    62     * would return an array: -
    63     *      array("(age < 20 AND age > 18)", -
    64     *            "email LIKE 'John@example.com'") -
    65     * -
    66     * @param string $str -
    67     * @param string $d         the delimeter which explodes the string -
    68     * @param string $e1        the first bracket, usually '(' -
    69     * @param string $e2        the second bracket, usually ')' -
    70     * -
    71     */ -
    72    public static function bracketExplode($str, $d = ' ', $e1 = '(', $e2 = ')') -
    73    { -
    74        if (is_array($d)) { -
    75            $a = preg_split('/('.implode('|', $d).')/', $str); -
    76            $d = stripslashes($d[0]); -
    77        } else { -
    78            $a = explode($d, $str); -
    79        } -
    80 -
    81        $i = 0; -
    82        $term = array(); -
    83        foreach($a as $key=>$val) { -
    84            if (empty($term[$i])) { -
    85                $term[$i] = trim($val); -
    86                $s1 = substr_count($term[$i], $e1); -
    87                $s2 = substr_count($term[$i], $e2); -
    88                 -
    89                if ($s1 == $s2) { -
    90                    $i++; -
    91                } -
    92            } else { -
    93                $term[$i] .= $d . trim($val); -
    94                $c1 = substr_count($term[$i], $e1); -
    95                $c2 = substr_count($term[$i], $e2); -
    96                 -
    97                if ($c1 == $c2) {  -
    98                    $i++; -
    99                } -
    100            } -
    101        } -
    102        return $term; -
    103    } -
    104 -
    105    /** -
    106     * quoteExplode -
    107     * -
    108     * example: -
    109     * -
    110     * parameters: -
    111     *      $str = email LIKE 'John@example.com' -
    112     *      $d = ' AND ' -
    113     * -
    114     * would return an array: -
    115     *      array("email", "LIKE", "'John@example.com'") -
    116     * -
    117     * @param string $str -
    118     * @param string $d         the delimeter which explodes the string -
    119     */ -
    120    public static function quoteExplode($str, $d = ' ') -
    121    { -
    122        if (is_array($d)) { -
    123            $a = preg_split('/('.implode('|', $d).')/', $str); -
    124            $d = stripslashes($d[0]); -
    125        } else { -
    126            $a = explode($d, $str); -
    127        } -
    128 -
    129        $i = 0; -
    130        $term = array(); -
    131        foreach ($a as $key => $val) { -
    132            if (empty($term[$i])) { -
    133                $term[$i] = trim($val); -
    134 -
    135                if ( ! (substr_count($term[$i], "'") & 1)) { -
    136                    $i++; -
    137                } -
    138            } else { -
    139                $term[$i] .= $d . trim($val); -
    140 -
    141                if ( ! (substr_count($term[$i], "'") & 1)) { -
    142                    $i++; -
    143                } -
    144            } -
    145        } -
    146        return $term; -
    147    } -
    148 -
    149    /** -
    150     * sqlExplode -
    151     * -
    152     * explodes a string into array using custom brackets and -
    153     * quote delimeters -
    154     * -
    155     * -
    156     * example: -
    157     * -
    158     * parameters: -
    159     *      $str = "(age < 20 AND age > 18) AND name LIKE 'John Doe'" -
    160     *      $d   = ' ' -
    161     *      $e1  = '(' -
    162     *      $e2  = ')' -
    163     * -
    164     * would return an array: -
    165     *      array('(age < 20 AND age > 18)', -
    166     *            'name', -
    167     *            'LIKE', -
    168     *            'John Doe') -
    169     * -
    170     * @param string $str -
    171     * @param string $d         the delimeter which explodes the string -
    172     * @param string $e1        the first bracket, usually '(' -
    173     * @param string $e2        the second bracket, usually ')' -
    174     * -
    175     * @return array -
    176     */ -
    177    public static function sqlExplode($str, $d = ' ', $e1 = '(', $e2 = ')') -
    178    { -
    179        if ($d == ' ') { -
    180            $d = array(' ', '\s'); -
    181        } -
    182        if (is_array($d)) { -
    183            $d = array_map('preg_quote', $d); -
    184 -
    185            if (in_array(' ', $d)) { -
    186                $d[] = '\s'; -
    187            } -
    188 -
    189            $split = '§(' . implode('|', $d) . ')§'; -
    190 -
    191            $str = preg_split($split, $str); -
    192            $d = stripslashes($d[0]); -
    193        } else { -
    194            $str = explode($d, $str); -
    195        } -
    196 -
    197        $i = 0; -
    198        $term = array(); -
    199 -
    200        foreach ($str as $key => $val) { -
    201            if (empty($term[$i])) { -
    202                $term[$i] = trim($val); -
    203 -
    204                $s1 = substr_count($term[$i], $e1); -
    205                $s2 = substr_count($term[$i], $e2); -
    206 -
    207                if (strpos($term[$i], '(') !== false) { -
    208                    if ($s1 == $s2) { -
    209                        $i++; -
    210                    } -
    211                } else { -
    212                    if ( ! (substr_count($term[$i], "'") & 1) && -
    213                         ! (substr_count($term[$i], "\"") & 1)) { -
    214                        $i++; -
    215                    } -
    216                } -
    217            } else { -
    218                $term[$i] .= $d . trim($val); -
    219                $c1 = substr_count($term[$i], $e1); -
    220                $c2 = substr_count($term[$i], $e2); -
    221 -
    222                if (strpos($term[$i], '(') !== false) { -
    223                    if ($c1 == $c2) { -
    224                        $i++; -
    225                    } -
    226                } else { -
    227                    if ( ! (substr_count($term[$i], "'") & 1) && -
    228                         ! (substr_count($term[$i], "\"") & 1)) { -
    229                        $i++; -
    230                    } -
    231                } -
    232            } -
    233        } -
    234        return $term; -
    235    } -
    236 -
    237    /** -
    238     * clauseExplode -
    239     * -
    240     * explodes a string into array using custom brackets and -
    241     * quote delimeters -
    242     * -
    243     * -
    244     * example: -
    245     * -
    246     * parameters: -
    247     *      $str = "(age < 20 AND age > 18) AND name LIKE 'John Doe'" -
    248     *      $d   = ' ' -
    249     *      $e1  = '(' -
    250     *      $e2  = ')' -
    251     * -
    252     * would return an array: -
    253     *      array('(age < 20 AND age > 18)', -
    254     *            'name', -
    255     *            'LIKE', -
    256     *            'John Doe') -
    257     * -
    258     * @param string $str -
    259     * @param string $d         the delimeter which explodes the string -
    260     * @param string $e1        the first bracket, usually '(' -
    261     * @param string $e2        the second bracket, usually ')' -
    262     * -
    263     * @return array -
    264     */ -
    265    public static function clauseExplode($str, array $d, $e1 = '(', $e2 = ')') -
    266    { -
    267        if (is_array($d)) { -
    268            $d = array_map('preg_quote', $d); -
    269 -
    270            if (in_array(' ', $d)) { -
    271                $d[] = '\s'; -
    272            } -
    273 -
    274            $split = '§(' . implode('|', $d) . ')§'; -
    275 -
    276            $str = preg_split($split, $str, -1, PREG_SPLIT_DELIM_CAPTURE); -
    277        } -
    278 -
    279        $i = 0; -
    280        $term = array(); -
    281 -
    282        foreach ($str as $key => $val) { -
    283            if ($key & 1) { -
    284                if (isset($term[($i - 1)]) && ! is_array($term[($i - 1)])) { -
    285                    $term[($i - 1)] = array($term[($i - 1)], $val); -
    286                } -
    287                continue; -
    288            } -
    289            if (empty($term[$i])) { -
    290                $term[$i] = $val; -
    291            } else { -
    292                $term[$i] .= $str[($key - 1)] . $val; -
    293            } -
    294 -
    295            $c1 = substr_count($term[$i], $e1); -
    296            $c2 = substr_count($term[$i], $e2); -
    297 -
    298            if (strpos($term[$i], '(') !== false) { -
    299                if ($c1 == $c2) { -
    300                    $i++; -
    301                } -
    302            } else { -
    303                if ( ! (substr_count($term[$i], "'") & 1) && -
    304                     ! (substr_count($term[$i], "\"") & 1)) { -
    305                    $i++; -
    306                } -
    307            } -
    308        } -
    309        $term[$i - 1] = array($term[$i - 1], ''); -
    310 -
    311        return $term; -
    312    } -
    313} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction.html b/tests_old/coverage/Doctrine_Transaction.html deleted file mode 100644 index 2e1eb9e71..000000000 --- a/tests_old/coverage/Doctrine_Transaction.html +++ /dev/null @@ -1,1371 +0,0 @@ - - - Coverage for Doctrine_Transaction - - -

    Coverage for Doctrine_Transaction

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Transaction.php 3184 2007-11-18 16:42:33Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Connection_Module'); -
    22/** -
    23 * Doctrine_Transaction -
    24 * Handles transaction savepoint and isolation abstraction -
    25 * -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @package     Doctrine -
    30 * @subpackage  Transaction -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 3184 $ -
    34 */ -
    35class Doctrine_Transaction extends Doctrine_Connection_Module -
    36{ -
    37    /** -
    38     * Doctrine_Transaction is in sleep state when it has no active transactions -
    39     */ -
    40    const STATE_SLEEP       = 0; -
    41 -
    42    /** -
    43     * Doctrine_Transaction is in active state when it has one active transaction -
    44     */ -
    45    const STATE_ACTIVE      = 1; -
    46 -
    47    /** -
    48     * Doctrine_Transaction is in busy state when it has multiple active transactions -
    49     */ -
    50    const STATE_BUSY        = 2; -
    51 -
    52    /** -
    53     * @var integer $transactionLevel      the nesting level of transactions, used by transaction methods -
    54     */ -
    55    protected $transactionLevel  = 0; -
    56 -
    57    /** -
    58     * @var array $invalid                  an array containing all invalid records within this transaction -
    59     * @todo What about a more verbose name? $invalidRecords? -
    60     */ -
    61    protected $invalid          = array(); -
    62 -
    63    /** -
    64     * @var array $savepoints               an array containing all savepoints -
    65     */ -
    66    protected $savePoints       = array(); -
    67 -
    68    /** -
    69     * @var array $_collections             an array of Doctrine_Collection objects that were affected during the Transaction -
    70     */ -
    71    protected $_collections     = array(); -
    72 -
    73    /** -
    74     * addCollection -
    75     * adds a collection in the internal array of collections -
    76     * -
    77     * at the end of each commit this array is looped over and -
    78     * of every collection Doctrine then takes a snapshot in order -
    79     * to keep the collections up to date with the database -
    80     * -
    81     * @param Doctrine_Collection $coll     a collection to be added -
    82     * @return Doctrine_Transaction         this object -
    83     */ -
    84    public function addCollection(Doctrine_Collection $coll) -
    85    { -
    86        $this->_collections[] = $coll; -
    87 -
    88        return $this; -
    89    } -
    90 -
    91    /** -
    92     * getState -
    93     * returns the state of this connection -
    94     * -
    95     * @see Doctrine_Connection_Transaction::STATE_* constants -
    96     * @return integer          the connection state -
    97     */ -
    98    public function getState() -
    99    { -
    100        switch ($this->transactionLevel) { -
    101            case 0: -
    102                return Doctrine_Transaction::STATE_SLEEP; -
    103                break; -
    104            case 1: -
    105                return Doctrine_Transaction::STATE_ACTIVE; -
    106                break; -
    107            default: -
    108                return Doctrine_Transaction::STATE_BUSY; -
    109        } -
    110    } -
    111 -
    112    /** -
    113     * addInvalid -
    114     * adds record into invalid records list -
    115     * -
    116     * @param Doctrine_Record $record -
    117     * @return boolean        false if record already existed in invalid records list, -
    118     *                        otherwise true -
    119     */ -
    120    public function addInvalid(Doctrine_Record $record) -
    121    { -
    122        if (in_array($record, $this->invalid, true)) { -
    123            return false; -
    124        } -
    125        $this->invalid[] = $record; -
    126        return true; -
    127    } -
    128 -
    129 -
    130   /** -
    131    * Return the invalid records -
    132    * -
    133    * @return array An array of invalid records -
    134    */  -
    135    public function getInvalid(){ -
    136        return $this->invalid; -
    137    } -
    138 -
    139    /** -
    140     * getTransactionLevel -
    141     * get the current transaction nesting level -
    142     * -
    143     * @return integer -
    144     */ -
    145    public function getTransactionLevel() -
    146    { -
    147        return $this->transactionLevel; -
    148    } -
    149 -
    150    /** -
    151     * getTransactionLevel -
    152     * set the current transaction nesting level -
    153     * -
    154     * @return Doctrine_Transaction     this object -
    155     */ -
    156    public function setTransactionLevel($level) -
    157    { -
    158        $this->transactionLevel = $level; -
    159 -
    160        return $this; -
    161    } -
    162 -
    163    /** -
    164     * beginTransaction -
    165     * Start a transaction or set a savepoint. -
    166     * -
    167     * if trying to set a savepoint and there is no active transaction -
    168     * a new transaction is being started -
    169     * -
    170     * Listeners: onPreTransactionBegin, onTransactionBegin -
    171     * -
    172     * @param string $savepoint                 name of a savepoint to set -
    173     * @throws Doctrine_Transaction_Exception   if the transaction fails at database level      -
    174     * @return integer                          current transaction nesting level -
    175     */ -
    176    public function beginTransaction($savepoint = null) -
    177    { -
    178        $this->conn->connect(); -
    179         -
    180        $listener = $this->conn->getAttribute(Doctrine::ATTR_LISTENER); -
    181 -
    182        if ( ! is_null($savepoint)) { -
    183            $this->savePoints[] = $savepoint; -
    184 -
    185            $event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_CREATE); -
    186 -
    187            $listener->preSavepointCreate($event); -
    188 -
    189            if ( ! $event->skipOperation) { -
    190                $this->createSavePoint($savepoint); -
    191            } -
    192 -
    193            $listener->postSavepointCreate($event); -
    194        } else { -
    195            if ($this->transactionLevel == 0) { -
    196                $event = new Doctrine_Event($this, Doctrine_Event::TX_BEGIN); -
    197 -
    198                $listener->preTransactionBegin($event); -
    199 -
    200                if ( ! $event->skipOperation) { -
    201                    try { -
    202                        $this->conn->getDbh()->beginTransaction(); -
    203                    } catch(Exception $e) { -
    204                        throw new Doctrine_Transaction_Exception($e->getMessage()); -
    205                    } -
    206                } -
    207                $listener->postTransactionBegin($event); -
    208            } -
    209        } -
    210 -
    211        $level = ++$this->transactionLevel; -
    212 -
    213        return $level; -
    214    } -
    215 -
    216    /** -
    217     * commit -
    218     * Commit the database changes done during a transaction that is in -
    219     * progress or release a savepoint. This function may only be called when -
    220     * auto-committing is disabled, otherwise it will fail. -
    221     * -
    222     * Listeners: preTransactionCommit, postTransactionCommit -
    223     * -
    224     * @param string $savepoint                 name of a savepoint to release -
    225     * @throws Doctrine_Transaction_Exception   if the transaction fails at database level -
    226     * @throws Doctrine_Validator_Exception     if the transaction fails due to record validations -
    227     * @return boolean                          false if commit couldn't be performed, true otherwise -
    228     */ -
    229    public function commit($savepoint = null) -
    230    { -
    231        $this->conn->connect(); -
    232 -
    233        if ($this->transactionLevel == 0) { -
    234            return false; -
    235        } -
    236 -
    237        $listener = $this->conn->getAttribute(Doctrine::ATTR_LISTENER); -
    238 -
    239        if ( ! is_null($savepoint)) { -
    240            $this->transactionLevel -= $this->removeSavePoints($savepoint); -
    241 -
    242            $event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_COMMIT); -
    243 -
    244            $listener->preSavepointCommit($event); -
    245 -
    246            if ( ! $event->skipOperation) { -
    247                $this->releaseSavePoint($savepoint); -
    248            } -
    249 -
    250            $listener->postSavepointCommit($event); -
    251        } else {             -
    252            if ($this->transactionLevel == 1) { -
    253                if ( ! empty($this->invalid)) { -
    254                    $this->rollback(); -
    255                    $tmp = $this->invalid; -
    256                    $this->invalid = array(); -
    257                    throw new Doctrine_Validator_Exception($tmp); -
    258                } -
    259                // take snapshots of all collections used within this transaction -
    260                foreach ($this->_collections as $coll) { -
    261                    $coll->takeSnapshot(); -
    262                } -
    263                $this->_collections = array(); -
    264                 -
    265                $event = new Doctrine_Event($this, Doctrine_Event::TX_COMMIT); -
    266             -
    267                $listener->preTransactionCommit($event); -
    268                if ( ! $event->skipOperation) { -
    269                    $this->conn->getDbh()->commit(); -
    270                } -
    271                $listener->postTransactionCommit($event); -
    272 -
    273            } -
    274             -
    275            $this->transactionLevel--; -
    276        } -
    277 -
    278        return true; -
    279    } -
    280 -
    281    /** -
    282     * rollback -
    283     * Cancel any database changes done during a transaction or since a specific -
    284     * savepoint that is in progress. This function may only be called when -
    285     * auto-committing is disabled, otherwise it will fail. Therefore, a new -
    286     * transaction is implicitly started after canceling the pending changes. -
    287     * -
    288     * this method can be listened with onPreTransactionRollback and onTransactionRollback -
    289     * eventlistener methods -
    290     * -
    291     * @param string $savepoint                 name of a savepoint to rollback to    -
    292     * @throws Doctrine_Transaction_Exception   if the rollback operation fails at database level -
    293     * @return boolean                          false if rollback couldn't be performed, true otherwise -
    294     * @todo Shouldnt this method only commit a rollback if the transactionLevel is 1 -
    295     *       (STATE_ACTIVE)? Explanation: Otherwise a rollback that is triggered from inside doctrine -
    296     *       in an (emulated) nested transaction would lead to a complete database level -
    297     *       rollback even though the client code did not yet want to do that. -
    298     *       In other words: if the user starts a transaction doctrine shouldnt roll it back. -
    299     *       Doctrine should only roll back transactions started by doctrine. Thoughts? -
    300     */ -
    301    public function rollback($savepoint = null) -
    302    { -
    303        $this->conn->connect(); -
    304        $currentState = $this->getState(); -
    305         -
    306        if ($currentState != self::STATE_ACTIVE && $currentState != self::STATE_BUSY) { -
    307            return false; -
    308        } -
    309 -
    310        $listener = $this->conn->getAttribute(Doctrine::ATTR_LISTENER); -
    311 -
    312        if ( ! is_null($savepoint)) { -
    313            $this->transactionLevel -= $this->removeSavePoints($savepoint); -
    314 -
    315            $event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_ROLLBACK); -
    316 -
    317            $listener->preSavepointRollback($event); -
    318             -
    319            if ( ! $event->skipOperation) { -
    320                $this->rollbackSavePoint($savepoint); -
    321            } -
    322 -
    323            $listener->postSavepointRollback($event); -
    324        } else { -
    325            $event = new Doctrine_Event($this, Doctrine_Event::TX_ROLLBACK); -
    326     -
    327            $listener->preTransactionRollback($event); -
    328             -
    329            if ( ! $event->skipOperation) { -
    330                $this->transactionLevel = 0; -
    331                try { -
    332                    $this->conn->getDbh()->rollback(); -
    333                } catch (Exception $e) { -
    334                    throw new Doctrine_Transaction_Exception($e->getMessage()); -
    335                } -
    336            } -
    337 -
    338            $listener->postTransactionRollback($event); -
    339        } -
    340 -
    341        return true; -
    342    } -
    343 -
    344    /** -
    345     * releaseSavePoint -
    346     * creates a new savepoint -
    347     * -
    348     * @param string $savepoint     name of a savepoint to create -
    349     * @return void -
    350     */ -
    351    protected function createSavePoint($savepoint) -
    352    { -
    353        throw new Doctrine_Transaction_Exception('Savepoints not supported by this driver.'); -
    354    } -
    355 -
    356    /** -
    357     * releaseSavePoint -
    358     * releases given savepoint -
    359     * -
    360     * @param string $savepoint     name of a savepoint to release -
    361     * @return void -
    362     */ -
    363    protected function releaseSavePoint($savepoint) -
    364    { -
    365        throw new Doctrine_Transaction_Exception('Savepoints not supported by this driver.'); -
    366    } -
    367 -
    368    /** -
    369     * rollbackSavePoint -
    370     * releases given savepoint -
    371     * -
    372     * @param string $savepoint     name of a savepoint to rollback to -
    373     * @return void -
    374     */ -
    375    protected function rollbackSavePoint($savepoint) -
    376    { -
    377        throw new Doctrine_Transaction_Exception('Savepoints not supported by this driver.'); -
    378    } -
    379 -
    380    /** -
    381     * removeSavePoints -
    382     * removes a savepoint from the internal savePoints array of this transaction object -
    383     * and all its children savepoints -
    384     * -
    385     * @param sring $savepoint      name of the savepoint to remove -
    386     * @return integer              removed savepoints -
    387     */ -
    388    private function removeSavePoints($savepoint) -
    389    { -
    390        $this->savePoints = array_values($this->savePoints); -
    391 -
    392        $found = false; -
    393        $i = 0; -
    394 -
    395        foreach ($this->savePoints as $key => $sp) { -
    396            if ( ! $found) { -
    397                if ($sp === $savepoint) { -
    398                    $found = true; -
    399                } -
    400            } -
    401            if ($found) { -
    402                $i++; -
    403                unset($this->savePoints[$key]); -
    404            } -
    405        } -
    406 -
    407        return $i; -
    408    } -
    409 -
    410    /** -
    411     * setIsolation -
    412     * -
    413     * Set the transacton isolation level. -
    414     * (implemented by the connection drivers) -
    415     * -
    416     * example: -
    417     * -
    418     * <code> -
    419     * $tx->setIsolation('READ UNCOMMITTED'); -
    420     * </code> -
    421     * -
    422     * @param   string  standard isolation level -
    423     *                  READ UNCOMMITTED (allows dirty reads) -
    424     *                  READ COMMITTED (prevents dirty reads) -
    425     *                  REPEATABLE READ (prevents nonrepeatable reads) -
    426     *                  SERIALIZABLE (prevents phantom reads) -
    427     * -
    428     * @throws Doctrine_Transaction_Exception           if the feature is not supported by the driver -
    429     * @throws PDOException                             if something fails at the PDO level -
    430     * @return void -
    431     */ -
    432    public function setIsolation($isolation) -
    433    { -
    434        throw new Doctrine_Transaction_Exception('Transaction isolation levels not supported by this driver.'); -
    435    } -
    436 -
    437    /** -
    438     * getTransactionIsolation -
    439     * -
    440     * fetches the current session transaction isolation level -
    441     * -
    442     * note: some drivers may support setting the transaction isolation level -
    443     * but not fetching it -
    444     * -
    445     * @throws Doctrine_Transaction_Exception           if the feature is not supported by the driver -
    446     * @throws PDOException                             if something fails at the PDO level -
    447     * @return string                                   returns the current session transaction isolation level -
    448     */ -
    449    public function getIsolation() -
    450    { -
    451        throw new Doctrine_Transaction_Exception('Fetching transaction isolation level not supported by this driver.'); -
    452    } -
    453} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction_Exception.html b/tests_old/coverage/Doctrine_Transaction_Exception.html deleted file mode 100644 index 899cf8d20..000000000 --- a/tests_old/coverage/Doctrine_Transaction_Exception.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Coverage for Doctrine_Transaction_Exception - - -

    Coverage for Doctrine_Transaction_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2703 2007-10-03 21:47:55Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Transaction_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Transaction -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    29 * @since       1.0 -
    30 * @version     $Revision: 2703 $ -
    31 * @link        www.phpdoctrine.org -
    32 */ -
    33class Doctrine_Transaction_Exception extends Doctrine_Exception -
    34{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction_Firebird.html b/tests_old/coverage/Doctrine_Transaction_Firebird.html deleted file mode 100644 index 83f203783..000000000 --- a/tests_old/coverage/Doctrine_Transaction_Firebird.html +++ /dev/null @@ -1,431 +0,0 @@ - - - Coverage for Doctrine_Transaction_Firebird - - -

    Coverage for Doctrine_Transaction_Firebird

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Firebird.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Transaction'); -
    22/** -
    23 * -
    24 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    25 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    26 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    27 * @package     Doctrine -
    28 * @subpackage  Transaction -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Transaction_Firebird extends Doctrine_Transaction -
    34{ -
    35    /** -
    36     * createSavepoint -
    37     * creates a new savepoint -
    38     * -
    39     * @param string $savepoint     name of a savepoint to set -
    40     * @return void -
    41     */ -
    42    protected function createSavePoint($savepoint) -
    43    { -
    44        $query = 'SAVEPOINT ' . $savepoint; -
    45 -
    46        return $this->conn->execute($query); -
    47    } -
    48 -
    49    /** -
    50     * releaseSavePoint -
    51     * releases given savepoint -
    52     * -
    53     * @param string $savepoint     name of a savepoint to release -
    54     * @return void -
    55     */ -
    56    protected function releaseSavePoint($savepoint) -
    57    { -
    58        $query = 'RELEASE SAVEPOINT ' . $savepoint; -
    59 -
    60        return $this->conn->execute($query); -
    61    } -
    62 -
    63    /** -
    64     * rollbackSavePoint -
    65     * releases given savepoint -
    66     * -
    67     * @param string $savepoint     name of a savepoint to rollback to -
    68     * @return void -
    69     */ -
    70    protected function rollbackSavePoint($savepoint) -
    71    { -
    72        $query = 'ROLLBACK TO SAVEPOINT '.$savepoint; -
    73 -
    74        return $this->conn->execute($query); -
    75    } -
    76 -
    77    /** -
    78     * Set the transacton isolation level. -
    79     * -
    80     * @param   string  standard isolation level (SQL-92) -
    81     *                  READ UNCOMMITTED (allows dirty reads) -
    82     *                  READ COMMITTED (prevents dirty reads) -
    83     *                  REPEATABLE READ (prevents nonrepeatable reads) -
    84     *                  SERIALIZABLE (prevents phantom reads) -
    85     * -
    86     * @param   array some transaction options: -
    87     *                  'wait' => 'WAIT' | 'NO WAIT' -
    88     *                  'rw'   => 'READ WRITE' | 'READ ONLY' -
    89     * -
    90     * @throws PDOException                         if something fails at the PDO level -
    91     * @throws Doctrine_Transaction_Exception       if using unknown isolation level or unknown wait option -
    92     * @return void -
    93     */ -
    94    public function setIsolation($isolation, $options = array()) { -
    95        switch ($isolation) { -
    96            case 'READ UNCOMMITTED': -
    97                $nativeIsolation = 'READ COMMITTED RECORD_VERSION'; -
    98                break; -
    99            case 'READ COMMITTED': -
    100                $nativeIsolation = 'READ COMMITTED NO RECORD_VERSION'; -
    101                break; -
    102            case 'REPEATABLE READ': -
    103                $nativeIsolation = 'SNAPSHOT'; -
    104                break; -
    105            case 'SERIALIZABLE': -
    106                $nativeIsolation = 'SNAPSHOT TABLE STABILITY'; -
    107                break; -
    108            default: -
    109                throw new Doctrine_Transaction_Exception('isolation level is not supported: ' . $isolation); -
    110        } -
    111 -
    112        $rw = $wait = ''; -
    113 -
    114        if (isset($options['wait'])) { -
    115            switch ($options['wait']) { -
    116                case 'WAIT': -
    117                case 'NO WAIT': -
    118                    $wait = ' ' . $options['wait']; -
    119                break; -
    120                default: -
    121                    throw new Doctrine_Transaction_Exception('wait option is not supported: ' . $options['wait']); -
    122            } -
    123        } -
    124 -
    125        if (isset($options['rw'])) { -
    126            switch ($options['rw']) { -
    127                case 'READ ONLY': -
    128                case 'READ WRITE': -
    129                    $rw = ' ' . $options['rw']; -
    130                    break; -
    131                default: -
    132                    throw new Doctrine_Transaction_Exception('wait option is not supported: ' . $options['rw']); -
    133            } -
    134        } -
    135 -
    136        $query = 'SET TRANSACTION' . $rw . $wait .' ISOLATION LEVEL ' . $nativeIsolation; -
    137 -
    138        $this->conn->execute($query); -
    139    } -
    140}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction_Mock.html b/tests_old/coverage/Doctrine_Transaction_Mock.html deleted file mode 100644 index 56b381951..000000000 --- a/tests_old/coverage/Doctrine_Transaction_Mock.html +++ /dev/null @@ -1,119 +0,0 @@ - - - Coverage for Doctrine_Transaction_Mock - - -

    Coverage for Doctrine_Transaction_Mock

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Transaction'); -
    22/** -
    23 * Doctrine_Transaction_Mock -
    24 * This class is used for testing purposes -
    25 * -
    26 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    27 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @package     Doctrine -
    30 * @subpackage  Transaction -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision$ -
    34 */ -
    35class Doctrine_Transaction_Mock extends Doctrine_Transaction -
    36{ }
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction_Mssql.html b/tests_old/coverage/Doctrine_Transaction_Mssql.html deleted file mode 100644 index 037f32fa9..000000000 --- a/tests_old/coverage/Doctrine_Transaction_Mssql.html +++ /dev/null @@ -1,215 +0,0 @@ - - - Coverage for Doctrine_Transaction_Mssql - - -

    Coverage for Doctrine_Transaction_Mssql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mssql.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Transaction'); -
    22/** -
    23 * -
    24 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    25 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    26 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    27 * @package     Doctrine -
    28 * @subpackage  Transaction -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2702 $ -
    32 */ -
    33class Doctrine_Transaction_Mssql extends Doctrine_Transaction -
    34{ -
    35    /** -
    36     * Set the transacton isolation level. -
    37     * -
    38     * @param   string  standard isolation level (SQL-92) -
    39     *      portable modes: -
    40     *                  READ UNCOMMITTED (allows dirty reads) -
    41     *                  READ COMMITTED (prevents dirty reads) -
    42     *                  REPEATABLE READ (prevents nonrepeatable reads) -
    43     *                  SERIALIZABLE (prevents phantom reads) -
    44     *      mssql specific modes: -
    45     *                  SNAPSHOT -
    46     * -
    47     * @link http://msdn2.microsoft.com/en-us/library/ms173763.aspx -
    48     * @throws PDOException                         if something fails at the PDO level -
    49     * @throws Doctrine_Transaction_Exception       if using unknown isolation level or unknown wait option -
    50     * @return void -
    51     */ -
    52    public function setIsolation($isolation, $options = array()) { -
    53        switch ($isolation) { -
    54            case 'READ UNCOMMITTED': -
    55            case 'READ COMMITTED': -
    56            case 'REPEATABLE READ': -
    57            case 'SERIALIZABLE': -
    58            case 'SNAPSHOT': -
    59                break; -
    60            default: -
    61                throw new Doctrine_Transaction_Exception('isolation level is not supported: ' . $isolation); -
    62        } -
    63 -
    64        $query = 'SET TRANSACTION ISOLATION LEVEL ' . $isolation; -
    65 -
    66        $this->conn->execute($query); -
    67    } -
    68}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction_Mysql.html b/tests_old/coverage/Doctrine_Transaction_Mysql.html deleted file mode 100644 index ec763756f..000000000 --- a/tests_old/coverage/Doctrine_Transaction_Mysql.html +++ /dev/null @@ -1,359 +0,0 @@ - - - Coverage for Doctrine_Transaction_Mysql - - -

    Coverage for Doctrine_Transaction_Mysql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Mysql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Transaction'); -
    22/** -
    23 * -
    24 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    25 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    26 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    27 * @package     Doctrine -
    28 * @subpackage  Transaction -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Transaction_Mysql extends Doctrine_Transaction -
    34{ -
    35    /** -
    36     * createSavepoint -
    37     * creates a new savepoint -
    38     * -
    39     * @param string $savepoint     name of a savepoint to set -
    40     * @return void -
    41     */ -
    42    protected function createSavePoint($savepoint) -
    43    { -
    44        $query = 'SAVEPOINT ' . $savepoint; -
    45 -
    46        return $this->conn->execute($query); -
    47    } -
    48 -
    49    /** -
    50     * releaseSavePoint -
    51     * releases given savepoint -
    52     * -
    53     * @param string $savepoint     name of a savepoint to release -
    54     * @return void -
    55     */ -
    56    protected function releaseSavePoint($savepoint) -
    57    { -
    58        $query = 'RELEASE SAVEPOINT ' . $savepoint; -
    59 -
    60        return $this->conn->execute($query); -
    61    } -
    62 -
    63    /** -
    64     * rollbackSavePoint -
    65     * releases given savepoint -
    66     * -
    67     * @param string $savepoint     name of a savepoint to rollback to -
    68     * @return void -
    69     */ -
    70    protected function rollbackSavePoint($savepoint) -
    71    { -
    72        $query = 'ROLLBACK TO SAVEPOINT ' . $savepoint; -
    73 -
    74        return $this->conn->execute($query); -
    75    } -
    76 -
    77    /** -
    78     * Set the transacton isolation level. -
    79     * -
    80     * @param   string  standard isolation level -
    81     *                  READ UNCOMMITTED (allows dirty reads) -
    82     *                  READ COMMITTED (prevents dirty reads) -
    83     *                  REPEATABLE READ (prevents nonrepeatable reads) -
    84     *                  SERIALIZABLE (prevents phantom reads) -
    85     * -
    86     * @throws Doctrine_Transaction_Exception           if using unknown isolation level -
    87     * @throws PDOException                             if something fails at the PDO level -
    88     * @return void -
    89     */ -
    90    public function setIsolation($isolation) -
    91    { -
    92        switch ($isolation) { -
    93            case 'READ UNCOMMITTED': -
    94            case 'READ COMMITTED': -
    95            case 'REPEATABLE READ': -
    96            case 'SERIALIZABLE': -
    97                break; -
    98            default: -
    99                throw new Doctrine_Transaction_Exception('Isolation level ' . $isolation . ' is not supported.'); -
    100        } -
    101 -
    102        $query = 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $isolation; -
    103 -
    104        return $this->conn->execute($query); -
    105    } -
    106 -
    107    /** -
    108     * getTransactionIsolation -
    109     * -
    110     * @return string               returns the current session transaction isolation level -
    111     */ -
    112    public function getIsolation() -
    113    { -
    114        return $this->conn->fetchOne('SELECT @@tx_isolation'); -
    115    } -
    116}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction_Oracle.html b/tests_old/coverage/Doctrine_Transaction_Oracle.html deleted file mode 100644 index e0b28ca77..000000000 --- a/tests_old/coverage/Doctrine_Transaction_Oracle.html +++ /dev/null @@ -1,329 +0,0 @@ - - - Coverage for Doctrine_Transaction_Oracle - - -

    Coverage for Doctrine_Transaction_Oracle

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Oracle.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Transaction'); -
    22/** -
    23 * -
    24 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    25 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    26 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    27 * @package     Doctrine -
    28 * @subpackage  Transaction -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Transaction_Oracle extends Doctrine_Transaction -
    34{ -
    35    /** -
    36     * createSavepoint -
    37     * creates a new savepoint -
    38     * -
    39     * @param string $savepoint     name of a savepoint to set -
    40     * @return void -
    41     */ -
    42    protected function createSavePoint($savepoint) -
    43    { -
    44        $query = 'SAVEPOINT ' . $savepoint; -
    45 -
    46        return $this->conn->execute($query); -
    47    } -
    48 -
    49    /** -
    50     * releaseSavePoint -
    51     * releases given savepoint -
    52     * -
    53     * @param string $savepoint     name of a savepoint to release -
    54     * @return void -
    55     */ -
    56    protected function releaseSavePoint($savepoint) -
    57    { -
    58        // oracle doesn't support manual releasing of savepoints -
    59        return true; -
    60    } -
    61 -
    62    /** -
    63     * rollbackSavePoint -
    64     * releases given savepoint -
    65     * -
    66     * @param string $savepoint     name of a savepoint to rollback to -
    67     * @return void -
    68     */ -
    69    protected function rollbackSavePoint($savepoint) -
    70    { -
    71        $query = 'ROLLBACK TO SAVEPOINT ' . $savepoint; -
    72 -
    73        return $this->conn->execute($query); -
    74    } -
    75 -
    76    /** -
    77     * Set the transacton isolation level. -
    78     * -
    79     * @param   string  standard isolation level -
    80     *                  READ UNCOMMITTED (allows dirty reads) -
    81     *                  READ COMMITTED (prevents dirty reads) -
    82     *                  REPEATABLE READ (prevents nonrepeatable reads) -
    83     *                  SERIALIZABLE (prevents phantom reads) -
    84     * @throws PDOException                         if something fails at the PDO level -
    85     * @throws Doctrine_Transaction_Exception       if using unknown isolation level -
    86     * @return void -
    87     */ -
    88    public function setIsolation($isolation) -
    89    { -
    90        switch ($isolation) { -
    91            case 'READ UNCOMMITTED': -
    92                $isolation = 'READ COMMITTED'; -
    93                break; -
    94            case 'READ COMMITTED': -
    95            case 'REPEATABLE READ': -
    96            case 'SERIALIZABLE': -
    97                $isolation = 'SERIALIZABLE'; -
    98                break; -
    99            default: -
    100                throw new Doctrine_Transaction_Exception('Isolation level ' . $isolation . ' is not supported.'); -
    101        } -
    102 -
    103        $query = 'ALTER SESSION ISOLATION LEVEL ' . $isolation; -
    104        return $this->conn->execute($query); -
    105    } -
    106}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction_Pgsql.html b/tests_old/coverage/Doctrine_Transaction_Pgsql.html deleted file mode 100644 index d849a1b9c..000000000 --- a/tests_old/coverage/Doctrine_Transaction_Pgsql.html +++ /dev/null @@ -1,326 +0,0 @@ - - - Coverage for Doctrine_Transaction_Pgsql - - -

    Coverage for Doctrine_Transaction_Pgsql

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Pgsql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Transaction'); -
    22/** -
    23 * -
    24 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    25 * @author      Paul Cooper <pgc@ucecom.com> (PEAR MDB2 Pgsql driver) -
    26 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @package     Doctrine -
    29 * @subpackage  Transaction -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 2963 $ -
    33 */ -
    34class Doctrine_Transaction_Pgsql extends Doctrine_Transaction -
    35{ -
    36    /** -
    37     * createSavepoint -
    38     * creates a new savepoint -
    39     * -
    40     * @param string $savepoint     name of a savepoint to set -
    41     * @return void -
    42     */ -
    43    protected function createSavePoint($savepoint) -
    44    { -
    45        $query = 'SAVEPOINT ' . $savepoint; -
    46 -
    47        return $this->conn->execute($query); -
    48    } -
    49 -
    50    /** -
    51     * releaseSavePoint -
    52     * releases given savepoint -
    53     * -
    54     * @param string $savepoint     name of a savepoint to release -
    55     * @return void -
    56     */ -
    57    protected function releaseSavePoint($savepoint) -
    58    { -
    59        $query = 'RELEASE SAVEPOINT ' . $savepoint; -
    60 -
    61        return $this->conn->execute($query); -
    62    } -
    63 -
    64    /** -
    65     * rollbackSavePoint -
    66     * releases given savepoint -
    67     * -
    68     * @param string $savepoint     name of a savepoint to rollback to -
    69     * @return void -
    70     */ -
    71    protected function rollbackSavePoint($savepoint) -
    72    { -
    73        $query = 'ROLLBACK TO SAVEPOINT ' . $savepoint; -
    74 -
    75        return $this->conn->execute($query); -
    76    } -
    77 -
    78    /** -
    79     * Set the transacton isolation level. -
    80     * -
    81     * @param   string  standard isolation level -
    82     *                  READ UNCOMMITTED (allows dirty reads) -
    83     *                  READ COMMITTED (prevents dirty reads) -
    84     *                  REPEATABLE READ (prevents nonrepeatable reads) -
    85     *                  SERIALIZABLE (prevents phantom reads) -
    86     * @throws PDOException                         if something fails at the PDO level -
    87     * @throws Doctrine_Transaction_Exception       if using unknown isolation level or unknown wait option -
    88     * @return void -
    89     */ -
    90    public function setIsolation($isolation) -
    91    { -
    92        switch ($isolation) { -
    93            case 'READ UNCOMMITTED': -
    94            case 'READ COMMITTED': -
    95            case 'REPEATABLE READ': -
    96            case 'SERIALIZABLE': -
    97                break; -
    98            default: -
    99                throw new Doctrine_Transaction_Exception('Isolation level '.$isolation.' is not supported.'); -
    100        } -
    101 -
    102        $query = 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL ' . $isolation; -
    103        return $this->conn->execute($query); -
    104    } -
    105}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Transaction_Sqlite.html b/tests_old/coverage/Doctrine_Transaction_Sqlite.html deleted file mode 100644 index 22459c53c..000000000 --- a/tests_old/coverage/Doctrine_Transaction_Sqlite.html +++ /dev/null @@ -1,209 +0,0 @@ - - - Coverage for Doctrine_Transaction_Sqlite - - -

    Coverage for Doctrine_Transaction_Sqlite

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Sqlite.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Transaction'); -
    22/** -
    23 * -
    24 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    25 * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) -
    26 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    27 * @package     Doctrine -
    28 * @subpackage  Transaction -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2702 $ -
    32 */ -
    33class Doctrine_Transaction_Sqlite extends Doctrine_Transaction -
    34{ -
    35    /** -
    36     * Set the transacton isolation level. -
    37     * -
    38     * @param   string  standard isolation level -
    39     *                  READ UNCOMMITTED (allows dirty reads) -
    40     *                  READ COMMITTED (prevents dirty reads) -
    41     *                  REPEATABLE READ (prevents nonrepeatable reads) -
    42     *                  SERIALIZABLE (prevents phantom reads) -
    43     * @throws PDOException                         if something fails at the PDO level -
    44     * @throws Doctrine_Transaction_Exception       if using unknown isolation level -
    45     * @return void -
    46     */ -
    47    public function setIsolation($isolation) -
    48    { -
    49        switch ($isolation) { -
    50            case 'READ UNCOMMITTED': -
    51                $isolation = 0; -
    52                break; -
    53            case 'READ COMMITTED': -
    54            case 'REPEATABLE READ': -
    55            case 'SERIALIZABLE': -
    56                $isolation = 1; -
    57                break; -
    58            default: -
    59                throw new Doctrine_Transaction_Exception('Isolation level ' . $isolation . 'is not supported.'); -
    60        } -
    61 -
    62        $query = 'PRAGMA read_uncommitted = ' . $isolation; -
    63 -
    64        return $this->conn->execute($query); -
    65    } -
    66}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Tree.html b/tests_old/coverage/Doctrine_Tree.html deleted file mode 100644 index 7c03c5e28..000000000 --- a/tests_old/coverage/Doctrine_Tree.html +++ /dev/null @@ -1,401 +0,0 @@ - - - Coverage for Doctrine_Tree - - -

    Coverage for Doctrine_Tree

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Tree.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */                    -
    21/** -
    22 * Doctrine_Tree -
    23 * -
    24 * @package     Doctrine -
    25 * @subpackage  Tree -
    26 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    27 * @link        www.phpdoctrine.org -
    28 * @since       1.0 -
    29 * @version     $Revision: 2963 $ -
    30 * @author      Joe Simms <joe.simms@websites4.com> -
    31 */ -
    32class Doctrine_Tree -
    33{ -
    34    /** -
    35     * @param object $table   reference to associated Doctrine_Table instance -
    36     */ -
    37    protected $table; -
    38 -
    39    /** -
    40     * @param array $options -
    41     */ -
    42    protected $options = array(); -
    43     -
    44    protected $_baseComponent; -
    45 -
    46    /** -
    47     * constructor, creates tree with reference to table and any options -
    48     * -
    49     * @param object $table                     instance of Doctrine_Table -
    50     * @param array $options                    options -
    51     */ -
    52    public function __construct(Doctrine_Table $table, $options) -
    53    { -
    54        $this->table = $table; -
    55        $this->options = $options; -
    56        $this->_baseComponent = $table->getComponentName(); -
    57        $class = $this->_baseComponent; -
    58        if ($table->getOption('inheritanceMap')) { -
    59            $subclasses = $table->getOption('subclasses'); -
    60            while (in_array($class, $subclasses)) { -
    61                $class = get_parent_class($class); -
    62            } -
    63            $this->_baseComponent = $class; -
    64        } -
    65        //echo $this->_baseComponent; -
    66    } -
    67 -
    68    /** -
    69     * Used to define table attributes required for the given implementation -
    70     * -
    71     * @throws Doctrine_Tree_Exception          if table attributes have not been defined -
    72     */ -
    73    public function setTableDefinition() -
    74    { -
    75        throw new Doctrine_Tree_Exception('Table attributes have not been defined for this Tree implementation.'); -
    76    } -
    77 -
    78    /** -
    79     * this method is used for setting up relations and attributes and should be used by specific implementations -
    80     * -
    81     */ -
    82    public function setUp() -
    83    { -
    84    } -
    85 -
    86    /** -
    87     * factory method to return tree instance based upon chosen implementation -
    88     * -
    89     * @param object $table                     instance of Doctrine_Table -
    90     * @param string $impName                   implementation (NestedSet, AdjacencyList, MaterializedPath) -
    91     * @param array $options                    options -
    92     * @return object $options                  instance of Doctrine_Node -
    93     * @throws Doctrine_Exception               if class does not extend Doctrine_Tree -
    94     */ -
    95    public static function factory(Doctrine_Table $table, $implName, $options = array()) -
    96    { -
    97        $class = 'Doctrine_Tree_' . $implName; -
    98        if ( ! class_exists($class)) { -
    99            throw new Doctrine_Exception('The chosen class must extend Doctrine_Tree'); -
    100        } -
    101        return new $class($table, $options); -
    102    } -
    103 -
    104    /** -
    105     * gets tree attribute value -
    106     *         -
    107     */      -
    108    public function getAttribute($name) -
    109    { -
    110      return isset($this->options[$name]) ? $this->options[$name] : null; -
    111    } -
    112 -
    113    /** -
    114     * sets tree attribute value -
    115     * -
    116     * @param mixed             -
    117     */ -
    118    public function setAttribute($name, $value) -
    119    { -
    120      $this->options[$name] = $value; -
    121    } -
    122 -
    123    /** -
    124     * Returns the base tree component. -
    125     */ -
    126    public function getBaseComponent() -
    127    { -
    128        return $this->_baseComponent; -
    129    } -
    130}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Tree_NestedSet.html b/tests_old/coverage/Doctrine_Tree_NestedSet.html deleted file mode 100644 index 1d8bdaaf5..000000000 --- a/tests_old/coverage/Doctrine_Tree_NestedSet.html +++ /dev/null @@ -1,1082 +0,0 @@ - - - Coverage for Doctrine_Tree_NestedSet - - -

    Coverage for Doctrine_Tree_NestedSet

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: NestedSet.php 3144 2007-11-13 15:52:45Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Tree_NestedSet -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Tree -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 3144 $ -
    31 * @author      Joe Simms <joe.simms@websites4.com> -
    32 */ -
    33class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Interface -
    34{ -
    35    private $_baseQuery; -
    36    private $_baseAlias = "base"; -
    37 -
    38    /** -
    39     * constructor, creates tree with reference to table and sets default root options -
    40     * -
    41     * @param object $table                     instance of Doctrine_Table -
    42     * @param array $options                    options -
    43     */ -
    44    public function __construct(Doctrine_Table $table, $options) -
    45    { -
    46        // set default many root attributes -
    47        $options['hasManyRoots'] = isset($options['hasManyRoots']) ? $options['hasManyRoots'] : false; -
    48        if ($options['hasManyRoots']) { -
    49            $options['rootColumnName'] = isset($options['rootColumnName']) ? $options['rootColumnName'] : 'root_id'; -
    50        } -
    51         -
    52        parent::__construct($table, $options); -
    53    } -
    54 -
    55    /** -
    56     * used to define table attributes required for the NestetSet implementation -
    57     * adds lft and rgt columns for corresponding left and right values -
    58     * -
    59     */ -
    60    public function setTableDefinition() -
    61    { -
    62        if ($root = $this->getAttribute('rootColumnName')) { -
    63            $this->table->setColumn($root, 'integer', 4); -
    64        } -
    65 -
    66        $this->table->setColumn('lft', 'integer', 4); -
    67        $this->table->setColumn('rgt', 'integer', 4); -
    68        $this->table->setColumn('level', 'integer', 2); -
    69    } -
    70 -
    71    /** -
    72     * creates root node from given record or from a new record -
    73     * -
    74     * @param object $record        instance of Doctrine_Record -
    75     */ -
    76    public function createRoot(Doctrine_Record $record = null) -
    77    { -
    78        if ( ! $record) { -
    79            $record = $this->table->create(); -
    80        } -
    81 -
    82        // if tree is many roots, and no root id has been set, then get next root id -
    83        if ($root = $this->getAttribute('hasManyRoots') && $record->getNode()->getRootValue() <= 0) { -
    84            $record->getNode()->setRootValue($this->getNextRootId()); -
    85        } -
    86 -
    87        $record->set('lft', '1'); -
    88        $record->set('rgt', '2'); -
    89        $record->set('level', 0); -
    90 -
    91        $record->save(); -
    92 -
    93        return $record; -
    94    } -
    95 -
    96    /** -
    97     * returns root node -
    98     * -
    99     * @return object $record        instance of Doctrine_Record -
    100     * @deprecated Use fetchRoot() -
    101     */ -
    102    public function findRoot($rootId = 1) -
    103    { -
    104        return $this->fetchRoot($rootId); -
    105    } -
    106 -
    107    /** -
    108     * Fetches a/the root node. -
    109     * -
    110     * @param integer $rootId -
    111     */ -
    112    public function fetchRoot($rootId = 1) -
    113    { -
    114        $q = $this->getBaseQuery(); -
    115        $q = $q->addWhere($this->_baseAlias . '.lft = ?', 1); -
    116         -
    117        // if tree has many roots, then specify root id -
    118        $q = $this->returnQueryWithRootId($q, $rootId); -
    119        $data = $q->execute(); -
    120 -
    121        if (count($data) <= 0) { -
    122            return false; -
    123        } -
    124 -
    125        if ($data instanceof Doctrine_Collection) { -
    126            $root = $data->getFirst(); -
    127            $root['level'] = 0; -
    128        } else if (is_array($data)) { -
    129            $root = array_shift($data); -
    130            $root['level'] = 0; -
    131        } else { -
    132            throw new Doctrine_Tree_Exception("Unexpected data structure returned."); -
    133        } -
    134 -
    135        return $root; -
    136    } -
    137 -
    138    /** -
    139     * Fetches a tree. -
    140     * -
    141     * @param array $options  Options -
    142     * @return mixed          The tree or FALSE if the tree could not be found. -
    143     */ -
    144    public function fetchTree($options = array()) -
    145    { -
    146        // fetch tree -
    147        $q = $this->getBaseQuery(); -
    148 -
    149        $q = $q->addWhere($this->_baseAlias . ".lft >= ?", 1); -
    150 -
    151        // if tree has many roots, then specify root id -
    152        $rootId = isset($options['root_id']) ? $options['root_id'] : '1'; -
    153        if (is_array($rootId)) { -
    154            $q->addOrderBy($this->_baseAlias . "." . $this->getAttribute('rootColumnName') . -
    155                    ", " . $this->_baseAlias . ".lft ASC"); -
    156        } else { -
    157            $q->addOrderBy($this->_baseAlias . ".lft ASC"); -
    158        } -
    159         -
    160        $q = $this->returnQueryWithRootId($q, $rootId); -
    161        $tree = $q->execute(); -
    162         -
    163        if (count($tree) <= 0) { -
    164            return false; -
    165        } -
    166         -
    167        return $tree; -
    168    } -
    169 -
    170    /** -
    171     * Fetches a branch of a tree. -
    172     * -
    173     * @param mixed $pk              primary key as used by table::find() to locate node to traverse tree from -
    174     * @param array $options         Options. -
    175     * @return mixed                 The branch or FALSE if the branch could not be found. -
    176     * @todo Only fetch the lft and rgt values of the initial record. more is not needed. -
    177     */ -
    178    public function fetchBranch($pk, $options = array()) -
    179    { -
    180        $record = $this->table->find($pk); -
    181        if ( ! ($record instanceof Doctrine_Record) || !$record->exists()) { -
    182            // TODO: if record doesn't exist, throw exception or similar? -
    183            return false; -
    184        } -
    185        //$depth = isset($options['depth']) ? $options['depth'] : null; -
    186         -
    187        $q = $this->getBaseQuery(); -
    188        $params = array($record->get('lft'), $record->get('rgt')); -
    189        $q->addWhere($this->_baseAlias . ".lft >= ? AND " . $this->_baseAlias . ".rgt <= ?", $params) -
    190                ->addOrderBy($this->_baseAlias . ".lft asc"); -
    191        $q = $this->returnQueryWithRootId($q, $record->getNode()->getRootValue()); -
    192        return $q->execute(); -
    193    } -
    194 -
    195    /** -
    196     * Fetches all root nodes. If the tree has only one root this is the same as -
    197     * fetchRoot(). -
    198     * -
    199     * @return mixed  The root nodes. -
    200     */ -
    201    public function fetchRoots() -
    202    { -
    203        $q = $this->getBaseQuery(); -
    204        $q = $q->addWhere($this->_baseAlias . '.lft = ?', 1); -
    205        return $q->execute(); -
    206    } -
    207 -
    208    /** -
    209     * calculates the next available root id -
    210     * -
    211     * @return integer -
    212     */ -
    213    public function getNextRootId() -
    214    { -
    215        return $this->getMaxRootId() + 1; -
    216    } -
    217 -
    218    /** -
    219     * calculates the current max root id -
    220     * -
    221     * @return integer -
    222     */     -
    223    public function getMaxRootId() -
    224    {       -
    225        $component = $this->table->getComponentName(); -
    226        $column    = $this->getAttribute('rootColumnName'); -
    227 -
    228        // cannot get this dql to work, cannot retrieve result using $coll[0]->max -
    229        //$dql = "SELECT MAX(c.$column) FROM $component c"; -
    230         -
    231        $dql = 'SELECT c.' . $column . ' FROM ' . $component . ' c ORDER BY c.' . $column . ' DESC LIMIT 1'; -
    232   -
    233        $coll = $this->table->getConnection()->query($dql); -
    234   -
    235        $max = $coll[0]->get($column); -
    236   -
    237        $max = !is_null($max) ? $max : 0; -
    238   -
    239        return $max;       -
    240    } -
    241 -
    242    /** -
    243     * returns parsed query with root id where clause added if applicable -
    244     * -
    245     * @param object    $query    Doctrine_Query -
    246     * @param integer   $root_id  id of destination root -
    247     * @return object   Doctrine_Query -
    248     */ -
    249    public function returnQueryWithRootId($query, $rootId = 1) -
    250    { -
    251        if ($root = $this->getAttribute('rootColumnName')) { -
    252            if (is_array($rootId)) { -
    253               $query->addWhere($root . ' IN (' . implode(',', array_fill(0, count($rootId), '?')) . ')', -
    254                       $rootId); -
    255            } else { -
    256               $query->addWhere($root . ' = ?', $rootId);  -
    257            } -
    258        } -
    259 -
    260        return $query; -
    261    } -
    262 -
    263    /** -
    264     * Enter description here... -
    265     * -
    266     * @param array $options -
    267     * @return unknown -
    268     */ -
    269    public function getBaseQuery() -
    270    { -
    271        if ( ! isset($this->_baseQuery)) { -
    272            $this->_baseQuery = $this->_createBaseQuery(); -
    273        } -
    274        return $this->_baseQuery->copy(); -
    275    } -
    276 -
    277    /** -
    278     * Enter description here... -
    279     * -
    280     */ -
    281    public function getBaseAlias() -
    282    { -
    283        return $this->_baseAlias; -
    284    } -
    285 -
    286    /** -
    287     * Enter description here... -
    288     * -
    289     */ -
    290    private function _createBaseQuery() -
    291    { -
    292        $this->_baseAlias = "base"; -
    293        $q = new Doctrine_Query(); -
    294        $q->select($this->_baseAlias . ".*")->from($this->getBaseComponent() . " " . $this->_baseAlias); -
    295        return $q; -
    296    } -
    297 -
    298    /** -
    299     * Enter description here... -
    300     * -
    301     * @param Doctrine_Query $query -
    302     */ -
    303    public function setBaseQuery(Doctrine_Query $query) -
    304    { -
    305        $this->_baseAlias = $query->getRootAlias(); -
    306        $query->addSelect($this->_baseAlias . ".lft, " . $this->_baseAlias . ".rgt, ". $this->_baseAlias . ".level"); -
    307        if ($this->getAttribute('rootColumnName')) { -
    308            $query->addSelect($this->_baseAlias . "." . $this->getAttribute('rootColumnName')); -
    309        } -
    310        $this->_baseQuery = $query; -
    311    } -
    312 -
    313    /** -
    314     * Enter description here... -
    315     * -
    316     */ -
    317    public function resetBaseQuery() -
    318    { -
    319        $this->_baseQuery = $this->_createBaseQuery(); -
    320    } -
    321 -
    322    /** -
    323     * Enter description here... -
    324     * -
    325     * @param unknown_type $graph -
    326     */ -
    327    /* -
    328    public function computeLevels($tree) -
    329    { -
    330        $right = array(); -
    331        $isArray = is_array($tree); -
    332        $rootColumnName = $this->getAttribute('rootColumnName'); -
    333         -
    334        for ($i = 0, $count = count($tree); $i < $count; $i++) { -
    335            if ($rootColumnName && $i > 0 && $tree[$i][$rootColumnName] != $tree[$i-1][$rootColumnName]) { -
    336                $right = array(); -
    337            } -
    338             -
    339            if (count($right) > 0) { -
    340                while (count($right) > 0 && $right[count($right)-1] < $tree[$i]['rgt']) { -
    341                    //echo count($right); -
    342                    array_pop($right); -
    343                } -
    344            } -
    345      -
    346            if ($isArray) { -
    347                $tree[$i]['level'] = count($right); -
    348            } else { -
    349                $tree[$i]->getNode()->setLevel(count($right)); -
    350            } -
    351     -
    352            $right[] = $tree[$i]['rgt']; -
    353        } -
    354        return $tree; -
    355    } -
    356    */ -
    357}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator.html b/tests_old/coverage/Doctrine_Validator.html deleted file mode 100644 index 8b40722cf..000000000 --- a/tests_old/coverage/Doctrine_Validator.html +++ /dev/null @@ -1,993 +0,0 @@ - - - Coverage for Doctrine_Validator - - -

    Coverage for Doctrine_Validator

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Validator.php 2965 2007-10-21 08:16:31Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator -
    24 * Doctrine_Validator performs validations in record properties -
    25 * -
    26 * @package     Doctrine -
    27 * @subpackage  Validator -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2965 $ -
    32 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    33 */ -
    34class Doctrine_Validator extends Doctrine_Locator_Injectable -
    35{ -
    36    /** -
    37     * @var array $validators           an array of validator objects -
    38     */ -
    39    private static $validators  = array(); -
    40 -
    41    /** -
    42     * returns a validator object -
    43     * -
    44     * @param string $name -
    45     * @return Doctrine_Validator_Interface -
    46     */ -
    47    public static function getValidator($name) -
    48    { -
    49        if ( ! isset(self::$validators[$name])) { -
    50            $class = 'Doctrine_Validator_' . ucwords(strtolower($name)); -
    51            if (class_exists($class)) { -
    52                self::$validators[$name] = new $class; -
    53            } else { -
    54                throw new Doctrine_Exception("Validator named '$name' not available."); -
    55            } -
    56 -
    57        } -
    58        return self::$validators[$name]; -
    59    } -
    60 -
    61    /** -
    62     * validates a given record and saves possible errors -
    63     * in Doctrine_Validator::$stack -
    64     * -
    65     * @param Doctrine_Record $record -
    66     * @return void -
    67     */ -
    68    public function validateRecord(Doctrine_Record $record) -
    69    { -
    70        $columns   = $record->getTable()->getColumns(); -
    71        $component = $record->getTable()->getComponentName(); -
    72 -
    73        $errorStack = $record->getErrorStack(); -
    74 -
    75        // if record is transient all fields will be validated -
    76        // if record is persistent only the modified fields will be validated -
    77        $data = ($record->exists()) ? $record->getModified() : $record->getData(); -
    78 -
    79        $err      = array(); -
    80        foreach ($data as $key => $value) { -
    81            if ($value === self::$_null) { -
    82                $value = null; -
    83            } else if ($value instanceof Doctrine_Record) { -
    84                $value = $value->getIncremented(); -
    85            } -
    86 -
    87            $column = $columns[$key]; -
    88 -
    89            if ($column['type'] == 'enum') { -
    90                $value = $record->getTable()->enumIndex($key, $value); -
    91 -
    92                if ($value === false) { -
    93                    $errorStack->add($key, 'enum'); -
    94                    continue; -
    95                } -
    96            } -
    97 -
    98            if ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS) { -
    99                if ( ! $this->validateLength($column, $key, $value)) { -
    100                    $errorStack->add($key, 'length'); -
    101 -
    102                    continue; -
    103                } -
    104            } -
    105 -
    106            foreach ($column as $name => $args) { -
    107                if (empty($name) -
    108                    || $name == 'primary' -
    109                    || $name == 'protected' -
    110                    || $name == 'autoincrement' -
    111                    || $name == 'default' -
    112                    || $name == 'values' -
    113                    || $name == 'sequence' -
    114                    || $name == 'zerofill' -
    115                    || $name == 'scale') { -
    116                    continue; -
    117                } -
    118 -
    119                if (strtolower($name) === 'notnull' && isset($column['autoincrement'])) { -
    120                    continue; -
    121                } -
    122 -
    123                if (strtolower($name) == 'length') { -
    124                    if ( ! ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS)) { -
    125                        if ( ! $this->validateLength($column, $key, $value)) { -
    126                            $errorStack->add($key, 'length'); -
    127                        } -
    128                    } -
    129                    continue; -
    130                } -
    131 -
    132                if (strtolower($name) == 'type') { -
    133                    if ( ! ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_TYPES)) { -
    134                        if ( ! self::isValidType($value, $column['type'])) { -
    135                            $errorStack->add($key, 'type'); -
    136                        } -
    137                    } -
    138                    continue; -
    139                } -
    140 -
    141                $validator = self::getValidator($name); -
    142                $validator->invoker = $record; -
    143                $validator->field   = $key; -
    144                $validator->args    = $args; -
    145 -
    146                if ( ! $validator->validate($value)) { -
    147                    $errorStack->add($key, $name); -
    148 -
    149                    //$err[$key] = 'not valid'; -
    150 -
    151                    // errors found quit validation looping for this column -
    152                    //break; -
    153                } -
    154            } -
    155 -
    156            if ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_TYPES) { -
    157                if ( ! self::isValidType($value, $column['type'])) { -
    158                    $errorStack->add($key, 'type'); -
    159                    continue; -
    160                } -
    161            } -
    162        } -
    163    } -
    164 -
    165    /** -
    166     * Validates the length of a field. -
    167     */ -
    168    private function validateLength($column, $key, $value) -
    169    { -
    170        if ($column['type'] == 'timestamp' || $column['type'] == 'integer' ||  -
    171                $column['type'] == 'enum') { -
    172            return true; -
    173        } else if ($column['type'] == 'array' || $column['type'] == 'object') { -
    174            $length = strlen(serialize($value)); -
    175        } else { -
    176            $length = strlen($value); -
    177        } -
    178 -
    179        if ($length > $column['length']) { -
    180            return false; -
    181        } -
    182        return true; -
    183    } -
    184 -
    185    /** -
    186     * whether or not this validator has errors -
    187     * -
    188     * @return boolean -
    189     */ -
    190    public function hasErrors() -
    191    { -
    192        return (count($this->stack) > 0); -
    193    } -
    194 -
    195    /** -
    196     * phpType -
    197     * converts a doctrine type to native php type -
    198     * -
    199     * @param $portableType     portable doctrine type -
    200     * @return string -
    201     *//* -
    202    public static function phpType($portableType) -
    203    { -
    204        switch ($portableType) { -
    205            case 'enum': -
    206                return 'integer'; -
    207            case 'blob': -
    208            case 'clob': -
    209            case 'mbstring': -
    210            case 'timestamp': -
    211            case 'date': -
    212            case 'gzip': -
    213                return 'string'; -
    214                break; -
    215            default: -
    216                return $portableType; -
    217        } -
    218    }*/ -
    219    /** -
    220     * returns whether or not the given variable is -
    221     * valid type -
    222     * -
    223     * @param mixed $var -
    224     * @param string $type -
    225     * @return boolean -
    226     */ -
    227     /* -
    228    public static function isValidType($var, $type) -
    229    { -
    230        if ($type == 'boolean') { -
    231            return true; -
    232        } -
    233 -
    234        $looseType = self::gettype($var); -
    235        $type      = self::phpType($type); -
    236 -
    237        switch ($looseType) { -
    238            case 'float': -
    239            case 'double': -
    240            case 'integer': -
    241                if ($type == 'string' || $type == 'float') { -
    242                    return true; -
    243                } -
    244            case 'string': -
    245            case 'array': -
    246            case 'object': -
    247                return ($type === $looseType); -
    248                break; -
    249            case 'NULL': -
    250                return true; -
    251                break; -
    252        } -
    253    }*/ -
    254     -
    255     -
    256    /** -
    257     * returns whether or not the given variable is -
    258     * valid type -
    259     * -
    260     * @param mixed $var -
    261     * @param string $type -
    262     * @return boolean -
    263     */ -
    264     public static function isValidType($var, $type) -
    265     { -
    266         if ($var === null) { -
    267             return true; -
    268         } else if (is_object($var)) { -
    269             return $type == 'object'; -
    270         } -
    271      -
    272         switch ($type) { -
    273             case 'float': -
    274             case 'double': -
    275                 return (String)$var == strval(floatval($var)); -
    276             case 'integer': -
    277                 return (String)$var == strval(intval($var)); -
    278             case 'string': -
    279                 return is_string($var) || is_int($var) || is_float($var); -
    280             case 'blob': -
    281             case 'clob': -
    282             case 'gzip': -
    283                 return is_string($var); -
    284             case 'array': -
    285                 return is_array($var); -
    286             case 'object': -
    287                 return is_object($var); -
    288             case 'boolean': -
    289                 return is_bool($var); -
    290             case 'timestamp': -
    291                 // todo: validate the timestamp is in YYYY-MM-DD HH:MM:SS format -
    292                 return true; -
    293             case 'date': -
    294                 $validator = self::getValidator('date'); -
    295                 return $validator->validate($var); -
    296             case 'enum': -
    297                 return is_string($var) || is_int($var); -
    298             default: -
    299                 return false; -
    300         } -
    301     } -
    302     -
    303     -
    304    /** -
    305     * returns the type of loosely typed variable -
    306     * -
    307     * @param mixed $var -
    308     * @return string -
    309     *//* -
    310    public static function gettype($var) -
    311    { -
    312        $type = gettype($var); -
    313        switch ($type) { -
    314            case 'string': -
    315                if (preg_match("/^[0-9]+$/",$var)) { -
    316                    return 'integer'; -
    317                } elseif (is_numeric($var)) { -
    318                    return 'float'; -
    319                } else { -
    320                    return $type; -
    321                } -
    322                break; -
    323            default: -
    324                return $type; -
    325        } -
    326    }*/ -
    327} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Date.html b/tests_old/coverage/Doctrine_Validator_Date.html deleted file mode 100644 index 7ce4f04ff..000000000 --- a/tests_old/coverage/Doctrine_Validator_Date.html +++ /dev/null @@ -1,170 +0,0 @@ - - - Coverage for Doctrine_Validator_Date - - -

    Coverage for Doctrine_Validator_Date

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Date.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Date -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Date -
    34{ -
    35    /** -
    36     * checks if given value is a valid date -
    37     * -
    38     * @param mixed $value -
    39     * @return boolean -
    40     */ -
    41    public function validate($value) -
    42    { -
    43        if ($value === null) { -
    44            return true; -
    45        } -
    46        $e = explode('-', $value); -
    47 -
    48        if (count($e) !== 3) { -
    49            return false; -
    50        } -
    51        return checkdate($e[1], $e[2], $e[0]); -
    52    } -
    53}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Driver.html b/tests_old/coverage/Doctrine_Validator_Driver.html deleted file mode 100644 index 307077dd7..000000000 --- a/tests_old/coverage/Doctrine_Validator_Driver.html +++ /dev/null @@ -1,359 +0,0 @@ - - - Coverage for Doctrine_Validator_Driver - - -

    Coverage for Doctrine_Validator_Driver

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Notnull.php 1080 2007-02-10 18:17:08Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Driver -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1080 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Driver -
    34{ -
    35    /** -
    36     * @var array $_args     an array of plugin specific args -
    37     */ -
    38    protected $_args = array(); -
    39 -
    40    /** -
    41     * __get -
    42     * an alias for getOption -
    43     * -
    44     * @param string $arg -
    45     */ -
    46    public function __get($arg) -
    47    { -
    48        if (isset($this->_args[$arg])) { -
    49            return $this->_args[$arg]; -
    50        } -
    51        return null; -
    52    } -
    53 -
    54    /** -
    55     * __isset -
    56     * -
    57     * @param string $arg -
    58     */ -
    59    public function __isset($arg) -
    60    { -
    61        return isset($this->_args[$arg]); -
    62    } -
    63 -
    64    /** -
    65     * sets given value to an argument -
    66     * -
    67     * @param $arg          the name of the option to be changed -
    68     * @param $value        the value of the option -
    69     * @return Doctrine_Validator_Driver    this object -
    70     */ -
    71    public function __set($arg, $value) -
    72    { -
    73        $this->_args[$arg] = $value; -
    74         -
    75        return $this; -
    76    } -
    77 -
    78    /** -
    79     * returns the value of an argument -
    80     * -
    81     * @param $arg          the name of the option to retrieve -
    82     * @return mixed        the value of the option -
    83     */ -
    84    public function getArg($arg) -
    85    { -
    86        if ( ! isset($this->_args[$arg])) { -
    87            throw new Doctrine_Plugin_Exception('Unknown option ' . $arg); -
    88        } -
    89         -
    90        return $this->_args[$arg]; -
    91    } -
    92 -
    93    /** -
    94     * sets given value to an argument -
    95     * -
    96     * @param $arg          the name of the option to be changed -
    97     * @param $value        the value of the option -
    98     * @return Doctrine_Validator_Driver    this object -
    99     */ -
    100    public function setArg($arg, $value) -
    101    { -
    102        $this->_args[$arg] = $value; -
    103         -
    104        return $this; -
    105    } -
    106 -
    107    /** -
    108     * returns all args and their associated values -
    109     * -
    110     * @return array    all args as an associative array -
    111     */ -
    112    public function getArgs() -
    113    { -
    114        return $this->_args; -
    115    } -
    116}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Email.html b/tests_old/coverage/Doctrine_Validator_Email.html deleted file mode 100644 index c3e624aa4..000000000 --- a/tests_old/coverage/Doctrine_Validator_Email.html +++ /dev/null @@ -1,245 +0,0 @@ - - - Coverage for Doctrine_Validator_Email - - -

    Coverage for Doctrine_Validator_Email

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Email.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Email -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Email -
    34{ -
    35    /** -
    36     * checks if given value is a valid email address -
    37     * -
    38     * @link http://iamcal.com/publish/articles/php/parsing_email/pdf/ -
    39     * @param mixed $value -
    40     * @return boolean -
    41     */ -
    42    public function validate($value) -
    43    { -
    44        if ($value === null) { -
    45            return true; -
    46        } -
    47        if (isset($this->args)) { -
    48            $parts = explode('@', $value); -
    49            if (isset($parts[1]) && function_exists('checkdnsrr')) { -
    50                if ( ! checkdnsrr($parts[1], 'MX')) { -
    51                    return false; -
    52                } -
    53            } -
    54        } -
    55 -
    56        $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; -
    57        $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; -
    58        $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'; -
    59        $quotedPair = '\\x5c[\\x00-\\x7f]'; -
    60        $domainLiteral = "\\x5b($dtext|$quotedPair)*\\x5d"; -
    61        $quotedString = "\\x22($qtext|$quotedPair)*\\x22"; -
    62        $domain_ref = $atom; -
    63        $subDomain = "($domain_ref|$domainLiteral)"; -
    64        $word = "($atom|$quotedString)"; -
    65        $domain = "$subDomain(\\x2e$subDomain)+"; -
    66        /* -
    67          following pseudocode to allow strict checking - ask pookey about this if you're puzzled -
    68 -
    69          if ($this->getValidationOption('strict_checking') == true) { -
    70              $domain = "$sub_domain(\\x2e$sub_domain)*"; -
    71          } -
    72        */ -
    73        $localPart = "$word(\\x2e$word)*"; -
    74        $addrSpec = "$localPart\\x40$domain"; -
    75 -
    76        return (bool) preg_match("!^$addrSpec$!D", $value); -
    77    } -
    78}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_ErrorStack.html b/tests_old/coverage/Doctrine_Validator_ErrorStack.html deleted file mode 100644 index dc8353776..000000000 --- a/tests_old/coverage/Doctrine_Validator_ErrorStack.html +++ /dev/null @@ -1,459 +0,0 @@ - - - Coverage for Doctrine_Validator_ErrorStack - - -

    Coverage for Doctrine_Validator_ErrorStack

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: ErrorStack.php 3157 2007-11-14 21:06:30Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_ErrorStack -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @author      Roman Borschel <roman@code-factory.org> -
    29 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    30 * @link        www.phpdoctrine.org -
    31 * @since       1.0 -
    32 * @version     $Revision: 3157 $ -
    33 */ -
    34class Doctrine_Validator_ErrorStack extends Doctrine_Access implements Countable, IteratorAggregate -
    35{ -
    36 -
    37    /** -
    38     * The errors of the error stack. -
    39     * -
    40     * @var array -
    41     */ -
    42    protected $errors = array(); -
    43 -
    44    protected $classname = ""; -
    45 -
    46    /** -
    47     * Constructor -
    48     * -
    49     */ -
    50    public function __construct($classname = "") -
    51    { -
    52        $this->classname = $classname; -
    53    } -
    54 -
    55    /** -
    56     * Adds an error to the stack. -
    57     * -
    58     * @param string $invalidFieldName -
    59     * @param string $errorType -
    60     */ -
    61    public function add($invalidFieldName, $errorCode = 'general') -
    62    { -
    63        $this->errors[$invalidFieldName][] = $errorCode; -
    64    } -
    65 -
    66    /** -
    67     * Removes all existing errors for the specified field from the stack. -
    68     * -
    69     * @param string $fieldName -
    70     */ -
    71    public function remove($fieldName) -
    72    { -
    73        if (isset($this->errors[$fieldName])) { -
    74            unset($this->errors[$fieldName]); -
    75        } -
    76    } -
    77 -
    78    /** -
    79     * Enter description here... -
    80     * -
    81     * @param unknown_type $name -
    82     * @return unknown -
    83     */ -
    84    public function get($fieldName) -
    85    { -
    86        return isset($this->errors[$fieldName]) ? $this->errors[$fieldName] : null; -
    87    } -
    88 -
    89    /** -
    90     * Enter description here... -
    91     * -
    92     * @param unknown_type $name -
    93     */ -
    94    public function set($fieldName, $errorCode) -
    95    { -
    96        $this->add($fieldName, $errorCode); -
    97    } -
    98 -
    99    /** -
    100     * Enter description here... -
    101     * -
    102     * @return unknown -
    103     */ -
    104    public function contains($fieldName) -
    105    { -
    106        return array_key_exists($fieldName, $this->errors); -
    107    } -
    108 -
    109    /** -
    110     * Removes all errors from the stack. -
    111     */ -
    112    public function clear() -
    113    { -
    114        $this->errors = array(); -
    115    } -
    116 -
    117    /** -
    118     * Enter description here... -
    119     * -
    120     * @return unknown -
    121     */ -
    122    public function getIterator() -
    123    { -
    124        return new ArrayIterator($this->errors); -
    125    } -
    126 -
    127    public function toArray() -
    128    { -
    129        return $this->errors; -
    130    } -
    131 -
    132    /** -
    133     * Enter description here... -
    134     * -
    135     * @return unknown -
    136     */ -
    137    public function count() -
    138    { -
    139        return count($this->errors); -
    140    } -
    141 -
    142    /** -
    143     * Get the classname where the errors occured -
    144     * -
    145     */ -
    146    public function getClassname(){ -
    147        return $this->classname; -
    148    } -
    149} -
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Exception.html b/tests_old/coverage/Doctrine_Validator_Exception.html deleted file mode 100644 index dd83889c8..000000000 --- a/tests_old/coverage/Doctrine_Validator_Exception.html +++ /dev/null @@ -1,311 +0,0 @@ - - - Coverage for Doctrine_Validator_Exception - - -

    Coverage for Doctrine_Validator_Exception

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Exception.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21Doctrine::autoload('Doctrine_Exception'); -
    22/** -
    23 * Doctrine_Validator_Exception -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    29 * @link        www.phpdoctrine.org -
    30 * @since       1.0 -
    31 * @version     $Revision: 2963 $ -
    32 */ -
    33class Doctrine_Validator_Exception extends Doctrine_Exception implements Countable, IteratorAggregate -
    34{ -
    35    /** -
    36     * @var array $invalid -
    37     */ -
    38    private $invalid = array(); -
    39 -
    40    /** -
    41     * @param Doctrine_Validator $validator -
    42     */ -
    43    public function __construct(array $invalid) -
    44    { -
    45        $this->invalid = $invalid; -
    46        parent::__construct($this->generateMessage()); -
    47    } -
    48 -
    49    public function getInvalidRecords() -
    50    { -
    51        return $this->invalid; -
    52    } -
    53 -
    54    public function getIterator() -
    55    { -
    56        return new ArrayIterator($this->invalid); -
    57    } -
    58 -
    59    public function count() -
    60    { -
    61        return count($this->invalid); -
    62    } -
    63 -
    64    /** -
    65     * __toString -
    66     * -
    67     * @return string -
    68     */ -
    69    public function __toString() -
    70    { -
    71 -
    72        return parent::__toString(); -
    73    } -
    74 -
    75    /** -
    76     * Generate a message with all classes that have exceptions -
    77     */ -
    78    private function generateMessage() -
    79    { -
    80        $message = ""; -
    81        foreach ($this->invalid as $record) { -
    82           $message .= "Validaton error in class " . get_class($record) . " "; -
    83        } -
    84        return $message; -
    85    } -
    86 -
    87    /** -
    88     * This method will apply the value of the $function variable as a user_func  -
    89     * to tall errorstack objects in the exception -
    90     * -
    91     * @param mixed Either string with function name or array with object,  -
    92     * functionname. See call_user_func in php manual for more inforamtion -
    93     */ -
    94    public function inspect($function) -
    95    { -
    96        foreach ($this->invalid as $record) { -
    97            call_user_func($function, $record->getErrorStack()); -
    98        } -
    99    } -
    100}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Future.html b/tests_old/coverage/Doctrine_Validator_Future.html deleted file mode 100644 index a77a2af0a..000000000 --- a/tests_old/coverage/Doctrine_Validator_Future.html +++ /dev/null @@ -1,248 +0,0 @@ - - - Coverage for Doctrine_Validator_Future - - -

    Coverage for Doctrine_Validator_Future

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id$ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Future -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Roman Borschel <roman@code-factory.org> -
    32 */ -
    33class Doctrine_Validator_Future -
    34{ -
    35    /** -
    36     * checks if the given value is a valid date in the future. -
    37     * -
    38     * @param mixed $value -
    39     * @return boolean -
    40     */ -
    41    public function validate($value) -
    42    { -
    43        if ($value === null) { -
    44            return true; -
    45        } -
    46        $e = explode('-', $value); -
    47 -
    48        if (count($e) !== 3) { -
    49            return false; -
    50        } -
    51         -
    52        if (is_array($this->args) && isset($this->args['timezone'])) { -
    53            switch (strtolower($this->args['timezone'])) { -
    54                case 'gmt': -
    55                    $now = gmdate("U") - date("Z"); -
    56                    break; -
    57                default: -
    58                    $now = getdate(); -
    59                    break; -
    60            } -
    61        } else { -
    62            $now = getdate(); -
    63        } -
    64         -
    65        if ($now['year'] > $e[0]) { -
    66            return false; -
    67        } else if ($now['year'] == $e[0]) { -
    68            if ($now['mon'] > $e[1]) { -
    69                return false; -
    70            } else if ($now['mon'] == $e[1]) { -
    71                return $now['mday'] < $e[2]; -
    72            } else { -
    73                return true; -
    74            } -
    75        } else { -
    76            return true; -
    77        } -
    78    } -
    79}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Notblank.html b/tests_old/coverage/Doctrine_Validator_Notblank.html deleted file mode 100644 index 62e5e6c77..000000000 --- a/tests_old/coverage/Doctrine_Validator_Notblank.html +++ /dev/null @@ -1,149 +0,0 @@ - - - Coverage for Doctrine_Validator_Notblank - - -

    Coverage for Doctrine_Validator_Notblank

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Notblank.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Notblank -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Notblank extends Doctrine_Validator_Driver -
    34{ -
    35    /** -
    36     * checks that value isn't blank -
    37     * a value is blank when its either null or contains only space characters -
    38     * -
    39     * @param mixed $value -
    40     * @return boolean -
    41     */ -
    42    public function validate($value) -
    43    { -
    44        return (trim($value) !== '' && $value !== null); -
    45    } -
    46}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Notnull.html b/tests_old/coverage/Doctrine_Validator_Notnull.html deleted file mode 100644 index b1eadb13a..000000000 --- a/tests_old/coverage/Doctrine_Validator_Notnull.html +++ /dev/null @@ -1,146 +0,0 @@ - - - Coverage for Doctrine_Validator_Notnull - - -

    Coverage for Doctrine_Validator_Notnull

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Notnull.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Notnull -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Notnull extends Doctrine_Validator_Driver -
    34{ -
    35    /** -
    36     * checks that given value isn't null -
    37     * -
    38     * @param mixed $value -
    39     * @return boolean -
    40     */ -
    41    public function validate($value) -
    42    { -
    43        return ($value !== null); -
    44    } -
    45}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Past.html b/tests_old/coverage/Doctrine_Validator_Past.html deleted file mode 100644 index 87ffa4de0..000000000 --- a/tests_old/coverage/Doctrine_Validator_Past.html +++ /dev/null @@ -1,248 +0,0 @@ - - - Coverage for Doctrine_Validator_Past - - -

    Coverage for Doctrine_Validator_Past

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Date.php 2367 2007-09-02 20:00:27Z zYne $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Past -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision$ -
    31 * @author      Roman Borschel <roman@code-factory.org> -
    32 */ -
    33class Doctrine_Validator_Past -
    34{ -
    35    /** -
    36     * checks if the given value is a valid date in the past. -
    37     * -
    38     * @param mixed $value -
    39     * @return boolean -
    40     */ -
    41    public function validate($value) -
    42    { -
    43        if ($value === null) { -
    44            return true; -
    45        } -
    46        $e = explode('-', $value); -
    47 -
    48        if (count($e) !== 3) { -
    49            return false; -
    50        } -
    51         -
    52        if (is_array($this->args) && isset($this->args['timezone'])) { -
    53            switch (strtolower($this->args['timezone'])) { -
    54                case 'gmt': -
    55                    $now = gmdate("U") - date("Z"); -
    56                    break; -
    57                default: -
    58                    $now = getdate(); -
    59                    break; -
    60            } -
    61        } else { -
    62            $now = getdate(); -
    63        } -
    64         -
    65        if ($now['year'] < $e[0]) { -
    66            return false; -
    67        } else if ($now['year'] == $e[0]) { -
    68            if ($now['mon'] < $e[1]) { -
    69                return false; -
    70            } else if ($now['mon'] == $e[1]) { -
    71                return $now['mday'] > $e[2]; -
    72            } else { -
    73                return true; -
    74            } -
    75        } else { -
    76            return true; -
    77        } -
    78    } -
    79}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Range.html b/tests_old/coverage/Doctrine_Validator_Range.html deleted file mode 100644 index 132919aae..000000000 --- a/tests_old/coverage/Doctrine_Validator_Range.html +++ /dev/null @@ -1,164 +0,0 @@ - - - Coverage for Doctrine_Validator_Range - - -

    Coverage for Doctrine_Validator_Range

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Range.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Range -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Range -
    34{ -
    35    /** -
    36     * checks if value is within given range -
    37     * -
    38     * @param mixed $value -
    39     * @return boolean -
    40     */ -
    41    public function validate($value) -
    42    { -
    43        if (isset($this->args[0]) && $value < $this->args[0]) { -
    44            return false; -
    45        } -
    46        if (isset($this->args[1]) && $value > $this->args[1]) { -
    47            return false; -
    48        } -
    49        return true; -
    50    } -
    51}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Regexp.html b/tests_old/coverage/Doctrine_Validator_Regexp.html deleted file mode 100644 index 65595d4f8..000000000 --- a/tests_old/coverage/Doctrine_Validator_Regexp.html +++ /dev/null @@ -1,197 +0,0 @@ - - - Coverage for Doctrine_Validator_Regexp - - -

    Coverage for Doctrine_Validator_Regexp

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Regexp.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Regexp -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Regexp -
    34{ -
    35    /** -
    36     * checks if given value satisfies a regular expression -
    37     * -
    38     * @param mixed $value -
    39     * @param mixed $args -
    40     * @return boolean -
    41     */ -
    42    public function validate($value) -
    43    { -
    44        if ( ! isset($this->args)) { -
    45           return true; -
    46        } -
    47        if (is_array($this->args)) { -
    48            foreach ($this->args as $regexp) { -
    49                if ( ! preg_match($regexp, $value)) { -
    50                    return false; -
    51                } -
    52            } -
    53            return true; -
    54        } else { -
    55            if (preg_match($this->args, $value)) { -
    56                return true; -
    57            } -
    58        } -
    59 -
    60        return false; -
    61    } -
    62}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Unique.html b/tests_old/coverage/Doctrine_Validator_Unique.html deleted file mode 100644 index 2f74e9095..000000000 --- a/tests_old/coverage/Doctrine_Validator_Unique.html +++ /dev/null @@ -1,224 +0,0 @@ - - - Coverage for Doctrine_Validator_Unique - - -

    Coverage for Doctrine_Validator_Unique

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Unique.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Unique -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2702 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Unique -
    34{ -
    35    /** -
    36     * checks if given value is unique -
    37     * -
    38     * @param mixed $value -
    39     * @return boolean -
    40     */ -
    41    public function validate($value) -
    42    { -
    43        $table = $this->invoker->getTable(); -
    44        $pks = $table->getIdentifier(); -
    45 -
    46        if ( is_array($pks) ) { -
    47            $pks = join(',', $pks); -
    48        } -
    49 -
    50        $sql   = 'SELECT ' . $pks . ' FROM ' . $table->getTableName() . ' WHERE ' . $this->field . ' = ?'; -
    51         -
    52        $values = array(); -
    53        $values[] = $value; -
    54         -
    55        // If the record is not new we need to add primary key checks because its ok if the  -
    56        // unique value already exists in the database IF the record in the database is the same -
    57        // as the one that is validated here. -
    58        $state = $this->invoker->state(); -
    59        if ( ! ($state == Doctrine_Record::STATE_TDIRTY || $state == Doctrine_Record::STATE_TCLEAN)) { -
    60            foreach ((array) $table->getIdentifier() as $pk) { -
    61                $sql .= " AND {$pk} != ?"; -
    62                $values[] = $this->invoker->$pk; -
    63            } -
    64        } -
    65         -
    66        $stmt  = $table->getConnection()->getDbh()->prepare($sql); -
    67        $stmt->execute($values); -
    68 -
    69        return ( ! is_array($stmt->fetch())); -
    70    } -
    71}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Unsigned.html b/tests_old/coverage/Doctrine_Validator_Unsigned.html deleted file mode 100644 index 9a33a0821..000000000 --- a/tests_old/coverage/Doctrine_Validator_Unsigned.html +++ /dev/null @@ -1,161 +0,0 @@ - - - Coverage for Doctrine_Validator_Unsigned - - -

    Coverage for Doctrine_Validator_Unsigned

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Enum.php 1080 2007-02-10 18:17:08Z romanb $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Unsigned -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 1080 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Unsigned -
    34{ -
    35    /** -
    36     * checks if given value is a valid unsigned integer -
    37     * -
    38     * @param mixed $value -
    39     * @return boolean -
    40     */ -
    41    public function validate($value) -
    42    { -
    43        $int = (int) $value; -
    44 -
    45        if ($int != $value || $int < 0) { -
    46            return false; -
    47        } -
    48        return true; -
    49    } -
    50}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_Validator_Usstate.html b/tests_old/coverage/Doctrine_Validator_Usstate.html deleted file mode 100644 index 4c7d2f05e..000000000 --- a/tests_old/coverage/Doctrine_Validator_Usstate.html +++ /dev/null @@ -1,326 +0,0 @@ - - - Coverage for Doctrine_Validator_Usstate - - -

    Coverage for Doctrine_Validator_Usstate

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: Usstate.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_Validator_Usstate -
    24 * -
    25 * @package     Doctrine -
    26 * @subpackage  Validator -
    27 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    28 * @link        www.phpdoctrine.org -
    29 * @since       1.0 -
    30 * @version     $Revision: 2963 $ -
    31 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    32 */ -
    33class Doctrine_Validator_Usstate -
    34{ -
    35    private static $states = array( -
    36                'AK' => true, -
    37                'AL' => true, -
    38                'AR' => true, -
    39                'AZ' => true, -
    40                'CA' => true, -
    41                'CO' => true, -
    42                'CT' => true, -
    43                'DC' => true, -
    44                'DE' => true, -
    45                'FL' => true, -
    46                'GA' => true, -
    47                'HI' => true, -
    48                'IA' => true, -
    49                'ID' => true, -
    50                'IL' => true, -
    51                'IN' => true, -
    52                'KS' => true, -
    53                'KY' => true, -
    54                'LA' => true, -
    55                'MA' => true, -
    56                'MD' => true, -
    57                'ME' => true, -
    58                'MI' => true, -
    59                'MN' => true, -
    60                'MO' => true, -
    61                'MS' => true, -
    62                'MT' => true, -
    63                'NC' => true, -
    64                'ND' => true, -
    65                'NE' => true, -
    66                'NH' => true, -
    67                'NJ' => true, -
    68                'NM' => true, -
    69                'NV' => true, -
    70                'NY' => true, -
    71                'OH' => true, -
    72                'OK' => true, -
    73                'OR' => true, -
    74                'PA' => true, -
    75                'PR' => true, -
    76                'RI' => true, -
    77                'SC' => true, -
    78                'SD' => true, -
    79                'TN' => true, -
    80                'TX' => true, -
    81                'UT' => true, -
    82                'VA' => true, -
    83                'VI' => true, -
    84                'VT' => true, -
    85                'WA' => true, -
    86                'WI' => true, -
    87                'WV' => true, -
    88                'WY' => true -
    89            ); -
    90    public function getStates() -
    91    { -
    92        return self::$states; -
    93    } -
    94 -
    95    /** -
    96     * checks if given value is a valid US state code -
    97     * -
    98     * @param string $args -
    99     * @return boolean -
    100     */ -
    101    public function validate($value) -
    102    { -
    103        return isset(self::$states[$value]); -
    104    } -
    105}
    \ No newline at end of file diff --git a/tests_old/coverage/Doctrine_View.html b/tests_old/coverage/Doctrine_View.html deleted file mode 100644 index d11bcd3f9..000000000 --- a/tests_old/coverage/Doctrine_View.html +++ /dev/null @@ -1,515 +0,0 @@ - - - Coverage for Doctrine_View - - -

    Coverage for Doctrine_View

    Back to coverage report

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1<?php -
    2/* -
    3 *  $Id: View.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $ -
    4 * -
    5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -
    6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -
    7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -
    8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -
    9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -
    10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -
    11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -
    12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -
    13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -
    14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -
    15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
    16 * -
    17 * This software consists of voluntary contributions made by many individuals -
    18 * and is licensed under the LGPL. For more information, see -
    19 * <http://www.phpdoctrine.org>. -
    20 */ -
    21 -
    22/** -
    23 * Doctrine_View -
    24 * -
    25 * this class represents a database view -
    26 * -
    27 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> -
    28 * @package     Doctrine -
    29 * @subpackage  View -
    30 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL -
    31 * @link        www.phpdoctrine.org -
    32 * @since       1.0 -
    33 * @version     $Revision: 2963 $ -
    34 */ -
    35class Doctrine_View -
    36{ -
    37    /** -
    38     * SQL DROP constant -
    39     */ -
    40    const DROP   = 'DROP VIEW %s'; -
    41 -
    42    /** -
    43     * SQL CREATE constant -
    44     */ -
    45    const CREATE = 'CREATE VIEW %s AS %s'; -
    46 -
    47    /** -
    48     * SQL SELECT constant -
    49     */ -
    50    const SELECT = 'SELECT * FROM %s'; -
    51 -
    52    /** -
    53     * @var string $name                the name of the view -
    54     */ -
    55    protected $name; -
    56 -
    57    /** -
    58     * @var Doctrine_Query $query       the DQL query object this view is hooked into -
    59     */ -
    60    protected $query; -
    61 -
    62    /** -
    63     * @var Doctrine_Connection $conn   the connection object -
    64     */ -
    65    protected $conn; -
    66 -
    67    /** -
    68     * constructor -
    69     * -
    70     * @param Doctrine_Query $query -
    71     */ -
    72    public function __construct(Doctrine_Query $query, $viewName) -
    73    { -
    74        $this->name  = $viewName; -
    75        $this->query = $query; -
    76        $this->query->setView($this); -
    77        $this->conn   = $query->getConnection(); -
    78    } -
    79 -
    80    /** -
    81     * getQuery -
    82     * returns the associated query object -
    83     * -
    84     * @return Doctrine_Query -
    85     */ -
    86    public function getQuery() -
    87    { -
    88        return $this->query; -
    89    } -
    90 -
    91    /** -
    92     * getName -
    93     * returns the name of this view -
    94     * -
    95     * @return string -
    96     */ -
    97    public function getName() -
    98    { -
    99        return $this->name; -
    100    } -
    101 -
    102    /** -
    103     * getConnection -
    104     * returns the connection object -
    105     * -
    106     * @return Doctrine_Connection -
    107     */ -
    108    public function getConnection() -
    109    { -
    110        return $this->conn; -
    111    } -
    112 -
    113    /** -
    114     * create -
    115     * creates this view -
    116     * -
    117     * @throws Doctrine_View_Exception -
    118     * @return void -
    119     */ -
    120    public function create() -
    121    { -
    122        $sql = sprintf(self::CREATE, $this->name, $this->query->getQuery()); -
    123        try { -
    124            $this->conn->execute($sql); -
    125        } catch(Doctrine_Exception $e) { -
    126            throw new Doctrine_View_Exception($e->__toString()); -
    127        } -
    128    } -
    129 -
    130    /** -
    131     * drop -
    132     * drops this view from the database -
    133     * -
    134     * @throws Doctrine_View_Exception -
    135     * @return void -
    136     */ -
    137    public function drop() -
    138    { -
    139        try { -
    140            $this->conn->execute(sprintf(self::DROP, $this->name)); -
    141        } catch(Doctrine_Exception $e) { -
    142            throw new Doctrine_View_Exception($e->__toString()); -
    143        } -
    144    } -
    145 -
    146    /** -
    147     * execute -
    148     * executes the view -
    149     * returns a collection of Doctrine_Record objects -
    150     * -
    151     * @return Doctrine_Collection -
    152     */ -
    153    public function execute() -
    154    { -
    155        return $this->query->execute(); -
    156    } -
    157 -
    158    /** -
    159     * getSelectSql -
    160     * returns the select sql for this view -
    161     * -
    162     * @return string -
    163     */ -
    164    public function getSelectSql() -
    165    { -
    166        return sprintf(self::SELECT, $this->name); -
    167    } -
    168}
    \ No newline at end of file diff --git a/tests_old/coverage/coverage.txt b/tests_old/coverage/coverage.txt deleted file mode 100644 index 38f7e2bef..000000000 --- a/tests_old/coverage/coverage.txt +++ /dev/null @@ -1 +0,0 @@ -a:4:{s:8:"coverage";a:501:{s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record/Abstract.php";a:101:{i:48;i:1;i:50;i:1;i:51;i:-2;i:60;i:-1;i:61;i:-2;i:71;i:-1;i:73;i:-1;i:74;i:-2;i:88;i:1;i:89;i:-1;i:90;i:-2;i:91;i:1;i:93;i:-2;i:96;i:1;i:97;i:1;i:100;i:1;i:101;i:1;i:104;i:1;i:105;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:-2;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:132;i:-1;i:133;i:-1;i:134;i:-1;i:135;i:-1;i:136;i:-1;i:137;i:-1;i:138;i:-1;i:140;i:-1;i:141;i:-1;i:143;i:-1;i:156;i:1;i:157;i:-1;i:158;i:-1;i:159;i:-1;i:160;i:-1;i:161;i:-1;i:162;i:-1;i:164;i:-1;i:165;i:1;i:167;i:1;i:180;i:1;i:182;i:1;i:183;i:-2;i:196;i:1;i:197;i:1;i:198;i:-2;i:211;i:1;i:213;i:1;i:214;i:-2;i:227;i:1;i:229;i:1;i:230;i:-2;i:244;i:1;i:245;i:1;i:248;i:-1;i:249;i:-1;i:250;i:-1;i:251;i:-1;i:259;i:1;i:260;i:1;i:271;i:-1;i:273;i:-1;i:274;i:-2;i:286;i:1;i:287;i:1;i:288;i:1;i:289;i:1;i:290;i:1;i:292;i:1;i:293;i:-1;i:294;i:-2;i:297;i:1;i:299;i:1;i:301;i:1;i:302;i:-1;i:303;i:-2;i:304;i:1;i:306;i:1;i:308;i:1;i:309;i:1;i:310;i:1;i:312;i:1;i:313;i:-2;i:325;i:-1;i:326;i:-1;i:327;i:-1;i:328;i:-1;i:329;i:-1;i:330;i:-1;i:332;i:-1;i:333;i:-2;}s:53:"/home/bjartka/public_html/doctrine/models/Package.php";a:4:{i:4;i:1;i:5;i:1;i:9;i:1;i:10;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/MigrationTest.php";a:2:{i:6;i:1;i:7;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/Record_Country.php";a:4:{i:4;i:1;i:5;i:1;i:7;i:1;i:8;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/MyUserGroup.php";a:8:{i:6;i:-1;i:8;i:-1;i:9;i:-1;i:10;i:-1;i:11;i:-1;i:15;i:-1;i:16;i:-1;i:17;i:-1;}s:49:"/home/bjartka/public_html/doctrine/models/JC3.php";a:3:{i:4;i:-1;i:5;i:-1;i:6;i:-1;}s:63:"/home/bjartka/public_html/doctrine/models/FooForeignlyOwned.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:74:"/home/bjartka/public_html/doctrine/models/NestedSetTest_SingleRootNode.php";a:3:{i:5;i:1;i:6;i:1;i:7;i:1;}s:58:"/home/bjartka/public_html/doctrine/models/FooBarRecord.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/NestTest.php";a:13:{i:6;i:1;i:7;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:21;i:1;}s:73:"/home/bjartka/public_html/doctrine/tests/Query/ReferenceModelTestCase.php";a:44:{i:35;i:1;i:36;i:1;i:37;i:1;i:38;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:45;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:82;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:1;}s:64:"/home/bjartka/public_html/doctrine/tests/Record/HookTestCase.php";a:41:{i:36;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:-2;i:102;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record/Filter.php";a:6:{i:35;i:1;i:40;i:1;i:41;i:1;i:44;i:-1;i:45;i:-2;i:62;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Import/Mssql.php";a:75:{i:21;i:1;i:34;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:48;i:-2;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:-1;i:65;i:-1;i:66;i:-1;i:67;i:-1;i:68;i:-1;i:69;i:-1;i:72;i:-1;i:73;i:-1;i:74;i:-1;i:76;i:-1;i:79;i:-1;i:80;i:-1;i:81;i:-1;i:82;i:-1;i:83;i:-1;i:84;i:-1;i:85;i:-1;i:86;i:-1;i:87;i:-1;i:88;i:-1;i:89;i:-1;i:90;i:-1;i:91;i:-1;i:93;i:1;i:94;i:-2;i:105;i:-1;i:115;i:1;i:117;i:1;i:118;i:-2;i:127;i:1;i:129;i:1;i:131;i:1;i:132;i:-2;i:142;i:1;i:143;i:1;i:145;i:1;i:147;i:1;i:148;i:-2;i:158;i:-1;i:159;i:-1;i:160;i:-1;i:161;i:-1;i:162;i:-1;i:163;i:-1;i:164;i:-1;i:165;i:-1;i:166;i:-1;i:168;i:-1;i:169;i:-1;i:170;i:-1;i:171;i:-1;i:173;i:-1;i:174;i:-1;i:176;i:-1;i:178;i:-1;i:179;i:-1;i:180;i:-1;i:181;i:-1;i:182;i:-1;i:184;i:-1;i:185;i:-2;i:195;i:1;i:197;i:1;i:198;i:-2;i:199;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Unique.php";a:21:{i:34;i:1;i:43;i:1;i:44;i:1;i:46;i:1;i:47;i:-1;i:48;i:-1;i:50;i:1;i:52;i:1;i:53;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:69;i:1;i:70;i:-2;i:71;i:1;}s:79:"/home/bjartka/public_html/doctrine/tests/DoctrineTest/Doctrine_UnitTestCase.php";a:170:{i:61;i:-1;i:62;i:-2;i:66;i:1;i:68;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:92;i:1;i:93;i:1;i:96;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:-1;i:109;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:-1;i:124;i:1;i:125;i:1;i:128;i:1;i:129;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:135;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:145;i:1;i:147;i:1;i:148;i:1;i:150;i:1;i:152;i:1;i:155;i:1;i:156;i:1;i:158;i:1;i:160;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:-2;i:175;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:187;i:1;i:188;i:1;i:189;i:1;i:190;i:1;i:192;i:1;i:193;i:1;i:196;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:202;i:1;i:204;i:1;i:206;i:1;i:209;i:1;i:210;i:1;i:211;i:1;i:213;i:1;i:216;i:1;i:217;i:1;i:218;i:1;i:220;i:1;i:221;i:1;i:222;i:1;i:223;i:1;i:224;i:1;i:225;i:1;i:227;i:1;i:228;i:1;i:229;i:1;i:231;i:1;i:232;i:1;i:233;i:1;i:235;i:1;i:236;i:1;i:237;i:1;i:238;i:1;i:239;i:1;i:241;i:1;i:242;i:1;i:243;i:1;i:245;i:1;i:246;i:1;i:247;i:1;i:248;i:1;i:249;i:1;i:251;i:1;i:252;i:1;i:253;i:1;i:255;i:1;i:256;i:1;i:257;i:1;i:260;i:-1;i:261;i:-2;i:264;i:1;i:266;i:1;i:267;i:1;i:268;i:1;i:270;i:1;i:271;i:1;i:274;i:1;i:275;i:-2;i:278;i:-1;i:279;i:-1;i:280;i:-1;i:281;i:-1;i:282;i:-1;i:285;i:1;i:286;i:1;i:287;i:1;i:288;i:1;i:289;i:1;i:290;i:1;i:292;i:1;i:293;i:1;}s:52:"/home/bjartka/public_html/doctrine/models/Entity.php";a:18:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:21;i:1;i:22;i:1;i:23;i:1;i:24;i:1;i:25;i:1;}s:56:"/home/bjartka/public_html/doctrine/models/TestRecord.php";a:2:{i:6;i:1;i:7;i:1;}s:62:"/home/bjartka/public_html/doctrine/models/RecordFilterTest.php";a:7:{i:7;i:-1;i:8;i:-1;i:9;i:-1;i:11;i:-1;i:12;i:-2;i:14;i:-1;i:15;i:-2;}s:57:"/home/bjartka/public_html/doctrine/models/SelfRefTest.php";a:5:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:12;i:1;}s:49:"/home/bjartka/public_html/doctrine/models/JC2.php";a:3:{i:4;i:-1;i:5;i:-1;i:6;i:-1;}s:69:"/home/bjartka/public_html/doctrine/tests/Connection/PgsqlTestCase.php";a:78:{i:38;i:1;i:40;i:1;i:41;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:66;i:1;i:68;i:1;i:69;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:115;i:1;i:117;i:1;i:118;i:1;i:122;i:1;i:124;i:1;i:125;i:1;i:129;i:1;i:131;i:1;i:132;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:143;i:1;i:145;i:1;i:146;i:1;i:150;i:1;i:152;i:1;i:153;i:1;i:157;i:1;i:159;i:1;i:160;i:1;i:164;i:1;i:166;i:1;i:167;i:1;i:171;i:1;i:173;i:1;i:174;i:1;i:178;i:1;i:180;i:1;i:181;i:1;i:185;i:1;i:187;i:1;i:188;i:1;i:192;i:1;i:194;i:1;i:195;i:1;i:199;i:1;i:201;i:1;i:202;i:1;i:206;i:1;i:208;i:1;i:209;i:1;i:213;i:1;i:215;i:1;i:216;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/DataDict/FirebirdTestCase.php";a:145:{i:37;i:1;i:38;i:1;i:41;i:1;i:42;i:1;i:46;i:1;i:47;i:-1;i:48;i:1;i:49;i:1;i:51;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:107;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:116;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:125;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:143;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:152;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:161;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:170;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:179;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:188;i:1;i:190;i:1;i:192;i:1;i:194;i:1;i:196;i:1;i:198;i:1;i:199;i:1;i:203;i:1;i:205;i:1;i:206;i:1;i:209;i:1;i:211;i:1;i:212;i:1;i:215;i:1;i:217;i:1;i:218;i:1;i:221;i:1;i:223;i:1;i:224;i:1;i:227;i:1;i:229;i:1;i:230;i:1;i:233;i:1;i:235;i:1;i:236;i:1;i:239;i:1;i:241;i:1;i:242;i:1;i:245;i:1;i:247;i:1;i:248;i:1;i:251;i:1;i:253;i:1;i:254;i:1;i:257;i:1;i:259;i:1;i:260;i:1;i:263;i:1;i:265;i:1;i:266;i:1;i:269;i:1;i:271;i:1;i:272;i:1;i:275;i:1;i:277;i:1;i:278;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/Sequence/MssqlTestCase.php";a:17:{i:37;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:59;i:1;i:61;i:1;i:62;i:1;}s:73:"/home/bjartka/public_html/doctrine/tests/Relation/ManyToMany2TestCase.php";a:59:{i:37;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:-2;i:73;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:-2;i:88;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:109;i:1;i:111;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:127;i:1;i:133;i:1;}s:72:"/home/bjartka/public_html/doctrine/tests/Connection/ProfilerTestCase.php";a:87:{i:37;i:-1;i:39;i:-1;i:41;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:107;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:118;i:-2;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:137;i:-2;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:-2;i:151;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:-2;i:165;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:-2;i:175;i:-2;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;}s:64:"/home/bjartka/public_html/doctrine/tests/ColumnAliasTestCase.php";a:76:{i:37;i:1;i:38;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:-2;i:102;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:123;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:132;i:1;i:134;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:143;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:150;i:1;i:152;i:1;i:153;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Expression/Driver.php";a:137:{i:0;i:1;i:21;i:1;i:33;i:1;i:37;i:1;i:38;i:-2;i:41;i:1;i:42;i:-2;i:52;i:1;i:53;i:-2;i:63;i:1;i:64;i:1;i:65;i:-2;i:78;i:1;i:79;i:1;i:80;i:-2;i:90;i:1;i:91;i:1;i:92;i:-2;i:102;i:1;i:103;i:1;i:104;i:-2;i:114;i:1;i:115;i:1;i:116;i:-2;i:129;i:-1;i:130;i:-1;i:131;i:-2;i:142;i:1;i:143;i:1;i:144;i:-2;i:155;i:1;i:157;i:1;i:158;i:-2;i:170;i:1;i:171;i:1;i:172;i:1;i:173;i:-2;i:184;i:1;i:185;i:-2;i:196;i:-1;i:197;i:-2;i:208;i:1;i:209;i:-2;i:221;i:1;i:222;i:-2;i:234;i:1;i:235;i:-2;i:247;i:1;i:248;i:-2;i:257;i:1;i:258;i:-2;i:272;i:1;i:273;i:-2;i:289;i:1;i:290;i:1;i:291;i:1;i:293;i:1;i:294;i:1;i:296;i:-2;i:308;i:1;i:310;i:1;i:311;i:-2;i:328;i:1;i:329;i:1;i:330;i:-2;i:346;i:1;i:347;i:1;i:348;i:-1;i:349;i:-2;i:350;i:1;i:351;i:-1;i:352;i:-2;i:353;i:1;i:355;i:-2;i:379;i:1;i:380;i:-2;i:404;i:1;i:405;i:-2;i:429;i:1;i:430;i:-2;i:454;i:1;i:455;i:-2;i:474;i:1;i:475;i:1;i:476;i:1;i:477;i:-2;i:496;i:1;i:497;i:1;i:498;i:1;i:499;i:-2;i:518;i:1;i:519;i:1;i:520;i:1;i:521;i:-2;i:541;i:1;i:542;i:1;i:543;i:1;i:544;i:-2;i:563;i:1;i:564;i:1;i:565;i:1;i:566;i:-2;i:586;i:1;i:587;i:1;i:588;i:1;i:589;i:-2;i:614;i:1;i:615;i:-1;i:616;i:-1;i:617;i:1;i:618;i:1;i:620;i:1;i:621;i:-1;i:622;i:-2;i:623;i:1;i:624;i:-2;i:642;i:1;i:643;i:1;i:644;i:-2;i:662;i:1;i:663;i:1;i:664;i:-2;i:691;i:1;i:692;i:1;i:693;i:1;i:694;i:1;i:695;i:-2;i:704;i:-1;i:705;i:-2;i:714;i:1;i:715;i:-2;i:724;i:1;i:725;i:1;i:726;i:-2;i:727;i:1;i:728;i:-2;i:729;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Module.php";a:13:{i:34;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:70;i:1;i:71;i:-2;i:81;i:-1;i:82;i:-2;i:83;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Mysql.php";a:70:{i:21;i:1;i:34;i:1;i:49;i:1;i:50;i:1;i:52;i:-1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:100;i:-1;i:102;i:-1;i:103;i:-1;i:171;i:-1;i:172;i:-1;i:173;i:-1;i:175;i:-1;i:176;i:-1;i:178;i:-1;i:179;i:-1;i:180;i:-1;i:181;i:-1;i:183;i:-1;i:185;i:-1;i:186;i:-1;i:187;i:-1;i:188;i:-1;i:189;i:-1;i:192;i:-1;i:194;i:-1;i:195;i:-1;i:196;i:-1;i:197;i:-2;i:198;i:-1;i:199;i:-1;i:200;i:-1;i:202;i:-1;i:203;i:-1;i:204;i:-2;i:205;i:-1;i:207;i:-1;i:208;i:-2;i:210;i:1;}s:76:"/home/bjartka/public_html/doctrine/lib/Doctrine/Search/Analyzer/Standard.php";a:21:{i:33;i:1;i:275;i:1;i:276;i:1;i:277;i:1;i:279;i:1;i:281;i:1;i:282;i:1;i:283;i:1;i:284;i:1;i:285;i:1;i:286;i:-2;i:287;i:1;i:289;i:1;i:290;i:1;i:291;i:-2;i:293;i:1;i:294;i:1;i:295;i:1;i:296;i:1;i:297;i:-2;i:299;i:1;}s:56:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hook.php";a:70:{i:34;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:-1;i:86;i:-1;i:87;i:-1;i:90;i:1;i:91;i:1;i:100;i:1;i:101;i:-2;i:111;i:-1;i:112;i:-1;i:122;i:-1;i:123;i:-1;i:135;i:1;i:136;i:-1;i:137;i:-2;i:138;i:1;i:139;i:1;i:140;i:-1;i:141;i:-2;i:142;i:1;i:144;i:1;i:145;i:1;i:147;i:1;i:148;i:1;i:150;i:1;i:151;i:-1;i:152;i:-2;i:154;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:162;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:169;i:1;i:170;i:-2;i:182;i:1;i:183;i:-1;i:184;i:-2;i:185;i:1;i:186;i:1;i:188;i:1;i:190;i:1;i:191;i:1;i:192;i:1;i:194;i:1;i:196;i:1;i:197;i:1;i:199;i:1;i:200;i:1;i:202;i:1;i:203;i:1;i:204;i:1;i:205;i:1;i:206;i:1;i:207;i:1;i:208;i:-2;i:218;i:-1;i:219;i:-1;i:228;i:-1;i:229;i:-1;i:231;i:1;}s:63:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Check.php";a:61:{i:34;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:70;i:-1;i:71;i:-2;i:81;i:1;i:82;i:1;i:94;i:1;i:96;i:1;i:97;i:-1;i:98;i:-1;i:99;i:-1;i:100;i:-1;i:102;i:-1;i:103;i:-1;i:104;i:1;i:105;i:1;i:106;i:-1;i:107;i:-1;i:108;i:-1;i:109;i:-1;i:111;i:-1;i:112;i:-1;i:113;i:1;i:114;i:1;i:117;i:-1;i:118;i:-2;i:122;i:1;i:124;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:138;i:1;i:139;i:-2;i:142;i:1;i:143;i:1;i:144;i:1;i:146;i:1;i:148;i:1;i:149;i:1;i:150;i:-2;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:-2;i:167;i:1;i:168;i:-2;i:169;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Import/Schema.php";a:205:{i:41;i:1;i:59;i:-1;i:60;i:-1;i:61;i:-2;i:62;i:-1;i:73;i:-1;i:74;i:-1;i:75;i:-1;i:76;i:-1;i:86;i:-1;i:87;i:-1;i:88;i:-1;i:89;i:-1;i:102;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:-1;i:109;i:-1;i:111;i:-1;i:112;i:-1;i:113;i:-1;i:114;i:-1;i:115;i:-1;i:116;i:-1;i:117;i:-1;i:118;i:-1;i:120;i:1;i:122;i:1;i:124;i:1;i:125;i:-2;i:140;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:149;i:1;i:151;i:1;i:152;i:1;i:153;i:-1;i:154;i:-2;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:185;i:1;i:186;i:-1;i:187;i:-1;i:189;i:1;i:190;i:-2;i:202;i:1;i:203;i:-2;i:215;i:1;i:218;i:1;i:219;i:1;i:220;i:1;i:221;i:1;i:222;i:1;i:223;i:1;i:224;i:1;i:226;i:-1;i:227;i:-1;i:228;i:-1;i:230;i:1;i:232;i:1;i:233;i:-2;i:245;i:1;i:246;i:-2;i:258;i:1;i:259;i:-2;i:271;i:1;i:272;i:-2;i:284;i:1;i:285;i:-2;i:295;i:1;i:296;i:-2;i:309;i:1;i:311;i:1;i:313;i:1;i:314;i:1;i:316;i:1;i:318;i:1;i:319;i:-1;i:320;i:-1;i:321;i:1;i:322;i:-1;i:323;i:-1;i:324;i:1;i:328;i:1;i:329;i:1;i:331;i:1;i:332;i:1;i:333;i:1;i:334;i:1;i:336;i:1;i:337;i:1;i:338;i:1;i:339;i:1;i:340;i:1;i:341;i:-1;i:342;i:-1;i:343;i:-1;i:346;i:1;i:347;i:1;i:348;i:1;i:349;i:1;i:350;i:1;i:351;i:1;i:352;i:1;i:354;i:1;i:356;i:1;i:357;i:1;i:358;i:-1;i:359;i:-1;i:360;i:1;i:362;i:1;i:363;i:1;i:364;i:1;i:366;i:1;i:367;i:1;i:368;i:1;i:369;i:1;i:370;i:1;i:371;i:1;i:372;i:1;i:373;i:1;i:374;i:1;i:375;i:1;i:376;i:1;i:378;i:1;i:379;i:-1;i:380;i:-1;i:381;i:1;i:383;i:1;i:384;i:-2;i:397;i:1;i:398;i:1;i:399;i:-1;i:400;i:-2;i:402;i:1;i:403;i:1;i:405;i:1;i:406;i:1;i:409;i:1;i:410;i:-1;i:411;i:-1;i:412;i:-1;i:413;i:1;i:414;i:1;i:417;i:1;i:418;i:1;i:420;i:1;i:421;i:-1;i:422;i:-1;i:424;i:1;i:425;i:-1;i:426;i:-1;i:427;i:1;i:430;i:1;i:431;i:1;i:432;i:1;i:434;i:1;i:435;i:1;i:436;i:1;i:439;i:1;i:440;i:1;i:451;i:1;i:452;i:1;i:453;i:1;i:454;i:1;i:455;i:1;i:456;i:1;i:457;i:1;i:461;i:1;i:463;i:1;i:464;i:-1;i:465;i:-1;i:466;i:-1;i:467;i:1;i:468;i:1;i:469;i:1;i:470;i:1;i:474;i:1;i:475;i:1;i:476;i:1;i:477;i:1;i:478;i:1;i:479;i:1;i:480;i:1;}s:49:"/home/bjartka/public_html/doctrine/models/JC1.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:51:"/home/bjartka/public_html/doctrine/models/Error.php";a:6:{i:4;i:1;i:5;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/RecordHookTest.php";a:20:{i:8;i:1;i:9;i:1;i:12;i:1;i:13;i:1;i:16;i:1;i:17;i:1;i:20;i:1;i:21;i:1;i:24;i:1;i:25;i:1;i:28;i:1;i:29;i:1;i:32;i:1;i:33;i:1;i:36;i:1;i:37;i:1;i:40;i:1;i:41;i:1;i:44;i:1;i:45;i:-2;}s:59:"/home/bjartka/public_html/doctrine/models/ConcreteGroup.php";a:2:{i:6;i:1;i:7;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/I18nTest.php";a:5:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:12;i:1;}s:56:"/home/bjartka/public_html/doctrine/models/File_Owner.php";a:4:{i:4;i:-1;i:5;i:-1;i:7;i:-1;i:8;i:-1;}s:56:"/home/bjartka/public_html/doctrine/models/SearchTest.php";a:7:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:12;i:1;i:14;i:1;i:15;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/NotNullTest.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:69:"/home/bjartka/public_html/doctrine/tests/Connection/MysqlTestCase.php";a:72:{i:35;i:1;i:36;i:1;i:37;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:44;i:1;i:46;i:1;i:47;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:109;i:1;i:111;i:1;i:112;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:124;i:1;i:126;i:1;i:127;i:1;i:129;i:1;i:131;i:1;i:132;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:141;i:1;i:142;i:1;i:144;i:1;i:146;i:1;i:147;i:1;i:149;i:1;i:151;i:1;i:152;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Expression/DriverTestCase.php";a:73:{i:39;i:1;i:41;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:58;i:1;i:59;i:-1;i:60;i:1;i:61;i:1;i:63;i:1;i:66;i:1;i:67;i:-1;i:68;i:1;i:69;i:1;i:71;i:1;i:77;i:1;i:78;i:1;i:84;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:111;i:1;i:113;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:135;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:141;i:1;i:142;i:1;i:144;i:1;i:145;i:1;i:147;i:1;i:148;i:1;i:150;i:1;i:151;i:1;i:157;i:1;i:158;i:1;i:160;i:1;i:161;i:1;i:163;i:1;i:164;i:1;i:166;i:1;i:167;i:1;i:169;i:1;i:170;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hydrator/Abstract.php";a:7:{i:62;i:1;i:71;i:1;i:72;i:1;i:83;i:1;i:84;i:1;i:94;i:-1;i:95;i:-2;}s:69:"/home/bjartka/public_html/doctrine/tests/DataType/BooleanTestCase.php";a:58:{i:34;i:1;i:36;i:1;i:37;i:1;i:38;i:1;i:41;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:97;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:114;i:1;i:115;i:1;i:116;i:1;}s:57:"/home/bjartka/public_html/doctrine/tests/HookTestCase.php";a:69:{i:38;i:1;i:40;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:86;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:102;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:124;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:134;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:144;i:1;i:146;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:154;i:1;i:156;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:164;i:1;i:166;i:1;i:168;i:1;i:169;i:1;i:170;i:1;}s:64:"/home/bjartka/public_html/doctrine/tests/Query/CheckTestCase.php";a:18:{i:36;i:1;i:38;i:1;i:41;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:52;i:1;i:53;i:-1;i:54;i:1;i:55;i:1;i:57;i:1;i:60;i:1;i:63;i:1;i:64;i:-1;i:65;i:1;i:66;i:1;i:68;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Import/SchemaTestCase.php";a:45:{i:40;i:1;i:41;i:1;i:43;i:1;i:44;i:-1;i:45;i:-1;i:47;i:1;i:48;i:-1;i:49;i:-1;i:50;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:80;i:1;i:81;i:1;i:82;i:-1;i:84;i:-1;i:85;i:-2;i:86;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:94;i:1;i:95;i:1;i:97;i:1;i:100;i:1;i:101;i:1;i:102;i:-2;i:103;i:-1;i:105;i:-2;}s:61:"/home/bjartka/public_html/doctrine/lib/Doctrine/Formatter.php";a:85:{i:21;i:1;i:33;i:1;i:49;i:-1;i:50;i:-1;i:51;i:-2;i:52;i:-1;i:54;i:-1;i:55;i:-1;i:56;i:-1;i:58;i:-1;i:59;i:-1;i:60;i:-1;i:61;i:-1;i:62;i:-2;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:87;i:1;i:88;i:-2;i:124;i:1;i:125;i:1;i:126;i:-2;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:132;i:1;i:133;i:-2;i:145;i:1;i:146;i:1;i:147;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:170;i:1;i:171;i:-2;i:172;i:-1;i:182;i:-1;i:183;i:-1;i:185;i:-1;i:186;i:-1;i:187;i:-2;i:188;i:-1;i:189;i:-2;i:199;i:-1;i:200;i:-1;i:201;i:-1;i:202;i:-1;i:203;i:-2;i:204;i:-1;i:205;i:-2;i:215;i:1;i:216;i:1;i:217;i:-2;i:227;i:1;i:228;i:1;i:229;i:-2;i:239;i:1;i:240;i:1;i:241;i:-2;i:243;i:1;}s:71:"/home/bjartka/public_html/doctrine/lib/Doctrine/Relation/ForeignKey.php";a:39:{i:21;i:1;i:34;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:80;i:1;i:81;i:-2;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:-2;i:99;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Pgsql.php";a:90:{i:21;i:1;i:34;i:1;i:50;i:-1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:91;i:-1;i:92;i:-1;i:93;i:-1;i:107;i:1;i:108;i:1;i:109;i:-1;i:110;i:-1;i:111;i:-1;i:112;i:-1;i:113;i:1;i:114;i:-1;i:115;i:-1;i:116;i:-1;i:118;i:1;i:119;i:-2;i:132;i:1;i:133;i:1;i:135;i:1;i:136;i:-1;i:137;i:-1;i:139;i:1;i:140;i:-1;i:141;i:-1;i:142;i:-1;i:143;i:-1;i:144;i:-1;i:146;i:-1;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:151;i:-1;i:152;i:-1;i:154;i:1;i:155;i:1;i:156;i:-2;i:166;i:-1;i:168;i:-1;i:170;i:-1;i:171;i:-1;i:173;i:-1;i:174;i:-1;i:175;i:-1;i:177;i:-1;i:178;i:-1;i:179;i:-1;i:180;i:-1;i:181;i:-1;i:182;i:-1;i:183;i:-1;i:185;i:-1;i:186;i:-1;i:187;i:-1;i:188;i:-1;i:189;i:-1;i:190;i:-1;i:192;i:-1;i:193;i:-1;i:194;i:-2;i:195;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/DataDict/Firebird.php";a:122:{i:21;i:1;i:33;i:1;i:59;i:1;i:60;i:-1;i:61;i:-2;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:-1;i:95;i:-1;i:96;i:-1;i:97;i:-1;i:98;i:-1;i:100;i:-1;i:101;i:-2;i:111;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:128;i:-1;i:129;i:-1;i:130;i:-1;i:131;i:-2;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:136;i:-1;i:137;i:-1;i:138;i:-1;i:139;i:-1;i:140;i:-1;i:141;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:-1;i:149;i:-1;i:150;i:-1;i:151;i:-1;i:152;i:-1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:187;i:1;i:188;i:1;i:189;i:1;i:190;i:1;i:191;i:-2;i:203;i:1;i:204;i:-2;i:216;i:1;i:217;i:-2;i:218;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Sequence/Mssql.php";a:53:{i:21;i:1;i:33;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:-1;i:58;i:1;i:60;i:1;i:61;i:-2;i:66;i:-2;i:67;i:-2;i:68;i:-2;i:76;i:-2;i:77;i:-2;i:78;i:-2;i:80;i:-2;i:81;i:-2;i:82;i:-2;i:85;i:1;i:87;i:1;i:88;i:1;i:91;i:1;i:92;i:1;i:93;i:-2;i:94;i:-2;i:95;i:-2;i:97;i:1;i:98;i:1;i:99;i:-2;i:110;i:1;i:112;i:1;i:113;i:1;i:114;i:-2;i:115;i:-2;i:116;i:-2;i:118;i:1;i:119;i:-2;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:135;i:-1;i:137;i:-1;i:138;i:1;i:141;i:1;i:142;i:-2;i:153;i:1;i:155;i:1;i:156;i:-2;i:157;i:1;}s:74:"/home/bjartka/public_html/doctrine/models/export/Cms_CategoryLanguages.php";a:14:{i:2;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:22;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record/Iterator.php";a:14:{i:0;i:1;i:33;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:63;i:-1;i:64;i:-1;i:73;i:1;i:75;i:1;i:76;i:-1;i:77;i:-2;i:78;i:1;i:80;i:-2;i:81;i:1;}s:71:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Profiler.php";a:36:{i:0;i:1;i:21;i:1;i:33;i:1;i:58;i:1;i:68;i:-1;i:82;i:1;i:83;i:-1;i:84;i:-2;i:87;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:110;i:1;i:120;i:-1;i:121;i:-1;i:122;i:-2;i:123;i:-1;i:124;i:-2;i:134;i:-1;i:135;i:-2;i:145;i:-1;i:146;i:-2;i:155;i:-1;i:156;i:-2;i:165;i:1;i:166;i:-2;i:176;i:1;i:177;i:-1;i:178;i:-2;i:180;i:1;i:181;i:1;i:182;i:-2;i:183;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Usstate.php";a:6:{i:34;i:1;i:92;i:-1;i:93;i:-2;i:103;i:1;i:104;i:-2;i:105;i:1;}s:62:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hook/Equal.php";a:6:{i:21;i:1;i:33;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;}s:56:"/home/bjartka/public_html/doctrine/lib/Doctrine/Node.php";a:43:{i:33;i:1;i:70;i:1;i:71;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:-1;i:79;i:-1;i:80;i:-1;i:81;i:-1;i:82;i:-1;i:83;i:1;i:84;i:-1;i:85;i:-1;i:86;i:1;i:88;i:1;i:100;i:1;i:102;i:1;i:103;i:-1;i:104;i:-2;i:106;i:1;i:107;i:-2;i:116;i:-1;i:117;i:-1;i:126;i:-1;i:127;i:-2;i:137;i:-1;i:138;i:-2;i:148;i:-1;i:149;i:-1;i:150;i:-1;i:152;i:-1;i:153;i:-1;i:154;i:-1;i:156;i:-1;i:157;i:-1;i:159;i:-1;i:160;i:-2;i:169;i:-1;i:170;i:-1;i:179;i:-1;i:180;i:-1;i:181;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Node/NestedSet.php";a:438:{i:34;i:1;i:43;i:-1;i:44;i:-2;i:53;i:-1;i:54;i:-2;i:63;i:-1;i:64;i:-2;i:73;i:-1;i:74;i:-2;i:83;i:-1;i:84;i:-1;i:85;i:-1;i:86;i:-1;i:87;i:-1;i:89;i:-1;i:90;i:-1;i:91;i:-2;i:93;i:-1;i:94;i:-1;i:95;i:-1;i:96;i:-1;i:97;i:-1;i:99;i:-1;i:100;i:-2;i:109;i:-1;i:110;i:-1;i:111;i:-1;i:112;i:-1;i:113;i:-1;i:115;i:-1;i:116;i:-1;i:117;i:-2;i:119;i:-1;i:120;i:-1;i:121;i:-1;i:122;i:-1;i:123;i:-1;i:125;i:-1;i:126;i:-2;i:135;i:-1;i:136;i:-1;i:137;i:-1;i:138;i:-1;i:139;i:-1;i:140;i:-1;i:141;i:-2;i:142;i:-1;i:143;i:-1;i:144;i:-1;i:145;i:-1;i:146;i:-2;i:155;i:-1;i:156;i:-1;i:157;i:-1;i:158;i:-1;i:159;i:-1;i:161;i:-1;i:162;i:-1;i:163;i:-2;i:165;i:-1;i:166;i:-1;i:167;i:-1;i:168;i:-1;i:169;i:-1;i:171;i:-1;i:172;i:-2;i:181;i:-1;i:182;i:-1;i:183;i:-1;i:184;i:-1;i:185;i:-1;i:187;i:-1;i:188;i:-1;i:189;i:-2;i:191;i:-1;i:192;i:-1;i:193;i:-1;i:194;i:-1;i:195;i:-1;i:197;i:-1;i:198;i:-2;i:207;i:1;i:208;i:-2;i:219;i:1;i:220;i:1;i:221;i:1;i:223;i:1;i:224;i:-1;i:225;i:-1;i:226;i:1;i:229;i:1;i:230;i:1;i:231;i:1;i:233;i:1;i:234;i:1;i:236;i:1;i:237;i:-1;i:238;i:-2;i:240;i:1;i:241;i:-2;i:250;i:-1;i:251;i:-1;i:252;i:-1;i:253;i:-1;i:254;i:-1;i:255;i:-1;i:257;i:-1;i:258;i:-1;i:259;i:-2;i:261;i:-1;i:262;i:-1;i:263;i:-1;i:264;i:-1;i:265;i:-1;i:267;i:-1;i:268;i:-2;i:279;i:1;i:280;i:1;i:281;i:1;i:282;i:1;i:283;i:1;i:284;i:-1;i:285;i:-1;i:286;i:1;i:287;i:1;i:288;i:1;i:289;i:-1;i:290;i:-2;i:291;i:1;i:292;i:-2;i:303;i:-1;i:304;i:-1;i:305;i:-1;i:306;i:-1;i:307;i:-1;i:308;i:-1;i:309;i:-1;i:310;i:-1;i:312;i:-1;i:313;i:-2;i:322;i:1;i:323;i:-2;i:332;i:-1;i:333;i:-2;i:344;i:-1;i:345;i:-1;i:346;i:-2;i:348;i:-1;i:349;i:-1;i:350;i:-2;i:351;i:-1;i:352;i:-1;i:353;i:-1;i:355;i:-1;i:356;i:-1;i:358;i:-1;i:359;i:-1;i:361;i:-1;i:362;i:-2;i:373;i:-1;i:374;i:-1;i:376;i:-1;i:377;i:-1;i:378;i:-1;i:380;i:-1;i:381;i:-1;i:382;i:-1;i:387;i:-1;i:388;i:-2;i:399;i:-1;i:400;i:-1;i:402;i:-1;i:403;i:-1;i:404;i:-1;i:406;i:-1;i:407;i:-1;i:408;i:-1;i:413;i:-1;i:414;i:-2;i:425;i:-1;i:426;i:-1;i:428;i:-1;i:429;i:-1;i:430;i:-1;i:432;i:-1;i:433;i:-1;i:434;i:-1;i:439;i:-1;i:440;i:-2;i:451;i:1;i:452;i:1;i:454;i:1;i:455;i:1;i:456;i:1;i:458;i:1;i:459;i:1;i:460;i:1;i:465;i:1;i:466;i:-2;i:479;i:-1;i:482;i:-1;i:485;i:-1;i:486;i:-1;i:487;i:-1;i:488;i:-1;i:489;i:-1;i:492;i:-1;i:495;i:-1;i:496;i:-1;i:499;i:-1;i:500;i:-1;i:501;i:-1;i:504;i:-1;i:505;i:-1;i:508;i:-1;i:509;i:-1;i:510;i:-1;i:511;i:-1;i:512;i:-1;i:513;i:-1;i:514;i:-1;i:515;i:-1;i:516;i:-1;i:517;i:-1;i:518;i:-1;i:519;i:-1;i:520;i:-1;i:521;i:-1;i:522;i:-1;i:524;i:-1;i:525;i:-1;i:526;i:-1;i:528;i:-1;i:529;i:-1;i:532;i:-1;i:533;i:-1;i:534;i:-1;i:537;i:-1;i:538;i:-1;i:539;i:-1;i:540;i:-1;i:541;i:-1;i:542;i:-1;i:543;i:-1;i:544;i:-1;i:545;i:-1;i:546;i:-1;i:548;i:-1;i:549;i:-1;i:550;i:-1;i:551;i:-1;i:553;i:-1;i:561;i:-1;i:563;i:-1;i:564;i:-1;i:566;i:-1;i:567;i:-1;i:568;i:-1;i:570;i:-1;i:578;i:-1;i:580;i:-1;i:581;i:-1;i:583;i:-1;i:584;i:-1;i:585;i:-1;i:587;i:-1;i:595;i:-1;i:597;i:-1;i:598;i:-1;i:600;i:-1;i:601;i:-1;i:602;i:-1;i:604;i:-1;i:612;i:-1;i:614;i:-1;i:615;i:-1;i:617;i:-1;i:618;i:-1;i:619;i:-1;i:621;i:-1;i:631;i:-1;i:632;i:-1;i:633;i:-2;i:635;i:-1;i:636;i:-1;i:637;i:-1;i:638;i:-1;i:641;i:-1;i:642;i:-1;i:645;i:-1;i:646;i:-1;i:647;i:-1;i:650;i:-1;i:651;i:-1;i:652;i:-1;i:653;i:-1;i:656;i:-1;i:657;i:-1;i:658;i:-1;i:659;i:-1;i:660;i:-1;i:661;i:-1;i:662;i:-1;i:663;i:-1;i:664;i:-1;i:665;i:-1;i:666;i:-1;i:667;i:-1;i:668;i:-1;i:669;i:-1;i:671;i:-1;i:673;i:-1;i:674;i:-2;i:675;i:-2;i:677;i:-1;i:685;i:-1;i:686;i:-1;i:695;i:-1;i:696;i:-2;i:705;i:-1;i:706;i:-2;i:715;i:-1;i:716;i:-1;i:717;i:-1;i:718;i:-1;i:719;i:-2;i:728;i:-1;i:729;i:-1;i:730;i:-1;i:731;i:-2;i:740;i:-1;i:741;i:-1;i:742;i:-1;i:743;i:-2;i:752;i:1;i:753;i:1;i:754;i:-1;i:755;i:-1;i:756;i:-2;i:757;i:-1;i:759;i:-2;i:768;i:-1;i:769;i:-1;i:771;i:-1;i:772;i:-1;i:774;i:-1;i:776;i:-1;i:778;i:-1;i:780;i:-1;i:782;i:-1;i:783;i:-1;i:784;i:-1;i:786;i:-1;i:787;i:-2;i:797;i:1;i:798;i:1;i:799;i:1;i:800;i:1;i:801;i:1;i:811;i:-1;i:812;i:-1;i:813;i:-1;i:814;i:-1;i:816;i:-1;i:819;i:-1;i:821;i:-1;i:822;i:-1;i:823;i:-1;i:824;i:-1;i:827;i:-1;i:828;i:-1;i:829;i:-1;i:830;i:-1;i:831;i:-1;i:832;i:-1;i:833;i:-1;i:836;i:-1;i:839;i:-1;i:841;i:-1;i:842;i:-1;i:843;i:-1;i:853;i:1;i:854;i:1;i:857;i:1;i:858;i:1;i:859;i:1;i:860;i:1;i:862;i:1;i:864;i:1;i:867;i:1;i:868;i:1;i:869;i:1;i:871;i:1;i:873;i:1;i:874;i:1;i:886;i:-1;i:887;i:-1;i:890;i:-1;i:891;i:-1;i:892;i:-1;i:893;i:-1;i:895;i:-1;i:897;i:-1;i:900;i:-1;i:901;i:-1;i:902;i:-1;i:904;i:-1;i:906;i:-1;i:907;i:-1;i:916;i:1;i:917;i:-2;i:926;i:1;i:927;i:1;i:936;i:1;i:937;i:-2;i:946;i:1;i:947;i:1;i:956;i:-1;i:957;i:-1;i:958;i:-1;i:959;i:-1;i:960;i:-1;i:962;i:-1;i:964;i:-1;i:966;i:-1;i:967;i:-1;i:968;i:-1;i:969;i:-2;i:977;i:1;i:978;i:-1;i:979;i:-2;i:980;i:1;i:981;i:-2;i:990;i:1;i:991;i:-1;i:992;i:-1;i:993;i:1;i:994;i:1;}s:51:"/home/bjartka/public_html/doctrine/tests/schema.yml";a:3:{i:24;i:1;i:47;i:1;i:55;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/QueryTest_Board.php";a:12:{i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:24;i:1;i:25;i:1;i:26;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Import/MssqlTestCase.php";a:19:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:44;i:1;i:46;i:1;i:47;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:68;i:1;i:70;i:1;i:71;i:1;}s:75:"/home/bjartka/public_html/doctrine/tests/Query/OneToOneFetchingTestCase.php";a:125:{i:36;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:84;i:1;i:85;i:1;i:87;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:120;i:1;i:122;i:1;i:126;i:1;i:127;i:1;i:131;i:1;i:132;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:140;i:1;i:141;i:-2;i:143;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:157;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:174;i:1;i:176;i:1;i:178;i:1;i:179;i:-2;i:182;i:1;i:183;i:1;i:184;i:1;i:190;i:1;i:192;i:1;i:193;i:1;i:194;i:1;i:195;i:1;i:196;i:1;i:197;i:1;i:198;i:1;i:201;i:1;i:202;i:1;i:205;i:1;i:207;i:1;i:208;i:1;i:210;i:1;i:211;i:1;i:213;i:1;i:214;i:1;i:215;i:1;i:217;i:1;i:218;i:-2;i:220;i:1;i:229;i:1;i:230;i:1;i:231;i:1;i:232;i:1;i:234;i:1;i:236;i:1;i:237;i:1;i:238;i:1;i:239;i:1;i:240;i:1;i:241;i:1;i:242;i:1;i:245;i:1;i:246;i:1;i:247;i:1;i:250;i:1;i:252;i:1;i:254;i:1;i:255;i:-2;i:256;i:-2;i:259;i:1;i:261;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Record/FilterTestCase.php";a:34:{i:36;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:48;i:1;i:50;i:-1;i:51;i:1;i:52;i:1;i:54;i:1;i:58;i:1;i:61;i:1;i:63;i:-1;i:64;i:1;i:65;i:1;i:67;i:1;i:71;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:-2;i:85;i:1;i:91;i:1;i:92;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:104;i:1;i:105;i:1;i:106;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Groupby.php";a:10:{i:21;i:1;i:33;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:-2;i:66;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction/Mock.php";a:3:{i:21;i:1;i:35;i:1;i:36;i:1;}s:65:"/home/bjartka/public_html/doctrine/models/export/Cms_Category.php";a:13:{i:2;i:1;i:7;i:1;i:8;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:22;i:1;}s:47:"/home/bjartka/tmp/dparser_0.97658000 1196020168";a:1:{i:6;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/mmrUser_B.php";a:7:{i:6;i:1;i:7;i:1;i:8;i:1;i:10;i:1;i:15;i:1;i:16;i:1;i:17;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/CPK_Association.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/Phototag.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:53:"/home/bjartka/public_html/doctrine/models/Element.php";a:6:{i:4;i:1;i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Relation/NestTestCase.php";a:120:{i:36;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:83;i:1;i:85;i:1;i:86;i:1;i:88;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:105;i:1;i:107;i:1;i:109;i:1;i:118;i:1;i:120;i:1;i:122;i:1;i:124;i:1;i:126;i:1;i:127;i:1;i:131;i:1;i:133;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:141;i:1;i:142;i:1;i:144;i:1;i:146;i:1;i:147;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:153;i:1;i:155;i:1;i:157;i:1;i:159;i:1;i:161;i:1;i:162;i:1;i:165;i:1;i:167;i:1;i:169;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:189;i:1;i:190;i:1;i:194;i:1;i:196;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:201;i:1;i:202;i:1;i:205;i:1;i:207;i:1;i:208;i:1;i:211;i:1;i:213;i:1;i:215;i:1;i:217;i:1;i:219;i:1;i:220;i:1;i:223;i:1;i:225;i:1;i:227;i:1;i:229;i:1;i:231;i:1;i:232;i:1;i:236;i:1;i:238;i:1;i:240;i:1;i:242;i:1;i:244;i:1;i:246;i:1;i:247;i:1;}s:60:"/home/bjartka/public_html/doctrine/lib/Doctrine/Relation.php";a:73:{i:0;i:1;i:34;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:-1;i:130;i:-2;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:152;i:-2;i:155;i:-1;i:156;i:-2;i:160;i:-1;i:161;i:-2;i:164;i:1;i:165;i:-2;i:169;i:-1;i:170;i:-2;i:174;i:1;i:175;i:1;i:176;i:-2;i:178;i:-1;i:179;i:-2;i:183;i:-1;i:184;i:-1;i:185;i:-1;i:186;i:-1;i:190;i:-1;i:191;i:-1;i:200;i:1;i:201;i:-2;i:211;i:1;i:212;i:-2;i:223;i:1;i:224;i:-2;i:234;i:1;i:235;i:1;i:236;i:1;i:237;i:-2;i:247;i:1;i:248;i:-2;i:259;i:1;i:260;i:-2;i:270;i:1;i:271;i:1;i:272;i:-2;i:282;i:1;i:283;i:1;i:284;i:-2;i:294;i:1;i:297;i:1;i:298;i:1;i:300;i:1;i:301;i:-2;i:320;i:-1;i:321;i:-1;i:322;i:-1;i:323;i:-1;i:324;i:-1;i:325;i:-1;i:326;i:-1;i:327;i:-1;i:328;i:-1;i:329;i:-2;i:330;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Sequence/Sqlite.php";a:29:{i:21;i:1;i:33;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:52;i:1;i:54;i:1;i:55;i:-2;i:61;i:-2;i:62;i:-2;i:63;i:-2;i:66;i:-2;i:67;i:-2;i:68;i:-2;i:71;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:81;i:1;i:82;i:1;i:83;i:-2;i:95;i:1;i:96;i:-2;i:107;i:1;i:108;i:1;i:110;i:1;i:112;i:1;i:113;i:-2;i:114;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Sequence/Oracle.php";a:26:{i:21;i:1;i:33;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:50;i:1;i:51;i:-2;i:54;i:-2;i:55;i:-2;i:56;i:-2;i:58;i:-2;i:59;i:-2;i:60;i:-2;i:62;i:1;i:63;i:-2;i:74;i:1;i:75;i:1;i:77;i:1;i:78;i:-2;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:-2;i:96;i:1;}s:71:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Exception.php";a:24:{i:21;i:1;i:33;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:51;i:1;i:52;i:-2;i:56;i:-1;i:57;i:-2;i:61;i:1;i:62;i:-2;i:72;i:-1;i:73;i:-2;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:-2;i:96;i:-1;i:97;i:-1;i:98;i:-1;i:99;i:-1;i:100;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Table/Exception.php";a:5:{i:21;i:1;i:34;i:1;i:39;i:1;i:40;i:1;i:41;i:1;}s:56:"/home/bjartka/public_html/doctrine/lib/Doctrine/Tree.php";a:29:{i:33;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:-1;i:60;i:-1;i:61;i:-1;i:62;i:-1;i:63;i:-1;i:64;i:-1;i:66;i:1;i:75;i:-1;i:76;i:-2;i:84;i:1;i:97;i:1;i:98;i:1;i:99;i:-1;i:100;i:-2;i:101;i:1;i:102;i:-2;i:110;i:1;i:111;i:-2;i:120;i:-1;i:121;i:-1;i:128;i:1;i:129;i:-2;i:130;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Tree/NestedSet.php";a:116:{i:33;i:1;i:47;i:1;i:48;i:1;i:49;i:-1;i:50;i:-1;i:52;i:1;i:53;i:1;i:62;i:1;i:63;i:-1;i:64;i:-1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:78;i:1;i:79;i:-1;i:80;i:-1;i:83;i:1;i:84;i:-1;i:85;i:-1;i:87;i:1;i:88;i:1;i:89;i:1;i:91;i:1;i:93;i:1;i:94;i:-2;i:104;i:-1;i:105;i:-2;i:114;i:1;i:115;i:1;i:118;i:1;i:119;i:1;i:121;i:1;i:122;i:-1;i:123;i:-2;i:125;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:-1;i:130;i:-1;i:131;i:-1;i:132;i:-1;i:135;i:1;i:136;i:-2;i:147;i:-1;i:149;i:-1;i:152;i:-1;i:153;i:-1;i:154;i:-1;i:155;i:-1;i:156;i:-1;i:157;i:-1;i:160;i:-1;i:161;i:-1;i:163;i:-1;i:164;i:-1;i:165;i:-2;i:167;i:-1;i:168;i:-2;i:180;i:-1;i:181;i:-1;i:183;i:-1;i:184;i:-2;i:187;i:-1;i:188;i:-1;i:189;i:-1;i:190;i:-1;i:191;i:-1;i:192;i:-1;i:193;i:-2;i:203;i:-1;i:204;i:-1;i:205;i:-1;i:206;i:-2;i:215;i:-1;i:216;i:-2;i:225;i:-1;i:226;i:-1;i:231;i:-1;i:233;i:-1;i:235;i:-1;i:237;i:-1;i:239;i:-1;i:240;i:-2;i:251;i:1;i:252;i:-1;i:253;i:-1;i:254;i:-1;i:255;i:-1;i:256;i:-1;i:258;i:-1;i:260;i:1;i:261;i:-2;i:271;i:1;i:272;i:1;i:273;i:1;i:274;i:1;i:275;i:-2;i:283;i:1;i:284;i:-2;i:292;i:1;i:293;i:1;i:294;i:1;i:295;i:1;i:296;i:-2;i:305;i:-1;i:306;i:-1;i:307;i:-1;i:308;i:-1;i:309;i:-1;i:310;i:-1;i:311;i:-1;i:319;i:-1;i:320;i:-1;i:357;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Cache/Interface.php";a:2:{i:33;i:1;i:74;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Configurable.php";a:179:{i:80;i:1;i:81;i:-1;i:83;i:-1;i:84;i:-1;i:85;i:-1;i:86;i:-1;i:87;i:-1;i:89;i:-1;i:91;i:1;i:92;i:-1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:-1;i:99;i:-2;i:100;i:1;i:101;i:-1;i:102;i:-2;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:-1;i:110;i:-2;i:111;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:-1;i:132;i:-2;i:133;i:1;i:134;i:1;i:135;i:-1;i:136;i:-1;i:137;i:-1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:-1;i:143;i:-1;i:144;i:-2;i:145;i:1;i:146;i:-1;i:147;i:-1;i:148;i:-1;i:150;i:1;i:152;i:1;i:156;i:-1;i:157;i:-1;i:158;i:-1;i:160;i:-1;i:161;i:-1;i:162;i:-2;i:164;i:-1;i:165;i:-2;i:169;i:-1;i:170;i:-2;i:174;i:-1;i:175;i:-1;i:176;i:-1;i:178;i:-1;i:180;i:-1;i:181;i:-2;i:185;i:-1;i:186;i:-1;i:187;i:-1;i:189;i:-1;i:190;i:-1;i:191;i:-1;i:192;i:-2;i:193;i:-1;i:194;i:-2;i:195;i:-1;i:196;i:-2;i:209;i:1;i:211;i:1;i:212;i:-2;i:222;i:1;i:223;i:1;i:224;i:1;i:225;i:-2;i:226;i:1;i:227;i:-2;i:228;i:1;i:229;i:-2;i:234;i:-1;i:235;i:-1;i:236;i:-1;i:237;i:-2;i:238;i:-1;i:239;i:-2;i:240;i:-1;i:241;i:-2;i:249;i:1;i:250;i:-2;i:260;i:1;i:261;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:267;i:1;i:268;i:-2;i:277;i:1;i:278;i:1;i:279;i:1;i:280;i:-2;i:281;i:-1;i:282;i:-2;i:283;i:1;i:284;i:-2;i:294;i:-1;i:295;i:-1;i:296;i:-1;i:297;i:-1;i:298;i:-2;i:299;i:-1;i:301;i:-1;i:302;i:-2;i:312;i:1;i:313;i:1;i:315;i:1;i:316;i:1;i:317;i:1;i:319;i:1;i:320;i:-2;i:329;i:1;i:330;i:1;i:331;i:1;i:332;i:-2;i:333;i:-1;i:334;i:-2;i:335;i:1;i:336;i:-2;i:346;i:1;i:347;i:1;i:348;i:1;i:349;i:-1;i:350;i:-2;i:351;i:1;i:353;i:1;i:354;i:-2;i:364;i:1;i:366;i:1;i:367;i:-1;i:368;i:-2;i:370;i:1;i:371;i:1;i:372;i:-2;i:374;i:1;i:375;i:1;i:376;i:-2;i:377;i:1;i:378;i:-2;i:388;i:-1;i:389;i:-2;i:400;i:1;i:401;i:1;i:411;i:1;i:412;i:-2;}s:63:"/home/bjartka/public_html/doctrine/models/BadlyNamed__Class.php";a:2:{i:5;i:1;i:6;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/mmrUser_C.php";a:7:{i:6;i:1;i:7;i:1;i:8;i:1;i:10;i:1;i:15;i:1;i:16;i:1;i:17;i:1;}s:51:"/home/bjartka/public_html/doctrine/models/Group.php";a:7:{i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/ForeignKeyTest.php";a:14:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:18;i:1;i:19;i:1;i:21;i:1;i:23;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/ZeroValueTest.php";a:11:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:18;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/Phonenumber.php";a:13:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:19;i:1;i:20;i:1;i:21;i:1;i:22;i:1;}s:66:"/home/bjartka/public_html/doctrine/models/MysqlIndexTestRecord.php";a:8:{i:6;i:1;i:7;i:1;i:8;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:14;i:1;i:16;i:1;}s:64:"/home/bjartka/public_html/doctrine/tests/TransactionTestCase.php";a:143:{i:37;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:-2;i:54;i:1;i:55;i:1;i:56;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:65;i:-2;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:98;i:-2;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:114;i:1;i:115;i:-1;i:116;i:1;i:117;i:1;i:119;i:1;i:124;i:1;i:126;i:1;i:127;i:-1;i:128;i:1;i:129;i:1;i:131;i:1;i:132;i:1;i:137;i:1;i:139;i:1;i:140;i:-1;i:141;i:1;i:142;i:1;i:144;i:1;i:145;i:1;i:150;i:1;i:151;i:-1;i:152;i:1;i:153;i:1;i:155;i:1;i:160;i:1;i:161;i:-1;i:162;i:1;i:163;i:1;i:165;i:1;i:169;i:1;i:170;i:1;i:174;i:1;i:175;i:1;i:179;i:1;i:180;i:1;i:184;i:1;i:185;i:1;i:189;i:1;i:191;i:1;i:192;i:1;i:196;i:1;i:198;i:1;i:199;i:1;i:202;i:1;i:205;i:1;i:208;i:1;i:209;i:1;i:210;i:1;i:213;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:218;i:1;i:219;i:1;i:220;i:-2;i:223;i:1;i:224;i:1;i:225;i:1;i:228;i:1;i:229;i:1;i:230;i:1;i:231;i:1;i:232;i:1;i:233;i:1;i:234;i:1;i:243;i:1;i:245;i:1;i:246;i:1;i:249;i:1;i:250;i:1;i:254;i:-1;i:256;i:-1;i:257;i:-1;i:260;i:-1;i:261;i:-1;i:265;i:1;i:267;i:1;i:268;i:1;i:271;i:1;i:272;i:1;i:277;i:1;i:279;i:1;i:280;i:1;i:283;i:1;i:284;i:1;i:288;i:1;i:290;i:1;i:291;i:1;i:294;i:1;i:295;i:1;i:299;i:1;i:301;i:1;i:302;i:1;i:306;i:1;i:307;i:1;i:311;i:1;i:312;i:-2;}s:59:"/home/bjartka/public_html/doctrine/tests/ExportTestCase.php";a:24:{i:38;i:1;i:40;i:-1;i:41;i:1;i:42;i:1;i:44;i:1;i:48;i:1;i:50;i:-1;i:51;i:1;i:52;i:1;i:54;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:83;i:1;i:87;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Import/OracleTestCase.php";a:36:{i:37;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:53;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:98;i:1;i:101;i:1;i:103;i:1;i:104;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Import/SqliteTestCase.php";a:13:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;}s:59:"/home/bjartka/public_html/doctrine/tests/AccessTestCase.php";a:51:{i:36;i:1;i:40;i:1;i:41;i:1;i:42;i:1;i:47;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:80;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:110;i:1;i:111;i:1;i:113;i:1;i:114;i:1;i:116;i:1;i:118;i:1;i:120;i:1;i:122;i:1;i:123;i:1;i:124;i:1;}s:72:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/ErrorStack.php";a:26:{i:34;i:1;i:52;i:1;i:53;i:1;i:63;i:1;i:64;i:1;i:73;i:-1;i:74;i:-1;i:75;i:-1;i:76;i:-1;i:86;i:1;i:87;i:-2;i:96;i:-1;i:97;i:-1;i:106;i:-1;i:107;i:-2;i:114;i:1;i:115;i:1;i:124;i:-1;i:125;i:-2;i:129;i:-1;i:130;i:-2;i:139;i:1;i:140;i:-2;i:147;i:-1;i:148;i:-2;i:150;i:1;}s:72:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hydrator/ArrayDriver.php";a:20:{i:35;i:1;i:38;i:1;i:39;i:-2;i:42;i:1;i:43;i:-2;i:46;i:-1;i:47;i:-2;i:51;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:-2;i:61;i:1;i:62;i:-2;i:65;i:1;i:66;i:1;i:67;i:-2;i:72;i:1;i:74;i:1;}s:55:"/home/bjartka/public_html/doctrine/lib/Doctrine/Lib.php";a:133:{i:34;i:1;i:43;i:1;i:44;i:-1;i:45;i:-2;i:46;i:1;i:47;i:-1;i:48;i:-2;i:49;i:1;i:50;i:-1;i:51;i:-2;i:52;i:1;i:53;i:-1;i:54;i:-2;i:55;i:1;i:56;i:1;i:57;i:-2;i:58;i:-2;i:59;i:-1;i:68;i:-1;i:69;i:-1;i:70;i:-1;i:71;i:-1;i:72;i:-1;i:73;i:-1;i:74;i:-1;i:75;i:-1;i:76;i:-1;i:77;i:-2;i:90;i:-1;i:91;i:-1;i:92;i:-1;i:93;i:-1;i:94;i:-1;i:95;i:-1;i:96;i:-1;i:97;i:-1;i:99;i:-1;i:100;i:-1;i:101;i:-1;i:102;i:-1;i:103;i:-1;i:105;i:-1;i:106;i:-1;i:107;i:-1;i:108;i:-1;i:109;i:-2;i:112;i:-1;i:113;i:-2;i:132;i:-1;i:133;i:-1;i:134;i:-1;i:135;i:-1;i:136;i:-1;i:137;i:-1;i:139;i:-1;i:140;i:-1;i:141;i:-1;i:142;i:-1;i:143;i:-1;i:144;i:-1;i:145;i:-1;i:146;i:-1;i:147;i:-1;i:148;i:-1;i:150;i:-1;i:151;i:-1;i:152;i:-1;i:153;i:-1;i:154;i:-2;i:155;i:-1;i:156;i:-1;i:157;i:-1;i:158;i:-1;i:159;i:-1;i:160;i:-1;i:161;i:-1;i:162;i:-1;i:163;i:-1;i:165;i:-1;i:166;i:-1;i:167;i:-1;i:168;i:-2;i:179;i:1;i:180;i:1;i:181;i:-2;i:182;i:-1;i:183;i:-1;i:184;i:-2;i:185;i:-1;i:186;i:-1;i:187;i:-2;i:188;i:-2;i:189;i:-1;i:198;i:-1;i:199;i:-1;i:200;i:-1;i:201;i:-1;i:202;i:-1;i:203;i:-1;i:205;i:-1;i:206;i:-1;i:207;i:-2;i:216;i:-1;i:217;i:-1;i:218;i:-1;i:219;i:-1;i:220;i:-1;i:221;i:-2;i:232;i:-1;i:233;i:-1;i:234;i:-1;i:235;i:-1;i:236;i:-1;i:237;i:-1;i:238;i:-1;i:239;i:-1;i:240;i:-1;i:241;i:-1;i:242;i:-1;i:243;i:-1;i:244;i:-1;i:245;i:-1;i:246;i:-1;i:247;i:-1;i:249;i:-1;i:250;i:-2;i:259;i:-1;i:260;i:-1;i:261;i:-1;i:264;i:-1;i:265;i:-1;i:266;i:-2;i:268;i:1;}s:61:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Set.php";a:19:{i:21;i:1;i:33;i:1;i:37;i:1;i:39;i:1;i:41;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:-2;i:60;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Past.php";a:32:{i:34;i:1;i:43;i:1;i:44;i:1;i:45;i:-2;i:46;i:1;i:48;i:1;i:49;i:-1;i:50;i:-2;i:52;i:1;i:53;i:-1;i:54;i:-1;i:55;i:-1;i:56;i:-1;i:57;i:-1;i:58;i:-1;i:59;i:-1;i:60;i:-1;i:61;i:-1;i:62;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:-2;i:73;i:-1;i:75;i:-2;i:76;i:1;i:78;i:-2;i:79;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Expression/Mysql.php";a:34:{i:21;i:1;i:33;i:1;i:42;i:-1;i:43;i:-2;i:52;i:-1;i:53;i:-2;i:74;i:-1;i:75;i:-1;i:76;i:-1;i:77;i:-1;i:80;i:-1;i:81;i:-1;i:82;i:-1;i:84;i:-1;i:85;i:-1;i:86;i:-1;i:87;i:-1;i:88;i:-1;i:89;i:-1;i:90;i:-1;i:91;i:-1;i:92;i:-1;i:93;i:-1;i:94;i:-1;i:95;i:-1;i:96;i:-1;i:98;i:-1;i:99;i:-1;i:100;i:-1;i:101;i:-1;i:102;i:-2;i:111;i:-1;i:112;i:-2;i:113;i:1;}s:63:"/home/bjartka/public_html/doctrine/lib/Doctrine/Search/File.php";a:23:{i:33;i:1;i:37;i:1;i:39;i:1;i:40;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:56;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:-2;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:69;i:1;}s:58:"/home/bjartka/public_html/doctrine/lib/Doctrine/Parser.php";a:26:{i:34;i:1;i:69;i:1;i:71;i:1;i:72;i:-2;i:86;i:1;i:88;i:1;i:89;i:-2;i:104;i:1;i:106;i:1;i:107;i:-2;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:131;i:1;i:132;i:-2;i:143;i:1;i:144;i:1;i:145;i:-2;i:146;i:1;i:148;i:-2;i:149;i:1;}s:49:"/home/bjartka/public_html/doctrine/tests/test.yml";a:1:{i:6;i:1;}s:58:"/home/bjartka/public_html/doctrine/lib/Doctrine/Access.php";a:25:{i:0;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:-2;i:65;i:1;i:66;i:1;i:78;i:1;i:79;i:-2;i:90;i:1;i:91;i:-2;i:102;i:-1;i:103;i:-2;i:113;i:1;i:114;i:-2;i:125;i:1;i:126;i:-2;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:142;i:1;i:151;i:1;i:152;i:-2;}s:54:"/home/bjartka/public_html/doctrine/models/Bookmark.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/BarRecord.php";a:5:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:12;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Hydrate/FetchModeTestCase.php";a:83:{i:38;i:1;i:40;i:1;i:42;i:1;i:44;i:1;i:46;i:1;i:47;i:1;i:50;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:62;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:75;i:1;i:77;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:86;i:1;i:88;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:112;i:1;i:113;i:1;i:115;i:1;i:116;i:1;i:120;i:1;i:122;i:1;i:123;i:1;i:124;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:132;i:1;i:133;i:1;i:137;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:148;i:1;i:149;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/Validator/PastTestCase.php";a:25:{i:37;i:1;i:38;i:1;i:39;i:1;i:44;i:1;i:48;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;}s:63:"/home/bjartka/public_html/doctrine/tests/Query/JoinTestCase.php";a:98:{i:37;i:1;i:38;i:1;i:40;i:1;i:41;i:1;i:44;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:78;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:114;i:1;i:116;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:129;i:1;i:131;i:1;i:133;i:1;i:134;i:1;i:138;i:1;i:140;i:1;i:142;i:1;i:143;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:151;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:-2;i:158;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:166;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:-2;i:173;i:1;i:177;i:1;i:178;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:187;i:1;i:188;i:1;i:189;i:1;i:191;i:1;i:192;i:1;i:193;i:1;i:194;i:1;i:199;i:1;i:200;i:1;i:202;i:-1;i:203;i:1;i:204;i:1;i:206;i:1;}s:60:"/home/bjartka/public_html/doctrine/tests/NewCoreTestCase.php";a:7:{i:37;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:44;i:1;i:46;i:1;i:47;i:1;}s:64:"/home/bjartka/public_html/doctrine/tests/Search/FileTestCase.php";a:9:{i:36;i:1;i:38;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:54;i:1;}s:59:"/home/bjartka/public_html/doctrine/tests/ParserTestCase.php";a:28:{i:37;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:42;i:-1;i:44;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:56;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:80;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:93;i:1;i:95;i:1;i:97;i:1;i:98;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/DoctrineTest/Reporter/Cli.php";a:14:{i:5;i:1;i:6;i:1;i:7;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:21;i:1;i:22;i:-2;}s:58:"/home/bjartka/public_html/doctrine/lib/Doctrine/Export.php";a:366:{i:21;i:1;i:34;i:1;i:59;i:1;i:60;i:1;i:71;i:-1;i:72;i:-2;i:83;i:1;i:84;i:-2;i:95;i:1;i:96;i:1;i:107;i:1;i:108;i:-2;i:119;i:1;i:121;i:1;i:122;i:-2;i:134;i:1;i:135;i:1;i:137;i:1;i:138;i:-2;i:149;i:-1;i:150;i:-2;i:163;i:1;i:164;i:1;i:176;i:-1;i:177;i:-2;i:188;i:1;i:189;i:1;i:200;i:1;i:201;i:-2;i:233;i:1;i:234;i:-1;i:235;i:-2;i:237;i:1;i:238;i:-1;i:239;i:-2;i:241;i:1;i:244;i:1;i:245;i:1;i:246;i:1;i:248;i:1;i:249;i:1;i:250;i:1;i:251;i:1;i:252;i:1;i:254;i:1;i:256;i:1;i:258;i:1;i:259;i:-1;i:260;i:-1;i:262;i:1;i:266;i:1;i:268;i:1;i:270;i:1;i:271;i:-1;i:272;i:-1;i:273;i:-1;i:274;i:-1;i:275;i:1;i:276;i:1;i:277;i:-2;i:291;i:1;i:293;i:1;i:294;i:1;i:295;i:1;i:296;i:1;i:314;i:1;i:315;i:-2;i:334;i:-1;i:335;i:-2;i:360;i:-1;i:362;i:-1;i:363;i:-2;i:388;i:1;i:389;i:1;i:390;i:1;i:392;i:1;i:393;i:1;i:394;i:1;i:395;i:-1;i:396;i:-1;i:398;i:1;i:399;i:1;i:400;i:1;i:401;i:1;i:402;i:1;i:404;i:1;i:405;i:-2;i:440;i:1;i:441;i:-2;i:454;i:-1;i:455;i:-1;i:456;i:-1;i:458;i:-1;i:459;i:-1;i:460;i:-1;i:461;i:-1;i:462;i:-1;i:463;i:-1;i:464;i:-1;i:465;i:-1;i:466;i:-1;i:468;i:-1;i:470;i:-1;i:471;i:-1;i:472;i:-1;i:473;i:-1;i:474;i:-1;i:476;i:-1;i:477;i:-2;i:487;i:1;i:489;i:1;i:491;i:1;i:492;i:-2;i:503;i:-1;i:505;i:-1;i:506;i:-2;i:599;i:1;i:601;i:1;i:602;i:1;i:603;i:1;i:604;i:1;i:620;i:-1;i:621;i:-2;i:654;i:1;i:655;i:1;i:657;i:1;i:658;i:1;i:659;i:1;i:660;i:-2;i:697;i:1;i:699;i:1;i:700;i:1;i:702;i:1;i:703;i:1;i:705;i:1;i:707;i:1;i:708;i:1;i:710;i:1;i:711;i:1;i:713;i:1;i:715;i:1;i:716;i:1;i:717;i:-2;i:718;i:1;i:720;i:1;i:721;i:-2;i:733;i:1;i:734;i:1;i:735;i:1;i:736;i:-1;i:737;i:-1;i:739;i:-1;i:740;i:-1;i:741;i:-1;i:742;i:-1;i:743;i:-1;i:745;i:1;i:746;i:1;i:747;i:1;i:748;i:1;i:749;i:1;i:750;i:1;i:751;i:-2;i:762;i:1;i:763;i:1;i:764;i:1;i:765;i:-1;i:766;i:-1;i:767;i:1;i:768;i:-1;i:769;i:-1;i:771;i:1;i:772;i:-1;i:773;i:-1;i:775;i:1;i:777;i:1;i:778;i:-2;i:790;i:1;i:791;i:1;i:793;i:1;i:794;i:-1;i:795;i:-1;i:796;i:-1;i:797;i:-1;i:799;i:-1;i:801;i:1;i:802;i:-1;i:803;i:-2;i:805;i:1;i:807;i:1;i:809;i:1;i:810;i:-2;i:821;i:1;i:822;i:1;i:823;i:1;i:824;i:-1;i:825;i:-1;i:826;i:1;i:828;i:1;i:829;i:1;i:830;i:-2;i:848;i:-1;i:849;i:-2;i:895;i:1;i:896;i:1;i:898;i:1;i:899;i:-2;i:911;i:-1;i:912;i:-1;i:913;i:-1;i:914;i:-1;i:915;i:-1;i:916;i:-1;i:917;i:-1;i:918;i:-1;i:919;i:-2;i:933;i:1;i:935;i:1;i:936;i:1;i:937;i:1;i:938;i:1;i:939;i:1;i:940;i:1;i:941;i:-2;i:942;i:-1;i:943;i:-1;i:944;i:-1;i:945;i:-2;i:957;i:1;i:958;i:1;i:959;i:-1;i:960;i:-1;i:961;i:1;i:963;i:1;i:964;i:-1;i:965;i:-2;i:966;i:1;i:967;i:-1;i:968;i:-2;i:969;i:1;i:970;i:-1;i:971;i:-2;i:973;i:1;i:974;i:1;i:975;i:1;i:976;i:1;i:977;i:1;i:978;i:1;i:980;i:1;i:982;i:1;i:983;i:1;i:985;i:1;i:986;i:-2;i:997;i:1;i:998;i:-2;i:1010;i:-1;i:1011;i:-2;i:1023;i:-1;i:1024;i:-2;i:1043;i:1;i:1044;i:1;i:1045;i:1;i:1046;i:-1;i:1049;i:1;i:1050;i:1;i:1063;i:1;i:1064;i:1;i:1065;i:1;i:1066;i:1;i:1067;i:1;i:1069;i:1;i:1070;i:1;i:1071;i:1;i:1072;i:1;i:1073;i:1;i:1075;i:1;i:1078;i:1;i:1079;i:1;i:1080;i:1;i:1082;i:1;i:1083;i:1;i:1084;i:1;i:1086;i:1;i:1087;i:1;i:1090;i:1;i:1091;i:1;i:1092;i:1;i:1093;i:1;i:1095;i:1;i:1096;i:1;i:1098;i:1;i:1100;i:1;i:1102;i:1;i:1103;i:1;i:1105;i:1;i:1106;i:-2;i:1107;i:-2;i:1108;i:-2;i:1110;i:1;i:1112;i:1;i:1113;i:1;i:1114;i:1;i:1127;i:1;i:1129;i:1;i:1131;i:1;i:1132;i:1;i:1133;i:1;i:1135;i:1;i:1137;i:1;i:1138;i:1;i:1140;i:1;i:1142;i:1;i:1143;i:1;i:1145;i:1;i:1147;i:1;i:1149;i:1;i:1150;i:1;i:1151;i:1;i:1152;i:-1;i:1155;i:1;i:1156;i:1;i:1157;i:1;i:1158;i:1;i:1160;i:1;i:1162;i:1;i:1164;i:1;i:1165;i:-2;i:1175;i:1;i:1177;i:1;i:1178;i:1;i:1180;i:1;i:1181;i:1;i:1182;i:-2;i:1184;i:1;i:1186;i:1;i:1188;i:1;i:1189;i:1;i:1190;i:1;i:1191;i:1;i:1193;i:1;i:1194;i:-2;i:1205;i:1;i:1207;i:1;i:1208;i:1;i:1211;i:1;i:1212;i:1;i:1214;i:1;i:1216;i:1;i:1217;i:1;i:1218;i:1;i:1220;i:1;i:1221;i:-2;i:1240;i:-1;i:1241;i:-1;i:1242;i:-1;i:1243;i:-1;i:1246;i:-1;i:1247;i:-2;i:1268;i:-1;i:1270;i:-1;i:1271;i:-1;i:1273;i:-2;i:1274;i:-2;i:1275;i:-2;i:1277;i:-1;i:1279;i:1;}s:63:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction.php";a:141:{i:21;i:1;i:35;i:1;i:86;i:1;i:88;i:1;i:89;i:-2;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:-2;i:104;i:1;i:105;i:1;i:106;i:-2;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:-2;i:122;i:1;i:123;i:1;i:124;i:-2;i:125;i:1;i:126;i:1;i:127;i:-2;i:136;i:1;i:137;i:-2;i:147;i:1;i:148;i:-2;i:158;i:1;i:160;i:1;i:161;i:-2;i:178;i:1;i:180;i:1;i:182;i:1;i:183;i:1;i:185;i:1;i:187;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:193;i:1;i:194;i:1;i:195;i:1;i:196;i:1;i:198;i:1;i:200;i:1;i:202;i:1;i:203;i:1;i:204;i:-2;i:206;i:1;i:207;i:1;i:208;i:1;i:211;i:1;i:213;i:1;i:214;i:-2;i:231;i:1;i:233;i:1;i:234;i:1;i:235;i:-2;i:237;i:1;i:239;i:1;i:240;i:1;i:242;i:1;i:244;i:1;i:246;i:1;i:247;i:1;i:248;i:1;i:250;i:1;i:251;i:1;i:252;i:1;i:253;i:1;i:254;i:1;i:255;i:1;i:256;i:1;i:257;i:1;i:258;i:-2;i:260;i:1;i:261;i:1;i:262;i:1;i:263;i:1;i:265;i:1;i:267;i:1;i:268;i:1;i:269;i:1;i:270;i:1;i:271;i:1;i:273;i:1;i:275;i:1;i:278;i:1;i:279;i:-2;i:303;i:1;i:304;i:1;i:306;i:1;i:307;i:1;i:308;i:-2;i:310;i:1;i:312;i:1;i:313;i:1;i:315;i:1;i:317;i:1;i:319;i:1;i:320;i:1;i:321;i:1;i:323;i:1;i:324;i:1;i:325;i:1;i:327;i:1;i:329;i:1;i:330;i:1;i:332;i:1;i:333;i:1;i:334;i:-2;i:336;i:1;i:338;i:1;i:341;i:1;i:342;i:-2;i:353;i:1;i:354;i:-2;i:365;i:1;i:366;i:-2;i:377;i:1;i:378;i:-2;i:390;i:1;i:392;i:1;i:393;i:1;i:395;i:1;i:396;i:1;i:397;i:1;i:398;i:1;i:399;i:1;i:400;i:1;i:401;i:1;i:402;i:1;i:403;i:1;i:404;i:1;i:405;i:1;i:407;i:1;i:408;i:-2;i:434;i:1;i:435;i:-2;i:451;i:1;i:452;i:-2;i:454;i:1;}s:81:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Firebird/Exception.php";a:14:{i:21;i:1;i:35;i:1;i:125;i:-1;i:126;i:-1;i:127;i:-1;i:128;i:-1;i:129;i:-2;i:130;i:-1;i:131;i:-1;i:132;i:-1;i:133;i:-1;i:134;i:-1;i:135;i:-2;i:136;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Import/Oracle.php";a:63:{i:21;i:1;i:31;i:1;i:40;i:1;i:41;i:-1;i:42;i:-2;i:51;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:57;i:-2;i:66;i:1;i:68;i:1;i:69;i:-2;i:80;i:-1;i:90;i:1;i:92;i:1;i:94;i:1;i:95;i:-2;i:105;i:1;i:108;i:1;i:110;i:1;i:112;i:1;i:113;i:-2;i:123;i:1;i:125;i:1;i:127;i:1;i:129;i:1;i:131;i:1;i:132;i:-1;i:133;i:-1;i:136;i:-1;i:137;i:-1;i:138;i:-1;i:139;i:-1;i:140;i:-1;i:141;i:-1;i:142;i:-1;i:143;i:-1;i:144;i:-1;i:145;i:-1;i:146;i:-1;i:147;i:-1;i:149;i:-1;i:151;i:1;i:152;i:-2;i:162;i:1;i:164;i:1;i:165;i:1;i:167;i:1;i:169;i:1;i:170;i:-2;i:180;i:1;i:181;i:1;i:182;i:-2;i:193;i:-1;i:204;i:-1;i:222;i:1;i:225;i:1;i:226;i:-2;i:236;i:1;i:237;i:1;i:238;i:-2;i:240;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Import/Sqlite.php";a:87:{i:21;i:1;i:32;i:1;i:42;i:-1;i:52;i:-1;i:63;i:-1;i:73;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:78;i:-1;i:79;i:-1;i:80;i:-1;i:81;i:-1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:-2;i:96;i:-1;i:98;i:-1;i:100;i:-1;i:101;i:-1;i:102;i:-1;i:103;i:-1;i:105;i:-1;i:106;i:-1;i:108;i:-1;i:109;i:-1;i:110;i:-1;i:111;i:-1;i:112;i:-1;i:113;i:-1;i:114;i:-1;i:115;i:-1;i:116;i:-1;i:118;i:-1;i:119;i:-1;i:120;i:-1;i:121;i:-1;i:122;i:-2;i:132;i:1;i:133;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:138;i:-1;i:139;i:-1;i:142;i:-1;i:143;i:-1;i:144;i:-1;i:145;i:-1;i:146;i:-1;i:147;i:-1;i:148;i:-1;i:149;i:-1;i:150;i:-1;i:151;i:-1;i:152;i:-1;i:153;i:-1;i:154;i:-1;i:155;i:-1;i:156;i:1;i:157;i:-2;i:167;i:1;i:168;i:1;i:169;i:-2;i:180;i:1;i:182;i:1;i:183;i:-2;i:194;i:-1;i:204;i:-1;i:205;i:-1;i:207;i:-1;i:208;i:-1;i:209;i:-1;i:210;i:-1;i:211;i:-1;i:212;i:-1;i:213;i:-1;i:214;i:-1;i:215;i:-1;i:216;i:-2;i:226;i:-1;i:236;i:-1;i:238;i:-1;i:239;i:-2;i:240;i:1;}s:71:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hook/Parser/Complex.php";a:27:{i:21;i:1;i:33;i:1;i:42;i:1;i:43;i:1;i:59;i:1;i:60;i:1;i:72;i:1;i:74;i:1;i:75;i:-1;i:76;i:-1;i:77;i:-1;i:78;i:-1;i:80;i:-1;i:81;i:-1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:95;i:1;i:96;i:-2;i:107;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Expression/Pgsql.php";a:59:{i:21;i:1;i:33;i:1;i:55;i:-1;i:57;i:-1;i:58;i:-1;i:59;i:-2;i:60;i:-1;i:62;i:-2;i:76;i:-1;i:78;i:-1;i:79;i:-1;i:80;i:-1;i:81;i:-2;i:82;i:-1;i:84;i:-2;i:105;i:-1;i:106;i:-1;i:107;i:-2;i:108;i:-1;i:109;i:-2;i:119;i:-1;i:120;i:-2;i:131;i:-1;i:132;i:-2;i:142;i:-1;i:144;i:-1;i:145;i:-2;i:154;i:-1;i:155;i:-2;i:164;i:-1;i:165;i:-2;i:175;i:-1;i:176;i:-2;i:197;i:-1;i:198;i:-1;i:199;i:-1;i:200;i:-1;i:203;i:-1;i:204;i:-1;i:205;i:-1;i:207;i:-1;i:208;i:-1;i:209;i:-1;i:210;i:-1;i:211;i:-1;i:212;i:-1;i:213;i:-1;i:214;i:-1;i:215;i:-1;i:216;i:-1;i:217;i:-1;i:218;i:-1;i:219;i:-1;i:221;i:-1;i:222;i:-1;i:223;i:-1;i:224;i:-1;i:225;i:-2;i:226;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/MyUserOneThing.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/Location.php";a:5:{i:6;i:1;i:7;i:1;i:8;i:1;i:12;i:1;i:13;i:1;}s:65:"/home/bjartka/public_html/doctrine/models/PluginSymfonyRecord.php";a:4:{i:8;i:1;i:9;i:1;i:13;i:1;i:14;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/InheritanceUser.php";a:6:{i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:14;i:1;i:15;i:1;}s:62:"/home/bjartka/public_html/doctrine/models/MyUserOtherThing.php";a:3:{i:4;i:-1;i:5;i:-1;i:6;i:-1;}s:63:"/home/bjartka/public_html/doctrine/models/CascadeDeleteTest.php";a:6:{i:6;i:-1;i:7;i:-1;i:10;i:-1;i:11;i:-1;i:12;i:-1;i:13;i:-1;}s:68:"/home/bjartka/public_html/doctrine/tests/Sequence/OracleTestCase.php";a:10:{i:37;i:1;i:38;i:1;i:40;i:1;i:41;i:1;i:44;i:1;i:46;i:1;i:48;i:1;i:51;i:1;i:53;i:1;i:54;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/Sequence/SqliteTestCase.php";a:14:{i:37;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Export/RecordTestCase.php";a:40:{i:36;i:-1;i:38;i:-1;i:40;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:-1;i:58;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:-1;i:84;i:1;i:88;i:1;i:90;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;}s:61:"/home/bjartka/public_html/doctrine/tests/RelationTestCase.php";a:71:{i:36;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:74;i:1;i:76;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:87;i:1;i:89;i:1;i:91;i:1;i:93;i:1;i:95;i:1;i:97;i:1;i:99;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:111;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:119;i:-2;i:121;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:128;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:-2;i:136;i:1;i:137;i:1;i:139;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:-2;i:149;i:1;i:150;i:1;i:152;i:1;i:154;i:1;i:155;i:1;i:157;i:1;i:159;i:1;i:160;i:1;i:162;i:1;i:164;i:1;i:165;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Abstract.php";a:501:{i:247;i:1;i:248;i:1;i:249;i:1;i:250;i:1;i:251;i:1;i:252;i:1;i:253;i:1;i:254;i:1;i:255;i:1;i:256;i:1;i:267;i:-1;i:268;i:-1;i:269;i:-2;i:270;i:-1;i:271;i:-1;i:283;i:-1;i:284;i:-2;i:295;i:1;i:296;i:-2;i:307;i:-1;i:308;i:-2;i:318;i:1;i:319;i:-2;i:333;i:1;i:334;i:-2;i:347;i:1;i:348;i:-1;i:349;i:-2;i:350;i:1;i:351;i:-2;i:365;i:-1;i:366;i:-2;i:379;i:1;i:380;i:-1;i:381;i:-2;i:383;i:1;i:384;i:-1;i:385;i:-1;i:386;i:-1;i:387;i:-1;i:389;i:-1;i:390;i:1;i:393;i:1;i:394;i:-2;i:408;i:-1;i:409;i:-2;i:422;i:1;i:423;i:-1;i:424;i:-2;i:425;i:1;i:426;i:1;i:427;i:1;i:428;i:1;i:430;i:1;i:431;i:-2;i:444;i:-1;i:445;i:-2;i:458;i:1;i:459;i:-1;i:460;i:-2;i:461;i:1;i:463;i:1;i:464;i:1;i:465;i:1;i:466;i:1;i:468;i:1;i:469;i:-2;i:481;i:1;i:482;i:1;i:492;i:1;i:493;i:-2;i:502;i:1;i:503;i:-2;i:513;i:1;i:514;i:1;i:515;i:1;i:516;i:1;i:517;i:1;i:518;i:1;i:519;i:1;i:520;i:1;i:521;i:-2;i:532;i:1;i:534;i:1;i:535;i:1;i:536;i:1;i:537;i:1;i:540;i:1;i:541;i:1;i:543;i:1;i:544;i:1;i:545;i:1;i:548;i:1;i:549;i:1;i:550;i:1;i:551;i:1;i:554;i:1;i:555;i:1;i:556;i:1;i:557;i:1;i:559;i:1;i:560;i:1;i:561;i:1;i:562;i:1;i:563;i:1;i:565;i:1;i:567;i:1;i:568;i:1;i:569;i:1;i:570;i:1;i:572;i:1;i:573;i:1;i:574;i:1;i:575;i:1;i:576;i:1;i:578;i:1;i:580;i:1;i:581;i:-2;i:598;i:1;i:599;i:-2;i:615;i:1;i:617;i:1;i:618;i:1;i:619;i:-2;i:621;i:1;i:622;i:-1;i:623;i:-2;i:625;i:1;i:626;i:-2;i:638;i:1;i:639;i:-2;i:650;i:1;i:652;i:1;i:653;i:1;i:655;i:1;i:656;i:1;i:657;i:1;i:659;i:1;i:661;i:1;i:662;i:-2;i:664;i:-1;i:665;i:-2;i:677;i:-1;i:678;i:-2;i:689;i:-1;i:690;i:-1;i:691;i:-2;i:692;i:-1;i:693;i:-2;i:704;i:-1;i:705;i:-2;i:717;i:1;i:718;i:-2;i:729;i:1;i:730;i:-1;i:731;i:-2;i:733;i:1;i:734;i:-2;i:749;i:1;i:750;i:1;i:751;i:1;i:752;i:1;i:753;i:-2;i:763;i:1;i:764;i:-1;i:765;i:-1;i:766;i:1;i:768;i:1;i:769;i:-2;i:779;i:1;i:780;i:1;i:781;i:-2;i:791;i:-1;i:793;i:-1;i:794;i:-1;i:795;i:-2;i:797;i:-1;i:798;i:-2;i:812;i:1;i:813;i:-2;i:826;i:1;i:828;i:1;i:830;i:1;i:831;i:1;i:832;i:1;i:834;i:1;i:835;i:1;i:836;i:-1;i:837;i:-1;i:838;i:1;i:839;i:1;i:841;i:1;i:843;i:1;i:844;i:-2;i:855;i:1;i:856;i:-1;i:857;i:-2;i:858;i:1;i:859;i:-2;i:869;i:1;i:871;i:1;i:872;i:1;i:873;i:1;i:875;i:1;i:876;i:1;i:877;i:1;i:878;i:1;i:879;i:1;i:880;i:1;i:881;i:1;i:882;i:1;i:883;i:1;i:885;i:1;i:886;i:1;i:888;i:1;i:889;i:1;i:892;i:1;i:894;i:1;i:895;i:1;i:896;i:1;i:897;i:1;i:899;i:1;i:900;i:1;i:901;i:-2;i:903;i:1;i:904;i:1;i:905;i:-2;i:916;i:1;i:917;i:1;i:918;i:1;i:919;i:1;i:921;i:1;i:922;i:1;i:924;i:1;i:926;i:1;i:928;i:1;i:930;i:1;i:932;i:1;i:933;i:1;i:934;i:1;i:935;i:1;i:937;i:1;i:938;i:1;i:939;i:1;i:940;i:-2;i:941;i:1;i:943;i:-2;i:944;i:1;i:946;i:1;i:947;i:1;i:948;i:-2;i:950;i:1;i:951;i:1;i:953;i:-2;i:965;i:1;i:966;i:1;i:967;i:1;i:969;i:1;i:970;i:1;i:971;i:1;i:972;i:1;i:973;i:1;i:974;i:1;i:975;i:1;i:976;i:1;i:977;i:1;i:978;i:1;i:980;i:1;i:981;i:-1;i:982;i:-1;i:983;i:1;i:984;i:-1;i:985;i:-1;i:986;i:1;i:987;i:1;i:989;i:1;i:990;i:-2;i:1001;i:1;i:1003;i:1;i:1004;i:1;i:1005;i:1;i:1006;i:1;i:1007;i:1;i:1009;i:1;i:1010;i:-1;i:1011;i:-1;i:1012;i:1;i:1013;i:-1;i:1014;i:-1;i:1015;i:1;i:1017;i:1;i:1018;i:-2;i:1029;i:1;i:1030;i:-2;i:1043;i:-1;i:1044;i:-2;i:1056;i:1;i:1057;i:1;i:1058;i:-2;i:1069;i:-1;i:1070;i:-2;i:1082;i:1;i:1083;i:1;i:1084;i:1;i:1085;i:1;i:1087;i:1;i:1088;i:-2;i:1101;i:1;i:1102;i:1;i:1103;i:1;i:1104;i:1;i:1105;i:-1;i:1106;i:-1;i:1107;i:-1;i:1108;i:1;i:1110;i:1;i:1111;i:1;i:1113;i:1;i:1115;i:1;i:1117;i:1;i:1118;i:-2;i:1130;i:-1;i:1131;i:-2;i:1142;i:-1;i:1143;i:-2;i:1155;i:-1;i:1156;i:-1;i:1157;i:-1;i:1158;i:-1;i:1160;i:-1;i:1161;i:-2;i:1172;i:1;i:1173;i:-2;i:1184;i:1;i:1185;i:-2;i:1196;i:-1;i:1197;i:-1;i:1198;i:-2;i:1209;i:-1;i:1210;i:-1;i:1211;i:-2;i:1221;i:1;i:1222;i:1;i:1223;i:-2;i:1234;i:1;i:1235;i:1;i:1236;i:-2;i:1247;i:1;i:1248;i:-1;i:1249;i:-1;i:1250;i:-1;i:1251;i:-1;i:1252;i:-2;i:1253;i:1;i:1254;i:1;i:1255;i:1;i:1256;i:1;i:1257;i:-1;i:1259;i:1;i:1260;i:1;i:1262;i:-2;i:1273;i:1;i:1274;i:-2;i:1285;i:1;i:1286;i:-2;i:1297;i:1;i:1298;i:-2;i:1309;i:1;i:1310;i:-2;i:1322;i:1;i:1323;i:1;i:1324;i:1;i:1325;i:1;i:1326;i:1;i:1329;i:1;i:1330;i:-2;i:1342;i:1;i:1343;i:1;i:1344;i:1;i:1345;i:1;i:1346;i:-1;i:1349;i:1;i:1350;i:-2;i:1361;i:1;i:1362;i:-2;i:1373;i:1;i:1374;i:-2;i:1385;i:1;i:1386;i:-2;i:1396;i:1;i:1397;i:-2;i:1407;i:-1;i:1408;i:1;i:1409;i:1;i:1410;i:1;i:1411;i:1;i:1412;i:1;i:1413;i:1;i:1414;i:1;i:1415;i:1;i:1416;i:1;i:1417;i:1;i:1418;i:1;i:1419;i:1;i:1421;i:1;i:1425;i:1;i:1426;i:1;i:1427;i:-2;i:1434;i:1;i:1435;i:-2;i:1442;i:1;i:1443;i:-2;i:1453;i:1;i:1454;i:-2;i:1463;i:1;i:1464;i:-2;i:1482;i:1;i:1483;i:-2;i:1495;i:1;i:1496;i:-2;i:1507;i:1;i:1508;i:-1;i:1509;i:-1;i:1510;i:-2;i:1511;i:1;i:1513;i:1;i:1514;i:-2;i:1525;i:1;i:1526;i:1;i:1527;i:-2;i:1538;i:-1;i:1539;i:-2;i:1549;i:-1;i:1550;i:-1;i:1551;i:-2;i:1561;i:-1;i:1562;i:-1;i:1563;i:-2;i:1574;i:-1;i:1575;i:-2;i:1585;i:1;i:1586;i:-1;i:1587;i:-1;i:1588;i:1;i:1590;i:1;i:1591;i:-2;i:1601;i:1;i:1602;i:-1;i:1603;i:-1;i:1604;i:1;i:1606;i:1;i:1607;i:-2;i:1618;i:-1;i:1619;i:-2;i:1629;i:1;i:1630;i:1;i:1631;i:-2;i:1632;i:1;i:1634;i:-2;i:1644;i:1;i:1645;i:1;i:1646;i:-2;i:1647;i:1;i:1649;i:-2;i:1658;i:1;i:1659;i:-2;i:1672;i:1;i:1673;i:1;i:1674;i:1;i:1675;i:1;i:1678;i:1;i:1679;i:1;i:1680;i:-2;i:1694;i:1;i:1696;i:1;i:1697;i:1;i:1698;i:1;i:1699;i:1;i:1700;i:1;i:1701;i:1;i:1702;i:1;i:1703;i:1;i:1704;i:1;i:1706;i:1;i:1707;i:1;i:1708;i:1;i:1709;i:1;i:1721;i:1;i:1722;i:1;i:1724;i:1;i:1726;i:1;i:1727;i:-1;i:1728;i:-2;i:1730;i:1;i:1731;i:1;i:1733;i:1;i:1734;i:-2;i:1759;i:1;i:1760;i:-2;i:1767;i:1;i:1768;i:-2;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Relation/Nest.php";a:60:{i:21;i:1;i:33;i:1;i:44;i:-1;i:45;i:-1;i:46;i:-1;i:47;i:-1;i:48;i:-1;i:50;i:-1;i:51;i:-1;i:52;i:-1;i:53;i:-1;i:55;i:-1;i:56;i:-1;i:57;i:-1;i:58;i:-1;i:59;i:-1;i:60;i:-1;i:61;i:-1;i:62;i:-1;i:63;i:-1;i:64;i:-1;i:65;i:-1;i:66;i:-1;i:67;i:-1;i:68;i:-1;i:69;i:-1;i:70;i:-1;i:72;i:-1;i:73;i:-2;i:103;i:1;i:106;i:1;i:107;i:1;i:108;i:-2;i:109;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:120;i:1;i:121;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:138;i:1;i:140;i:1;i:142;i:-2;i:143;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Date.php";a:11:{i:34;i:1;i:43;i:1;i:44;i:-1;i:45;i:-2;i:46;i:1;i:48;i:1;i:49;i:-1;i:50;i:-2;i:51;i:1;i:52;i:-2;i:53;i:1;}s:58:"/home/bjartka/public_html/doctrine/models/ResourceType.php";a:4:{i:4;i:1;i:5;i:1;i:7;i:1;i:8;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/SequenceRecord.php";a:3:{i:5;i:1;i:6;i:1;i:7;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/GzipTest.php";a:2:{i:4;i:1;i:5;i:1;}s:70:"/home/bjartka/public_html/doctrine/models/CascadeDeleteRelatedTest.php";a:11:{i:6;i:-1;i:7;i:-1;i:8;i:-1;i:11;i:-1;i:12;i:-1;i:13;i:-1;i:14;i:-1;i:16;i:-1;i:17;i:-1;i:18;i:-1;i:19;i:-1;}s:49:"/home/bjartka/public_html/doctrine/models/Tag.php";a:4:{i:4;i:1;i:5;i:1;i:7;i:1;i:8;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/BooleanTest.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:58:"/home/bjartka/public_html/doctrine/models/Forum_Thread.php";a:7:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:9;i:1;i:10;i:1;i:11;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/QueryTest_User.php";a:7:{i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:17;i:1;i:18;i:1;i:19;i:1;}s:69:"/home/bjartka/public_html/doctrine/tests/Connection/MssqlTestCase.php";a:39:{i:35;i:1;i:37;i:1;i:38;i:1;i:40;i:1;i:42;i:1;i:43;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:97;i:1;i:98;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/Sequence/PgsqlTestCase.php";a:10:{i:37;i:1;i:38;i:1;i:40;i:1;i:41;i:1;i:44;i:1;i:46;i:1;i:48;i:1;i:51;i:1;i:53;i:1;i:54;i:1;}s:59:"/home/bjartka/public_html/doctrine/tests/PluginTestCase.php";a:42:{i:37;i:1;i:40;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:80;i:1;i:82;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:112;i:1;i:114;i:1;}s:61:"/home/bjartka/public_html/doctrine/tests/AuditLogTestCase.php";a:37:{i:37;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:80;i:1;i:84;i:1;i:87;i:1;i:88;i:-1;i:89;i:1;i:90;i:1;i:92;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:-1;}s:57:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query.php";a:864:{i:0;i:1;i:188;i:1;i:189;i:-2;i:196;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:200;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:204;i:1;i:214;i:1;i:215;i:1;i:218;i:1;i:221;i:1;i:223;i:1;i:224;i:-2;i:235;i:-1;i:236;i:-1;i:247;i:1;i:249;i:1;i:250;i:1;i:251;i:1;i:252;i:1;i:254;i:1;i:264;i:1;i:265;i:-2;i:277;i:1;i:278;i:1;i:279;i:1;i:280;i:1;i:281;i:1;i:282;i:1;i:283;i:1;i:284;i:1;i:285;i:1;i:287;i:1;i:288;i:-2;i:297;i:1;i:298;i:-2;i:306;i:-1;i:307;i:-1;i:317;i:1;i:318;i:-2;i:331;i:1;i:333;i:1;i:334;i:1;i:335;i:-2;i:337;i:1;i:338;i:1;i:339;i:1;i:340;i:1;i:341;i:-2;i:343;i:-1;i:344;i:-2;i:361;i:1;i:362;i:1;i:363;i:-2;i:365;i:1;i:366;i:1;i:367;i:-2;i:378;i:1;i:379;i:-2;i:389;i:1;i:391;i:1;i:393;i:1;i:394;i:1;i:395;i:-1;i:397;i:-1;i:398;i:-2;i:399;i:1;i:401;i:-2;i:462;i:-1;i:463;i:-1;i:464;i:-2;i:466;i:-1;i:467;i:-2;i:483;i:1;i:484;i:1;i:486;i:1;i:487;i:1;i:488;i:-2;i:490;i:1;i:494;i:1;i:496;i:1;i:497;i:1;i:500;i:1;i:501;i:1;i:502;i:1;i:505;i:1;i:506;i:1;i:507;i:1;i:508;i:1;i:509;i:1;i:511;i:1;i:512;i:1;i:513;i:1;i:514;i:1;i:516;i:1;i:517;i:1;i:518;i:1;i:519;i:1;i:521;i:1;i:523;i:1;i:525;i:1;i:528;i:1;i:529;i:-2;i:542;i:-1;i:544;i:-1;i:545;i:-1;i:546;i:-1;i:547;i:-1;i:548;i:-1;i:549;i:-1;i:550;i:-1;i:553;i:-1;i:554;i:-1;i:558;i:-1;i:559;i:-1;i:561;i:-1;i:562;i:-1;i:563;i:-1;i:565;i:-1;i:566;i:-2;i:567;i:-1;i:569;i:-1;i:571;i:-1;i:573;i:-1;i:575;i:-2;i:588;i:1;i:589;i:1;i:591;i:1;i:593;i:1;i:594;i:1;i:596;i:1;i:597;i:-2;i:598;i:1;i:599;i:1;i:601;i:-2;i:613;i:1;i:615;i:1;i:616;i:1;i:619;i:1;i:620;i:-1;i:622;i:-1;i:623;i:-1;i:625;i:1;i:627;i:1;i:628;i:1;i:630;i:1;i:631;i:-1;i:632;i:-2;i:634;i:1;i:636;i:1;i:638;i:1;i:639;i:1;i:640;i:1;i:642;i:1;i:643;i:1;i:644;i:1;i:646;i:1;i:647;i:1;i:649;i:1;i:651;i:1;i:653;i:1;i:655;i:1;i:657;i:1;i:658;i:1;i:660;i:1;i:662;i:1;i:663;i:1;i:664;i:1;i:666;i:1;i:667;i:1;i:668;i:1;i:669;i:1;i:670;i:1;i:671;i:1;i:672;i:1;i:675;i:1;i:677;i:1;i:678;i:1;i:698;i:1;i:700;i:1;i:701;i:1;i:702;i:-2;i:704;i:1;i:706;i:1;i:707;i:1;i:708;i:1;i:710;i:1;i:711;i:1;i:712;i:1;i:713;i:1;i:715;i:1;i:718;i:1;i:719;i:1;i:720;i:1;i:724;i:1;i:725;i:1;i:726;i:1;i:728;i:1;i:729;i:1;i:730;i:1;i:733;i:1;i:735;i:1;i:736;i:1;i:738;i:1;i:741;i:1;i:743;i:1;i:744;i:1;i:746;i:1;i:747;i:1;i:748;i:1;i:750;i:1;i:752;i:1;i:753;i:1;i:755;i:1;i:756;i:-1;i:757;i:-1;i:759;i:1;i:762;i:1;i:763;i:-1;i:764;i:-2;i:766;i:1;i:768;i:1;i:771;i:1;i:774;i:1;i:775;i:1;i:776;i:-2;i:778;i:1;i:779;i:1;i:780;i:1;i:782;i:1;i:785;i:1;i:787;i:1;i:788;i:1;i:790;i:1;i:792;i:1;i:793;i:1;i:795;i:1;i:796;i:1;i:797;i:1;i:799;i:1;i:801;i:1;i:803;i:1;i:804;i:1;i:805;i:1;i:808;i:1;i:809;i:1;i:812;i:1;i:815;i:1;i:818;i:1;i:819;i:1;i:820;i:1;i:822;i:1;i:824;i:1;i:826;i:1;i:828;i:1;i:830;i:1;i:831;i:1;i:833;i:1;i:835;i:1;i:836;i:1;i:838;i:1;i:840;i:1;i:841;i:1;i:842;i:1;i:843;i:1;i:845;i:1;i:848;i:1;i:849;i:1;i:850;i:1;i:851;i:-2;i:864;i:1;i:865;i:1;i:867;i:1;i:868;i:1;i:869;i:1;i:870;i:-2;i:873;i:1;i:874;i:1;i:876;i:1;i:878;i:1;i:879;i:1;i:880;i:1;i:884;i:1;i:885;i:1;i:886;i:-2;i:889;i:1;i:891;i:1;i:893;i:1;i:894;i:-1;i:895;i:-1;i:896;i:-1;i:897;i:-2;i:898;i:-1;i:899;i:-1;i:900;i:-1;i:902;i:-1;i:903;i:1;i:906;i:1;i:907;i:1;i:909;i:1;i:910;i:-2;i:925;i:-1;i:926;i:-1;i:928;i:-1;i:930;i:-1;i:932;i:-1;i:933;i:-1;i:934;i:-1;i:936;i:-1;i:938;i:-1;i:940;i:-1;i:941;i:-1;i:942;i:-1;i:943;i:-1;i:944;i:-1;i:956;i:-1;i:957;i:-1;i:959;i:-1;i:962;i:-1;i:963;i:-1;i:965;i:-1;i:966;i:-1;i:967;i:-2;i:969;i:-1;i:971;i:-1;i:972;i:-1;i:975;i:-1;i:976;i:-1;i:977;i:-2;i:979;i:-1;i:981;i:-1;i:984;i:-1;i:985;i:-1;i:986;i:-2;i:988;i:-1;i:990;i:-1;i:994;i:-1;i:995;i:-1;i:996;i:-1;i:997;i:-1;i:999;i:-1;i:1000;i:-1;i:1001;i:-1;i:1002;i:-1;i:1004;i:-1;i:1005;i:-1;i:1007;i:-1;i:1009;i:-1;i:1010;i:-1;i:1012;i:-1;i:1014;i:-1;i:1015;i:-1;i:1017;i:-1;i:1018;i:-1;i:1030;i:1;i:1031;i:1;i:1032;i:1;i:1033;i:1;i:1034;i:1;i:1035;i:1;i:1036;i:1;i:1037;i:1;i:1038;i:1;i:1039;i:1;i:1040;i:1;i:1041;i:-1;i:1042;i:1;i:1043;i:-2;i:1053;i:1;i:1054;i:1;i:1055;i:1;i:1056;i:1;i:1057;i:1;i:1058;i:-2;i:1062;i:1;i:1063;i:-1;i:1064;i:-1;i:1065;i:1;i:1066;i:1;i:1068;i:1;i:1069;i:1;i:1071;i:1;i:1072;i:-1;i:1074;i:1;i:1075;i:-1;i:1076;i:-2;i:1078;i:1;i:1080;i:1;i:1081;i:1;i:1083;i:1;i:1084;i:1;i:1085;i:1;i:1086;i:1;i:1088;i:1;i:1090;i:1;i:1091;i:1;i:1093;i:1;i:1096;i:1;i:1097;i:1;i:1098;i:1;i:1099;i:-2;i:1113;i:1;i:1127;i:-1;i:1139;i:1;i:1140;i:1;i:1141;i:-2;i:1144;i:1;i:1145;i:1;i:1146;i:1;i:1147;i:1;i:1148;i:1;i:1149;i:1;i:1152;i:1;i:1156;i:1;i:1157;i:1;i:1158;i:1;i:1159;i:1;i:1161;i:1;i:1166;i:1;i:1167;i:-1;i:1168;i:-2;i:1170;i:1;i:1171;i:1;i:1172;i:1;i:1173;i:1;i:1174;i:1;i:1176;i:1;i:1177;i:1;i:1178;i:1;i:1179;i:1;i:1180;i:1;i:1182;i:1;i:1183;i:1;i:1184;i:1;i:1185;i:1;i:1186;i:1;i:1187;i:1;i:1188;i:1;i:1189;i:1;i:1190;i:1;i:1191;i:1;i:1193;i:1;i:1196;i:1;i:1197;i:1;i:1199;i:1;i:1200;i:1;i:1201;i:1;i:1204;i:1;i:1207;i:1;i:1208;i:1;i:1209;i:1;i:1210;i:1;i:1211;i:1;i:1213;i:1;i:1215;i:1;i:1216;i:1;i:1218;i:1;i:1219;i:1;i:1221;i:1;i:1222;i:1;i:1223;i:1;i:1225;i:1;i:1226;i:1;i:1227;i:1;i:1228;i:1;i:1230;i:1;i:1231;i:1;i:1232;i:-1;i:1234;i:1;i:1237;i:1;i:1238;i:1;i:1239;i:1;i:1241;i:1;i:1242;i:1;i:1243;i:1;i:1245;i:1;i:1246;i:1;i:1247;i:1;i:1248;i:1;i:1250;i:1;i:1251;i:1;i:1252;i:1;i:1255;i:1;i:1256;i:1;i:1257;i:1;i:1258;i:1;i:1259;i:1;i:1260;i:1;i:1261;i:1;i:1263;i:1;i:1264;i:-2;i:1279;i:1;i:1280;i:1;i:1281;i:1;i:1284;i:1;i:1286;i:1;i:1289;i:1;i:1291;i:1;i:1294;i:1;i:1295;i:1;i:1296;i:1;i:1297;i:1;i:1298;i:1;i:1300;i:1;i:1301;i:1;i:1302;i:-2;i:1305;i:1;i:1306;i:-1;i:1307;i:-2;i:1310;i:1;i:1311;i:1;i:1312;i:1;i:1313;i:1;i:1314;i:1;i:1316;i:1;i:1317;i:1;i:1318;i:1;i:1319;i:1;i:1320;i:1;i:1321;i:1;i:1322;i:1;i:1324;i:1;i:1326;i:1;i:1328;i:1;i:1329;i:1;i:1331;i:1;i:1332;i:-1;i:1333;i:-2;i:1334;i:1;i:1336;i:1;i:1337;i:1;i:1340;i:1;i:1341;i:1;i:1342;i:1;i:1344;i:1;i:1347;i:1;i:1349;i:1;i:1351;i:1;i:1352;i:1;i:1353;i:-1;i:1354;i:-2;i:1356;i:1;i:1358;i:1;i:1359;i:1;i:1360;i:1;i:1361;i:-2;i:1363;i:1;i:1364;i:1;i:1365;i:-2;i:1366;i:1;i:1368;i:1;i:1369;i:1;i:1370;i:1;i:1372;i:1;i:1373;i:1;i:1374;i:1;i:1376;i:1;i:1377;i:1;i:1378;i:1;i:1379;i:-1;i:1380;i:-2;i:1381;i:1;i:1382;i:1;i:1383;i:-2;i:1385;i:1;i:1387;i:1;i:1388;i:1;i:1389;i:1;i:1391;i:1;i:1392;i:1;i:1393;i:1;i:1394;i:1;i:1396;i:1;i:1397;i:1;i:1398;i:-2;i:1413;i:1;i:1414;i:1;i:1415;i:1;i:1417;i:1;i:1418;i:1;i:1419;i:1;i:1421;i:1;i:1423;i:1;i:1424;i:1;i:1425;i:1;i:1427;i:1;i:1428;i:-1;i:1429;i:-1;i:1430;i:1;i:1431;i:-1;i:1432;i:-1;i:1433;i:1;i:1434;i:1;i:1435;i:1;i:1436;i:1;i:1437;i:1;i:1438;i:1;i:1439;i:1;i:1440;i:1;i:1441;i:1;i:1442;i:1;i:1443;i:1;i:1444;i:1;i:1445;i:1;i:1446;i:1;i:1447;i:1;i:1448;i:1;i:1449;i:1;i:1450;i:1;i:1451;i:1;i:1452;i:1;i:1453;i:1;i:1454;i:1;i:1455;i:1;i:1456;i:1;i:1457;i:1;i:1458;i:-2;i:1459;i:1;i:1461;i:1;i:1462;i:-2;i:1469;i:1;i:1470;i:1;i:1471;i:-2;i:1472;i:1;i:1474;i:1;i:1475;i:1;i:1476;i:1;i:1478;i:1;i:1479;i:1;i:1482;i:1;i:1484;i:1;i:1486;i:1;i:1487;i:1;i:1488;i:1;i:1489;i:1;i:1490;i:1;i:1491;i:1;i:1493;i:1;i:1494;i:1;i:1495;i:1;i:1496;i:1;i:1497;i:1;i:1500;i:1;i:1501;i:1;i:1503;i:1;i:1505;i:1;i:1506;i:1;i:1507;i:1;i:1509;i:1;i:1510;i:1;i:1511;i:1;i:1513;i:1;i:1514;i:1;i:1516;i:1;i:1518;i:1;i:1521;i:1;i:1523;i:1;i:1526;i:1;i:1527;i:1;i:1528;i:1;i:1529;i:1;i:1533;i:1;i:1534;i:-1;i:1535;i:-2;i:1537;i:1;i:1540;i:1;i:1541;i:1;i:1542;i:1;i:1544;i:1;i:1545;i:1;i:1547;i:1;i:1548;i:1;i:1549;i:1;i:1550;i:1;i:1551;i:1;i:1552;i:1;i:1553;i:1;i:1554;i:1;i:1556;i:1;i:1557;i:1;i:1558;i:1;i:1560;i:1;i:1562;i:1;i:1564;i:1;i:1566;i:1;i:1568;i:1;i:1569;i:1;i:1570;i:1;i:1572;i:1;i:1573;i:1;i:1575;i:1;i:1577;i:1;i:1578;i:1;i:1579;i:1;i:1581;i:1;i:1583;i:1;i:1585;i:1;i:1587;i:1;i:1590;i:1;i:1591;i:1;i:1592;i:1;i:1593;i:1;i:1595;i:1;i:1598;i:1;i:1599;i:1;i:1600;i:1;i:1601;i:1;i:1602;i:1;i:1604;i:1;i:1606;i:1;i:1608;i:1;i:1609;i:1;i:1611;i:1;i:1612;i:1;i:1613;i:1;i:1615;i:1;i:1617;i:1;i:1619;i:1;i:1621;i:1;i:1622;i:1;i:1623;i:1;i:1624;i:1;i:1625;i:1;i:1626;i:1;i:1627;i:1;i:1628;i:1;i:1629;i:1;i:1630;i:1;i:1632;i:1;i:1634;i:1;i:1636;i:1;i:1637;i:1;i:1638;i:1;i:1639;i:1;i:1642;i:1;i:1644;i:1;i:1645;i:1;i:1646;i:1;i:1647;i:1;i:1649;i:1;i:1651;i:1;i:1653;i:1;i:1654;i:1;i:1655;i:1;i:1656;i:1;i:1657;i:1;i:1658;i:1;i:1660;i:1;i:1662;i:1;i:1664;i:1;i:1665;i:1;i:1667;i:1;i:1668;i:1;i:1669;i:1;i:1670;i:1;i:1671;i:1;i:1672;i:1;i:1674;i:1;i:1675;i:1;i:1676;i:1;i:1677;i:-2;i:1679;i:1;i:1680;i:1;i:1681;i:1;i:1682;i:-2;i:1694;i:1;i:1695;i:1;i:1697;i:1;i:1698;i:1;i:1701;i:1;i:1703;i:1;i:1705;i:1;i:1706;i:1;i:1707;i:1;i:1709;i:1;i:1711;i:1;i:1713;i:1;i:1715;i:1;i:1717;i:1;i:1718;i:-2;i:1726;i:1;i:1728;i:1;i:1729;i:1;i:1732;i:1;i:1734;i:1;i:1736;i:1;i:1737;i:1;i:1739;i:1;i:1742;i:1;i:1744;i:1;i:1745;i:1;i:1748;i:1;i:1749;i:1;i:1751;i:1;i:1752;i:1;i:1753;i:1;i:1754;i:1;i:1755;i:1;i:1756;i:1;i:1758;i:1;i:1759;i:-2;i:1785;i:1;i:1788;i:1;i:1789;i:1;i:1790;i:1;i:1791;i:1;i:1792;i:1;i:1793;i:1;i:1796;i:1;i:1797;i:1;i:1798;i:1;i:1800;i:1;i:1801;i:1;i:1802;i:1;i:1803;i:1;i:1804;i:1;i:1806;i:1;i:1809;i:1;i:1811;i:1;i:1812;i:1;i:1813;i:1;i:1815;i:1;i:1816;i:1;i:1817;i:1;i:1819;i:1;i:1820;i:-1;i:1821;i:-1;i:1823;i:1;i:1825;i:1;i:1827;i:1;i:1829;i:1;i:1830;i:-1;i:1831;i:-1;i:1832;i:-1;i:1833;i:-1;i:1834;i:-1;i:1835;i:1;i:1838;i:1;i:1839;i:-2;i:1853;i:1;i:1854;i:1;i:1855;i:-2;i:1866;i:1;i:1867;i:1;i:1868;i:1;i:1870;i:1;i:1871;i:1;i:1872;i:1;i:1873;i:1;i:1875;i:1;i:1876;i:-2;i:1889;i:-1;i:1890;i:-1;i:1891;i:-1;i:1892;i:-1;i:1893;i:-1;i:1903;i:-1;i:1904;i:-1;i:1916;i:-1;}s:64:"/home/bjartka/public_html/doctrine/tests/Record/LockTestCase.php";a:13:{i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:10;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:20;i:1;i:21;i:1;i:22;i:1;}s:64:"/home/bjartka/public_html/doctrine/tests/Query/CacheTestCase.php";a:69:{i:38;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:56;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:110;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:122;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:130;i:1;i:132;i:1;i:133;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:141;i:1;i:142;i:1;i:144;i:1;i:146;i:1;i:147;i:1;i:149;i:1;i:150;i:1;}s:60:"/home/bjartka/public_html/doctrine/lib/Doctrine/DataDict.php";a:34:{i:34;i:1;i:45;i:-1;i:47;i:-1;i:48;i:-1;i:49;i:-2;i:51;i:-1;i:52;i:-1;i:53;i:-2;i:55;i:-1;i:57;i:-1;i:58;i:-1;i:59;i:-1;i:61;i:-1;i:62;i:-1;i:63;i:-1;i:64;i:-1;i:65;i:-1;i:67;i:-1;i:68;i:-1;i:69;i:-1;i:70;i:-1;i:71;i:-1;i:72;i:-1;i:73;i:-1;i:75;i:-1;i:76;i:-2;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:-2;i:96;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Sequence/Mysql.php";a:29:{i:21;i:1;i:33;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:51;i:1;i:53;i:1;i:54;i:-2;i:59;i:-2;i:60;i:-2;i:61;i:-2;i:64;i:-2;i:65;i:-2;i:66;i:-2;i:69;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:80;i:1;i:81;i:1;i:82;i:-2;i:94;i:1;i:95;i:-2;i:106;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:111;i:-2;i:112;i:1;}s:72:"/home/bjartka/public_html/doctrine/lib/Doctrine/Expression/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:58:"/home/bjartka/public_html/doctrine/lib/Doctrine/RawSql.php";a:156:{i:21;i:1;i:39;i:1;i:51;i:1;i:52;i:-2;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:-2;i:75;i:1;i:76;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:85;i:-2;i:93;i:1;i:94;i:-2;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:119;i:1;i:120;i:1;i:122;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:147;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:160;i:1;i:162;i:1;i:163;i:1;i:165;i:1;i:166;i:1;i:168;i:1;i:169;i:-2;i:179;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:-2;i:187;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:193;i:1;i:195;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:204;i:1;i:205;i:1;i:207;i:1;i:211;i:1;i:212;i:1;i:214;i:1;i:215;i:1;i:217;i:1;i:218;i:1;i:219;i:1;i:220;i:1;i:221;i:1;i:224;i:1;i:225;i:1;i:227;i:1;i:228;i:1;i:230;i:1;i:231;i:1;i:232;i:1;i:233;i:1;i:234;i:1;i:236;i:1;i:237;i:1;i:238;i:1;i:239;i:1;i:240;i:1;i:241;i:1;i:243;i:1;i:244;i:1;i:245;i:1;i:246;i:1;i:247;i:1;i:248;i:1;i:249;i:1;i:251;i:1;i:252;i:1;i:253;i:1;i:254;i:1;i:255;i:-2;i:265;i:1;i:266;i:-2;i:277;i:1;i:278;i:1;i:280;i:1;i:282;i:1;i:283;i:1;i:285;i:1;i:287;i:1;i:289;i:1;i:290;i:1;i:292;i:1;i:293;i:1;i:295;i:1;i:297;i:1;i:300;i:1;i:302;i:1;i:305;i:1;i:306;i:1;i:307;i:1;i:308;i:1;i:310;i:1;i:311;i:1;i:312;i:1;i:314;i:1;i:315;i:1;i:316;i:1;i:317;i:1;i:319;i:1;i:320;i:1;i:321;i:1;i:323;i:1;i:325;i:1;i:326;i:1;i:328;i:1;i:329;i:-2;i:331;i:1;}s:83:"/home/bjartka/public_html/doctrine/lib/Doctrine/Template/Listener/Timestampable.php";a:20:{i:33;i:1;i:50;i:1;i:51;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:76;i:-1;i:78;i:-1;i:79;i:-1;i:91;i:1;i:93;i:1;i:94;i:-1;i:95;i:1;i:96;i:1;i:97;i:-2;i:98;i:-1;i:100;i:-2;i:101;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hook/Integer.php";a:17:{i:21;i:1;i:33;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:67;i:1;i:69;i:1;i:72;i:1;i:73;i:1;i:74;i:-2;i:75;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Node/Interface.php";a:2:{i:33;i:1;i:268;i:1;}s:47:"/home/bjartka/tmp/dparser_0.97595900 1196020168";a:3:{i:4;i:1;i:5;i:1;i:7;i:1;}s:47:"/home/bjartka/tmp/dparser_0.98683200 1196020168";a:3:{i:4;i:1;i:5;i:1;i:7;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/Page.php";a:7:{i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:14;i:1;i:15;i:1;i:16;i:1;}s:56:"/home/bjartka/public_html/doctrine/models/Assignment.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/FieldNameTest.php";a:6:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;}s:70:"/home/bjartka/public_html/doctrine/models/ORM_AccessControlsGroups.php";a:3:{i:6;i:-1;i:7;i:-1;i:8;i:-1;}s:58:"/home/bjartka/public_html/doctrine/models/LocationI18n.php";a:6:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:13;i:1;i:14;i:1;}s:64:"/home/bjartka/public_html/doctrine/models/QueryTest_Category.php";a:13:{i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:21;i:1;i:22;i:1;i:23;i:1;i:24;i:1;i:25;i:1;i:32;i:1;i:33;i:1;i:34;i:1;i:35;i:1;}s:64:"/home/bjartka/public_html/doctrine/tests/Query/WhereTestCase.php";a:162:{i:37;i:1;i:40;i:1;i:41;i:1;i:42;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:112;i:1;i:114;i:1;i:116;i:1;i:118;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:125;i:1;i:127;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:135;i:1;i:137;i:1;i:138;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:145;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:-2;i:159;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:167;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:-2;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:183;i:1;i:185;i:1;i:187;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:193;i:1;i:196;i:1;i:198;i:1;i:200;i:1;i:202;i:1;i:203;i:1;i:204;i:1;i:207;i:1;i:209;i:1;i:211;i:1;i:212;i:1;i:214;i:1;i:215;i:1;i:218;i:1;i:220;i:1;i:222;i:1;i:223;i:1;i:225;i:1;i:226;i:1;i:229;i:1;i:231;i:1;i:233;i:1;i:234;i:1;i:236;i:1;i:237;i:1;i:240;i:1;i:242;i:1;i:244;i:1;i:245;i:1;i:247;i:1;i:248;i:1;i:251;i:1;i:253;i:1;i:255;i:1;i:256;i:1;i:259;i:1;i:261;i:1;i:263;i:1;i:264;i:1;i:267;i:1;i:268;i:1;i:269;i:1;i:271;i:1;i:273;i:1;i:275;i:1;i:277;i:1;i:279;i:1;i:280;i:1;i:284;i:1;i:286;i:1;i:288;i:1;i:290;i:1;i:291;i:1;i:292;i:1;i:293;i:1;i:294;i:1;i:298;i:1;i:300;i:1;i:302;i:1;i:304;i:1;i:305;i:1;i:306;i:1;i:307;i:1;i:308;i:1;i:312;i:1;i:314;i:1;i:316;i:1;i:317;i:1;i:321;i:1;i:323;i:1;i:325;i:1;i:326;i:1;}s:69:"/home/bjartka/public_html/doctrine/tests/CustomPrimaryKeyTestCase.php";a:14:{i:36;i:1;i:40;i:1;i:42;i:1;i:43;i:1;i:46;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:59;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Manager/Exception.php";a:2:{i:33;i:1;i:34;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Expression/Sqlite.php";a:41:{i:0;i:1;i:21;i:1;i:33;i:1;i:43;i:-1;i:44;i:-2;i:55;i:-1;i:56;i:-2;i:65;i:1;i:66;i:1;i:67;i:-2;i:80;i:-1;i:81;i:-2;i:84;i:-1;i:85;i:-2;i:88;i:-1;i:89;i:-2;i:92;i:-1;i:93;i:-2;i:96;i:-1;i:97;i:-2;i:106;i:-1;i:107;i:-2;i:121;i:-1;i:122;i:-2;i:133;i:-1;i:134;i:-1;i:135;i:-1;i:136;i:-1;i:137;i:-1;i:138;i:-1;i:139;i:-1;i:140;i:-1;i:141;i:-2;i:150;i:1;i:151;i:-2;i:167;i:1;i:168;i:1;i:169;i:-2;i:170;i:-1;i:171;i:-2;i:172;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Import/Pgsql.php";a:49:{i:21;i:1;i:33;i:1;i:130;i:-1;i:140;i:1;i:141;i:1;i:143;i:1;i:144;i:-2;i:154;i:1;i:155;i:1;i:156;i:1;i:158;i:1;i:159;i:1;i:160;i:-1;i:162;i:-1;i:164;i:-1;i:165;i:-1;i:166;i:-1;i:168;i:-1;i:171;i:-1;i:172;i:-1;i:173;i:-1;i:174;i:-1;i:175;i:-1;i:176;i:-1;i:177;i:-1;i:178;i:-1;i:179;i:-1;i:180;i:-1;i:181;i:-1;i:182;i:-1;i:183;i:-1;i:184;i:1;i:185;i:-2;i:195;i:1;i:196;i:1;i:198;i:1;i:199;i:-2;i:209;i:1;i:210;i:-2;i:223;i:-1;i:224;i:-1;i:225;i:-1;i:226;i:-1;i:227;i:-1;i:228;i:-1;i:229;i:-2;i:239;i:-1;i:240;i:-2;i:241;i:1;}s:63:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hook/Parser.php";a:6:{i:34;i:1;i:40;i:1;i:41;i:-2;i:51;i:1;i:52;i:-2;i:67;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Search/Query.php";a:115:{i:34;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:-2;i:64;i:1;i:65;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:75;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:102;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:112;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:124;i:1;i:126;i:1;i:128;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:145;i:-2;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:159;i:1;i:160;i:1;i:164;i:1;i:165;i:1;i:166;i:-2;i:167;i:1;i:169;i:-2;i:172;i:1;i:173;i:1;i:174;i:-2;i:175;i:1;i:177;i:1;i:179;i:-2;i:183;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:188;i:1;i:190;i:1;i:191;i:1;i:193;i:1;i:194;i:1;i:195;i:1;i:196;i:-2;i:197;i:1;i:198;i:1;i:200;i:1;i:201;i:-2;i:204;i:1;i:206;i:1;i:207;i:1;i:209;i:1;i:211;i:1;i:213;i:1;i:214;i:1;i:215;i:1;i:218;i:1;i:220;i:1;i:221;i:-2;i:225;i:-1;i:226;i:-2;i:229;i:1;i:230;i:-2;i:233;i:1;i:234;i:-2;i:236;i:1;}s:76:"/home/bjartka/public_html/doctrine/tests/migration_classes/001_add_table.php";a:7:{i:2;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:12;i:1;i:13;i:1;i:14;i:1;}s:58:"/home/bjartka/public_html/doctrine/models/RelationTest.php";a:13:{i:6;i:1;i:7;i:1;i:8;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:21;i:1;i:22;i:1;i:23;i:1;i:24;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/PolicyAsset.php";a:7:{i:6;i:1;i:7;i:1;i:8;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;}s:56:"/home/bjartka/public_html/doctrine/models/mmrGroup_B.php";a:7:{i:5;i:-1;i:6;i:-1;i:7;i:-1;i:8;i:-1;i:11;i:-1;i:12;i:-1;i:13;i:-1;}s:55:"/home/bjartka/public_html/doctrine/models/gnatEmail.php";a:2:{i:6;i:1;i:7;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/EntityReference.php";a:3:{i:6;i:1;i:7;i:1;i:9;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Import/PgsqlTestCase.php";a:36:{i:37;i:1;i:39;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:51;i:1;i:73;i:1;i:74;i:1;i:77;i:1;i:79;i:1;i:90;i:1;i:91;i:1;i:94;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:121;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:128;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:135;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:153;i:1;i:166;i:1;i:167;i:1;i:168;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/Query/SubqueryTestCase.php";a:50:{i:39;i:1;i:40;i:1;i:42;i:1;i:43;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:62;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:81;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:99;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:-2;i:108;i:1;i:109;i:1;i:113;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:127;i:-2;i:129;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Search/QueryTestCase.php";a:146:{i:37;i:1;i:39;i:1;i:40;i:1;i:42;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:63;i:1;i:64;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:84;i:1;i:85;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:94;i:1;i:95;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:109;i:1;i:110;i:1;i:114;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:124;i:1;i:125;i:1;i:127;i:1;i:129;i:1;i:130;i:1;i:134;i:1;i:135;i:1;i:137;i:1;i:139;i:1;i:140;i:1;i:144;i:1;i:145;i:1;i:148;i:1;i:150;i:1;i:151;i:1;i:155;i:1;i:156;i:1;i:160;i:1;i:162;i:1;i:163;i:1;i:167;i:1;i:168;i:1;i:172;i:1;i:174;i:1;i:175;i:1;i:179;i:1;i:180;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:188;i:1;i:189;i:1;i:194;i:1;i:195;i:1;i:199;i:1;i:200;i:1;i:202;i:1;i:203;i:1;i:208;i:1;i:209;i:1;i:212;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:220;i:1;i:221;i:1;i:225;i:1;i:226;i:1;i:227;i:1;i:229;i:1;i:230;i:1;i:231;i:1;i:235;i:1;i:236;i:1;i:240;i:1;i:241;i:1;i:243;i:1;i:244;i:1;i:245;i:1;i:249;i:1;i:250;i:1;i:254;i:1;i:255;i:1;i:256;i:1;i:258;i:1;i:259;i:1;i:260;i:1;i:264;i:1;i:265;i:1;i:269;i:1;i:270;i:1;i:271;i:1;i:273;i:1;i:274;i:1;i:278;i:1;i:279;i:1;i:283;i:1;i:284;i:1;i:285;i:1;i:287;i:1;i:288;i:1;i:289;i:1;i:292;i:1;i:293;i:1;i:297;i:1;i:298;i:1;i:299;i:1;i:301;i:1;i:302;i:1;i:303;i:1;i:306;i:1;i:307;i:1;i:311;i:1;i:312;i:1;i:313;i:1;i:314;i:1;i:316;i:1;i:317;i:1;i:318;i:1;i:322;i:1;i:323;i:1;i:325;i:1;i:326;i:1;}s:63:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Where.php";a:86:{i:21;i:1;i:33;i:1;i:37;i:1;i:38;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:-2;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:83;i:1;i:84;i:-2;i:87;i:-1;i:91;i:1;i:93;i:1;i:95;i:1;i:96;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:-1;i:104;i:-1;i:106;i:1;i:108;i:1;i:110;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:122;i:1;i:124;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:137;i:1;i:138;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:146;i:1;i:147;i:-2;i:158;i:1;i:160;i:1;i:162;i:1;i:163;i:-1;i:164;i:-2;i:166;i:1;i:168;i:1;i:169;i:-2;i:171;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Offset.php";a:4:{i:33;i:1;i:37;i:1;i:38;i:-2;i:39;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Migration/Process.php";a:82:{i:34;i:1;i:43;i:1;i:44;i:-2;i:54;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:69;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:84;i:-1;i:85;i:-1;i:87;i:-1;i:88;i:-1;i:89;i:-1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:118;i:-1;i:119;i:-1;i:121;i:-1;i:122;i:-1;i:123;i:-1;i:124;i:-1;i:125;i:-1;i:126;i:-1;i:127;i:-1;i:128;i:-1;i:138;i:-1;i:139;i:-1;i:141;i:-1;i:142;i:-1;i:143;i:-1;i:145;i:-1;i:146;i:-1;i:147;i:-1;i:157;i:-1;i:158;i:-1;i:160;i:-1;i:161;i:-1;i:162;i:-1;i:172;i:-1;i:173;i:-1;i:175;i:-1;i:176;i:-1;i:177;i:-1;i:187;i:-1;i:188;i:-1;i:190;i:-1;i:191;i:-1;i:192;i:-1;i:202;i:-1;i:203;i:-1;i:204;i:-1;i:205;i:-1;i:206;i:-1;i:207;i:-1;i:217;i:-1;i:218;i:-1;i:219;i:-1;i:220;i:-1;i:221;i:-1;i:222;i:-1;i:232;i:-1;i:233;i:-1;i:234;i:-1;i:235;i:-1;i:236;i:-1;i:246;i:-1;i:247;i:-1;i:248;i:-1;i:249;i:-1;i:250;i:-1;i:251;i:1;}s:65:"/home/bjartka/public_html/doctrine/models/InheritanceDealUser.php";a:18:{i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:15;i:1;i:22;i:1;i:24;i:1;i:26;i:1;i:27;i:1;i:28;i:1;i:32;i:1;i:34;i:1;i:35;i:1;i:36;i:1;i:37;i:1;i:38;i:1;i:39;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/RTC4.php";a:5:{i:4;i:1;i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/User.php";a:31:{i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:21;i:1;i:22;i:1;i:23;i:1;i:24;i:1;i:25;i:1;i:26;i:1;i:27;i:1;i:28;i:1;i:29;i:1;i:30;i:1;i:31;i:1;i:37;i:1;i:38;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;}s:56:"/home/bjartka/public_html/doctrine/models/mmrGroup_C.php";a:7:{i:6;i:-1;i:7;i:-1;i:8;i:-1;i:9;i:-1;i:12;i:-1;i:13;i:-1;i:14;i:-1;}s:54:"/home/bjartka/public_html/doctrine/models/CPK_Test.php";a:4:{i:4;i:-1;i:5;i:-1;i:7;i:-1;i:8;i:-1;}s:67:"/home/bjartka/public_html/doctrine/tests/Sequence/MysqlTestCase.php";a:13:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:53;i:1;i:55;i:1;i:57;i:1;i:58;i:1;}s:58:"/home/bjartka/public_html/doctrine/tests/QueryTestCase.php";a:34:{i:38;i:1;i:40;i:1;i:42;i:1;i:45;i:1;i:46;i:1;i:51;i:1;i:53;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:72;i:1;i:74;i:1;i:76;i:1;i:78;i:1;i:80;i:1;i:81;i:1;i:85;i:1;i:87;i:1;i:89;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:109;i:1;i:110;i:1;}s:59:"/home/bjartka/public_html/doctrine/tests/RawSqlTestCase.php";a:147:{i:38;i:1;i:39;i:1;i:40;i:1;i:42;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:70;i:1;i:71;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:83;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:90;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:108;i:1;i:111;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:118;i:1;i:120;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:131;i:1;i:132;i:1;i:134;i:1;i:135;i:1;i:137;i:1;i:139;i:1;i:140;i:1;i:142;i:1;i:144;i:1;i:145;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:154;i:1;i:156;i:1;i:158;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:173;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:185;i:1;i:187;i:1;i:188;i:1;i:189;i:1;i:191;i:1;i:192;i:1;i:193;i:1;i:194;i:1;i:195;i:1;i:201;i:1;i:203;i:1;i:204;i:1;i:206;i:1;i:209;i:1;i:211;i:1;i:212;i:1;i:213;i:1;i:214;i:1;i:216;i:1;i:220;i:1;i:222;i:1;i:224;i:1;i:225;i:1;i:226;i:1;i:230;i:1;i:232;i:1;i:233;i:1;i:234;i:1;i:235;i:1;i:236;i:1;i:238;i:1;i:239;i:1;i:243;i:1;i:245;i:1;i:246;i:1;i:247;i:1;i:248;i:1;i:249;i:1;i:251;i:1;i:252;i:1;i:256;i:1;i:257;i:1;i:258;i:1;i:259;i:1;i:260;i:1;i:261;i:1;i:262;i:1;i:263;i:1;i:267;i:1;i:268;i:1;i:269;i:1;i:270;i:1;i:271;i:1;i:275;i:1;i:276;i:1;i:278;i:1;i:279;i:-1;i:280;i:1;i:281;i:1;i:283;i:1;i:287;i:1;i:288;i:1;i:290;i:1;i:291;i:-1;i:292;i:1;i:293;i:1;i:295;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Mssql.php";a:85:{i:21;i:1;i:34;i:1;i:50;i:-1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:68;i:1;i:69;i:1;i:84;i:1;i:85;i:1;i:86;i:-2;i:87;i:-1;i:88;i:-2;i:102;i:-1;i:103;i:-1;i:105;i:-1;i:106;i:-1;i:107;i:-1;i:108;i:-2;i:110;i:-1;i:111;i:-1;i:112;i:-1;i:113;i:-1;i:114;i:-1;i:115;i:-1;i:117;i:-1;i:119;i:-1;i:120;i:-1;i:121;i:-1;i:122;i:-1;i:123;i:-1;i:124;i:-1;i:125;i:-1;i:126;i:-1;i:127;i:-1;i:129;i:-1;i:131;i:-2;i:133;i:-1;i:134;i:-2;i:144;i:1;i:145;i:-1;i:146;i:-1;i:147;i:1;i:148;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:155;i:-1;i:156;i:-1;i:157;i:-1;i:158;i:-1;i:159;i:-1;i:160;i:-1;i:161;i:-1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:170;i:1;i:171;i:1;i:172;i:-2;i:182;i:-1;i:184;i:-1;i:185;i:-1;i:186;i:-2;i:187;i:-2;i:188;i:-2;i:190;i:-2;i:192;i:-1;i:193;i:-2;i:194;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Sequence/Pgsql.php";a:22:{i:21;i:1;i:33;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:-2;i:54;i:-2;i:55;i:-2;i:56;i:-2;i:58;i:-2;i:59;i:-2;i:61;i:1;i:62;i:-2;i:76;i:1;i:77;i:1;i:79;i:1;i:80;i:-2;i:91;i:1;i:92;i:1;i:93;i:-2;i:94;i:1;}s:60:"/home/bjartka/public_html/doctrine/lib/Doctrine/AuditLog.php";a:37:{i:33;i:1;i:51;i:1;i:52;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:79;i:1;i:80;i:-2;i:90;i:1;i:92;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:106;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:120;i:-2;i:122;i:1;}s:58:"/home/bjartka/public_html/doctrine/lib/Doctrine/Plugin.php";a:78:{i:34;i:1;i:53;i:-1;i:54;i:-1;i:55;i:-2;i:56;i:-1;i:57;i:-2;i:66;i:-1;i:67;i:-2;i:77;i:1;i:78;i:-1;i:79;i:-2;i:81;i:1;i:82;i:-2;i:93;i:1;i:95;i:1;i:96;i:-2;i:100;i:1;i:101;i:1;i:110;i:-1;i:111;i:-2;i:115;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:122;i:1;i:123;i:-1;i:124;i:-2;i:126;i:1;i:127;i:1;i:133;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:146;i:1;i:147;i:-2;i:151;i:1;i:152;i:1;i:154;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:171;i:1;i:173;i:1;i:174;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:180;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:186;i:-2;i:200;i:1;i:202;i:1;i:203;i:1;i:204;i:1;i:205;i:1;i:206;i:1;i:208;i:1;i:209;i:-2;i:223;i:1;i:225;i:1;i:226;i:-1;i:227;i:-1;i:229;i:-1;i:230;i:-1;i:231;i:-1;i:233;i:-1;i:234;i:1;i:236;i:1;i:238;i:1;i:240;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hook/WordLike.php";a:16:{i:21;i:1;i:33;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:65;i:-2;i:67;i:1;}s:53:"/home/bjartka/public_html/doctrine/models/Address.php";a:6:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:11;i:1;i:12;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/EnumTest3.php";a:2:{i:5;i:1;i:6;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/M2MTest2.php";a:5:{i:4;i:-1;i:5;i:-1;i:6;i:-1;i:8;i:-1;i:9;i:-1;}s:58:"/home/bjartka/public_html/doctrine/models/ConcreteUser.php";a:2:{i:6;i:1;i:7;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/ColumnAliasTest.php";a:7:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:13;i:1;i:14;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/QueryTest_Item.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/ClientModel.php";a:28:{i:6;i:-1;i:8;i:-1;i:9;i:-1;i:10;i:-1;i:11;i:-1;i:12;i:-1;i:13;i:-1;i:17;i:-1;i:18;i:-1;i:25;i:-1;i:27;i:-1;i:28;i:-1;i:29;i:-1;i:33;i:-1;i:37;i:-1;i:38;i:-1;i:39;i:-1;i:46;i:-1;i:48;i:-1;i:50;i:-1;i:51;i:-1;i:52;i:-1;i:53;i:-1;i:54;i:-1;i:55;i:-1;i:56;i:-1;i:60;i:-1;i:61;i:-1;}s:50:"/home/bjartka/public_html/doctrine/models/RTC3.php";a:5:{i:4;i:-1;i:5;i:-1;i:7;i:-1;i:8;i:-1;i:9;i:-1;}s:56:"/home/bjartka/public_html/doctrine/models/FilterTest.php";a:4:{i:4;i:-1;i:5;i:-1;i:7;i:-1;i:8;i:-1;}s:71:"/home/bjartka/public_html/doctrine/tests/Relation/OneToManyTestCase.php";a:47:{i:36;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:67;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:112;i:1;i:114;i:1;i:116;i:1;i:117;i:1;}s:57:"/home/bjartka/public_html/doctrine/tests/ViewTestCase.php";a:26:{i:38;i:1;i:39;i:1;i:41;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:49;i:1;i:52;i:1;i:53;i:1;i:54;i:-2;i:56;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:69;i:1;i:70;i:-2;i:72;i:1;i:73;i:1;i:77;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Query/SelectTestCase.php";a:72:{i:126;i:1;i:129;i:1;i:131;i:1;i:132;i:-1;i:133;i:1;i:134;i:1;i:136;i:1;i:140;i:1;i:142;i:1;i:144;i:1;i:146;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:156;i:1;i:158;i:1;i:160;i:1;i:161;i:1;i:164;i:1;i:166;i:1;i:168;i:1;i:169;i:1;i:172;i:1;i:174;i:1;i:176;i:1;i:177;i:1;i:180;i:1;i:182;i:1;i:184;i:1;i:185;i:1;i:189;i:1;i:191;i:1;i:193;i:1;i:195;i:1;i:196;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:200;i:1;i:203;i:1;i:205;i:1;i:207;i:1;i:208;i:1;i:209;i:1;i:210;i:1;i:211;i:1;i:212;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:217;i:1;i:218;i:1;i:219;i:1;i:222;i:1;i:224;i:1;i:226;i:1;i:228;i:1;i:230;i:1;i:232;i:1;i:234;i:1;i:235;i:1;i:236;i:1;i:237;i:1;i:238;i:1;i:240;i:1;i:241;i:1;i:242;i:1;i:243;i:1;i:244;i:1;i:245;i:1;}s:59:"/home/bjartka/public_html/doctrine/tests/RecordTestCase.php";a:537:{i:38;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:91;i:1;i:92;i:1;i:95;i:1;i:96;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:105;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:113;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:122;i:1;i:124;i:1;i:126;i:1;i:128;i:1;i:129;i:-1;i:130;i:1;i:131;i:1;i:132;i:1;i:135;i:1;i:139;i:1;i:140;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:152;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:164;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:176;i:1;i:178;i:1;i:180;i:1;i:181;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:188;i:1;i:190;i:1;i:192;i:1;i:194;i:1;i:195;i:1;i:196;i:1;i:197;i:1;i:198;i:1;i:200;i:1;i:202;i:1;i:204;i:1;i:205;i:1;i:206;i:1;i:207;i:1;i:208;i:1;i:209;i:1;i:210;i:1;i:212;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:217;i:1;i:218;i:1;i:219;i:1;i:223;i:1;i:224;i:1;i:225;i:1;i:227;i:1;i:228;i:1;i:232;i:1;i:233;i:1;i:234;i:1;i:236;i:1;i:238;i:1;i:240;i:1;i:242;i:1;i:244;i:1;i:246;i:1;i:250;i:1;i:251;i:1;i:252;i:1;i:254;i:1;i:255;i:1;i:256;i:1;i:260;i:1;i:261;i:1;i:262;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:266;i:1;i:269;i:1;i:270;i:1;i:271;i:1;i:272;i:1;i:273;i:1;i:275;i:1;i:276;i:1;i:277;i:1;i:278;i:1;i:279;i:1;i:280;i:1;i:282;i:1;i:283;i:1;i:284;i:1;i:285;i:1;i:286;i:1;i:288;i:1;i:289;i:1;i:290;i:1;i:291;i:1;i:293;i:1;i:295;i:1;i:296;i:1;i:297;i:1;i:298;i:1;i:299;i:1;i:300;i:1;i:302;i:1;i:303;i:1;i:304;i:1;i:305;i:1;i:306;i:1;i:307;i:1;i:309;i:1;i:310;i:1;i:311;i:1;i:312;i:1;i:314;i:1;i:315;i:1;i:316;i:1;i:317;i:1;i:318;i:1;i:320;i:1;i:321;i:1;i:322;i:1;i:323;i:1;i:325;i:1;i:326;i:1;i:327;i:1;i:328;i:1;i:329;i:1;i:331;i:1;i:332;i:1;i:333;i:1;i:338;i:1;i:340;i:1;i:341;i:1;i:343;i:1;i:345;i:1;i:346;i:1;i:347;i:1;i:349;i:1;i:350;i:1;i:351;i:1;i:352;i:1;i:355;i:1;i:356;i:1;i:358;i:1;i:359;i:1;i:360;i:1;i:362;i:1;i:363;i:1;i:364;i:1;i:365;i:1;i:367;i:1;i:369;i:1;i:371;i:1;i:372;i:1;i:373;i:1;i:374;i:1;i:376;i:1;i:381;i:1;i:382;i:1;i:383;i:1;i:384;i:1;i:385;i:1;i:386;i:1;i:387;i:1;i:388;i:1;i:389;i:1;i:390;i:1;i:391;i:1;i:392;i:1;i:394;i:1;i:398;i:1;i:400;i:1;i:401;i:1;i:402;i:1;i:403;i:1;i:405;i:1;i:406;i:1;i:407;i:1;i:408;i:1;i:409;i:1;i:410;i:1;i:414;i:1;i:416;i:1;i:417;i:1;i:418;i:1;i:419;i:1;i:420;i:1;i:424;i:1;i:425;i:1;i:426;i:1;i:428;i:1;i:429;i:1;i:431;i:1;i:433;i:1;i:434;i:1;i:435;i:1;i:436;i:1;i:440;i:1;i:441;i:1;i:442;i:1;i:444;i:1;i:445;i:1;i:447;i:1;i:449;i:1;i:450;i:1;i:452;i:1;i:453;i:1;i:456;i:1;i:457;i:1;i:458;i:1;i:459;i:1;i:460;i:1;i:462;i:1;i:466;i:1;i:467;i:1;i:468;i:1;i:469;i:1;i:472;i:1;i:473;i:1;i:474;i:1;i:476;i:1;i:477;i:1;i:478;i:1;i:479;i:1;i:481;i:1;i:482;i:1;i:483;i:1;i:486;i:1;i:487;i:1;i:488;i:1;i:489;i:1;i:490;i:1;i:492;i:1;i:493;i:1;i:494;i:1;i:495;i:1;i:496;i:1;i:497;i:1;i:499;i:1;i:500;i:1;i:501;i:1;i:502;i:1;i:504;i:1;i:506;i:1;i:507;i:1;i:510;i:1;i:511;i:1;i:512;i:1;i:514;i:1;i:515;i:1;i:516;i:1;i:518;i:1;i:519;i:1;i:523;i:1;i:524;i:1;i:525;i:1;i:526;i:1;i:529;i:1;i:530;i:1;i:531;i:1;i:532;i:1;i:534;i:1;i:535;i:1;i:536;i:1;i:537;i:1;i:538;i:1;i:539;i:1;i:543;i:1;i:544;i:1;i:545;i:1;i:547;i:1;i:549;i:1;i:550;i:1;i:552;i:1;i:553;i:1;i:554;i:1;i:558;i:1;i:559;i:1;i:562;i:1;i:565;i:1;i:566;i:1;i:567;i:1;i:571;i:1;i:572;i:1;i:574;i:1;i:575;i:1;i:577;i:1;i:578;i:1;i:579;i:1;i:580;i:1;i:581;i:1;i:582;i:1;i:583;i:1;i:584;i:1;i:588;i:1;i:589;i:1;i:591;i:1;i:592;i:1;i:594;i:1;i:596;i:1;i:597;i:1;i:599;i:1;i:600;i:1;i:602;i:1;i:603;i:1;i:604;i:1;i:605;i:1;i:609;i:1;i:611;i:1;i:612;i:1;i:614;i:1;i:616;i:1;i:617;i:1;i:618;i:1;i:620;i:1;i:622;i:1;i:624;i:1;i:625;i:1;i:627;i:1;i:628;i:1;i:632;i:1;i:634;i:1;i:635;i:1;i:636;i:1;i:638;i:1;i:641;i:1;i:643;i:1;i:644;i:1;i:645;i:1;i:647;i:1;i:648;i:1;i:650;i:1;i:651;i:1;i:652;i:1;i:653;i:1;i:657;i:1;i:659;i:1;i:660;i:1;i:661;i:1;i:662;i:1;i:666;i:1;i:667;i:1;i:668;i:1;i:670;i:1;i:671;i:1;i:672;i:1;i:673;i:1;i:676;i:1;i:677;i:1;i:678;i:1;i:679;i:1;i:680;i:1;i:682;i:1;i:683;i:1;i:684;i:1;i:686;i:1;i:692;i:1;i:693;i:1;i:694;i:1;i:696;i:1;i:698;i:1;i:699;i:1;i:700;i:1;i:702;i:1;i:704;i:1;i:705;i:1;i:706;i:1;i:707;i:1;i:708;i:1;i:712;i:1;i:713;i:1;i:714;i:1;i:716;i:1;i:717;i:1;i:718;i:1;i:719;i:1;i:721;i:1;i:722;i:1;i:723;i:1;i:725;i:1;i:728;i:1;i:732;i:1;i:733;i:1;i:735;i:1;i:736;i:1;i:741;i:1;i:743;i:1;i:745;i:1;i:746;i:1;i:747;i:1;i:753;i:1;i:754;i:1;i:755;i:1;i:756;i:1;i:758;i:1;i:760;i:1;i:761;i:1;i:765;i:1;i:766;i:1;i:767;i:1;i:768;i:1;i:769;i:1;i:771;i:1;i:772;i:1;i:774;i:1;i:775;i:1;i:779;i:1;i:780;i:1;i:781;i:1;i:782;i:1;i:783;i:1;i:787;i:1;i:788;i:1;i:789;i:1;i:790;i:1;i:792;i:1;i:793;i:1;i:794;i:1;i:795;i:1;i:797;i:1;i:798;i:1;i:799;i:1;i:801;i:1;i:802;i:1;i:807;i:1;i:808;i:1;i:810;i:1;i:811;i:1;i:813;i:1;i:814;i:1;i:815;i:1;i:816;i:1;i:817;i:1;i:818;i:1;i:819;i:1;i:821;i:1;i:822;i:1;i:824;i:1;i:826;i:1;i:827;i:1;i:828;i:1;i:830;i:1;i:835;i:1;i:837;i:1;i:838;i:1;i:842;i:1;i:844;i:1;i:845;i:1;i:846;i:1;i:848;i:1;i:849;i:1;i:852;i:1;i:853;i:1;i:854;i:1;i:858;i:1;i:859;i:1;i:860;i:1;i:861;i:1;i:862;i:1;i:863;i:1;i:864;i:1;i:865;i:1;i:866;i:1;i:867;i:1;i:868;i:1;i:869;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Relation/Parser.php";a:233:{i:35;i:1;i:58;i:1;i:59;i:1;i:68;i:-1;i:69;i:-2;i:78;i:1;i:79;i:-1;i:80;i:-2;i:82;i:1;i:83;i:-2;i:87;i:1;i:88;i:1;i:89;i:-2;i:91;i:1;i:92;i:-2;i:103;i:1;i:104;i:-1;i:105;i:-1;i:114;i:1;i:115;i:1;i:116;i:1;i:118;i:1;i:119;i:1;i:120;i:-2;i:122;i:1;i:134;i:1;i:135;i:-2;i:144;i:1;i:145;i:1;i:146;i:-2;i:148;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:159;i:1;i:160;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:183;i:1;i:185;i:1;i:187;i:1;i:188;i:1;i:189;i:1;i:190;i:1;i:193;i:1;i:195;i:1;i:197;i:1;i:198;i:1;i:199;i:-2;i:200;i:-1;i:201;i:1;i:202;i:1;i:204;i:1;i:205;i:-2;i:206;i:1;i:208;i:-2;i:218;i:1;i:219;i:1;i:220;i:1;i:222;i:1;i:223;i:-2;i:235;i:1;i:237;i:1;i:238;i:1;i:240;i:1;i:241;i:1;i:242;i:-2;i:243;i:1;i:244;i:1;i:247;i:1;i:248;i:-2;i:258;i:1;i:259;i:1;i:260;i:1;i:261;i:1;i:263;i:1;i:265;i:1;i:266;i:1;i:270;i:-1;i:271;i:-1;i:272;i:1;i:276;i:1;i:277;i:1;i:278;i:1;i:280;i:1;i:284;i:1;i:286;i:1;i:287;i:1;i:288;i:1;i:291;i:1;i:293;i:1;i:294;i:1;i:296;i:1;i:297;i:-2;i:310;i:1;i:311;i:1;i:312;i:-1;i:313;i:-1;i:314;i:-1;i:315;i:-1;i:316;i:-1;i:317;i:1;i:318;i:1;i:321;i:1;i:322;i:-2;i:333;i:1;i:335;i:1;i:337;i:1;i:338;i:1;i:339;i:-2;i:341;i:1;i:342;i:1;i:344;i:1;i:345;i:1;i:346;i:-1;i:347;i:-1;i:348;i:-2;i:349;i:1;i:350;i:1;i:351;i:1;i:352;i:-2;i:353;i:-1;i:355;i:1;i:356;i:-1;i:357;i:-2;i:359;i:1;i:360;i:-2;i:372;i:1;i:373;i:1;i:374;i:1;i:376;i:1;i:377;i:1;i:379;i:1;i:380;i:1;i:381;i:1;i:382;i:1;i:384;i:1;i:385;i:1;i:389;i:1;i:390;i:1;i:391;i:1;i:394;i:1;i:395;i:1;i:397;i:1;i:398;i:1;i:399;i:1;i:400;i:1;i:401;i:1;i:403;i:1;i:404;i:1;i:407;i:1;i:408;i:1;i:410;i:1;i:411;i:1;i:412;i:-2;i:414;i:1;i:415;i:1;i:417;i:1;i:421;i:1;i:424;i:1;i:425;i:1;i:426;i:1;i:427;i:1;i:428;i:1;i:429;i:1;i:431;i:1;i:432;i:1;i:433;i:1;i:434;i:1;i:435;i:1;i:436;i:1;i:437;i:-2;i:438;i:1;i:439;i:1;i:441;i:1;i:442;i:1;i:443;i:1;i:444;i:1;i:445;i:1;i:446;i:1;i:448;i:1;i:449;i:1;i:450;i:1;i:451;i:1;i:452;i:1;i:453;i:1;i:454;i:1;i:455;i:-2;i:456;i:-1;i:457;i:-1;i:460;i:-1;i:461;i:-1;i:463;i:-1;i:464;i:-1;i:466;i:-1;i:467;i:-1;i:468;i:-1;i:470;i:-1;i:471;i:-1;i:472;i:-1;i:473;i:-1;i:474;i:-1;i:476;i:-1;i:478;i:-1;i:479;i:-1;i:480;i:-1;i:481;i:-1;i:482;i:-1;i:483;i:-1;i:485;i:-1;i:488;i:1;i:489;i:-2;i:490;i:1;}s:72:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Exception.php";a:10:{i:21;i:1;i:33;i:1;i:88;i:1;i:89;i:-2;i:99;i:-1;i:100;i:-2;i:114;i:-1;i:115;i:-1;i:116;i:-2;i:117;i:1;}s:72:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction/Firebird.php";a:51:{i:21;i:1;i:33;i:1;i:44;i:1;i:46;i:1;i:47;i:-2;i:58;i:1;i:60;i:1;i:61;i:-2;i:72;i:1;i:74;i:1;i:75;i:-2;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:112;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:140;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Export/Firebird.php";a:196:{i:21;i:1;i:35;i:1;i:45;i:1;i:47;i:1;i:48;i:-2;i:58;i:1;i:60;i:1;i:61;i:-2;i:73;i:1;i:74;i:-1;i:75;i:-1;i:76;i:-1;i:78;i:-1;i:79;i:-1;i:80;i:-1;i:81;i:-1;i:82;i:1;i:85;i:1;i:86;i:1;i:88;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:101;i:1;i:102;i:-2;i:113;i:-1;i:116;i:-1;i:117;i:-1;i:119;i:-1;i:120;i:-2;i:154;i:1;i:157;i:1;i:158;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:165;i:1;i:166;i:1;i:169;i:1;i:170;i:-2;i:171;i:1;i:172;i:1;i:182;i:-1;i:184;i:-1;i:185;i:-1;i:186;i:-1;i:187;i:-1;i:188;i:-1;i:192;i:-1;i:193;i:-1;i:194;i:-1;i:195;i:-1;i:196;i:-1;i:197;i:-1;i:198;i:-1;i:199;i:-1;i:200;i:-1;i:201;i:-1;i:202;i:-2;i:213;i:-1;i:214;i:-1;i:218;i:-1;i:219;i:-2;i:311;i:-1;i:313;i:-1;i:314;i:-1;i:315;i:-1;i:316;i:-1;i:317;i:-1;i:318;i:-1;i:319;i:-1;i:320;i:-1;i:321;i:-1;i:322;i:-1;i:323;i:-1;i:324;i:-1;i:325;i:-1;i:326;i:-1;i:327;i:-1;i:328;i:-2;i:329;i:-1;i:330;i:-1;i:331;i:-1;i:332;i:-1;i:333;i:-1;i:334;i:-1;i:335;i:-1;i:336;i:-1;i:337;i:-1;i:339;i:-1;i:340;i:-1;i:341;i:-1;i:342;i:-1;i:343;i:-1;i:344;i:-1;i:345;i:-1;i:346;i:-1;i:347;i:-1;i:349;i:-1;i:350;i:-1;i:351;i:-1;i:352;i:-1;i:353;i:-1;i:354;i:-1;i:355;i:-1;i:356;i:-1;i:357;i:-1;i:359;i:-1;i:361;i:-1;i:362;i:-1;i:363;i:-1;i:364;i:-1;i:365;i:-1;i:366;i:-1;i:367;i:-1;i:368;i:-1;i:369;i:-1;i:370;i:-1;i:372;i:-1;i:373;i:-1;i:374;i:-2;i:376;i:-1;i:377;i:-1;i:378;i:-1;i:379;i:-1;i:380;i:-2;i:415;i:-1;i:417;i:-1;i:418;i:-1;i:419;i:-1;i:420;i:-1;i:421;i:-1;i:422;i:-1;i:423;i:-1;i:424;i:-1;i:425;i:-1;i:426;i:-1;i:427;i:-1;i:428;i:-1;i:429;i:-1;i:430;i:-1;i:431;i:-1;i:432;i:-1;i:433;i:-1;i:434;i:-1;i:435;i:-1;i:436;i:-1;i:437;i:-1;i:439;i:-1;i:440;i:-2;i:465;i:1;i:467;i:1;i:468;i:-1;i:469;i:-1;i:470;i:1;i:471;i:1;i:472;i:1;i:473;i:-1;i:474;i:-1;i:475;i:1;i:476;i:1;i:477;i:-1;i:478;i:-1;i:479;i:-1;i:480;i:-1;i:482;i:1;i:483;i:1;i:484;i:1;i:485;i:1;i:486;i:1;i:487;i:1;i:489;i:1;i:490;i:-2;i:501;i:-1;i:502;i:-2;i:519;i:1;i:521;i:1;i:524;i:1;i:526;i:1;i:527;i:-2;i:529;i:-2;i:530;i:-2;i:531;i:-2;i:534;i:-2;i:535;i:-2;i:545;i:-1;i:546;i:-1;i:547;i:-1;i:549;i:-1;i:550;i:-2;i:552;i:1;}s:58:"/home/bjartka/public_html/doctrine/lib/Doctrine/Search.php";a:130:{i:33;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:79;i:1;i:81;i:1;i:83;i:1;i:84;i:-2;i:94;i:1;i:95;i:-2;i:106;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:132;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:150;i:1;i:161;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:173;i:1;i:175;i:1;i:176;i:-2;i:189;i:1;i:191;i:1;i:192;i:1;i:193;i:1;i:194;i:1;i:197;i:1;i:199;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:205;i:1;i:206;i:1;i:207;i:1;i:209;i:1;i:210;i:1;i:211;i:1;i:213;i:1;i:215;i:1;i:216;i:1;i:218;i:1;i:219;i:1;i:220;i:1;i:222;i:1;i:223;i:1;i:224;i:1;i:226;i:1;i:227;i:1;i:228;i:1;i:229;i:1;i:231;i:1;i:232;i:1;i:233;i:-2;i:235;i:1;i:244;i:1;i:245;i:1;i:246;i:-2;i:247;i:1;i:249;i:1;i:252;i:1;i:253;i:1;i:254;i:1;i:256;i:1;i:258;i:1;i:259;i:1;i:260;i:-2;i:262;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:266;i:1;i:267;i:1;i:268;i:1;i:269;i:1;i:270;i:1;i:271;i:1;i:272;i:1;i:274;i:1;i:276;i:1;i:278;i:1;i:279;i:1;i:281;i:1;i:283;i:1;i:284;i:1;i:285;i:1;i:287;i:1;i:289;i:1;i:291;i:1;i:292;i:-2;i:294;i:1;}s:56:"/home/bjartka/public_html/doctrine/lib/Doctrine/I18n.php";a:36:{i:33;i:1;i:52;i:1;i:53;i:1;i:63;i:1;i:64;i:-1;i:65;i:-2;i:67;i:1;i:69;i:1;i:71;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:106;i:1;i:108;i:1;i:110;i:1;i:111;i:-2;i:113;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Range.php";a:10:{i:34;i:1;i:43;i:1;i:44;i:1;i:45;i:-2;i:46;i:-1;i:47;i:-1;i:48;i:-2;i:49;i:-1;i:50;i:-2;i:51;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Notblank.php";a:4:{i:33;i:1;i:44;i:1;i:45;i:-2;i:46;i:1;}s:51:"/home/bjartka/public_html/doctrine/lib/Doctrine.php";a:261:{i:0;i:1;i:470;i:-1;i:471;i:-2;i:481;i:-1;i:482;i:-1;i:483;i:-1;i:485;i:-1;i:486;i:-2;i:496;i:1;i:497;i:-1;i:498;i:-1;i:500;i:1;i:501;i:-2;i:513;i:1;i:514;i:1;i:516;i:1;i:517;i:1;i:518;i:1;i:519;i:1;i:520;i:1;i:521;i:1;i:522;i:1;i:523;i:1;i:524;i:1;i:525;i:1;i:526;i:1;i:528;i:1;i:529;i:-2;i:544;i:1;i:545;i:1;i:546;i:1;i:547;i:1;i:549;i:1;i:551;i:1;i:553;i:1;i:554;i:1;i:555;i:1;i:556;i:1;i:557;i:1;i:558;i:1;i:562;i:-2;i:564;i:-2;i:565;i:-2;i:567;i:-2;i:568;i:-2;i:569;i:-2;i:570;i:-2;i:571;i:-2;i:572;i:-2;i:573;i:-2;i:574;i:-2;i:575;i:-2;i:576;i:-2;i:577;i:-2;i:579;i:-2;i:582;i:1;i:583;i:1;i:584;i:-2;i:597;i:1;i:602;i:1;i:603;i:1;i:604;i:1;i:605;i:1;i:606;i:-2;i:607;i:1;i:608;i:1;i:609;i:-2;i:622;i:1;i:624;i:1;i:625;i:1;i:626;i:1;i:628;i:1;i:629;i:1;i:630;i:-2;i:631;i:1;i:633;i:-1;i:634;i:-2;i:648;i:-1;i:649;i:-2;i:662;i:-1;i:664;i:-1;i:666;i:-1;i:668;i:-1;i:670;i:-1;i:672;i:-1;i:673;i:-2;i:687;i:-1;i:688;i:-1;i:690;i:-1;i:691;i:-2;i:703;i:1;i:704;i:-2;i:716;i:-1;i:717;i:-2;i:727;i:-1;i:729;i:-1;i:730;i:-1;i:731;i:-1;i:732;i:-1;i:734;i:-1;i:735;i:-2;i:748;i:-1;i:750;i:-1;i:751;i:-2;i:763;i:-1;i:764;i:-1;i:765;i:-1;i:767;i:-1;i:768;i:-1;i:770;i:-1;i:772;i:-1;i:773;i:-1;i:774;i:-1;i:775;i:-2;i:777;i:-1;i:778;i:-1;i:779;i:-1;i:782;i:-1;i:786;i:-1;i:789;i:-1;i:792;i:-1;i:795;i:-1;i:797;i:-1;i:798;i:-1;i:799;i:-2;i:801;i:-1;i:803;i:-1;i:804;i:-2;i:816;i:-1;i:817;i:-1;i:818;i:-1;i:820;i:-1;i:822;i:-1;i:824;i:-1;i:826;i:-1;i:827;i:-1;i:828;i:-1;i:829;i:-2;i:832;i:-1;i:834;i:-1;i:835;i:-1;i:836;i:-2;i:838;i:-1;i:840;i:-1;i:841;i:-2;i:854;i:-1;i:856;i:-1;i:857;i:-2;i:871;i:-1;i:873;i:-1;i:874;i:-1;i:875;i:-1;i:877;i:-1;i:878;i:-2;i:892;i:-1;i:894;i:-1;i:895;i:-2;i:907;i:-1;i:909;i:-1;i:910;i:-2;i:921;i:-1;i:923;i:-1;i:924;i:-2;i:935;i:-1;i:937;i:-1;i:938;i:-2;i:948;i:-1;i:949;i:-2;i:959;i:-1;i:960;i:-2;i:976;i:-1;i:977;i:-2;i:990;i:1;i:991;i:1;i:992;i:-2;i:994;i:1;i:995;i:-1;i:996;i:-1;i:998;i:1;i:1000;i:1;i:1001;i:1;i:1003;i:1;i:1004;i:-2;i:1006;i:1;i:1008;i:1;i:1009;i:1;i:1011;i:1;i:1012;i:-2;i:1014;i:1;i:1015;i:-2;i:1029;i:-1;i:1030;i:-1;i:1031;i:-1;i:1032;i:-1;i:1033;i:-1;i:1034;i:-1;i:1036;i:-1;i:1037;i:-1;i:1038;i:-1;i:1039;i:-1;i:1040;i:-1;i:1041;i:-1;i:1042;i:-1;i:1043;i:-1;i:1044;i:-1;i:1045;i:-1;i:1046;i:-1;i:1047;i:-1;i:1048;i:-1;i:1049;i:-1;i:1050;i:-1;i:1051;i:-2;i:1063;i:1;i:1064;i:-2;i:1076;i:1;i:1077;i:-2;i:1089;i:1;i:1090;i:-2;i:1102;i:-1;i:1103;i:-1;i:1104;i:-2;i:1106;i:-1;i:1107;i:-2;i:1119;i:1;i:1120;i:-1;i:1121;i:-2;i:1123;i:1;i:1124;i:1;i:1125;i:-2;i:1127;i:-1;i:1128;i:-2;i:1138;i:-1;i:1139;i:-1;i:1140;i:-1;i:1141;i:-2;i:1143;i:-1;i:1145;i:-1;i:1146;i:-1;i:1147;i:-1;i:1149;i:-1;i:1150;i:-1;i:1151;i:-1;i:1152;i:-1;i:1153;i:-1;i:1154;i:-1;i:1155;i:-1;i:1157;i:-1;i:1158;i:-2;i:1169;i:1;i:1170;i:1;i:1172;i:1;i:1173;i:1;i:1174;i:1;i:1176;i:1;i:1177;i:1;i:1179;i:1;i:1180;i:1;i:1181;i:1;i:1182;i:1;i:1184;i:1;i:1185;i:-2;}s:63:"/home/bjartka/public_html/doctrine/models/TestMovieUserVote.php";a:4:{i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/RTC2.php";a:4:{i:4;i:-1;i:5;i:-1;i:7;i:-1;i:8;i:-1;}s:53:"/home/bjartka/public_html/doctrine/models/MyUser2.php";a:13:{i:6;i:-1;i:8;i:-1;i:9;i:-1;i:10;i:-1;i:11;i:-1;i:12;i:-1;i:13;i:-1;i:14;i:-1;i:15;i:-1;i:16;i:-1;i:17;i:-1;i:21;i:-1;i:22;i:-1;}s:61:"/home/bjartka/public_html/doctrine/models/QueryTest_Entry.php";a:7:{i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:20;i:1;i:21;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/EnumTest2.php";a:3:{i:5;i:1;i:6;i:1;i:7;i:1;}s:51:"/home/bjartka/public_html/doctrine/models/Album.php";a:8:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:13;i:1;i:14;i:1;i:15;i:1;}s:62:"/home/bjartka/public_html/doctrine/tests/MigrationTestCase.php";a:7:{i:38;i:1;i:41;i:1;i:44;i:1;i:46;i:1;i:49;i:1;i:52;i:1;i:53;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Sqlite.php";a:40:{i:22;i:1;i:36;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:88;i:1;i:89;i:1;i:90;i:-2;i:92;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:108;i:1;i:109;i:-2;i:111;i:1;}s:60:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hydrator.php";a:159:{i:35;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:69;i:-2;i:71;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:81;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:89;i:1;i:91;i:1;i:93;i:1;i:95;i:1;i:97;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:-1;i:106;i:-2;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:139;i:1;i:140;i:1;i:141;i:-1;i:142;i:1;i:143;i:-1;i:144;i:-2;i:145;i:1;i:146;i:1;i:147;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:155;i:1;i:156;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:173;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:179;i:1;i:181;i:1;i:182;i:1;i:183;i:-2;i:186;i:1;i:188;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:193;i:1;i:194;i:1;i:195;i:-1;i:196;i:1;i:197;i:-1;i:198;i:-2;i:199;i:1;i:200;i:1;i:201;i:1;i:204;i:1;i:205;i:1;i:206;i:1;i:208;i:1;i:210;i:1;i:211;i:1;i:213;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:217;i:1;i:220;i:1;i:221;i:1;i:222;i:1;i:223;i:1;i:224;i:1;i:225;i:1;i:227;i:1;i:229;i:1;i:234;i:1;i:235;i:-2;i:249;i:1;i:250;i:1;i:251;i:-2;i:253;i:1;i:256;i:1;i:257;i:1;i:258;i:-2;i:260;i:1;i:261;i:1;i:262;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:267;i:1;i:268;i:1;i:269;i:1;i:270;i:1;i:271;i:1;i:272;i:1;i:284;i:1;i:286;i:1;i:288;i:1;i:289;i:1;i:290;i:1;i:291;i:1;i:292;i:1;i:293;i:1;i:294;i:1;i:296;i:1;i:297;i:1;i:298;i:1;i:299;i:1;i:301;i:1;i:302;i:1;i:303;i:1;i:305;i:1;i:306;i:1;i:307;i:1;i:309;i:1;i:311;i:1;i:312;i:1;i:313;i:1;i:314;i:1;i:316;i:1;i:317;i:-2;i:327;i:1;i:328;i:-2;i:331;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Oracle.php";a:43:{i:21;i:1;i:33;i:1;i:42;i:-1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:71;i:1;i:72;i:1;i:80;i:-1;i:81;i:-1;i:98;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:-1;i:103;i:-1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:-2;i:118;i:1;}s:72:"/home/bjartka/public_html/doctrine/lib/Doctrine/Template/Versionable.php";a:10:{i:33;i:1;i:37;i:1;i:38;i:1;i:41;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:50;i:-2;i:53;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Driver.php";a:23:{i:0;i:1;i:34;i:1;i:48;i:-1;i:49;i:-1;i:50;i:-2;i:51;i:-1;i:52;i:-2;i:61;i:-1;i:62;i:-2;i:73;i:1;i:75;i:1;i:76;i:-2;i:86;i:-1;i:87;i:-1;i:88;i:-2;i:90;i:-1;i:91;i:-2;i:102;i:-1;i:104;i:-1;i:105;i:-2;i:114;i:-1;i:115;i:-2;i:116;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/ORM_AccessGroup.php";a:4:{i:6;i:1;i:7;i:1;i:10;i:1;i:11;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/SymfonyRecord.php";a:4:{i:9;i:1;i:10;i:1;i:14;i:1;i:15;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/RTC1.php";a:4:{i:4;i:-1;i:5;i:-1;i:7;i:-1;i:8;i:-1;}s:50:"/home/bjartka/public_html/doctrine/models/Role.php";a:4:{i:6;i:1;i:7;i:1;i:10;i:1;i:11;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/Record_District.php";a:2:{i:4;i:1;i:5;i:1;}s:53:"/home/bjartka/public_html/doctrine/models/BlogTag.php";a:5:{i:6;i:-1;i:7;i:-1;i:8;i:-1;i:11;i:-1;i:12;i:-1;}s:70:"/home/bjartka/public_html/doctrine/tests/Connection/OracleTestCase.php";a:54:{i:35;i:1;i:37;i:1;i:38;i:1;i:40;i:1;i:42;i:1;i:43;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:112;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:118;i:1;i:120;i:1;i:122;i:1;i:123;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Connection/SqliteTestCase.php";a:33:{i:35;i:1;i:37;i:1;i:38;i:1;i:40;i:1;i:42;i:1;i:43;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:88;i:1;}s:73:"/home/bjartka/public_html/doctrine/tests/Query/AggregateValueTestCase.php";a:101:{i:37;i:1;i:40;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:59;i:1;i:62;i:1;i:63;i:-1;i:64;i:1;i:65;i:1;i:68;i:1;i:71;i:1;i:72;i:1;i:73;i:-2;i:75;i:1;i:76;i:1;i:80;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:87;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:130;i:1;i:132;i:1;i:134;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:146;i:1;i:148;i:1;i:150;i:1;i:151;i:1;i:153;i:1;i:154;i:1;i:158;i:1;i:160;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:168;i:1;i:170;i:1;i:172;i:1;i:174;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:182;i:1;i:183;i:1;i:185;i:1;i:186;i:1;i:189;i:1;i:190;i:1;i:192;i:1;i:193;i:1;i:196;i:1;i:197;i:1;i:199;i:1;i:200;i:1;i:203;i:1;i:204;i:1;i:206;i:1;i:207;i:1;i:210;i:1;i:211;i:1;i:212;i:1;i:214;i:1;i:215;i:1;}s:57:"/home/bjartka/public_html/doctrine/lib/Doctrine/Event.php";a:87:{i:0;i:1;i:34;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:127;i:1;i:128;i:-2;i:138;i:-1;i:139;i:-1;i:140;i:-1;i:141;i:-1;i:142;i:-1;i:143;i:-1;i:144;i:-1;i:145;i:-1;i:146;i:-1;i:147;i:-1;i:148;i:-1;i:149;i:-1;i:150;i:-1;i:152;i:-1;i:153;i:-1;i:154;i:-1;i:155;i:-1;i:156;i:-1;i:157;i:-1;i:159;i:-1;i:160;i:-1;i:161;i:-1;i:162;i:-1;i:163;i:-1;i:164;i:-1;i:166;i:-1;i:167;i:-1;i:168;i:-1;i:169;i:-1;i:170;i:-1;i:171;i:-1;i:173;i:-1;i:174;i:-1;i:175;i:-1;i:176;i:-1;i:177;i:-1;i:178;i:-1;i:179;i:-1;i:180;i:-1;i:181;i:-1;i:182;i:-1;i:183;i:-1;i:184;i:-1;i:185;i:-1;i:186;i:-1;i:195;i:1;i:196;i:-2;i:207;i:1;i:208;i:1;i:209;i:-2;i:211;i:1;i:212;i:-2;i:223;i:1;i:225;i:1;i:226;i:-2;i:238;i:1;i:240;i:1;i:241;i:-2;i:253;i:1;i:255;i:1;i:256;i:-2;i:266;i:1;i:267;i:1;i:277;i:1;i:278;i:-2;i:288;i:1;i:290;i:1;i:291;i:-2;i:302;i:1;i:303;i:-2;i:313;i:-1;i:314;i:-2;i:324;i:1;i:325;i:-1;i:326;i:-2;i:327;i:1;i:328;i:-2;i:330;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Regexp.php";a:18:{i:34;i:1;i:44;i:1;i:45;i:-1;i:46;i:-2;i:47;i:1;i:48;i:-1;i:49;i:-1;i:50;i:-1;i:51;i:-2;i:52;i:-1;i:53;i:-1;i:54;i:-2;i:55;i:1;i:56;i:1;i:57;i:-2;i:60;i:1;i:61;i:-2;i:62;i:1;}s:74:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record/Filter/Compound.php";a:36:{i:33;i:1;i:39;i:1;i:40;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:-2;i:64;i:-1;i:66;i:-1;i:67;i:-1;i:68;i:-1;i:69;i:-1;i:71;i:-1;i:72;i:-2;i:74;i:-1;i:75;i:-1;i:85;i:1;i:86;i:1;i:87;i:-1;i:88;i:-1;i:89;i:-2;i:90;i:-1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:-2;i:96;i:-1;i:98;i:-1;i:99;i:-1;i:100;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Tree/Interface.php";a:2:{i:33;i:1;i:65;i:1;}s:61:"/home/bjartka/public_html/doctrine/lib/Doctrine/Migration.php";a:171:{i:36;i:1;i:66;i:1;i:67;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:82;i:-1;i:83;i:-2;i:93;i:-1;i:94;i:-1;i:95;i:-1;i:106;i:1;i:109;i:1;i:111;i:1;i:112;i:-2;i:113;i:-2;i:115;i:-2;i:126;i:1;i:127;i:1;i:128;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:157;i:1;i:158;i:1;i:159;i:-2;i:161;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:168;i:1;i:170;i:1;i:171;i:1;i:173;i:1;i:175;i:1;i:176;i:1;i:177;i:-1;i:178;i:-2;i:179;i:1;i:181;i:1;i:182;i:-1;i:183;i:-2;i:185;i:1;i:186;i:1;i:188;i:1;i:189;i:1;i:191;i:1;i:192;i:-2;i:201;i:-1;i:202;i:-2;i:214;i:1;i:216;i:1;i:217;i:1;i:218;i:1;i:219;i:1;i:221;i:1;i:232;i:1;i:234;i:1;i:236;i:1;i:237;i:-2;i:248;i:1;i:250;i:1;i:252;i:1;i:253;i:-2;i:264;i:1;i:266;i:1;i:267;i:1;i:268;i:1;i:269;i:1;i:271;i:1;i:273;i:1;i:274;i:-2;i:283;i:-1;i:284;i:-2;i:296;i:1;i:297;i:1;i:299;i:1;i:300;i:1;i:301;i:-2;i:302;i:-1;i:304;i:-1;i:305;i:-2;i:318;i:1;i:320;i:1;i:321;i:1;i:333;i:1;i:334;i:-1;i:335;i:-2;i:336;i:1;i:338;i:1;i:339;i:1;i:340;i:1;i:342;i:1;i:343;i:1;i:344;i:1;i:345;i:1;i:346;i:1;i:360;i:1;i:363;i:1;i:364;i:-1;i:365;i:-1;i:367;i:1;i:368;i:-1;i:369;i:-2;i:371;i:1;i:373;i:1;i:374;i:1;i:375;i:1;i:376;i:1;i:377;i:1;i:378;i:1;i:379;i:1;i:380;i:1;i:383;i:1;i:385;i:1;i:386;i:-2;i:397;i:1;i:398;i:1;i:410;i:1;i:412;i:1;i:413;i:1;i:423;i:1;i:425;i:1;i:426;i:1;i:437;i:-1;i:439;i:-1;i:440;i:-1;i:451;i:-1;i:453;i:-1;i:454;i:-1;i:465;i:-1;i:467;i:-1;i:468;i:-1;i:479;i:-1;i:481;i:-1;i:482;i:-1;i:493;i:-1;i:495;i:-1;i:496;i:-1;i:509;i:1;i:511;i:1;i:512;i:1;i:524;i:-1;i:526;i:-1;i:527;i:-1;i:540;i:-1;i:542;i:-1;i:543;i:-1;i:554;i:-1;i:556;i:-1;i:557;i:-1;i:569;i:-1;i:571;i:-1;i:572;i:-1;i:583;i:-1;i:585;i:-1;i:586;i:-1;i:588;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/DoctrineTest/Reporter.php";a:2:{i:9;i:1;i:10;i:1;}s:58:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record.php";a:673:{i:0;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:152;i:1;i:153;i:1;i:159;i:1;i:160;i:1;i:161;i:-2;i:163;i:1;i:165;i:1;i:168;i:1;i:171;i:1;i:173;i:1;i:175;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:194;i:1;i:196;i:1;i:197;i:1;i:199;i:1;i:201;i:1;i:210;i:-1;i:211;i:-2;i:221;i:1;i:230;i:1;i:239;i:1;i:240;i:-2;i:243;i:-1;i:244;i:-2;i:253;i:1;i:254;i:1;i:255;i:-2;i:257;i:1;i:260;i:1;i:261;i:1;i:262;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:266;i:1;i:269;i:1;i:270;i:-2;i:278;i:1;i:285;i:1;i:292;i:1;i:298;i:1;i:304;i:1;i:310;i:1;i:316;i:1;i:322;i:1;i:328;i:1;i:334;i:1;i:340;i:1;i:347;i:1;i:354;i:1;i:361;i:1;i:368;i:1;i:376;i:1;i:377;i:-2;i:388;i:1;i:389;i:-1;i:390;i:-1;i:391;i:-2;i:392;i:-1;i:393;i:-1;i:394;i:1;i:396;i:-1;i:407;i:1;i:408;i:1;i:409;i:-2;i:410;i:1;i:411;i:1;i:413;i:1;i:414;i:1;i:415;i:-2;i:417;i:1;i:418;i:1;i:419;i:1;i:420;i:1;i:421;i:1;i:422;i:1;i:423;i:1;i:434;i:1;i:435;i:1;i:437;i:1;i:438;i:1;i:439;i:1;i:440;i:1;i:441;i:1;i:443;i:1;i:444;i:1;i:446;i:1;i:447;i:-2;i:458;i:1;i:459;i:1;i:460;i:1;i:461;i:1;i:472;i:1;i:473;i:1;i:474;i:1;i:475;i:1;i:476;i:1;i:477;i:1;i:478;i:1;i:479;i:1;i:480;i:1;i:481;i:1;i:482;i:1;i:483;i:1;i:484;i:1;i:485;i:1;i:486;i:1;i:487;i:1;i:489;i:1;i:490;i:1;i:491;i:1;i:492;i:1;i:493;i:1;i:495;i:1;i:496;i:1;i:497;i:-1;i:498;i:1;i:508;i:1;i:510;i:1;i:512;i:1;i:514;i:1;i:515;i:1;i:516;i:1;i:517;i:1;i:518;i:1;i:520;i:1;i:521;i:1;i:523;i:1;i:524;i:1;i:525;i:-1;i:526;i:1;i:527;i:1;i:528;i:1;i:529;i:1;i:530;i:1;i:531;i:1;i:532;i:1;i:533;i:1;i:534;i:1;i:535;i:1;i:536;i:1;i:537;i:1;i:538;i:1;i:539;i:1;i:540;i:-1;i:542;i:1;i:544;i:1;i:546;i:1;i:548;i:1;i:549;i:-2;i:561;i:1;i:563;i:1;i:565;i:1;i:566;i:1;i:568;i:1;i:569;i:1;i:571;i:1;i:573;i:1;i:575;i:1;i:576;i:1;i:577;i:1;i:579;i:1;i:581;i:1;i:582;i:1;i:583;i:1;i:584;i:1;i:585;i:1;i:586;i:1;i:587;i:1;i:588;i:1;i:589;i:1;i:590;i:1;i:591;i:1;i:593;i:-1;i:594;i:1;i:596;i:1;i:598;i:1;i:600;i:1;i:602;i:1;i:603;i:1;i:617;i:1;i:618;i:1;i:619;i:-2;i:620;i:1;i:621;i:1;i:622;i:1;i:623;i:1;i:624;i:1;i:625;i:-1;i:627;i:1;i:628;i:-1;i:630;i:-1;i:631;i:-1;i:632;i:-1;i:633;i:-1;i:634;i:-1;i:636;i:-1;i:638;i:1;i:639;i:1;i:640;i:1;i:641;i:1;i:643;i:1;i:644;i:-1;i:645;i:-2;i:646;i:1;i:658;i:1;i:659;i:1;i:660;i:-1;i:661;i:-1;i:662;i:1;i:663;i:-1;i:664;i:-2;i:665;i:1;i:668;i:1;i:670;i:1;i:671;i:1;i:672;i:-2;i:674;i:1;i:676;i:1;i:678;i:1;i:680;i:1;i:682;i:1;i:683;i:-2;i:696;i:1;i:697;i:1;i:698;i:1;i:699;i:1;i:700;i:1;i:701;i:1;i:702;i:1;i:704;i:1;i:714;i:1;i:715;i:1;i:725;i:1;i:726;i:-2;i:736;i:1;i:737;i:-2;i:750;i:1;i:751;i:-1;i:752;i:-2;i:753;i:1;i:754;i:-1;i:755;i:-2;i:757;i:1;i:758;i:-2;i:769;i:1;i:770;i:-1;i:771;i:-1;i:772;i:-1;i:773;i:-2;i:774;i:1;i:775;i:-2;i:788;i:1;i:790;i:1;i:792;i:1;i:793;i:1;i:794;i:1;i:796;i:1;i:797;i:1;i:798;i:1;i:799;i:1;i:801;i:1;i:802;i:-2;i:804;i:1;i:805;i:1;i:806;i:-2;i:809;i:1;i:811;i:1;i:813;i:1;i:814;i:1;i:815;i:1;i:817;i:1;i:818;i:1;i:819;i:1;i:820;i:1;i:821;i:-2;i:822;i:-2;i:824;i:-2;i:838;i:1;i:839;i:1;i:857;i:1;i:858;i:1;i:859;i:1;i:861;i:1;i:863;i:1;i:864;i:1;i:865;i:1;i:866;i:1;i:868;i:1;i:869;i:1;i:870;i:1;i:871;i:1;i:874;i:1;i:875;i:1;i:876;i:1;i:877;i:1;i:879;i:1;i:880;i:1;i:881;i:1;i:882;i:1;i:883;i:1;i:884;i:1;i:885;i:1;i:886;i:1;i:887;i:1;i:888;i:-1;i:889;i:1;i:890;i:1;i:892;i:1;i:893;i:1;i:894;i:1;i:895;i:1;i:896;i:1;i:897;i:-2;i:898;i:-2;i:901;i:1;i:909;i:1;i:912;i:1;i:913;i:1;i:914;i:1;i:916;i:1;i:917;i:-1;i:918;i:-2;i:919;i:1;i:920;i:1;i:921;i:1;i:922;i:-2;i:923;i:-1;i:924;i:1;i:925;i:1;i:926;i:1;i:927;i:1;i:930;i:1;i:931;i:-1;i:932;i:-2;i:933;i:1;i:934;i:1;i:935;i:1;i:936;i:1;i:937;i:1;i:939;i:1;i:940;i:1;i:942;i:1;i:945;i:1;i:947;i:1;i:948;i:-1;i:949;i:-2;i:950;i:1;i:952;i:1;i:953;i:1;i:963;i:1;i:964;i:1;i:965;i:-2;i:966;i:1;i:967;i:-1;i:968;i:-2;i:969;i:1;i:970;i:-1;i:971;i:-2;i:972;i:1;i:973;i:1;i:975;i:1;i:976;i:-2;i:977;i:1;i:978;i:-2;i:986;i:-1;i:987;i:-1;i:988;i:-1;i:990;i:-1;i:1004;i:1;i:1005;i:1;i:1006;i:1;i:1007;i:1;i:1008;i:1;i:1021;i:1;i:1022;i:1;i:1023;i:1;i:1024;i:1;i:1026;i:-2;i:1048;i:-1;i:1049;i:-1;i:1050;i:-1;i:1052;i:-1;i:1053;i:-2;i:1062;i:1;i:1064;i:1;i:1065;i:1;i:1066;i:1;i:1067;i:1;i:1068;i:-2;i:1075;i:-1;i:1077;i:-1;i:1078;i:-1;i:1079;i:-1;i:1080;i:-1;i:1081;i:-2;i:1095;i:1;i:1097;i:1;i:1098;i:1;i:1099;i:1;i:1101;i:1;i:1102;i:1;i:1104;i:1;i:1105;i:1;i:1106;i:1;i:1107;i:-2;i:1110;i:1;i:1111;i:1;i:1112;i:1;i:1113;i:1;i:1114;i:1;i:1115;i:1;i:1116;i:1;i:1117;i:1;i:1118;i:1;i:1119;i:1;i:1120;i:1;i:1121;i:1;i:1122;i:1;i:1123;i:1;i:1124;i:1;i:1125;i:1;i:1126;i:1;i:1133;i:1;i:1134;i:1;i:1135;i:1;i:1136;i:1;i:1137;i:1;i:1138;i:1;i:1140;i:1;i:1141;i:1;i:1142;i:1;i:1143;i:1;i:1144;i:1;i:1146;i:1;i:1147;i:-2;i:1157;i:1;i:1158;i:-2;i:1167;i:-1;i:1168;i:-2;i:1179;i:1;i:1181;i:1;i:1182;i:1;i:1183;i:1;i:1184;i:1;i:1185;i:1;i:1186;i:1;i:1187;i:1;i:1188;i:1;i:1189;i:1;i:1190;i:1;i:1191;i:1;i:1192;i:-1;i:1193;i:-1;i:1194;i:-1;i:1195;i:-1;i:1196;i:-1;i:1197;i:-1;i:1198;i:1;i:1199;i:-2;i:1202;i:1;i:1203;i:1;i:1204;i:1;i:1205;i:-1;i:1206;i:1;i:1207;i:1;i:1208;i:1;i:1209;i:1;i:1210;i:1;i:1211;i:1;i:1214;i:-1;i:1215;i:-1;i:1216;i:-2;i:1217;i:-1;i:1219;i:-2;i:1222;i:-1;i:1223;i:-1;i:1224;i:-2;i:1225;i:-1;i:1227;i:-2;i:1237;i:1;i:1238;i:1;i:1239;i:-2;i:1249;i:1;i:1250;i:1;i:1251;i:-2;i:1260;i:-1;i:1261;i:-1;i:1262;i:-2;i:1263;i:-1;i:1264;i:-2;i:1272;i:1;i:1273;i:-2;i:1285;i:1;i:1286;i:1;i:1287;i:1;i:1288;i:1;i:1289;i:-2;i:1299;i:1;i:1301;i:1;i:1302;i:1;i:1304;i:1;i:1305;i:1;i:1307;i:1;i:1308;i:1;i:1310;i:1;i:1311;i:1;i:1312;i:1;i:1313;i:1;i:1314;i:1;i:1316;i:1;i:1317;i:-2;i:1326;i:-1;i:1328;i:-1;i:1329;i:-1;i:1330;i:-1;i:1331;i:-1;i:1332;i:-1;i:1333;i:-1;i:1334;i:-1;i:1336;i:-1;i:1337;i:-1;i:1338;i:-2;i:1348;i:1;i:1349;i:-1;i:1350;i:-1;i:1351;i:-1;i:1352;i:-1;i:1353;i:1;i:1354;i:1;i:1355;i:1;i:1356;i:1;i:1357;i:1;i:1358;i:1;i:1359;i:1;i:1360;i:1;i:1361;i:1;i:1362;i:1;i:1364;i:1;i:1373;i:1;i:1374;i:-2;i:1384;i:1;i:1385;i:1;i:1386;i:1;i:1387;i:-2;i:1389;i:1;i:1390;i:-2;i:1402;i:1;i:1403;i:-2;i:1412;i:1;i:1413;i:-2;i:1422;i:1;i:1423;i:1;i:1424;i:-2;i:1425;i:-1;i:1435;i:-1;i:1436;i:-1;i:1437;i:-2;i:1438;i:-1;i:1439;i:-2;i:1447;i:1;i:1448;i:-2;i:1458;i:-1;i:1459;i:-1;i:1471;i:-1;i:1472;i:-1;i:1473;i:-1;i:1484;i:1;i:1486;i:1;i:1487;i:1;i:1488;i:1;i:1489;i:1;i:1492;i:1;i:1493;i:1;i:1505;i:1;i:1506;i:1;i:1508;i:1;i:1509;i:1;i:1510;i:1;i:1512;i:1;i:1514;i:1;i:1515;i:1;i:1516;i:1;i:1517;i:-2;i:1526;i:1;i:1527;i:-1;i:1528;i:-2;i:1530;i:1;i:1531;i:1;i:1532;i:1;i:1533;i:1;i:1534;i:1;i:1535;i:1;i:1537;i:1;i:1538;i:-2;i:1550;i:1;i:1551;i:1;i:1552;i:1;i:1553;i:1;i:1555;i:1;i:1556;i:1;i:1557;i:-2;i:1559;i:1;i:1561;i:1;i:1562;i:-2;i:1565;i:1;i:1566;i:-2;i:1578;i:1;i:1580;i:1;i:1582;i:1;i:1584;i:1;i:1585;i:1;i:1586;i:1;i:1587;i:1;i:1589;i:1;i:1590;i:1;i:1591;i:1;i:1593;i:1;i:1595;i:1;i:1596;i:1;i:1597;i:1;i:1598;i:1;i:1600;i:1;i:1601;i:1;i:1602;i:1;i:1604;i:1;i:1605;i:1;i:1606;i:1;i:1607;i:1;i:1608;i:1;i:1609;i:1;i:1610;i:1;i:1611;i:1;i:1612;i:1;i:1613;i:1;i:1614;i:1;i:1615;i:-2;i:1632;i:1;i:1633;i:-1;i:1634;i:-1;i:1635;i:-2;i:1637;i:1;i:1638;i:1;i:1639;i:1;i:1640;i:1;i:1642;i:1;i:1643;i:-2;i:1644;i:-1;i:1646;i:-1;i:1647;i:-2;i:1654;i:-1;i:1655;i:-1;i:1658;i:-1;i:1659;i:-2;i:1666;i:-1;i:1667;i:-2;}s:50:"/home/bjartka/public_html/doctrine/models/Song.php";a:8:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/Record_City.php";a:7:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:9;i:1;i:10;i:1;i:11;i:1;}s:62:"/home/bjartka/public_html/doctrine/models/MysqlGroupMember.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:74:"/home/bjartka/public_html/doctrine/models/ValidatorTest_FootballPlayer.php";a:4:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;}s:52:"/home/bjartka/public_html/doctrine/models/Author.php";a:7:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:12;i:1;i:13;i:1;i:14;i:1;}s:65:"/home/bjartka/public_html/doctrine/models/CheckConstraintTest.php";a:4:{i:6;i:-1;i:7;i:-1;i:8;i:-1;i:9;i:-1;}s:60:"/home/bjartka/public_html/doctrine/models/QueryTest_Rank.php";a:9:{i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:18;i:1;i:19;i:1;}s:73:"/home/bjartka/public_html/doctrine/tests/Transaction/FirebirdTestCase.php";a:44:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:57;i:1;i:58;i:-1;i:59;i:1;i:60;i:1;i:62;i:1;i:66;i:1;i:67;i:-1;i:68;i:1;i:69;i:1;i:71;i:1;i:75;i:1;i:76;i:-1;i:77;i:1;i:78;i:1;i:80;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:95;i:1;i:97;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:105;i:1;i:107;i:1;i:109;i:1;i:111;i:1;i:112;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/Export/FirebirdTestCase.php";a:30:{i:38;i:1;i:39;i:-1;i:40;i:1;i:41;i:1;i:43;i:1;i:47;i:1;i:48;i:-1;i:49;i:1;i:50;i:1;i:52;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:85;i:1;}s:63:"/home/bjartka/public_html/doctrine/tests/UnitOfWorkTestCase.php";a:77:{i:43;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:137;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/Relation/ParserTestCase.php";a:99:{i:37;i:1;i:39;i:1;i:40;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:57;i:-1;i:58;i:1;i:59;i:1;i:61;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:80;i:1;i:81;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:115;i:1;i:117;i:1;i:118;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:125;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:132;i:1;i:133;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:151;i:1;i:153;i:1;i:155;i:1;i:156;i:1;i:159;i:1;i:160;i:1;i:162;i:1;i:164;i:1;i:166;i:1;i:167;i:1;i:170;i:1;i:171;i:1;i:172;i:1;i:174;i:1;i:176;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:188;i:1;i:190;i:1;i:192;i:1;i:193;i:1;i:195;i:1;i:196;i:1;i:197;i:1;}s:57:"/home/bjartka/public_html/doctrine/tests/I18nTestCase.php";a:48:{i:37;i:1;i:41;i:1;i:43;i:1;i:44;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:112;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:121;i:1;i:123;i:1;i:124;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/Query/MultiJoinTestCase.php";a:107:{i:37;i:1;i:38;i:1;i:39;i:1;i:40;i:1;i:44;i:1;i:46;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:59;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:83;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:90;i:1;i:92;i:1;i:94;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:116;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:145;i:1;i:146;i:1;i:149;i:1;i:151;i:1;i:153;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:188;i:1;i:190;i:1;i:191;i:1;}s:78:"/home/bjartka/public_html/doctrine/tests/Query/MysqlSubqueryHavingTestCase.php";a:25:{i:37;i:1;i:38;i:1;i:39;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;}s:71:"/home/bjartka/public_html/doctrine/tests/Record/InheritanceTestCase.php";a:18:{i:24;i:1;i:25;i:1;i:26;i:1;i:29;i:1;i:30;i:1;i:34;i:1;i:35;i:1;i:36;i:1;i:37;i:1;i:42;i:1;i:43;i:1;i:46;i:1;i:47;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:55;i:1;i:58;i:1;}s:59:"/home/bjartka/public_html/doctrine/tests/SearchTestCase.php";a:81:{i:37;i:1;i:39;i:1;i:40;i:1;i:42;i:1;i:46;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:109;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:116;i:1;i:118;i:1;i:119;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:127;i:1;i:128;i:1;i:130;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:147;i:1;i:148;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:155;i:1;i:158;i:1;i:163;i:1;i:164;i:-1;i:165;i:1;i:166;i:1;i:168;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Select.php";a:5:{i:21;i:1;i:33;i:1;i:37;i:1;i:38;i:1;i:39;i:1;}s:56:"/home/bjartka/public_html/doctrine/lib/Doctrine/View.php";a:26:{i:36;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:88;i:1;i:89;i:-2;i:99;i:1;i:100;i:-2;i:110;i:1;i:111;i:-2;i:122;i:1;i:124;i:1;i:125;i:1;i:126;i:-2;i:128;i:1;i:140;i:1;i:141;i:1;i:142;i:-2;i:144;i:1;i:155;i:1;i:156;i:-2;i:166;i:1;i:167;i:-2;i:168;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/Locator/Injectable.php";a:24:{i:62;i:-1;i:63;i:-1;i:64;i:-2;i:77;i:-1;i:78;i:-1;i:80;i:-1;i:81;i:-1;i:82;i:-2;i:98;i:-1;i:99;i:-1;i:100;i:-1;i:101;i:-2;i:103;i:-1;i:105;i:-1;i:107;i:-2;i:108;i:-1;i:110;i:-2;i:122;i:-1;i:124;i:-1;i:125;i:-2;i:136;i:1;i:137;i:1;i:147;i:1;i:148;i:-2;}s:54:"/home/bjartka/public_html/doctrine/models/Resource.php";a:5:{i:4;i:1;i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/EventListener.php";a:33:{i:38;i:1;i:40;i:1;i:43;i:-1;i:45;i:-1;i:48;i:1;i:51;i:1;i:53;i:1;i:56;i:1;i:58;i:1;i:61;i:1;i:63;i:1;i:67;i:1;i:69;i:1;i:72;i:1;i:74;i:1;i:77;i:1;i:79;i:1;i:82;i:1;i:84;i:1;i:87;i:1;i:89;i:1;i:92;i:1;i:94;i:1;i:97;i:1;i:99;i:1;i:102;i:1;i:104;i:-1;i:107;i:1;i:109;i:1;i:112;i:1;i:114;i:1;i:117;i:1;i:119;i:1;}s:63:"/home/bjartka/public_html/doctrine/tests/Ticket/587TestCase.php";a:47:{i:19;i:1;i:20;i:1;i:21;i:1;i:24;i:1;i:25;i:1;i:29;i:1;i:30;i:1;i:31;i:1;i:33;i:1;i:34;i:1;i:35;i:1;i:36;i:1;i:38;i:1;i:39;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:79;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:96;i:1;i:98;i:1;i:99;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Transaction/MysqlTestCase.php";a:21:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:63;i:1;i:64;i:-1;i:65;i:1;i:66;i:1;i:68;i:1;i:71;i:1;i:73;i:1;i:74;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Export/MysqlTestCase.php";a:181:{i:36;i:-1;i:38;i:-1;i:43;i:1;i:45;i:-1;i:46;i:1;i:47;i:1;i:49;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:70;i:1;i:71;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:113;i:1;i:115;i:1;i:116;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:124;i:1;i:126;i:1;i:127;i:1;i:130;i:1;i:132;i:1;i:133;i:1;i:135;i:1;i:137;i:1;i:138;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:146;i:1;i:148;i:1;i:149;i:1;i:152;i:1;i:154;i:1;i:155;i:1;i:157;i:1;i:159;i:1;i:160;i:1;i:164;i:1;i:166;i:1;i:167;i:1;i:169;i:1;i:171;i:1;i:172;i:1;i:175;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:187;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:194;i:1;i:196;i:1;i:198;i:1;i:199;i:1;i:200;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:204;i:1;i:205;i:1;i:208;i:1;i:210;i:1;i:211;i:1;i:213;i:1;i:214;i:1;i:217;i:1;i:219;i:1;i:220;i:1;i:221;i:1;i:223;i:1;i:224;i:1;i:225;i:1;i:227;i:1;i:233;i:1;i:235;i:1;i:236;i:1;i:239;i:1;i:241;i:1;i:242;i:1;i:243;i:1;i:244;i:1;i:245;i:1;i:246;i:1;i:247;i:1;i:248;i:1;i:249;i:1;i:252;i:1;i:253;i:1;i:254;i:1;i:255;i:1;i:258;i:1;i:260;i:1;i:261;i:1;i:264;i:1;i:266;i:1;i:267;i:1;i:271;i:1;i:273;i:1;i:274;i:1;i:277;i:1;i:278;i:1;i:281;i:1;i:282;i:-1;i:283;i:1;i:284;i:1;i:286;i:1;i:289;i:1;i:290;i:1;i:292;i:1;i:293;i:1;i:296;i:1;i:297;i:1;i:298;i:1;i:300;i:1;i:302;i:1;i:303;i:1;i:305;i:1;i:306;i:1;i:307;i:1;i:310;i:1;i:311;i:1;i:312;i:1;i:314;i:1;i:317;i:1;i:318;i:1;i:319;i:1;i:320;i:1;i:321;i:1;i:323;i:1;i:325;i:1;i:326;i:1;i:329;i:1;i:330;i:1;i:331;i:1;i:333;i:1;i:336;i:1;i:337;i:1;i:338;i:1;i:339;i:1;i:340;i:1;i:341;i:1;i:343;i:1;i:345;i:1;i:346;i:1;}s:72:"/home/bjartka/public_html/doctrine/tests/Query/MysqlSubqueryTestCase.php";a:54:{i:37;i:1;i:38;i:1;i:39;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:111;i:1;i:113;i:1;i:115;i:1;i:116;i:1;}s:62:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Part.php";a:10:{i:34;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:59;i:-1;i:60;i:-2;i:62;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Adapter/Mock.php";a:66:{i:34;i:1;i:46;i:1;i:47;i:1;i:50;i:-1;i:51;i:-2;i:54;i:1;i:55;i:-2;i:58;i:-1;i:59;i:-1;i:62;i:1;i:63;i:1;i:65;i:1;i:66;i:-2;i:69;i:1;i:70;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:78;i:-1;i:80;i:-1;i:82;i:-1;i:83;i:-2;i:85;i:1;i:86;i:1;i:88;i:1;i:89;i:-2;i:92;i:1;i:93;i:-2;i:96;i:1;i:97;i:-2;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:-1;i:107;i:-1;i:109;i:-1;i:110;i:-2;i:112;i:1;i:113;i:-2;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:121;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:127;i:-2;i:128;i:1;i:130;i:-2;i:133;i:-1;i:134;i:-2;i:137;i:1;i:138;i:1;i:141;i:1;i:142;i:1;i:145;i:-1;i:146;i:-1;i:148;i:-1;i:150;i:-1;i:153;i:1;i:154;i:1;i:155;i:-1;i:159;i:1;i:161;i:1;i:163;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction/Pgsql.php";a:23:{i:21;i:1;i:34;i:1;i:45;i:1;i:47;i:1;i:48;i:-2;i:59;i:1;i:61;i:1;i:62;i:-2;i:73;i:1;i:75;i:1;i:76;i:-2;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:104;i:-2;i:105;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/DataDict/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Export/Pgsql.php";a:132:{i:21;i:1;i:34;i:1;i:45;i:1;i:47;i:1;i:48;i:-2;i:59;i:1;i:61;i:1;i:62;i:-2;i:75;i:1;i:76;i:1;i:77;i:-1;i:78;i:-1;i:79;i:1;i:80;i:-1;i:81;i:-1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:-1;i:87;i:-1;i:88;i:1;i:90;i:1;i:91;i:-1;i:92;i:-1;i:93;i:1;i:95;i:1;i:96;i:-2;i:111;i:-1;i:113;i:-1;i:114;i:-1;i:115;i:-1;i:116;i:-1;i:117;i:-1;i:118;i:-1;i:119;i:-1;i:120;i:-1;i:121;i:-1;i:122;i:-1;i:124;i:-1;i:125;i:-1;i:126;i:-2;i:128;i:-1;i:130;i:-1;i:131;i:-1;i:132;i:-1;i:133;i:-1;i:134;i:-1;i:135;i:-1;i:137;i:-1;i:138;i:-1;i:139;i:-1;i:140;i:-1;i:141;i:-1;i:142;i:-1;i:143;i:-1;i:145;i:-1;i:146;i:-1;i:147;i:-1;i:148;i:-1;i:149;i:-1;i:151;i:-1;i:152;i:-1;i:153;i:-2;i:154;i:-1;i:155;i:-1;i:156;i:-1;i:157;i:-1;i:158;i:-1;i:159;i:-1;i:160;i:-1;i:161;i:-1;i:162;i:-1;i:163;i:-1;i:164;i:-1;i:165;i:-1;i:166;i:-1;i:168;i:-1;i:169;i:-1;i:170;i:-1;i:171;i:-1;i:172;i:-1;i:173;i:-1;i:175;i:-1;i:176;i:-1;i:177;i:-1;i:178;i:-1;i:179;i:-1;i:181;i:-1;i:182;i:-2;i:275;i:-1;i:276;i:-1;i:277;i:-1;i:278;i:-1;i:279;i:-1;i:280;i:-2;i:298;i:-1;i:299;i:-1;i:300;i:-1;i:301;i:-2;i:310;i:-1;i:311;i:-1;i:312;i:-2;i:324;i:1;i:325;i:-1;i:326;i:-2;i:328;i:1;i:329;i:-1;i:330;i:-2;i:332;i:1;i:335;i:1;i:336;i:1;i:337;i:1;i:338;i:1;i:339;i:1;i:341;i:1;i:343;i:1;i:345;i:1;i:346;i:-1;i:347;i:-1;i:348;i:-1;i:349;i:-1;i:351;i:1;i:353;i:1;i:354;i:1;i:355;i:1;i:356;i:1;i:357;i:1;i:358;i:1;i:360;i:1;i:361;i:-2;i:363;i:1;}s:62:"/home/bjartka/public_html/doctrine/lib/Doctrine/Expression.php";a:38:{i:0;i:1;i:21;i:1;i:34;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:-1;i:52;i:-1;i:53;i:1;i:62;i:1;i:63;i:1;i:64;i:-2;i:66;i:-1;i:67;i:-2;i:77;i:1;i:78;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:-2;i:96;i:1;i:97;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:104;i:1;i:105;i:-2;i:115;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:121;i:1;i:122;i:-2;i:132;i:1;i:133;i:-2;i:142;i:-1;i:143;i:-2;i:145;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/RawSql/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/ConcreteEmail.php";a:2:{i:6;i:1;i:7;i:1;}s:53:"/home/bjartka/public_html/doctrine/models/MyGroup.php";a:7:{i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:15;i:1;i:16;i:1;}s:66:"/home/bjartka/public_html/doctrine/models/CategoryWithPosition.php";a:5:{i:4;i:1;i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/MysqlUser.php";a:3:{i:6;i:1;i:8;i:1;i:9;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/FooRecord.php";a:28:{i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:20;i:1;i:21;i:1;i:22;i:1;i:23;i:1;i:24;i:1;i:26;i:1;i:27;i:1;i:28;i:1;i:29;i:1;i:31;i:1;i:33;i:1;i:34;i:1;i:35;i:1;i:37;i:1;i:38;i:1;i:39;i:1;i:40;i:1;i:42;i:1;}s:72:"/home/bjartka/public_html/doctrine/tests/EventListener/ChainTestCase.php";a:7:{i:36;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:44;i:1;i:45;i:1;i:47;i:1;}s:64:"/home/bjartka/public_html/doctrine/tests/Query/LimitTestCase.php";a:168:{i:39;i:1;i:40;i:1;i:41;i:1;i:43;i:1;i:44;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:58;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:68;i:1;i:69;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:113;i:1;i:114;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:126;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:135;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:144;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:169;i:1;i:170;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:177;i:1;i:178;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:185;i:1;i:188;i:1;i:189;i:1;i:190;i:1;i:194;i:1;i:195;i:1;i:196;i:1;i:197;i:1;i:199;i:1;i:201;i:1;i:203;i:1;i:206;i:1;i:207;i:1;i:209;i:1;i:211;i:1;i:213;i:1;i:214;i:1;i:215;i:1;i:217;i:1;i:218;i:1;i:220;i:1;i:221;i:1;i:223;i:1;i:224;i:1;i:226;i:1;i:228;i:1;i:229;i:1;i:233;i:1;i:234;i:1;i:237;i:1;i:239;i:1;i:241;i:1;i:242;i:1;i:243;i:1;i:244;i:1;i:246;i:1;i:247;i:1;i:251;i:1;i:253;i:1;i:254;i:1;i:255;i:1;i:256;i:1;i:258;i:1;i:260;i:1;i:261;i:1;i:262;i:1;i:266;i:1;i:267;i:1;i:269;i:1;i:272;i:1;i:273;i:1;i:274;i:1;i:275;i:1;i:276;i:1;i:277;i:1;i:278;i:1;i:279;i:1;i:280;i:1;i:281;i:1;i:282;i:1;i:283;i:1;i:285;i:1;i:286;i:1;i:288;i:1;i:289;i:1;i:290;i:1;i:291;i:1;i:292;i:1;i:296;i:1;i:298;i:1;i:299;i:1;i:300;i:1;i:302;i:1;i:303;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Query/OrderbyTestCase.php";a:13:{i:37;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:43;i:1;i:44;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:55;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/Query/RegistryTestCase.php";a:15:{i:37;i:1;i:39;i:1;i:40;i:1;i:42;i:1;i:46;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:63;i:1;i:65;i:1;i:66;i:1;}s:61:"/home/bjartka/public_html/doctrine/tests/TemplateTestCase.php";a:49:{i:36;i:1;i:38;i:1;i:43;i:1;i:44;i:1;i:45;i:-1;i:46;i:1;i:47;i:1;i:49;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:100;i:1;i:101;i:-2;i:107;i:1;i:108;i:1;i:109;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:120;i:1;i:121;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:133;i:1;i:134;i:1;i:135;i:1;}s:59:"/home/bjartka/public_html/doctrine/lib/Doctrine/Manager.php";a:276:{i:0;i:1;i:35;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:-2;i:121;i:1;i:122;i:-2;i:131;i:-1;i:132;i:-2;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:-2;i:158;i:1;i:159;i:-1;i:160;i:-1;i:161;i:1;i:162;i:-2;i:172;i:1;i:174;i:1;i:175;i:-2;i:191;i:-1;i:192;i:-1;i:193;i:-1;i:194;i:-1;i:195;i:-2;i:211;i:-1;i:212;i:-1;i:213;i:-1;i:214;i:-1;i:215;i:-2;i:233;i:1;i:234;i:1;i:235;i:-2;i:236;i:1;i:238;i:-2;i:252;i:1;i:253;i:1;i:254;i:-1;i:255;i:-2;i:257;i:1;i:258;i:1;i:259;i:1;i:260;i:-1;i:261;i:-2;i:262;i:1;i:264;i:1;i:265;i:-1;i:266;i:-1;i:268;i:1;i:269;i:1;i:270;i:1;i:271;i:1;i:273;i:1;i:274;i:1;i:275;i:1;i:276;i:1;i:278;i:1;i:280;i:1;i:284;i:1;i:286;i:1;i:287;i:1;i:288;i:1;i:289;i:-1;i:290;i:-2;i:291;i:1;i:292;i:1;i:293;i:1;i:297;i:1;i:298;i:1;i:299;i:1;i:300;i:1;i:301;i:1;i:302;i:1;i:303;i:1;i:304;i:1;i:305;i:1;i:306;i:1;i:307;i:1;i:308;i:1;i:309;i:-1;i:310;i:-2;i:312;i:1;i:313;i:1;i:315;i:1;i:317;i:1;i:318;i:1;i:319;i:1;i:320;i:1;i:321;i:-2;i:331;i:-1;i:333;i:-1;i:335;i:-1;i:336;i:-1;i:337;i:-1;i:338;i:-1;i:339;i:-1;i:341;i:-1;i:342;i:-1;i:343;i:-1;i:345;i:-1;i:346;i:-1;i:347;i:-1;i:348;i:-1;i:349;i:-1;i:351;i:-1;i:352;i:-2;i:365;i:1;i:368;i:1;i:370;i:1;i:372;i:1;i:373;i:1;i:374;i:1;i:375;i:1;i:376;i:1;i:378;i:1;i:379;i:-1;i:380;i:-2;i:382;i:1;i:383;i:1;i:384;i:1;i:385;i:1;i:386;i:1;i:387;i:-1;i:388;i:-1;i:389;i:-1;i:391;i:1;i:392;i:1;i:393;i:1;i:394;i:1;i:395;i:1;i:396;i:1;i:399;i:1;i:401;i:1;i:402;i:1;i:403;i:-1;i:404;i:-1;i:405;i:-2;i:406;i:-1;i:407;i:-1;i:408;i:-1;i:409;i:-1;i:410;i:-1;i:411;i:-2;i:413;i:-1;i:414;i:-1;i:415;i:-1;i:417;i:-1;i:418;i:-1;i:419;i:-1;i:421;i:-1;i:423;i:1;i:424;i:1;i:425;i:1;i:426;i:1;i:427;i:1;i:428;i:1;i:429;i:1;i:430;i:1;i:431;i:1;i:432;i:1;i:433;i:-1;i:434;i:-2;i:435;i:1;i:436;i:1;i:437;i:1;i:438;i:1;i:439;i:-1;i:440;i:-2;i:442;i:1;i:443;i:-1;i:444;i:-1;i:446;i:1;i:447;i:1;i:448;i:1;i:450;i:1;i:451;i:-1;i:452;i:-1;i:453;i:-1;i:456;i:1;i:457;i:-2;i:467;i:1;i:468;i:1;i:469;i:-2;i:471;i:1;i:472;i:-2;i:485;i:-1;i:486;i:-1;i:487;i:-2;i:489;i:-1;i:490;i:-2;i:503;i:-1;i:505;i:-1;i:506;i:-2;i:516;i:1;i:517;i:-2;i:531;i:-1;i:532;i:-1;i:542;i:1;i:543;i:-1;i:544;i:-2;i:545;i:1;i:546;i:-2;i:559;i:1;i:560;i:-2;i:573;i:1;i:574;i:1;i:575;i:1;i:576;i:-2;i:586;i:-1;i:588;i:-1;i:590;i:-1;i:591;i:-1;i:592;i:-1;i:593;i:-1;i:595;i:-1;i:596;i:-1;i:606;i:1;i:607;i:-2;i:619;i:1;i:620;i:1;i:621;i:-1;i:622;i:-2;i:623;i:1;i:624;i:1;i:635;i:-1;i:636;i:-2;i:646;i:1;i:647;i:-2;i:657;i:1;i:658;i:-2;i:669;i:1;i:670;i:1;i:671;i:-1;i:672;i:-2;i:673;i:1;i:674;i:-2;i:684;i:-1;i:685;i:-1;i:686;i:-1;i:687;i:-1;i:688;i:-1;i:689;i:-2;i:691;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Table/Repository.php";a:41:{i:0;i:1;i:35;i:1;i:56;i:1;i:57;i:1;i:66;i:-1;i:67;i:-2;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:-2;i:82;i:1;i:84;i:1;i:85;i:-2;i:94;i:-1;i:95;i:-1;i:96;i:-2;i:97;i:-1;i:98;i:-2;i:107;i:-1;i:108;i:-2;i:116;i:1;i:117;i:-1;i:118;i:-2;i:119;i:1;i:120;i:1;i:121;i:-2;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:-2;i:143;i:1;i:144;i:-2;i:152;i:-1;i:153;i:-2;i:161;i:-1;i:162;i:-1;i:163;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Relation/LocalKey.php";a:24:{i:21;i:1;i:34;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:59;i:1;i:60;i:-1;i:61;i:-1;i:64;i:1;i:66;i:1;i:67;i:-2;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:-2;i:81;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/DataDict/Sqlite.php";a:189:{i:21;i:1;i:32;i:1;i:59;i:1;i:60;i:-1;i:61;i:-2;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:-1;i:81;i:1;i:82;i:-1;i:83;i:1;i:84;i:-1;i:85;i:-2;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:-1;i:93;i:1;i:94;i:-1;i:95;i:1;i:96;i:-1;i:97;i:-2;i:98;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:115;i:-1;i:116;i:-1;i:117;i:-1;i:118;i:-1;i:119;i:-1;i:120;i:-1;i:121;i:-2;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:137;i:1;i:138;i:-1;i:139;i:-1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:-1;i:150;i:-1;i:151;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:-1;i:185;i:1;i:186;i:-1;i:187;i:-1;i:188;i:-1;i:189;i:-1;i:190;i:-1;i:191;i:-1;i:192;i:-1;i:193;i:-1;i:194;i:-1;i:195;i:-1;i:196;i:-1;i:197;i:-1;i:198;i:-1;i:199;i:1;i:200;i:-1;i:201;i:-1;i:202;i:-1;i:203;i:1;i:204;i:1;i:205;i:-1;i:206;i:-1;i:207;i:-1;i:208;i:1;i:209;i:-1;i:210;i:-1;i:211;i:-1;i:212;i:1;i:213;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:217;i:1;i:218;i:1;i:219;i:1;i:220;i:1;i:221;i:1;i:222;i:1;i:223;i:1;i:224;i:1;i:225;i:1;i:226;i:1;i:227;i:1;i:228;i:1;i:229;i:1;i:230;i:1;i:231;i:1;i:232;i:1;i:233;i:1;i:234;i:1;i:235;i:-1;i:236;i:-1;i:237;i:-1;i:239;i:1;i:240;i:1;i:241;i:1;i:242;i:1;i:243;i:-2;i:273;i:1;i:274;i:1;i:276;i:1;i:278;i:1;i:279;i:1;i:280;i:1;i:281;i:1;i:282;i:1;i:283;i:-1;i:284;i:-1;i:285;i:1;i:286;i:1;i:292;i:1;i:295;i:1;i:297;i:1;i:298;i:1;i:299;i:-2;i:300;i:1;}s:62:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/From.php";a:37:{i:21;i:1;i:33;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:-1;i:57;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:-1;i:64;i:-2;i:66;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:-2;i:89;i:1;}s:73:"/home/bjartka/public_html/doctrine/lib/Doctrine/Hydrator/RecordDriver.php";a:47:{i:34;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:48;i:-2;i:52;i:1;i:54;i:1;i:55;i:-2;i:59;i:1;i:67;i:-2;i:71;i:1;i:72;i:1;i:85;i:-1;i:87;i:-1;i:88;i:-1;i:89;i:-1;i:90;i:-1;i:91;i:-2;i:92;i:-1;i:93;i:-1;i:94;i:-1;i:95;i:-1;i:96;i:-2;i:98;i:-1;i:99;i:-2;i:103;i:1;i:104;i:-2;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:113;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:121;i:1;i:122;i:-2;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:135;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/DataDict/Oracle.php";a:127:{i:21;i:1;i:31;i:1;i:57;i:1;i:58;i:-1;i:59;i:-2;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:-2;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:-1;i:94;i:-1;i:95;i:-1;i:96;i:-1;i:97;i:-1;i:98;i:-1;i:99;i:-2;i:110;i:1;i:111;i:-1;i:112;i:-2;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:-1;i:134;i:-1;i:135;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:-1;i:148;i:-1;i:149;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:-1;i:165;i:-1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:-1;i:171;i:-1;i:172;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:188;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:192;i:1;i:194;i:1;i:195;i:1;i:196;i:1;i:197;i:1;i:198;i:-2;i:200;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Import/Builder.php";a:346:{i:40;i:1;i:121;i:1;i:122;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:147;i:1;i:148;i:1;i:158;i:1;i:159;i:1;i:171;i:1;i:172;i:-1;i:173;i:-1;i:175;i:1;i:176;i:-2;i:188;i:-1;i:189;i:-1;i:190;i:-1;i:192;i:-1;i:193;i:-2;i:202;i:1;i:203;i:1;i:212;i:1;i:213;i:1;i:223;i:1;i:224;i:1;i:233;i:-1;i:234;i:-2;i:244;i:-1;i:245;i:-1;i:246;i:-1;i:247;i:-1;i:248;i:-1;i:249;i:-1;i:260;i:1;i:262;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:266;i:1;i:268;i:1;i:279;i:1;i:280;i:1;i:281;i:-2;i:283;i:1;i:284;i:-1;i:292;i:1;i:293;i:1;i:294;i:1;i:304;i:-1;i:305;i:-1;i:307;i:-1;i:308;i:-1;i:309;i:-1;i:310;i:-1;i:313;i:-1;i:314;i:-1;i:315;i:-1;i:316;i:-1;i:317;i:-1;i:319;i:-1;i:320;i:-2;i:330;i:1;i:332;i:1;i:334;i:1;i:335;i:-1;i:336;i:-1;i:337;i:-1;i:339;i:1;i:340;i:1;i:342;i:1;i:343;i:1;i:345;i:1;i:346;i:1;i:348;i:1;i:349;i:1;i:350;i:1;i:351;i:-1;i:354;i:1;i:355;i:1;i:356;i:1;i:357;i:1;i:358;i:1;i:359;i:1;i:360;i:1;i:362;i:1;i:364;i:1;i:366;i:1;i:367;i:1;i:368;i:1;i:369;i:1;i:370;i:1;i:372;i:1;i:373;i:1;i:375;i:1;i:376;i:1;i:378;i:1;i:380;i:1;i:381;i:1;i:383;i:1;i:384;i:1;i:385;i:-2;i:386;i:-1;i:396;i:1;i:397;i:1;i:399;i:-1;i:400;i:-1;i:402;i:-1;i:403;i:-1;i:404;i:-1;i:405;i:-1;i:406;i:-1;i:407;i:-1;i:410;i:-1;i:412;i:1;i:413;i:-2;i:423;i:1;i:424;i:1;i:425;i:1;i:426;i:-1;i:428;i:-1;i:429;i:-1;i:430;i:1;i:431;i:1;i:432;i:1;i:433;i:-1;i:436;i:1;i:438;i:1;i:439;i:-2;i:449;i:1;i:450;i:1;i:452;i:-1;i:453;i:-1;i:454;i:-1;i:455;i:-1;i:456;i:-1;i:457;i:-1;i:458;i:-1;i:460;i:-1;i:461;i:-1;i:462;i:-1;i:463;i:-1;i:466;i:-1;i:469;i:-1;i:470;i:-1;i:472;i:1;i:473;i:-2;i:483;i:1;i:484;i:1;i:485;i:-1;i:486;i:-1;i:488;i:1;i:489;i:-2;i:499;i:1;i:501;i:1;i:502;i:-1;i:503;i:-1;i:504;i:-1;i:505;i:-1;i:507;i:1;i:508;i:-2;i:520;i:1;i:521;i:1;i:523;i:1;i:524;i:-1;i:525;i:-1;i:526;i:-1;i:528;i:1;i:529;i:1;i:530;i:1;i:532;i:1;i:533;i:1;i:534;i:1;i:536;i:1;i:537;i:1;i:538;i:1;i:539;i:1;i:540;i:1;i:543;i:1;i:545;i:1;i:546;i:-1;i:547;i:-1;i:549;i:1;i:550;i:-1;i:551;i:-1;i:553;i:1;i:554;i:1;i:555;i:1;i:557;i:1;i:558;i:1;i:559;i:1;i:561;i:1;i:562;i:1;i:563;i:1;i:565;i:1;i:566;i:1;i:567;i:1;i:569;i:1;i:570;i:-1;i:571;i:-1;i:573;i:1;i:574;i:1;i:575;i:1;i:576;i:1;i:577;i:1;i:579;i:1;i:580;i:1;i:581;i:1;i:583;i:1;i:584;i:-1;i:585;i:-1;i:586;i:-1;i:588;i:1;i:589;i:1;i:591;i:1;i:592;i:1;i:594;i:1;i:595;i:1;i:597;i:1;i:598;i:1;i:599;i:-2;i:600;i:1;i:616;i:1;i:617;i:-1;i:618;i:-2;i:620;i:1;i:621;i:1;i:622;i:1;i:624;i:1;i:625;i:1;i:626;i:1;i:627;i:1;i:628;i:1;i:629;i:1;i:632;i:1;i:634;i:1;i:635;i:1;i:636;i:1;i:637;i:1;i:638;i:1;i:639;i:1;i:641;i:1;i:642;i:-2;i:658;i:1;i:659;i:-1;i:660;i:-2;i:662;i:1;i:663;i:1;i:665;i:1;i:666;i:-1;i:667;i:-1;i:668;i:-1;i:670;i:-1;i:671;i:-1;i:674;i:1;i:675;i:1;i:679;i:1;i:680;i:1;i:681;i:1;i:682;i:1;i:683;i:1;i:686;i:1;i:688;i:-1;i:689;i:-1;i:690;i:-1;i:691;i:-1;i:692;i:-1;i:693;i:-1;i:694;i:-1;i:695;i:-1;i:696;i:-1;i:697;i:-1;i:699;i:1;i:700;i:1;i:701;i:1;i:702;i:1;i:703;i:1;i:705;i:1;i:707;i:1;i:708;i:-1;i:709;i:-1;i:711;i:1;i:712;i:1;i:713;i:-1;i:715;i:1;i:724;i:1;i:726;i:1;i:727;i:1;i:728;i:1;i:729;i:1;i:730;i:1;i:731;i:1;i:733;i:1;i:735;i:1;i:737;i:1;i:739;i:1;i:740;i:-1;i:741;i:-1;i:742;i:1;i:758;i:1;i:760;i:1;i:762;i:1;i:765;i:1;i:767;i:1;i:768;i:-1;i:770;i:-1;i:772;i:-1;i:773;i:1;i:775;i:1;i:777;i:1;i:780;i:1;i:781;i:-1;i:783;i:-1;i:785;i:-1;i:786;i:-1;i:789;i:1;i:791;i:1;i:792;i:-1;i:794;i:-1;i:795;i:1;i:797;i:1;i:799;i:1;i:800;i:1;i:802;i:1;i:803;i:1;i:804;i:-1;i:806;i:-1;i:809;i:1;i:811;i:1;i:812;i:-1;i:813;i:-1;i:814;i:-1;i:816;i:1;i:818;i:1;i:819;i:1;i:820;i:-1;i:821;i:-1;i:822;i:1;i:823;i:1;i:826;i:1;i:827;i:-1;i:828;i:-2;i:829;i:1;i:831;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/DoctrineTest/UnitTestCase.php";a:69:{i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:-1;i:21;i:-1;i:22;i:1;i:23;i:-1;i:24;i:-1;i:25;i:1;i:26;i:1;i:28;i:1;i:32;i:1;i:33;i:1;i:34;i:1;i:35;i:-1;i:37;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:-1;i:46;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:65;i:1;i:66;i:1;i:69;i:1;i:70;i:1;i:73;i:1;i:74;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:-1;i:83;i:-1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:-2;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:105;i:1;i:106;i:-2;i:109;i:1;i:110;i:-2;i:113;i:1;i:114;i:-2;}s:59:"/home/bjartka/public_html/doctrine/models/ValidatorTest.php";a:10:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:12;i:1;i:13;i:1;i:14;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/Auth.php";a:5:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:12;i:1;}s:60:"/home/bjartka/public_html/doctrine/lib/Doctrine/Template.php";a:19:{i:50;i:1;i:51;i:1;i:61;i:-1;i:62;i:-2;i:74;i:1;i:75;i:1;i:85;i:-1;i:86;i:-2;i:98;i:1;i:100;i:1;i:101;i:-2;i:111;i:1;i:112;i:-2;i:122;i:-1;i:123;i:-2;i:134;i:-1;i:135;i:-2;i:144;i:1;i:154;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/CustomPK.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/Forum_Entry.php";a:10:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:12;i:1;i:13;i:1;i:14;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/TreeLeaf.php";a:6:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:12;i:1;i:13;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/DataDict/OracleTestCase.php";a:158:{i:37;i:1;i:38;i:-1;i:39;i:1;i:40;i:1;i:42;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:122;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:129;i:1;i:132;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:148;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:155;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:162;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:169;i:1;i:172;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:179;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:186;i:1;i:188;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:193;i:1;i:195;i:1;i:196;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:202;i:1;i:204;i:1;i:206;i:1;i:208;i:1;i:210;i:1;i:212;i:1;i:213;i:1;i:217;i:1;i:219;i:1;i:220;i:1;i:223;i:1;i:225;i:1;i:226;i:1;i:229;i:1;i:231;i:1;i:232;i:1;i:235;i:1;i:237;i:1;i:238;i:1;i:241;i:1;i:243;i:1;i:244;i:1;i:247;i:1;i:249;i:1;i:250;i:1;i:253;i:1;i:255;i:1;i:256;i:1;i:259;i:1;i:261;i:1;i:262;i:1;i:265;i:1;i:267;i:1;i:268;i:1;i:271;i:1;i:273;i:1;i:274;i:1;i:277;i:1;i:279;i:1;i:280;i:1;i:283;i:1;i:285;i:1;i:286;i:1;i:289;i:1;i:291;i:1;i:292;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/DataDict/SqliteTestCase.php";a:71:{i:37;i:1;i:38;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:70;i:1;i:71;i:1;i:74;i:1;i:76;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:107;i:1;i:109;i:1;i:110;i:1;i:113;i:1;i:115;i:1;i:116;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:125;i:1;i:127;i:1;i:128;i:1;i:131;i:1;i:133;i:1;i:134;i:1;i:137;i:1;i:139;i:1;i:140;i:1;i:143;i:1;i:145;i:1;i:146;i:1;i:149;i:1;i:151;i:1;i:152;i:1;i:155;i:1;i:157;i:1;i:158;i:1;i:161;i:1;i:163;i:1;i:164;i:1;}s:60:"/home/bjartka/public_html/doctrine/tests/ManagerTestCase.php";a:65:{i:35;i:1;i:36;i:1;i:38;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:58;i:1;i:61;i:1;i:68;i:1;i:69;i:1;i:71;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:-2;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:-2;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:124;i:1;i:125;i:-2;i:127;i:1;i:128;i:1;i:129;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/TreeStructureTestCase.php";a:49:{i:38;i:1;i:39;i:1;i:40;i:1;i:45;i:1;i:49;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:-2;i:58;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:111;i:1;i:112;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:127;i:1;}s:63:"/home/bjartka/public_html/doctrine/tests/Query/FromTestCase.php";a:40:{i:36;i:1;i:40;i:1;i:42;i:1;i:43;i:1;i:46;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:69;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:81;i:1;i:83;i:1;i:85;i:1;i:86;i:1;i:89;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:97;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:105;i:1;i:107;i:1;i:109;i:1;i:110;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:118;i:1;}s:72:"/home/bjartka/public_html/doctrine/lib/Doctrine/Relation/Association.php";a:32:{i:21;i:1;i:36;i:1;i:43;i:1;i:44;i:-2;i:47;i:1;i:48;i:-2;i:58;i:1;i:59;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:-1;i:70;i:-1;i:71;i:-1;i:72;i:-1;i:73;i:-1;i:74;i:-2;i:76;i:1;i:77;i:-2;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:96;i:1;i:97;i:-2;i:98;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Orderby.php";a:10:{i:21;i:1;i:33;i:1;i:44;i:1;i:46;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:-2;i:54;i:1;}s:71:"/home/bjartka/public_html/doctrine/lib/Doctrine/EventListener/Chain.php";a:143:{i:21;i:1;i:36;i:1;i:53;i:1;i:54;i:1;i:56;i:-1;i:57;i:-2;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:-1;i:63;i:1;i:74;i:-1;i:75;i:-1;i:76;i:-2;i:77;i:-1;i:78;i:-2;i:89;i:-1;i:90;i:-1;i:101;i:-1;i:102;i:-1;i:103;i:-1;i:104;i:-1;i:116;i:-1;i:117;i:-1;i:118;i:-1;i:119;i:-1;i:130;i:-1;i:131;i:-1;i:132;i:-1;i:133;i:-1;i:144;i:-1;i:145;i:-1;i:146;i:-1;i:147;i:-1;i:158;i:-1;i:159;i:-1;i:160;i:-1;i:161;i:-1;i:172;i:-1;i:173;i:-1;i:174;i:-1;i:175;i:-1;i:186;i:-1;i:187;i:-1;i:188;i:-1;i:189;i:-1;i:200;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:217;i:1;i:228;i:-1;i:229;i:-1;i:230;i:-1;i:231;i:-1;i:242;i:-1;i:243;i:-1;i:244;i:-1;i:245;i:-1;i:256;i:1;i:257;i:1;i:258;i:1;i:259;i:1;i:270;i:1;i:271;i:1;i:272;i:1;i:273;i:1;i:284;i:-1;i:285;i:-1;i:286;i:-1;i:287;i:-1;i:298;i:-1;i:299;i:-1;i:300;i:-1;i:301;i:-1;i:304;i:-1;i:305;i:-1;i:306;i:-1;i:307;i:-1;i:310;i:-1;i:311;i:-1;i:312;i:-1;i:313;i:-1;i:316;i:1;i:317;i:1;i:318;i:1;i:319;i:1;i:322;i:1;i:323;i:1;i:324;i:1;i:325;i:1;i:329;i:1;i:330;i:1;i:331;i:1;i:332;i:1;i:335;i:1;i:336;i:1;i:337;i:1;i:338;i:1;i:342;i:1;i:343;i:1;i:344;i:1;i:345;i:1;i:348;i:1;i:349;i:1;i:350;i:1;i:351;i:1;i:355;i:1;i:356;i:1;i:357;i:1;i:358;i:1;i:361;i:-1;i:362;i:-1;i:363;i:-1;i:364;i:-1;i:368;i:1;i:369;i:1;i:370;i:1;i:371;i:1;i:374;i:1;i:375;i:1;i:376;i:1;i:377;i:1;i:381;i:-1;i:382;i:-1;i:383;i:-1;i:384;i:-1;i:388;i:-1;i:389;i:-1;i:390;i:-1;i:391;i:-1;i:395;i:1;i:396;i:1;i:397;i:1;i:398;i:1;i:402;i:1;i:403;i:1;i:404;i:1;i:405;i:1;i:407;i:1;}s:63:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Limit.php";a:4:{i:33;i:1;i:37;i:1;i:38;i:-2;i:39;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Registry.php";a:23:{i:34;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:44;i:1;i:46;i:1;i:48;i:1;i:52;i:1;i:53;i:1;i:54;i:-1;i:55;i:-2;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:-1;i:60;i:-2;i:61;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:69;i:-2;i:70;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/Template/NestedSet.php";a:7:{i:33;i:1;i:39;i:1;i:40;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;}s:62:"/home/bjartka/public_html/doctrine/lib/Doctrine/Parser/Yml.php";a:12:{i:2;i:1;i:35;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:54;i:-2;i:66;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:-2;i:74;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/Data_File.php";a:5:{i:4;i:-1;i:5;i:-1;i:6;i:-1;i:8;i:-1;i:9;i:-1;}s:50:"/home/bjartka/public_html/doctrine/models/Book.php";a:8:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:13;i:1;i:14;i:1;i:15;i:1;}s:63:"/home/bjartka/public_html/doctrine/models/ConcreteGroupUser.php";a:2:{i:6;i:1;i:7;i:1;}s:68:"/home/bjartka/public_html/doctrine/models/EventListenerChainTest.php";a:6:{i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/FooLocallyOwned.php";a:2:{i:6;i:1;i:7;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Transaction/PgsqlTestCase.php";a:18:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:57;i:1;i:58;i:-1;i:59;i:1;i:60;i:1;i:62;i:1;i:65;i:1;i:67;i:1;i:68;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Export/PgsqlTestCase.php";a:69:{i:37;i:1;i:38;i:1;i:39;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:59;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:96;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:113;i:1;i:114;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:124;i:1;i:125;i:1;i:128;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;}s:63:"/home/bjartka/public_html/doctrine/tests/ExpressionTestCase.php";a:15:{i:37;i:1;i:41;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:59;i:1;i:60;i:1;i:61;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Relation/OneToOneTestCase.php";a:41:{i:36;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:46;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:100;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/EventListenerTestCase.php";a:21:{i:38;i:1;i:40;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:184;i:-1;i:185;i:-1;i:187;i:-1;i:188;i:-2;i:190;i:-1;i:191;i:-1;i:193;i:-1;i:194;i:-2;i:196;i:-1;i:197;i:-2;}s:72:"/home/bjartka/public_html/doctrine/tests/Query/PgsqlSubqueryTestCase.php";a:23:{i:37;i:1;i:38;i:1;i:39;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;}s:78:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Mssql/Exception.php";a:10:{i:21;i:1;i:34;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:-2;i:73;i:-1;i:74;i:-2;i:75;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction/Mysql.php";a:25:{i:21;i:1;i:33;i:1;i:44;i:1;i:46;i:1;i:47;i:-2;i:58;i:1;i:60;i:1;i:61;i:-2;i:72;i:1;i:74;i:1;i:75;i:-2;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:-2;i:114;i:1;i:115;i:-2;i:116;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Export/Mysql.php";a:290:{i:21;i:1;i:34;i:1;i:44;i:1;i:45;i:-2;i:55;i:1;i:56;i:-2;i:94;i:1;i:95;i:1;i:97;i:1;i:98;i:-1;i:99;i:-2;i:100;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:111;i:-1;i:112;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:121;i:-1;i:122;i:-1;i:124;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:144;i:1;i:146;i:1;i:148;i:1;i:149;i:-1;i:150;i:-1;i:151;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:158;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:176;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:-2;i:277;i:1;i:278;i:1;i:279;i:-2;i:280;i:-1;i:282;i:-1;i:283;i:-1;i:284;i:-1;i:285;i:-1;i:286;i:-1;i:287;i:-1;i:288;i:-1;i:289;i:-1;i:290;i:-1;i:291;i:-1;i:293;i:-1;i:294;i:-1;i:295;i:-2;i:297;i:-1;i:298;i:-1;i:299;i:-1;i:300;i:-1;i:301;i:-1;i:303;i:-1;i:304;i:-1;i:305;i:-1;i:306;i:-1;i:307;i:-1;i:308;i:-1;i:309;i:-1;i:310;i:-1;i:312;i:-1;i:313;i:-1;i:314;i:-1;i:315;i:-1;i:316;i:-1;i:317;i:-1;i:318;i:-1;i:319;i:-1;i:320;i:-1;i:322;i:-1;i:323;i:-1;i:324;i:-1;i:325;i:-1;i:326;i:-1;i:327;i:-1;i:329;i:-1;i:330;i:-1;i:331;i:-1;i:332;i:-1;i:333;i:-1;i:334;i:-1;i:335;i:-1;i:336;i:-1;i:337;i:-1;i:338;i:-1;i:340;i:-1;i:341;i:-1;i:342;i:-1;i:343;i:-1;i:344;i:-1;i:346;i:-1;i:347;i:-1;i:348;i:-1;i:349;i:-1;i:350;i:-1;i:351;i:-1;i:352;i:-1;i:353;i:-1;i:354;i:-1;i:355;i:-1;i:356;i:-1;i:358;i:-1;i:359;i:-1;i:360;i:-2;i:362;i:-1;i:364;i:-1;i:365;i:-2;i:383;i:-1;i:384;i:-1;i:386;i:-1;i:388;i:-1;i:389;i:-1;i:390;i:-1;i:392;i:-1;i:393;i:-1;i:395;i:-1;i:396;i:-1;i:397;i:-1;i:398;i:-1;i:400;i:-1;i:402;i:-1;i:403;i:-1;i:404;i:-1;i:405;i:-1;i:407;i:-1;i:408;i:-1;i:409;i:-1;i:414;i:-1;i:415;i:-1;i:416;i:-1;i:417;i:-1;i:419;i:-1;i:420;i:-1;i:421;i:-2;i:424;i:-1;i:425;i:-1;i:428;i:-1;i:430;i:-1;i:434;i:-1;i:435;i:-1;i:436;i:-2;i:440;i:-1;i:478;i:-1;i:479;i:-1;i:480;i:-1;i:481;i:-1;i:482;i:-1;i:483;i:-1;i:484;i:-1;i:485;i:-1;i:486;i:-1;i:487;i:-1;i:488;i:-1;i:489;i:-1;i:490;i:-1;i:491;i:-1;i:492;i:-1;i:493;i:-1;i:495;i:-1;i:496;i:-2;i:508;i:1;i:509;i:1;i:510;i:-1;i:511;i:-1;i:512;i:-1;i:514;i:-1;i:515;i:-1;i:516;i:-1;i:517;i:-1;i:518;i:-1;i:519;i:-1;i:521;i:-1;i:522;i:-1;i:523;i:1;i:524;i:-2;i:536;i:1;i:537;i:1;i:538;i:1;i:539;i:1;i:540;i:1;i:541;i:1;i:542;i:1;i:543;i:1;i:544;i:-1;i:545;i:-1;i:546;i:-1;i:547;i:1;i:549;i:1;i:550;i:-1;i:551;i:-2;i:552;i:1;i:553;i:1;i:554;i:1;i:556;i:1;i:558;i:1;i:560;i:1;i:561;i:-2;i:572;i:1;i:574;i:1;i:575;i:1;i:577;i:1;i:578;i:1;i:579;i:1;i:580;i:1;i:582;i:1;i:583;i:1;i:585;i:1;i:586;i:1;i:587;i:1;i:588;i:1;i:589;i:1;i:590;i:1;i:591;i:1;i:592;i:1;i:593;i:1;i:594;i:1;i:596;i:1;i:597;i:1;i:598;i:1;i:599;i:-2;i:611;i:1;i:612;i:1;i:613;i:-1;i:614;i:-1;i:615;i:1;i:616;i:1;i:617;i:1;i:618;i:1;i:619;i:1;i:620;i:1;i:621;i:1;i:622;i:-2;i:633;i:1;i:634;i:1;i:635;i:1;i:636;i:-2;i:647;i:-1;i:648;i:-1;i:649;i:-2;i:653;i:-1;i:654;i:-1;i:655;i:-1;i:656;i:-2;i:657;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Template/I18n.php";a:12:{i:33;i:1;i:43;i:1;i:44;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:70;i:-1;i:71;i:-2;i:73;i:1;}s:63:"/home/bjartka/public_html/doctrine/lib/Doctrine/Parser/spyc.php";a:419:{i:19;i:1;i:52;i:1;i:53;i:1;i:71;i:1;i:89;i:-1;i:90;i:-1;i:91;i:-2;i:114;i:-1;i:115;i:-1;i:116;i:-2;i:136;i:1;i:137;i:1;i:138;i:-1;i:139;i:-1;i:140;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:151;i:1;i:152;i:1;i:155;i:1;i:156;i:-1;i:157;i:-1;i:158;i:-1;i:159;i:-2;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:-1;i:165;i:-1;i:166;i:1;i:168;i:1;i:169;i:1;i:171;i:1;i:174;i:1;i:176;i:1;i:177;i:-1;i:178;i:-1;i:179;i:-1;i:181;i:1;i:182;i:1;i:183;i:1;i:185;i:1;i:186;i:1;i:187;i:-1;i:188;i:-1;i:189;i:1;i:191;i:1;i:196;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:200;i:1;i:201;i:1;i:202;i:1;i:203;i:-1;i:204;i:-1;i:205;i:-1;i:206;i:-1;i:207;i:-1;i:208;i:-1;i:209;i:-1;i:210;i:1;i:211;i:-1;i:212;i:-1;i:213;i:-1;i:214;i:-1;i:215;i:-1;i:216;i:-1;i:217;i:-1;i:218;i:-1;i:219;i:1;i:220;i:1;i:221;i:1;i:223;i:1;i:224;i:-1;i:225;i:-1;i:226;i:-1;i:227;i:-1;i:228;i:-1;i:229;i:-1;i:230;i:-1;i:234;i:1;i:235;i:1;i:236;i:1;i:237;i:1;i:238;i:1;i:239;i:1;i:241;i:1;i:243;i:1;i:245;i:1;i:247;i:1;i:249;i:1;i:251;i:1;i:253;i:1;i:257;i:1;i:258;i:1;i:259;i:1;i:260;i:-1;i:261;i:1;i:262;i:-1;i:263;i:1;i:264;i:1;i:265;i:-1;i:266;i:-1;i:267;i:1;i:268;i:1;i:269;i:1;i:270;i:1;i:272;i:1;i:273;i:1;i:274;i:1;i:275;i:-1;i:276;i:1;i:277;i:1;i:278;i:-1;i:279;i:-1;i:280;i:1;i:281;i:1;i:282;i:1;i:283;i:1;i:284;i:1;i:285;i:1;i:288;i:1;i:291;i:1;i:292;i:1;i:293;i:-2;i:320;i:1;i:321;i:1;i:322;i:1;i:323;i:-1;i:326;i:1;i:327;i:1;i:328;i:1;i:329;i:-1;i:333;i:1;i:336;i:1;i:337;i:1;i:338;i:1;i:339;i:1;i:340;i:-2;i:381;i:1;i:384;i:1;i:386;i:1;i:388;i:1;i:389;i:1;i:391;i:1;i:392;i:1;i:393;i:1;i:394;i:-2;i:404;i:1;i:405;i:1;i:406;i:1;i:407;i:1;i:408;i:1;i:409;i:1;i:410;i:-2;i:411;i:-1;i:413;i:-2;i:425;i:1;i:426;i:-1;i:427;i:-1;i:428;i:1;i:431;i:1;i:432;i:1;i:433;i:1;i:435;i:1;i:437;i:1;i:439;i:1;i:440;i:1;i:442;i:1;i:444;i:1;i:445;i:-2;i:455;i:-1;i:456;i:-1;i:457;i:-1;i:458;i:-1;i:459;i:-1;i:460;i:-1;i:461;i:-1;i:462;i:-1;i:463;i:-2;i:473;i:1;i:474;i:-1;i:475;i:-2;i:477;i:1;i:478;i:-1;i:479;i:-1;i:480;i:-1;i:481;i:-1;i:482;i:-1;i:483;i:1;i:484;i:-2;i:495;i:1;i:496;i:1;i:497;i:1;i:498;i:1;i:499;i:1;i:501;i:1;i:502;i:-2;i:511;i:1;i:513;i:1;i:515;i:1;i:517;i:-1;i:518;i:-1;i:519;i:1;i:521;i:1;i:522;i:-1;i:524;i:-1;i:525;i:-1;i:526;i:-1;i:527;i:1;i:529;i:1;i:532;i:1;i:533;i:-1;i:534;i:-1;i:535;i:-1;i:537;i:1;i:538;i:1;i:539;i:1;i:540;i:1;i:544;i:1;i:545;i:1;i:546;i:-1;i:547;i:-1;i:548;i:1;i:550;i:1;i:551;i:1;i:552;i:-2;i:561;i:1;i:562;i:-1;i:563;i:-1;i:564;i:1;i:568;i:1;i:571;i:1;i:572;i:1;i:573;i:1;i:574;i:1;i:575;i:1;i:577;i:-1;i:578;i:-1;i:579;i:-1;i:580;i:-1;i:581;i:-1;i:582;i:-1;i:583;i:1;i:587;i:-1;i:590;i:-1;i:591;i:-1;i:592;i:-1;i:593;i:-1;i:594;i:-1;i:595;i:1;i:596;i:1;i:597;i:1;i:599;i:-1;i:600;i:1;i:601;i:1;i:602;i:1;i:603;i:1;i:604;i:1;i:605;i:1;i:606;i:1;i:607;i:-1;i:608;i:-1;i:610;i:1;i:613;i:1;i:614;i:-2;i:627;i:1;i:630;i:1;i:631;i:1;i:632;i:-1;i:633;i:-1;i:634;i:-1;i:635;i:1;i:638;i:1;i:639;i:-1;i:640;i:-1;i:641;i:-1;i:644;i:1;i:645;i:-1;i:646;i:-1;i:647;i:-1;i:649;i:1;i:653;i:1;i:654;i:1;i:655;i:1;i:656;i:1;i:657;i:-1;i:658;i:-1;i:659;i:-1;i:660;i:1;i:661;i:1;i:664;i:1;i:665;i:1;i:666;i:1;i:667;i:1;i:668;i:-1;i:669;i:-1;i:670;i:-1;i:671;i:1;i:672;i:1;i:675;i:1;i:676;i:-1;i:677;i:-1;i:678;i:-1;i:679;i:-1;i:680;i:-1;i:681;i:-1;i:682;i:-1;i:683;i:-1;i:684;i:-1;i:686;i:1;i:687;i:-2;i:695;i:1;i:697;i:1;i:698;i:-1;i:699;i:-2;i:701;i:1;i:702;i:1;i:703;i:1;i:705;i:1;i:707;i:1;i:708;i:1;i:709;i:1;i:711;i:1;i:712;i:-2;i:720;i:1;i:721;i:-1;i:722;i:-1;i:723;i:-1;i:725;i:-1;i:726;i:-1;i:727;i:-1;i:728;i:-1;i:729;i:-1;i:730;i:-1;i:732;i:-1;i:733;i:-1;i:734;i:-1;i:735;i:1;i:736;i:-2;i:739;i:-1;i:741;i:-1;i:743;i:-1;i:744;i:-1;i:745;i:-1;i:747;i:-1;i:748;i:-1;i:750;i:-1;i:751;i:-1;i:752;i:-1;i:753;i:-1;i:755;i:-1;i:756;i:-1;i:757;i:-1;i:759;i:-1;i:760;i:-1;i:762;i:-1;i:763;i:-1;i:764;i:-1;i:765;i:-1;i:774;i:1;i:775;i:1;i:776;i:1;i:777;i:1;i:778;i:1;i:780;i:1;i:782;i:1;i:785;i:1;i:786;i:1;i:787;i:1;i:788;i:1;i:789;i:-2;i:799;i:1;i:801;i:1;i:803;i:1;i:804;i:1;i:806;i:1;i:807;i:1;i:808;i:1;i:809;i:1;i:810;i:-1;i:812;i:1;i:813;i:1;i:815;i:1;i:817;i:-1;i:818;i:-1;i:819;i:-1;i:820;i:-1;i:823;i:1;i:824;i:-2;i:834;i:1;i:835;i:-1;i:837;i:-1;i:839;i:1;i:840;i:-1;i:841;i:-1;i:843;i:-1;i:844;i:-1;i:845;i:-1;i:846;i:1;i:847;i:-2;i:864;i:1;i:865;i:1;i:867;i:1;i:868;i:1;i:869;i:1;i:870;i:1;i:871;i:1;i:872;i:1;i:873;i:1;i:874;i:1;i:875;i:-2;i:878;i:1;}s:53:"/home/bjartka/public_html/doctrine/models/PolicyN.php";a:7:{i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:12;i:1;i:13;i:1;}s:72:"/home/bjartka/public_html/doctrine/models/ValidatorTest_AddressModel.php";a:10:{i:5;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:16;i:1;i:17;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/TestMovie.php";a:15:{i:7;i:1;i:8;i:1;i:9;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:24;i:1;i:25;i:1;i:26;i:1;}s:58:"/home/bjartka/public_html/doctrine/models/App_Category.php";a:6:{i:4;i:-1;i:5;i:-1;i:6;i:-1;i:8;i:-1;i:9;i:-1;i:10;i:-1;}s:55:"/home/bjartka/public_html/doctrine/models/GroupUser.php";a:7:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:13;i:1;i:14;i:1;i:15;i:1;}s:63:"/home/bjartka/public_html/doctrine/tests/Ticket/428TestCase.php";a:18:{i:18;i:1;i:24;i:1;i:26;i:1;i:27;i:1;i:28;i:1;i:29;i:1;i:30;i:1;i:31;i:1;i:32;i:1;i:33;i:1;i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:47;i:1;i:48;i:1;i:49;i:-2;i:51;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/DataDict/MssqlTestCase.php";a:128:{i:38;i:1;i:39;i:-1;i:40;i:1;i:41;i:1;i:43;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:78;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:110;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:124;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:135;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:142;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:149;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:158;i:1;i:160;i:1;i:162;i:1;i:164;i:1;i:166;i:1;i:168;i:1;i:169;i:1;i:173;i:1;i:175;i:1;i:176;i:1;i:179;i:1;i:181;i:1;i:182;i:1;i:185;i:1;i:187;i:1;i:188;i:1;i:191;i:1;i:193;i:1;i:194;i:1;i:197;i:1;i:199;i:1;i:200;i:1;i:203;i:1;i:205;i:1;i:206;i:1;i:209;i:1;i:211;i:1;i:212;i:1;i:215;i:1;i:217;i:1;i:218;i:1;i:221;i:1;i:223;i:1;i:224;i:1;i:227;i:1;i:229;i:1;i:230;i:1;i:233;i:1;i:235;i:1;i:236;i:1;i:239;i:1;i:241;i:1;i:242;i:1;i:245;i:1;i:247;i:1;i:248;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Sequence/FirebirdTestCase.php";a:10:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:54;i:1;}s:72:"/home/bjartka/public_html/doctrine/tests/Collection/SnapshotTestCase.php";a:60:{i:43;i:1;i:45;i:1;i:46;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:86;i:1;i:88;i:1;i:89;i:1;i:91;i:1;i:93;i:1;i:95;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:102;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:112;i:1;i:114;i:1;i:115;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:129;i:1;i:130;i:1;i:132;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:141;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Record/StateTestCase.php";a:13:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:47;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:62;i:1;}s:62:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection.php";a:374:{i:0;i:1;i:21;i:1;i:56;i:1;i:175;i:1;i:176;i:1;i:177;i:-1;i:178;i:-2;i:179;i:1;i:181;i:1;i:183;i:1;i:184;i:1;i:186;i:1;i:187;i:1;i:188;i:1;i:190;i:1;i:191;i:1;i:192;i:-1;i:193;i:-1;i:195;i:1;i:197;i:1;i:199;i:1;i:200;i:1;i:202;i:1;i:203;i:1;i:215;i:-1;i:216;i:-1;i:217;i:-2;i:218;i:-1;i:230;i:1;i:231;i:1;i:232;i:1;i:233;i:-2;i:234;i:1;i:235;i:-2;i:237;i:1;i:239;i:1;i:240;i:-2;i:241;i:-2;i:243;i:-2;i:244;i:-1;i:245;i:-1;i:246;i:-1;i:247;i:-1;i:249;i:-1;i:251;i:-2;i:258;i:-1;i:259;i:-2;i:274;i:1;i:275;i:1;i:276;i:1;i:277;i:1;i:278;i:1;i:279;i:1;i:280;i:1;i:283;i:1;i:284;i:-2;i:294;i:1;i:295;i:-2;i:312;i:1;i:313;i:1;i:314;i:-2;i:316;i:1;i:317;i:1;i:318;i:-2;i:319;i:1;i:321;i:1;i:322;i:1;i:323;i:1;i:324;i:1;i:325;i:1;i:326;i:1;i:327;i:1;i:328;i:1;i:329;i:1;i:330;i:1;i:331;i:1;i:333;i:1;i:334;i:-2;i:343;i:1;i:344;i:-2;i:353;i:1;i:355;i:1;i:356;i:-2;i:367;i:1;i:368;i:1;i:369;i:-2;i:371;i:1;i:373;i:1;i:375;i:1;i:376;i:1;i:378;i:1;i:379;i:1;i:380;i:1;i:381;i:1;i:383;i:1;i:384;i:1;i:385;i:1;i:386;i:1;i:388;i:1;i:389;i:-1;i:391;i:-1;i:392;i:-1;i:393;i:-1;i:394;i:-1;i:396;i:-1;i:399;i:1;i:401;i:1;i:402;i:1;i:403;i:-2;i:404;i:1;i:405;i:1;i:407;i:1;i:409;i:1;i:410;i:1;i:411;i:-2;i:415;i:1;i:416;i:1;i:425;i:-1;i:435;i:-1;i:436;i:-1;i:437;i:-1;i:438;i:-2;i:476;i:-1;i:477;i:-1;i:478;i:-2;i:479;i:-1;i:481;i:-1;i:482;i:-1;i:484;i:-1;i:485;i:-1;i:486;i:-1;i:488;i:-1;i:489;i:-1;i:490;i:-1;i:491;i:-1;i:493;i:-1;i:494;i:-1;i:495;i:-1;i:497;i:-1;i:499;i:-1;i:501;i:-1;i:502;i:-2;i:514;i:1;i:516;i:1;i:517;i:1;i:518;i:1;i:521;i:1;i:522;i:1;i:525;i:1;i:526;i:-2;i:539;i:1;i:540;i:-1;i:541;i:-2;i:543;i:1;i:544;i:1;i:545;i:1;i:546;i:-1;i:547;i:-1;i:548;i:-1;i:549;i:1;i:551;i:1;i:553;i:1;i:555;i:1;i:556;i:1;i:557;i:1;i:558;i:1;i:560;i:1;i:561;i:-2;i:572;i:1;i:573;i:-1;i:574;i:-2;i:576;i:1;i:579;i:1;i:581;i:1;i:582;i:1;i:583;i:1;i:584;i:1;i:585;i:1;i:586;i:1;i:587;i:1;i:588;i:1;i:590;i:1;i:593;i:1;i:594;i:1;i:595;i:1;i:597;i:1;i:600;i:1;i:601;i:-2;i:611;i:-1;i:648;i:1;i:649;i:1;i:651;i:1;i:652;i:1;i:653;i:-2;i:654;i:1;i:655;i:-2;i:669;i:1;i:670;i:-2;i:682;i:1;i:683;i:-2;i:694;i:-1;i:705;i:1;i:706;i:-2;i:718;i:1;i:719;i:-2;i:730;i:1;i:731;i:-2;i:742;i:1;i:743;i:-2;i:755;i:1;i:756;i:-2;i:767;i:1;i:768;i:-2;i:779;i:-1;i:780;i:-2;i:801;i:1;i:803;i:1;i:804;i:-2;i:813;i:1;i:816;i:1;i:818;i:1;i:820;i:1;i:822;i:1;i:823;i:1;i:824;i:1;i:826;i:1;i:828;i:1;i:829;i:1;i:830;i:1;i:832;i:1;i:833;i:-2;i:856;i:1;i:858;i:1;i:859;i:1;i:860;i:-1;i:861;i:-2;i:862;i:1;i:863;i:-2;i:876;i:-1;i:877;i:-1;i:878;i:-1;i:879;i:-1;i:880;i:-2;i:892;i:1;i:893;i:-2;i:904;i:1;i:907;i:1;i:908;i:1;i:909;i:1;i:910;i:1;i:911;i:-2;i:912;i:1;i:914;i:1;i:916;i:1;i:917;i:1;i:918;i:1;i:919;i:1;i:920;i:1;i:922;i:1;i:924;i:-2;i:925;i:-2;i:927;i:-2;i:928;i:-2;i:938;i:1;i:941;i:1;i:942;i:1;i:943;i:1;i:945;i:1;i:946;i:-2;i:947;i:1;i:949;i:1;i:951;i:1;i:952;i:1;i:954;i:1;i:955;i:1;i:956;i:1;i:958;i:1;i:960;i:1;i:961;i:1;i:963;i:1;i:964;i:-2;i:973;i:1;i:975;i:1;i:977;i:1;i:979;i:1;i:980;i:1;i:981;i:-1;i:982;i:-1;i:983;i:1;i:985;i:1;i:986;i:1;i:987;i:-2;i:989;i:-1;i:990;i:-1;i:1001;i:1;i:1002;i:-2;i:1012;i:1;i:1013;i:1;i:1014;i:-2;i:1015;i:1;i:1017;i:1;i:1018;i:1;i:1019;i:1;i:1020;i:1;i:1023;i:1;i:1025;i:1;i:1026;i:-2;i:1035;i:1;i:1036;i:-2;i:1052;i:1;i:1053;i:-2;i:1062;i:1;i:1063;i:-2;i:1074;i:-1;i:1076;i:-1;i:1077;i:-1;i:1078;i:-2;i:1079;i:-1;i:1080;i:-1;i:1081;i:-2;i:1093;i:1;i:1094;i:-2;i:1103;i:-1;i:1104;i:-2;i:1116;i:1;i:1117;i:1;i:1118;i:1;i:1119;i:1;i:1129;i:1;i:1130;i:1;i:1131;i:1;i:1132;i:1;i:1133;i:1;i:1143;i:1;i:1144;i:1;i:1145;i:1;i:1155;i:1;i:1157;i:1;i:1159;i:1;i:1161;i:1;i:1162;i:1;i:1164;i:1;i:1165;i:1;i:1174;i:-1;i:1175;i:-2;i:1185;i:-1;i:1187;i:-1;i:1188;i:-2;i:1198;i:-1;i:1200;i:-1;i:1201;i:-2;i:1211;i:-1;i:1212;i:-2;i:1221;i:1;i:1222;i:-1;i:1223;i:-2;i:1225;i:1;i:1226;i:-2;i:1235;i:1;i:1236;i:-1;i:1237;i:-2;i:1239;i:1;i:1240;i:-2;i:1256;i:-1;i:1257;i:-2;i:1274;i:1;i:1275;i:1;i:1292;i:1;i:1293;i:1;i:1311;i:1;i:1312;i:1;i:1320;i:-1;i:1321;i:-2;i:1323;i:1;}s:74:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record/Filter/Standard.php";a:6:{i:34;i:1;i:44;i:1;i:45;i:-2;i:55;i:1;i:56;i:-2;i:57;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Condition.php";a:40:{i:21;i:1;i:33;i:1;i:44;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:-2;i:69;i:1;i:74;i:1;i:75;i:-2;i:91;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:98;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:110;i:1;i:111;i:-2;i:113;i:1;}s:62:"/home/bjartka/public_html/doctrine/lib/Doctrine/Collection.php";a:302:{i:0;i:1;i:21;i:1;i:34;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:107;i:-1;i:108;i:-1;i:118;i:1;i:119;i:-2;i:129;i:1;i:130;i:1;i:139;i:-1;i:141;i:-1;i:142;i:-1;i:143;i:-1;i:144;i:-1;i:145;i:-1;i:146;i:-1;i:148;i:-1;i:150;i:-1;i:151;i:-2;i:161;i:-1;i:162;i:-1;i:164;i:-1;i:166;i:-1;i:167;i:-1;i:168;i:-1;i:170;i:-1;i:172;i:-1;i:173;i:-1;i:174;i:-1;i:175;i:-1;i:177;i:-1;i:178;i:-1;i:179;i:-1;i:180;i:-1;i:191;i:-1;i:193;i:-1;i:194;i:-2;i:204;i:-1;i:205;i:-2;i:215;i:1;i:216;i:-2;i:226;i:1;i:227;i:-2;i:237;i:1;i:238;i:-2;i:246;i:1;i:247;i:-2;i:255;i:1;i:256;i:-2;i:265;i:1;i:266;i:1;i:268;i:1;i:269;i:1;i:271;i:1;i:273;i:1;i:275;i:1;i:276;i:1;i:277;i:1;i:278;i:1;i:279;i:-1;i:281;i:1;i:282;i:1;i:284;i:1;i:285;i:1;i:294;i:-1;i:295;i:-2;i:306;i:1;i:308;i:1;i:309;i:1;i:310;i:-2;i:321;i:1;i:322;i:-2;i:325;i:-1;i:326;i:-2;i:347;i:1;i:348;i:1;i:350;i:1;i:351;i:1;i:353;i:1;i:354;i:1;i:355;i:1;i:356;i:1;i:358;i:1;i:359;i:1;i:360;i:1;i:361;i:1;i:362;i:1;i:365;i:1;i:367;i:1;i:368;i:1;i:370;i:1;i:371;i:-2;i:373;i:1;i:374;i:-2;i:381;i:-1;i:382;i:-1;i:384;i:-1;i:385;i:-1;i:386;i:-1;i:387;i:-1;i:388;i:-1;i:390;i:-1;i:391;i:-1;i:392;i:-2;i:400;i:-1;i:401;i:-2;i:412;i:1;i:413;i:-2;i:423;i:1;i:424;i:1;i:425;i:1;i:427;i:1;i:428;i:1;i:438;i:1;i:439;i:1;i:441;i:1;i:442;i:1;i:443;i:1;i:444;i:-1;i:446;i:1;i:452;i:1;i:453;i:1;i:454;i:1;i:455;i:-2;i:456;i:1;i:458;i:1;i:459;i:-1;i:460;i:-1;i:461;i:-2;i:462;i:-1;i:463;i:-1;i:464;i:-2;i:466;i:1;i:467;i:-1;i:468;i:-1;i:469;i:-1;i:470;i:-2;i:471;i:-1;i:472;i:-1;i:473;i:1;i:475;i:1;i:476;i:-2;i:486;i:-1;i:487;i:-1;i:489;i:-1;i:490;i:-1;i:491;i:-1;i:492;i:-1;i:493;i:-1;i:494;i:-1;i:495;i:-1;i:496;i:-1;i:497;i:-1;i:499;i:-1;i:500;i:-2;i:502;i:-1;i:504;i:-1;i:505;i:-1;i:506;i:-1;i:507;i:-1;i:508;i:-1;i:509;i:-1;i:510;i:-1;i:511;i:-1;i:512;i:-1;i:513;i:-1;i:514;i:-1;i:517;i:-1;i:519;i:-1;i:521;i:-1;i:522;i:-1;i:533;i:-1;i:534;i:-1;i:535;i:-1;i:536;i:-1;i:538;i:-1;i:539;i:-1;i:540;i:-1;i:541;i:-1;i:542;i:-1;i:543;i:-1;i:544;i:-1;i:545;i:-1;i:546;i:-1;i:547;i:-1;i:548;i:-1;i:549;i:-1;i:550;i:-2;i:551;i:-1;i:553;i:-1;i:554;i:-1;i:555;i:-1;i:556;i:-1;i:557;i:-1;i:558;i:-1;i:560;i:-1;i:561;i:-1;i:562;i:-1;i:563;i:-1;i:564;i:-1;i:565;i:-1;i:567;i:-1;i:568;i:-1;i:569;i:-1;i:570;i:-2;i:571;i:-1;i:572;i:-1;i:573;i:-1;i:574;i:-1;i:575;i:-1;i:576;i:-1;i:577;i:-1;i:579;i:-1;i:580;i:-1;i:581;i:-1;i:591;i:-1;i:592;i:-2;i:609;i:1;i:611;i:1;i:612;i:-2;i:622;i:1;i:623;i:-2;i:639;i:1;i:640;i:1;i:641;i:1;i:643;i:1;i:644;i:-2;i:654;i:-1;i:655;i:-1;i:657;i:-1;i:659;i:-1;i:660;i:-1;i:662;i:-1;i:663;i:-2;i:676;i:-1;i:677;i:-1;i:678;i:-1;i:679;i:-1;i:680;i:-1;i:693;i:-1;i:694;i:-1;i:695;i:-2;i:696;i:-1;i:698;i:-2;i:711;i:-1;i:712;i:-1;i:713;i:-2;i:714;i:-1;i:716;i:-2;i:725;i:1;i:726;i:-2;i:735;i:1;i:736;i:-2;i:744;i:1;i:745;i:1;i:746;i:-2;i:748;i:1;i:749;i:-2;i:761;i:1;i:762;i:1;i:763;i:1;i:765;i:1;i:767;i:1;i:769;i:1;i:771;i:1;i:772;i:1;i:773;i:1;i:775;i:1;i:777;i:1;i:778;i:-2;i:790;i:1;i:791;i:1;i:792;i:1;i:794;i:1;i:795;i:1;i:797;i:1;i:798;i:1;i:799;i:1;i:801;i:1;i:803;i:1;i:805;i:1;i:806;i:-2;i:814;i:1;i:815;i:1;i:816;i:-2;i:823;i:-1;i:824;i:-2;i:832;i:-1;i:833;i:-2;i:835;i:1;}s:77:"/home/bjartka/public_html/doctrine/lib/Doctrine/Relation/Parser/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Search/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/Log_Entry.php";a:5:{i:4;i:1;i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/App_User.php";a:10:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:13;i:1;i:14;i:1;}s:56:"/home/bjartka/public_html/doctrine/models/Log_Status.php";a:2:{i:4;i:-1;i:5;i:-1;}s:66:"/home/bjartka/public_html/doctrine/tests/DataType/EnumTestCase.php";a:93:{i:36;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:-2;i:57;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:-2;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:-2;i:78;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:-2;i:89;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:-2;i:100;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:126;i:1;i:128;i:1;i:130;i:1;i:131;i:1;i:133;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:139;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:146;i:1;i:147;i:1;i:149;i:1;i:150;i:1;i:154;i:1;i:156;i:1;i:159;i:1;i:161;i:-1;i:162;i:1;i:163;i:1;i:165;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:172;i:1;i:174;i:1;i:175;i:-1;i:176;i:-1;i:177;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:188;i:1;i:190;i:1;i:191;i:1;}s:69:"/home/bjartka/public_html/doctrine/tests/Validator/FutureTestCase.php";a:25:{i:37;i:1;i:38;i:1;i:39;i:1;i:44;i:1;i:48;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:69;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Query/UpdateTestCase.php";a:22:{i:39;i:1;i:41;i:1;i:43;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:69;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:77;i:1;i:79;i:1;i:81;i:1;i:82;i:1;}s:72:"/home/bjartka/public_html/doctrine/tests/Query/JoinConditionTestCase.php";a:18:{i:36;i:1;i:38;i:1;i:41;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:65;i:1;i:67;i:1;i:69;i:1;i:70;i:1;}s:61:"/home/bjartka/public_html/doctrine/lib/Doctrine/Exception.php";a:8:{i:33;i:1;i:84;i:-1;i:85;i:-1;i:86;i:-2;i:88;i:-1;i:89;i:-1;i:90;i:-2;i:93;i:1;}s:73:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/UnitOfWork.php";a:373:{i:21;i:1;i:33;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:80;i:1;i:81;i:1;i:82;i:-2;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:111;i:1;i:112;i:1;i:114;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:123;i:-1;i:124;i:-1;i:125;i:-1;i:126;i:-1;i:127;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:-2;i:143;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:-2;i:150;i:1;i:152;i:1;i:153;i:1;i:155;i:1;i:157;i:1;i:158;i:1;i:160;i:1;i:162;i:1;i:163;i:1;i:165;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:177;i:1;i:178;i:-2;i:179;i:1;i:181;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:188;i:1;i:190;i:1;i:192;i:1;i:193;i:1;i:195;i:1;i:196;i:1;i:199;i:1;i:200;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:206;i:1;i:208;i:1;i:210;i:1;i:212;i:1;i:213;i:-2;i:223;i:1;i:225;i:1;i:227;i:1;i:229;i:1;i:230;i:1;i:231;i:1;i:232;i:1;i:233;i:1;i:234;i:1;i:235;i:1;i:236;i:1;i:237;i:1;i:238;i:1;i:239;i:1;i:241;i:1;i:242;i:-1;i:243;i:1;i:245;i:1;i:247;i:1;i:248;i:1;i:260;i:1;i:261;i:1;i:262;i:-2;i:263;i:1;i:265;i:1;i:267;i:1;i:269;i:1;i:271;i:1;i:273;i:1;i:275;i:1;i:277;i:1;i:279;i:1;i:280;i:1;i:281;i:1;i:283;i:1;i:284;i:1;i:286;i:1;i:287;i:1;i:288;i:1;i:289;i:1;i:291;i:1;i:292;i:1;i:294;i:1;i:297;i:1;i:299;i:1;i:301;i:1;i:303;i:1;i:305;i:1;i:306;i:-2;i:313;i:-1;i:314;i:-1;i:316;i:-1;i:317;i:-1;i:318;i:-1;i:320;i:-1;i:323;i:-1;i:324;i:-1;i:327;i:-1;i:328;i:-2;i:341;i:-1;i:342;i:-1;i:343;i:-1;i:347;i:-1;i:348;i:-1;i:349;i:-1;i:351;i:-1;i:352;i:-1;i:354;i:-1;i:355;i:-1;i:356;i:-1;i:357;i:-1;i:358;i:-1;i:359;i:-1;i:360;i:-1;i:361;i:-1;i:362;i:-1;i:363;i:-1;i:364;i:-1;i:365;i:-1;i:367;i:-1;i:368;i:-1;i:369;i:-1;i:370;i:-1;i:371;i:-1;i:375;i:-1;i:376;i:-1;i:377;i:-1;i:380;i:-1;i:381;i:-1;i:382;i:-1;i:383;i:-1;i:385;i:-1;i:386;i:-1;i:388;i:-1;i:389;i:-1;i:400;i:1;i:401;i:1;i:402;i:1;i:404;i:1;i:405;i:1;i:407;i:1;i:408;i:1;i:409;i:1;i:411;i:1;i:414;i:1;i:415;i:1;i:424;i:1;i:425;i:1;i:426;i:1;i:428;i:1;i:429;i:-2;i:448;i:1;i:449;i:1;i:451;i:1;i:452;i:1;i:454;i:1;i:455;i:1;i:456;i:1;i:457;i:1;i:458;i:1;i:460;i:1;i:461;i:1;i:463;i:1;i:464;i:1;i:465;i:1;i:466;i:1;i:468;i:1;i:469;i:1;i:470;i:1;i:471;i:1;i:472;i:1;i:483;i:1;i:484;i:1;i:485;i:1;i:486;i:1;i:487;i:1;i:488;i:1;i:489;i:1;i:490;i:1;i:491;i:1;i:492;i:1;i:504;i:1;i:507;i:1;i:508;i:1;i:510;i:1;i:511;i:1;i:512;i:1;i:513;i:1;i:516;i:1;i:517;i:1;i:519;i:1;i:520;i:1;i:521;i:1;i:522;i:1;i:523;i:1;i:533;i:1;i:535;i:1;i:537;i:1;i:539;i:1;i:541;i:1;i:542;i:1;i:544;i:1;i:545;i:1;i:547;i:1;i:549;i:1;i:550;i:1;i:552;i:1;i:553;i:1;i:554;i:-1;i:555;i:-1;i:556;i:-1;i:557;i:-1;i:558;i:-1;i:559;i:1;i:561;i:1;i:562;i:1;i:564;i:1;i:565;i:1;i:566;i:1;i:567;i:1;i:569;i:1;i:571;i:1;i:572;i:1;i:574;i:1;i:576;i:1;i:578;i:1;i:579;i:-2;i:590;i:1;i:592;i:1;i:594;i:1;i:596;i:1;i:598;i:1;i:599;i:1;i:600;i:1;i:602;i:1;i:604;i:1;i:605;i:1;i:607;i:1;i:608;i:1;i:609;i:1;i:611;i:1;i:613;i:1;i:614;i:1;i:615;i:1;i:616;i:1;i:617;i:1;i:619;i:1;i:621;i:1;i:622;i:1;i:623;i:1;i:625;i:1;i:627;i:1;i:629;i:1;i:631;i:1;i:633;i:1;i:634;i:-2;i:641;i:1;i:643;i:1;i:645;i:1;i:647;i:1;i:649;i:1;i:650;i:1;i:651;i:1;i:652;i:1;i:653;i:-2;i:655;i:1;i:656;i:1;i:657;i:1;i:658;i:1;i:660;i:1;i:662;i:1;i:663;i:-2;i:670;i:1;i:672;i:1;i:673;i:-1;i:674;i:-2;i:676;i:1;i:677;i:1;i:679;i:1;i:681;i:1;i:682;i:1;i:683;i:1;i:684;i:1;i:686;i:1;i:687;i:1;i:689;i:1;i:691;i:1;i:692;i:1;i:694;i:1;i:695;i:-1;i:696;i:-1;i:698;i:1;i:700;i:1;i:701;i:-1;i:702;i:-2;i:704;i:1;i:705;i:1;i:706;i:1;i:708;i:1;i:710;i:1;}s:79:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Sqlite/Exception.php";a:11:{i:21;i:1;i:34;i:1;i:69;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:-2;i:75;i:1;i:76;i:-1;i:77;i:-2;i:78;i:1;}s:79:"/home/bjartka/public_html/doctrine/lib/Doctrine/Adapter/Statement/Interface.php";a:2:{i:33;i:1;i:294;i:1;}s:79:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Oracle/Exception.php";a:10:{i:21;i:1;i:34;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:-2;i:78;i:-1;i:79;i:-2;i:80;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Import/Firebird.php";a:29:{i:21;i:1;i:33;i:1;i:42;i:1;i:44;i:1;i:45;i:-2;i:56;i:1;i:57;i:1;i:59;i:1;i:60;i:-2;i:69;i:1;i:70;i:-2;i:79;i:1;i:80;i:-2;i:90;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:-2;i:104;i:1;i:106;i:1;i:107;i:-2;i:119;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:124;i:1;i:126;i:1;i:127;i:-2;i:128;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Expression/Mock.php";a:3:{i:21;i:1;i:34;i:1;i:35;i:1;}s:58:"/home/bjartka/public_html/doctrine/models/ORM_TestItem.php";a:6:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:11;i:1;i:12;i:1;}s:69:"/home/bjartka/public_html/doctrine/models/ValidatorTest_DateModel.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:58:"/home/bjartka/public_html/doctrine/models/MyOtherThing.php";a:5:{i:4;i:1;i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;}s:56:"/home/bjartka/public_html/doctrine/models/MyOneThing.php";a:5:{i:4;i:-1;i:5;i:-1;i:6;i:-1;i:8;i:-1;i:9;i:-1;}s:51:"/home/bjartka/public_html/doctrine/models/Email.php";a:2:{i:6;i:1;i:7;i:1;}s:51:"/home/bjartka/public_html/doctrine/models/RateN.php";a:11:{i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;}s:63:"/home/bjartka/public_html/doctrine/models/ORM_AccessControl.php";a:4:{i:6;i:-1;i:7;i:-1;i:10;i:-1;i:11;i:-1;}s:60:"/home/bjartka/public_html/doctrine/models/Forum_Category.php";a:9:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;}s:51:"/home/bjartka/public_html/doctrine/models/Photo.php";a:4:{i:4;i:1;i:5;i:1;i:7;i:1;i:8;i:1;}s:80:"/home/bjartka/public_html/doctrine/models/ValidatorTest_ClientToAddressModel.php";a:5:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:14;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/VersioningTest.php";a:5:{i:6;i:1;i:7;i:1;i:8;i:1;i:11;i:1;i:12;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Ticket/NjeroTestCase.php";a:49:{i:16;i:1;i:19;i:1;i:20;i:1;i:21;i:1;i:22;i:1;i:23;i:1;i:24;i:1;i:25;i:1;i:29;i:1;i:30;i:1;i:31;i:1;i:32;i:1;i:34;i:1;i:35;i:1;i:36;i:1;i:37;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:61;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:86;i:1;}s:63:"/home/bjartka/public_html/doctrine/tests/Ticket/480TestCase.php";a:12:{i:38;i:1;i:39;i:1;i:40;i:1;i:42;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:56;i:1;i:57;i:1;i:61;i:1;i:62;i:1;i:64;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/Import/FirebirdTestCase.php";a:21:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:73;i:1;i:75;i:1;i:76;i:1;}s:60:"/home/bjartka/public_html/doctrine/tests/HydrateTestCase.php";a:22:{i:58;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:80;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:98;i:-1;i:99;i:-1;i:103;i:-1;i:104;i:-2;}s:71:"/home/bjartka/public_html/doctrine/tests/Query/ShortAliasesTestCase.php";a:6:{i:13;i:1;i:15;i:1;i:17;i:1;i:19;i:1;i:21;i:1;i:23;i:1;}s:69:"/home/bjartka/public_html/doctrine/tests/Query/ExpressionTestCase.php";a:41:{i:38;i:1;i:41;i:1;i:43;i:1;i:44;i:-1;i:45;i:1;i:46;i:1;i:48;i:1;i:52;i:1;i:55;i:1;i:57;i:1;i:58;i:-1;i:59;i:1;i:60;i:1;i:62;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:75;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:84;i:1;i:86;i:1;i:88;i:1;i:89;i:1;i:93;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:109;i:1;i:111;i:1;i:112;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Common.php";a:14:{i:21;i:1;i:33;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:-1;i:53;i:-1;i:55;i:1;i:56;i:-2;i:57;i:1;}s:79:"/home/bjartka/public_html/doctrine/lib/Doctrine/Plugin.php(236) : eval()'d code";a:36:{i:4;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:20;i:1;i:21;i:1;i:22;i:1;i:23;i:1;i:24;i:1;i:25;i:1;i:26;i:1;i:27;i:1;i:28;i:1;i:29;i:1;i:30;i:1;i:31;i:1;i:32;i:1;i:33;i:1;i:34;i:1;i:35;i:1;i:36;i:1;i:38;i:1;i:39;i:1;i:40;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:45;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Future.php";a:32:{i:34;i:1;i:43;i:1;i:44;i:1;i:45;i:-2;i:46;i:1;i:48;i:1;i:49;i:-1;i:50;i:-2;i:52;i:1;i:53;i:-1;i:54;i:-1;i:55;i:-1;i:56;i:-1;i:57;i:-1;i:58;i:-1;i:59;i:-1;i:60;i:-1;i:61;i:-1;i:62;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:-1;i:70;i:1;i:71;i:1;i:72;i:-2;i:73;i:1;i:75;i:-2;i:76;i:1;i:78;i:-2;i:79;i:1;}s:71:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/JoinCondition.php";a:52:{i:21;i:1;i:33;i:1;i:37;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:55;i:1;i:57;i:-1;i:59;i:-1;i:61;i:-1;i:62;i:-1;i:63;i:-1;i:64;i:-1;i:65;i:-1;i:67;i:-1;i:69;i:-1;i:70;i:-1;i:71;i:-1;i:72;i:-1;i:73;i:-1;i:74;i:-1;i:75;i:-1;i:77;i:-1;i:78;i:-1;i:80;i:-1;i:81;i:1;i:82;i:-1;i:83;i:-1;i:84;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:-1;i:95;i:-1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:103;i:-2;i:104;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/EntityAddress.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/ORM_TestEntry.php";a:9:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:13;i:1;i:14;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/Task.php";a:6:{i:4;i:1;i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/ForeignKeyTest2.php";a:4:{i:6;i:-1;i:7;i:-1;i:9;i:-1;i:10;i:-1;}s:54:"/home/bjartka/public_html/doctrine/models/gnatUser.php";a:6:{i:8;i:1;i:9;i:1;i:10;i:1;i:14;i:1;i:15;i:1;i:16;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/CoverageCodeN.php";a:6:{i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:13;i:1;}s:58:"/home/bjartka/public_html/doctrine/models/BookmarkUser.php";a:6:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:12;i:1;i:13;i:1;}s:63:"/home/bjartka/public_html/doctrine/tests/ConnectionTestCase.php";a:122:{i:39;i:1;i:40;i:-1;i:41;i:1;i:42;i:1;i:44;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:66;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:82;i:1;i:84;i:1;i:86;i:1;i:88;i:1;i:89;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:110;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:127;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:134;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:144;i:1;i:145;i:1;i:149;i:1;i:150;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:161;i:1;i:162;i:1;i:164;i:1;i:165;i:-1;i:166;i:1;i:167;i:1;i:169;i:1;i:171;i:1;i:172;i:1;i:174;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:184;i:1;i:185;i:1;i:189;i:1;i:190;i:1;i:194;i:1;i:195;i:1;i:199;i:1;i:200;i:1;i:201;i:1;i:205;i:1;i:206;i:1;i:210;i:1;i:211;i:1;i:212;i:1;i:213;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:220;i:1;i:221;i:1;i:222;i:1;i:223;i:1;i:224;i:1;i:225;i:1;i:226;i:1;i:227;i:1;i:228;i:1;i:229;i:1;i:230;i:1;i:231;i:1;i:232;i:1;i:233;i:1;i:237;i:1;i:240;i:1;i:242;i:1;i:243;i:1;i:244;i:1;i:245;i:-2;i:247;i:1;i:248;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/Query/ConditionTestCase.php";a:51:{i:35;i:1;i:36;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:45;i:1;i:47;i:1;i:50;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:69;i:1;i:71;i:1;i:73;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:88;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:96;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:109;i:1;i:111;i:1;i:113;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:121;i:1;}s:73:"/home/bjartka/public_html/doctrine/tests/CustomResultSetOrderTestCase.php";a:69:{i:44;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:109;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:126;i:1;i:127;i:1;i:128;i:-1;i:130;i:1;i:131;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:153;i:1;i:156;i:1;i:158;i:1;i:159;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:172;i:1;i:173;i:1;i:174;i:-1;i:176;i:1;i:177;i:1;}s:81:"/home/bjartka/public_html/doctrine/tests/ColumnAggregationInheritanceTestCase.php";a:28:{i:40;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/DataDict/Mssql.php";a:113:{i:21;i:1;i:34;i:1;i:61;i:1;i:62;i:-1;i:63;i:-2;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:-1;i:82;i:-1;i:83;i:-1;i:84;i:-2;i:85;i:-1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:-1;i:90;i:-1;i:91;i:-1;i:92;i:-2;i:93;i:-1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:-1;i:110;i:-1;i:111;i:-1;i:112;i:-1;i:113;i:-1;i:115;i:-1;i:116;i:-2;i:126;i:1;i:127;i:1;i:129;i:1;i:131;i:1;i:133;i:1;i:134;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:-1;i:167;i:-1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:188;i:-2;i:190;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Sequence/Firebird.php";a:28:{i:21;i:1;i:33;i:1;i:45;i:1;i:47;i:1;i:50;i:1;i:52;i:1;i:53;i:-2;i:58;i:-2;i:59;i:-2;i:60;i:-2;i:65;i:-2;i:66;i:-2;i:67;i:-2;i:69;i:1;i:70;i:-2;i:81;i:1;i:82;i:-2;i:93;i:1;i:96;i:1;i:98;i:1;i:99;i:1;i:100;i:-2;i:102;i:1;i:103;i:-1;i:104;i:-2;i:105;i:1;i:106;i:-2;i:107;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/DateTest.php";a:2:{i:4;i:-1;i:5;i:-1;}s:66:"/home/bjartka/public_html/doctrine/models/ValidatorTest_Person.php";a:5:{i:4;i:1;i:5;i:1;i:6;i:1;i:9;i:1;i:10;i:1;}s:80:"/home/bjartka/public_html/doctrine/tests/Record/SerializeUnserializeTestCase.php";a:48:{i:38;i:1;i:40;i:1;i:41;i:1;i:44;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:83;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:93;i:1;i:95;i:1;i:97;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:112;i:1;i:113;i:1;}s:68:"/home/bjartka/public_html/doctrine/tests/Migration/MysqlTestCase.php";a:21:{i:39;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:-1;i:46;i:1;i:47;i:1;i:49;i:1;i:53;i:1;i:56;i:-1;i:57;i:-1;i:58;i:-1;i:61;i:-1;i:64;i:-1;i:67;i:-1;i:69;i:-1;i:72;i:-1;i:75;i:-1;i:76;i:-1;i:77;i:1;i:79;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Tokenizer.php";a:172:{i:37;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:86;i:1;i:87;i:-1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:-1;i:96;i:-1;i:97;i:-2;i:99;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:-2;i:115;i:1;i:116;i:1;i:117;i:-2;i:118;i:1;i:120;i:-2;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:172;i:1;i:173;i:1;i:174;i:-2;i:193;i:1;i:194;i:1;i:195;i:1;i:196;i:1;i:197;i:1;i:200;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:204;i:1;i:206;i:1;i:207;i:1;i:208;i:1;i:209;i:1;i:210;i:1;i:212;i:1;i:213;i:1;i:214;i:1;i:216;i:1;i:217;i:1;i:218;i:-2;i:250;i:1;i:251;i:1;i:252;i:1;i:253;i:1;i:254;i:1;i:256;i:1;i:257;i:1;i:258;i:1;i:260;i:1;i:262;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:268;i:1;i:269;i:1;i:271;i:1;i:272;i:1;i:273;i:1;i:275;i:1;i:276;i:1;i:278;i:1;i:279;i:1;i:280;i:1;i:281;i:1;i:282;i:1;i:283;i:1;i:284;i:1;i:285;i:1;i:286;i:1;i:288;i:1;i:289;i:1;i:290;i:1;i:291;i:1;i:293;i:1;i:294;i:1;i:295;i:1;i:296;i:1;i:297;i:1;i:298;i:1;i:299;i:1;i:300;i:1;i:301;i:1;i:304;i:1;i:305;i:1;i:306;i:-2;i:338;i:1;i:339;i:1;i:341;i:1;i:342;i:1;i:343;i:1;i:345;i:1;i:347;i:1;i:348;i:1;i:350;i:1;i:351;i:1;i:353;i:1;i:354;i:1;i:355;i:1;i:356;i:1;i:357;i:1;i:358;i:1;i:359;i:-2;i:360;i:1;i:361;i:1;i:362;i:1;i:363;i:1;i:366;i:1;i:367;i:1;i:369;i:1;i:370;i:1;i:371;i:1;i:372;i:1;i:373;i:1;i:374;i:1;i:375;i:1;i:376;i:1;i:377;i:1;i:379;i:1;i:380;i:1;i:382;i:1;i:383;i:-2;i:384;i:1;}s:64:"/home/bjartka/public_html/doctrine/lib/Doctrine/Query/Having.php";a:37:{i:21;i:1;i:33;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:60;i:-2;i:61;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:75;i:-2;i:76;i:1;i:79;i:-2;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:-2;i:99;i:1;}s:63:"/home/bjartka/public_html/doctrine/lib/Doctrine/Cache/Array.php";a:17:{i:33;i:1;i:51;i:1;i:52;i:1;i:53;i:-2;i:54;i:1;i:55;i:-2;i:65;i:-1;i:66;i:-2;i:80;i:1;i:81;i:1;i:91;i:-1;i:92;i:-1;i:101;i:-1;i:102;i:-1;i:111;i:1;i:112;i:-2;i:114;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Export/Schema.php";a:52:{i:36;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:-1;i:53;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:-2;i:67;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:96;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:110;i:1;i:111;i:-2;i:123;i:1;i:125;i:1;i:126;i:-1;i:127;i:-1;i:129;i:1;i:130;i:-2;i:131;i:1;}s:57:"/home/bjartka/public_html/doctrine/tests/DoctrineTest.php";a:115:{i:0;i:1;i:48;i:-1;i:49;i:-1;i:50;i:-1;i:61;i:-1;i:62;i:-1;i:63;i:-1;i:74;i:-1;i:75;i:-1;i:76;i:-1;i:77;i:-1;i:78;i:-1;i:79;i:-1;i:80;i:-1;i:81;i:-1;i:82;i:-1;i:83;i:-1;i:84;i:-1;i:85;i:-1;i:86;i:-1;i:87;i:-1;i:88;i:-1;i:89;i:-1;i:90;i:-1;i:94;i:-1;i:95;i:-1;i:96;i:-1;i:97;i:-1;i:98;i:-1;i:99;i:-1;i:100;i:-1;i:101;i:-1;i:102;i:-1;i:104;i:-1;i:105;i:-1;i:107;i:-1;i:108;i:-1;i:109;i:-1;i:110;i:-1;i:113;i:-1;i:114;i:-1;i:115;i:-1;i:116;i:-1;i:117;i:-1;i:118;i:-1;i:119;i:-1;i:120;i:-1;i:121;i:-1;i:122;i:-1;i:123;i:-2;i:126;i:-1;i:150;i:-1;i:151;i:1;i:152;i:1;i:153;i:-1;i:154;i:-1;i:155;i:-1;i:156;i:-1;i:157;i:-1;i:158;i:-1;i:161;i:-2;i:162;i:-1;i:163;i:-1;i:172;i:-1;i:173;i:-1;i:174;i:-1;i:175;i:-1;i:176;i:-1;i:177;i:-1;i:178;i:-1;i:179;i:-1;i:180;i:-1;i:181;i:-1;i:190;i:-1;i:191;i:-1;i:192;i:-1;i:193;i:-1;i:194;i:-1;i:195;i:-1;i:196;i:-1;i:197;i:-1;i:198;i:-1;i:199;i:-1;i:200;i:-1;i:201;i:-1;i:202;i:-1;i:204;i:-1;i:205;i:-1;i:206;i:-2;i:217;i:1;i:218;i:1;i:219;i:-2;i:221;i:-1;i:222;i:-1;i:224;i:-1;i:226;i:-1;i:227;i:-1;i:228;i:-2;i:230;i:-1;i:232;i:-1;i:234;i:-1;i:235;i:-1;i:236;i:-1;i:237;i:-1;i:242;i:-1;i:243;i:-1;i:244;i:-1;i:246;i:-1;i:247;i:-1;i:248;i:-1;i:250;i:-1;i:251;i:-1;i:252;i:-1;i:254;i:-1;i:255;i:-2;}s:69:"/home/bjartka/public_html/doctrine/models/FooForeignlyOwnedWithPK.php";a:4:{i:6;i:1;i:7;i:1;i:10;i:1;i:11;i:1;}s:55:"/home/bjartka/public_html/doctrine/models/CPK_Test2.php";a:4:{i:4;i:-1;i:5;i:-1;i:7;i:-1;i:8;i:-1;}s:65:"/home/bjartka/public_html/doctrine/models/PackageVersionNotes.php";a:5:{i:6;i:-1;i:7;i:-1;i:8;i:-1;i:11;i:-1;i:12;i:-1;}s:67:"/home/bjartka/public_html/doctrine/models/TestMovieUserBookmark.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/PolicyCodeN.php";a:6:{i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:13;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Record/ZeroValuesTestCase.php";a:24:{i:37;i:1;i:39;i:1;i:40;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:67;i:1;i:68;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:77;i:1;}s:56:"/home/bjartka/public_html/doctrine/lib/Doctrine/Null.php";a:7:{i:0;i:1;i:37;i:1;i:40;i:-1;i:41;i:-2;i:44;i:1;i:45;i:-2;i:46;i:1;}s:78:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Mysql/Exception.php";a:10:{i:21;i:1;i:34;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:-2;i:83;i:-1;i:84;i:-2;i:85;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction/Mssql.php";a:15:{i:21;i:1;i:33;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:68;i:1;}s:71:"/home/bjartka/public_html/doctrine/lib/Doctrine/Template/Searchable.php";a:20:{i:33;i:1;i:37;i:1;i:38;i:1;i:42;i:1;i:43;i:-2;i:47;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:65;i:1;i:66;i:1;i:68;i:1;}s:74:"/home/bjartka/public_html/doctrine/lib/Doctrine/Template/Timestampable.php";a:8:{i:35;i:1;i:59;i:1;i:60;i:1;i:69;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;}s:64:"/home/bjartka/public_html/doctrine/models/FooReferenceRecord.php";a:4:{i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;}s:71:"/home/bjartka/public_html/doctrine/models/CascadeDeleteRelatedTest2.php";a:7:{i:6;i:-1;i:7;i:-1;i:8;i:-1;i:11;i:-1;i:12;i:-1;i:13;i:-1;i:14;i:-1;}s:60:"/home/bjartka/public_html/doctrine/models/mmrGroupUser_C.php";a:3:{i:7;i:-1;i:8;i:-1;i:9;i:-1;}s:52:"/home/bjartka/public_html/doctrine/models/Policy.php";a:6:{i:6;i:1;i:7;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/PackageVersion.php";a:6:{i:4;i:-1;i:5;i:-1;i:6;i:-1;i:9;i:-1;i:10;i:-1;i:11;i:-1;}s:61:"/home/bjartka/public_html/doctrine/models/InheritanceDeal.php";a:6:{i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:14;i:1;i:15;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/SerializeTest.php";a:20:{i:6;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:15;i:1;i:16;i:1;i:17;i:1;i:18;i:1;i:19;i:1;i:22;i:1;i:23;i:1;i:25;i:1;i:26;i:1;i:27;i:1;i:28;i:1;i:29;i:1;}s:70:"/home/bjartka/public_html/doctrine/tests/Transaction/MssqlTestCase.php";a:17:{i:38;i:1;i:39;i:-1;i:40;i:1;i:41;i:1;i:43;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:58;i:1;i:60;i:1;i:61;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Query/DriverTestCase.php";a:32:{i:36;i:1;i:38;i:1;i:42;i:1;i:44;i:1;i:46;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:81;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:94;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:102;i:1;i:103;i:1;}s:78:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Pgsql/Exception.php";a:11:{i:21;i:1;i:35;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:-2;i:105;i:1;i:106;i:-1;i:107;i:-2;i:108;i:1;}s:74:"/home/bjartka/public_html/doctrine/lib/Doctrine/Adapter/Statement/Mock.php";a:36:{i:34;i:1;i:42;i:1;i:43;i:1;i:59;i:-1;i:78;i:-1;i:110;i:-1;i:120;i:1;i:121;i:-2;i:133;i:-1;i:134;i:-2;i:145;i:-1;i:146;i:-2;i:157;i:-1;i:158;i:-2;i:191;i:1;i:192;i:-2;i:209;i:1;i:210;i:-2;i:229;i:1;i:230;i:1;i:231;i:1;i:232;i:1;i:233;i:-2;i:248;i:1;i:249;i:-2;i:266;i:-1;i:267;i:-2;i:282;i:-1;i:283;i:-2;i:299;i:1;i:300;i:-2;i:319;i:-1;i:329;i:-1;i:339;i:-1;i:348;i:-1;i:350;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/AuditLog/Listener.php";a:32:{i:21;i:1;i:33;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:49;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:59;i:1;i:61;i:1;i:63;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:79;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:88;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Unsigned.php";a:8:{i:34;i:1;i:43;i:1;i:45;i:1;i:46;i:-1;i:47;i:-2;i:48;i:1;i:49;i:-2;i:50;i:1;}s:71:"/home/bjartka/public_html/doctrine/models/ValidatorTest_ClientModel.php";a:8:{i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:10;i:1;i:13;i:1;i:14;i:1;}s:61:"/home/bjartka/public_html/doctrine/models/MysqlTestRecord.php";a:4:{i:6;i:1;i:7;i:1;i:9;i:1;i:10;i:1;}s:63:"/home/bjartka/public_html/doctrine/models/BoardWithPosition.php";a:5:{i:4;i:1;i:5;i:1;i:6;i:1;i:8;i:1;i:9;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/mmrGroupUser_B.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:63:"/home/bjartka/public_html/doctrine/models/BaseSymfonyRecord.php";a:3:{i:6;i:1;i:10;i:1;i:11;i:1;}s:63:"/home/bjartka/public_html/doctrine/models/ResourceReference.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/SoftDeleteTest.php";a:9:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:12;i:1;i:13;i:1;i:16;i:1;i:18;i:1;i:19;i:1;}s:75:"/home/bjartka/public_html/doctrine/models/ConcreteInheritanceTestParent.php";a:5:{i:6;i:-1;i:7;i:-1;i:14;i:-1;i:16;i:-1;i:17;i:-1;}s:66:"/home/bjartka/public_html/doctrine/models/CustomSequenceRecord.php";a:3:{i:5;i:1;i:6;i:1;i:7;i:1;}s:49:"/home/bjartka/public_html/doctrine/models/App.php";a:7:{i:4;i:-1;i:5;i:-1;i:6;i:-1;i:7;i:-1;i:9;i:-1;i:10;i:-1;i:11;i:-1;}s:53:"/home/bjartka/public_html/doctrine/models/Account.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Query/HavingTestCase.php";a:15:{i:37;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:54;i:1;i:56;i:1;i:57;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:65;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Export/SchemaTestCase.php";a:3:{i:58;i:1;i:59;i:1;i:60;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/Forum_Board.php";a:7:{i:4;i:1;i:5;i:1;i:6;i:1;i:7;i:1;i:9;i:1;i:10;i:1;i:11;i:1;}s:57:"/home/bjartka/public_html/doctrine/lib/Doctrine/Table.php";a:733:{i:0;i:1;i:207;i:1;i:209;i:1;i:211;i:1;i:212;i:1;i:214;i:1;i:215;i:1;i:217;i:1;i:219;i:1;i:222;i:1;i:223;i:1;i:224;i:1;i:225;i:1;i:226;i:1;i:227;i:1;i:228;i:1;i:237;i:1;i:238;i:1;i:239;i:1;i:240;i:-2;i:241;i:1;i:243;i:1;i:245;i:1;i:250;i:1;i:251;i:1;i:252;i:-2;i:254;i:1;i:255;i:1;i:256;i:1;i:258;i:1;i:259;i:-1;i:260;i:-2;i:263;i:1;i:265;i:1;i:266;i:1;i:269;i:1;i:270;i:1;i:272;i:1;i:273;i:1;i:275;i:1;i:276;i:1;i:279;i:1;i:281;i:1;i:283;i:1;i:284;i:1;i:285;i:-2;i:286;i:1;i:288;i:1;i:289;i:1;i:290;i:-2;i:291;i:1;i:293;i:1;i:294;i:1;i:296;i:1;i:297;i:1;i:298;i:1;i:299;i:1;i:300;i:1;i:301;i:-2;i:302;i:1;i:303;i:1;i:304;i:1;i:306;i:1;i:308;i:1;i:309;i:1;i:311;i:1;i:313;i:1;i:314;i:1;i:315;i:-2;i:317;i:1;i:318;i:1;i:319;i:1;i:320;i:1;i:322;i:1;i:323;i:-1;i:325;i:1;i:327;i:1;i:330;i:1;i:331;i:1;i:332;i:1;i:334;i:1;i:336;i:1;i:337;i:1;i:338;i:1;i:340;i:1;i:341;i:-2;i:349;i:1;i:350;i:1;i:351;i:1;i:352;i:1;i:354;i:1;i:356;i:1;i:358;i:1;i:359;i:1;i:362;i:1;i:363;i:1;i:367;i:1;i:368;i:1;i:371;i:1;i:372;i:1;i:373;i:1;i:374;i:1;i:375;i:1;i:376;i:1;i:377;i:1;i:378;i:1;i:379;i:1;i:380;i:1;i:381;i:1;i:382;i:1;i:384;i:1;i:385;i:1;i:386;i:1;i:387;i:1;i:388;i:1;i:389;i:1;i:391;i:1;i:393;i:1;i:394;i:1;i:395;i:1;i:396;i:-2;i:398;i:1;i:400;i:1;i:401;i:1;i:402;i:1;i:403;i:1;i:404;i:1;i:405;i:1;i:406;i:1;i:407;i:1;i:408;i:1;i:409;i:1;i:411;i:1;i:412;i:1;i:413;i:1;i:414;i:-1;i:415;i:-1;i:416;i:-1;i:417;i:-1;i:420;i:1;i:421;i:-1;i:422;i:1;i:423;i:1;i:424;i:1;i:425;i:1;i:426;i:1;i:428;i:1;i:430;i:1;i:431;i:1;i:432;i:1;i:433;i:1;i:434;i:1;i:446;i:1;i:447;i:1;i:448;i:-2;i:449;i:1;i:451;i:-2;i:461;i:-1;i:462;i:-2;i:473;i:1;i:474;i:1;i:475;i:-2;i:479;i:1;i:480;i:1;i:481;i:-2;i:485;i:1;i:486;i:1;i:496;i:1;i:497;i:-2;i:510;i:-1;i:511;i:-1;i:521;i:1;i:522;i:1;i:524;i:1;i:526;i:1;i:527;i:1;i:528;i:-2;i:530;i:1;i:531;i:1;i:532;i:1;i:533;i:1;i:534;i:1;i:535;i:1;i:536;i:1;i:537;i:1;i:538;i:1;i:539;i:1;i:540;i:1;i:541;i:-1;i:542;i:1;i:544;i:1;i:545;i:1;i:546;i:1;i:547;i:1;i:548;i:1;i:551;i:1;i:552;i:1;i:554;i:1;i:556;i:1;i:557;i:1;i:559;i:1;i:560;i:1;i:561;i:1;i:563;i:1;i:564;i:1;i:565;i:-1;i:566;i:-2;i:567;i:1;i:568;i:-2;i:570;i:1;i:571;i:1;i:573;i:1;i:574;i:1;i:575;i:1;i:576;i:1;i:578;i:1;i:579;i:1;i:580;i:1;i:581;i:1;i:582;i:1;i:583;i:1;i:584;i:1;i:586;i:1;i:587;i:1;i:589;i:1;i:590;i:1;i:591;i:1;i:592;i:1;i:594;i:1;i:596;i:1;i:597;i:1;i:598;i:1;i:599;i:-2;i:611;i:-1;i:613;i:-1;i:614;i:-1;i:615;i:-1;i:616;i:-1;i:617;i:-1;i:618;i:-2;i:619;i:-2;i:621;i:-1;i:631;i:1;i:632;i:-2;i:642;i:1;i:643;i:1;i:644;i:-2;i:645;i:1;i:646;i:-2;i:655;i:-1;i:656;i:-2;i:666;i:1;i:667;i:-2;i:678;i:-1;i:679;i:-1;i:690;i:-1;i:691;i:-1;i:692;i:-1;i:693;i:-1;i:696;i:-1;i:697;i:-2;i:708;i:1;i:709;i:1;i:718;i:-1;i:719;i:-1;i:720;i:-2;i:722;i:-1;i:723;i:-2;i:732;i:1;i:733;i:1;i:735;i:1;i:736;i:-1;i:737;i:-1;i:740;i:1;i:741;i:1;i:742;i:1;i:743;i:1;i:744;i:1;i:745;i:1;i:747;i:1;i:750;i:1;i:751;i:1;i:752;i:1;i:753;i:1;i:754;i:1;i:755;i:1;i:757;i:1;i:758;i:1;i:759;i:1;i:760;i:1;i:761;i:1;i:763;i:1;i:766;i:1;i:768;i:1;i:769;i:1;i:770;i:1;i:771;i:1;i:773;i:1;i:783;i:1;i:784;i:-2;i:793;i:1;i:794;i:-2;i:804;i:1;i:805;i:-2;i:818;i:1;i:819;i:-1;i:820;i:-1;i:821;i:1;i:822;i:-2;i:831;i:1;i:832;i:-2;i:847;i:1;i:848;i:1;i:849;i:1;i:850;i:1;i:851;i:1;i:852;i:1;i:853;i:1;i:854;i:1;i:855;i:-1;i:856;i:-2;i:857;i:1;i:858;i:-2;i:859;i:1;i:860;i:1;i:871;i:1;i:872;i:1;i:873;i:-2;i:874;i:-1;i:875;i:-2;i:889;i:1;i:890;i:1;i:891;i:-2;i:892;i:1;i:893;i:-2;i:901;i:1;i:902;i:1;i:903;i:-2;i:904;i:1;i:905;i:-2;i:918;i:1;i:919;i:1;i:920;i:-2;i:921;i:1;i:922;i:-2;i:938;i:1;i:939;i:1;i:940;i:1;i:942;i:1;i:943;i:1;i:944;i:1;i:945;i:1;i:946;i:1;i:947;i:1;i:948;i:1;i:949;i:1;i:952;i:1;i:953;i:1;i:954;i:1;i:955;i:1;i:956;i:1;i:958;i:1;i:959;i:1;i:960;i:1;i:961;i:1;i:962;i:1;i:963;i:1;i:964;i:1;i:967;i:1;i:969;i:1;i:970;i:1;i:971;i:1;i:972;i:1;i:973;i:1;i:974;i:1;i:975;i:1;i:976;i:1;i:978;i:1;i:979;i:1;i:980;i:1;i:981;i:1;i:982;i:1;i:984;i:1;i:985;i:1;i:987;i:1;i:988;i:1;i:990;i:1;i:991;i:1;i:992;i:-2;i:993;i:1;i:995;i:1;i:996;i:1;i:998;i:1;i:999;i:1;i:1000;i:1;i:1001;i:1;i:1004;i:1;i:1005;i:1;i:1006;i:1;i:1007;i:1;i:1008;i:1;i:1009;i:1;i:1010;i:1;i:1011;i:1;i:1012;i:1;i:1013;i:1;i:1014;i:1;i:1015;i:1;i:1025;i:1;i:1026;i:-2;i:1037;i:1;i:1038;i:1;i:1039;i:-1;i:1040;i:-2;i:1041;i:1;i:1042;i:1;i:1043;i:-2;i:1044;i:1;i:1046;i:-2;i:1053;i:1;i:1054;i:-2;i:1061;i:1;i:1062;i:-2;i:1070;i:1;i:1071;i:-2;i:1081;i:-1;i:1083;i:-1;i:1085;i:-1;i:1086;i:-2;i:1095;i:1;i:1096;i:-2;i:1107;i:1;i:1108;i:1;i:1110;i:1;i:1111;i:-2;i:1122;i:1;i:1123;i:1;i:1124;i:-2;i:1126;i:1;i:1128;i:1;i:1129;i:1;i:1130;i:1;i:1131;i:-2;i:1142;i:1;i:1143;i:-2;i:1157;i:1;i:1158;i:-2;i:1162;i:1;i:1163;i:-2;i:1179;i:1;i:1180;i:1;i:1181;i:1;i:1182;i:1;i:1183;i:-2;i:1199;i:-1;i:1200;i:-1;i:1201;i:-1;i:1202;i:-1;i:1203;i:-2;i:1214;i:1;i:1215;i:1;i:1227;i:1;i:1229;i:1;i:1230;i:-1;i:1231;i:-2;i:1233;i:1;i:1235;i:1;i:1236;i:-2;i:1248;i:1;i:1250;i:1;i:1251;i:1;i:1252;i:1;i:1253;i:-2;i:1255;i:-1;i:1256;i:-2;i:1267;i:1;i:1269;i:1;i:1271;i:1;i:1272;i:1;i:1273;i:1;i:1275;i:1;i:1276;i:1;i:1277;i:1;i:1279;i:1;i:1280;i:1;i:1281;i:-2;i:1282;i:1;i:1283;i:1;i:1285;i:1;i:1286;i:1;i:1287;i:1;i:1288;i:1;i:1289;i:1;i:1290;i:-2;i:1293;i:1;i:1295;i:1;i:1296;i:1;i:1297;i:1;i:1298;i:1;i:1299;i:1;i:1300;i:1;i:1301;i:1;i:1303;i:1;i:1304;i:1;i:1305;i:-1;i:1306;i:-1;i:1309;i:1;i:1310;i:-2;i:1328;i:1;i:1329;i:1;i:1330;i:-2;i:1331;i:1;i:1332;i:1;i:1333;i:1;i:1334;i:1;i:1335;i:1;i:1336;i:1;i:1337;i:1;i:1338;i:1;i:1339;i:-2;i:1340;i:1;i:1341;i:1;i:1342;i:1;i:1343;i:-2;i:1344;i:1;i:1345;i:1;i:1346;i:-2;i:1354;i:1;i:1355;i:1;i:1356;i:1;i:1357;i:1;i:1358;i:1;i:1359;i:1;i:1361;i:1;i:1363;i:1;i:1365;i:1;i:1366;i:1;i:1367;i:1;i:1368;i:1;i:1369;i:-2;i:1378;i:1;i:1379;i:1;i:1380;i:1;i:1381;i:1;i:1382;i:1;i:1383;i:1;i:1384;i:1;i:1385;i:1;i:1386;i:1;i:1387;i:-2;i:1396;i:-1;i:1397;i:-1;i:1398;i:-2;i:1405;i:-1;i:1406;i:-1;i:1407;i:-1;i:1408;i:-2;i:1416;i:1;i:1417;i:1;i:1418;i:1;i:1419;i:-2;i:1420;i:1;i:1422;i:-2;i:1433;i:1;i:1434;i:-1;i:1435;i:-2;i:1437;i:1;i:1438;i:1;i:1439;i:-1;i:1440;i:1;i:1441;i:1;i:1442;i:-2;i:1444;i:-1;i:1445;i:-2;i:1456;i:1;i:1458;i:1;i:1459;i:1;i:1460;i:1;i:1461;i:-2;i:1462;i:-1;i:1463;i:-2;i:1472;i:1;i:1473;i:-2;i:1482;i:1;i:1483;i:-2;i:1493;i:1;i:1495;i:1;i:1497;i:1;i:1498;i:1;i:1499;i:1;i:1500;i:-2;i:1501;i:-1;i:1503;i:-1;i:1504;i:-2;i:1513;i:1;i:1514;i:1;i:1515;i:-2;i:1516;i:1;i:1517;i:1;i:1518;i:1;i:1519;i:1;i:1520;i:1;i:1522;i:-2;i:1531;i:1;i:1532;i:-2;i:1541;i:1;i:1542;i:-2;i:1551;i:1;i:1552;i:1;i:1553;i:-2;i:1562;i:1;i:1563;i:1;i:1564;i:1;i:1565;i:-2;i:1566;i:1;i:1567;i:-2;i:1579;i:1;i:1580;i:1;i:1590;i:1;i:1591;i:-2;i:1618;i:1;i:1619;i:-1;i:1620;i:1;i:1621;i:1;i:1622;i:-2;i:1623;i:1;i:1626;i:1;i:1627;i:1;i:1628;i:1;i:1629;i:1;i:1631;i:1;i:1632;i:-1;i:1633;i:-2;i:1634;i:1;i:1635;i:-2;i:1636;i:-1;i:1637;i:1;i:1638;i:1;i:1640;i:1;i:1641;i:-1;i:1642;i:-2;i:1643;i:1;i:1644;i:-2;i:1645;i:1;i:1646;i:1;i:1647;i:-2;i:1648;i:1;i:1649;i:1;i:1650;i:-2;i:1651;i:1;i:1653;i:1;i:1654;i:-2;i:1656;i:1;i:1657;i:-2;i:1668;i:1;i:1669;i:1;i:1670;i:1;i:1671;i:1;i:1672;i:1;i:1674;i:1;i:1675;i:1;i:1676;i:1;i:1677;i:-2;i:1678;i:-1;i:1679;i:-2;i:1688;i:1;i:1689;i:-2;i:1698;i:1;i:1699;i:-2;i:1709;i:1;i:1710;i:1;i:1721;i:1;i:1722;i:-2;i:1732;i:1;i:1733;i:-1;i:1734;i:-2;i:1736;i:1;i:1737;i:-2;i:1741;i:-1;i:1742;i:-2;i:1746;i:1;i:1748;i:1;i:1749;i:-2;i:1760;i:-1;i:1762;i:-1;i:1763;i:-2;i:1775;i:1;i:1777;i:1;i:1778;i:-2;i:1788;i:1;i:1789;i:1;i:1790;i:-2;i:1792;i:1;i:1793;i:-2;i:1803;i:1;i:1805;i:1;i:1807;i:1;i:1809;i:1;i:1810;i:-2;i:1819;i:1;i:1820;i:-2;i:1829;i:-1;i:1830;i:-2;i:1842;i:-1;i:1843;i:-2;i:1855;i:-1;i:1857;i:-1;i:1858;i:-2;i:1871;i:-1;i:1872;i:-1;i:1873;i:-1;i:1874;i:-1;i:1875;i:-1;i:1876;i:-1;i:1877;i:-1;i:1879;i:-1;i:1880;i:-1;i:1881;i:-1;i:1882;i:-2;i:1884;i:-1;i:1885;i:-1;i:1887;i:-1;i:1888;i:-1;i:1889;i:-1;i:1890;i:-1;i:1892;i:-1;i:1893;i:-1;i:1894;i:-2;i:1896;i:-1;i:1897;i:-2;i:1898;i:-1;i:1900;i:-2;i:1901;i:-1;}s:50:"/home/bjartka/public_html/doctrine/models/Blog.php";a:8:{i:7;i:1;i:10;i:1;i:11;i:1;i:18;i:1;i:24;i:1;i:25;i:1;i:26;i:1;i:31;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/Description.php";a:3:{i:4;i:1;i:5;i:1;i:6;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/Rec2.php";a:5:{i:6;i:1;i:7;i:1;i:8;i:1;i:12;i:1;i:13;i:1;}s:71:"/home/bjartka/public_html/doctrine/tests/Transaction/OracleTestCase.php";a:23:{i:37;i:1;i:39;i:1;i:40;i:1;i:43;i:1;i:44;i:1;i:47;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:55;i:1;i:56;i:-1;i:57;i:1;i:58;i:1;i:60;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;}s:71:"/home/bjartka/public_html/doctrine/tests/Transaction/SqliteTestCase.php";a:14:{i:38;i:1;i:39;i:-1;i:40;i:1;i:41;i:1;i:43;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Export/OracleTestCase.php";a:71:{i:37;i:1;i:38;i:1;i:39;i:1;i:41;i:1;i:43;i:1;i:44;i:1;i:48;i:1;i:50;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:58;i:1;i:60;i:1;i:61;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:100;i:1;i:102;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:117;i:1;i:119;i:1;i:121;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:132;i:1;i:133;i:1;i:135;i:1;i:137;i:1;i:138;i:1;i:141;i:1;i:142;i:1;i:143;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:149;i:1;i:151;i:1;i:152;i:1;}s:66:"/home/bjartka/public_html/doctrine/tests/Export/SqliteTestCase.php";a:81:{i:38;i:1;i:39;i:-1;i:40;i:1;i:41;i:1;i:43;i:1;i:47;i:1;i:48;i:-1;i:49;i:1;i:50;i:1;i:52;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:85;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:96;i:1;i:102;i:1;i:104;i:1;i:105;i:1;i:108;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:118;i:1;i:124;i:1;i:126;i:1;i:128;i:1;i:129;i:1;i:132;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:138;i:1;i:139;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:147;i:1;i:148;i:1;i:151;i:1;i:152;i:-1;i:153;i:1;i:154;i:1;i:156;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:163;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:172;i:1;i:177;i:1;i:179;i:1;i:181;i:1;}s:75:"/home/bjartka/public_html/doctrine/tests/Query/ApplyInheritanceTestCase.php";a:10:{i:38;i:1;i:42;i:1;i:44;i:1;i:45;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:53;i:1;i:55;i:1;i:56;i:1;}s:73:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record/Listener/Chain.php";a:75:{i:21;i:1;i:36;i:1;i:53;i:1;i:54;i:1;i:56;i:-1;i:57;i:-2;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:-1;i:63;i:1;i:74;i:-1;i:75;i:-1;i:76;i:-2;i:77;i:-1;i:78;i:-2;i:89;i:-1;i:90;i:-1;i:94;i:-1;i:95;i:-1;i:96;i:-1;i:97;i:-1;i:101;i:-1;i:102;i:-1;i:103;i:-1;i:104;i:-1;i:108;i:-1;i:109;i:-1;i:110;i:-1;i:111;i:-1;i:115;i:-1;i:116;i:-1;i:117;i:-1;i:118;i:-1;i:122;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:139;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:164;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:179;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:188;i:1;i:190;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/Relation/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:61:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator.php";a:130:{i:34;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:-1;i:57;i:1;i:58;i:1;i:59;i:-2;i:70;i:1;i:71;i:1;i:73;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:87;i:1;i:89;i:1;i:90;i:-1;i:92;i:-1;i:93;i:-1;i:94;i:-1;i:95;i:-2;i:96;i:-1;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:-2;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:-1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:-2;i:119;i:1;i:120;i:1;i:121;i:-2;i:123;i:1;i:124;i:1;i:125;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:-2;i:132;i:1;i:133;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:139;i:-2;i:141;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:146;i:1;i:147;i:1;i:153;i:1;i:154;i:1;i:156;i:1;i:157;i:1;i:158;i:-1;i:159;i:-1;i:160;i:-2;i:161;i:1;i:162;i:1;i:163;i:1;i:170;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:179;i:1;i:180;i:1;i:181;i:-2;i:182;i:1;i:183;i:-2;i:192;i:-1;i:193;i:-2;i:266;i:1;i:267;i:1;i:268;i:1;i:269;i:1;i:270;i:-2;i:273;i:1;i:274;i:1;i:275;i:1;i:276;i:1;i:277;i:1;i:278;i:1;i:279;i:1;i:280;i:1;i:281;i:1;i:282;i:1;i:283;i:-1;i:284;i:1;i:285;i:1;i:286;i:1;i:287;i:1;i:288;i:1;i:289;i:-1;i:290;i:1;i:292;i:-1;i:293;i:1;i:294;i:1;i:295;i:1;i:296;i:-1;i:297;i:-1;i:298;i:-1;i:299;i:-1;i:300;i:-1;i:301;i:-2;i:328;i:1;}s:54:"/home/bjartka/public_html/doctrine/models/TestUser.php";a:11:{i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:11;i:1;i:12;i:1;i:13;i:1;i:14;i:1;i:16;i:1;i:19;i:1;i:20;i:1;}s:59:"/home/bjartka/public_html/doctrine/models/NestReference.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/DataDict/PgsqlTestCase.php";a:194:{i:37;i:1;i:38;i:-2;i:42;i:1;i:43;i:-1;i:44;i:1;i:45;i:1;i:47;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:71;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:85;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:94;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:110;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:117;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:124;i:1;i:126;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:133;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:140;i:1;i:142;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:147;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:156;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:165;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:174;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:180;i:1;i:183;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:188;i:1;i:190;i:1;i:192;i:1;i:193;i:1;i:194;i:1;i:195;i:1;i:197;i:1;i:199;i:1;i:200;i:1;i:201;i:1;i:202;i:1;i:205;i:1;i:207;i:1;i:208;i:1;i:209;i:1;i:210;i:1;i:213;i:1;i:215;i:1;i:216;i:1;i:217;i:1;i:218;i:1;i:220;i:1;i:223;i:1;i:225;i:1;i:226;i:1;i:228;i:1;i:229;i:1;i:230;i:1;i:231;i:1;i:232;i:1;i:234;i:1;i:235;i:1;i:236;i:1;i:237;i:1;i:238;i:1;i:241;i:1;i:242;i:1;i:243;i:1;i:247;i:1;i:249;i:1;i:251;i:1;i:253;i:1;i:255;i:1;i:257;i:1;i:258;i:1;i:261;i:1;i:263;i:1;i:265;i:1;i:267;i:1;i:269;i:1;i:271;i:1;i:272;i:1;i:275;i:1;i:277;i:1;i:278;i:1;i:281;i:1;i:283;i:1;i:284;i:1;i:287;i:1;i:289;i:1;i:290;i:1;i:293;i:1;i:295;i:1;i:296;i:1;i:299;i:1;i:301;i:1;i:302;i:1;i:305;i:1;i:307;i:1;i:308;i:1;i:311;i:1;i:313;i:1;i:314;i:1;i:317;i:1;i:319;i:1;i:320;i:1;i:323;i:1;i:325;i:1;i:326;i:1;i:329;i:1;i:331;i:1;i:332;i:1;i:335;i:1;i:337;i:1;i:338;i:1;i:341;i:1;i:343;i:1;i:344;i:1;i:347;i:1;i:349;i:1;i:350;i:1;}s:69:"/home/bjartka/public_html/doctrine/tests/Query/MultiJoin2TestCase.php";a:56:{i:36;i:1;i:39;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:47;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:74;i:1;i:75;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:-2;i:94;i:1;i:98;i:1;i:99;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:-2;i:114;i:1;}s:73:"/home/bjartka/public_html/doctrine/tests/Query/ComponentAliasTestCase.php";a:53:{i:38;i:1;i:39;i:1;i:41;i:1;i:43;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:56;i:1;i:57;i:1;i:59;i:1;i:61;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:78;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:89;i:1;i:90;i:1;i:92;i:1;i:94;i:1;i:96;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:112;i:1;i:113;i:1;i:115;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;}s:65:"/home/bjartka/public_html/doctrine/tests/Query/DeleteTestCase.php";a:35:{i:38;i:1;i:40;i:1;i:42;i:1;i:44;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:52;i:1;i:54;i:1;i:56;i:1;i:58;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:72;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:80;i:1;i:82;i:1;i:84;i:1;i:86;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:94;i:1;i:96;i:1;i:98;i:1;i:100;i:1;i:102;i:1;i:104;i:1;i:105;i:1;}s:74:"/home/bjartka/public_html/doctrine/tests/ClassTableInheritanceTestCase.php";a:128:{i:36;i:1;i:38;i:1;i:42;i:1;i:44;i:1;i:46;i:1;i:47;i:1;i:51;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:64;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:77;i:1;i:79;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:96;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:109;i:1;i:110;i:1;i:112;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:125;i:1;i:126;i:1;i:128;i:1;i:130;i:1;i:131;i:1;i:133;i:1;i:134;i:1;i:138;i:1;i:139;i:1;i:140;i:1;i:141;i:1;i:143;i:1;i:145;i:1;i:146;i:1;i:148;i:1;i:150;i:1;i:151;i:1;i:153;i:1;i:155;i:1;i:156;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:164;i:1;i:166;i:1;i:167;i:1;i:169;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:176;i:1;i:179;i:1;i:180;i:1;i:182;i:1;i:183;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:188;i:1;i:192;i:1;i:194;i:1;i:196;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:200;i:1;i:201;i:1;i:205;i:1;i:207;i:1;i:208;i:1;i:210;i:1;i:212;i:1;i:215;i:1;i:216;i:1;i:218;i:1;i:219;i:1;i:221;i:1;i:222;i:1;i:223;i:1;i:224;i:1;i:232;i:1;i:233;i:1;i:239;i:1;i:241;i:1;i:242;i:1;i:248;i:1;i:249;i:1;i:255;i:1;i:256;i:1;i:267;i:1;i:268;i:1;i:269;i:1;i:273;i:1;i:274;i:1;}s:73:"/home/bjartka/public_html/doctrine/tests/NestedSet/SingleRootTestCase.php";a:39:{i:37;i:1;i:38;i:1;i:39;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:85;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;}s:60:"/home/bjartka/public_html/doctrine/lib/Doctrine/Sequence.php";a:10:{i:21;i:1;i:34;i:1;i:46;i:-1;i:47;i:-2;i:58;i:-1;i:59;i:-2;i:70;i:-1;i:72;i:-1;i:73;i:-2;i:74;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/DataDict/Mysql.php";a:254:{i:21;i:1;i:32;i:1;i:136;i:1;i:137;i:-1;i:138;i:-2;i:140;i:1;i:141;i:1;i:142;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:151;i:1;i:152;i:-1;i:153;i:-1;i:154;i:1;i:156;i:1;i:158;i:1;i:159;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:164;i:1;i:165;i:-1;i:166;i:-1;i:167;i:-1;i:168;i:-1;i:169;i:-1;i:170;i:-1;i:171;i:-1;i:172;i:-2;i:173;i:-1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:-1;i:180;i:1;i:181;i:1;i:182;i:-1;i:183;i:-1;i:184;i:-2;i:185;i:-1;i:186;i:1;i:187;i:1;i:188;i:-1;i:189;i:-1;i:190;i:-1;i:191;i:-1;i:192;i:-1;i:193;i:-1;i:194;i:-2;i:196;i:1;i:197;i:1;i:198;i:1;i:199;i:1;i:200;i:1;i:201;i:-1;i:202;i:1;i:203;i:1;i:204;i:1;i:205;i:1;i:206;i:1;i:207;i:1;i:208;i:1;i:209;i:1;i:210;i:-2;i:211;i:-1;i:212;i:1;i:213;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:217;i:1;i:218;i:1;i:219;i:1;i:220;i:1;i:221;i:1;i:222;i:1;i:223;i:1;i:224;i:-1;i:225;i:-1;i:226;i:-1;i:227;i:-1;i:228;i:-1;i:229;i:-1;i:230;i:-2;i:240;i:1;i:241;i:1;i:242;i:1;i:243;i:-1;i:244;i:-1;i:245;i:1;i:246;i:-1;i:247;i:-1;i:248;i:-1;i:249;i:1;i:250;i:1;i:252;i:1;i:253;i:1;i:255;i:1;i:256;i:1;i:257;i:1;i:259;i:1;i:262;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:266;i:-1;i:267;i:-1;i:268;i:1;i:269;i:1;i:270;i:1;i:271;i:1;i:272;i:1;i:273;i:1;i:274;i:1;i:275;i:1;i:276;i:1;i:277;i:1;i:278;i:1;i:279;i:1;i:280;i:1;i:281;i:1;i:282;i:1;i:283;i:1;i:284;i:1;i:285;i:1;i:286;i:1;i:287;i:1;i:288;i:1;i:289;i:1;i:290;i:1;i:291;i:1;i:292;i:1;i:293;i:1;i:294;i:1;i:295;i:1;i:296;i:1;i:297;i:1;i:298;i:1;i:299;i:1;i:300;i:1;i:301;i:1;i:302;i:1;i:303;i:1;i:304;i:1;i:305;i:-1;i:306;i:-1;i:307;i:1;i:308;i:1;i:309;i:1;i:310;i:-1;i:311;i:-1;i:312;i:1;i:313;i:1;i:314;i:1;i:315;i:1;i:316;i:1;i:317;i:1;i:318;i:-1;i:319;i:-1;i:320;i:-1;i:321;i:-1;i:322;i:-1;i:323;i:-1;i:324;i:-1;i:325;i:-1;i:326;i:-1;i:327;i:-1;i:328;i:-1;i:329;i:-1;i:330;i:-1;i:331;i:-1;i:332;i:-1;i:334;i:-1;i:335;i:-1;i:336;i:1;i:337;i:-1;i:338;i:-1;i:339;i:-1;i:340;i:-1;i:341;i:1;i:342;i:1;i:343;i:1;i:344;i:1;i:345;i:1;i:346;i:1;i:347;i:1;i:348;i:1;i:349;i:1;i:350;i:1;i:351;i:-1;i:352;i:-1;i:353;i:-1;i:354;i:1;i:355;i:1;i:356;i:1;i:357;i:1;i:358;i:1;i:359;i:1;i:360;i:1;i:361;i:1;i:362;i:1;i:363;i:1;i:364;i:1;i:365;i:1;i:366;i:1;i:367;i:1;i:368;i:1;i:369;i:1;i:370;i:1;i:371;i:1;i:372;i:1;i:373;i:1;i:374;i:1;i:375;i:1;i:376;i:1;i:377;i:1;i:378;i:1;i:379;i:1;i:380;i:1;i:382;i:1;i:384;i:1;i:385;i:1;i:386;i:-2;i:387;i:-1;i:389;i:-2;i:401;i:1;i:402;i:-2;i:414;i:1;i:415;i:-2;i:444;i:1;i:445;i:1;i:446;i:1;i:447;i:1;i:448;i:-1;i:449;i:-1;i:450;i:-1;i:451;i:-1;i:452;i:-1;i:453;i:-1;i:454;i:-1;i:456;i:-1;i:463;i:1;i:464;i:1;i:466;i:1;i:468;i:1;i:469;i:-2;i:470;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/Template/Sluggable.php";a:7:{i:35;i:1;i:56;i:1;i:57;i:1;i:66;i:-1;i:68;i:-1;i:69;i:-1;i:71;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Search/Listener.php";a:9:{i:33;i:1;i:39;i:1;i:40;i:1;i:44;i:1;i:49;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:57;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Notnull.php";a:4:{i:33;i:1;i:43;i:1;i:44;i:-2;i:45;i:1;}s:57:"/home/bjartka/public_html/doctrine/models/FilterTest2.php";a:3:{i:4;i:-1;i:5;i:-1;i:6;i:-1;}s:63:"/home/bjartka/public_html/doctrine/models/EventListenerTest.php";a:8:{i:4;i:1;i:5;i:1;i:6;i:1;i:9;i:1;i:11;i:-1;i:12;i:-2;i:14;i:-1;i:15;i:-2;}s:53:"/home/bjartka/public_html/doctrine/models/M2MTest.php";a:8:{i:4;i:-1;i:5;i:-1;i:6;i:-1;i:9;i:-1;i:10;i:-1;i:11;i:-1;i:12;i:-1;i:14;i:-1;}s:64:"/home/bjartka/public_html/doctrine/models/QueryTest_UserRank.php";a:3:{i:6;i:1;i:7;i:1;i:8;i:1;}s:60:"/home/bjartka/public_html/doctrine/models/LiabilityCodeN.php";a:6:{i:5;i:1;i:6;i:1;i:7;i:1;i:8;i:1;i:9;i:1;i:13;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/DataDict/MysqlTestCase.php";a:196:{i:36;i:1;i:37;i:1;i:40;i:1;i:41;i:1;i:45;i:1;i:46;i:-1;i:47;i:1;i:48;i:1;i:50;i:1;i:53;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:67;i:1;i:69;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:81;i:1;i:83;i:1;i:84;i:1;i:85;i:1;i:86;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:97;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:111;i:1;i:113;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:118;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:125;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:1;i:132;i:1;i:134;i:1;i:135;i:1;i:136;i:1;i:137;i:1;i:138;i:1;i:141;i:1;i:143;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:148;i:1;i:150;i:1;i:151;i:1;i:152;i:1;i:153;i:1;i:155;i:1;i:157;i:1;i:158;i:1;i:159;i:1;i:160;i:1;i:161;i:1;i:165;i:1;i:167;i:1;i:168;i:1;i:169;i:1;i:170;i:1;i:171;i:1;i:174;i:1;i:176;i:1;i:177;i:1;i:178;i:1;i:179;i:1;i:181;i:1;i:183;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:188;i:1;i:190;i:1;i:191;i:1;i:192;i:1;i:193;i:1;i:194;i:1;i:198;i:1;i:200;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:205;i:1;i:207;i:1;i:208;i:1;i:209;i:1;i:210;i:1;i:211;i:1;i:214;i:1;i:217;i:1;i:218;i:1;i:219;i:1;i:220;i:1;i:221;i:1;i:224;i:1;i:226;i:1;i:227;i:1;i:228;i:1;i:229;i:1;i:231;i:1;i:233;i:1;i:234;i:1;i:235;i:1;i:236;i:1;i:238;i:1;i:240;i:1;i:241;i:1;i:242;i:1;i:243;i:1;i:245;i:1;i:247;i:1;i:248;i:1;i:249;i:1;i:250;i:1;i:251;i:1;i:255;i:1;i:257;i:1;i:259;i:1;i:261;i:1;i:263;i:1;i:265;i:1;i:266;i:1;i:270;i:1;i:272;i:1;i:273;i:1;i:276;i:1;i:278;i:1;i:279;i:1;i:282;i:1;i:284;i:1;i:285;i:1;i:288;i:1;i:290;i:1;i:291;i:1;i:294;i:1;i:296;i:1;i:297;i:1;i:300;i:1;i:302;i:1;i:303;i:1;i:306;i:1;i:308;i:1;i:309;i:1;i:312;i:1;i:314;i:1;i:315;i:1;i:318;i:1;i:320;i:1;i:321;i:1;i:324;i:1;i:326;i:1;i:327;i:1;i:330;i:1;i:332;i:1;i:333;i:1;i:336;i:1;i:338;i:1;i:339;i:1;i:342;i:1;i:344;i:1;i:345;i:1;i:348;i:1;i:350;i:1;i:351;i:1;}s:61:"/home/bjartka/public_html/doctrine/tests/SequenceTestCase.php";a:7:{i:37;i:-1;i:40;i:-1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:66;i:1;}s:62:"/home/bjartka/public_html/doctrine/tests/TokenizerTestCase.php";a:58:{i:37;i:1;i:39;i:1;i:43;i:1;i:45;i:1;i:46;i:1;i:48;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:113;i:1;i:114;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Record/Listener.php";a:14:{i:36;i:-1;i:39;i:-1;i:42;i:-1;i:45;i:-1;i:48;i:1;i:51;i:1;i:54;i:1;i:57;i:1;i:60;i:1;i:63;i:1;i:66;i:1;i:69;i:1;i:72;i:1;i:75;i:1;}s:81:"/home/bjartka/public_html/doctrine/tests/Query/MultipleAggregateValueTestCase.php";a:40:{i:37;i:1;i:40;i:1;i:41;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:61;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:-2;i:71;i:1;i:72;i:1;i:73;i:1;i:76;i:1;i:77;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:83;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:-2;i:93;i:1;i:94;i:1;i:95;i:1;}s:75:"/home/bjartka/public_html/doctrine/tests/Query/SelectExpressionTestCase.php";a:45:{i:37;i:1;i:40;i:1;i:41;i:1;i:42;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:-2;i:55;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:-2;i:69;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:-2;i:83;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:-2;i:97;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:-2;i:112;i:1;}s:72:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Statement.php";a:93:{i:21;i:1;i:33;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:-1;i:60;i:-2;i:61;i:1;i:71;i:-1;i:72;i:-2;i:75;i:-1;i:76;i:-2;i:79;i:1;i:80;i:-2;i:96;i:-1;i:97;i:-1;i:98;i:-2;i:99;i:-1;i:101;i:-2;i:119;i:-1;i:120;i:-1;i:121;i:-2;i:122;i:-1;i:124;i:-2;i:155;i:-1;i:156;i:-1;i:157;i:-2;i:158;i:-1;i:160;i:-2;i:170;i:1;i:171;i:-2;i:183;i:-1;i:184;i:-2;i:195;i:-1;i:196;i:-2;i:207;i:-1;i:208;i:-2;i:228;i:1;i:229;i:1;i:231;i:1;i:232;i:1;i:233;i:1;i:234;i:1;i:235;i:1;i:237;i:1;i:239;i:1;i:240;i:-2;i:241;i:-2;i:244;i:-2;i:246;i:-2;i:247;i:-2;i:280;i:1;i:282;i:1;i:283;i:1;i:284;i:1;i:286;i:1;i:288;i:1;i:289;i:1;i:290;i:1;i:292;i:1;i:294;i:1;i:295;i:-2;i:313;i:1;i:314;i:1;i:315;i:1;i:317;i:1;i:319;i:1;i:320;i:1;i:321;i:1;i:322;i:1;i:323;i:1;i:326;i:1;i:327;i:1;i:329;i:1;i:331;i:1;i:332;i:-2;i:347;i:1;i:348;i:-2;i:365;i:-1;i:366;i:-2;i:378;i:-1;i:379;i:-2;i:399;i:-1;i:400;i:-2;i:415;i:-1;i:416;i:-2;i:432;i:1;i:433;i:-2;i:445;i:-1;i:446;i:-2;i:457;i:-1;i:458;i:-2;i:460;i:1;}s:73:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:71:"/home/bjartka/public_html/doctrine/lib/Doctrine/Connection/Firebird.php";a:33:{i:21;i:1;i:35;i:1;i:51;i:-1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:70;i:1;i:79;i:1;i:80;i:1;i:91;i:-1;i:92;i:-1;i:93;i:-1;i:105;i:-1;i:106;i:-1;i:107;i:-1;i:108;i:-1;i:109;i:-1;i:110;i:-2;i:111;i:1;}s:66:"/home/bjartka/public_html/doctrine/lib/Doctrine/DataDict/Pgsql.php";a:195:{i:21;i:1;i:33;i:1;i:362;i:1;i:363;i:-1;i:364;i:-2;i:365;i:1;i:366;i:1;i:367;i:1;i:368;i:1;i:369;i:1;i:370;i:1;i:371;i:1;i:373;i:1;i:375;i:1;i:377;i:1;i:378;i:1;i:380;i:1;i:381;i:1;i:382;i:1;i:383;i:1;i:384;i:1;i:385;i:1;i:386;i:1;i:387;i:1;i:388;i:1;i:389;i:1;i:390;i:1;i:391;i:1;i:392;i:-2;i:393;i:1;i:394;i:1;i:395;i:-2;i:396;i:1;i:397;i:1;i:398;i:1;i:399;i:1;i:400;i:1;i:401;i:1;i:402;i:1;i:403;i:1;i:404;i:-2;i:405;i:-1;i:406;i:1;i:407;i:1;i:408;i:1;i:409;i:1;i:410;i:1;i:411;i:1;i:412;i:1;i:413;i:1;i:414;i:1;i:415;i:1;i:416;i:1;i:417;i:1;i:418;i:-1;i:419;i:-1;i:420;i:-1;i:421;i:-1;i:422;i:-1;i:423;i:-1;i:424;i:-2;i:436;i:1;i:437;i:1;i:438;i:-1;i:439;i:-1;i:440;i:1;i:441;i:1;i:442;i:1;i:443;i:1;i:444;i:1;i:446;i:1;i:447;i:1;i:448;i:1;i:450;i:1;i:453;i:1;i:454;i:1;i:455;i:1;i:456;i:1;i:457;i:1;i:458;i:1;i:459;i:1;i:460;i:1;i:461;i:-1;i:462;i:-1;i:463;i:1;i:464;i:1;i:465;i:1;i:466;i:1;i:467;i:1;i:468;i:1;i:469;i:1;i:470;i:1;i:471;i:1;i:472;i:1;i:473;i:1;i:474;i:1;i:475;i:1;i:476;i:1;i:477;i:1;i:478;i:1;i:479;i:1;i:480;i:1;i:481;i:1;i:482;i:1;i:483;i:1;i:484;i:1;i:485;i:1;i:486;i:1;i:487;i:1;i:488;i:1;i:489;i:1;i:490;i:1;i:491;i:1;i:492;i:1;i:493;i:1;i:494;i:1;i:495;i:1;i:496;i:1;i:497;i:-1;i:498;i:-1;i:499;i:1;i:500;i:1;i:501;i:1;i:502;i:1;i:503;i:1;i:504;i:1;i:505;i:1;i:506;i:1;i:507;i:1;i:508;i:1;i:509;i:1;i:510;i:1;i:511;i:1;i:512;i:1;i:513;i:1;i:514;i:1;i:515;i:1;i:516;i:1;i:517;i:1;i:518;i:1;i:519;i:1;i:520;i:1;i:521;i:1;i:522;i:1;i:523;i:1;i:524;i:1;i:525;i:1;i:526;i:1;i:527;i:1;i:528;i:1;i:529;i:1;i:530;i:1;i:531;i:1;i:532;i:1;i:533;i:1;i:534;i:1;i:535;i:1;i:536;i:1;i:537;i:1;i:538;i:1;i:539;i:1;i:540;i:1;i:541;i:1;i:542;i:1;i:543;i:1;i:544;i:1;i:545;i:1;i:546;i:1;i:547;i:1;i:548;i:1;i:549;i:1;i:550;i:1;i:552;i:1;i:553;i:1;i:554;i:1;i:555;i:1;i:556;i:-2;i:588;i:1;i:589;i:1;i:590;i:1;i:591;i:-2;i:593;i:1;i:594;i:1;i:595;i:1;i:596;i:-1;i:597;i:-1;i:598;i:1;i:599;i:1;i:607;i:1;i:608;i:1;i:609;i:1;i:610;i:-2;i:622;i:-1;i:623;i:-2;i:625;i:1;}s:68:"/home/bjartka/public_html/doctrine/lib/Doctrine/Export/Exception.php";a:3:{i:21;i:1;i:33;i:1;i:34;i:1;}s:67:"/home/bjartka/public_html/doctrine/tests/DoctrineTest/GroupTest.php";a:45:{i:10;i:-1;i:11;i:-1;i:12;i:-1;i:15;i:-1;i:16;i:-2;i:20;i:-1;i:21;i:-1;i:22;i:-1;i:23;i:-1;i:25;i:-1;i:28;i:1;i:29;i:1;i:30;i:-2;i:31;i:-1;i:32;i:-1;i:33;i:-1;i:35;i:-1;i:36;i:-1;i:37;i:-2;i:38;i:-1;i:39;i:-1;i:40;i:-2;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:-1;i:47;i:-2;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:64;i:1;i:65;i:1;i:70;i:1;i:71;i:-2;i:74;i:-1;i:75;i:-2;}s:54:"/home/bjartka/public_html/doctrine/models/EnumTest.php";a:6:{i:5;i:1;i:6;i:1;i:7;i:1;i:9;i:1;i:10;i:1;i:11;i:1;}s:56:"/home/bjartka/public_html/doctrine/models/MysqlGroup.php";a:3:{i:6;i:1;i:8;i:1;i:9;i:1;}s:50:"/home/bjartka/public_html/doctrine/models/Rec1.php";a:4:{i:6;i:1;i:7;i:1;i:11;i:1;i:12;i:1;}s:52:"/home/bjartka/public_html/doctrine/models/MyUser.php";a:5:{i:4;i:-1;i:5;i:-1;i:7;i:-1;i:8;i:-1;i:9;i:-1;}s:58:"/home/bjartka/public_html/doctrine/tests/TableTestCase.php";a:126:{i:38;i:1;i:39;i:1;i:40;i:1;i:44;i:1;i:46;i:1;i:47;i:1;i:51;i:1;i:53;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:66;i:1;i:68;i:1;i:70;i:1;i:71;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:78;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:84;i:1;i:86;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:92;i:1;i:94;i:1;i:95;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:106;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:114;i:1;i:115;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:122;i:1;i:125;i:1;i:126;i:1;i:130;i:1;i:131;i:1;i:135;i:1;i:136;i:1;i:140;i:1;i:141;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:152;i:1;i:153;i:1;i:154;i:1;i:155;i:1;i:159;i:1;i:160;i:1;i:163;i:1;i:164;i:1;i:165;i:1;i:166;i:-2;i:170;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:-2;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:-2;i:188;i:1;i:189;i:1;i:190;i:1;i:191;i:-2;i:195;i:1;i:196;i:1;i:197;i:1;i:198;i:-2;i:200;i:1;i:204;i:1;i:205;i:1;i:206;i:1;i:208;i:1;i:209;i:1;i:210;i:1;i:211;i:1;i:212;i:1;i:213;i:1;i:217;i:1;i:218;i:1;i:219;i:1;i:220;i:1;i:224;i:1;i:225;i:1;i:228;i:1;i:229;i:1;i:230;i:-2;i:232;i:1;i:236;i:1;i:237;i:1;i:239;i:1;i:243;i:1;i:244;i:1;}s:62:"/home/bjartka/public_html/doctrine/tests/ValidatorTestCase.php";a:219:{i:40;i:1;i:41;i:1;i:42;i:1;i:43;i:1;i:44;i:1;i:45;i:1;i:46;i:1;i:47;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:65;i:1;i:66;i:1;i:67;i:1;i:68;i:1;i:69;i:1;i:70;i:1;i:72;i:1;i:73;i:1;i:74;i:1;i:75;i:1;i:76;i:1;i:77;i:1;i:79;i:1;i:80;i:1;i:81;i:1;i:82;i:1;i:83;i:1;i:84;i:1;i:86;i:1;i:87;i:1;i:88;i:1;i:89;i:1;i:90;i:1;i:91;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:100;i:1;i:101;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:105;i:1;i:107;i:1;i:108;i:1;i:109;i:1;i:110;i:1;i:111;i:1;i:112;i:1;i:113;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:123;i:1;i:124;i:1;i:126;i:1;i:128;i:1;i:130;i:1;i:131;i:1;i:132;i:1;i:133;i:1;i:134;i:1;i:137;i:1;i:138;i:1;i:142;i:1;i:144;i:1;i:145;i:1;i:146;i:1;i:147;i:1;i:148;i:1;i:149;i:1;i:150;i:1;i:152;i:1;i:154;i:1;i:155;i:1;i:158;i:1;i:160;i:1;i:161;i:1;i:162;i:1;i:163;i:1;i:165;i:1;i:166;i:1;i:167;i:1;i:168;i:1;i:170;i:1;i:171;i:1;i:173;i:1;i:174;i:1;i:182;i:1;i:184;i:1;i:185;i:1;i:186;i:1;i:187;i:1;i:189;i:1;i:190;i:1;i:191;i:1;i:192;i:1;i:193;i:1;i:200;i:1;i:201;i:1;i:203;i:1;i:204;i:1;i:205;i:1;i:206;i:1;i:207;i:1;i:208;i:1;i:209;i:1;i:210;i:1;i:214;i:1;i:215;i:1;i:216;i:1;i:217;i:1;i:218;i:-1;i:219;i:1;i:220;i:1;i:221;i:1;i:223;i:1;i:225;i:1;i:226;i:1;i:227;i:1;i:228;i:1;i:231;i:1;i:232;i:1;i:240;i:1;i:243;i:1;i:245;i:1;i:246;i:1;i:247;i:1;i:248;i:1;i:249;i:1;i:250;i:1;i:251;i:1;i:253;i:1;i:255;i:1;i:256;i:1;i:257;i:1;i:261;i:1;i:263;i:1;i:264;i:1;i:265;i:1;i:266;i:1;i:267;i:-1;i:268;i:1;i:269;i:1;i:270;i:1;i:272;i:1;i:274;i:1;i:275;i:1;i:278;i:1;i:279;i:1;i:287;i:1;i:289;i:1;i:290;i:1;i:293;i:1;i:294;i:-1;i:295;i:1;i:296;i:1;i:297;i:1;i:300;i:1;i:301;i:1;i:332;i:1;i:334;i:1;i:335;i:1;i:336;i:1;i:338;i:1;i:339;i:1;i:341;i:1;i:343;i:1;i:344;i:-2;i:347;i:1;i:349;i:1;i:350;i:1;i:354;i:1;i:356;i:1;i:357;i:1;i:358;i:1;i:360;i:1;i:361;i:1;i:363;i:1;i:364;i:-1;i:365;i:1;i:366;i:1;i:368;i:1;i:370;i:1;i:371;i:1;i:375;i:1;i:377;i:1;i:378;i:1;i:379;i:1;i:380;i:1;i:381;i:-1;i:382;i:1;i:383;i:1;i:384;i:1;i:385;i:1;i:387;i:1;i:388;i:1;i:389;i:1;i:390;i:1;i:391;i:1;i:392;i:1;i:393;i:1;i:394;i:1;i:397;i:1;i:398;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Export/Sqlite.php";a:180:{i:21;i:1;i:34;i:1;i:46;i:1;i:47;i:1;i:48;i:1;i:49;i:-2;i:50;i:-1;i:51;i:-1;i:52;i:-1;i:53;i:-2;i:54;i:-1;i:90;i:1;i:91;i:1;i:92;i:1;i:93;i:1;i:95;i:1;i:96;i:-2;i:107;i:1;i:109;i:1;i:110;i:1;i:112;i:1;i:113;i:1;i:114;i:1;i:116;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:122;i:1;i:123;i:1;i:124;i:1;i:125;i:1;i:127;i:1;i:128;i:1;i:129;i:1;i:130;i:-2;i:162;i:1;i:163;i:1;i:164;i:-2;i:166;i:1;i:167;i:1;i:168;i:-2;i:169;i:1;i:171;i:1;i:172;i:1;i:173;i:1;i:174;i:1;i:175;i:1;i:176;i:1;i:177;i:-2;i:178;i:1;i:180;i:1;i:181;i:1;i:182;i:1;i:183;i:1;i:184;i:1;i:186;i:1;i:187;i:1;i:189;i:1;i:190;i:-1;i:191;i:-1;i:193;i:1;i:194;i:-1;i:195;i:-1;i:197;i:1;i:199;i:1;i:201;i:1;i:202;i:1;i:203;i:1;i:204;i:1;i:205;i:1;i:206;i:1;i:247;i:-2;i:260;i:-1;i:261;i:-1;i:262;i:-1;i:263;i:-1;i:264;i:-1;i:265;i:-1;i:266;i:-1;i:267;i:-1;i:268;i:-1;i:269;i:-1;i:270;i:-1;i:271;i:-1;i:272;i:-1;i:273;i:-1;i:275;i:-1;i:276;i:-1;i:277;i:-1;i:278;i:-1;i:280;i:-1;i:281;i:-2;i:298;i:-1;i:299;i:-1;i:300;i:-1;i:302;i:-1;i:304;i:-1;i:305;i:-1;i:306;i:-2;i:309;i:-1;i:310;i:-1;i:311;i:-2;i:315;i:-2;i:316;i:-2;i:317;i:-2;i:320;i:-2;i:321;i:-2;i:331;i:-1;i:333;i:-1;i:334;i:-2;i:338;i:1;i:339;i:-1;i:340;i:-2;i:341;i:1;i:343;i:1;i:344;i:1;i:345;i:1;i:346;i:1;i:347;i:1;i:348;i:-1;i:349;i:-1;i:350;i:-1;i:351;i:1;i:353;i:1;i:354;i:-1;i:355;i:-2;i:357;i:1;i:358;i:1;i:359;i:-1;i:360;i:-1;i:361;i:-1;i:363;i:1;i:364;i:1;i:365;i:1;i:366;i:-1;i:367;i:-1;i:368;i:1;i:369;i:1;i:370;i:1;i:372;i:1;i:373;i:1;i:374;i:-1;i:375;i:-1;i:376;i:-1;i:377;i:-1;i:379;i:1;i:380;i:-1;i:381;i:-1;i:382;i:-1;i:383;i:-1;i:384;i:-1;i:385;i:-1;i:386;i:-1;i:387;i:-1;i:388;i:-1;i:390;i:-1;i:391;i:-1;i:392;i:-1;i:393;i:-1;i:394;i:-1;i:396;i:1;i:397;i:-1;i:398;i:-1;i:399;i:-1;i:400;i:-1;i:401;i:-1;i:402;i:-1;i:403;i:-1;i:404;i:-1;i:405;i:-1;i:406;i:-1;i:408;i:1;i:409;i:-1;i:410;i:-2;i:412;i:1;i:414;i:1;i:415;i:-2;i:417;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction/Sqlite.php";a:17:{i:21;i:1;i:33;i:1;i:50;i:1;i:51;i:1;i:52;i:1;i:53;i:1;i:54;i:1;i:55;i:1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:62;i:1;i:64;i:1;i:65;i:-2;i:66;i:1;}s:69:"/home/bjartka/public_html/doctrine/lib/Doctrine/Adapter/Interface.php";a:2:{i:34;i:1;i:46;i:1;}s:65:"/home/bjartka/public_html/doctrine/lib/Doctrine/Export/Oracle.php";a:157:{i:21;i:1;i:34;i:1;i:46;i:-1;i:47;i:-1;i:49;i:-1;i:50;i:-1;i:52;i:-1;i:53;i:-1;i:55;i:-1;i:56;i:-1;i:59;i:-1;i:60;i:-1;i:61;i:-1;i:62;i:-1;i:63;i:-1;i:65;i:-1;i:66;i:-2;i:78;i:-1;i:79;i:-1;i:80;i:-1;i:82;i:-1;i:84;i:-1;i:85;i:-2;i:98;i:1;i:99;i:1;i:100;i:1;i:102;i:1;i:103;i:1;i:104;i:1;i:106;i:1;i:108;i:1;i:109;i:-1;i:110;i:-1;i:112;i:-1;i:113;i:-1;i:115;i:1;i:117;i:1;i:118;i:1;i:119;i:1;i:120;i:1;i:121;i:1;i:123;i:1;i:129;i:1;i:130;i:1;i:131;i:1;i:135;i:1;i:138;i:1;i:142;i:1;i:143;i:1;i:144;i:-2;i:154;i:-1;i:155;i:-1;i:156;i:-1;i:157;i:-1;i:158;i:-1;i:159;i:-1;i:161;i:-1;i:162;i:-1;i:163;i:-1;i:166;i:-1;i:169;i:-1;i:171;i:-1;i:174;i:-1;i:175;i:-1;i:176;i:-1;i:186;i:-1;i:187;i:-2;i:200;i:-1;i:201;i:-1;i:202;i:-1;i:203;i:-1;i:204;i:-1;i:205;i:-1;i:206;i:-1;i:207;i:-1;i:209;i:-1;i:210;i:-1;i:211;i:-1;i:212;i:-1;i:214;i:-1;i:215;i:-2;i:250;i:1;i:252;i:1;i:253;i:1;i:254;i:1;i:256;i:1;i:257;i:1;i:292;i:1;i:294;i:1;i:295;i:1;i:296;i:1;i:297;i:1;i:298;i:1;i:299;i:1;i:301;i:1;i:302;i:-2;i:313;i:-1;i:314;i:-1;i:316;i:-1;i:317;i:-2;i:410;i:-1;i:412;i:-1;i:413;i:-1;i:414;i:-1;i:415;i:-1;i:416;i:-1;i:417;i:-1;i:418;i:-1;i:419;i:-1;i:420;i:-1;i:421;i:-1;i:423;i:-1;i:424;i:-1;i:425;i:-2;i:427;i:-1;i:429;i:-1;i:430;i:-1;i:431;i:-1;i:432;i:-1;i:433;i:-1;i:434;i:-1;i:435;i:-1;i:437;i:-1;i:438;i:-1;i:439;i:-1;i:440;i:-1;i:441;i:-1;i:442;i:-1;i:443;i:-1;i:445;i:-1;i:446;i:-1;i:447;i:-1;i:448;i:-1;i:450;i:-1;i:451;i:-1;i:452;i:-1;i:454;i:-1;i:455;i:-1;i:456;i:-1;i:457;i:-1;i:458;i:-1;i:459;i:-1;i:460;i:-1;i:462;i:-1;i:463;i:-1;i:464;i:-1;i:465;i:-1;i:466;i:-1;i:483;i:1;i:484;i:1;i:485;i:1;i:486;i:1;i:487;i:-2;i:498;i:1;i:499;i:1;i:500;i:-2;i:501;i:1;}s:70:"/home/bjartka/public_html/doctrine/lib/Doctrine/Transaction/Oracle.php";a:25:{i:21;i:1;i:33;i:1;i:44;i:1;i:46;i:1;i:47;i:-2;i:59;i:1;i:60;i:-2;i:71;i:1;i:73;i:1;i:74;i:-2;i:91;i:1;i:92;i:1;i:93;i:1;i:94;i:1;i:95;i:1;i:96;i:1;i:97;i:1;i:98;i:1;i:99;i:1;i:100;i:1;i:101;i:1;i:103;i:1;i:104;i:1;i:105;i:-2;i:106;i:1;}s:58:"/home/bjartka/public_html/doctrine/lib/Doctrine/Import.php";a:61:{i:21;i:1;i:37;i:1;i:48;i:1;i:49;i:-1;i:50;i:-2;i:52;i:1;i:53;i:-2;i:62;i:1;i:63;i:-1;i:64;i:-2;i:66;i:1;i:67;i:-2;i:77;i:-1;i:78;i:-2;i:88;i:1;i:89;i:-1;i:90;i:-2;i:92;i:1;i:93;i:-2;i:103;i:-1;i:104;i:-2;i:114;i:-1;i:115;i:-2;i:125;i:-1;i:126;i:-2;i:136;i:-1;i:137;i:-2;i:147;i:-1;i:148;i:-2;i:158;i:-1;i:159;i:-2;i:168;i:1;i:169;i:-1;i:170;i:-2;i:172;i:1;i:173;i:-2;i:183;i:1;i:184;i:-1;i:185;i:-2;i:187;i:1;i:188;i:-2;i:201;i:-1;i:203;i:-1;i:206;i:-1;i:207;i:-1;i:208;i:-2;i:210;i:-1;i:211;i:-1;i:212;i:-1;i:214;i:-1;i:215;i:-1;i:216;i:-1;i:217;i:-1;i:218;i:-1;i:219;i:-1;i:221;i:-1;i:222;i:-1;i:223;i:-1;i:225;i:-1;i:226;i:-2;i:227;i:1;}s:77:"/home/bjartka/public_html/doctrine/lib/Doctrine/Search/Analyzer/Interface.php";a:2:{i:33;i:1;i:36;i:1;}s:67:"/home/bjartka/public_html/doctrine/lib/Doctrine/Validator/Email.php";a:27:{i:34;i:1;i:44;i:1;i:45;i:1;i:46;i:-2;i:47;i:1;i:48;i:1;i:49;i:1;i:50;i:1;i:51;i:1;i:52;i:-2;i:53;i:-1;i:54;i:-1;i:56;i:1;i:57;i:1;i:58;i:1;i:59;i:1;i:60;i:1;i:61;i:1;i:62;i:1;i:63;i:1;i:64;i:1;i:65;i:1;i:73;i:1;i:74;i:1;i:76;i:1;i:77;i:-2;i:78;i:1;}}s:8:"revision";s:4:"3227";s:6:"totals";a:5:{s:5:"lines";i:18735;s:10:"notcovered";i:8791;s:7:"covered";i:8267;s:5:"maybe";i:1677;s:10:"percentage";d:53.0799999999999982946974341757595539093017578125;}s:4:"data";a:344:{s:8:"Doctrine";a:6:{s:7:"covered";i:75;s:5:"maybe";i:62;s:10:"notcovered";i:123;s:5:"total";i:260;s:10:"percentage";d:52.68999999999999772626324556767940521240234375;s:4:"type";s:7:"covered";}s:13:"Doctrine_Hook";a:6:{s:7:"covered";i:47;s:5:"maybe";i:7;s:10:"notcovered";i:15;s:5:"total";i:69;s:10:"percentage";d:78.2600000000000051159076974727213382720947265625;s:4:"type";s:7:"covered";}s:24:"Doctrine_Resource_Client";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:119;s:5:"total";i:119;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Resource_Params";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:22;s:5:"total";i:22;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Resource_Request";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:39;s:5:"total";i:39;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Resource_Config";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Resource_Query";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:126;s:5:"total";i:126;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Resource_Server";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:167;s:5:"total";i:167;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Resource_Access";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:27:"Doctrine_Resource_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Resource_Record";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:203;s:5:"total";i:203;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Resource_Collection";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:66;s:5:"total";i:66;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Resource_Table";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:79;s:5:"total";i:79;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:20:"Doctrine_Hook_Parser";a:6:{s:7:"covered";i:3;s:5:"maybe";i:2;s:10:"notcovered";i:0;s:5:"total";i:5;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:21:"Doctrine_Hook_Integer";a:6:{s:7:"covered";i:15;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:16;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:22:"Doctrine_Hook_WordLike";a:6:{s:7:"covered";i:14;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:15;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:19:"Doctrine_Hook_Equal";a:6:{s:7:"covered";i:5;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:5;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:28:"Doctrine_Hook_Parser_Complex";a:6:{s:7:"covered";i:19;s:5:"maybe";i:1;s:10:"notcovered";i:6;s:5:"total";i:26;s:10:"percentage";d:76.9200000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:23:"Doctrine_I18n_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:13:"Doctrine_I18n";a:6:{s:7:"covered";i:32;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:35;s:10:"percentage";d:97.1400000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:15:"Doctrine_Column";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:44;s:5:"total";i:44;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:17:"Doctrine_Compiler";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:92;s:5:"total";i:92;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:11:"Doctrine_Db";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:3;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:14:"Doctrine_Pager";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:96;s:5:"total";i:96;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:13:"Doctrine_Null";a:6:{s:7:"covered";i:3;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:6;s:10:"percentage";d:83.3299999999999982946974341757595539093017578125;s:4:"type";s:7:"covered";}s:15:"Doctrine_Plugin";a:6:{s:7:"covered";i:53;s:5:"maybe";i:11;s:10:"notcovered";i:13;s:5:"total";i:77;s:10:"percentage";d:83.1200000000000045474735088646411895751953125;s:4:"type";s:7:"covered";}s:14:"Doctrine_Cache";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:208;s:5:"total";i:208;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:17:"Doctrine_DataType";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:9;s:5:"total";i:9;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Query_Tokenizer";a:6:{s:7:"covered";i:159;s:5:"maybe";i:9;s:10:"notcovered";i:3;s:5:"total";i:171;s:10:"percentage";d:98.25;s:4:"type";s:7:"covered";}s:21:"Doctrine_Query_Having";a:6:{s:7:"covered";i:32;s:5:"maybe";i:4;s:10:"notcovered";i:0;s:5:"total";i:36;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:20:"Doctrine_Query_Check";a:6:{s:7:"covered";i:40;s:5:"maybe";i:6;s:10:"notcovered";i:14;s:5:"total";i:60;s:10:"percentage";d:76.6700000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:21:"Doctrine_Query_Filter";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:6;s:5:"total";i:6;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:33:"Doctrine_Query_Registry_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Query_Parser";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Query_Offset";a:6:{s:7:"covered";i:2;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:3;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:24:"Doctrine_Query_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:23:"Doctrine_Query_Abstract";a:6:{s:7:"covered";i:314;s:5:"maybe";i:106;s:10:"notcovered";i:80;s:5:"total";i:500;s:10:"percentage";d:84;s:4:"type";s:7:"covered";}s:22:"Doctrine_Query_Orderby";a:6:{s:7:"covered";i:8;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:9;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:24:"Doctrine_Query_Condition";a:6:{s:7:"covered";i:36;s:5:"maybe";i:3;s:10:"notcovered";i:0;s:5:"total";i:39;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:20:"Doctrine_Query_Where";a:6:{s:7:"covered";i:76;s:5:"maybe";i:5;s:10:"notcovered";i:4;s:5:"total";i:85;s:10:"percentage";d:95.2900000000000062527760746888816356658935546875;s:4:"type";s:7:"covered";}s:21:"Doctrine_Query_Select";a:6:{s:7:"covered";i:4;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:4;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:23:"Doctrine_Query_Registry";a:6:{s:7:"covered";i:17;s:5:"maybe";i:3;s:10:"notcovered";i:2;s:5:"total";i:22;s:10:"percentage";d:90.909999999999996589394868351519107818603515625;s:4:"type";s:7:"covered";}s:28:"Doctrine_Query_JoinCondition";a:6:{s:7:"covered";i:28;s:5:"maybe";i:1;s:10:"notcovered";i:22;s:5:"total";i:51;s:10:"percentage";d:56.8599999999999994315658113919198513031005859375;s:4:"type";s:7:"covered";}s:19:"Doctrine_Query_From";a:6:{s:7:"covered";i:32;s:5:"maybe";i:2;s:10:"notcovered";i:2;s:5:"total";i:36;s:10:"percentage";d:94.43999999999999772626324556767940521240234375;s:4:"type";s:7:"covered";}s:19:"Doctrine_Query_Part";a:6:{s:7:"covered";i:7;s:5:"maybe";i:1;s:10:"notcovered";i:1;s:5:"total";i:9;s:10:"percentage";d:88.8900000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:27:"Doctrine_Query_Filter_Chain";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:22;s:5:"total";i:22;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Query_Groupby";a:6:{s:7:"covered";i:8;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:9;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:18:"Doctrine_Query_Set";a:6:{s:7:"covered";i:17;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:18;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:20:"Doctrine_Query_Limit";a:6:{s:7:"covered";i:2;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:3;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:19:"Doctrine_Expression";a:6:{s:7:"covered";i:26;s:5:"maybe";i:7;s:10:"notcovered";i:4;s:5:"total";i:37;s:10:"percentage";d:89.18999999999999772626324556767940521240234375;s:4:"type";s:7:"covered";}s:29:"Doctrine_Hydrator_ArrayDriver";a:6:{s:7:"covered";i:12;s:5:"maybe";i:6;s:10:"notcovered";i:1;s:5:"total";i:19;s:10:"percentage";d:94.7399999999999948840923025272786617279052734375;s:4:"type";s:7:"covered";}s:27:"Doctrine_Hydrator_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Hydrator_Abstract";a:6:{s:7:"covered";i:4;s:5:"maybe";i:1;s:10:"notcovered";i:1;s:5:"total";i:6;s:10:"percentage";d:83.3299999999999982946974341757595539093017578125;s:4:"type";s:7:"covered";}s:30:"Doctrine_Hydrator_RecordDriver";a:6:{s:7:"covered";i:28;s:5:"maybe";i:8;s:10:"notcovered";i:10;s:5:"total";i:46;s:10:"percentage";d:78.2600000000000051159076974727213382720947265625;s:4:"type";s:7:"covered";}s:17:"Doctrine_Hydrator";a:6:{s:7:"covered";i:143;s:5:"maybe";i:10;s:10:"notcovered";i:5;s:5:"total";i:158;s:10:"percentage";d:96.840000000000003410605131648480892181396484375;s:4:"type";s:7:"covered";}s:13:"Doctrine_Node";a:6:{s:7:"covered";i:12;s:5:"maybe";i:5;s:10:"notcovered";i:25;s:5:"total";i:42;s:10:"percentage";d:40.47999999999999687361196265555918216705322265625;s:4:"type";s:7:"covered";}s:26:"Doctrine_DataDict_Firebird";a:6:{s:7:"covered";i:95;s:5:"maybe";i:6;s:10:"notcovered";i:20;s:5:"total";i:121;s:10:"percentage";d:83.469999999999998863131622783839702606201171875;s:4:"type";s:7:"covered";}s:27:"Doctrine_DataDict_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:24:"Doctrine_DataDict_Oracle";a:6:{s:7:"covered";i:105;s:5:"maybe";i:5;s:10:"notcovered";i:16;s:5:"total";i:126;s:10:"percentage";d:87.2999999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:23:"Doctrine_DataDict_Mysql";a:6:{s:7:"covered";i:169;s:5:"maybe";i:11;s:10:"notcovered";i:73;s:5:"total";i:253;s:10:"percentage";d:71.150000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:23:"Doctrine_DataDict_Pgsql";a:6:{s:7:"covered";i:168;s:5:"maybe";i:9;s:10:"notcovered";i:17;s:5:"total";i:194;s:10:"percentage";d:91.2399999999999948840923025272786617279052734375;s:4:"type";s:7:"covered";}s:26:"Doctrine_DataDict_Informix";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:52;s:5:"total";i:52;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_DataDict_Mssql";a:6:{s:7:"covered";i:90;s:5:"maybe";i:5;s:10:"notcovered";i:17;s:5:"total";i:112;s:10:"percentage";d:84.81999999999999317878973670303821563720703125;s:4:"type";s:7:"covered";}s:24:"Doctrine_DataDict_Sqlite";a:6:{s:7:"covered";i:137;s:5:"maybe";i:6;s:10:"notcovered";i:45;s:5:"total";i:188;s:10:"percentage";d:76.06000000000000227373675443232059478759765625;s:4:"type";s:7:"covered";}s:31:"Doctrine_Cli_AnsiColorFormatter";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:54;s:5:"total";i:54;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Cli_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Cli_Formatter";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:25;s:5:"total";i:25;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:13:"Doctrine_Tree";a:6:{s:7:"covered";i:13;s:5:"maybe";i:5;s:10:"notcovered";i:10;s:5:"total";i:28;s:10:"percentage";d:64.2900000000000062527760746888816356658935546875;s:4:"type";s:7:"covered";}s:14:"Doctrine_Query";a:6:{s:7:"covered";i:676;s:5:"maybe";i:61;s:10:"notcovered";i:126;s:5:"total";i:863;s:10:"percentage";d:85.400000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:20:"Doctrine_Transaction";a:6:{s:7:"covered";i:117;s:5:"maybe";i:23;s:10:"notcovered";i:0;s:5:"total";i:140;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:15:"Doctrine_Search";a:6:{s:7:"covered";i:122;s:5:"maybe";i:7;s:10:"notcovered";i:0;s:5:"total";i:129;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:14:"Doctrine_Event";a:6:{s:7:"covered";i:26;s:5:"maybe";i:13;s:10:"notcovered";i:47;s:5:"total";i:86;s:10:"percentage";d:45.35000000000000142108547152020037174224853515625;s:4:"type";s:7:"covered";}s:17:"Doctrine_Relation";a:6:{s:7:"covered";i:34;s:5:"maybe";i:18;s:10:"notcovered";i:20;s:5:"total";i:72;s:10:"percentage";d:72.219999999999998863131622783839702606201171875;s:4:"type";s:7:"covered";}s:22:"Doctrine_EventListener";a:6:{s:7:"covered";i:29;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:32;s:10:"percentage";d:90.6299999999999954525264911353588104248046875;s:4:"type";s:7:"covered";}s:24:"Doctrine_Record_Listener";a:6:{s:7:"covered";i:9;s:5:"maybe";i:0;s:10:"notcovered";i:4;s:5:"total";i:13;s:10:"percentage";d:69.2300000000000039790393202565610408782958984375;s:4:"type";s:7:"covered";}s:30:"Doctrine_Record_Listener_Chain";a:6:{s:7:"covered";i:48;s:5:"maybe";i:3;s:10:"notcovered";i:23;s:5:"total";i:74;s:10:"percentage";d:68.9200000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:22:"Doctrine_Record_Filter";a:6:{s:7:"covered";i:3;s:5:"maybe";i:1;s:10:"notcovered";i:1;s:5:"total";i:5;s:10:"percentage";d:80;s:4:"type";s:7:"covered";}s:25:"Doctrine_Record_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:24:"Doctrine_Record_Abstract";a:6:{s:7:"covered";i:49;s:5:"maybe";i:15;s:10:"notcovered";i:36;s:5:"total";i:100;s:10:"percentage";d:64;s:4:"type";s:7:"covered";}s:31:"Doctrine_Record_Filter_Standard";a:6:{s:7:"covered";i:3;s:5:"maybe";i:2;s:10:"notcovered";i:0;s:5:"total";i:5;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:31:"Doctrine_Record_Filter_Compound";a:6:{s:7:"covered";i:17;s:5:"maybe";i:4;s:10:"notcovered";i:14;s:5:"total";i:35;s:10:"percentage";d:60;s:4:"type";s:7:"covered";}s:24:"Doctrine_Record_Iterator";a:6:{s:7:"covered";i:8;s:5:"maybe";i:2;s:10:"notcovered";i:3;s:5:"total";i:13;s:10:"percentage";d:76.9200000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:31:"Doctrine_Record_State_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Task_DumpData";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:13;s:5:"total";i:13;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Task_BuildAllLoad";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:16;s:5:"total";i:16;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Task_BuildAll";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:20;s:5:"total";i:20;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Task_Migrate";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:34:"Doctrine_Task_GenerateMigrationsDb";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:27:"Doctrine_Task_LoadDummyData";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:6;s:5:"total";i:6;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Task_BuildAllReload";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:16;s:5:"total";i:16;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:17:"Doctrine_Task_Dql";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:30;s:5:"total";i:30;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:38:"Doctrine_Task_GenerateMigrationsModels";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Task_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Task_GenerateSql";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:15;s:5:"total";i:15;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Task_Compile";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:31:"Doctrine_Task_GenerateMigration";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Task_LoadData";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:6;s:5:"total";i:6;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Task_CreateDb";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:9;s:5:"total";i:9;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:32:"Doctrine_Task_GenerateYamlModels";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Task_CreateTables";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Task_GenerateYamlDb";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:32:"Doctrine_Task_GenerateModelsYaml";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Task_RebuildDb";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:16;s:5:"total";i:16;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:30:"Doctrine_Task_GenerateModelsDb";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:20:"Doctrine_Task_DropDb";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:17;s:5:"total";i:17;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:13:"Doctrine_Task";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:68;s:5:"total";i:68;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:15:"Doctrine_Parser";a:6:{s:7:"covered";i:19;s:5:"maybe";i:6;s:10:"notcovered";i:0;s:5:"total";i:25;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:26:"Doctrine_Locator_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:27:"Doctrine_Locator_Injectable";a:6:{s:7:"covered";i:2;s:5:"maybe";i:7;s:10:"notcovered";i:14;s:5:"total";i:23;s:10:"percentage";d:39.13000000000000255795384873636066913604736328125;s:4:"type";s:7:"covered";}s:12:"Doctrine_Cli";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:218;s:5:"total";i:218;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:15:"Doctrine_Access";a:6:{s:7:"covered";i:16;s:5:"maybe";i:7;s:10:"notcovered";i:1;s:5:"total";i:24;s:10:"percentage";d:95.8299999999999982946974341757595539093017578125;s:4:"type";s:7:"covered";}s:27:"Doctrine_Compiler_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:18:"Doctrine_Exception";a:6:{s:7:"covered";i:1;s:5:"maybe";i:2;s:10:"notcovered";i:4;s:5:"total";i:7;s:10:"percentage";d:42.8599999999999994315658113919198513031005859375;s:4:"type";s:7:"covered";}s:15:"Doctrine_Import";a:6:{s:7:"covered";i:12;s:5:"maybe";i:19;s:10:"notcovered";i:29;s:5:"total";i:60;s:10:"percentage";d:51.6700000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:25:"Doctrine_Plugin_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:17:"Doctrine_DataDict";a:6:{s:7:"covered";i:7;s:5:"maybe";i:4;s:10:"notcovered";i:22;s:5:"total";i:33;s:10:"percentage";d:33.3299999999999982946974341757595539093017578125;s:4:"type";s:7:"covered";}s:15:"Doctrine_Record";a:6:{s:7:"covered";i:493;s:5:"maybe";i:82;s:10:"notcovered";i:97;s:5:"total";i:672;s:10:"percentage";d:85.56999999999999317878973670303821563720703125;s:4:"type";s:7:"covered";}s:23:"Doctrine_Data_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:20:"Doctrine_Data_Import";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:303;s:5:"total";i:303;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:20:"Doctrine_Data_Export";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:118;s:5:"total";i:118;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:19:"Doctrine_Collection";a:6:{s:7:"covered";i:115;s:5:"maybe";i:44;s:10:"notcovered";i:142;s:5:"total";i:301;s:10:"percentage";d:52.82000000000000028421709430404007434844970703125;s:4:"type";s:7:"covered";}s:15:"Doctrine_RawSql";a:6:{s:7:"covered";i:146;s:5:"maybe";i:9;s:10:"notcovered";i:0;s:5:"total";i:155;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:15:"Doctrine_Export";a:6:{s:7:"covered";i:225;s:5:"maybe";i:51;s:10:"notcovered";i:89;s:5:"total";i:365;s:10:"percentage";d:75.6200000000000045474735088646411895751953125;s:4:"type";s:7:"covered";}s:25:"Doctrine_Table_Repository";a:6:{s:7:"covered";i:20;s:5:"maybe";i:11;s:10:"notcovered";i:9;s:5:"total";i:40;s:10:"percentage";d:77.5;s:4:"type";s:7:"covered";}s:35:"Doctrine_Table_Repository_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Table_Exception";a:6:{s:7:"covered";i:4;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:4;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:49:"Doctrine_Migration_IrreversibleMigrationException";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Migration_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Migration_Builder";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:153;s:5:"total";i:153;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Migration_Process";a:6:{s:7:"covered";i:20;s:5:"maybe";i:1;s:10:"notcovered";i:60;s:5:"total";i:81;s:10:"percentage";d:25.92999999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:26:"Doctrine_AuditLog_Listener";a:6:{s:7:"covered";i:31;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:31;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:22:"Doctrine_Template_I18n";a:6:{s:7:"covered";i:9;s:5:"maybe";i:1;s:10:"notcovered";i:1;s:5:"total";i:11;s:10:"percentage";d:90.909999999999996589394868351519107818603515625;s:4:"type";s:7:"covered";}s:40:"Doctrine_Template_Listener_Timestampable";a:6:{s:7:"covered";i:12;s:5:"maybe";i:2;s:10:"notcovered";i:5;s:5:"total";i:19;s:10:"percentage";d:73.68000000000000682121026329696178436279296875;s:4:"type";s:7:"covered";}s:36:"Doctrine_Template_Listener_Sluggable";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:37;s:5:"total";i:37;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Template_Taggable";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:31:"Doctrine_Template_Timestampable";a:6:{s:7:"covered";i:7;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:7;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:27:"Doctrine_Template_NestedSet";a:6:{s:7:"covered";i:6;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:6;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:28:"Doctrine_Template_Searchable";a:6:{s:7:"covered";i:18;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:19;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:29:"Doctrine_Template_Versionable";a:6:{s:7:"covered";i:8;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:9;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:27:"Doctrine_Template_Sluggable";a:6:{s:7:"covered";i:3;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:6;s:10:"percentage";d:50;s:4:"type";s:7:"covered";}s:17:"Doctrine_Template";a:6:{s:7:"covered";i:8;s:5:"maybe";i:6;s:10:"notcovered";i:4;s:5:"total";i:18;s:10:"percentage";d:77.780000000000001136868377216160297393798828125;s:4:"type";s:7:"covered";}s:19:"Doctrine_FileFinder";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:332;s:5:"total";i:332;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Relation_LocalKey";a:6:{s:7:"covered";i:19;s:5:"maybe";i:2;s:10:"notcovered";i:2;s:5:"total";i:23;s:10:"percentage";d:91.2999999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:34:"Doctrine_Relation_Association_Self";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:64;s:5:"total";i:64;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Relation_Nest";a:6:{s:7:"covered";i:30;s:5:"maybe";i:3;s:10:"notcovered";i:26;s:5:"total";i:59;s:10:"percentage";d:55.92999999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:24:"Doctrine_Relation_Parser";a:6:{s:7:"covered";i:169;s:5:"maybe";i:25;s:10:"notcovered";i:38;s:5:"total";i:232;s:10:"percentage";d:83.6200000000000045474735088646411895751953125;s:4:"type";s:7:"covered";}s:27:"Doctrine_Relation_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:29:"Doctrine_Relation_Association";a:6:{s:7:"covered";i:21;s:5:"maybe";i:5;s:10:"notcovered";i:5;s:5:"total";i:31;s:10:"percentage";d:83.8700000000000045474735088646411895751953125;s:4:"type";s:7:"covered";}s:28:"Doctrine_Relation_ForeignKey";a:6:{s:7:"covered";i:36;s:5:"maybe";i:2;s:10:"notcovered";i:0;s:5:"total";i:38;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:34:"Doctrine_Relation_Parser_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:25:"Doctrine_RawSql_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:25:"Doctrine_Transaction_Mock";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:29:"Doctrine_Transaction_Firebird";a:6:{s:7:"covered";i:47;s:5:"maybe";i:3;s:10:"notcovered";i:0;s:5:"total";i:50;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:30:"Doctrine_Transaction_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:27:"Doctrine_Transaction_Oracle";a:6:{s:7:"covered";i:20;s:5:"maybe";i:4;s:10:"notcovered";i:0;s:5:"total";i:24;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:26:"Doctrine_Transaction_Mysql";a:6:{s:7:"covered";i:19;s:5:"maybe";i:5;s:10:"notcovered";i:0;s:5:"total";i:24;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:26:"Doctrine_Transaction_Pgsql";a:6:{s:7:"covered";i:18;s:5:"maybe";i:4;s:10:"notcovered";i:0;s:5:"total";i:22;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:29:"Doctrine_Transaction_Informix";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Transaction_Mssql";a:6:{s:7:"covered";i:14;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:14;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:27:"Doctrine_Transaction_Sqlite";a:6:{s:7:"covered";i:15;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:16;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:21:"Doctrine_Sequence_Db2";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:47;s:5:"total";i:47;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Sequence_Firebird";a:6:{s:7:"covered";i:14;s:5:"maybe";i:12;s:10:"notcovered";i:1;s:5:"total";i:27;s:10:"percentage";d:96.2999999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:27:"Doctrine_Sequence_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Sequence_Oracle";a:6:{s:7:"covered";i:15;s:5:"maybe";i:10;s:10:"notcovered";i:0;s:5:"total";i:25;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:23:"Doctrine_Sequence_Mysql";a:6:{s:7:"covered";i:18;s:5:"maybe";i:10;s:10:"notcovered";i:0;s:5:"total";i:28;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:23:"Doctrine_Sequence_Pgsql";a:6:{s:7:"covered";i:12;s:5:"maybe";i:9;s:10:"notcovered";i:0;s:5:"total";i:21;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:26:"Doctrine_Sequence_Informix";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Sequence_Mssql";a:6:{s:7:"covered";i:29;s:5:"maybe";i:20;s:10:"notcovered";i:3;s:5:"total";i:52;s:10:"percentage";d:94.2300000000000039790393202565610408782958984375;s:4:"type";s:7:"covered";}s:24:"Doctrine_Sequence_Sqlite";a:6:{s:7:"covered";i:18;s:5:"maybe";i:10;s:10:"notcovered";i:0;s:5:"total";i:28;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:23:"Doctrine_Adapter_Mysqli";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:44;s:5:"total";i:44;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Adapter_Mock";a:6:{s:7:"covered";i:38;s:5:"maybe";i:12;s:10:"notcovered";i:15;s:5:"total";i:65;s:10:"percentage";d:76.9200000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:20:"Doctrine_Adapter_Db2";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:159;s:5:"total";i:159;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:31:"Doctrine_Adapter_Statement_Mock";a:6:{s:7:"covered";i:12;s:5:"maybe";i:11;s:10:"notcovered";i:12;s:5:"total";i:35;s:10:"percentage";d:65.7099999999999937472239253111183643341064453125;s:4:"type";s:7:"covered";}s:26:"Doctrine_Adapter_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:30:"Doctrine_Adapter_Db2_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Adapter_Oracle";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:113;s:5:"total";i:113;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Adapter_Resource";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:42;s:5:"total";i:42;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Adapter_Statement";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:18;s:5:"total";i:18;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:14:"Doctrine_Table";a:6:{s:7:"covered";i:512;s:5:"maybe";i:127;s:10:"notcovered";i:93;s:5:"total";i:732;s:10:"percentage";d:87.2999999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:22:"Doctrine_Export_Schema";a:6:{s:7:"covered";i:45;s:5:"maybe";i:3;s:10:"notcovered";i:3;s:5:"total";i:51;s:10:"percentage";d:94.1200000000000045474735088646411895751953125;s:4:"type";s:7:"covered";}s:24:"Doctrine_Export_Firebird";a:6:{s:7:"covered";i:49;s:5:"maybe";i:20;s:10:"notcovered";i:126;s:5:"total";i:195;s:10:"percentage";d:35.38000000000000255795384873636066913604736328125;s:4:"type";s:7:"covered";}s:25:"Doctrine_Export_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:22:"Doctrine_Export_Oracle";a:6:{s:7:"covered";i:44;s:5:"maybe";i:10;s:10:"notcovered";i:102;s:5:"total";i:156;s:10:"percentage";d:34.61999999999999744204615126363933086395263671875;s:4:"type";s:7:"covered";}s:21:"Doctrine_Export_Mysql";a:6:{s:7:"covered";i:121;s:5:"maybe";i:19;s:10:"notcovered";i:149;s:5:"total";i:289;s:10:"percentage";d:48.43999999999999772626324556767940521240234375;s:4:"type";s:7:"covered";}s:21:"Doctrine_Export_Pgsql";a:6:{s:7:"covered";i:36;s:5:"maybe";i:12;s:10:"notcovered";i:83;s:5:"total";i:131;s:10:"percentage";d:36.6400000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:21:"Doctrine_Export_Mssql";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:84;s:5:"total";i:84;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Export_Frontbase";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:132;s:5:"total";i:132;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Export_Sqlite";a:6:{s:7:"covered";i:82;s:5:"maybe";i:21;s:10:"notcovered";i:76;s:5:"total";i:179;s:10:"percentage";d:57.53999999999999914734871708787977695465087890625;s:4:"type";s:7:"covered";}s:24:"Doctrine_Export_Reporter";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:6;s:5:"total";i:6;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:20:"Doctrine_Pager_Range";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:24;s:5:"total";i:24;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Pager_Range_Jumping";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:30;s:5:"total";i:30;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Pager_Range_Sliding";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:36;s:5:"total";i:36;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Pager_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:13:"Doctrine_Data";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:73;s:5:"total";i:73;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:17:"Doctrine_Sequence";a:6:{s:7:"covered";i:2;s:5:"maybe";i:3;s:10:"notcovered";i:4;s:5:"total";i:9;s:10:"percentage";d:55.56000000000000227373675443232059478759765625;s:4:"type";s:7:"covered";}s:23:"Doctrine_Tree_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Tree_NestedSet";a:6:{s:7:"covered";i:38;s:5:"maybe";i:15;s:10:"notcovered";i:62;s:5:"total";i:115;s:10:"percentage";d:46.090000000000003410605131648480892181396484375;s:4:"type";s:7:"covered";}s:27:"Doctrine_Tree_AdjacencyList";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:30:"Doctrine_Tree_MaterializedPath";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:13:"Doctrine_File";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:15;s:5:"total";i:15;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:12:"Doctrine_Lib";a:6:{s:7:"covered";i:9;s:5:"maybe";i:19;s:10:"notcovered";i:104;s:5:"total";i:132;s:10:"percentage";d:21.21000000000000085265128291212022304534912109375;s:4:"type";s:7:"covered";}s:24:"Doctrine_Expression_Mock";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:28:"Doctrine_Expression_Firebird";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:6;s:5:"total";i:6;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:29:"Doctrine_Expression_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:26:"Doctrine_Expression_Oracle";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:26;s:5:"total";i:26;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Expression_Driver";a:6:{s:7:"covered";i:82;s:5:"maybe";i:45;s:10:"notcovered";i:9;s:5:"total";i:136;s:10:"percentage";d:93.3799999999999954525264911353588104248046875;s:4:"type";s:7:"covered";}s:25:"Doctrine_Expression_Mysql";a:6:{s:7:"covered";i:2;s:5:"maybe";i:4;s:10:"notcovered";i:27;s:5:"total";i:33;s:10:"percentage";d:18.17999999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:25:"Doctrine_Expression_Pgsql";a:6:{s:7:"covered";i:2;s:5:"maybe";i:13;s:10:"notcovered";i:43;s:5:"total";i:58;s:10:"percentage";d:25.8599999999999994315658113919198513031005859375;s:4:"type";s:7:"covered";}s:28:"Doctrine_Expression_Informix";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Expression_Mssql";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:22;s:5:"total";i:22;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Expression_Sqlite";a:6:{s:7:"covered";i:8;s:5:"maybe";i:14;s:10:"notcovered";i:18;s:5:"total";i:40;s:10:"percentage";d:55;s:4:"type";s:7:"covered";}s:20:"Doctrine_Cache_Array";a:6:{s:7:"covered";i:7;s:5:"maybe";i:4;s:10:"notcovered";i:5;s:5:"total";i:16;s:10:"percentage";d:68.75;s:4:"type";s:7:"covered";}s:17:"Doctrine_Cache_Db";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:92;s:5:"total";i:92;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Cache_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Cache_Driver";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:17;s:5:"total";i:17;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Cache_Memcache";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:51;s:5:"total";i:51;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:18:"Doctrine_Cache_Apc";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:28;s:5:"total";i:28;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:16:"Doctrine_Locator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:68;s:5:"total";i:68;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_View_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:32:"Doctrine_EventListener_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_EventListener_Chain";a:6:{s:7:"covered";i:68;s:5:"maybe";i:3;s:10:"notcovered";i:71;s:5:"total";i:142;s:10:"percentage";d:50;s:4:"type";s:7:"covered";}s:17:"Doctrine_Resource";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:23;s:5:"total";i:23;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:16:"Doctrine_Adapter";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Parser_Serialize";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:10;s:5:"total";i:10;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:19:"Doctrine_Parser_Yml";a:6:{s:7:"covered";i:9;s:5:"maybe";i:2;s:10:"notcovered";i:0;s:5:"total";i:11;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:20:"Doctrine_Parser_Json";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:12;s:5:"total";i:12;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Parser_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:19:"Doctrine_Parser_Xml";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:64;s:5:"total";i:64;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Validator_Notnull";a:6:{s:7:"covered";i:2;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:3;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:24:"Doctrine_Validator_Range";a:6:{s:7:"covered";i:3;s:5:"maybe";i:3;s:10:"notcovered";i:3;s:5:"total";i:9;s:10:"percentage";d:66.6700000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:27:"Doctrine_Validator_Notblank";a:6:{s:7:"covered";i:2;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:3;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:26:"Doctrine_Validator_Country";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:8;s:5:"total";i:8;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Validator_Nospace";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:3;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Validator_Past";a:6:{s:7:"covered";i:15;s:5:"maybe";i:5;s:10:"notcovered";i:11;s:5:"total";i:31;s:10:"percentage";d:64.5199999999999960209606797434389591217041015625;s:4:"type";s:7:"covered";}s:25:"Doctrine_Validator_Future";a:6:{s:7:"covered";i:15;s:5:"maybe";i:5;s:10:"notcovered";i:11;s:5:"total";i:31;s:10:"percentage";d:64.5199999999999960209606797434389591217041015625;s:4:"type";s:7:"covered";}s:26:"Doctrine_Validator_Usstate";a:6:{s:7:"covered";i:2;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:5;s:10:"percentage";d:80;s:4:"type";s:7:"covered";}s:29:"Doctrine_Validator_ErrorStack";a:6:{s:7:"covered";i:9;s:5:"maybe";i:6;s:10:"notcovered";i:10;s:5:"total";i:25;s:10:"percentage";d:60;s:4:"type";s:7:"covered";}s:28:"Doctrine_Validator_Exception";a:6:{s:7:"covered";i:12;s:5:"maybe";i:5;s:10:"notcovered";i:6;s:5:"total";i:23;s:10:"percentage";d:73.909999999999996589394868351519107818603515625;s:4:"type";s:7:"covered";}s:24:"Doctrine_Validator_Email";a:6:{s:7:"covered";i:21;s:5:"maybe";i:3;s:10:"notcovered";i:2;s:5:"total";i:26;s:10:"percentage";d:92.31000000000000227373675443232059478759765625;s:4:"type";s:7:"covered";}s:28:"Doctrine_Validator_Htmlcolor";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:6;s:5:"total";i:6;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Validator_Driver";a:6:{s:7:"covered";i:4;s:5:"maybe";i:8;s:10:"notcovered";i:10;s:5:"total";i:22;s:10:"percentage";d:54.5499999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:28:"Doctrine_Validator_Minlength";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:7;s:5:"total";i:7;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Validator_Unique";a:6:{s:7:"covered";i:17;s:5:"maybe";i:1;s:10:"notcovered";i:2;s:5:"total";i:20;s:10:"percentage";d:90;s:4:"type";s:7:"covered";}s:29:"Doctrine_Validator_Creditcard";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:3;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Validator_Date";a:6:{s:7:"covered";i:5;s:5:"maybe";i:3;s:10:"notcovered";i:2;s:5:"total";i:10;s:10:"percentage";d:80;s:4:"type";s:7:"covered";}s:27:"Doctrine_Validator_Unsigned";a:6:{s:7:"covered";i:4;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:7;s:10:"percentage";d:85.7099999999999937472239253111183643341064453125;s:4:"type";s:7:"covered";}s:25:"Doctrine_Validator_Regexp";a:6:{s:7:"covered";i:6;s:5:"maybe";i:5;s:10:"notcovered";i:6;s:5:"total";i:17;s:10:"percentage";d:64.7099999999999937472239253111183643341064453125;s:4:"type";s:7:"covered";}s:21:"Doctrine_Validator_Ip";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:3;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:18:"Doctrine_Validator";a:6:{s:7:"covered";i:98;s:5:"maybe";i:13;s:10:"notcovered";i:18;s:5:"total";i:129;s:10:"percentage";d:86.0499999999999971578290569595992565155029296875;s:4:"type";s:7:"covered";}s:26:"Doctrine_Locking_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:36:"Doctrine_Locking_Manager_Pessimistic";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:178;s:5:"total";i:178;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Import_Reader";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Import_Schema";a:6:{s:7:"covered";i:142;s:5:"maybe";i:13;s:10:"notcovered";i:49;s:5:"total";i:204;s:10:"percentage";d:75.9800000000000039790393202565610408782958984375;s:4:"type";s:7:"covered";}s:24:"Doctrine_Import_Firebird";a:6:{s:7:"covered";i:21;s:5:"maybe";i:7;s:10:"notcovered";i:0;s:5:"total";i:28;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:25:"Doctrine_Import_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Import_Reader_Db";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:33;s:5:"total";i:33;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:32:"Doctrine_Import_Reader_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Import_Builder";a:6:{s:7:"covered";i:214;s:5:"maybe";i:16;s:10:"notcovered";i:115;s:5:"total";i:345;s:10:"percentage";d:66.6700000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:22:"Doctrine_Import_Oracle";a:6:{s:7:"covered";i:33;s:5:"maybe";i:10;s:10:"notcovered";i:19;s:5:"total";i:62;s:10:"percentage";d:69.349999999999994315658113919198513031005859375;s:4:"type";s:7:"covered";}s:21:"Doctrine_Import_Mysql";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:114;s:5:"total";i:114;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Import_Pgsql";a:6:{s:7:"covered";i:15;s:5:"maybe";i:6;s:10:"notcovered";i:27;s:5:"total";i:48;s:10:"percentage";d:43.75;s:4:"type";s:7:"covered";}s:33:"Doctrine_Import_Builder_BaseClass";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:33:"Doctrine_Import_Builder_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Import_Informix";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Import_Mssql";a:6:{s:7:"covered";i:21;s:5:"maybe";i:7;s:10:"notcovered";i:46;s:5:"total";i:74;s:10:"percentage";d:37.840000000000003410605131648480892181396484375;s:4:"type";s:7:"covered";}s:22:"Doctrine_Import_Sqlite";a:6:{s:7:"covered";i:20;s:5:"maybe";i:7;s:10:"notcovered";i:59;s:5:"total";i:86;s:10:"percentage";d:31.39999999999999857891452847979962825775146484375;s:4:"type";s:7:"covered";}s:23:"Doctrine_Node_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Node_NestedSet";a:6:{s:7:"covered";i:64;s:5:"maybe";i:47;s:10:"notcovered";i:326;s:5:"total";i:437;s:10:"percentage";d:25.39999999999999857891452847979962825775146484375;s:4:"type";s:7:"covered";}s:44:"Doctrine_Node_AdjacencyList_PreOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:46:"Doctrine_Node_AdjacencyList_LevelOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:45:"Doctrine_Node_AdjacencyList_PostOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:47:"Doctrine_Node_MaterializedPath_PreOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:18;s:5:"total";i:18;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:49:"Doctrine_Node_MaterializedPath_LevelOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:18;s:5:"total";i:18;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:48:"Doctrine_Node_MaterializedPath_PostOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:18;s:5:"total";i:18;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:40:"Doctrine_Node_NestedSet_PreOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:73;s:5:"total";i:73;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:42:"Doctrine_Node_NestedSet_LevelOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:41:"Doctrine_Node_NestedSet_PostOrderIterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:27:"Doctrine_Node_AdjacencyList";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:30:"Doctrine_Node_MaterializedPath";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:19:"Doctrine_File_Index";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:19;s:5:"total";i:19;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:16:"Doctrine_Manager";a:6:{s:7:"covered";i:153;s:5:"maybe";i:40;s:10:"notcovered";i:82;s:5:"total";i:275;s:10:"percentage";d:70.18000000000000682121026329696178436279296875;s:4:"type";s:7:"covered";}s:24:"Doctrine_Search_Analyzer";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:3;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Search_Listener";a:6:{s:7:"covered";i:8;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:8;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:21:"Doctrine_Search_Query";a:6:{s:7:"covered";i:101;s:5:"maybe";i:12;s:10:"notcovered";i:1;s:5:"total";i:114;s:10:"percentage";d:99.1200000000000045474735088646411895751953125;s:4:"type";s:7:"covered";}s:22:"Doctrine_Search_Parser";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Search_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:2;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:22:"Doctrine_Search_Record";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:10;s:5:"total";i:10;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:20:"Doctrine_Search_File";a:6:{s:7:"covered";i:21;s:5:"maybe";i:1;s:10:"notcovered";i:0;s:5:"total";i:22;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:33:"Doctrine_Search_Analyzer_Standard";a:6:{s:7:"covered";i:17;s:5:"maybe";i:3;s:10:"notcovered";i:0;s:5:"total";i:20;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:34:"Doctrine_Search_Analyzer_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Search_Scorer";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:19;s:5:"total";i:19;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Search_Indexer";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:39;s:5:"total";i:39;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:33:"Doctrine_Search_Indexer_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:27:"Doctrine_Search_Indexer_Dir";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:11;s:5:"total";i:11;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:12:"Doctrine_Log";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:73;s:5:"total";i:73;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_IntegrityMapper";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:103;s:5:"total";i:103;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:21:"Doctrine_Configurable";a:6:{s:7:"covered";i:84;s:5:"maybe";i:38;s:10:"notcovered";i:56;s:5:"total";i:178;s:10:"percentage";d:68.5400000000000062527760746888816356658935546875;s:4:"type";s:7:"covered";}s:17:"Doctrine_AuditLog";a:6:{s:7:"covered";i:34;s:5:"maybe";i:2;s:10:"notcovered";i:0;s:5:"total";i:36;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:19:"Doctrine_Connection";a:6:{s:7:"covered";i:228;s:5:"maybe";i:72;s:10:"notcovered";i:73;s:5:"total";i:373;s:10:"percentage";d:80.43000000000000682121026329696178436279296875;s:4:"type";s:7:"covered";}s:26:"Doctrine_Manager_Exception";a:6:{s:7:"covered";i:1;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:1;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:26:"Doctrine_Collection_Offset";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:10;s:5:"total";i:10;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:29:"Doctrine_Collection_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:35:"Doctrine_Collection_Iterator_Normal";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:3;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:35:"Doctrine_Collection_Iterator_Offset";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:1;s:5:"total";i:1;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:39:"Doctrine_Collection_Iterator_Expandable";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:18;s:5:"total";i:18;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Collection_Iterator";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:25;s:5:"total";i:25;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:18:"Doctrine_Migration";a:6:{s:7:"covered";i:108;s:5:"maybe";i:18;s:10:"notcovered";i:44;s:5:"total";i:170;s:10:"percentage";d:74.1200000000000045474735088646411895751953125;s:4:"type";s:7:"covered";}s:29:"Doctrine_Log_Formatter_Simple";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:18;s:5:"total";i:18;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Log_Formatter_Xml";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:26;s:5:"total";i:26;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Log_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:22:"Doctrine_Log_Writer_Db";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:31;s:5:"total";i:31;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Log_Writer_Null";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:2;s:5:"total";i:2;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Log_Writer_Mock";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:6;s:5:"total";i:6;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Log_Writer_Abstract";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:20;s:5:"total";i:20;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:26:"Doctrine_Log_Writer_Stream";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:32;s:5:"total";i:32;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Log_Filter_Priority";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:11;s:5:"total";i:11;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Log_Filter_Suppress";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:6;s:5:"total";i:6;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:27:"Doctrine_Log_Filter_Message";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:9;s:5:"total";i:9;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:13:"Doctrine_View";a:6:{s:7:"covered";i:18;s:5:"maybe";i:7;s:10:"notcovered";i:0;s:5:"total";i:25;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:18:"Doctrine_Formatter";a:6:{s:7:"covered";i:50;s:5:"maybe";i:13;s:10:"notcovered";i:21;s:5:"total";i:84;s:10:"percentage";d:75;s:4:"type";s:7:"covered";}s:13:"Doctrine_Util";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:24:"Doctrine_Connection_Mock";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:3;s:5:"total";i:3;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:23:"Doctrine_Connection_Db2";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:20;s:5:"total";i:20;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:38:"Doctrine_Connection_Informix_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:28:"Doctrine_Connection_Firebird";a:6:{s:7:"covered";i:22;s:5:"maybe";i:1;s:10:"notcovered";i:9;s:5:"total";i:32;s:10:"percentage";d:71.8799999999999954525264911353588104248046875;s:4:"type";s:7:"covered";}s:29:"Doctrine_Connection_Exception";a:6:{s:7:"covered";i:3;s:5:"maybe";i:3;s:10:"notcovered";i:3;s:5:"total";i:9;s:10:"percentage";d:66.6700000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:26:"Doctrine_Connection_Module";a:6:{s:7:"covered";i:9;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:12;s:10:"percentage";d:91.6700000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}s:35:"Doctrine_Connection_Mssql_Exception";a:6:{s:7:"covered";i:6;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:9;s:10:"percentage";d:88.8900000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:26:"Doctrine_Connection_Oracle";a:6:{s:7:"covered";i:36;s:5:"maybe";i:1;s:10:"notcovered";i:5;s:5:"total";i:42;s:10:"percentage";d:88.099999999999994315658113919198513031005859375;s:4:"type";s:7:"covered";}s:25:"Doctrine_Connection_Mysql";a:6:{s:7:"covered";i:36;s:5:"maybe";i:3;s:10:"notcovered";i:30;s:5:"total";i:69;s:10:"percentage";d:56.52000000000000312638803734444081783294677734375;s:4:"type";s:7:"covered";}s:38:"Doctrine_Connection_Profiler_Exception";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:0;s:5:"total";i:0;s:10:"percentage";i:100;s:4:"type";s:10:"notcovered";}s:25:"Doctrine_Connection_Pgsql";a:6:{s:7:"covered";i:43;s:5:"maybe";i:3;s:10:"notcovered";i:43;s:5:"total";i:89;s:10:"percentage";d:51.68999999999999772626324556767940521240234375;s:4:"type";s:7:"covered";}s:36:"Doctrine_Connection_Oracle_Exception";a:6:{s:7:"covered";i:6;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:9;s:10:"percentage";d:88.8900000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:28:"Doctrine_Connection_Informix";a:6:{s:7:"covered";i:0;s:5:"maybe";i:0;s:10:"notcovered";i:5;s:5:"total";i:5;s:10:"percentage";i:0;s:4:"type";s:10:"notcovered";}s:30:"Doctrine_Connection_UnitOfWork";a:6:{s:7:"covered";i:298;s:5:"maybe";i:15;s:10:"notcovered";i:59;s:5:"total";i:372;s:10:"percentage";d:84.1400000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:35:"Doctrine_Connection_Pgsql_Exception";a:6:{s:7:"covered";i:7;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:10;s:10:"percentage";d:90;s:4:"type";s:7:"covered";}s:36:"Doctrine_Connection_Sqlite_Exception";a:6:{s:7:"covered";i:7;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:10;s:10:"percentage";d:90;s:4:"type";s:7:"covered";}s:38:"Doctrine_Connection_Firebird_Exception";a:6:{s:7:"covered";i:2;s:5:"maybe";i:2;s:10:"notcovered";i:9;s:5:"total";i:13;s:10:"percentage";d:30.769999999999999573674358543939888477325439453125;s:4:"type";s:7:"covered";}s:25:"Doctrine_Connection_Mssql";a:6:{s:7:"covered";i:35;s:5:"maybe";i:11;s:10:"notcovered";i:38;s:5:"total";i:84;s:10:"percentage";d:54.75999999999999801048033987171947956085205078125;s:4:"type";s:7:"covered";}s:26:"Doctrine_Connection_Common";a:6:{s:7:"covered";i:10;s:5:"maybe";i:1;s:10:"notcovered";i:2;s:5:"total";i:13;s:10:"percentage";d:84.6200000000000045474735088646411895751953125;s:4:"type";s:7:"covered";}s:28:"Doctrine_Connection_Profiler";a:6:{s:7:"covered";i:17;s:5:"maybe";i:9;s:10:"notcovered";i:9;s:5:"total";i:35;s:10:"percentage";d:74.2900000000000062527760746888816356658935546875;s:4:"type";s:7:"covered";}s:26:"Doctrine_Connection_Sqlite";a:6:{s:7:"covered";i:37;s:5:"maybe";i:2;s:10:"notcovered";i:0;s:5:"total";i:39;s:10:"percentage";d:100;s:4:"type";s:7:"covered";}s:35:"Doctrine_Connection_Mysql_Exception";a:6:{s:7:"covered";i:6;s:5:"maybe";i:2;s:10:"notcovered";i:1;s:5:"total";i:9;s:10:"percentage";d:88.8900000000000005684341886080801486968994140625;s:4:"type";s:7:"covered";}s:29:"Doctrine_Connection_Statement";a:6:{s:7:"covered";i:42;s:5:"maybe";i:29;s:10:"notcovered";i:21;s:5:"total";i:92;s:10:"percentage";d:77.1700000000000017053025658242404460906982421875;s:4:"type";s:7:"covered";}}} \ No newline at end of file diff --git a/tests_old/coverage/index.php b/tests_old/coverage/index.php deleted file mode 100644 index f565c80f1..000000000 --- a/tests_old/coverage/index.php +++ /dev/null @@ -1,57 +0,0 @@ -. - */ - -require_once dirname(__FILE__) . '/../../lib/Doctrine.php'; -require_once dirname(__FILE__) . '/../DoctrineTest/Coverage.php'; -$reporter = new DoctrineTest_Coverage(); -$svn_info = explode(" ", exec("svn info | grep Revision")); -$revision = $svn_info[1]; - - -?> - - - - - -

    Coverage report for Doctrine

    -

    Report generated against revision getRevision(); ?> current HEAD revision is .

    -

    Default mode shows results sorted by percentage with highest first. Customize the ordering with the following GET parameters:

    • order = covered|total|maybe|notcovered|percentage
    • flip=true

    -

    Files that are not linked in the below table are not tested at all.

    - - - - - - - - - - - showSummary(); ?> -
    PercentageTotalCoveredMaybeNot Covered
    - - diff --git a/tests_old/index.php b/tests_old/index.php deleted file mode 100755 index fd3a33263..000000000 --- a/tests_old/index.php +++ /dev/null @@ -1,2 +0,0 @@ -createTable('migration_test', array('field1' => array('type' => 'string'))); - $this->addColumn('migration_test', 'field2', 'integer'); - } - - public function down() - { - $this->dropTable('migration_test'); - } -} \ No newline at end of file diff --git a/tests_old/models/Account.php b/tests_old/models/Account.php deleted file mode 100644 index b35f54394..000000000 --- a/tests_old/models/Account.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('entity_id', 'integer'); - $class->setColumn('amount', 'integer'); - } -} - diff --git a/tests_old/models/Address.php b/tests_old/models/Address.php deleted file mode 100644 index 3d6e80202..000000000 --- a/tests_old/models/Address.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('address', 'string', 200); - $class->hasMany('User', array('local' => 'address_id', - 'foreign' => 'user_id', - 'refClass' => 'EntityAddress')); - } -} diff --git a/tests_old/models/Album.php b/tests_old/models/Album.php deleted file mode 100644 index e4001c76d..000000000 --- a/tests_old/models/Album.php +++ /dev/null @@ -1,14 +0,0 @@ -setColumn('user_id', 'integer'); - $class->setColumn('name', 'string',20); - $class->hasMany('Song', array('local' => 'id', 'foreign' => 'album_id')); - $class->hasOne('User', array('local' => 'user_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} - diff --git a/tests_old/models/App.php b/tests_old/models/App.php deleted file mode 100644 index 11a1e6dde..000000000 --- a/tests_old/models/App.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string', 32); - $class->setColumn('user_id', 'integer', 11); - $class->setColumn('app_category_id', 'integer', 11); - $class->hasOne('User', array('local' => 'user_id', 'foreign' => 'id')); - $class->hasOne('App_Category as Category', array('local' => 'app_category_id', 'foreign' => 'id')); - } -} - diff --git a/tests_old/models/App_Category.php b/tests_old/models/App_Category.php deleted file mode 100644 index 977a4112c..000000000 --- a/tests_old/models/App_Category.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('name', 'string', 32); - $class->setColumn('parent_id', 'integer'); - $class->hasMany('App', array('local' => 'id', 'foreign' => 'app_category_id')); - $class->hasOne('App_Category as Parent', array('local' => 'parent_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/App_User.php b/tests_old/models/App_User.php deleted file mode 100644 index d23701ed5..000000000 --- a/tests_old/models/App_User.php +++ /dev/null @@ -1,13 +0,0 @@ -setColumn('first_name', 'string', 32); - $class->setColumn('last_name', 'string', 32); - $class->setColumn('email', 'string', 128, 'email'); - $class->setColumn('username', 'string', 16, 'unique, nospace'); - $class->setColumn('password', 'string', 128, 'notblank'); - $class->setColumn('country', 'string', 2, 'country'); - $class->setColumn('zipcode', 'string', 9, 'nospace'); - $class->hasMany('App', array('local' => 'id', 'foreign' => 'user_id')); - } -} diff --git a/tests_old/models/Assignment.php b/tests_old/models/Assignment.php deleted file mode 100644 index aec87421f..000000000 --- a/tests_old/models/Assignment.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('task_id', 'integer'); - $class->setColumn('resource_id', 'integer'); - } -} - diff --git a/tests_old/models/Auth.php b/tests_old/models/Auth.php deleted file mode 100644 index 560380a6b..000000000 --- a/tests_old/models/Auth.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('roleid', 'integer', 10); - $class->setColumn('name', 'string', 50); - $class->hasOne('Role', array('local' => 'roleid', 'foreign' => 'id')); - } -} - diff --git a/tests_old/models/Author.php b/tests_old/models/Author.php deleted file mode 100644 index 170e79891..000000000 --- a/tests_old/models/Author.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('book_id', 'integer'); - $class->setColumn('name', 'string',20); - $class->hasOne('Book', array('local' => 'book_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} diff --git a/tests_old/models/BadlyNamed__Class.php b/tests_old/models/BadlyNamed__Class.php deleted file mode 100644 index 98939beca..000000000 --- a/tests_old/models/BadlyNamed__Class.php +++ /dev/null @@ -1,7 +0,0 @@ -setTableName('bar'); - $class->setColumn('name', 'string', 200); - $class->hasMany('FooRecord as Foo', array('local' => 'barId', 'foreign' => 'fooId', 'refClass' => 'FooBarRecord')); - } -} diff --git a/tests_old/models/BaseSymfonyRecord.php b/tests_old/models/BaseSymfonyRecord.php deleted file mode 100644 index 911a67cd1..000000000 --- a/tests_old/models/BaseSymfonyRecord.php +++ /dev/null @@ -1,10 +0,0 @@ -setInheritanceType(Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS); - $class->setColumn('name', 'string', 30); - } - -} diff --git a/tests_old/models/Blog.php b/tests_old/models/Blog.php deleted file mode 100644 index 04474bade..000000000 --- a/tests_old/models/Blog.php +++ /dev/null @@ -1,23 +0,0 @@ -loadTemplate('Taggable'); - } -} -class Taggable extends Doctrine_Template -{ - public static function initMetadata($class) - { - //$this->hasMany('[Component]TagTemplate as Tag'); - } -} -class TagTemplate extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setColumn('name', 'string', 100); - $class->setColumn('description', 'string'); - } -} diff --git a/tests_old/models/BlogTag.php b/tests_old/models/BlogTag.php deleted file mode 100644 index 33a6a1e9b..000000000 --- a/tests_old/models/BlogTag.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('name', 'string', 100); - $class->setColumn('description', 'string'); - $class->hasOne('Blog', array('onDelete' => 'CASCADE')); - } -} diff --git a/tests_old/models/BoardWithPosition.php b/tests_old/models/BoardWithPosition.php deleted file mode 100644 index 1925da438..000000000 --- a/tests_old/models/BoardWithPosition.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('position', 'integer'); - $class->setColumn('category_id', 'integer'); - $class->hasOne('CategoryWithPosition as Category', array('local' => 'category_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - } -} diff --git a/tests_old/models/Book.php b/tests_old/models/Book.php deleted file mode 100644 index 3d99d0c25..000000000 --- a/tests_old/models/Book.php +++ /dev/null @@ -1,13 +0,0 @@ -setColumn('user_id', 'integer'); - $class->setColumn('name', 'string',20); - $class->hasMany('Author', array('local' => 'id', 'foreign' => 'book_id')); - $class->hasOne('User', array('local' => 'user_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} diff --git a/tests_old/models/Bookmark.php b/tests_old/models/Bookmark.php deleted file mode 100644 index 4710557c1..000000000 --- a/tests_old/models/Bookmark.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('user_id', 'integer', null, array('primary' => true)); - $class->setColumn('page_id', 'integer', null, array('primary' => true)); - } -} diff --git a/tests_old/models/BookmarkUser.php b/tests_old/models/BookmarkUser.php deleted file mode 100644 index 56b7d5170..000000000 --- a/tests_old/models/BookmarkUser.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string', 30); - $class->hasMany('Bookmark as Bookmarks', - array('local' => 'id', - 'foreign' => 'user_id')); - } -} diff --git a/tests_old/models/BooleanTest.php b/tests_old/models/BooleanTest.php deleted file mode 100644 index a433ef390..000000000 --- a/tests_old/models/BooleanTest.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('is_working', 'boolean'); - $class->setColumn('is_working_notnull', 'boolean', 1, array('default' => false, 'notnull' => true)); - } -} diff --git a/tests_old/models/CPK_Association.php b/tests_old/models/CPK_Association.php deleted file mode 100644 index 63a031529..000000000 --- a/tests_old/models/CPK_Association.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('test1_id', 'integer', 11, 'primary'); - $class->setColumn('test2_id', 'integer', 11, 'primary'); - } -} diff --git a/tests_old/models/CPK_Test.php b/tests_old/models/CPK_Test.php deleted file mode 100644 index 2c53541e1..000000000 --- a/tests_old/models/CPK_Test.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('name', 'string', 255); - $class->hasMany('CPK_Test2 as Test', array('local' => 'test_id', 'foreign' => 'test2_id', 'refClass' => 'CPK_Association')); - } -} diff --git a/tests_old/models/CPK_Test2.php b/tests_old/models/CPK_Test2.php deleted file mode 100644 index 92c75f0a9..000000000 --- a/tests_old/models/CPK_Test2.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('name', 'string', 255); - $class->hasMany('CPK_Test as Test', array('local' => 'test2_id', 'test1_id', 'refClass' => 'CPK_Association')); - } -} diff --git a/tests_old/models/CascadeDeleteRelatedTest.php b/tests_old/models/CascadeDeleteRelatedTest.php deleted file mode 100644 index d0752e7fa..000000000 --- a/tests_old/models/CascadeDeleteRelatedTest.php +++ /dev/null @@ -1,17 +0,0 @@ -setColumn('name', 'string'); - $class->setColumn('cscd_id', 'integer'); - $class->hasOne('CascadeDeleteTest', array('local' => 'cscd_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE', - 'onUpdate' => 'SET NULL')); - - $class->hasMany('CascadeDeleteRelatedTest2 as Related', - array('local' => 'id', - 'foreign' => 'cscd_id')); - } -} diff --git a/tests_old/models/CascadeDeleteRelatedTest2.php b/tests_old/models/CascadeDeleteRelatedTest2.php deleted file mode 100644 index ca18e5d16..000000000 --- a/tests_old/models/CascadeDeleteRelatedTest2.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('name', 'string'); - $class->setColumn('cscd_id', 'integer'); - $class->hasOne('CascadeDeleteRelatedTest', array('local' => 'cscd_id', - 'foreign' => 'id', - 'onDelete' => 'SET NULL')); - } -} diff --git a/tests_old/models/CascadeDeleteTest.php b/tests_old/models/CascadeDeleteTest.php deleted file mode 100644 index b5465a9cb..000000000 --- a/tests_old/models/CascadeDeleteTest.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string'); - $class->hasMany('CascadeDeleteRelatedTest as Related', - array('local' => 'id', - 'foreign' => 'cscd_id')); - } -} diff --git a/tests_old/models/CategoryNestedSet.php b/tests_old/models/CategoryNestedSet.php deleted file mode 100644 index 85d2ca22d..000000000 --- a/tests_old/models/CategoryNestedSet.php +++ /dev/null @@ -1,12 +0,0 @@ -setTableName('category_nested_set'); - $class->setColumn('id', 'integer', 4, array('primary' => true, 'autoincrement' => true)); - $class->setColumn('name', 'string', 255, array('notnull' => true)); - - $class->actAs('NestedSet'); - } -} diff --git a/tests_old/models/CategoryWithPosition.php b/tests_old/models/CategoryWithPosition.php deleted file mode 100644 index b24c4a0e5..000000000 --- a/tests_old/models/CategoryWithPosition.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('position', 'integer'); - $class->setColumn('name', 'string', 255); - $class->hasMany('BoardWithPosition as Boards', array('local' => 'id' , 'foreign' => 'category_id')); - } -} diff --git a/tests_old/models/CheckConstraintTest.php b/tests_old/models/CheckConstraintTest.php deleted file mode 100644 index 6f3d22006..000000000 --- a/tests_old/models/CheckConstraintTest.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('price', 'decimal', 2, array('max' => 5000, 'min' => 100)); - $class->setColumn('discounted_price', 'decimal', 2); - $class->check('price > discounted_price'); - } -} diff --git a/tests_old/models/ClientModel.php b/tests_old/models/ClientModel.php deleted file mode 100644 index 8552ba769..000000000 --- a/tests_old/models/ClientModel.php +++ /dev/null @@ -1,47 +0,0 @@ -setTableName('clients'); - - $class->setColumn('id', 'integer', 4, array('notnull' => true, - 'primary' => true, - 'autoincrement' => true, - 'unsigned' => true)); - $class->setColumn('short_name', 'string', 32, array('notnull' => true, 'notblank', 'unique' => true)); - $class->hasMany('AddressModel', array('local' => 'client_id', 'foreign' => 'address_id', 'refClass' => 'ClientToAddressModel')); - } -} - -class ClientToAddressModel extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('clients_to_addresses'); - - $class->setColumn('client_id', 'integer', 11, array('primary' => true)); - $class->setColumn('address_id', 'integer', 11, array('primary' => true)); - - $class->hasOne('ClientModel', array('local' => 'client_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - $class->hasOne('AddressModel', array('local' => 'address_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - } -} - -class AddressModel extends Doctrine_Entity -{ - public static function initMetadata($class) - { - $class->setTableName('addresses'); - - $class->setColumn('id', 'integer', 11, array('autoincrement' => true, - 'primary' => true - )); - $class->setColumn('address1', 'string', 255, array('notnull' => true, 'notblank')); - $class->setColumn('address2', 'string', 255, array('notnull' => true)); - $class->setColumn('city', 'string', 255, array('notnull' => true, 'notblank')); - $class->setColumn('state', 'string', 10, array('notnull' => true, 'notblank', 'usstate')); - $class->setColumn('zip', 'string', 15, array('notnull' => true, 'notblank', 'regexp' => '/^[0-9-]*$/')); - $class->hasMany('ClientModel', array('local' => 'address_id', 'foreign' => 'client_id', 'refClass' => 'ClientToAddressModel')); - } -} diff --git a/tests_old/models/ColumnAliasTest.php b/tests_old/models/ColumnAliasTest.php deleted file mode 100644 index 894d2d19b..000000000 --- a/tests_old/models/ColumnAliasTest.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('column1 as alias1', 'string', 200); - $class->setColumn('column2 as alias2', 'integer', 4); - $class->setColumn('another_column as anotherField', 'string', 50); - $class->setColumn('book_id as bookId', 'integer', 4); - $class->hasOne('Book as book', array('local' => 'book_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/ConcreteEmail.php b/tests_old/models/ConcreteEmail.php deleted file mode 100644 index 501660f64..000000000 --- a/tests_old/models/ConcreteEmail.php +++ /dev/null @@ -1,8 +0,0 @@ -loadTemplate('EmailTemplate'); - } -} diff --git a/tests_old/models/ConcreteGroup.php b/tests_old/models/ConcreteGroup.php deleted file mode 100644 index ccfaa0b03..000000000 --- a/tests_old/models/ConcreteGroup.php +++ /dev/null @@ -1,8 +0,0 @@ -loadTemplate('GroupTemplate'); - } -} diff --git a/tests_old/models/ConcreteGroupUser.php b/tests_old/models/ConcreteGroupUser.php deleted file mode 100644 index 7af708772..000000000 --- a/tests_old/models/ConcreteGroupUser.php +++ /dev/null @@ -1,8 +0,0 @@ -loadTemplate('GroupUserTemplate'); - } -} diff --git a/tests_old/models/ConcreteInheritanceTestParent.php b/tests_old/models/ConcreteInheritanceTestParent.php deleted file mode 100644 index 12b1d4066..000000000 --- a/tests_old/models/ConcreteInheritanceTestParent.php +++ /dev/null @@ -1,16 +0,0 @@ -setColumn('name', 'string'); - } -} - -class ConcreteInheritanceTestChild extends ConcreteInheritanceTestParent -{ - public static function initMetadata($class) - { - $class->setColumn('age', 'integer'); - } -} diff --git a/tests_old/models/ConcreteUser.php b/tests_old/models/ConcreteUser.php deleted file mode 100644 index a1ec61ae8..000000000 --- a/tests_old/models/ConcreteUser.php +++ /dev/null @@ -1,9 +0,0 @@ -loadTemplate('UserTemplate'); - } -} - diff --git a/tests_old/models/CoverageCodeN.php b/tests_old/models/CoverageCodeN.php deleted file mode 100644 index 55a7c5251..000000000 --- a/tests_old/models/CoverageCodeN.php +++ /dev/null @@ -1,10 +0,0 @@ -setTableName('coverage_codes'); - $class->setColumn('id', 'integer', 4, array('notnull' => true, 'primary' => true, 'autoincrement' => true)); - $class->setColumn('code', 'integer', 4, array ( 'notnull' => true, 'notblank' => true,)); - $class->setColumn('description', 'string', 4000, array ( 'notnull' => true, 'notblank' => true,)); - } -} diff --git a/tests_old/models/CustomPK.php b/tests_old/models/CustomPK.php deleted file mode 100644 index 1f0e7c43b..000000000 --- a/tests_old/models/CustomPK.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('uid', 'integer',11, array('autoincrement' => true, 'primary' => true)); - $class->setColumn('name', 'string',255); - } -} diff --git a/tests_old/models/CustomSequenceRecord.php b/tests_old/models/CustomSequenceRecord.php deleted file mode 100644 index e712a70a6..000000000 --- a/tests_old/models/CustomSequenceRecord.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('id', 'integer', null, array('primary', 'sequence' => 'custom_seq')); - $class->setColumn('name', 'string'); - } -} - diff --git a/tests_old/models/Data_File.php b/tests_old/models/Data_File.php deleted file mode 100644 index 97afb672a..000000000 --- a/tests_old/models/Data_File.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('filename', 'string'); - $class->setColumn('file_owner_id', 'integer'); - $class->hasOne('File_Owner', array('local' => 'file_owner_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/DateTest.php b/tests_old/models/DateTest.php deleted file mode 100644 index eabbbad6a..000000000 --- a/tests_old/models/DateTest.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('date', 'date', 20); - } -} - diff --git a/tests_old/models/Description.php b/tests_old/models/Description.php deleted file mode 100644 index fd51afe8c..000000000 --- a/tests_old/models/Description.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('description', 'string',3000); - $class->setColumn('file_md5', 'string',32); - } -} - diff --git a/tests_old/models/Element.php b/tests_old/models/Element.php deleted file mode 100644 index bddf40c41..000000000 --- a/tests_old/models/Element.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('name', 'string', 100); - $class->setColumn('parent_id', 'integer'); - $class->hasMany('Element as Child', array('local' => 'id', 'foreign' => 'parent_id')); - $class->hasOne('Element as Parent', array('local' => 'parent_id', 'foreign' => 'id')); - } -} - diff --git a/tests_old/models/Email.php b/tests_old/models/Email.php deleted file mode 100644 index f8d170c34..000000000 --- a/tests_old/models/Email.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('address', 'string', 150, - array('email', 'unique' => true, 'validators' => array('email', 'unique'))); - } - - -} diff --git a/tests_old/models/Entity.php b/tests_old/models/Entity.php deleted file mode 100644 index a6be04949..000000000 --- a/tests_old/models/Entity.php +++ /dev/null @@ -1,29 +0,0 @@ -setColumn('id', 'integer',20, array('autoincrement' => true, 'primary' => true)); - $class->setColumn('name', 'string',50); - $class->setColumn('loginname', 'string',20, array('unique' => true, 'validators' => array('unique'))); - $class->setColumn('password', 'string',16); - $class->setColumn('type', 'integer'); - $class->setColumn('created', 'integer',11); - $class->setColumn('updated', 'integer',11); - $class->setColumn('email_id', 'integer'); - - $class->setSubclasses(array('Group', 'User')); - $class->setInheritanceType(Doctrine::INHERITANCE_TYPE_SINGLE_TABLE, array( - 'discriminatorColumn' => 'type', - 'discriminatorMap' => array(0 => 'User', 1 => 'Group', 2 => 'Entity') - )); - - $class->hasOne('Email', array('local' => 'email_id')); - $class->hasMany('Phonenumber', array('local' => 'id', 'foreign' => 'entity_id')); - $class->hasOne('Account', array('foreign' => 'entity_id')); - $class->hasMany('Entity', array('local' => 'entity1', - 'refClass' => 'EntityReference', - 'foreign' => 'entity2', - 'equal' => true)); - } -} diff --git a/tests_old/models/EntityAddress.php b/tests_old/models/EntityAddress.php deleted file mode 100644 index 94086f8e7..000000000 --- a/tests_old/models/EntityAddress.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('user_id', 'integer', null, array('primary' => true)); - $class->setColumn('address_id', 'integer', null, array('primary' => true)); - } -} diff --git a/tests_old/models/EntityReference.php b/tests_old/models/EntityReference.php deleted file mode 100644 index 657beef63..000000000 --- a/tests_old/models/EntityReference.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('entity1', 'integer', null, array('primary' => true)); - $class->setColumn('entity2', 'integer', null, array('primary' => true)); - } -} - diff --git a/tests_old/models/EnumTest.php b/tests_old/models/EnumTest.php deleted file mode 100644 index 9125b5b6c..000000000 --- a/tests_old/models/EnumTest.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('status', 'enum', 11, array('values' => array('open', 'verified', 'closed'))); - $class->setColumn('text', 'string'); - $class->hasMany('EnumTest2 as Enum2', array('local' => 'id', 'foreign' => 'enum_test_id')); - $class->hasMany('EnumTest3 as Enum3', array('local' => 'text', 'foreign' => 'text')); - } -} diff --git a/tests_old/models/EnumTest2.php b/tests_old/models/EnumTest2.php deleted file mode 100644 index 1989c734f..000000000 --- a/tests_old/models/EnumTest2.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('status', 'enum', 11, array('values' => array('open', 'verified', 'closed'))); - $class->setColumn('enum_test_id', 'integer'); - } -} diff --git a/tests_old/models/EnumTest3.php b/tests_old/models/EnumTest3.php deleted file mode 100644 index e241e2b4f..000000000 --- a/tests_old/models/EnumTest3.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('text', 'string', 10, array('primary' => true)); - } -} diff --git a/tests_old/models/Error.php b/tests_old/models/Error.php deleted file mode 100644 index 091d0bd24..000000000 --- a/tests_old/models/Error.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('message', 'string',200); - $class->setColumn('code', 'integer',11); - $class->setColumn('file_md5', 'string',32, array('primary' => true)); - $class->hasMany('Description', array('local' => 'file_md5', 'foreign' => 'file_md5')); - } -} - diff --git a/tests_old/models/EventListenerChainTest.php b/tests_old/models/EventListenerChainTest.php deleted file mode 100644 index 6570a4c30..000000000 --- a/tests_old/models/EventListenerChainTest.php +++ /dev/null @@ -1,19 +0,0 @@ -setColumn('name', 'string', 100); - $chain = new Doctrine_EventListener_Chain(); - $chain->add(new Doctrine_EventListener_TestA()); - $chain->add(new Doctrine_EventListener_TestB()); - } -} - -class Doctrine_EventListener_TestA extends Doctrine_EventListener -{ - -} -class Doctrine_EventListener_TestB extends Doctrine_EventListener -{ - -} diff --git a/tests_old/models/EventListenerTest.php b/tests_old/models/EventListenerTest.php deleted file mode 100644 index 230bb9cf6..000000000 --- a/tests_old/models/EventListenerTest.php +++ /dev/null @@ -1,13 +0,0 @@ -setColumn("name", "string", 100); - $class->setColumn("password", "string", 8); - } - public function getName($name) { - return strtoupper($name); - } - public function setPassword($password) { - return md5($password); - } -} diff --git a/tests_old/models/FieldNameTest.php b/tests_old/models/FieldNameTest.php deleted file mode 100644 index 0ff090e21..000000000 --- a/tests_old/models/FieldNameTest.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('someColumn', 'string', 200, array('default' => 'some string')); - $class->setColumn('someEnum', 'enum', 4, array('default' => 'php', 'values' => array('php', 'java', 'python'))); - $class->setColumn('someArray', 'array', 100, array('default' => array())); - $class->setColumn('someObject', 'object', 200, array('default' => new stdClass)); - $class->setColumn('someInt', 'integer', 20, array('default' => 11)); - } -} diff --git a/tests_old/models/File_Owner.php b/tests_old/models/File_Owner.php deleted file mode 100644 index 91b9aa126..000000000 --- a/tests_old/models/File_Owner.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('name', 'string', 255); - $class->hasOne('Data_File', array('local' => 'id', 'foreign' => 'file_owner_id')); - } -} diff --git a/tests_old/models/FilterTest.php b/tests_old/models/FilterTest.php deleted file mode 100644 index ec98e4a19..000000000 --- a/tests_old/models/FilterTest.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('name', 'string',100); - $class->hasMany('FilterTest2 as filtered', array('local' => 'id', 'foreign' => 'test1_id')); - } -} diff --git a/tests_old/models/FilterTest2.php b/tests_old/models/FilterTest2.php deleted file mode 100644 index a527d8b35..000000000 --- a/tests_old/models/FilterTest2.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('name', 'string',100); - $class->setColumn('test1_id', 'integer'); - } -} diff --git a/tests_old/models/FooBarRecord.php b/tests_old/models/FooBarRecord.php deleted file mode 100644 index c067a6470..000000000 --- a/tests_old/models/FooBarRecord.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('fooId', 'integer', null, array('primary' => true)); - $class->setColumn('barId', 'integer', null, array('primary' => true)); - } -} diff --git a/tests_old/models/FooForeignlyOwned.php b/tests_old/models/FooForeignlyOwned.php deleted file mode 100644 index a39008b80..000000000 --- a/tests_old/models/FooForeignlyOwned.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('name', 'string', 200); - $class->setColumn('fooId', 'integer'); - } -} diff --git a/tests_old/models/FooForeignlyOwnedWithPK.php b/tests_old/models/FooForeignlyOwnedWithPK.php deleted file mode 100644 index 29960f1cc..000000000 --- a/tests_old/models/FooForeignlyOwnedWithPK.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('name', 'string', 200); - } -} diff --git a/tests_old/models/FooLocallyOwned.php b/tests_old/models/FooLocallyOwned.php deleted file mode 100644 index f9326a150..000000000 --- a/tests_old/models/FooLocallyOwned.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('name', 'string', 200); - } -} - diff --git a/tests_old/models/FooRecord.php b/tests_old/models/FooRecord.php deleted file mode 100644 index 76105bb11..000000000 --- a/tests_old/models/FooRecord.php +++ /dev/null @@ -1,38 +0,0 @@ -setTableName('foo'); - $class->setColumn('name', 'string', 200, array('notnull' => true)); - $class->setColumn('parent_id', 'integer'); - $class->setColumn('local_foo', 'integer'); - - $class->hasMany('FooRecord as FooFriend', array('local' => 'foo1', - 'foreign' => 'foo2', - 'equal' => true, - 'refClass' => 'FooReferenceRecord', - )); - - $class->hasMany('FooRecord as FooParents', array('local' => 'foo1', - 'foreign' => 'foo2', - 'refClass' => 'FooReferenceRecord', - 'onDelete' => 'RESTRICT', - )); - - $class->hasMany('FooRecord as FooChildren', array('local' => 'foo2', - 'foreign' => 'foo1', - 'refClass' => 'FooReferenceRecord', - )); - - $class->hasMany('FooRecord as Children', array('local' => 'id', 'foreign' => 'parent_id')); - - $class->hasOne('FooRecord as Parent', array('local' => 'parent_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - $class->hasOne('FooLocallyOwned', array('local' => 'local_foo', 'onDelete' => 'RESTRICT')); - - $class->hasMany('BarRecord as Bar', array('local' => 'fooId', - 'foreign' => 'barId', - 'refClass' => 'FooBarRecord', - 'onUpdate' => 'RESTRICT')); - } -} diff --git a/tests_old/models/FooReferenceRecord.php b/tests_old/models/FooReferenceRecord.php deleted file mode 100644 index e6da65685..000000000 --- a/tests_old/models/FooReferenceRecord.php +++ /dev/null @@ -1,10 +0,0 @@ -setTableName('foo_reference'); - $class->setColumn('foo1', 'integer', null, array('primary' => true)); - $class->setColumn('foo2', 'integer', null, array('primary' => true)); - } -} diff --git a/tests_old/models/ForeignKeyTest.php b/tests_old/models/ForeignKeyTest.php deleted file mode 100644 index c8fb887de..000000000 --- a/tests_old/models/ForeignKeyTest.php +++ /dev/null @@ -1,22 +0,0 @@ -setColumn('name', 'string', null); - $class->setColumn('code', 'integer', 4); - $class->setColumn('content', 'string', 4000); - $class->setColumn('parent_id', 'integer'); - - $class->hasOne('ForeignKeyTest as Parent', - array('local' => 'parent_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE', - 'onUpdate' => 'RESTRICT') - ); - - $class->hasMany('ForeignKeyTest as Children', array('local' => 'id', 'foreign' => 'parent_id')); - - $class->setTableOption('type', 'INNODB'); - } -} diff --git a/tests_old/models/ForeignKeyTest2.php b/tests_old/models/ForeignKeyTest2.php deleted file mode 100644 index ba0c9617b..000000000 --- a/tests_old/models/ForeignKeyTest2.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('name', 'string', null); - $class->setColumn('foreignkey', 'integer'); - $class->hasOne('ForeignKeyTest', array('local' => 'foreignkey', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/Forum_Board.php b/tests_old/models/Forum_Board.php deleted file mode 100644 index 50a2a2f4e..000000000 --- a/tests_old/models/Forum_Board.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('category_id', 'integer', 10); - $class->setColumn('name', 'string', 100); - $class->setColumn('description', 'string', 5000); - $class->hasOne('Forum_Category as Category', array('local' => 'category_id', 'foreign' => 'id')); - $class->hasMany('Forum_Thread as Threads', array('local' => 'id', 'foreign' => 'board_id')); - } -} - diff --git a/tests_old/models/Forum_Category.php b/tests_old/models/Forum_Category.php deleted file mode 100644 index d57432e9d..000000000 --- a/tests_old/models/Forum_Category.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('root_category_id', 'integer', 10); - $class->setColumn('parent_category_id', 'integer', 10); - $class->setColumn('name', 'string', 50); - $class->setColumn('description', 'string', 99999); - $class->hasMany('Forum_Category as Subcategory', array('local' => 'id', 'foreign' => 'parent_category_id')); - $class->hasOne('Forum_Category as Parent', array('local' => 'parent_category_id', 'foreign' => 'id')); - $class->hasOne('Forum_Category as Rootcategory', array('local' => 'root_category_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/Forum_Entry.php b/tests_old/models/Forum_Entry.php deleted file mode 100644 index 19538c082..000000000 --- a/tests_old/models/Forum_Entry.php +++ /dev/null @@ -1,14 +0,0 @@ -setColumn('author', 'string', 50); - $class->setColumn('topic', 'string', 100); - $class->setColumn('message', 'string', 99999); - $class->setColumn('parent_entry_id', 'integer', 10); - $class->setColumn('thread_id', 'integer', 10); - $class->setColumn('date', 'integer', 10); - $class->hasOne('Forum_Entry as Parent', array('local' => 'id', 'foreign' => 'parent_entry_id')); - $class->hasOne('Forum_Thread as Thread', array('local' => 'thread_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - } -} - diff --git a/tests_old/models/Forum_Thread.php b/tests_old/models/Forum_Thread.php deleted file mode 100644 index 691b088f1..000000000 --- a/tests_old/models/Forum_Thread.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('board_id', 'integer', 10); - $class->setColumn('updated', 'integer', 10); - $class->setColumn('closed', 'integer', 1); - $class->hasOne('Forum_Board as Board', array('local' => 'board_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - $class->hasMany('Forum_Entry as Entries', array('local' => 'id', 'foreign' => 'thread_id')); - } -} - diff --git a/tests_old/models/Group.php b/tests_old/models/Group.php deleted file mode 100644 index aeee66a27..000000000 --- a/tests_old/models/Group.php +++ /dev/null @@ -1,20 +0,0 @@ - Doctrine_Connection -// won't initialize grouptable when Doctrine_Connection->getTable('Group') is called -class GroupTable { } - -class Group extends Entity -{ - public static function initMetadata($class) - { - $class->hasMany('User', array( - 'local' => 'group_id', - 'foreign' => 'user_id', - 'refClass' => 'Groupuser' - )); - } -} - diff --git a/tests_old/models/Groupuser.php b/tests_old/models/Groupuser.php deleted file mode 100644 index 1da05f2da..000000000 --- a/tests_old/models/Groupuser.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('added', 'integer'); - $class->setColumn('group_id', 'integer', null /*,array('primary' => true)*/); - $class->setColumn('user_id', 'integer', null /*,array('primary' => true)*/); - $class->hasOne('Group', array('local' => 'group_id', 'foreign' => 'id')); - $class->hasOne('User', array('local' => 'user_id', 'foreign' => 'id')); - } -} \ No newline at end of file diff --git a/tests_old/models/GzipTest.php b/tests_old/models/GzipTest.php deleted file mode 100644 index 7e448492e..000000000 --- a/tests_old/models/GzipTest.php +++ /dev/null @@ -1,6 +0,0 @@ -setColumn('gzip', 'gzip', 100000); - } -} diff --git a/tests_old/models/I18nTest.php b/tests_old/models/I18nTest.php deleted file mode 100644 index 74987f41a..000000000 --- a/tests_old/models/I18nTest.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('name', 'string', 200); - $class->setColumn('title', 'string', 200); - $class->actAs('I18n', array('fields' => array('name', 'title'))); - } -} diff --git a/tests_old/models/InheritanceDeal.php b/tests_old/models/InheritanceDeal.php deleted file mode 100644 index df4cb21ba..000000000 --- a/tests_old/models/InheritanceDeal.php +++ /dev/null @@ -1,12 +0,0 @@ -setTableName('inheritance_deal'); - - $class->setColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,)); - $class->setColumn('name', 'string', 255, array ()); - $class->hasMany('InheritanceUser as Users', array('refClass' => 'InheritanceDealUser', 'local' => 'entity_id', 'foreign' => 'user_id')); - } -} \ No newline at end of file diff --git a/tests_old/models/InheritanceDealUser.php b/tests_old/models/InheritanceDealUser.php deleted file mode 100644 index 873306e13..000000000 --- a/tests_old/models/InheritanceDealUser.php +++ /dev/null @@ -1,27 +0,0 @@ -setInheritanceType(Doctrine::INHERITANCE_TYPE_SINGLE_TABLE, array( - 'discriminatorColumn' => 'type', - 'discriminatorMap' => array(1 => 'InheritanceDealUser', 2 => 'InheritanceEntityUser') - )); - $class->setSubclasses(array('InheritanceDealUser')); - $class->setTableName('inheritance_entity_user'); - $class->setColumn('type', 'integer', 4, array ( 'primary' => true,)); - $class->setColumn('user_id', 'integer', 4, array ( 'primary' => true,)); - $class->setColumn('entity_id', 'integer', 4, array ( 'primary' => true,)); - } -} - -class InheritanceDealUser extends InheritanceEntityUser -{ - public static function initMetadata($class) - { - $class->setColumn('user_id', 'integer', 4, array ( 'primary' => true,)); - $class->setColumn('entity_id', 'integer', 4, array ( 'primary' => true,)); - $class->hasOne('InheritanceUser as User', array('local' => 'user_id', 'foreign' => 'id')); - $class->hasOne('InheritanceDeal as Deal', array('local' => 'entity_id', 'foreign' => 'id')); - } -} \ No newline at end of file diff --git a/tests_old/models/InheritanceUser.php b/tests_old/models/InheritanceUser.php deleted file mode 100644 index 16694f74e..000000000 --- a/tests_old/models/InheritanceUser.php +++ /dev/null @@ -1,12 +0,0 @@ -setTableName('inheritance_user'); - - $class->setColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,)); - $class->setColumn('username', 'string', 128, array ( 'notnull' => true,)); - $class->hasMany('InheritanceDeal as Deals', array('refClass' => 'InheritanceDealUser', 'local' => 'user_id', 'foreign' => 'entity_id')); - } -} \ No newline at end of file diff --git a/tests_old/models/JC1.php b/tests_old/models/JC1.php deleted file mode 100644 index 49008243c..000000000 --- a/tests_old/models/JC1.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('c1_id', 'integer'); - $class->setColumn('c2_id', 'integer'); - } -} - diff --git a/tests_old/models/JC2.php b/tests_old/models/JC2.php deleted file mode 100644 index 09b3c47e5..000000000 --- a/tests_old/models/JC2.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('c1_id', 'integer'); - $class->setColumn('c2_id', 'integer'); - } -} - diff --git a/tests_old/models/JC3.php b/tests_old/models/JC3.php deleted file mode 100644 index c9db796da..000000000 --- a/tests_old/models/JC3.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('c1_id', 'integer'); - $class->setColumn('c2_id', 'integer'); - } -} - diff --git a/tests_old/models/LiabilityCodeN.php b/tests_old/models/LiabilityCodeN.php deleted file mode 100644 index dcd2a22c0..000000000 --- a/tests_old/models/LiabilityCodeN.php +++ /dev/null @@ -1,10 +0,0 @@ -setTableName('liability_codes'); - $class->setColumn('id', 'integer', 4, array('notnull' => true, 'primary' => true, 'autoincrement' => true)); - $class->setColumn('code', 'integer', 4, array ( 'notnull' => true, 'notblank' => true,)); - $class->setColumn('description', 'string', 4000, array ( 'notnull' => true, 'notblank' => true,)); - } -} diff --git a/tests_old/models/Location.php b/tests_old/models/Location.php deleted file mode 100644 index 27a00d91a..000000000 --- a/tests_old/models/Location.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('lat', 'double', 10, array ()); - $class->setColumn('lon', 'double', 10, array ()); - $class->hasMany('LocationI18n as LocationI18n', array('local' => 'id', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/LocationI18n.php b/tests_old/models/LocationI18n.php deleted file mode 100644 index c65657ffe..000000000 --- a/tests_old/models/LocationI18n.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string', 50, array()); - $class->setColumn('id', 'integer', 10, array('primary' => true)); - $class->setColumn('culture', 'string', 2); - $class->hasOne('Location as Location', array('local' => 'id')); - } -} diff --git a/tests_old/models/Log_Entry.php b/tests_old/models/Log_Entry.php deleted file mode 100644 index 4c48adec6..000000000 --- a/tests_old/models/Log_Entry.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('stamp', 'timestamp'); - $class->setColumn('status_id', 'integer'); - $class->hasOne('Log_Status', array('local' => 'status_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/Log_Status.php b/tests_old/models/Log_Status.php deleted file mode 100644 index 51dcbd1e8..000000000 --- a/tests_old/models/Log_Status.php +++ /dev/null @@ -1,6 +0,0 @@ -setColumn('name', 'string', 255); - } -} diff --git a/tests_old/models/M2MTest.php b/tests_old/models/M2MTest.php deleted file mode 100644 index 65f88c9ff..000000000 --- a/tests_old/models/M2MTest.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('name', 'string', 200); - $class->setColumn('child_id', 'integer'); - $class->hasMany('RTC1 as RTC1', array('local' => 'c2_id', 'foreign' => 'c1_id', 'refClass' => 'JC1')); - $class->hasMany('RTC2 as RTC2', array('local' => 'c2_id', 'foreign' => 'c1_id', 'refClass' => 'JC1')); - $class->hasMany('RTC3 as RTC3', array('local' => 'c2_id', 'foreign' => 'c1_id', 'refClass' => 'JC2')); - $class->hasMany('RTC3 as RTC4', array('local' => 'c2_id', 'foreign' => 'c1_id', 'refClass' => 'c1_id')); - } -} - diff --git a/tests_old/models/M2MTest2.php b/tests_old/models/M2MTest2.php deleted file mode 100644 index 0ccc5a0ca..000000000 --- a/tests_old/models/M2MTest2.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('oid', 'integer', 11, array('autoincrement', 'primary')); - $class->setColumn('name', 'string', 20); - $class->hasMany('RTC4 as RTC5', array('local' => 'c2_id', 'foreign' => 'c1_id', 'refClass' => 'JC1')); - } -} - diff --git a/tests_old/models/MigrationTest.php b/tests_old/models/MigrationTest.php deleted file mode 100644 index 464caa9bb..000000000 --- a/tests_old/models/MigrationTest.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('field1', 'string'); - } -} \ No newline at end of file diff --git a/tests_old/models/MyGroup.php b/tests_old/models/MyGroup.php deleted file mode 100644 index 06a3bbf03..000000000 --- a/tests_old/models/MyGroup.php +++ /dev/null @@ -1,17 +0,0 @@ -setTableName('my_group'); - - $this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,)); - $this->hasColumn('name', 'string', 255, array ( 'notnull' => true,)); - $this->hasColumn('description', 'string', 4000, array ()); - } - - public function setUp() - { - $this->hasMany('MyUser as users', array('refClass' => 'MyUserGroup', 'local' => 'group_id', 'foreign' => 'user_id')); - } -} diff --git a/tests_old/models/MyOneThing.php b/tests_old/models/MyOneThing.php deleted file mode 100644 index 793f8d696..000000000 --- a/tests_old/models/MyOneThing.php +++ /dev/null @@ -1,10 +0,0 @@ -hasColumn('name', 'string'); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() { - $this->hasMany('MyUserOneThing', 'MyUserOneThing.one_thing_id'); - } -} diff --git a/tests_old/models/MyOtherThing.php b/tests_old/models/MyOtherThing.php deleted file mode 100644 index 84b26cce1..000000000 --- a/tests_old/models/MyOtherThing.php +++ /dev/null @@ -1,10 +0,0 @@ -hasColumn('name', 'string'); - $this->hasColumn('user_id', 'integer'); - } - public function setUp() { - $this->hasMany('MyUserOtherThing', 'MyUserOtherThing.other_thing_id'); - } -} diff --git a/tests_old/models/MyUser.php b/tests_old/models/MyUser.php deleted file mode 100644 index d9cc791e0..000000000 --- a/tests_old/models/MyUser.php +++ /dev/null @@ -1,10 +0,0 @@ -hasColumn('name', 'string'); - } - public function setUp() { - $this->hasMany('MyOneThing', 'MyOneThing.user_id'); - $this->hasMany('MyOtherThing', 'MyOtherThing.user_id'); - } -} diff --git a/tests_old/models/MyUser2.php b/tests_old/models/MyUser2.php deleted file mode 100644 index 21e5362b7..000000000 --- a/tests_old/models/MyUser2.php +++ /dev/null @@ -1,23 +0,0 @@ -setTableName('my_user'); - - $this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,)); - $this->hasColumn('username', 'string', 128, array ( 'notnull' => true,)); - $this->hasColumn('algorithm', 'string', 128, array ( 'default' => 'sha1', 'notnull' => true,)); - $this->hasColumn('salt', 'string', 128, array ( 'notnull' => true,)); - $this->hasColumn('password', 'string', 128, array ( 'notnull' => true,)); - $this->hasColumn('created_at', 'timestamp', null, array ()); - $this->hasColumn('last_login', 'timestamp', null, array ()); - $this->hasColumn('is_active', 'boolean', null, array ( 'default' => 1, 'notnull' => true,)); - $this->hasColumn('is_super_admin', 'boolean', null, array ( 'default' => 0, 'notnull' => true,)); - } - - public function setUp() - { - $this->hasMany('MyGroup as groups', array('refClass' => 'MyUserGroup', 'local' => 'user_id', 'foreign' => 'group_id')); - } -} diff --git a/tests_old/models/MyUserGroup.php b/tests_old/models/MyUserGroup.php deleted file mode 100644 index e206fc30e..000000000 --- a/tests_old/models/MyUserGroup.php +++ /dev/null @@ -1,18 +0,0 @@ -setTableName('my_user_group'); - - $this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,)); - $this->hasColumn('group_id', 'integer', 4, array ()); - $this->hasColumn('user_id', 'integer', 4, array ()); - } - - public function setUp() - { - $this->hasOne('MyGroup as MyGroup', 'MyUserGroup.group_id'); - $this->hasOne('MyUser as MyUser', 'MyUserGroup.user_id'); - } -} diff --git a/tests_old/models/MyUserOneThing.php b/tests_old/models/MyUserOneThing.php deleted file mode 100644 index 5a48424fd..000000000 --- a/tests_old/models/MyUserOneThing.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('user_id', 'integer'); - $class->setColumn('one_thing_id', 'integer'); - } -} diff --git a/tests_old/models/MyUserOtherThing.php b/tests_old/models/MyUserOtherThing.php deleted file mode 100644 index cf31c37c4..000000000 --- a/tests_old/models/MyUserOtherThing.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('user_id', 'integer'); - $this->hasColumn('other_thing_id', 'integer'); - } -} diff --git a/tests_old/models/MysqlGroup.php b/tests_old/models/MysqlGroup.php deleted file mode 100644 index 0afbadaf2..000000000 --- a/tests_old/models/MysqlGroup.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('name', 'string', null); - $class->hasMany('MysqlUser', array('local' => 'id', 'foreign' => 'user_id')); - } -} diff --git a/tests_old/models/MysqlGroupMember.php b/tests_old/models/MysqlGroupMember.php deleted file mode 100644 index de3cfd8ce..000000000 --- a/tests_old/models/MysqlGroupMember.php +++ /dev/null @@ -1,10 +0,0 @@ -hasColumn('group_id', 'integer', null, 'primary'); - $this->hasColumn('user_id', 'integer', null, 'primary'); - } -} - diff --git a/tests_old/models/MysqlIndexTestRecord.php b/tests_old/models/MysqlIndexTestRecord.php deleted file mode 100644 index 3ec83eb7c..000000000 --- a/tests_old/models/MysqlIndexTestRecord.php +++ /dev/null @@ -1,17 +0,0 @@ -setColumn('name', 'string', null); - $class->setColumn('code', 'integer', 4); - $class->setColumn('content', 'string', 4000); - - $class->addIndex('content', array('fields' => 'content', 'type' => 'fulltext')); - $class->addIndex('namecode', array('fields' => array('name', 'code'), - 'type' => 'unique')); - - $class->setTableOption('type', 'MYISAM'); - - } -} diff --git a/tests_old/models/MysqlTestRecord.php b/tests_old/models/MysqlTestRecord.php deleted file mode 100644 index 3ecda54e5..000000000 --- a/tests_old/models/MysqlTestRecord.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string', null, array('primary' => true)); - $class->setColumn('code', 'integer', null, array('primary' => true)); - - $class->setTableOption('type', 'INNODB'); - } -} diff --git a/tests_old/models/MysqlUser.php b/tests_old/models/MysqlUser.php deleted file mode 100644 index 232b4f042..000000000 --- a/tests_old/models/MysqlUser.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('name', 'string', null); - $class->hasMany('MysqlGroup', array('local' => 'id', 'foreign' => 'group_id')); - } -} diff --git a/tests_old/models/NestReference.php b/tests_old/models/NestReference.php deleted file mode 100644 index bc055ae67..000000000 --- a/tests_old/models/NestReference.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('parent_id', 'integer', 4, array('primary' => true)); - $class->setColumn('child_id', 'integer', 4, array('primary' => true)); - } -} diff --git a/tests_old/models/NestTest.php b/tests_old/models/NestTest.php deleted file mode 100644 index b2a342459..000000000 --- a/tests_old/models/NestTest.php +++ /dev/null @@ -1,19 +0,0 @@ -setColumn('name', 'string'); - $class->hasMany('NestTest as Parents', array('local' => 'child_id', - 'refClass' => 'NestReference', - 'foreign' => 'parent_id')); - $class->hasMany('NestTest as Children', array('local' => 'parent_id', - 'refClass' => 'NestReference', - 'foreign' => 'child_id')); - - $class->hasMany('NestTest as Relatives', array('local' => 'child_id', - 'refClass' => 'NestReference', - 'foreign' => 'parent_id', - 'equal' => true)); - } -} diff --git a/tests_old/models/NestedSetTest_SingleRootNode.php b/tests_old/models/NestedSetTest_SingleRootNode.php deleted file mode 100644 index b20191e49..000000000 --- a/tests_old/models/NestedSetTest_SingleRootNode.php +++ /dev/null @@ -1,9 +0,0 @@ -actAs('NestedSet'); - $class->setColumn('name', 'string', 50, array('notnull')); - } - -} diff --git a/tests_old/models/NotNullTest.php b/tests_old/models/NotNullTest.php deleted file mode 100644 index 878eca43d..000000000 --- a/tests_old/models/NotNullTest.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('name', 'string', 100, array('notnull' => true)); - $class->setColumn('type', 'integer', 11); - } -} diff --git a/tests_old/models/ORM_AccessControl.php b/tests_old/models/ORM_AccessControl.php deleted file mode 100644 index b625a0a8b..000000000 --- a/tests_old/models/ORM_AccessControl.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('name', 'string', 255); - $class->hasMany('ORM_AccessGroup as accessGroups', array( - 'local' => 'accessControlID', 'foreign' => 'accessGroupID', - 'refClass' => 'ORM_AccessControlsGroups') - ); - } -} diff --git a/tests_old/models/ORM_AccessControlsGroups.php b/tests_old/models/ORM_AccessControlsGroups.php deleted file mode 100644 index 41d0be3e1..000000000 --- a/tests_old/models/ORM_AccessControlsGroups.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('accessControlID', 'integer', 11, array('primary' => true)); - $class->setColumn('accessGroupID', 'integer', 11, array('primary' => true)); - } -} diff --git a/tests_old/models/ORM_AccessGroup.php b/tests_old/models/ORM_AccessGroup.php deleted file mode 100644 index d2612b736..000000000 --- a/tests_old/models/ORM_AccessGroup.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string', 255); - $class->hasMany('ORM_AccessControl as accessControls', - array('local' => 'accessGroupID', 'foreign' => 'accessControlID', - 'refClass' => 'ORM_AccessControlsGroups')); - } -} diff --git a/tests_old/models/ORM_TestEntry.php b/tests_old/models/ORM_TestEntry.php deleted file mode 100644 index eb0e8f2ff..000000000 --- a/tests_old/models/ORM_TestEntry.php +++ /dev/null @@ -1,15 +0,0 @@ -setTableName('test_entries'); - $this->hasColumn('id', 'integer', 11, 'autoincrement|primary'); - $this->hasColumn('name', 'string', 255); - $this->hasColumn('stamp', 'timestamp'); - $this->hasColumn('amount', 'float'); - $this->hasColumn('itemID', 'integer'); - } - - public function setUp() { - $this->hasOne('ORM_TestItem', 'ORM_TestEntry.itemID'); - } -} diff --git a/tests_old/models/ORM_TestItem.php b/tests_old/models/ORM_TestItem.php deleted file mode 100644 index cdac98d7d..000000000 --- a/tests_old/models/ORM_TestItem.php +++ /dev/null @@ -1,13 +0,0 @@ -setTableName('test_items'); - $this->hasColumn('id', 'integer', 11, 'autoincrement|primary'); - $this->hasColumn('name', 'string', 255); - } - - public function setUp() { - - $this->hasOne('ORM_TestEntry', 'ORM_TestEntry.itemID'); - } -} diff --git a/tests_old/models/Package.php b/tests_old/models/Package.php deleted file mode 100644 index 2cc0a2844..000000000 --- a/tests_old/models/Package.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('description', 'string', 255); - $class->hasMany('PackageVersion as Version', array('local' => 'id', 'foreign' => 'package_id')); - } -} diff --git a/tests_old/models/PackageVersion.php b/tests_old/models/PackageVersion.php deleted file mode 100644 index 8c60e2a60..000000000 --- a/tests_old/models/PackageVersion.php +++ /dev/null @@ -1,12 +0,0 @@ -hasColumn('package_id', 'integer'); - $this->hasColumn('description', 'string', 255); - } - public function setUp() - { - $this->hasOne('Package', 'PackageVersion.package_id'); - $this->hasMany('PackageVersionNotes as Note', 'PackageVersionNotes.package_version_id'); - } -} diff --git a/tests_old/models/PackageVersionNotes.php b/tests_old/models/PackageVersionNotes.php deleted file mode 100644 index f7b7264a2..000000000 --- a/tests_old/models/PackageVersionNotes.php +++ /dev/null @@ -1,13 +0,0 @@ -hasColumn('package_version_id', 'integer'); - $this->hasColumn('description', 'string', 255); - } - public function setUp() - { - $this->hasOne('PackageVersion', 'PackageVersionNotes.package_version_id'); - } -} diff --git a/tests_old/models/Page.php b/tests_old/models/Page.php deleted file mode 100644 index 549d2918a..000000000 --- a/tests_old/models/Page.php +++ /dev/null @@ -1,13 +0,0 @@ -setColumn('name', 'string', 30); - $class->setColumn('url', 'string', 100); - $class->hasMany('Bookmark as Bookmarks', - array('local' => 'id', - 'foreign' => 'page_id')); - } -} diff --git a/tests_old/models/Phonenumber.php b/tests_old/models/Phonenumber.php deleted file mode 100644 index d0481c3dc..000000000 --- a/tests_old/models/Phonenumber.php +++ /dev/null @@ -1,21 +0,0 @@ -setColumn('phonenumber', 'string',20); - $class->setColumn('entity_id', 'integer'); - - $class->hasOne('Entity', array('local' => 'entity_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - - $class->hasOne('Group', array('local' => 'entity_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - - $class->hasOne('User', array('local' => 'entity_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} diff --git a/tests_old/models/Photo.php b/tests_old/models/Photo.php deleted file mode 100644 index e8d3f793c..000000000 --- a/tests_old/models/Photo.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('name', 'string', 100); - $class->hasMany('Tag', array('local' => 'photo_id', 'foreign' => 'tag_id', 'refClass' => 'Phototag')); - } -} diff --git a/tests_old/models/Phototag.php b/tests_old/models/Phototag.php deleted file mode 100644 index 940f37cb9..000000000 --- a/tests_old/models/Phototag.php +++ /dev/null @@ -1,7 +0,0 @@ -setColumn('photo_id', 'integer'); - $class->setColumn('tag_id', 'integer'); - } -} diff --git a/tests_old/models/PluginSymfonyRecord.php b/tests_old/models/PluginSymfonyRecord.php deleted file mode 100644 index 5cd72f599..000000000 --- a/tests_old/models/PluginSymfonyRecord.php +++ /dev/null @@ -1,15 +0,0 @@ -setColumn('policy_number', 'integer', 11, array('unique' => true)); - $class->hasMany('PolicyAsset as PolicyAssets', array('local' => 'policy_number', - 'foreign' => 'policy_number')); - $class->addIndex('policy_number_index', array('fields' => array('policy_number'))); - } - -} diff --git a/tests_old/models/PolicyAsset.php b/tests_old/models/PolicyAsset.php deleted file mode 100644 index 7210ecb34..000000000 --- a/tests_old/models/PolicyAsset.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('policy_number', 'integer', 11); - $class->setColumn('value', 'float', 10, array ('notblank' => true,)); - $class->hasOne('Policy', array('foreign' => 'policy_number', - 'local' => 'policy_number')); - $class->addIndex('policy_number_index', array('fields' => array('policy_number'))); - } -} diff --git a/tests_old/models/PolicyCodeN.php b/tests_old/models/PolicyCodeN.php deleted file mode 100644 index e0658dcf3..000000000 --- a/tests_old/models/PolicyCodeN.php +++ /dev/null @@ -1,10 +0,0 @@ -setTableName('policy_codes'); - $class->setColumn('id', 'integer', 4, array('notnull' => true, 'primary' => true, 'autoincrement' => true)); - $class->setColumn('code', 'integer', 4, array ( 'notnull' => true, 'notblank' => true,)); - $class->setColumn('description', 'string', 4000, array ( 'notnull' => true, 'notblank' => true,)); - } -} diff --git a/tests_old/models/PolicyN.php b/tests_old/models/PolicyN.php deleted file mode 100644 index ff6fcc7c8..000000000 --- a/tests_old/models/PolicyN.php +++ /dev/null @@ -1,12 +0,0 @@ -setTableName('policies'); - $class->setColumn('id', 'integer', 4, array('notnull' => true, 'primary' => true, 'autoincrement' => true)); - $class->setColumn('rate_id', 'integer', 4, array ( )); - $class->setColumn('policy_number', 'integer', 4, array ( 'unique' => true, )); - $class->hasOne('RateN', array('local' => 'rate_id', 'foreign' => 'id' )); - } - -} diff --git a/tests_old/models/QueryTest_Board.php b/tests_old/models/QueryTest_Board.php deleted file mode 100644 index a8c7698a9..000000000 --- a/tests_old/models/QueryTest_Board.php +++ /dev/null @@ -1,21 +0,0 @@ -setColumn('categoryId as categoryId', 'integer', 4, - array('notnull')); - $class->setColumn('name as name', 'string', 100, - array('notnull', 'unique')); - $class->setColumn('lastEntryId as lastEntryId', 'integer', 4, - array('default' => 0, 'notnull')); - $class->setColumn('position as position', 'integer', 4, - array('default' => 0, 'notnull')); - - $class->hasOne('QueryTest_Category as category', array('local' => 'categoryId', 'foreign' => 'id')); - $class->hasOne('QueryTest_Entry as lastEntry', array('local' => 'lastEntryId', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/QueryTest_Category.php b/tests_old/models/QueryTest_Category.php deleted file mode 100644 index 91c9ff929..000000000 --- a/tests_old/models/QueryTest_Category.php +++ /dev/null @@ -1,30 +0,0 @@ -setColumn('rootCategoryId as rootCategoryId', 'integer', 4, - array('default' => 0)); - $class->setColumn('parentCategoryId as parentCategoryId', 'integer', 4, - array('notnull', 'default' => 0)); - $class->setColumn('name as name', 'string', 50, - array('notnull', 'unique')); - $class->setColumn('position as position', 'integer', 4, - array('default' => 0, 'notnull')); - - $class->hasMany('QueryTest_Category as subCategories', array('local' => 'id', 'foreign' => 'parentCategoryId')); - $class->hasOne('QueryTest_Category as rootCategory', array('local' => 'rootCategoryId', 'foreign' => 'id')); - $class->hasMany('QueryTest_Board as boards', array('local' => 'id', 'foreign' => 'categoryId')); - } -} diff --git a/tests_old/models/QueryTest_Entry.php b/tests_old/models/QueryTest_Entry.php deleted file mode 100644 index 85b1a223d..000000000 --- a/tests_old/models/QueryTest_Entry.php +++ /dev/null @@ -1,15 +0,0 @@ -setColumn('authorId', 'integer', 4, - array('notnull')); - $class->setColumn('date', 'integer', 4, - array('notnull')); - $class->hasOne('QueryTest_User as author', array('local' => 'authorId', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/QueryTest_Item.php b/tests_old/models/QueryTest_Item.php deleted file mode 100644 index ee70ebc45..000000000 --- a/tests_old/models/QueryTest_Item.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('price', 'decimal'); - $class->setColumn('quantity', 'integer'); - } -} - diff --git a/tests_old/models/QueryTest_Rank.php b/tests_old/models/QueryTest_Rank.php deleted file mode 100644 index 9e93d4bab..000000000 --- a/tests_old/models/QueryTest_Rank.php +++ /dev/null @@ -1,18 +0,0 @@ -setColumn('title as title', 'string', 100, - array('notnull')); - $class->setColumn('color as color', 'string', 20, - array('notnull', 'regexp' => '/^[a-zA-Z\-]{3,}|#[0-9a-fA-F]{6}$/D')); - $class->setColumn('icon as icon', 'string', 50, - array('notnull', 'default' => ' ', 'regexp' => '/^[a-zA-Z0-9_\-]+\.(jpg|gif|png)$/D')); - - $class->hasMany('QueryTest_User as users', array('local' => 'rankId', 'foreign' => 'userId', 'refClass' => 'QueryTest_UserRank')); - } -} diff --git a/tests_old/models/QueryTest_User.php b/tests_old/models/QueryTest_User.php deleted file mode 100644 index 4c2912d88..000000000 --- a/tests_old/models/QueryTest_User.php +++ /dev/null @@ -1,13 +0,0 @@ -setColumn('username as username', 'string', 50, - array('notnull')); - $class->setColumn('visibleRankId', 'integer', 4); - $class->hasOne('QueryTest_Rank as visibleRank', array('local' => 'visibleRankId', 'foreign' => 'id')); - $class->hasMany('QueryTest_Rank as ranks', array('local' => 'userId', 'foreign' => 'rankId', 'refClass' => 'QueryTest_UserRank')); - } -} diff --git a/tests_old/models/QueryTest_UserRank.php b/tests_old/models/QueryTest_UserRank.php deleted file mode 100644 index 3e32b5e48..000000000 --- a/tests_old/models/QueryTest_UserRank.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('rankId', 'integer', 4, array('primary')); - $class->setColumn('userId', 'integer', 4, array('primary')); - } -} diff --git a/tests_old/models/RTC1.php b/tests_old/models/RTC1.php deleted file mode 100644 index d573a07bc..000000000 --- a/tests_old/models/RTC1.php +++ /dev/null @@ -1,10 +0,0 @@ -hasColumn('name', 'string', 200); - } - public function setUp() { - $this->hasMany('M2MTest as RTC1', 'JC1.c2_id'); - } -} - diff --git a/tests_old/models/RTC2.php b/tests_old/models/RTC2.php deleted file mode 100644 index a5c77312e..000000000 --- a/tests_old/models/RTC2.php +++ /dev/null @@ -1,10 +0,0 @@ -hasColumn('name', 'string', 200); - } - public function setUp() { - $this->hasMany('M2MTest as RTC2', 'JC1.c2_id'); - } -} - diff --git a/tests_old/models/RTC3.php b/tests_old/models/RTC3.php deleted file mode 100644 index e0b23f671..000000000 --- a/tests_old/models/RTC3.php +++ /dev/null @@ -1,11 +0,0 @@ -hasColumn('name', 'string', 200); - } - public function setUp() { - $this->hasMany('M2MTest as RTC3', 'JC2.c2_id'); - $this->hasMany('M2MTest as RTC4', 'JC1.c2_id'); - } -} - diff --git a/tests_old/models/RTC4.php b/tests_old/models/RTC4.php deleted file mode 100644 index 62568a5e1..000000000 --- a/tests_old/models/RTC4.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('oid', 'integer', 11, array('autoincrement', 'primary')); - $class->setColumn('name', 'string', 20); - $class->hasMany('M2MTest2', array('local' => 'c1_id', 'foreign' => 'c2_id', 'refClass' => 'JC3')); - } -} diff --git a/tests_old/models/RateN.php b/tests_old/models/RateN.php deleted file mode 100644 index 5766d4163..000000000 --- a/tests_old/models/RateN.php +++ /dev/null @@ -1,16 +0,0 @@ -setTableName('rates'); - $class->setColumn('id', 'integer', 4, array('notnull' => true, 'primary' => true, 'autoincrement' => true)); - $class->setColumn('policy_code', 'integer', 4, array ( 'notnull' => true, 'notblank' => true,)); - $class->setColumn('coverage_code', 'integer', 4, array ( 'notnull' => true, 'notblank' => true,)); - $class->setColumn('liability_code', 'integer', 4, array ( 'notnull' => true, 'notblank' => true,)); - $class->setColumn('total_rate', 'float', null, array ( 'notnull' => true, 'notblank' => true,)); - $class->hasOne('PolicyCodeN', array('local' => 'policy_code', 'foreign' => 'code' )); - $class->hasOne('CoverageCodeN', array('local' => 'coverage_code', 'foreign' => 'code' )); - $class->hasOne('LiabilityCodeN', array('local' => 'liability_code', 'foreign' => 'code' )); - } - -} diff --git a/tests_old/models/Rec1.php b/tests_old/models/Rec1.php deleted file mode 100644 index 9d57bd47a..000000000 --- a/tests_old/models/Rec1.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('first_name', 'string', 128, array ()); - $class->hasOne('Rec2 as Account', array('local' => 'id', 'foreign' => 'user_id')); - } -} - - diff --git a/tests_old/models/Rec2.php b/tests_old/models/Rec2.php deleted file mode 100644 index a18e73715..000000000 --- a/tests_old/models/Rec2.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('user_id', 'integer', 10, array ( 'unique' => true,)); - $class->setColumn('address', 'string', 150, array ()); - $class->hasOne('Rec1 as User', array('local' => 'user_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/RecordFilterTest.php b/tests_old/models/RecordFilterTest.php deleted file mode 100644 index c4959ae87..000000000 --- a/tests_old/models/RecordFilterTest.php +++ /dev/null @@ -1,15 +0,0 @@ -setColumn("name", "string", 200); - $class->setColumn("password", "string", 32); - } - public function setPassword($password) { - return md5($password); - } - public function getName($name) { - return strtoupper($name); - } -} diff --git a/tests_old/models/RecordHookTest.php b/tests_old/models/RecordHookTest.php deleted file mode 100644 index 8d9b95e8b..000000000 --- a/tests_old/models/RecordHookTest.php +++ /dev/null @@ -1,46 +0,0 @@ -setColumn('name', 'string', null, array('primary' => true)); - } - public function preSave() - { - $this->_messages[] = __FUNCTION__; - } - public function postSave() - { - $this->_messages[] = __FUNCTION__; - } - public function preInsert() - { - $this->_messages[] = __FUNCTION__; - } - public function postInsert() - { - $this->_messages[] = __FUNCTION__; - } - public function preUpdate() - { - $this->_messages[] = __FUNCTION__; - } - public function postUpdate() - { - $this->_messages[] = __FUNCTION__; - } - public function preDelete() - { - $this->_messages[] = __FUNCTION__; - } - public function postDelete() - { - $this->_messages[] = __FUNCTION__; - } - public function pop() - { - return array_pop($this->_messages); - } -} diff --git a/tests_old/models/Record_City.php b/tests_old/models/Record_City.php deleted file mode 100644 index 64c88cdb5..000000000 --- a/tests_old/models/Record_City.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('name', 'string', 200); - $class->setColumn('country_id', 'integer'); - $class->setColumn('district_id', 'integer'); - $class->hasOne('Record_Country as Country', array('local' => 'country_id', 'foreign' => 'id')); - $class->hasOne('Record_District as District', array('local' => 'district_id', 'foreign' => 'id')); - } -} diff --git a/tests_old/models/Record_Country.php b/tests_old/models/Record_Country.php deleted file mode 100644 index 5483bc7ea..000000000 --- a/tests_old/models/Record_Country.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('name', 'string', 200); - $class->hasMany('Record_City as City', array('local' => 'id', 'foreign' => 'country_id')); - } -} - - diff --git a/tests_old/models/Record_District.php b/tests_old/models/Record_District.php deleted file mode 100644 index c81f7072f..000000000 --- a/tests_old/models/Record_District.php +++ /dev/null @@ -1,6 +0,0 @@ -setColumn('name', 'string', 200); - } -} diff --git a/tests_old/models/RelationTest.php b/tests_old/models/RelationTest.php deleted file mode 100644 index 29edf4cf2..000000000 --- a/tests_old/models/RelationTest.php +++ /dev/null @@ -1,26 +0,0 @@ -setInheritanceType(Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS); - $class->setColumn('name', 'string', 200); - $class->setColumn('parent_id', 'integer'); - } -} - -class RelationTestChild extends RelationTest -{ - public static function initMetadata($class) - { - $class->hasOne('RelationTest as Parent', array( - 'local' => 'parent_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE', - )); - $class->hasMany('RelationTestChild as Children', array( - 'local' => 'id', - 'foreign' => 'parent_id', - )); - } -} diff --git a/tests_old/models/Resource.php b/tests_old/models/Resource.php deleted file mode 100644 index ba668a52d..000000000 --- a/tests_old/models/Resource.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('name', 'string',100); - $class->hasMany('Task as TaskAlias', array('local' => 'resource_id', 'foreign' => 'task_id', 'refClass' => 'Assignment')); - $class->hasMany('ResourceType as Type', array('local' => 'resource_id', 'foreign' => 'type_id', 'refClass' => 'ResourceReference')); - } -} diff --git a/tests_old/models/ResourceReference.php b/tests_old/models/ResourceReference.php deleted file mode 100644 index 5c3eb24ff..000000000 --- a/tests_old/models/ResourceReference.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('type_id', 'integer'); - $class->setColumn('resource_id', 'integer'); - } -} - diff --git a/tests_old/models/ResourceType.php b/tests_old/models/ResourceType.php deleted file mode 100644 index e26f0e34a..000000000 --- a/tests_old/models/ResourceType.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('type', 'string',100); - $class->hasMany('Resource as ResourceAlias', array('local' => 'type_id', 'foreign' => 'resource_id', 'refClass' => 'ResourceReference')); - } -} - diff --git a/tests_old/models/Role.php b/tests_old/models/Role.php deleted file mode 100644 index b52ab15e6..000000000 --- a/tests_old/models/Role.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string', 20, array('unique' => true)); - $class->hasMany('Auth', array('local' => 'id', 'foreign' => 'roleid')); - } - -} - diff --git a/tests_old/models/SearchTest.php b/tests_old/models/SearchTest.php deleted file mode 100644 index 63ef7e811..000000000 --- a/tests_old/models/SearchTest.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('title', 'string', 100); - $class->setColumn('content', 'string'); - $options = array('generateFiles' => false, - 'fields' => array('title', 'content')); - $class->actAs('Searchable', $options); - } -} diff --git a/tests_old/models/SelfRefTest.php b/tests_old/models/SelfRefTest.php deleted file mode 100644 index 40e960a4f..000000000 --- a/tests_old/models/SelfRefTest.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string', 50); - $class->setColumn('created_by', 'integer'); - $class->hasOne('SelfRefTest as createdBy', array('local' => 'created_by')); - } -} - diff --git a/tests_old/models/SequenceRecord.php b/tests_old/models/SequenceRecord.php deleted file mode 100644 index 9ed3b75d2..000000000 --- a/tests_old/models/SequenceRecord.php +++ /dev/null @@ -1,8 +0,0 @@ -hasColumn('id', 'integer', null, array('primary', 'sequence')); - $this->hasColumn('name', 'string'); - } -} diff --git a/tests_old/models/SerializeTest.php b/tests_old/models/SerializeTest.php deleted file mode 100644 index b3e02e8f6..000000000 --- a/tests_old/models/SerializeTest.php +++ /dev/null @@ -1,31 +0,0 @@ -setTableName('serialize_test'); - - $class->setColumn('booltest', 'boolean'); - $class->setColumn('integertest', 'integer', 4, array('unsigned' => true)); - $class->setColumn('floattest', 'float'); - $class->setColumn('stringtest', 'string', 200, array('fixed' => true)); - $class->setColumn('arraytest', 'array', 10000); - $class->setColumn('objecttest', 'object'); - $class->setColumn('blobtest', 'blob'); - $class->setColumn('clobtest', 'clob'); - $class->setColumn('timestamptest', 'timestamp'); - $class->setColumn('timetest', 'time'); - $class->setColumn('datetest', 'date'); - $class->setColumn('enumtest', 'enum', 4, - array( - 'values' => array( - 'php', - 'java', - 'python' - ) - ) - ); - $class->setColumn('gziptest', 'gzip'); - } - -} diff --git a/tests_old/models/SoftDeleteTest.php b/tests_old/models/SoftDeleteTest.php deleted file mode 100644 index 91c15d642..000000000 --- a/tests_old/models/SoftDeleteTest.php +++ /dev/null @@ -1,20 +0,0 @@ -setColumn('name', 'string', null, array('primary' => true)); - $class->setColumn('something', 'string', '25', array('notnull' => true, 'unique' => true)); - $class->setColumn('deleted', 'boolean', 1); - } - /*public function preDelete() - { - $event->skipOperation(); - } - public function postDelete() - { - $this->deleted = true; - - $this->save(); - }*/ -} diff --git a/tests_old/models/Song.php b/tests_old/models/Song.php deleted file mode 100644 index 1db64b07c..000000000 --- a/tests_old/models/Song.php +++ /dev/null @@ -1,13 +0,0 @@ -setColumn('album_id', 'integer'); - $class->setColumn('genre', 'string',20); - $class->setColumn('title', 'string',30); - $class->hasOne('Album', array('local' => 'album_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE')); - } -} diff --git a/tests_old/models/SymfonyRecord.php b/tests_old/models/SymfonyRecord.php deleted file mode 100644 index 782f023d3..000000000 --- a/tests_old/models/SymfonyRecord.php +++ /dev/null @@ -1,16 +0,0 @@ -setColumn('tag', 'string', 100); - $class->hasMany('Photo', array('local' => 'tag_id', 'foreign' => 'photo_id', 'refClass' => 'Phototag')); - } -} diff --git a/tests_old/models/Task.php b/tests_old/models/Task.php deleted file mode 100644 index 4dca90130..000000000 --- a/tests_old/models/Task.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('name', 'string',100); - $class->setColumn('parent_id', 'integer'); - $class->hasMany('Resource as ResourceAlias', array('local' => 'task_id', 'foreign' => 'resource_id', 'refClass' => 'Assignment')); - $class->hasMany('Task as Subtask', array('local' => 'id', 'foreign' => 'parent_id')); - } -} diff --git a/tests_old/models/TestMovie.php b/tests_old/models/TestMovie.php deleted file mode 100644 index 2e80d671c..000000000 --- a/tests_old/models/TestMovie.php +++ /dev/null @@ -1,25 +0,0 @@ -setColumn('user_id', 'integer', null); - $class->setColumn('name', 'string', 30); - - $class->hasOne('TestUser as User', - array('local' => 'user_id', - 'foreign' => 'id')); - - $class->hasMany('TestUser as MovieBookmarks', - array('local' => 'movie_id', - 'foreign' => 'user_id', - 'refClass' => 'TestMovieUserBookmark')); - - $class->hasMany('TestUser as MovieVotes', - array('local' => 'movie_id', - 'foreign' => 'user_id', - 'refClass' => 'TestMovieUserVote')); - } - -} diff --git a/tests_old/models/TestMovieUserBookmark.php b/tests_old/models/TestMovieUserBookmark.php deleted file mode 100644 index a0728a87c..000000000 --- a/tests_old/models/TestMovieUserBookmark.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('user_id', 'integer', null, array('primary' => true)); - $class->setColumn('movie_id', 'integer', null, array('primary' => true)); - } -} - diff --git a/tests_old/models/TestMovieUserVote.php b/tests_old/models/TestMovieUserVote.php deleted file mode 100644 index e51064c98..000000000 --- a/tests_old/models/TestMovieUserVote.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('vote', 'string', 30); - $class->setColumn('user_id', 'integer', null, array('primary' => true)); - $class->setColumn('movie_id', 'integer', null, array('primary' => true)); - } -} diff --git a/tests_old/models/TestRecord.php b/tests_old/models/TestRecord.php deleted file mode 100644 index 3ebb48a82..000000000 --- a/tests_old/models/TestRecord.php +++ /dev/null @@ -1,8 +0,0 @@ -setTableName('test'); - } -} diff --git a/tests_old/models/TestUser.php b/tests_old/models/TestUser.php deleted file mode 100644 index b6b8c32bd..000000000 --- a/tests_old/models/TestUser.php +++ /dev/null @@ -1,19 +0,0 @@ -setColumn('name', 'string', 30); - $class->hasMany('TestMovie as UserBookmarks', - array('local' => 'user_id', - 'foreign' => 'movie_id', - 'refClass' => 'TestMovieUserBookmark')); - - $class->hasMany('TestMovie as UserVotes', - array('local' => 'user_id', - 'foreign' => 'movie_id', - 'refClass' => 'TestMovieUserVote')); - - } - -} diff --git a/tests_old/models/TreeLeaf.php b/tests_old/models/TreeLeaf.php deleted file mode 100644 index 93c8dcc35..000000000 --- a/tests_old/models/TreeLeaf.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('name', 'string'); - $class->setColumn('parent_id', 'integer'); - $class->hasOne('TreeLeaf as Parent', array('local' => 'parent_id', 'foreign' => 'id')); - $class->hasMany('TreeLeaf as Children', array('local' => 'id', 'foreign' => 'parent_id')); - } -} diff --git a/tests_old/models/User.php b/tests_old/models/User.php deleted file mode 100644 index 049e2508f..000000000 --- a/tests_old/models/User.php +++ /dev/null @@ -1,50 +0,0 @@ -hasMany('Address', array( - 'local' => 'user_id', - 'foreign' => 'address_id', - 'refClass' => 'EntityAddress', - )); - $class->hasMany('Address as Addresses', array( - 'local' => 'user_id', - 'foreign' => 'address_id', - 'refClass' => 'EntityAddress', - )); - $class->hasMany('Album', array('local' => 'id', 'foreign' => 'user_id')); - $class->hasMany('Book', array('local' => 'id', 'foreign' => 'user_id')); - $class->hasMany('Group', array( - 'local' => 'user_id', - 'foreign' => 'group_id', - 'refClass' => 'Groupuser' - )); - } - - /** Custom validation */ - public function validate() - { - // Allow only one name! - if ($this->name !== 'The Saint') { - $this->errorStack()->add('name', 'notTheSaint'); - } - } - public function validateOnInsert() - { - if ($this->password !== 'Top Secret') { - $this->errorStack()->add('password', 'pwNotTopSecret'); - } - } - public function validateOnUpdate() - { - if ($this->loginname !== 'Nobody') { - $this->errorStack()->add('loginname', 'notNobody'); - } - } -} - diff --git a/tests_old/models/ValidatorTest.php b/tests_old/models/ValidatorTest.php deleted file mode 100644 index d82e8d8a2..000000000 --- a/tests_old/models/ValidatorTest.php +++ /dev/null @@ -1,24 +0,0 @@ -setColumn('mymixed', 'string', 100); - $class->setColumn('mystring', 'string', 100, - array('validators' => array('notnull', 'unique')) - ); - $class->setColumn('myarray', 'array', 1000); - $class->setColumn('myobject', 'object', 1000); - $class->setColumn('myinteger', 'integer', 11); - $class->setColumn('myrange', 'integer', 11, - array('validators' => array('range' => array(4,123))) - ); - $class->setColumn('myregexp', 'string', 5, - array('validators' => array('regexp' => '/^[0-9]+$/')) - ); - $class->setColumn('myemail', 'string', 100, - array('validators' => array('email')) - ); - $class->setColumn('myemail2', 'string', 100, - array('validators' => array('email', 'notblank')) - ); - } -} diff --git a/tests_old/models/ValidatorTest_AddressModel.php b/tests_old/models/ValidatorTest_AddressModel.php deleted file mode 100644 index 08acd4d8b..000000000 --- a/tests_old/models/ValidatorTest_AddressModel.php +++ /dev/null @@ -1,19 +0,0 @@ -setColumn("id", "integer", 11, array('autoincrement' => true, - 'primary' => true - )); - $class->setColumn('address1', 'string', 255, array('notnull' => true, - 'validators' => array('notnull', 'notblank'))); - $class->setColumn('address2', 'string', 255, array('notnull' => true, - 'validators' => array('notnull'))); - $class->setColumn('city', 'string', 255, array('notnull' => true, - 'validators' => array('notnull', 'notblank'))); - $class->setColumn('state', 'string', 10, array('notnull' => true, - 'validators' => array('notnull', 'notblank', 'usstate'))); - $class->setColumn('zip', 'string', 15, array('notnull' => true, - 'validators' => array('notnull', 'notblank', 'regexp' => '/^[0-9-]*$/'))); - $class->hasMany('ValidatorTest_ClientModel', array('local' => 'address_id', 'foreign' => 'client_id', 'refClass' => 'ValidatorTest_ClientToAddressModel')); - } -} diff --git a/tests_old/models/ValidatorTest_ClientModel.php b/tests_old/models/ValidatorTest_ClientModel.php deleted file mode 100644 index dcc61798c..000000000 --- a/tests_old/models/ValidatorTest_ClientModel.php +++ /dev/null @@ -1,11 +0,0 @@ -setColumn('id', 'integer', 4, array('notnull' => true, - 'primary' => true, - 'autoincrement' => true, - 'unsigned' => true)); - $class->setColumn('short_name', 'string', 32, array('notnull' => true, 'notblank', 'unique' => true)); - $class->hasMany("ValidatorTest_AddressModel", array('local' => 'client_id', 'foreign' => 'address_id', 'refClass' => 'ValidatorTest_ClientToAddressModel')); - } -} diff --git a/tests_old/models/ValidatorTest_ClientToAddressModel.php b/tests_old/models/ValidatorTest_ClientToAddressModel.php deleted file mode 100644 index 4676335cb..000000000 --- a/tests_old/models/ValidatorTest_ClientToAddressModel.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn("client_id", "integer", 11, array('primary' => true)); - $class->setColumn("address_id", "integer", 11, array('primary' => true)); - } -} diff --git a/tests_old/models/ValidatorTest_DateModel.php b/tests_old/models/ValidatorTest_DateModel.php deleted file mode 100644 index 4adcd3a33..000000000 --- a/tests_old/models/ValidatorTest_DateModel.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('birthday', 'date', null, - array('validators' => array('past'))); - $class->setColumn('death', 'date', null, - array('validators' => array('future'))); - } -} diff --git a/tests_old/models/ValidatorTest_FootballPlayer.php b/tests_old/models/ValidatorTest_FootballPlayer.php deleted file mode 100644 index 819b885fb..000000000 --- a/tests_old/models/ValidatorTest_FootballPlayer.php +++ /dev/null @@ -1,8 +0,0 @@ -setColumn('person_id', 'string', 255); - $class->setColumn('team_name', 'string', 255); - $class->setColumn('goals_count', 'integer', 4); - } -} diff --git a/tests_old/models/ValidatorTest_Person.php b/tests_old/models/ValidatorTest_Person.php deleted file mode 100644 index 5991beb51..000000000 --- a/tests_old/models/ValidatorTest_Person.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('identifier', 'integer', 4, - array('validators' => array('notblank', 'unique'))); - $class->setColumn('is_football_player', 'boolean'); - $class->hasOne('ValidatorTest_FootballPlayer', - array('local' => 'id', 'foreign' => 'person_id')); - } -} diff --git a/tests_old/models/VersioningTest.php b/tests_old/models/VersioningTest.php deleted file mode 100644 index 66fd9610d..000000000 --- a/tests_old/models/VersioningTest.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('name', 'string'); - $class->setColumn('version', 'integer'); - $class->actAs('Versionable'); - } -} diff --git a/tests_old/models/ZeroValueTest.php b/tests_old/models/ZeroValueTest.php deleted file mode 100644 index bef72b7a8..000000000 --- a/tests_old/models/ZeroValueTest.php +++ /dev/null @@ -1,16 +0,0 @@ -setColumn('id', 'integer', 4, array('primary' => true, 'autoincrement' => true,)); - $class->setColumn('username', 'string', 128, array('notnull' => true,)); - $class->setColumn('algorithm', 'string', 128, array('default' => 'sha1', 'notnull' => true,)); - $class->setColumn('salt', 'string', 128, array('notnull' => true,)); - $class->setColumn('password', 'string', 128, array('notnull' => true,)); - $class->setColumn('created_at', 'timestamp', null, array()); - $class->setColumn('last_login', 'timestamp', null, array()); - $class->setColumn('is_active', 'boolean', null, array('default' => true, 'notnull' => true,)); - $class->setColumn('is_super_admin', 'boolean', null, array('default' => false, 'notnull' => true,)); - } -} diff --git a/tests_old/models/export/Cms_Category.php b/tests_old/models/export/Cms_Category.php deleted file mode 100644 index 61a3140cb..000000000 --- a/tests_old/models/export/Cms_Category.php +++ /dev/null @@ -1,18 +0,0 @@ -setColumn('created', 'timestamp'); - $class->setColumn('parent', 'integer', 11); - $class->setColumn('position', 'integer', 3); - $class->setColumn('active', 'integer', 11); - $class->setTableOption('collate', 'utf8_unicode_ci'); - $class->setTableOption('charset', 'utf8'); - $class->setTableOption('type', 'INNODB'); - $class->addIndex('index_parent', array('fields' => array('parent'))); - - $class->hasMany('Cms_CategoryLanguages as langs', array('local' => 'id', 'foreign' => 'category_id')); - } -} diff --git a/tests_old/models/export/Cms_CategoryLanguages.php b/tests_old/models/export/Cms_CategoryLanguages.php deleted file mode 100644 index a42e49681..000000000 --- a/tests_old/models/export/Cms_CategoryLanguages.php +++ /dev/null @@ -1,18 +0,0 @@ -setColumn('name', 'string',256); - $class->setColumn('category_id', 'integer',11); - $class->setColumn('language_id', 'integer',11); - $class->setTableOption('collate', 'utf8_unicode_ci'); - $class->setTableOption('charset', 'utf8'); - $class->setTableOption('type', 'INNODB'); - $class->addIndex('index_category', array('fields' => array('category_id'))); - $class->addIndex('index_language', array('fields' => array('language_id'))); - - $class->setAttribute(Doctrine::ATTR_COLL_KEY, 'language_id'); - $class->hasOne('Cms_Category as category', array('local' => 'category_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - } -} diff --git a/tests_old/models/gnatEmail.php b/tests_old/models/gnatEmail.php deleted file mode 100644 index d3ef6d7c6..000000000 --- a/tests_old/models/gnatEmail.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('address', 'string', 150); - } - - -} diff --git a/tests_old/models/gnatUser.php b/tests_old/models/gnatUser.php deleted file mode 100644 index 26e878e84..000000000 --- a/tests_old/models/gnatUser.php +++ /dev/null @@ -1,13 +0,0 @@ -setColumn('name', 'string', 150); - $class->setColumn('foreign_id', 'integer', 10, array ('unique' => true)); - $class->hasOne('gnatEmail as Email', array('local'=> 'foreign_id', 'foreign'=>'id', 'onDelete'=>'CASCADE')); - } -} - diff --git a/tests_old/models/mmrGroupUser_B.php b/tests_old/models/mmrGroupUser_B.php deleted file mode 100644 index 47fd231d2..000000000 --- a/tests_old/models/mmrGroupUser_B.php +++ /dev/null @@ -1,9 +0,0 @@ -setColumn('user_id', 'string', 30, array('primary' => true)); - $class->setColumn('group_id', 'string', 30, array('primary' => true)); - } -} diff --git a/tests_old/models/mmrGroupUser_C.php b/tests_old/models/mmrGroupUser_C.php deleted file mode 100644 index f9399f752..000000000 --- a/tests_old/models/mmrGroupUser_C.php +++ /dev/null @@ -1,10 +0,0 @@ -setColumn('user_id', 'string', 30, array('primary' => true)); - $class->setColumn('group_id', 'string', 30, array('primary' => true)); - } -} diff --git a/tests_old/models/mmrGroup_B.php b/tests_old/models/mmrGroup_B.php deleted file mode 100644 index 329f072f0..000000000 --- a/tests_old/models/mmrGroup_B.php +++ /dev/null @@ -1,14 +0,0 @@ -hasMany('mmrUser_B', array('local' => 'group_id', - 'foreign' => 'user_id', - 'refClass' => 'mmrGroupUser_B')); - } - public function setTableDefinition() { - // Works when - $this->hasColumn('id', 'string', 30, array ( 'primary' => true)); - $this->hasColumn('name', 'string', 30); - } -} diff --git a/tests_old/models/mmrGroup_C.php b/tests_old/models/mmrGroup_C.php deleted file mode 100644 index 04852d9e6..000000000 --- a/tests_old/models/mmrGroup_C.php +++ /dev/null @@ -1,12 +0,0 @@ -setColumn('g_id as id', 'string', 30, array('primary' => true)); - $class->setColumn('name', 'string', 30); - $class->hasMany('mmrUser_C', array('local' => 'group_id', - 'foreign' => 'user_id', - 'refClass' => 'mmrGroupUser_C')); - } -} diff --git a/tests_old/models/mmrUser_B.php b/tests_old/models/mmrUser_B.php deleted file mode 100644 index 597abbd59..000000000 --- a/tests_old/models/mmrUser_B.php +++ /dev/null @@ -1,18 +0,0 @@ -hasMany('mmrGroup_B as Group', array('local' => 'user_id', - 'foreign' => 'group_id', - 'refClass' => 'mmrGroupUser_B')); - - } - - public function setTableDefinition() - { - // Works when - $this->hasColumn('id', 'string', 30, array ( 'primary' => true)); - $this->hasColumn('name', 'string', 30); - } -} diff --git a/tests_old/models/mmrUser_C.php b/tests_old/models/mmrUser_C.php deleted file mode 100644 index ef5db5970..000000000 --- a/tests_old/models/mmrUser_C.php +++ /dev/null @@ -1,19 +0,0 @@ -hasMany('mmrGroup_C as Group', array('local' => 'user_id', - 'foreign' => 'group_id', - 'refClass' => 'mmrGroupUser_C')); - - } - - public function setTableDefinition() - { - // Works when - $this->hasColumn('u_id as id', 'string', 30, array('primary' => true)); - $this->hasColumn('name', 'string', 30); - } -} - diff --git a/tests_old/mysql_migration_classes/001_mysql_add_table.php b/tests_old/mysql_migration_classes/001_mysql_add_table.php deleted file mode 100644 index 88b81e717..000000000 --- a/tests_old/mysql_migration_classes/001_mysql_add_table.php +++ /dev/null @@ -1,14 +0,0 @@ -createTable('migration_test', array('field1' => array('type' => 'string'))); - $this->addColumn('migration_test', 'field2', 'integer'); - } - - public function down() - { - $this->dropTable('migration_test'); - } -} \ No newline at end of file diff --git a/tests_old/mysql_migration_classes/002_mysql_change_column.php b/tests_old/mysql_migration_classes/002_mysql_change_column.php deleted file mode 100644 index 230d338ff..000000000 --- a/tests_old/mysql_migration_classes/002_mysql_change_column.php +++ /dev/null @@ -1,13 +0,0 @@ -renameColumn('migration_test','field2','field3'); - } - - public function down() - { - $this->renameColumn('migration_test','field3','field2'); - } -} \ No newline at end of file diff --git a/tests_old/run.php b/tests_old/run.php deleted file mode 100644 index a448ad0ac..000000000 --- a/tests_old/run.php +++ /dev/null @@ -1,312 +0,0 @@ -addTestCase(new Doctrine_Ticket_Njero_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_428_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_480_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_587_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_576_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_583_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_626B_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_626C_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_642_TestCase()); -//If you write a ticket testcase add it here like shown above! -$tickets->addTestCase(new Doctrine_Ticket_438_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_638_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_673_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_626D_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_697_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_912_TestCase()); -$test->addTestCase($tickets); - -// Connection drivers (not yet fully tested) -$driver = new GroupTest("Driver tests", 'driver'); -$driver->addTestCase(new Doctrine_Connection_Pgsql_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Oracle_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Sqlite_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Mssql_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Mysql_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Firebird_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Informix_TestCase()); -$test->addTestCase($driver); - -// Transaction module (FULLY TESTED) -$transaction = new GroupTest("Transaction tests", 'transaction'); -$transaction->addTestCase(new Doctrine_Transaction_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Firebird_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Informix_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Mysql_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Mssql_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Pgsql_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Oracle_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Sqlite_TestCase()); -$test->addTestCase($transaction); - -// DataDict module (FULLY TESTED) -$data_dict = new GroupTest('DataDict tests', 'data_dict'); -$data_dict->addTestCase(new Doctrine_DataDict_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Firebird_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Informix_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Mysql_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Mssql_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Pgsql_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Oracle_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Sqlite_TestCase()); -$test->addTestCase($data_dict); - -// Sequence module (not yet fully tested) -$sequence = new GroupTest('Sequence tests','sequence'); -$sequence->addTestCase(new Doctrine_Sequence_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Firebird_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Informix_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Mysql_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Mssql_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Pgsql_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Oracle_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Sqlite_TestCase()); -$test->addTestCase($sequence); - -// Export module (not yet fully tested) -$export = new GroupTest('Export tests','export'); -//$export->addTestCase(new Doctrine_Export_Reporter_TestCase()); -$export->addTestCase(new Doctrine_Export_Firebird_TestCase()); -$export->addTestCase(new Doctrine_Export_Informix_TestCase()); -$export->addTestCase(new Doctrine_Export_TestCase()); -$export->addTestCase(new Doctrine_Export_Mssql_TestCase()); -$export->addTestCase(new Doctrine_Export_Pgsql_TestCase()); -$export->addTestCase(new Doctrine_Export_Oracle_TestCase()); -$export->addTestCase(new Doctrine_Export_Record_TestCase()); -$export->addTestCase(new Doctrine_Export_Mysql_TestCase()); -$export->addTestCase(new Doctrine_Export_Sqlite_TestCase()); -$test->addTestCase($export); - -//$test->addTestCase(new Doctrine_CascadingDelete_TestCase()); - -// Import module (not yet fully tested) -$import = new GroupTest('Import tests','import'); -//$import->addTestCase(new Doctrine_Import_TestCase()); -$import->addTestCase(new Doctrine_Import_Firebird_TestCase()); -$import->addTestCase(new Doctrine_Import_Informix_TestCase()); -$import->addTestCase(new Doctrine_Import_Mysql_TestCase()); -$import->addTestCase(new Doctrine_Import_Mssql_TestCase()); -$import->addTestCase(new Doctrine_Import_Pgsql_TestCase()); -$import->addTestCase(new Doctrine_Import_Oracle_TestCase()); -$import->addTestCase(new Doctrine_Import_Sqlite_TestCase()); -$test->addTestCase($import); - -// Expression module (not yet fully tested) -$expression = new GroupTest('Expression tests','expression'); -$expression->addTestCase(new Doctrine_Expression_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Driver_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Firebird_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Informix_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Mysql_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Mssql_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Pgsql_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Oracle_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Sqlite_TestCase()); -$test->addTestCase($expression); - -// Core -$core = new GroupTest('Core tests: Access, Configurable, Manager, Connection, Table, UnitOfWork, Collection, Hydrate, Tokenizer','core'); -$core->addTestCase(new Doctrine_Access_TestCase()); -//$core->addTestCase(new Doctrine_Configurable_TestCase()); -$core->addTestCase(new Doctrine_Manager_TestCase()); -$core->addTestCase(new Doctrine_Connection_TestCase()); -$core->addTestCase(new Doctrine_UnitOfWork_TestCase()); -//$core->addTestCase(new Doctrine_Collection_TestCase()); -$core->addTestCase(new Doctrine_Collection_Snapshot_TestCase()); -$core->addTestCase(new Doctrine_Hydrate_FetchMode_TestCase()); -$core->addTestCase(new Doctrine_Tokenizer_TestCase()); -//$core->addTestCase(new Doctrine_Collection_Offset_TestCase()); -//$core->addTestCase(new Doctrine_BatchIterator_TestCase()); -$core->addTestCase(new Doctrine_Hydrate_TestCase()); -$test->addTestCase($core); - -// Relation handling -$relation = new GroupTest('Relation tests: includes TreeStructure','relation'); -$relation->addTestCase(new Doctrine_TreeStructure_TestCase()); -$relation->addTestCase(new Doctrine_Relation_TestCase()); -//$relation->addTestCase(new Doctrine_Relation_Access_TestCase()); -//$relation->addTestCase(new Doctrine_Relation_ManyToMany_TestCase()); -$relation->addTestCase(new Doctrine_Relation_ManyToMany2_TestCase()); -$relation->addTestCase(new Doctrine_Relation_OneToMany_TestCase()); -$relation->addTestCase(new Doctrine_Relation_Nest_TestCase()); -$relation->addTestCase(new Doctrine_Relation_OneToOne_TestCase()); -$relation->addTestCase(new Doctrine_Relation_Parser_TestCase()); -$test->addTestCase($relation); - -// Datatypes -$data_types = new GroupTest('DataTypes tests: Enum and Boolean','data_types'); -$data_types->addTestCase(new Doctrine_DataType_Enum_TestCase()); -$data_types->addTestCase(new Doctrine_DataType_Boolean_TestCase()); -$test->addTestCase($data_types); - -// Utility components -$plugins = new GroupTest('Plugin tests: View, Validator, Hook', 'plugins'); -//$plugins->addTestCase(new Doctrine_PessimisticLocking_TestCase()); -//$plugins->addTestCase(new Doctrine_Plugin_TestCase()); -$plugins->addTestCase(new Doctrine_View_TestCase()); -//$plugins->addTestCase(new Doctrine_AuditLog_TestCase()); -$plugins->addTestCase(new Doctrine_Validator_TestCase()); -$plugins->addTestCase(new Doctrine_Validator_Future_TestCase()); -$plugins->addTestCase(new Doctrine_Validator_Past_TestCase()); -$plugins->addTestCase(new Doctrine_Hook_TestCase()); -//$plugins->addTestCase(new Doctrine_I18n_TestCase()); -$test->addTestCase($plugins); - -// Db component -$db = new GroupTest('Db tests: Db and Profiler','db'); -$db->addTestCase(new Doctrine_Db_TestCase()); -$db->addTestCase(new Doctrine_Connection_Profiler_TestCase()); -$test->addTestCase($db); - -// Eventlisteners -$event_listener = new GroupTest('EventListener tests','event_listener'); -$event_listener->addTestCase(new Doctrine_EventListener_TestCase()); -$event_listener->addTestCase(new Doctrine_EventListener_Chain_TestCase()); -$test->addTestCase($event_listener); - -// Query tests -$query_tests = new GroupTest('Query tests','query_test'); -## The following tests seem to influence each other when the whole suite is run... -$query_tests->addTestCase(new Doctrine_Query_JoinCondition2_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Select_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MultipleAggregateValue_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_AggregateValue_TestCase()); -## - -# Passes with filter=query or filter=query_referencemodel but fail when running the -# whole suite ... -$query_tests->addTestCase(new Doctrine_Query_ReferenceModel_TestCase()); -# - -$query_tests->addTestCase(new Doctrine_Query_Condition_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MultiJoin_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MultiJoin2_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_ComponentAlias_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_ShortAliases_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Expression_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_OneToOneFetching_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Check_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Limit_TestCase()); -//$query_tests->addTestCase(new Doctrine_Query_IdentifierQuoting_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Update_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Delete_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Join_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Having_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Orderby_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Subquery_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Driver_TestCase()); -$query_tests->addTestCase(new Doctrine_Record_Hook_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Where_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_From_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_JoinCondition_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MysqlSubquery_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_PgsqlSubquery_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MysqlSubqueryHaving_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_SelectExpression_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Registry_TestCase()); -$test->addTestCase($query_tests); - -// Record -$record = new GroupTest('Record tests','record'); -$record->addTestCase(new Doctrine_Record_Filter_TestCase()); -$record->addTestCase(new Doctrine_Record_TestCase()); -$record->addTestCase(new Doctrine_Record_State_TestCase()); -$record->addTestCase(new Doctrine_Record_SerializeUnserialize_TestCase()); -// This test used to segfault php because of infinite recursion in Connection/UnitOfWork -$record->addTestCase(new Doctrine_Record_Lock_TestCase()); -$record->addTestCase(new Doctrine_Record_ZeroValues_TestCase()); -//$record->addTestCase(new Doctrine_Record_SaveBlankRecord_TestCase()); -$record->addTestCase(new Doctrine_Record_Inheritance_TestCase()); -$record->addTestCase(new Doctrine_Record_Synchronize_TestCase()); -$test->addTestCase($record); - -$test->addTestCase(new Doctrine_CustomPrimaryKey_TestCase()); -$test->addTestCase(new Doctrine_CustomResultSetOrder_TestCase()); - -//$test->addTestCase(new Doctrine_CtiColumnAggregation_TestCase()); -$test->addTestCase(new Doctrine_ColumnAggregationInheritance_TestCase()); -//$test->addTestCase(new Doctrine_ClassTableInheritance_TestCase()); -$test->addTestCase(new Doctrine_ColumnAlias_TestCase()); - -$test->addTestCase(new Doctrine_RawSql_TestCase()); - -$test->addTestCase(new Doctrine_NewCore_TestCase()); - -//$test->addTestCase(new Doctrine_Template_TestCase()); - -//$test->addTestCase(new Doctrine_Import_Builder_TestCase()); - -// Inheritance mapping tests -$test->addTestCase(new Doctrine_Inheritance_SingleTable_TestCase()); -$test->addTestCase(new Doctrine_Inheritance_Joined_TestCase()); -$test->addTestCase(new Doctrine_Inheritance_TablePerClass_TestCase()); - -// Metadata loading tests -$test->addTestCase(new Doctrine_Metadata_Factory_TestCase()); - -// nestedset tests -//$test->addTestCase(new Doctrine_NestedSet_SingleRoot_TestCase()); -//$test->addTestCase(new Doctrine_NestedSet_LoadInSetUp_TestCase()); - -// Search tests -$search = new GroupTest('Search tests','search'); -//$search->addTestCase(new Doctrine_Search_TestCase()); -//$search->addTestCase(new Doctrine_Search_Query_TestCase()); -//$search->addTestCase(new Doctrine_Search_File_TestCase()); - -$test->addTestCase($search); - -// Cache tests -$cache = new GroupTest('Cache tests','cache'); -$cache->addTestCase(new Doctrine_Query_Cache_TestCase()); -$cache->addTestCase(new Doctrine_Cache_Apc_TestCase()); -//$cache->addTestCase(new Doctrine_Cache_Memcache_TestCase()); -//$cache->addTestCase(new Doctrine_Cache_Sqlite_TestCase()); -//$cache->addTestCase(new Doctrine_Cache_Query_SqliteTestCase()); -//$cache->addTestCase(new Doctrine_Cache_FileTestCase()); -//$cache->addTestCase(new Doctrine_Cache_SqliteTestCase()); -//$cache->addTestCase(new Doctrine_Cache_TestCase()); -$test->addTestCase($cache); - -// Migration Tests -$migration = new GroupTest('Migration tests','migration'); -//$migration->addTestCase(new Doctrine_Migration_TestCase()); -//$migration->addTestCase(new Doctrine_Migration_Mysql_TestCase()); -$test->addTestCase($migration); - -$test->addTestCase(new Doctrine_Query_ApplyInheritance_TestCase()); - -$parser = new GroupTest('Parser tests', 'parser'); -$parser->addTestCase(new Doctrine_Parser_TestCase()); -$test->addTestCase($parser); - -$schemaFiles = new GroupTest('Schema files', 'schema_files'); -$schemaFiles->addTestCase(new Doctrine_Import_Schema_TestCase()); -$schemaFiles->addTestCase(new Doctrine_Export_Schema_TestCase()); -$test->addTestCase($schemaFiles); - -$data = new GroupTest('Data exporting/importing fixtures', 'data_fixtures'); -$data->addTestCase(new Doctrine_Data_Import_TestCase()); -$data->addTestCase(new Doctrine_Data_Export_TestCase()); -$test->addTestCase($data); - -$s = microtime(true); -$test->run(); -$e = microtime(true); - -echo 'test run took: ' . ($e - $s) . ' seconds
    '; -echo "peak memory usage: " . memory_get_peak_usage() / 1024 . "KB\n"; diff --git a/tests_old/schema.xml b/tests_old/schema.xml deleted file mode 100755 index b55374623..000000000 --- a/tests_old/schema.xml +++ /dev/null @@ -1,2 +0,0 @@ - -accountAccountinteger2011idinteger2147483647entity_idinteger2147483647amount
    addressAddressinteger2011id
    string200address
    EntityAddressaddress_iduser_idmanyidaddress_idmany
    albumAlbuminteger2011idinteger2147483647user_idstring20nameidalbum_idmanyuser_ididoneassignmentAssignmentinteger2011idinteger2147483647task_idinteger2147483647resource_idresource_ididonetask_ididonedescriptionDescriptioninteger2011idstring3000descriptionstring32file_md5elementElementinteger2011idstring100nameinteger2147483647parent_idElementidparent_idmanyElementparent_ididoneemailEmailinteger2011id
    11string150address
    entityEntity11integer20idstring50name1string20loginnamestring16passwordinteger1typeinteger11createdinteger11updatedinteger2147483647email_idemail_ididoneidentity_idmanyidentity_idoneEntityReferenceentity1entity2manyidentity1manyentity_addressEntityAddress1integer2147483647user_id1integer2147483647address_id
    address_ididone
    user_ididone
    entity_referenceEntityReference1integer2147483647entity11integer2147483647entity2entity1idoneentity1idoneentity1idoneerrorErrorstring200messageinteger11code1string32file_md5file_md5file_md5oneentityGroup11integer20idstring50name1string20loginnamestring16passwordinteger1typeinteger11createdinteger11updatedinteger2147483647email_idemail_ididoneidentity_idmanyidentity_idoneEntityReferenceentity1entity2manyGroupusergroup_iduser_idmanyidentity1manyidgroup_idmanygroupuserGroupuserinteger2011idinteger2147483647addedinteger2147483647group_idinteger2147483647user_idgroup_ididoneuser_ididonephonenumberPhonenumberinteger2011idstring20phonenumberinteger2147483647entity_identity_ididoneentity_ididoneentity_ididoneresource_referenceResourceReferenceinteger2011idinteger2147483647type_idinteger2147483647resource_idresource_ididoneresourcetype_ididoneresourceResourceinteger2011idstring100nameAssignmentTaskresource_idtask_idmanyResourceReferenceResourceTyperesource_idtype_idmanyidresource_idmanyidresource_idmanyresource_typeResourceTypeinteger2011idstring100typeResourceReferenceResourceresourcetype_idresource_idmanyidresourcetype_idmanysongSonginteger2011idinteger2147483647album_idstring20genre<type>string</type><length>30</length><name>title</name>album_ididonetaskTaskinteger2011idstring100nameinteger2147483647parent_idAssignmentResourcetask_idresource_idmanyTaskidparent_idmanyidtask_idmanyentityUser11integer20idstring50name1string20loginnamestring16passwordinteger1typeinteger11createdinteger11updatedinteger2147483647email_idemail_ididoneidentity_idmanyidentity_idoneEntityReferenceentity1entity2many
    EntityAddressuser_idaddress_idmany
    EntityAddressAddressuser_idaddress_idmanyiduser_idmanyiduser_idmanyGroupuseruser_idgroup_idmanyidentity1manyiduser_idmanyiduser_idmany
    diff --git a/tests_old/schema.yml b/tests_old/schema.yml deleted file mode 100644 index 375203518..000000000 --- a/tests_old/schema.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- -User: - actAs: [Timestampable] - columns: - id: - type: integer(4) - primary: true - autoincrement: true - username: - type: string(255) - password: - type: string(255) -Profile: - actAs: [Timestampable] - columns: - id: - type: integer(4) - primary: true - autoincrement: true - user_id: - type: integer(4) - contact_id: - type: integer(4) - first_name: - type: string(255) - last_name: - type: string(255) - relations: - User: - foreignType: one - Contact: - foreignType: one -Contact: - actAs: [Timestampable] - columns: - id: - type: integer(4) - primary: true - autoincrement: true - name: - type: string(255) -Phonenumber: - actAs: [Timestampable] - columns: - id: - type: integer(4) - primary: true - autoincrement: true - contact_id: - type: integer(4) - phone_number: - type: integer(4) - relations: - Contact: - foreignAlias: Phonenumbers \ No newline at end of file diff --git a/tests_old/template.tpl b/tests_old/template.tpl deleted file mode 100644 index 8eda37e69..000000000 --- a/tests_old/template.tpl +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -/** - * %s - * - * @package Doctrine - * @author Konsta Vesterinen - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - */ -class %s extends Doctrine_UnitTestCase -{ -} diff --git a/tests_old/unsolved.php b/tests_old/unsolved.php deleted file mode 100644 index a94668ac9..000000000 --- a/tests_old/unsolved.php +++ /dev/null @@ -1,38 +0,0 @@ -"; - -$manager = Doctrine_Manager::getInstance(); -$dbh = Doctrine_Db::getConnection('sqlite::memory:'); -$conn = $manager->openConnection($dbh); -/** -$user = new User(); -$user->name = 'zYne'; -$user->Phonenumber[0]->phonenumber = '123 123'; -if ($user === $user->Phonenumber[0]->entity_id) { - print 'case 1 works\n'; -} -$city = new Record_City(); -$city->name = 'City 1'; -$city->District->name = 'District 1'; - -if ($city->District === $city->district_id) { - print 'case 2 works\n'; -} -*/ - -$c = new Record_Country(); -$c->name = 'Some country'; -$city = $c->City[0]; -$city->name = 'City 1'; -$city->District->name = 'District 1'; - -$c->save(); diff --git a/tools/Bot.php b/tools/Bot.php deleted file mode 100644 index bbbad0023..000000000 --- a/tools/Bot.php +++ /dev/null @@ -1,154 +0,0 @@ - 'irc.freenode.net', - 'port' => 6667, - 'username' => 'Doctrine', - 'hostname' => 'phpdoctrine.net', - 'servername' => 'Doctrine', - 'realname' => 'Doctrine bot', - 'nick' => 'Doctrine', - 'channels' => array('#doctrine-test')); - - protected $_socket; - - - public function connect() - { - // Open the socket to the IRC server - $this->_socket = fsockopen($this->_options['server'], $this->_options['port']); - - unlink('log.txt'); - - sleep(1); - - Doctrine_Manager::connection('sqlite::memory:'); - - - // Send auth info - $this->execute('USER ' . $this->_options['username'] . ' ' . - $this->_options['hostname'] . ' ' . - $this->_options['servername'] . ' :' . - $this->_options['realname'] . "\n"); - - $this->execute('NICK ' . $this->_options['nick'] . "\n"); - - foreach ($this->_options['channels'] as $channel) { - $this->execute('JOIN ' . $channel . "\n"); - } - } - public function execute($command) - { - fputs($this->_socket, $command); - - $this->log('>>> ' . $command); - } - public function log($command) - { - $fp = fopen('log.txt', 'a+'); - - fwrite($fp, $command); - - fclose($fp); - } - public function disconnect() - { - $this->execute('QUIT' . "\n"); - - fclose($this->_socket); - } - // IRC Functions [BEGIN] - - // Joins channel - public function join($channel) - { - $this->execute('JOIN ' . $channel . "\r\n"); - } - - // Leaves the channel - public function part($channel){ - $this->execute('PART ' . $channel . "\r\n"); - } - - // send message to channel/user - public function say($to, $msg){ - $this->execute('PRIVMSG '. $to . ' :' . $msg . "\r\n"); - } - - // modes: +o, -o, +v, -v, etc. - public function setMode($user, $mode){ - $this->execute('MODE ' . $this->channel . ' ' . $mode . ' ' . $user . "\r\n"); - } - // kicks user from the channel - public function kick($user, $from, $reason = "") - { - $this->execute('KICK ' . $from . ' ' . $user . ' :' . $reason . "\r\n"); - } - // changes the channel topic - public function topic($channel, $topic) - { - $this->execute('TOPIC ' . $channel . ' :' . $topic . "\r\n"); - } - public function run() - { - $this->connect(); - // Force an endless while - - while( ! feof($this->_socket)) { - - // Continue the rest of the script here - $data = fgets($this->_socket, 4096); - - print $data . "
    "; - // Separate all data - $ex = explode(' ', $data); - - // Send PONG back to the server - if ($ex[0] == 'PING') { - $this->execute('PONG ' . $ex[1] . "\n"); - } - //$this->log($data); - - // Say something in the channel - $command = str_replace(array(chr(10), chr(13)), '', $ex[3]); - - // strip out ':' - $command = substr($command, 1); - - array_shift($ex); - array_shift($ex); - $scope = array_shift($ex); - array_shift($ex); - - $argsStr = implode(' ', $ex); - - - //$this->log($command . ' ' . $scope); - - switch ($command) { - case '!shutdown': - $this->disconnect(); - exit; - break; - case '!native-expr': - $portableExpr = $ex[0]; - - break; - } - } - - } -} -$bot = new Dbot(); -$bot->run(); diff --git a/tools/sandbox/config.php b/tools/sandbox/config.php deleted file mode 100644 index 3fe811275..000000000 --- a/tools/sandbox/config.php +++ /dev/null @@ -1,55 +0,0 @@ -. - */ - -/** - * Doctrine Configuration File - * - * This is a sample implementation of Doctrine - * - * @package Doctrine - * @subpackage Config - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision: 2753 $ - * @author Konsta Vesterinen - * @author Jonathan H. Wage - */ - -define('SANDBOX_PATH', dirname(__FILE__)); -define('DOCTRINE_PATH', dirname(dirname(SANDBOX_PATH)) . DIRECTORY_SEPARATOR . 'lib'); -define('DATA_FIXTURES_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'fixtures'); -define('MODELS_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'models'); -define('MIGRATIONS_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'migrations'); -define('SQL_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'sql'); -define('YAML_SCHEMA_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'schema'); -define('DB_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'sandbox.db'); -define('DSN', 'sqlite:///' . DB_PATH); - -require_once(DOCTRINE_PATH . DIRECTORY_SEPARATOR . 'Doctrine.php'); - -spl_autoload_register(array('Doctrine', 'autoload')); - -Doctrine_Manager::connection(DSN, 'sandbox'); - -Doctrine_Manager::getInstance()->setAttribute('model_loading', 'conservative'); - -Doctrine::loadModels('models'); \ No newline at end of file diff --git a/tools/sandbox/doctrine b/tools/sandbox/doctrine deleted file mode 100755 index 8edb14848..000000000 --- a/tools/sandbox/doctrine +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env php -setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE); - -// Configure Doctrine Cli -// Normally these are arguments to the cli tasks but if they are set here the arguments will be auto-filled -$config = array('data_fixtures_path' => DATA_FIXTURES_PATH, - 'models_path' => MODELS_PATH, - 'migrations_path' => MIGRATIONS_PATH, - 'sql_path' => SQL_PATH, - 'yaml_schema_path' => YAML_SCHEMA_PATH); - -$cli = new Doctrine_Cli($config); -$cli->run($_SERVER['argv']); \ No newline at end of file diff --git a/tools/sandbox/index.php.dist b/tools/sandbox/index.php.dist deleted file mode 100644 index 2af5fa0c0..000000000 --- a/tools/sandbox/index.php.dist +++ /dev/null @@ -1,2 +0,0 @@ - - * @author Stig Bakken - * @author Tomas V.V.Cox - * @author Greg Beaver - * @copyright 1997-2006 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: PEAR.php,v 1.101 2006/04/25 02:41:03 cellog Exp $ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/**#@+ - * ERROR constants - */ -define('PEAR_ERROR_RETURN', 1); -define('PEAR_ERROR_PRINT', 2); -define('PEAR_ERROR_TRIGGER', 4); -define('PEAR_ERROR_DIE', 8); -define('PEAR_ERROR_CALLBACK', 16); -/** - * WARNING: obsolete - * @deprecated - */ -define('PEAR_ERROR_EXCEPTION', 32); -/**#@-*/ -define('PEAR_ZE2', (function_exists('version_compare') && - version_compare(zend_version(), "2-dev", "ge"))); - -if (substr(PHP_OS, 0, 3) == 'WIN') { - define('OS_WINDOWS', true); - define('OS_UNIX', false); - define('PEAR_OS', 'Windows'); -} else { - define('OS_WINDOWS', false); - define('OS_UNIX', true); - define('PEAR_OS', 'Unix'); // blatant assumption -} - -// instant backwards compatibility -if ( ! defined('PATH_SEPARATOR')) { - if (OS_WINDOWS) { - define('PATH_SEPARATOR', ';'); - } else { - define('PATH_SEPARATOR', ':'); - } -} - -$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; -$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; -$GLOBALS['_PEAR_destructor_object_list'] = array(); -$GLOBALS['_PEAR_shutdown_funcs'] = array(); -$GLOBALS['_PEAR_error_handler_stack'] = array(); - -@ini_set('track_errors', true); - -/** - * Base class for other PEAR classes. Provides rudimentary - * emulation of destructors. - * - * If you want a destructor in your class, inherit PEAR and make a - * destructor method called _yourclassname (same name as the - * constructor, but with a "_" prefix). Also, in your constructor you - * have to call the PEAR constructor: $this->PEAR();. - * The destructor method will be called without parameters. Note that - * at in some SAPI implementations (such as Apache), any output during - * the request shutdown (in which destructors are called) seems to be - * discarded. If you need to get any debug information from your - * destructor, use error_log(), syslog() or something similar. - * - * IMPORTANT! To use the emulated destructors you need to create the - * objects by reference: $obj =& new PEAR_child; - * - * @category pear - * @package PEAR - * @author Stig Bakken - * @author Tomas V.V. Cox - * @author Greg Beaver - * @copyright 1997-2006 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.5.0 - * @link http://pear.php.net/package/PEAR - * @see PEAR_Error - * @since Class available since PHP 4.0.2 - * @link http://pear.php.net/manual/en/core.pear.php#core.pear.pear - */ -class PEAR -{ - // {{{ properties - - /** - * Whether to enable internal debug messages. - * - * @var bool - * @access private - */ - var $_debug = false; - - /** - * Default error mode for this object. - * - * @var int - * @access private - */ - var $_default_error_mode = null; - - /** - * Default error options used for this object when error mode - * is PEAR_ERROR_TRIGGER. - * - * @var int - * @access private - */ - var $_default_error_options = null; - - /** - * Default error handler (callback) for this object, if error mode is - * PEAR_ERROR_CALLBACK. - * - * @var string - * @access private - */ - var $_default_error_handler = ''; - - /** - * Which class to use for error objects. - * - * @var string - * @access private - */ - var $_error_class = 'PEAR_Error'; - - /** - * An array of expected errors. - * - * @var array - * @access private - */ - var $_expected_errors = array(); - - // }}} - - // {{{ constructor - - /** - * Constructor. Registers this object in - * $_PEAR_destructor_object_list for destructor emulation if a - * destructor object exists. - * - * @param string $error_class (optional) which class to use for - * error objects, defaults to PEAR_Error. - * @access public - * @return void - */ - function PEAR($error_class = null) - { - $classname = strtolower(get_class($this)); - if ($this->_debug) { - print "PEAR constructor called, class=$classname\n"; - } - if ($error_class !== null) { - $this->_error_class = $error_class; - } - while ($classname && strcasecmp($classname, "pear")) { - $destructor = "_$classname"; - if (method_exists($this, $destructor)) { - global $_PEAR_destructor_object_list; - $_PEAR_destructor_object_list[] = &$this; - if ( ! isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { - register_shutdown_function("_PEAR_call_destructors"); - $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; - } - break; - } else { - $classname = get_parent_class($classname); - } - } - } - - // }}} - // {{{ destructor - - /** - * Destructor (the emulated type of...). Does nothing right now, - * but is included for forward compatibility, so subclass - * destructors should always call it. - * - * See the note in the class desciption about output from - * destructors. - * - * @access public - * @return void - */ - function _PEAR() { - if ($this->_debug) { - printf("PEAR destructor called, class=%s\n", strtolower(get_class($this))); - } - } - - // }}} - // {{{ getStaticProperty() - - /** - * If you have a class that's mostly/entirely static, and you need static - * properties, you can use this method to simulate them. Eg. in your method(s) - * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); - * You MUST use a reference, or they will not persist! - * - * @access public - * @param string $class The calling classname, to prevent clashes - * @param string $var The variable to retrieve. - * @return mixed A reference to the variable. If not set it will be - * auto initialised to NULL. - */ - function &getStaticProperty($class, $var) - { - static $properties; - if ( ! isset($properties[$class])) { - $properties[$class] = array(); - } - if ( ! array_key_exists($var, $properties[$class])) { - $properties[$class][$var] = null; - } - return $properties[$class][$var]; - } - - // }}} - // {{{ registerShutdownFunc() - - /** - * Use this function to register a shutdown method for static - * classes. - * - * @access public - * @param mixed $func The function name (or array of class/method) to call - * @param mixed $args The arguments to pass to the function - * @return void - */ - function registerShutdownFunc($func, $args = array()) - { - // if we are called statically, there is a potential - // that no shutdown func is registered. Bug #6445 - if ( ! isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { - register_shutdown_function("_PEAR_call_destructors"); - $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; - } - $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); - } - - // }}} - // {{{ isError() - - /** - * Tell whether a value is a PEAR error. - * - * @param mixed $data the value to test - * @param int $code if $data is an error object, return true - * only if $code is a string and - * $obj->getMessage() == $code or - * $code is an integer and $obj->getCode() == $code - * @access public - * @return bool true if parameter is an error - */ - function isError($data, $code = null) - { - if (is_a($data, 'PEAR_Error')) { - if (is_null($code)) { - return true; - } elseif (is_string($code)) { - return $data->getMessage() == $code; - } else { - return $data->getCode() == $code; - } - } - return false; - } - - // }}} - // {{{ setErrorHandling() - - /** - * Sets how errors generated by this object should be handled. - * Can be invoked both in objects and statically. If called - * statically, setErrorHandling sets the default behaviour for all - * PEAR objects. If called in an object, setErrorHandling sets - * the default behaviour for that object. - * - * @param int $mode - * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, - * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, - * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION. - * - * @param mixed $options - * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one - * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). - * - * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected - * to be the callback function or method. A callback - * function is a string with the name of the function, a - * callback method is an array of two elements: the element - * at index 0 is the object, and the element at index 1 is - * the name of the method to call in the object. - * - * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is - * a printf format string used when printing the error - * message. - * - * @access public - * @return void - * @see PEAR_ERROR_RETURN - * @see PEAR_ERROR_PRINT - * @see PEAR_ERROR_TRIGGER - * @see PEAR_ERROR_DIE - * @see PEAR_ERROR_CALLBACK - * @see PEAR_ERROR_EXCEPTION - * - * @since PHP 4.0.5 - */ - - function setErrorHandling($mode = null, $options = null) - { - if (isset($this) && is_a($this, 'PEAR')) { - $setmode = &$this->_default_error_mode; - $setoptions = &$this->_default_error_options; - } else { - $setmode = &$GLOBALS['_PEAR_default_error_mode']; - $setoptions = &$GLOBALS['_PEAR_default_error_options']; - } - - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $setmode = $mode; - $setoptions = $options; - break; - - case PEAR_ERROR_CALLBACK: - $setmode = $mode; - // class/object method callback - if (is_callable($options)) { - $setoptions = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - } - - // }}} - // {{{ expectError() - - /** - * This method is used to tell which errors you expect to get. - * Expected errors are always returned with error mode - * PEAR_ERROR_RETURN. Expected error codes are stored in a stack, - * and this method pushes a new element onto it. The list of - * expected errors are in effect until they are popped off the - * stack with the popExpect() method. - * - * Note that this method can not be called statically - * - * @param mixed $code a single error code or an array of error codes to expect - * - * @return int the new depth of the "expected errors" stack - * @access public - */ - function expectError($code = '*') - { - if (is_array($code)) { - array_push($this->_expected_errors, $code); - } else { - array_push($this->_expected_errors, array($code)); - } - return sizeof($this->_expected_errors); - } - - // }}} - // {{{ popExpect() - - /** - * This method pops one element off the expected error codes - * stack. - * - * @return array the list of error codes that were popped - */ - function popExpect() - { - return array_pop($this->_expected_errors); - } - - // }}} - // {{{ _checkDelExpect() - - /** - * This method checks unsets an error code if available - * - * @param mixed error code - * @return bool true if the error code was unset, false otherwise - * @access private - * @since PHP 4.3.0 - */ - function _checkDelExpect($error_code) - { - $deleted = false; - - foreach ($this->_expected_errors AS $key => $error_array) { - if (in_array($error_code, $error_array)) { - unset($this->_expected_errors[$key][array_search($error_code, $error_array)]); - $deleted = true; - } - - // clean up empty arrays - if (0 == count($this->_expected_errors[$key])) { - unset($this->_expected_errors[$key]); - } - } - return $deleted; - } - - // }}} - // {{{ delExpect() - - /** - * This method deletes all occurences of the specified element from - * the expected error codes stack. - * - * @param mixed $error_code error code that should be deleted - * @return mixed list of error codes that were deleted or error - * @access public - * @since PHP 4.3.0 - */ - function delExpect($error_code) - { - $deleted = false; - - if ((is_array($error_code) && (0 != count($error_code)))) { - // $error_code is a non-empty array here; - // we walk through it trying to unset all - // values - foreach($error_code as $key => $error) { - if ($this->_checkDelExpect($error)) { - $deleted = true; - } else { - $deleted = false; - } - } - return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME - } elseif ( ! empty($error_code)) { - // $error_code comes alone, trying to unset it - if ($this->_checkDelExpect($error_code)) { - return true; - } else { - return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME - } - } else { - // $error_code is empty - return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME - } - } - - // }}} - // {{{ raiseError() - - /** - * This method is a wrapper that returns an instance of the - * configured error class with this object's default error - * handling applied. If the $mode and $options parameters are not - * specified, the object's defaults are used. - * - * @param mixed $message a text error message or a PEAR error object - * - * @param int $code a numeric error code (it is up to your class - * to define these if you want to use codes) - * - * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, - * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, - * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION. - * - * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter - * specifies the PHP-internal error level (one of - * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). - * If $mode is PEAR_ERROR_CALLBACK, this - * parameter specifies the callback function or - * method. In other error modes this parameter - * is ignored. - * - * @param string $userinfo If you need to pass along for example debug - * information, this parameter is meant for that. - * - * @param string $error_class The returned error object will be - * instantiated from this class, if specified. - * - * @param bool $skipmsg If true, raiseError will only pass error codes, - * the error message parameter will be dropped. - * - * @access public - * @return object a PEAR error object - * @see PEAR::setErrorHandling - * @since PHP 4.0.5 - */ - function &raiseError($message = null, - $code = null, - $mode = null, - $options = null, - $userinfo = null, - $error_class = null, - $skipmsg = false) - { - // The error is yet a PEAR error object - if (is_object($message)) { - $code = $message->getCode(); - $userinfo = $message->getUserInfo(); - $error_class = $message->getType(); - $message->error_message_prefix = ''; - $message = $message->getMessage(); - } - - if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) { - if ($exp[0] == "*" || - (is_int(reset($exp)) && in_array($code, $exp)) || - (is_string(reset($exp)) && in_array($message, $exp))) { - $mode = PEAR_ERROR_RETURN; - } - } - // No mode given, try global ones - if ($mode === null) { - // Class error handler - if (isset($this) && isset($this->_default_error_mode)) { - $mode = $this->_default_error_mode; - $options = $this->_default_error_options; - // Global error handler - } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) { - $mode = $GLOBALS['_PEAR_default_error_mode']; - $options = $GLOBALS['_PEAR_default_error_options']; - } - } - - if ($error_class !== null) { - $ec = $error_class; - } elseif (isset($this) && isset($this->_error_class)) { - $ec = $this->_error_class; - } else { - $ec = 'PEAR_Error'; - } - if ($skipmsg) { - $a = &new $ec($code, $mode, $options, $userinfo); - return $a; - } else { - $a = &new $ec($message, $code, $mode, $options, $userinfo); - return $a; - } - } - - // }}} - // {{{ throwError() - - /** - * Simpler form of raiseError with fewer options. In most cases - * message, code and userinfo are enough. - * - * @param string $message - * - */ - function &throwError($message = null, - $code = null, - $userinfo = null) - { - if (isset($this) && is_a($this, 'PEAR')) { - $a = &$this->raiseError($message, $code, null, null, $userinfo); - return $a; - } else { - $a = &PEAR::raiseError($message, $code, null, null, $userinfo); - return $a; - } - } - - // }}} - function staticPushErrorHandling($mode, $options = null) - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - $def_mode = &$GLOBALS['_PEAR_default_error_mode']; - $def_options = &$GLOBALS['_PEAR_default_error_options']; - $stack[] = array($def_mode, $def_options); - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $def_mode = $mode; - $def_options = $options; - break; - - case PEAR_ERROR_CALLBACK: - $def_mode = $mode; - // class/object method callback - if (is_callable($options)) { - $def_options = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - $stack[] = array($mode, $options); - return true; - } - - function staticPopErrorHandling() - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - $setmode = &$GLOBALS['_PEAR_default_error_mode']; - $setoptions = &$GLOBALS['_PEAR_default_error_options']; - array_pop($stack); - list($mode, $options) = $stack[sizeof($stack) - 1]; - array_pop($stack); - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $setmode = $mode; - $setoptions = $options; - break; - - case PEAR_ERROR_CALLBACK: - $setmode = $mode; - // class/object method callback - if (is_callable($options)) { - $setoptions = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - return true; - } - - // {{{ pushErrorHandling() - - /** - * Push a new error handler on top of the error handler options stack. With this - * you can easily override the actual error handler for some code and restore - * it later with popErrorHandling. - * - * @param mixed $mode (same as setErrorHandling) - * @param mixed $options (same as setErrorHandling) - * - * @return bool Always true - * - * @see PEAR::setErrorHandling - */ - function pushErrorHandling($mode, $options = null) - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - if (isset($this) && is_a($this, 'PEAR')) { - $def_mode = &$this->_default_error_mode; - $def_options = &$this->_default_error_options; - } else { - $def_mode = &$GLOBALS['_PEAR_default_error_mode']; - $def_options = &$GLOBALS['_PEAR_default_error_options']; - } - $stack[] = array($def_mode, $def_options); - - if (isset($this) && is_a($this, 'PEAR')) { - $this->setErrorHandling($mode, $options); - } else { - PEAR::setErrorHandling($mode, $options); - } - $stack[] = array($mode, $options); - return true; - } - - // }}} - // {{{ popErrorHandling() - - /** - * Pop the last error handler used - * - * @return bool Always true - * - * @see PEAR::pushErrorHandling - */ - function popErrorHandling() - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - array_pop($stack); - list($mode, $options) = $stack[sizeof($stack) - 1]; - array_pop($stack); - if (isset($this) && is_a($this, 'PEAR')) { - $this->setErrorHandling($mode, $options); - } else { - PEAR::setErrorHandling($mode, $options); - } - return true; - } - - // }}} - // {{{ loadExtension() - - /** - * OS independant PHP extension load. Remember to take care - * on the correct extension name for case sensitive OSes. - * - * @param string $ext The extension name - * @return bool Success or not on the dl() call - */ - function loadExtension($ext) - { - if ( ! extension_loaded($ext)) { - // if either returns true dl() will produce a FATAL error, stop that - if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) { - return false; - } - if (OS_WINDOWS) { - $suffix = '.dll'; - } elseif (PHP_OS == 'HP-UX') { - $suffix = '.sl'; - } elseif (PHP_OS == 'AIX') { - $suffix = '.a'; - } elseif (PHP_OS == 'OSX') { - $suffix = '.bundle'; - } else { - $suffix = '.so'; - } - return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); - } - return true; - } - - // }}} -} - -// {{{ _PEAR_call_destructors() - -function _PEAR_call_destructors() -{ - global $_PEAR_destructor_object_list; - if (is_array($_PEAR_destructor_object_list) && - sizeof($_PEAR_destructor_object_list)) - { - reset($_PEAR_destructor_object_list); - if (PEAR::getStaticProperty('PEAR', 'destructlifo')) { - $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list); - } - while (list($k, $objref) = each($_PEAR_destructor_object_list)) { - $classname = get_class($objref); - while ($classname) { - $destructor = "_$classname"; - if (method_exists($objref, $destructor)) { - $objref->$destructor(); - break; - } else { - $classname = get_parent_class($classname); - } - } - } - // Empty the object list to ensure that destructors are - // not called more than once. - $_PEAR_destructor_object_list = array(); - } - - // Now call the shutdown functions - if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) { - foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) { - call_user_func_array($value[0], $value[1]); - } - } -} - -// }}} -/** - * Standard PEAR error class for PHP 4 - * - * This class is supserseded by {@link PEAR_Exception} in PHP 5 - * - * @category pear - * @package PEAR - * @author Stig Bakken - * @author Tomas V.V. Cox - * @author Gregory Beaver - * @copyright 1997-2006 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.5.0 - * @link http://pear.php.net/manual/en/core.pear.pear-error.php - * @see PEAR::raiseError(), PEAR::throwError() - * @since Class available since PHP 4.0.2 - */ -class PEAR_Error -{ - // {{{ properties - - var $error_message_prefix = ''; - var $mode = PEAR_ERROR_RETURN; - var $level = E_USER_NOTICE; - var $code = -1; - var $message = ''; - var $userinfo = ''; - var $backtrace = null; - - // }}} - // {{{ constructor - - /** - * PEAR_Error constructor - * - * @param string $message message - * - * @param int $code (optional) error code - * - * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN, - * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER, - * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION - * - * @param mixed $options (optional) error level, _OR_ in the case of - * PEAR_ERROR_CALLBACK, the callback function or object/method - * tuple. - * - * @param string $userinfo (optional) additional user/debug info - * - * @access public - * - */ - function PEAR_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { - if ($mode === null) { - $mode = PEAR_ERROR_RETURN; - } - $this->message = $message; - $this->code = $code; - $this->mode = $mode; - $this->userinfo = $userinfo; - if ( ! PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { - $this->backtrace = debug_backtrace(); - if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) { - unset($this->backtrace[0]['object']); - } - } - if ($mode & PEAR_ERROR_CALLBACK) { - $this->level = E_USER_NOTICE; - $this->callback = $options; - } else { - if ($options === null) { - $options = E_USER_NOTICE; - } - $this->level = $options; - $this->callback = null; - } - if ($this->mode & PEAR_ERROR_PRINT) { - if (is_null($options) || is_int($options)) { - $format = "%s"; - } else { - $format = $options; - } - printf($format, $this->getMessage()); - } - if ($this->mode & PEAR_ERROR_TRIGGER) { - trigger_error($this->getMessage(), $this->level); - } - if ($this->mode & PEAR_ERROR_DIE) { - $msg = $this->getMessage(); - if (is_null($options) || is_int($options)) { - $format = "%s"; - if (substr($msg, -1) != "\n") { - $msg .= "\n"; - } - } else { - $format = $options; - } - die(sprintf($format, $msg)); - } - if ($this->mode & PEAR_ERROR_CALLBACK) { - if (is_callable($this->callback)) { - call_user_func($this->callback, $this); - } - } - if ($this->mode & PEAR_ERROR_EXCEPTION) { - trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING); - eval('$e = new Exception($this->message, $this->code);throw($e);'); - } - } - - // }}} - // {{{ getMode() - - /** - * Get the error mode from an error object. - * - * @return int error mode - * @access public - */ - function getMode() { - return $this->mode; - } - - // }}} - // {{{ getCallback() - - /** - * Get the callback function/method from an error object. - * - * @return mixed callback function or object/method array - * @access public - */ - function getCallback() { - return $this->callback; - } - - // }}} - // {{{ getMessage() - - - /** - * Get the error message from an error object. - * - * @return string full error message - * @access public - */ - function getMessage() - { - return ($this->error_message_prefix . $this->message); - } - - - // }}} - // {{{ getCode() - - /** - * Get error code from an error object - * - * @return int error code - * @access public - */ - function getCode() - { - return $this->code; - } - - // }}} - // {{{ getType() - - /** - * Get the name of this error/exception. - * - * @return string error/exception name (type) - * @access public - */ - function getType() - { - return get_class($this); - } - - // }}} - // {{{ getUserInfo() - - /** - * Get additional user-supplied information. - * - * @return string user-supplied information - * @access public - */ - function getUserInfo() - { - return $this->userinfo; - } - - // }}} - // {{{ getDebugInfo() - - /** - * Get additional debug information supplied by the application. - * - * @return string debug information - * @access public - */ - function getDebugInfo() - { - return $this->getUserInfo(); - } - - // }}} - // {{{ getBacktrace() - - /** - * Get the call backtrace from where the error was generated. - * Supported with PHP 4.3.0 or newer. - * - * @param int $frame (optional) what frame to fetch - * @return array Backtrace, or NULL if not available. - * @access public - */ - function getBacktrace($frame = null) - { - if (defined('PEAR_IGNORE_BACKTRACE')) { - return null; - } - if ($frame === null) { - return $this->backtrace; - } - return $this->backtrace[$frame]; - } - - // }}} - // {{{ addUserInfo() - - function addUserInfo($info) - { - if (empty($this->userinfo)) { - $this->userinfo = $info; - } else { - $this->userinfo .= " ** $info"; - } - } - - // }}} - // {{{ toString() - - /** - * Make a string representation of this object. - * - * @return string a string with an object summary - * @access public - */ - function toString() { - $modes = array(); - $levels = array(E_USER_NOTICE => 'notice', - E_USER_WARNING => 'warning', - E_USER_ERROR => 'error'); - if ($this->mode & PEAR_ERROR_CALLBACK) { - if (is_array($this->callback)) { - $callback = (is_object($this->callback[0]) ? - strtolower(get_class($this->callback[0])) : - $this->callback[0]) . '::' . - $this->callback[1]; - } else { - $callback = $this->callback; - } - return sprintf('[%s: message="%s" code=%d mode=callback '. - 'callback=%s prefix="%s" info="%s"]', - strtolower(get_class($this)), $this->message, $this->code, - $callback, $this->error_message_prefix, - $this->userinfo); - } - if ($this->mode & PEAR_ERROR_PRINT) { - $modes[] = 'print'; - } - if ($this->mode & PEAR_ERROR_TRIGGER) { - $modes[] = 'trigger'; - } - if ($this->mode & PEAR_ERROR_DIE) { - $modes[] = 'die'; - } - if ($this->mode & PEAR_ERROR_RETURN) { - $modes[] = 'return'; - } - return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. - 'prefix="%s" info="%s"]', - strtolower(get_class($this)), $this->message, $this->code, - implode("|", $modes), $levels[$this->level], - $this->error_message_prefix, - $this->userinfo); - } - - // }}} -} - -/* - * Local Variables: - * mode: php - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ -?> diff --git a/vendor/Sensei/Sensei.php b/vendor/Sensei/Sensei.php deleted file mode 100644 index 6b7ecbab6..000000000 --- a/vendor/Sensei/Sensei.php +++ /dev/null @@ -1,139 +0,0 @@ -. - */ - -/** - * Sensei - * - * @package Sensei - * @category Core - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @author Konsta Vesterinen - * @version $Revision$ - * @since 1.0 - */ -final class Sensei { - /** - * @var string $path doctrine root directory - */ - private static $path; - - /** - * getPath - * returns the doctrine root - * - * @return string - */ - public static function getPath() - { - if ( ! self::$path) { - self::$path = dirname(__FILE__); - } - return self::$path; - } - - /** - * simple autoload function - * returns true if the class was loaded, otherwise false - * - * @param string $classname - * @return boolean - */ - public static function autoload($classname) - { - if (class_exists($classname, false)) { - return false; - } - if ( ! self::$path) { - self::$path = dirname(__FILE__); - } - $class = self::$path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $classname) . '.php'; - - if ( ! file_exists($class)) { - return false; - } - - require_once($class); - - return true; - } - - /** - * Load a given class: a file name is acquired by naively transforming - * underscores into directory separators and appending the .php suffix. - * - * The file is searched for in every directory in the include path. - * - * @param string class name - * @param boolean allow class to be autoloaded before attempt - * @return true - * @throws Xi_Exception if the class could not be loaded - */ - public static function loadClass($className) - { - if (class_exists($className, false)) { - return false; - } - if ( ! self::$path) { - self::$path = dirname(__FILE__); - } - $class = self::$path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; - - if ( ! file_exists($class)) { - return false; - } - - require_once($class); - - throw new Sensei_Exception('Class ' . $className . ' does not exist and could not ' - . 'be loaded.'); - } - - /** - * Create a new instance of a class. - * - * @param string class name - * @param array constructor arguments, optional - * @return object - */ - public static function create($class, array $args = array()) - { - /** - * An arbitrary amount of constructor arguments can be achieved using - * reflection, but it's slower by an order of magnitude. Manually handle - * instantiation for up to three arguments. - */ - switch (count($args)) { - case 0: - return new $class; - case 1: - return new $class($args[0]); - case 2: - return new $class($args[0], $args[1]); - case 3: - return new $class($args[0], $args[1], $args[2]); - default: - return call_user_func_array(array(new ReflectionClass($class),'newInstance'), - $args); - } - } -} diff --git a/vendor/Sensei/Sensei/Doc/Renderer.php b/vendor/Sensei/Sensei/Doc/Renderer.php deleted file mode 100644 index d89a4a811..000000000 --- a/vendor/Sensei/Sensei/Doc/Renderer.php +++ /dev/null @@ -1,87 +0,0 @@ -. - */ - -/** - * Sensei_Doc_Renderer - * - * @package Sensei_Doc - * @category Documentation - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @version $Revision$ - * @since 1.0 - */ -abstract class Sensei_Doc_Renderer -{ - protected $_wiki; - protected $_toc; - protected $_options = array(); - - public function __construct(Sensei_Doc_Toc $toc, array $options = array()) - { - $defaultOptions = array( - 'title' => 'Title', - 'author' => 'Author', - 'version' => '', - 'subject' => 'Subject', - 'keywords' => 'key, word', - 'template' => '' - ); - - $this->_options = array_merge($defaultOptions, $this->_options); - - $this->setOptions($options); - - $this->_toc = $toc; - - $this->_wiki = Text_Wiki::singleton('Doc'); - $this->_wiki->setParseConf('Doclink', 'toc', $this->_toc); - } - - abstract public function render(); - - public function setOptions(array $options) - { - foreach ($options as $option => $value) { - $this->setOption($option, $value); - } - } - - public function setOption($option, $value) - { - if (is_string($option)) { - if (array_key_exists($option, $this->_options)) { - $this->_options[$option] = $value; - } else { - throw new Exception('Unknown option ' . $option . '.'); - } - } else { - throw new Exception('Option must be a string.'); - } - } - - public function getOption($option) - { - return $this->_options[$option]; - } - -} diff --git a/vendor/Sensei/Sensei/Doc/Renderer/Exception.php b/vendor/Sensei/Sensei/Doc/Renderer/Exception.php deleted file mode 100644 index 15eef306b..000000000 --- a/vendor/Sensei/Sensei/Doc/Renderer/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -/** - * Sensei_Doc_Renderer_Exception - * - * @package Sensei - * @category Sensei Core - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @author Konsta Vesterinen - * @version $Revision$ - * @since 1.0 - */ -class Sensei_Doc_Renderer_Exception extends Exception -{ } diff --git a/vendor/Sensei/Sensei/Doc/Renderer/Latex.php b/vendor/Sensei/Sensei/Doc/Renderer/Latex.php deleted file mode 100644 index 774f8149c..000000000 --- a/vendor/Sensei/Sensei/Doc/Renderer/Latex.php +++ /dev/null @@ -1,73 +0,0 @@ -. - */ - -/** - * Sensei_Doc_Renderer_Latex - * - * @package Sensei_Doc - * @category Documentation - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @version $Revision$ - * @since 1.0 - */ -class Sensei_Doc_Renderer_Latex extends Sensei_Doc_Renderer -{ - public function __construct(Sensei_Doc_Toc $toc, array $options = array()) - { - parent::__construct($toc, $options); - } - - protected function _mergeSections($section = null) - { - if ($section === null) { - $section = $this->_toc; - } - - $text = ''; - - for ($i = 0; $i < count($section); $i++) { - $child = $section->getChild($i); - $text .= str_repeat('+', $child->getLevel()) . $child->getName() . "\n"; - $text .= $child->getText() . "\n"; - $text .= $this->_mergeSections($child); - } - - return $text; - } - - public function render() - { - $content = $this->_wiki->transform($this->_mergeSections(), 'Latex'); - - $output = $this->_options['template']; - - $output = str_replace('%TITLE%', $this->_options['title'], $output); - $output = str_replace('%AUTHOR%', $this->_options['author'], $output); - $output = str_replace('%VERSION%', $this->_options['version'], $output); - $output = str_replace('%SUBJECT%', $this->_options['subject'], $output); - $output = str_replace('%KEYWORDS%', $this->_options['keywords'], $output); - $output = str_replace('%CONTENT%', $content, $output); - - return $output; - } -} diff --git a/vendor/Sensei/Sensei/Doc/Renderer/Pdf.php b/vendor/Sensei/Sensei/Doc/Renderer/Pdf.php deleted file mode 100644 index 14ce6048f..000000000 --- a/vendor/Sensei/Sensei/Doc/Renderer/Pdf.php +++ /dev/null @@ -1,158 +0,0 @@ -. - */ - -/** - * Sensei_Doc_Renderer_Pdf - * - * @package Sensei_Doc - * @category Documentation - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @version $Revision$ - * @since 1.0 - */ -class Sensei_Doc_Renderer_Pdf extends Sensei_Doc_Renderer -{ - protected $_options = array( - 'temp_dir' => '/tmp', - 'pdflatex_path' => '/usr/bin/pdflatex', - 'lock' => false - ); - - protected static $_tmpFileExtensions = array('tex', 'aux', 'out', 'log', 'toc', 'pdf'); - - protected $_tmpFilename; - - - public function __construct(Sensei_Doc_Toc $toc, array $options = array()) - { - parent::__construct($toc, $options); - } - - public function testRequirements() - { - exec($this->_options['pdflatex_path'], $output); - - if ( ! isset($output[0]) || ! preg_match('/^This is pdfe?TeXk?/', $output[0])) { - $message = 'pdfLaTeX does not seem to be installed, or pdflatex_path' - . ' option does not point to pdfLaTeX executable.'; - throw new Sensei_Doc_Renderer_Exception($message); - } - } - - /** - * Deletes temporary files generated during LaTeX to PDF conversion. - */ - protected function _cleanUp() - { - foreach (self::$_tmpFileExtensions as $extension) { - $filename = $this->_options['temp_dir'] . DIRECTORY_SEPARATOR - . $this->tmpFilename . '.' . $extension; - @unlink($filename); - } - } - - public function render() - { - $this->testRequirements(); - - // Filename to be used by temporary files - $this->tmpFilename = md5($this->_options['title']); - - // Change working directory to the temporary directory - $currentDir = getcwd(); - if ( ! @chdir($this->_options['temp_dir'])) { - throw new Sensei_Doc_Renderer_Exception('Could not change to temporary directory.'); - } - - if ($this->_options['lock']) { - $lockFile = $this->tmpFilename . '.lock'; - - // Check if lock exists - if (file_exists($lockFile)) { - throw new Sensei_Doc_Renderer_Exception('Pdf is being generated at the moment.'); - } - - // Create a lock (just an empty file) - if (($fp = @fopen($lockFile, 'w')) === false) { - throw new Sensei_Doc_Renderer_Exception('Could not create a lock file.'); - } - fclose($fp); - } - - $latexRenderer = new Sensei_Doc_Renderer_Latex($this->_toc); - - // Set the options of the Latex renderer to be the same as this instance - // of PDF renderer. - foreach ($this->_options as $option => $value) { - try { - $latexRenderer->setOption($option, $value); - } catch (Exception $e){ - // Do nothing. Latex renderer does not have all options of PDF - // renderer. - } - } - - // Render the wiki source to latex - $latex = $latexRenderer->render(); - - // Open a temporary file for writing the latex source to - if ( ! @file_put_contents($this->tmpFilename . '.tex', $latex, LOCK_EX)) { - $this->_cleanUp(); // delete temporary files - throw new Sensei_Doc_Renderer_Exception('Could not write latex source to a temporary file.'); - } - - // Run pdfLaTeX to create the PDF file. - $command = $this->_options['pdflatex_path'] . ' -interaction=nonstopmode ' - . $this->tmpFilename . '.tex'; - exec($command); - - // Second run generates table of contents - exec($command); - - // Since table of contents is multiple pages long, we need a third run - // in order to fix incorrect page numbers in table of contents - exec($command); - - // Read the generated PDF file - $pdf = @file_get_contents($this->tmpFilename . '.pdf'); - - if ($pdf === false) { - $this->_cleanUp(); // delete temporary files - throw new Sensei_Doc_Renderer_Exception('An error occured during the Latex to PDF conversion.'); - } - - // Delete temporary files - $this->_cleanUp(); - - // Remove lock file - if ($this->_options['lock']) { - @unlink($lockFile); - } - - // Switch back to the previous working directory - chdir($currentDir); - - return $pdf; - } - -} diff --git a/vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php b/vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php deleted file mode 100644 index 5266d43cb..000000000 --- a/vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php +++ /dev/null @@ -1,242 +0,0 @@ -. - */ - -/** - * Sensei_Doc_Renderer_Xhtml - * - * @package Sensei_Doc - * @category Documentation - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @version $Revision$ - * @since 1.0 - */ -class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer -{ - /** - * Available options - * - * (Sensei_Doc_Section|null) section : - * Section to be rendered. If null all sections will be rendered. - * - * (string) url_prefix : - * All URLs pointing to sections will be prefixed with this. - */ - protected $_options = array( - 'section' => null, - 'url_prefix' => '' - ); - - private $_chapter; - private $_codeListingsIndex; - - public function __construct(Sensei_Doc_Toc $toc, array $options = array()) - { - parent::__construct($toc, $options); - - $this->_wiki->setRenderConf('xhtml', 'Doclink', 'url_callback', array(&$this, 'makeUrl')); - $this->_wiki->setRenderConf('xhtml', 'Code', 'code_begin_callback', array(&$this, 'codeListingsNumberingCallback')); - } - - /** - * Renders table of contents as nested unordered lists. - * - * @return string rendered table of contents - */ - public function renderToc() - { - return $this->_renderToc($this->_toc); - } - - /** - * Renders table of contents recursively as nested unordered lists. - * - * @param $section Sensei_Doc_Toc|Sensei_Doc_Section - * @return string rendered table of contents - */ - protected function _renderToc($section) - { - $output = ''; - - if ($section instanceof Sensei_Doc_Toc) { - $class = ' class="tree"'; - } elseif ($section !== $this->_options['section']) { - $class = ' class="closed"'; - } else { - $class = ''; - } - - $output .= '' . "\n"; - - for ($i = 0; $i < $section->count(); $i++) { - $child = $section->getChild($i); - - $text = $child->getIndex() . ' ' . $child->getName(); - $href = $this->makeUrl($child); - - $output .= '
  • ' . $text . ''; - - if ($child->count() > 0) { - $output .= "\n"; - $output .= $this->_renderToc($child); - } - - $output .= '
  • ' . "\n"; - } - - $output .= '' . "\n"; - - return $output; - } - - /** - * Renders section defined by 'section' option. If 'section' option is not - * set, renders all sections. - * - * @return string rendered sections - */ - public function render() - { - $section = $this->_options['section']; - - if ($section instanceof Sensei_Doc_Section) { - - $content = $this->_renderSection($section); - - } else { - - // No section was set, so let's render all sections - $content = ''; - for ($i = 0; $i < count($this->_toc); $i++) { - $content .= $this->_renderSection($this->_toc->getChild($i)); - } - } - - $output = $this->_options['template']; - - $output = str_replace('%TITLE%', $this->_options['title'], $output); - $output = str_replace('%AUTHOR%', $this->_options['author'], $output); - $output = str_replace('%SUBJECT%', $this->_options['subject'], $output); - $output = str_replace('%KEYWORDS%', $this->_options['keywords'], $output); - $output = str_replace('%TOC%', $this->renderToc(), $output); - $output = str_replace('%CONTENT%', $content, $output); - - return $output; - } - - /** - * Renders a sections and its children - * - * @param $section Sensei_Doc_Section section to be rendered - * @return string rendered sections - */ - protected function _renderSection(Sensei_Doc_Section $section) - { - $output = ''; - - $title = $section->getIndex() . ' ' . $section->getName(); - $level = $section->getLevel(); - - if ($level === 1) { - $class = ' class="chapter"'; - $title = 'Chapter ' . $title; - $this->_chapter = $section->getIndex(); - $this->_codeListingsIndex = 0; - } else { - $class = ' class="section"'; - } - - $output .= '' . "\n"; - - $output .= ""; - - if ( ! ($this->_options['section'] instanceof Sensei_Doc_Section) - || ($level > $this->_options['section']->getLevel())) { - $anchor = $this->makeAnchor($section); - $output .= ''; - $output .= $title . ''; - } else { - $output .= $title; - } - - $output .= ""; - - // Transform section contents from wiki syntax to XHTML - $output .= $this->_wiki->transform($section->getText()); - - // Render children of this section recursively - for ($i = 0; $i < count($section); $i++) { - $output .= $this->_renderSection($section->getChild($i)); - } - - $output .= '' . "\n"; - - return $output; - } - - public function makeUrl($section) - { - if ($section instanceof Sensei_Doc_Section) { - $path = $section->getPath(); - } else { - $path = $section; - } - - $url = $this->_options['url_prefix']; - - if ($this->_options['section'] instanceof Sensei_Doc_Section) { - $level = $this->_options['section']->getLevel(); - $url .= implode(':', array_slice(explode(':', $path), 0, $level)); - } - - $anchor = $this->makeAnchor($section); - if ($anchor !== '') { - $url .= '#' . $anchor; - } - - return $url; - } - - public function makeAnchor($section) - { - if ($section instanceof Sensei_Doc_Section) { - $path = $section->getPath(); - } else { - $path = $section; - } - - if ($this->_options['section'] instanceof Sensei_Doc_Section) { - $level = $this->_options['section']->getLevel(); - return implode(':', array_slice(explode(':', $path), $level)); - } else { - return $path; - } - } - - public function codeListingsNumberingCallback() - { - $this->_codeListingsIndex++; - $html = '

    Listing ' . $this->_chapter . '.' - . $this->_codeListingsIndex . "

    \n"; - return $html; - } -} diff --git a/vendor/Sensei/Sensei/Doc/Section.php b/vendor/Sensei/Sensei/Doc/Section.php deleted file mode 100644 index ee6df0d9e..000000000 --- a/vendor/Sensei/Sensei/Doc/Section.php +++ /dev/null @@ -1,401 +0,0 @@ -. - */ - -/** - * Sensei_Doc_Section - * - * @package Sensei_Doc - * @category Documentation - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @author Konsta Vesterinen - * @version $Revision$ - * @since 1.0 - */ -class Sensei_Doc_Section implements Countable -{ - /** - * Name of the section - * - * @var string - */ - private $_name; - - /** - * The index of this section among the subsections of its parent. The index - * ranges from 0 to the number of subsections the parent has minus one. - * - * @var int - */ - private $_index; - - /** - * Array containing the subsections of this section. - * - * @var array - */ - private $_children = array(); - - /** - * The parent of this section. - * - * @var Sensei_Doc_Section - */ - private $_parent; - - /** - * Level of this section in section hierarchy. - * - * @var int - */ - private $_level = 0; - - /** - * Text contents of this section. - * - * @var string - */ - private $_text = ''; - - - /** - * Constructs a new section. - * - * @param string $name name of the section - * @param Sensei_Doc_Section $parent parent of the section - */ - public function __construct($name = null, $parent = null) - { - $this->_name = $name; - $this->_parent = $parent; - - if ($parent !== null) { - $this->_parent->addChild($this); - $this->_level = $this->_parent->_level + 1; - } - } - - /** - * Adds a subsection to this section. - * - * @param Sensei_Doc_Section $child - */ - protected function addChild(Sensei_Doc_Section $child) - { - $child->_index = count($this); - $this->_children[] = $child; - } - - /** - * Returns the index of this section. - * - * @param string $separator - * @return string - */ - public function getIndex($separator = '.') - { - if ($this->_parent->_name !== null) { - return $this->_parent->getIndex($separator) . $separator . ($this->_index + 1); - } else { - return ($this->_index + 1); - } - } - - /** - * Returns the path of this section. - * - * @param string $separator - * @return string - */ - public function getPath($short = false, $separator = ':') - { - if ( ! $short && ! $this->_parent->isRoot()) { - return $this->_parent->getPath($short, $separator) . $separator . $this->getPath(true); - } else { - return self::convertNameToPath($this->_name); - } - } - - /** - * Returns the name of this section. - * - * @param boolean $full - * @param string $separator - * @return string - */ - public function getName($full = false, $separator = ' - ') - { - if ($full && ! $this->_parent->isRoot()) { - return $this->_parent->getName($full, $separator) . $separator . $this->_name; - } else { - return $this->_name; - } - } - - /** - * Returns how many subsections this section has. - * - * @return int number of subsections - */ - public function count() - { - return count($this->_children); - } - - /** - * Returns the subsection that has the given index. - * - * The index ranges from 0 to the number of subsections this section has - * minus one. - * - * @param int $index index of the subsection - * @return Sensei_Doc_Section The subsection with given index. - */ - public function getChild($index) - { - return $this->_children[$index]; - } - - /** - * Returns the parent of this section. - * - * @return Sensei_Doc_Section - */ - public function getParent() - { - if ($this->_parent->isRoot()) { - return null; - } else { - return $this->_parent; - } - } - - /** - * Returns the next section. - * - * If this section has subsections and their level is at most the specified - * maximum level, the next section is the first subsection of this section. - * - * If this section is not the last subsection of its parent and level of - * this section is at most the specified maximum level, the next section is - * the next section at the same level as this. - * - * Otherwise the next section is the next section of the parent that is on - * the same level as the parent. - * - * @param int $maxLevel The maximum level that the next section can have. - * If maximum level is 0 (default), this parameter is - * discarded. - * - * @return Sensei_Doc_Section|null The next section, or null if not - * available. - */ - public function next($maxLevel = 0) - { - if ($this->isRoot()) { - - return null; - - } else { - - if (( ! $maxLevel || ($this->_level < $maxLevel)) - && (count($this) > 0)) { - return $this->getChild(0); - } - - if (( ! $maxLevel || ($this->_level <= $maxLevel) ) - && ($this->_index < count($this->_parent) - 1)) { - return $this->_parent->getChild($this->_index + 1); - } - - return $this->_parent->next($this->_parent->_level); - - } - } - - /** - * Returns the previous section. - * - * @return Sensei_Doc_Section - */ - public function previous($maxLevel = 0) - { - if ($maxLevel > 0 && $this->_level > $maxLevel) { - $previous = $this; - while ($previous->_level > $maxLevel) { - $previous = $previous->getParent(); - } - return $previous; - } - - if ($this->_index === 0) { - return $this->getParent(); - } else { - $previousSibling = $this->_parent->getChild($this->_index - 1); - return $previousSibling->findLastChild($maxLevel); - } - } - - /** - * Finds the last child or grand child of this section. - * - * If this section has no children, this section is returned. - * - * @param int $maxLevel Specifies the maximum level that the algorithm will - * traverse to. If maximum level is 0 (default), the - * algorithm will go as deep as possible. - * @return Sensei_Doc_Section - */ - public function findLastChild($maxLevel = 0) - { - if (( ! $maxLevel || $this->_level < $maxLevel) && count($this) > 0) { - return $this->getChild(count($this) - 1)->findLastChild(); - } else { - return $this; - } - } - - /** - * Returns true, if this section is the root section. - * - * @return bool - */ - public function isRoot() - { - return $this->_parent === null; - } - - /** - * Returns the level of this section in section hierarchy. - * - * @return int - */ - public function getLevel() - { - return $this->_level; - } - - /** - * Returns the text contents of this section. - * - * @return string - */ - public function getText() - { - return $this->_text; - } - - public function parse($path, $filename) - { - $file = file($path . DIRECTORY_SEPARATOR . $filename); - $current = $this; - - if ($this->isRoot()) { - $path .= DIRECTORY_SEPARATOR . basename($filename, '.txt'); - } - - foreach ($file as $lineNum => $line) { - - // Checks if the line is a heading - if (preg_match('/^(\+{1,6}) (.*)/', trim($line), $matches)) { - - $level = strlen($matches[1]); - $heading = $matches[2]; - - if (($level > $this->getLevel()) && ($level <= $current->getLevel() + 1)) { - - // The current section did not have any text in this file. - // Let's assume that the text is defined in another file. - if ( ! $current->isRoot() && $current->_text === '') { - - $otherFilename = $current->getPath(false, DIRECTORY_SEPARATOR) . '.txt'; - - if (($filename !== $otherFilename) - && (file_exists($path . DIRECTORY_SEPARATOR . $otherFilename))) { - $current->parse($path, $otherFilename); - } - } - - $parent = $current; - - while ($parent->getLevel() >= $level) { - $parent = $parent->_parent; - } - - $current = new Sensei_Doc_Section($heading, $parent); - - } else { - - $format = 'Section has no direct parent, or level of the ' - . 'heading is not greater than the level of the ' - . 'file in "%s" on line %d'; - - $message = sprintf($format, $filename, $lineNum); - - throw new Sensei_Exception($message); - - } - - } else { - - if ($current->_text === '') { - if (trim($line) !== '') { - $current->_text = $line; - } - } else { - $current->_text .= $line; - } - - } - } - - // The last section did not have any text in this file. - // Let's assume that the text is defined in another file. - if ( ! $current->isRoot() && $current->_text === '') { - - $otherFilename = $current->getPath(false, DIRECTORY_SEPARATOR) . '.txt'; - - if (($filename !== $otherFilename) - && (file_exists($path . DIRECTORY_SEPARATOR . $otherFilename))) { - $current->parse($path, $otherFilename); - } - } - } - - /** - * Converts section name to section path. - * - * Section path is generated from section name by making section name - * lowercase, replacing all whitespace with a dash and removing all - * characters that are not a letter, a number or a dash. - * - * @param $name string section name - * @return section path - */ - public static function convertNameToPath($name) - { - $patterns = array('/\s/', '/[^a-z0-9-]/'); - $replacements = array('-', ''); - - return preg_replace($patterns, $replacements, strtolower($name)); - } -} diff --git a/vendor/Sensei/Sensei/Doc/Toc.php b/vendor/Sensei/Sensei/Doc/Toc.php deleted file mode 100644 index 1bb32b61f..000000000 --- a/vendor/Sensei/Sensei/Doc/Toc.php +++ /dev/null @@ -1,132 +0,0 @@ -. - */ - -/** - * Sensei_Doc_Toc - * - * @package Sensei_Doc - * @category Documentation - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @author Konsta Vesterinen - * @version $Revision$ - * @since 1.0 - */ -class Sensei_Doc_Toc implements Countable -{ - /** - * An empty (root) section that contains all other sections. - * - * @var Sensei_Doc_Section - */ - private $_toc; - - - /** - * Constructs a new table of contents from a file - * - * @param string $filename Name of the file that contains the section - * structure. - */ - public function __construct($filename) - { - $this->_toc = new Sensei_Doc_Section(); - $this->_toc->parse(dirname($filename), basename($filename)); - } - - /** - * Finds the section that matches the given path. - * - * The path consists of section names, where spaces are replaced by - * underscores, and which separated by '/' (default). - * - * @param string $path Path - * @param string $separator A string that separates section names in path. - * @return Sensei_Doc_Section|null A section that matches the given path, or - * null if no matching section was found. - */ - public function findByPath($path, $separator = ':') - { - $sectionPaths = explode($separator, $path); - $currentSection = $this->_toc; - - foreach ($sectionPaths as $sectionPath) { - - $found = false; - - for ($i = 0; $i < $currentSection->count(); $i++) { - if ($currentSection->getChild($i)->getPath(true, $separator) === $sectionPath) { - $currentSection = $currentSection->getChild($i); - $found = true; - break; - } - } - - if ( ! $found) { - return null; - } - } - - return $currentSection; - } - - public function findByIndex($index, $separator = '.') - { - $indexes = explode($separator, $index); - $currentSection = $this->_toc; - - if (end($indexes) === '') { - array_pop($indexes); - } - - foreach ($indexes as $i) { - try { - $currentSection = $currentSection->getChild((int) $i - 1); - } catch (Exception $e) { - return null; - } - } - - return $currentSection; - } - - /** - * Returns a root section with the given index. - * - * @param int $index - * @return Sensei_Doc_Section - */ - public function getChild($index) - { - return $this->_toc->getChild($index); - } - - /** - * Returns the number of sections (excluding their subsections). - * - * @return int - */ - public function count() - { - return $this->_toc->count(); - } -} \ No newline at end of file diff --git a/vendor/Sensei/Sensei/Exception.php b/vendor/Sensei/Sensei/Exception.php deleted file mode 100644 index 2ca066da5..000000000 --- a/vendor/Sensei/Sensei/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -/** - * Sensei_Exception - * - * @package Sensei - * @category Sensei Core - * @license http://www.gnu.org/licenses/lgpl.txt LGPL - * @link http://sourceforge.net/projects/sensei - * @author Janne Vanhala - * @author Konsta Vesterinen - * @version $Revision$ - * @since 1.0 - */ -class Sensei_Exception extends Exception -{ } diff --git a/vendor/Text/Wiki.php b/vendor/Text/Wiki.php deleted file mode 100644 index f9d3af623..000000000 --- a/vendor/Text/Wiki.php +++ /dev/null @@ -1,1552 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Wiki.php,v 1.51 2007/06/09 23:17:46 justinpatrin Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * The baseline abstract parser class. - */ -require_once 'Text/Wiki/Parse.php'; - -/** - * The baseline abstract render class. - */ -require_once 'Text/Wiki/Render.php'; - -/** - * Parse structured wiki text and render into arbitrary formats such as XHTML. - * - * This is the "master" class for handling the management and convenience - * functions to transform Wiki-formatted text. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: 1.2.0 - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki { - - /** - * - * The default list of rules, in order, to apply to the source text. - * - * @access public - * - * @var array - * - */ - - var $rules = array( - 'Prefilter', - 'Delimiter', - 'Code', - 'Function', - 'Html', - 'Raw', - 'Include', - 'Embed', - 'Anchor', - 'Heading', - 'Toc', - 'Horiz', - 'Break', - 'Blockquote', - 'List', - 'Deflist', - 'Table', - 'Image', - 'Phplookup', - 'Center', - 'Newline', - 'Paragraph', - 'Url', - 'Freelink', - 'Interwiki', - 'Wikilink', - 'Colortext', - 'Strong', - 'Bold', - 'Emphasis', - 'Italic', - 'Underline', - 'Tt', - 'Superscript', - 'Subscript', - 'Revise', - 'Tighten' - ); - - - /** - * - * The list of rules to not-apply to the source text. - * - * @access public - * - * @var array - * - */ - - var $disable = array( - 'Html', - 'Include', - 'Embed' - ); - - - /** - * - * Custom configuration for rules at the parsing stage. - * - * In this array, the key is the parsing rule name, and the value is - * an array of key-value configuration pairs corresponding to the $conf - * property in the target parsing rule. - * - * For example: - * - * - * $parseConf = array( - * 'Include' => array( - * 'base' => '/path/to/scripts/' - * ) - * ); - * - * - * Note that most default rules do not need any parsing configuration. - * - * @access public - * - * @var array - * - */ - - var $parseConf = array(); - - - /** - * - * Custom configuration for rules at the rendering stage. - * - * Because rendering may be different for each target format, the - * first-level element in this array is always a format name (e.g., - * 'Xhtml'). - * - * Within that first level element, the subsequent elements match the - * $parseConf format. That is, the sub-key is the rendering rule name, - * and the sub-value is an array of key-value configuration pairs - * corresponding to the $conf property in the target rendering rule. - * - * @access public - * - * @var array - * - */ - - var $renderConf = array( - 'Docbook' => array(), - 'Latex' => array(), - 'Pdf' => array(), - 'Plain' => array(), - 'Rtf' => array(), - 'Xhtml' => array() - ); - - - /** - * - * Custom configuration for the output format itself. - * - * Even though Text_Wiki will render the tokens from parsed text, - * the format itself may require some configuration. For example, - * RTF needs to know font names and sizes, PDF requires page layout - * information, and DocBook needs a section hierarchy. This array - * matches the $conf property of the the format-level renderer - * (e.g., Text_Wiki_Render_Xhtml). - * - * In this array, the key is the rendering format name, and the value is - * an array of key-value configuration pairs corresponding to the $conf - * property in the rendering format rule. - * - * @access public - * - * @var array - * - */ - - var $formatConf = array( - 'Docbook' => array(), - 'Latex' => array(), - 'Pdf' => array(), - 'Plain' => array(), - 'Rtf' => array(), - 'Xhtml' => array() - ); - - - /** - * - * The delimiter for token numbers of parsed elements in source text. - * - * @access public - * - * @var string - * - */ - - var $delim = "\xFF"; - - - /** - * - * The tokens generated by rules as the source text is parsed. - * - * As Text_Wiki applies rule classes to the source text, it will - * replace portions of the text with a delimited token number. This - * is the array of those tokens, representing the replaced text and - * any options set by the parser for that replaced text. - * - * The tokens array is sequential; each element is itself a sequential - * array where element 0 is the name of the rule that generated the - * token, and element 1 is an associative array where the key is an - * option name and the value is an option value. - * - * @access private - * - * @var array - * - */ - - var $tokens = array(); - - /** - * How many tokens generated pro rules. - * - * Intended to load only necessary render objects - * - * @access private - * @var array - */ - var $_countRulesTokens = array(); - - - /** - * - * The source text to which rules will be applied. - * - * This text will be transformed in-place, which means that it will - * change as the rules are applied. - * - * @access private - * - * @var string - * - */ - - var $source = ''; - - /** - * The output text - * - * @var string - */ - var $output = ''; - - - /** - * - * Array of rule parsers. - * - * Text_Wiki creates one instance of every rule that is applied to - * the source text; this array holds those instances. The array key - * is the rule name, and the array value is an instance of the rule - * class. - * - * @access private - * - * @var array - * - */ - - var $parseObj = array(); - - - /** - * - * Array of rule renderers. - * - * Text_Wiki creates one instance of every rule that is applied to - * the source text; this array holds those instances. The array key - * is the rule name, and the array value is an instance of the rule - * class. - * - * @access private - * - * @var array - * - */ - - var $renderObj = array(); - - - /** - * - * Array of format renderers. - * - * @access private - * - * @var array - * - */ - - var $formatObj = array(); - - - /** - * - * Array of paths to search, in order, for parsing and rendering rules. - * - * @access private - * - * @var array - * - */ - - var $path = array( - 'parse' => array(), - 'render' => array() - ); - - - - /** - * - * The directory separator character. - * - * @access private - * - * @var string - * - */ - - var $_dirSep = DIRECTORY_SEPARATOR; - - /** - * Temporary configuration variable - * - * @var string - */ - var $renderingType = 'preg'; - - /** - * Stack of rendering callbacks - * - * @var Array - */ - var $_renderCallbacks = array(); - - /** - * Current output block - * - * @var string - */ - var $_block; - - /** - * A stack of blocks - * - * @param Array - */ - var $_blocks; - - /** - * - * Constructor. - * - * **DEPRECATED** - * Please use the singleton() or factory() methods. - * - * @access public - * - * @param array $rules The set of rules to load for this object. Defaults - * to null, which will load the default ruleset for this parser. - */ - - function Text_Wiki($rules = null) - { - if (is_array($rules)) { - $this->rules = array(); - foreach ($rules as $rule) { - $this->rules[] = ucfirst($rule); - } - } - - $this->addPath( - 'parse', - $this->fixPath(dirname(__FILE__)) . 'Wiki/Parse/Default/' - ); - $this->addPath( - 'render', - $this->fixPath(dirname(__FILE__)) . 'Wiki/Render/' - ); - - } - - /** - * Singleton. - * - * This avoids instantiating multiple Text_Wiki instances where a number - * of objects are required in one call, e.g. to save memory in a - * CMS invironment where several parsers are required in a single page. - * - * $single = & singleton(); - * - * or - * - * $single = & singleton('Parser', array('Prefilter', 'Delimiter', 'Code', 'Function', - * 'Html', 'Raw', 'Include', 'Embed', 'Anchor', 'Heading', 'Toc', 'Horiz', - * 'Break', 'Blockquote', 'List', 'Deflist', 'Table', 'Image', 'Phplookup', - * 'Center', 'Newline', 'Paragraph', 'Url', 'Freelink', 'Interwiki', 'Wikilink', - * 'Colortext', 'Strong', 'Bold', 'Emphasis', 'Italic', 'Underline', 'Tt', - * 'Superscript', 'Subscript', 'Revise', 'Tighten')); - * - * Call using a subset of this list. The order of passing rulesets in the - * $rules array is important! - * - * After calling this, call $single->setParseConf(), setRenderConf() or setFormatConf() - * as usual for a constructed object of this class. - * - * The internal static array of singleton objects has no index on the parser - * rules, the only index is on the parser name. So if you call this multiple - * times with different rules but the same parser name, you will get the same - * static parser object each time. - * - * @access public - * @static - * @since Method available since Release 1.1.0 - * @param string $parser The parser to be used (defaults to 'Default'). - * @param array $rules The set of rules to instantiate the object. This - * will only be used when the first call to singleton is made, if included - * in further calls it will be effectively ignored. - * @return &object a reference to the Text_Wiki unique instantiation. - */ - function &singleton($parser = 'Default', $rules = null) - { - static $only = array(); - if ( ! isset($only[$parser])) { - $ret = & Text_Wiki::factory($parser, $rules); - if (Text_Wiki::isError($ret)) { - return $ret; - } - $only[$parser] =& $ret; - } - return $only[$parser]; - } - - /** - * Returns a Text_Wiki Parser class for the specified parser. - * - * @access public - * @static - * @param string $parser The name of the parse to instantiate - * you need to have Text_Wiki_XXX installed to use $parser = 'XXX', it's E_FATAL - * @param array $rules The rules to pass into the constructor - * {@see Text_Wiki::singleton} for a list of rules - * @return Text_Wiki a Parser object extended from Text_Wiki - */ - function &factory($parser = 'Default', $rules = null) - { - $class = 'Text_Wiki_' . $parser; - $file = str_replace('_', '/', $class).'.php'; - if ( ! class_exists($class)) { - require_once $file; - if ( ! class_exists($class)) { - return Text_Wiki::error( - 'Class ' . $class . ' does not exist after requiring '. $file . - ', install package ' . $class . "\n"); - } - } - - $obj =& new $class($rules); - return $obj; - } - - /** - * - * Set parser configuration for a specific rule and key. - * - * @access public - * - * @param string $rule The parse rule to set config for. - * - * @param array|string $arg1 The full config array to use for the - * parse rule, or a conf key in that array. - * - * @param string $arg2 The config value for the key. - * - * @return void - * - */ - - function setParseConf($rule, $arg1, $arg2 = null) - { - $rule = ucwords(strtolower($rule)); - - if ( ! isset($this->parseConf[$rule])) { - $this->parseConf[$rule] = array(); - } - - // if first arg is an array, use it as the entire - // conf array for the rule. otherwise, treat arg1 - // as a key and arg2 as a value for the rule conf. - if (is_array($arg1)) { - $this->parseConf[$rule] = $arg1; - } else { - $this->parseConf[$rule][$arg1] = $arg2; - } - } - - - /** - * - * Get parser configuration for a specific rule and key. - * - * @access public - * - * @param string $rule The parse rule to get config for. - * - * @param string $key A key in the conf array; if null, - * returns the entire conf array. - * - * @return mixed The whole conf array if no key is specified, - * or the specific conf key value. - * - */ - - function getParseConf($rule, $key = null) - { - $rule = ucwords(strtolower($rule)); - - // the rule does not exist - if ( ! isset($this->parseConf[$rule])) { - return null; - } - - // no key requested, return the whole array - if (is_null($key)) { - return $this->parseConf[$rule]; - } - - // does the requested key exist? - if (isset($this->parseConf[$rule][$key])) { - // yes, return that value - return $this->parseConf[$rule][$key]; - } else { - // no - return null; - } - } - - - /** - * - * Set renderer configuration for a specific format, rule, and key. - * - * @access public - * - * @param string $format The render format to set config for. - * - * @param string $rule The render rule to set config for in the format. - * - * @param array|string $arg1 The config array, or the config key - * within the render rule. - * - * @param string $arg2 The config value for the key. - * - * @return void - * - */ - - function setRenderConf($format, $rule, $arg1, $arg2 = null) - { - $format = ucwords(strtolower($format)); - $rule = ucwords(strtolower($rule)); - - if ( ! isset($this->renderConf[$format])) { - $this->renderConf[$format] = array(); - } - - if ( ! isset($this->renderConf[$format][$rule])) { - $this->renderConf[$format][$rule] = array(); - } - - // if first arg is an array, use it as the entire - // conf array for the render rule. otherwise, treat arg1 - // as a key and arg2 as a value for the render rule conf. - if (is_array($arg1)) { - $this->renderConf[$format][$rule] = $arg1; - } else { - $this->renderConf[$format][$rule][$arg1] = $arg2; - } - } - - - /** - * - * Get renderer configuration for a specific format, rule, and key. - * - * @access public - * - * @param string $format The render format to get config for. - * - * @param string $rule The render format rule to get config for. - * - * @param string $key A key in the conf array; if null, - * returns the entire conf array. - * - * @return mixed The whole conf array if no key is specified, - * or the specific conf key value. - * - */ - - function getRenderConf($format, $rule, $key = null) - { - $format = ucwords(strtolower($format)); - $rule = ucwords(strtolower($rule)); - - if ( ! isset($this->renderConf[$format]) || - ! isset($this->renderConf[$format][$rule])) { - return null; - } - - // no key requested, return the whole array - if (is_null($key)) { - return $this->renderConf[$format][$rule]; - } - - // does the requested key exist? - if (isset($this->renderConf[$format][$rule][$key])) { - // yes, return that value - return $this->renderConf[$format][$rule][$key]; - } else { - // no - return null; - } - - } - - /** - * - * Set format configuration for a specific rule and key. - * - * @access public - * - * @param string $format The format to set config for. - * - * @param string $key The config key within the format. - * - * @param string $val The config value for the key. - * - * @return void - * - */ - - function setFormatConf($format, $arg1, $arg2 = null) - { - if ( ! is_array($this->formatConf[$format])) { - $this->formatConf[$format] = array(); - } - - // if first arg is an array, use it as the entire - // conf array for the format. otherwise, treat arg1 - // as a key and arg2 as a value for the format conf. - if (is_array($arg1)) { - $this->formatConf[$format] = $arg1; - } else { - $this->formatConf[$format][$arg1] = $arg2; - } - } - - - - /** - * - * Get configuration for a specific format and key. - * - * @access public - * - * @param string $format The format to get config for. - * - * @param mixed $key A key in the conf array; if null, - * returns the entire conf array. - * - * @return mixed The whole conf array if no key is specified, - * or the specific conf key value. - * - */ - - function getFormatConf($format, $key = null) - { - // the format does not exist - if ( ! isset($this->formatConf[$format])) { - return null; - } - - // no key requested, return the whole array - if (is_null($key)) { - return $this->formatConf[$format]; - } - - // does the requested key exist? - if (isset($this->formatConf[$format][$key])) { - // yes, return that value - return $this->formatConf[$format][$key]; - } else { - // no - return null; - } - } - - - /** - * - * Inserts a rule into to the rule set. - * - * @access public - * - * @param string $name The name of the rule. Should be different from - * all other keys in the rule set. - * - * @param string $tgt The rule after which to insert this new rule. By - * default (null) the rule is inserted at the end; if set to '', inserts - * at the beginning. - * - * @return void - * - */ - - function insertRule($name, $tgt = null) - { - $name = ucwords(strtolower($name)); - if ( ! is_null($tgt)) { - $tgt = ucwords(strtolower($tgt)); - } - - // does the rule name to be inserted already exist? - if (in_array($name, $this->rules)) { - // yes, return - return null; - } - - // the target name is not null, and not '', but does not exist - // in the list of rules. this means we're trying to insert after - // a target key, but the target key isn't there. - if ( ! is_null($tgt) && $tgt != '' && - ! in_array($tgt, $this->rules)) { - return false; - } - - // if $tgt is null, insert at the end. We know this is at the - // end (instead of resetting an existing rule) becuase we exited - // at the top of this method if the rule was already in place. - if (is_null($tgt)) { - $this->rules[] = $name; - return true; - } - - // save a copy of the current rules, then reset the rule set - // so we can insert in the proper place later. - // where to insert the rule? - if ($tgt == '') { - // insert at the beginning - array_unshift($this->rules, $name); - return true; - } - - // insert after the named rule - $tmp = $this->rules; - $this->rules = array(); - - foreach ($tmp as $val) { - $this->rules[] = $val; - if ($val == $tgt) { - $this->rules[] = $name; - } - } - - return true; - - } - - - /** - * - * Delete (remove or unset) a rule from the $rules property. - * - * @access public - * - * @param string $rule The name of the rule to remove. - * - * @return void - * - */ - - function deleteRule($name) - { - $name = ucwords(strtolower($name)); - $key = array_search($name, $this->rules); - if ($key !== false) { - unset($this->rules[$key]); - } - } - - - /** - * - * Change from one rule to another in-place. - * - * @access public - * - * @param string $old The name of the rule to change from. - * - * @param string $new The name of the rule to change to. - * - * @return void - * - */ - - function changeRule($old, $new) - { - $old = ucwords(strtolower($old)); - $new = ucwords(strtolower($new)); - $key = array_search($old, $this->rules); - if ($key !== false) { - // delete the new name , case it was already there - $this->deleteRule($new); - $this->rules[$key] = $new; - } - } - - - /** - * - * Enables a rule so that it is applied when parsing. - * - * @access public - * - * @param string $rule The name of the rule to enable. - * - * @return void - * - */ - - function enableRule($name) - { - $name = ucwords(strtolower($name)); - $key = array_search($name, $this->disable); - if ($key !== false) { - unset($this->disable[$key]); - } - } - - - /** - * - * Disables a rule so that it is not applied when parsing. - * - * @access public - * - * @param string $rule The name of the rule to disable. - * - * @return void - * - */ - - function disableRule($name) - { - $name = ucwords(strtolower($name)); - $key = array_search($name, $this->disable); - if ($key === false) { - $this->disable[] = $name; - } - } - - - /** - * - * Parses and renders the text passed to it, and returns the results. - * - * First, the method parses the source text, applying rules to the - * text as it goes. These rules will modify the source text - * in-place, replacing some text with delimited tokens (and - * populating the $this->tokens array as it goes). - * - * Next, the method renders the in-place tokens into the requested - * output format. - * - * Finally, the method returns the transformed text. Note that the - * source text is transformed in place; once it is transformed, it is - * no longer the same as the original source text. - * - * @access public - * - * @param string $text The source text to which wiki rules should be - * applied, both for parsing and for rendering. - * - * @param string $format The target output format, typically 'xhtml'. - * If a rule does not support a given format, the output from that - * rule is rule-specific. - * - * @return string The transformed wiki text. - * - */ - - function transform($text, $format = 'Xhtml') - { - $this->parse($text); - return $this->render($format); - } - - - /** - * - * Sets the $_source text property, then parses it in place and - * retains tokens in the $_tokens array property. - * - * @access public - * - * @param string $text The source text to which wiki rules should be - * applied, both for parsing and for rendering. - * - * @return void - * - */ - - function parse($text) - { - // set the object property for the source text - $this->source = $text; - - // reset the tokens. - $this->tokens = array(); - $this->_countRulesTokens = array(); - - // apply the parse() method of each requested rule to the source - // text. - foreach ($this->rules as $name) { - // do not parse the rules listed in $disable - if ( ! in_array($name, $this->disable)) { - - // load the parsing object - $this->loadParseObj($name); - - // load may have failed; only parse if - // an object is in the array now - if (is_object($this->parseObj[$name])) { - $this->parseObj[$name]->parse(); - } - } - } - } - - - /** - * - * Renders tokens back into the source text, based on the requested format. - * - * @access public - * - * @param string $format The target output format, typically 'xhtml'. - * If a rule does not support a given format, the output from that - * rule is rule-specific. - * - * @return string The transformed wiki text. - * - */ - - function render($format = 'Xhtml') - { - // the rendering method we're going to use from each rule - $format = ucwords(strtolower($format)); - - // the eventual output text - $this->output = ''; - - // when passing through the parsed source text, keep track of when - // we are in a delimited section - $in_delim = false; - - // when in a delimited section, capture the token key number - $key = ''; - - // load the format object, or crap out if we can't find it - $result = $this->loadFormatObj($format); - if ($this->isError($result)) { - return $result; - } - - // pre-rendering activity - if (is_object($this->formatObj[$format])) { - $this->output .= $this->formatObj[$format]->pre(); - } - - // load the render objects - foreach (array_keys($this->_countRulesTokens) as $rule) { - $this->loadRenderObj($format, $rule); - } - - if ($this->renderingType == 'preg') { - $this->output .= preg_replace_callback('/'.$this->delim.'(\d+)'.$this->delim.'/', - array(&$this, '_renderToken'), - $this->source); - - /* -//Damn strtok()! Why does it "skip" empty parts of the string. It's useless now! - } elseif ($this->renderingType == 'strtok') { - echo '
    '.htmlentities($this->source).'
    '; - $t = strtok($this->source, $this->delim); - $inToken = true; - $i = 0; - while ($t !== false) { - echo 'Token: '.$i.'
    "'.htmlentities($t).'"


    '; - if ($inToken) { - //$this->output .= $this->renderObj[$this->tokens[$t][0]]->token($this->tokens[$t][1]); - } else { - $this->output .= $t; - } - $inToken = !$inToken; - $t = strtok($this->delim); - ++$i; - } - */ - } else { - // pass through the parsed source text character by character - $this->_block = ''; - $tokenStack = array(); - $k = strlen($this->source); - for ($i = 0; $i < $k; $i++) { - - // the current character - $char = $this->source{$i}; - - // are alredy in a delimited section? - if ($in_delim) { - - // yes; are we ending the section? - if ($char == $this->delim) { - - if (count($this->_renderCallbacks) == 0) { - $this->output .= $this->_block; - $this->_block = ''; - } - - if (isset($opts['type'])) { - if ($opts['type'] == 'start') { - array_push($tokenStack, $rule); - } elseif ($opts['type'] == 'end') { - if ($tokenStack[count($tokenStack) - 1] != $rule) { - return Text_Wiki::error('Unbalanced tokens, check your syntax'); - } else { - array_pop($tokenStack); - } - } - } - - // yes, get the replacement text for the delimited - // token number and unset the flag. - $key = (int)$key; - $rule = $this->tokens[$key][0]; - $opts = $this->tokens[$key][1]; - $this->_block .= $this->renderObj[$rule]->token($opts); - $in_delim = false; - - } else { - - // no, add to the delimited token key number - $key .= $char; - - } - - } else { - - // not currently in a delimited section. - // are we starting into a delimited section? - if ($char == $this->delim) { - // yes, reset the previous key and - // set the flag. - $key = ''; - $in_delim = true; - - } else { - // no, add to the output as-is - $this->_block .= $char; - } - } - } - } - - if (count($this->_renderCallbacks)) { - return $this->error('Render callbacks left over after processing finished'); - } - /* - while (count($this->_renderCallbacks)) { - $this->popRenderCallback(); - } - */ - if (strlen($this->_block)) { - $this->output .= $this->_block; - $this->_block = ''; - } - - // post-rendering activity - if (is_object($this->formatObj[$format])) { - $this->output .= $this->formatObj[$format]->post(); - } - - // return the rendered source text. - return $this->output; - } - - /** - * Renders a token, for use only as an internal callback - * - * @param array Matches from preg_rpelace_callback, [1] is the token number - * @return string The rendered text for the token - * @access private - */ - function _renderToken($matches) { - return $this->renderObj[$this->tokens[$matches[1]][0]]->token($this->tokens[$matches[1]][1]); - } - - function registerRenderCallback($callback) { - $this->_blocks[] = $this->_block; - $this->_block = ''; - $this->_renderCallbacks[] = $callback; - } - - function popRenderCallback() { - if (count($this->_renderCallbacks) == 0) { - return Text_Wiki::error('Render callback popped when no render callbacks in stack'); - } else { - $callback = array_pop($this->_renderCallbacks); - $this->_block = call_user_func($callback, $this->_block); - if (count($this->_blocks)) { - $parentBlock = array_pop($this->_blocks); - $this->_block = $parentBlock.$this->_block; - } - if (count($this->_renderCallbacks) == 0) { - $this->output .= $this->_block; - $this->_block = ''; - } - } - } - - /** - * - * Returns the parsed source text with delimited token placeholders. - * - * @access public - * - * @return string The parsed source text. - * - */ - - function getSource() - { - return $this->source; - } - - - /** - * - * Returns tokens that have been parsed out of the source text. - * - * @access public - * - * @param array $rules If an array of rule names is passed, only return - * tokens matching these rule names. If no array is passed, return all - * tokens. - * - * @return array An array of tokens. - * - */ - - function getTokens($rules = null) - { - if (is_null($rules)) { - return $this->tokens; - } else { - settype($rules, 'array'); - $result = array(); - foreach ($this->tokens as $key => $val) { - if (in_array($val[0], $rules)) { - $result[$key] = $val; - } - } - return $result; - } - } - - - /** - * - * Add a token to the Text_Wiki tokens array, and return a delimited - * token number. - * - * @access public - * - * @param array $options An associative array of options for the new - * token array element. The keys and values are specific to the - * rule, and may or may not be common to other rule options. Typical - * options keys are 'text' and 'type' but may include others. - * - * @param boolean $id_only If true, return only the token number, not - * a delimited token string. - * - * @return string|int By default, return the number of the - * newly-created token array element with a delimiter prefix and - * suffix; however, if $id_only is set to true, return only the token - * number (no delimiters). - * - */ - - function addToken($rule, $options = array(), $id_only = false) - { - // increment the token ID number. note that if you parse - // multiple times with the same Text_Wiki object, the ID number - // will not reset to zero. - static $id; - if ( ! isset($id)) { - $id = 0; - } else { - $id ++; - } - - // force the options to be an array - settype($options, 'array'); - - // add the token - $this->tokens[$id] = array( - 0 => $rule, - 1 => $options - ); - if ( ! isset($this->_countRulesTokens[$rule])) { - $this->_countRulesTokens[$rule] = 1; - } else { - ++$this->_countRulesTokens[$rule]; - } - - // return a value - if ($id_only) { - // return the last token number - return $id; - } else { - // return the token number with delimiters - return $this->delim . $id . $this->delim; - } - } - - - /** - * - * Set or re-set a token with specific information, overwriting any - * previous rule name and rule options. - * - * @access public - * - * @param int $id The token number to reset. - * - * @param int $rule The rule name to use. - * - * @param array $options An associative array of options for the - * token array element. The keys and values are specific to the - * rule, and may or may not be common to other rule options. Typical - * options keys are 'text' and 'type' but may include others. - * - * @return void - * - */ - - function setToken($id, $rule, $options = array()) - { - $oldRule = $this->tokens[$id][0]; - // reset the token - $this->tokens[$id] = array( - 0 => $rule, - 1 => $options - ); - if ($rule != $oldRule) { - if ( ! ($this->_countRulesTokens[$oldRule]--)) { - unset($this->_countRulesTokens[$oldRule]); - } - if ( ! isset($this->_countRulesTokens[$rule])) { - $this->_countRulesTokens[$rule] = 1; - } else { - ++$this->_countRulesTokens[$rule]; - } - } - } - - - /** - * - * Load a rule parser class file. - * - * @access public - * - * @return bool True if loaded, false if not. - * - */ - - function loadParseObj($rule) - { - $rule = ucwords(strtolower($rule)); - $file = $rule . '.php'; - $class = "Text_Wiki_Parse_$rule"; - - if ( ! class_exists($class)) { - $loc = $this->findFile('parse', $file); - if ($loc) { - // found the class - include_once $loc; - } else { - // can't find the class - $this->parseObj[$rule] = null; - // can't find the class - return $this->error( - "Parse rule '$rule' not found" - ); - } - } - - $this->parseObj[$rule] =& new $class($this); - - } - - - /** - * - * Load a rule-render class file. - * - * @access public - * - * @return bool True if loaded, false if not. - * - */ - - function loadRenderObj($format, $rule) - { - $format = ucwords(strtolower($format)); - $rule = ucwords(strtolower($rule)); - $file = "$format/$rule.php"; - $class = "Text_Wiki_Render_$format" . "_$rule"; - - if ( ! class_exists($class)) { - // load the class - $loc = $this->findFile('render', $file); - if ($loc) { - // found the class - include_once $loc; - } else { - // can't find the class - return $this->error( - "Render rule '$rule' in format '$format' not found" - ); - } - } - - $this->renderObj[$rule] =& new $class($this); - } - - - /** - * - * Load a format-render class file. - * - * @access public - * - * @return bool True if loaded, false if not. - * - */ - - function loadFormatObj($format) - { - $format = ucwords(strtolower($format)); - $file = $format . '.php'; - $class = "Text_Wiki_Render_$format"; - - if ( ! class_exists($class)) { - $loc = $this->findFile('render', $file); - if ($loc) { - // found the class - include_once $loc; - } else { - // can't find the class - return $this->error( - "Rendering format class '$class' not found" - ); - } - } - - $this->formatObj[$format] =& new $class($this); - } - - - /** - * - * Add a path to a path array. - * - * @access public - * - * @param string $type The path-type to add (parse or render). - * - * @param string $dir The directory to add to the path-type. - * - * @return void - * - */ - - function addPath($type, $dir) - { - $dir = $this->fixPath($dir); - if ( ! isset($this->path[$type])) { - $this->path[$type] = array($dir); - } else { - array_unshift($this->path[$type], $dir); - } - } - - - /** - * - * Get the current path array for a path-type. - * - * @access public - * - * @param string $type The path-type to look up (plugin, filter, or - * template). If not set, returns all path types. - * - * @return array The array of paths for the requested type. - * - */ - - function getPath($type = null) - { - if (is_null($type)) { - return $this->path; - } elseif ( ! isset($this->path[$type])) { - return array(); - } else { - return $this->path[$type]; - } - } - - - /** - * - * Searches a series of paths for a given file. - * - * @param array $type The type of paths to search (template, plugin, - * or filter). - * - * @param string $file The file name to look for. - * - * @return string|bool The full path and file name for the target file, - * or boolean false if the file is not found in any of the paths. - * - */ - - function findFile($type, $file) - { - // get the set of paths - $set = $this->getPath($type); - - // start looping through them - foreach ($set as $path) { - $fullname = $path . $file; - if (file_exists($fullname) && is_readable($fullname)) { - return $fullname; - } - } - - // could not find the file in the set of paths - return false; - } - - - /** - * - * Append a trailing '/' to paths, unless the path is empty. - * - * @access private - * - * @param string $path The file path to fix - * - * @return string The fixed file path - * - */ - - function fixPath($path) - { - $len = strlen($this->_dirSep); - - if ( ! empty($path) && - substr($path, -1 * $len, $len) != $this->_dirSep) { - return $path . $this->_dirSep; - } else { - return $path; - } - } - - - /** - * - * Simple error-object generator. - * - * @access public - * - * @param string $message The error message. - * - * @return object PEAR_Error - * - */ - - function &error($message) - { - if ( ! class_exists('PEAR_Error')) { - include_once 'PEAR.php'; - } - return PEAR::throwError($message); - } - - - /** - * - * Simple error checker. - * - * @access public - * - * @param mixed $obj Check if this is a PEAR_Error object or not. - * - * @return bool True if a PEAR_Error, false if not. - * - */ - - function isError(&$obj) - { - return is_a($obj, 'PEAR_Error'); - } -} - -?> diff --git a/vendor/Text/Wiki/Default.php b/vendor/Text/Wiki/Default.php deleted file mode 100644 index f7c702785..000000000 --- a/vendor/Text/Wiki/Default.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Default.php,v 1.1 2006/03/01 16:58:17 justinpatrin Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -require_once('Text/Wiki.php'); - -/** - * This is the parser for the Default ruleset. For now, this simply extends Text_Wiki. - * - * @category Text - * @package Text_Wiki - * @version Release: @package_version@ - * @author Justin Patrin - */ -class Text_Wiki_Default extends Text_Wiki { -} diff --git a/vendor/Text/Wiki/Parse.php b/vendor/Text/Wiki/Parse.php deleted file mode 100644 index 404c6128c..000000000 --- a/vendor/Text/Wiki/Parse.php +++ /dev/null @@ -1,264 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Parse.php,v 1.5 2005/07/29 08:57:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * Baseline rule class for extension into a "real" parser component. - * - * Text_Wiki_Rule classes do not stand on their own; they are called by a - * Text_Wiki object, typcially in the transform() method. Each rule class - * performs three main activities: parse, process, and render. - * - * The parse() method takes a regex and applies it to the whole block of - * source text at one time. Each match is sent as $matches to the - * process() method. - * - * The process() method acts on the matched text from the source, and - * then processes the source text is some way. This may mean the - * creation of a delimited token using addToken(). In every case, the - * process() method returns the text that should replace the matched text - * from parse(). - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Parse { - - - /** - * - * Configuration options for this parser rule. - * - * @access public - * - * @var string - * - */ - - var $conf = array(); - - - /** - * - * Regular expression to find matching text for this rule. - * - * @access public - * - * @var string - * - * @see parse() - * - */ - - var $regex = null; - - - /** - * - * The name of this rule for new token array elements. - * - * @access public - * - * @var string - * - */ - - var $rule = null; - - - /** - * - * A reference to the calling Text_Wiki object. - * - * This is needed so that each rule has access to the same source - * text, token set, URLs, interwiki maps, page names, etc. - * - * @access public - * - * @var object - */ - - var $wiki = null; - - - /** - * - * Constructor for this parser rule. - * - * @access public - * - * @param object &$obj The calling "parent" Text_Wiki object. - * - */ - - function Text_Wiki_Parse(&$obj) - { - // set the reference to the calling Text_Wiki object; - // this allows us access to the shared source text, token - // array, etc. - $this->wiki =& $obj; - - // set the name of this rule; generally used when adding - // to the tokens array. strip off the Text_Wiki_Parse_ portion. - // text_wiki_parse_ - // 0123456789012345 - $tmp = substr(get_class($this), 16); - $this->rule = ucwords(strtolower($tmp)); - - // override config options for the rule if specified - if (isset($this->wiki->parseConf[$this->rule]) && - is_array($this->wiki->parseConf[$this->rule])) { - - $this->conf = array_merge( - $this->conf, - $this->wiki->parseConf[$this->rule] - ); - - } - } - - - /** - * - * Abstrct method to parse source text for matches. - * - * Applies the rule's regular expression to the source text, passes - * every match to the process() method, and replaces the matched text - * with the results of the processing. - * - * @access public - * - * @see Text_Wiki_Parse::process() - * - */ - - function parse() - { - $this->wiki->source = preg_replace_callback( - $this->regex, - array(&$this, 'process'), - $this->wiki->source - ); - } - - - /** - * - * Abstract method to generate replacements for matched text. - * - * @access public - * - * @param array $matches An array of matches from the parse() method - * as generated by preg_replace_callback. $matches[0] is the full - * matched string, $matches[1] is the first matched pattern, - * $matches[2] is the second matched pattern, and so on. - * - * @return string The processed text replacement; defaults to the - * full matched string (i.e., no changes to the text). - * - * @see Text_Wiki_Parse::parse() - * - */ - - function process(&$matches) - { - return $matches[0]; - } - - - /** - * - * Simple method to safely get configuration key values. - * - * @access public - * - * @param string $key The configuration key. - * - * @param mixed $default If the key does not exist, return this value - * instead. - * - * @return mixed The configuration key value (if it exists) or the - * default value (if not). - * - */ - - function getConf($key, $default = null) - { - if (isset($this->conf[$key])) { - return $this->conf[$key]; - } else { - return $default; - } - } - - - /** - * - * Extract 'attribute="value"' portions of wiki markup. - * - * This kind of markup is typically used only in macros, but is useful - * anywhere. - * - * The syntax is pretty strict; there can be no spaces between the - * option name, the equals, and the first double-quote; the value - * must be surrounded by double-quotes. You can escape characters in - * the value with a backslash, and the backslash will be stripped for - * you. - * - * @access public - * - * @param string $text The "attributes" portion of markup. - * - * @return array An associative array of key-value pairs where the - * key is the option name and the value is the option value. - * - */ - - function getAttrs($text) - { - // find the =" sections; - $tmp = explode('="', trim($text)); - - // basic setup - $k = count($tmp) - 1; - $attrs = array(); - $key = null; - - // loop through the sections - foreach ($tmp as $i => $val) { - - // first element is always the first key - if ($i == 0) { - $key = trim($val); - continue; - } - - // find the last double-quote in the value. - // the part to the left is the value for the last key, - // the part to the right is the next key name - $pos = strrpos($val, '"'); - $attrs[$key] = stripslashes(substr($val, 0, $pos)); - $key = trim(substr($val, $pos+1)); - - } - - return $attrs; - - } -} -?> diff --git a/vendor/Text/Wiki/Parse/Default/Anchor.php b/vendor/Text/Wiki/Parse/Default/Anchor.php deleted file mode 100644 index 83dae3433..000000000 --- a/vendor/Text/Wiki/Parse/Default/Anchor.php +++ /dev/null @@ -1,87 +0,0 @@ - -* -* @author Paul M. Jones -* -* @license LGPL -* -* @version $Id: Anchor.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* This class implements a Text_Wiki_Parse to add an anchor target name -* in the wiki page. -* -* @author Manuel Holtgrewe -* -* @author Paul M. Jones -* -* @category Text -* -* @package Text_Wiki -* -*/ - -class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to find source text matching this - * rule. Looks like a macro: [[# anchor_name]] - * - * @access public - * - * @var string - * - */ - - var $regex = '/(\[\[# )([-_A-Za-z0-9.]+?)( .+)?(\]\])/i'; - - - /** - * - * Generates a token entry for the matched text. Token options are: - * - * 'text' => The full matched text, not including the tags. - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A delimited token number to be used as a placeholder in - * the source text. - * - */ - - function process(&$matches) { - - $name = $matches[2]; - $text = $matches[3]; - - $start = $this->wiki->addToken( - $this->rule, - array('type' => 'start', 'name' => $name) - ); - - $end = $this->wiki->addToken( - $this->rule, - array('type' => 'end', 'name' => $name) - ); - - // done, place the script output directly in the source - return $start . trim($text) . $end; - } -} -?> diff --git a/vendor/Text/Wiki/Parse/Default/Blockquote.php b/vendor/Text/Wiki/Parse/Default/Blockquote.php deleted file mode 100644 index 7e209726a..000000000 --- a/vendor/Text/Wiki/Parse/Default/Blockquote.php +++ /dev/null @@ -1,180 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Blockquote.php,v 1.4 2006/10/21 05:56:28 justinpatrin Exp $ -* -*/ - -/** -* -* Parse for block-quoted text. -* -* Find source text marked as a blockquote, identified by any number of -* greater-than signs '>' at the start of the line, followed by a space, -* and then the quote text; each '>' indicates an additional level of -* quoting. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse { - - - /** - * - * Regex for parsing the source text. - * - * @access public - * - * @var string - * - * @see parse() - * - */ - - var $regex = '/\n((\>).*\n)(?!(\>))/Us'; - - - /** - * - * Generates a replacement for the matched text. - * - * Token options are: - * - * 'type' => - * 'start' : the start of a blockquote - * 'end' : the end of a blockquote - * - * 'level' => the indent level (0 for the first level, 1 for the - * second, etc) - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A series of text and delimited tokens marking the different - * list text and list elements. - * - */ - - function process(&$matches) - { - // the replacement text we will return to parse() - $return = "\n"; - - // the list of post-processing matches - $list = array(); - - // $matches[1] is the text matched as a list set by parse(); - // create an array called $list that contains a new set of - // matches for the various list-item elements. - preg_match_all( - '=^(\>+) (.*\n)=Ums', - $matches[1], - $list, - PREG_SET_ORDER - ); - - $curLevel = 0; - - // loop through each list-item element. - foreach ($list as $key => $val) { - - // $val[0] is the full matched list-item line - // $val[1] is the number of initial '>' chars (indent level) - // $val[2] is the quote text - - // we number levels starting at 1, not zero - $level = strlen($val[1]); - - // add a level to the list? - while ($level > $curLevel) { - // the current indent level is greater than the number - // of stack elements, so we must be starting a new - // level. push the new level onto the stack with a - // dummy value (boolean true)... - ++$curLevel; - - //$return .= "\n"; - - // ...and add a start token to the return. - $return .= $this->wiki->addToken( - $this->rule, - array( - 'type' => 'start', - 'level' => $curLevel - ) - ); - - //$return .= "\n\n"; - } - - // remove a level? - while ($curLevel > $level) { - - // as long as the stack count is greater than the - // current indent level, we need to end list types. - // continue adding end-list tokens until the stack count - // and the indent level are the same. - - //$return .= "\n\n"; - - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => 'end', - 'level' => $curLevel - ) - ); - - //$return .= "\n"; - --$curLevel; - } - - // add the line text. - $return .= $val[2]; - } - - // the last char of the matched pattern must be \n but we don't - // want this to be inside the tokens - $return = substr($return, 0, -1); - - // the last line may have been indented. go through the stack - // and create end-tokens until the stack is empty. - //$return .= "\n"; - - while ($curLevel > 0) { - $return .= $this->wiki->addToken( - $this->rule, - array ( - 'type' => 'end', - 'level' => $curLevel - ) - ); - --$curLevel; - } - - // put back the trailing \n - $return .= "\n"; - - // we're done! send back the replacement text. - return $return; - } -} -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Default/Bold.php b/vendor/Text/Wiki/Parse/Default/Bold.php deleted file mode 100644 index c4c26afd0..000000000 --- a/vendor/Text/Wiki/Parse/Default/Bold.php +++ /dev/null @@ -1,79 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Bold.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* Parses for bold text. -* -* This class implements a Text_Wiki_Rule to find source text marked for -* strong emphasis (bold) as defined by text surrounded by three -* single-quotes. On parsing, the text itself is left in place, but the -* starting and ending instances of three single-quotes are replaced with -* tokens. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Bold extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to parse the source text and find - * matches conforming to this rule. Used by the parse() method. - * - * @access public - * - * @var string - * - * @see parse() - * - */ - - var $regex = "/'''(()|[^'].*)'''/U"; - - - /** - * - * Generates a replacement for the matched text. Token options are: - * - * 'type' => ['start'|'end'] The starting or ending point of the - * emphasized text. The text itself is left in the source. - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A pair of delimited tokens to be used as a placeholder in - * the source text surrounding the text to be emphasized. - * - */ - - function process(&$matches) - { - $start = $this->wiki->addToken($this->rule, array('type' => 'start')); - $end = $this->wiki->addToken($this->rule, array('type' => 'end')); - return $start . $matches[1] . $end; - } -} -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Default/Break.php b/vendor/Text/Wiki/Parse/Default/Break.php deleted file mode 100644 index fa0fd04ab..000000000 --- a/vendor/Text/Wiki/Parse/Default/Break.php +++ /dev/null @@ -1,72 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Break.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* Parses for explicit line breaks. -* -* This class implements a Text_Wiki_Parse to mark forced line breaks in the -* source text. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Break extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to parse the source text and find - * matches conforming to this rule. Used by the parse() method. - * - * @access public - * - * @var string - * - * @see parse() - * - */ - - var $regex = '/ _\n/'; - - - /** - * - * Generates a replacement token for the matched text. - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return string A delimited token to be used as a placeholder in - * the source text. - * - */ - - function process(&$matches) - { - return $this->wiki->addToken($this->rule); - } -} - -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Default/Center.php b/vendor/Text/Wiki/Parse/Default/Center.php deleted file mode 100644 index 43bed1809..000000000 --- a/vendor/Text/Wiki/Parse/Default/Center.php +++ /dev/null @@ -1,78 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Center.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* Parses for centered lines of text. -* -* This class implements a Text_Wiki_Parse to find lines marked for centering. -* The line must start with "= " (i.e., an equal-sign followed by a space). -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Center extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to find source text matching this - * rule. - * - * @access public - * - * @var string - * - */ - - var $regex = '/\n\= (.*?)\n/'; - - /** - * - * Generates a token entry for the matched text. - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A delimited token number to be used as a placeholder in - * the source text. - * - */ - - function process(&$matches) - { - $start = $this->wiki->addToken( - $this->rule, - array('type' => 'start') - ); - - $end = $this->wiki->addToken( - $this->rule, - array('type' => 'end') - ); - - return "\n" . $start . $matches[1] . $end . "\n"; - } -} -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Default/Code.php b/vendor/Text/Wiki/Parse/Default/Code.php deleted file mode 100644 index 0140e6ff8..000000000 --- a/vendor/Text/Wiki/Parse/Default/Code.php +++ /dev/null @@ -1,99 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Code.php,v 1.11 2007/06/09 23:11:25 justinpatrin Exp $ -* -*/ - -/** -* -* Parses for text marked as a code example block. -* -* This class implements a Text_Wiki_Parse to find sections marked as code -* examples. Blocks are marked as the string on a line by itself, -* followed by the inline code example, and terminated with the string -* on a line by itself. The code example is run through the -* native PHP highlight_string() function to colorize it, then surrounded -* with
    ...
    tags when rendered as XHTML. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Code extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to find source text matching this - * rule. - * - * @access public - * - * @var string - * - */ - -/* var $regex = '/^(\)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';*/ - var $regex = ';^]*)?>((?:(?R)|.*?)*)\n(\s|$);msi'; - - /** - * - * Generates a token entry for the matched text. Token options are: - * - * 'text' => The full matched text, not including the tags. - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A delimited token number to be used as a placeholder in - * the source text. - * - */ - - function process(&$matches) - { - // are there additional attribute arguments? - $args = trim($matches[1]); - - if ($args == '') { - $options = array( - 'text' => $matches[2], - 'attr' => array('type' => '') - ); - } else { - // get the attributes... - $attr = $this->getAttrs($args); - - // ... and make sure we have a 'type' - if ( ! isset($attr['type'])) { - $attr['type'] = ''; - } - - // retain the options - $options = array( - 'text' => $matches[2], - 'attr' => $attr - ); - } - - return $this->wiki->addToken($this->rule, $options) . $matches[3]; - } -} -?> diff --git a/vendor/Text/Wiki/Parse/Default/Colortext.php b/vendor/Text/Wiki/Parse/Default/Colortext.php deleted file mode 100644 index de976ab4a..000000000 --- a/vendor/Text/Wiki/Parse/Default/Colortext.php +++ /dev/null @@ -1,89 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Colortext.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* Parses for colorized text. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse { - - /** - * - * The regular expression used to parse the source text and find - * matches conforming to this rule. Used by the parse() method. - * - * @access public - * - * @var string - * - * @see parse() - * - */ - - var $regex = "/\#\#(.+?)\|(.+?)\#\#/"; - - - /** - * - * Generates a replacement for the matched text. Token options are: - * - * 'type' => ['start'|'end'] The starting or ending point of the - * emphasized text. The text itself is left in the source. - * - * 'color' => the color indicator - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return string A pair of delimited tokens to be used as a - * placeholder in the source text surrounding the text to be - * emphasized. - * - */ - - function process(&$matches) - { - $start = $this->wiki->addToken( - $this->rule, - array( - 'type' => 'start', - 'color' => $matches[1] - ) - ); - - $end = $this->wiki->addToken( - $this->rule, - array( - 'type' => 'end', - 'color' => $matches[1] - ) - ); - - return $start . $matches[2] . $end; - } -} -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Default/Deflist.php b/vendor/Text/Wiki/Parse/Default/Deflist.php deleted file mode 100644 index 807168400..000000000 --- a/vendor/Text/Wiki/Parse/Default/Deflist.php +++ /dev/null @@ -1,122 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Deflist.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* Parses for definition lists. -* -* This class implements a Text_Wiki_Parse to find source text marked as a -* definition list. In short, if a line starts with ':' then it is a -* definition list item; another ':' on the same line indicates the end -* of the definition term and the beginning of the definition narrative. -* The list items must be on sequential lines (no blank lines between -* them) -- a blank line indicates the beginning of a new list. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse { - - - /** - * - * The regular expression used to parse the source text and find - * matches conforming to this rule. Used by the parse() method. - * - * @access public - * - * @var string - * - * @see parse() - * - */ - - var $regex = '/\n((: ).*\n)(?!(: |\n))/Us'; - - - /** - * - * Generates a replacement for the matched text. Token options are: - * - * 'type' => - * 'list_start' : the start of a definition list - * 'list_end' : the end of a definition list - * 'term_start' : the start of a definition term - * 'term_end' : the end of a definition term - * 'narr_start' : the start of definition narrative - * 'narr_end' : the end of definition narrative - * 'unknown' : unknown type of definition portion - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A series of text and delimited tokens marking the different - * list text and list elements. - * - */ - - function process(&$matches) - { - // the replacement text we will return to parse() - $return = ''; - - // the list of post-processing matches - $list = array(); - - // start the deflist - $options = array('type' => 'list_start'); - $return .= $this->wiki->addToken($this->rule, $options); - - // $matches[1] is the text matched as a list set by parse(); - // create an array called $list that contains a new set of - // matches for the various definition-list elements. - preg_match_all( - '/^(: )(.*)?( : )(.*)?$/Ums', - $matches[1], - $list, - PREG_SET_ORDER - ); - - // add each term and narrative - foreach ($list as $key => $val) { - $return .= ( - $this->wiki->addToken($this->rule, array('type' => 'term_start')) . - trim($val[2]) . - $this->wiki->addToken($this->rule, array('type' => 'term_end')) . - $this->wiki->addToken($this->rule, array('type' => 'narr_start')) . - trim($val[4]) . - $this->wiki->addToken($this->rule, array('type' => 'narr_end')) - ); - } - - - // end the deflist - $options = array('type' => 'list_end'); - $return .= $this->wiki->addToken($this->rule, $options); - - // done! - return "\n" . $return . "\n\n"; - } -} -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Default/Delimiter.php b/vendor/Text/Wiki/Parse/Default/Delimiter.php deleted file mode 100644 index 811e8f5ba..000000000 --- a/vendor/Text/Wiki/Parse/Default/Delimiter.php +++ /dev/null @@ -1,80 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Delimiter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* Parses for Text_Wiki delimiter characters already in the source text. -* -* This class implements a Text_Wiki_Parse to find instances of the delimiter -* character already embedded in the source text; it extracts them and replaces -* them with a delimited token, then renders them as the delimiter itself -* when the target format is XHTML. -* -* @category Text -* -* @package Text_Wiki -* -* @author Paul M. Jones -* -*/ - -class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse { - - /** - * - * Constructor. Overrides the Text_Wiki_Parse constructor so that we - * can set the $regex property dynamically (we need to include the - * Text_Wiki $delim character. - * - * @param object &$obj The calling "parent" Text_Wiki object. - * - * @param string $name The token name to use for this rule. - * - */ - - function Text_Wiki_Parse_delimiter(&$obj) - { - parent::Text_Wiki_Parse($obj); - $this->regex = '/' . $this->wiki->delim . '/'; - } - - - /** - * - * Generates a token entry for the matched text. Token options are: - * - * 'text' => The full matched text. - * - * @access public - * - * @param array &$matches The array of matches from parse(). - * - * @return A delimited token number to be used as a placeholder in - * the source text. - * - */ - - function process(&$matches) - { - return $this->wiki->addToken( - $this->rule, - array('text' => $this->wiki->delim) - ); - } -} -?> \ No newline at end of file diff --git a/vendor/Text/Wiki/Parse/Default/Embed.php b/vendor/Text/Wiki/Parse/Default/Embed.php deleted file mode 100644 index 586134c9a..000000000 --- a/vendor/Text/Wiki/Parse/Default/Embed.php +++ /dev/null @@ -1,106 +0,0 @@ - -* -* @license LGPL -* -* @version $Id: Embed.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ -* -*/ - -/** -* -* Embeds the results of a PHP script at render-time. -* -* This class implements a Text_Wiki_Parse to embed the contents of a URL -* inside the page at render-time. Typically used to get script output. -* This differs from the 'include' rule, which incorporates results at -* parse-time; 'embed' output does not get parsed by Text_Wiki, while -* 'include' ouput does. -* -* This rule is inherently not secure; it allows cross-site scripting to -* occur if the embedded output has -'; - } - } else { - $js = ''; - } - return $js.' -
    -'; - case 'endContent': - return ' -
    -'; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Horiz.php b/vendor/Text/Wiki/Render/Xhtml/Horiz.php deleted file mode 100644 index 83370d907..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Horiz.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Horiz.php,v 1.7 2005/07/30 08:03:28 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders an horizontal bar in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Horiz extends Text_Wiki_Render { - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - $css = $this->formatConf(' class="%s"', 'css'); - return "\n"; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Html.php b/vendor/Text/Wiki/Render/Xhtml/Html.php deleted file mode 100644 index fae1239a7..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Html.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Html.php,v 1.5 2005/07/30 08:03:28 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders preformated html in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Html extends Text_Wiki_Render { - - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - return $options['text']; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Image.php b/vendor/Text/Wiki/Render/Xhtml/Image.php deleted file mode 100644 index 3ead33c80..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Image.php +++ /dev/null @@ -1,184 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Image.php,v 1.17 2007/03/15 15:04:50 justinpatrin Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class inserts an image in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render { - - var $conf = array( - 'base' => '/', - 'url_base' => null, - 'css' => null, - 'css_link' => null - ); - - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - // note the image source - $src = $options['src']; - - // is the source a local file or URL? - if (strpos($src, '://') === false) { - // the source refers to a local file. - // add the URL base to it. - $src = $this->getConf('base', '/') . $src; - } - - // stephane@metacites.net - // is the image clickable? - if (isset($options['attr']['link'])) { - // yes, the image is clickable. - // are we linked to a URL or a wiki page? - if (strpos($options['attr']['link'], '://')) { - // it's a URL, prefix the URL base - $href = $this->getConf('url_base') . $options['attr']['link']; - } else { - // it's a WikiPage; assume it exists. - /** @todo This needs to honor sprintf wikilinks (pmjones) */ - /** @todo This needs to honor interwiki (pmjones) */ - /** @todo This needs to honor freelinks (pmjones) */ - $href = $this->wiki->getRenderConf('xhtml', 'wikilink', 'view_url') . - $options['attr']['link']; - } - } else { - // image is not clickable. - $href = null; - } - // unset so it won't show up as an attribute - unset($options['attr']['link']); - - // stephane@metacites.net -- 25/07/2004 - // use CSS for all alignment - if (isset($options['attr']['align'])) { - // make sure we have a style attribute - if ( ! isset($options['attr']['style'])) { - // no style, set up a blank one - $options['attr']['style'] = ''; - } else { - // style exists, add a space - $options['attr']['style'] .= ' '; - } - - if ($options['attr']['align'] == 'center') { - // add a "center" style to the existing style. - $options['attr']['style'] .= - 'display: block; margin-left: auto; margin-right: auto;'; - } else { - // add a float style to the existing style - $options['attr']['style'] .= - 'float: '.$options['attr']['align']; - } - - // unset so it won't show up as an attribute - unset($options['attr']['align']); - } - - // stephane@metacites.net -- 25/07/2004 - // try to guess width and height - if ( ! isset($options['attr']['width']) && - ! isset($options['attr']['height'])) { - - // does the source refer to a local file or a URL? - if (strpos($src,'://')) { - // is a URL link - $imageFile = $src; - } elseif ($src[0] == '.') { - // reg at dav-muz dot net -- 2005-03-07 - // is a local file on relative path. - $imageFile = $src; # ...don't do anything because it's perfect! - } else { - // is a local file on absolute path. - $imageFile = $_SERVER['DOCUMENT_ROOT'] . $src; - } - - // attempt to get the image size - $imageSize = @getimagesize($imageFile); - - if (is_array($imageSize)) { - $options['attr']['width'] = $imageSize[0]; - $options['attr']['height'] = $imageSize[1]; - } - - } - - // start the HTML output - $output = 'formatConf(' class="%s"', 'css'); - - // add the attributes to the output, and be sure to - // track whether or not we find an "alt" attribute - $alt = false; - foreach ($options['attr'] as $key => $val) { - - // track the 'alt' attribute - if (strtolower($key) == 'alt') { - $alt = true; - } - - // the 'class' attribute overrides the CSS class conf - if (strtolower($key) == 'class') { - $css = null; - } - - $key = $this->textEncode($key); - $val = $this->textEncode($val); - $output .= " $key=\"$val\""; - } - - // always add an "alt" attribute per Stephane Solliec - if ( ! $alt) { - $alt = $this->textEncode(basename($options['src'])); - $output .= " alt=\"$alt\""; - } - - // end the image tag with the automatic CSS class (if any) - $output .= "$css />"; - - // was the image clickable? - if ($href) { - // yes, add the href and return - $href = $this->textEncode($href); - $css = $this->formatConf(' class="%s"', 'css_link'); - $output = "$output"; - } - - return $output; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Include.php b/vendor/Text/Wiki/Render/Xhtml/Include.php deleted file mode 100644 index d334c1ebb..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Include.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Include.php,v 1.6 2005/07/30 08:03:28 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders included maekup in XHTML. (empty) - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Include extends Text_Wiki_Render { - function token() - { - return ''; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Interwiki.php b/vendor/Text/Wiki/Render/Xhtml/Interwiki.php deleted file mode 100644 index ec1a58fcd..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Interwiki.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Interwiki.php,v 1.15 2007/03/15 00:08:47 justinpatrin Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders inter wikis links in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render { - - var $conf = array( - 'sites' => array( - 'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s', - 'Advogato' => 'http://advogato.org/%s', - 'Wiki' => 'http://c2.com/cgi/wiki?%s' - ), - 'target' => '_blank', - 'css' => null - ); - - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - $text = $options['text']; - if (isset($options['url'])) { - // calculated by the parser (e.g. Mediawiki) - $href = $options['url']; - } else { - $site = $options['site']; - // toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces) - $page = $this->urlEncode($options['page']); - - if (isset($this->conf['sites'][$site])) { - $href = $this->conf['sites'][$site]; - } else { - return $text; - } - - // old form where page is at end, - // or new form with %s placeholder for sprintf()? - if (strpos($href, '%s') === false) { - // use the old form - $href = $href . $page; - } else { - // use the new form - $href = sprintf($href, $page); - } - } - - // allow for alternative targets - $target = $this->getConf('target'); - - // build base link - $css = $this->formatConf(' class="%s"', 'css'); - $text = $this->textEncode($text); - $output = "textEncode($target); - $output .= " onclick=\"window.open(this.href, '$target');"; - $output .= " return false;\""; - } - - $output .= ">$text"; - - return $output; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Italic.php b/vendor/Text/Wiki/Render/Xhtml/Italic.php deleted file mode 100644 index 92f78dc92..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Italic.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Italic.php,v 1.7 2005/07/30 08:03:28 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders italic text in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Italic extends Text_Wiki_Render { - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - if ($options['type'] == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return ""; - } - - if ($options['type'] == 'end') { - return ''; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/List.php b/vendor/Text/Wiki/Render/Xhtml/List.php deleted file mode 100644 index 86ee2c831..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/List.php +++ /dev/null @@ -1,172 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: List.php,v 1.9 2005/11/06 10:38:22 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders bullet and ordered lists in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render { - - var $conf = array( - 'css_ol' => null, - 'css_ol_li' => null, - 'css_ul' => null, - 'css_ul_li' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * This rendering method is syntactically and semantically compliant - * with XHTML 1.1 in that sub-lists are part of the previous list item. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - // make nice variables (type, level, count) - extract($options); - - // set up indenting so that the results look nice; we do this - // in two steps to avoid str_pad mathematics. ;-) - $pad = str_pad('', $level, "\t"); - $pad = str_replace("\t", ' ', $pad); - - switch ($type) { - - case 'bullet_list_start': - - // build the base HTML - $css = $this->formatConf(' class="%s"', 'css_ul'); - $html = ""; - - /* - // if this is the opening block for the list, - // put an extra newline in front of it so the - // output looks nice. - if ($level == 0) { - $html = "\n$html"; - } - */ - - // done! - return $html; - break; - - case 'bullet_list_end': - - // build the base HTML - $html = "\n$pad"; - - // if this is the closing block for the list, - // put extra newlines after it so the output - // looks nice. - if ($level == 0) { - $html .= "\n\n"; - } - - // done! - return $html; - break; - - case 'number_list_start': - if (isset($format)) { - $format = ' type="' . $format . '"'; - } else { - $format = ''; - } - // build the base HTML - $css = $this->formatConf(' class="%s"', 'css_ol'); - $html = ""; - - /* - // if this is the opening block for the list, - // put an extra newline in front of it so the - // output looks nice. - if ($level == 0) { - $html = "\n$html"; - } - */ - - // done! - return $html; - break; - - case 'number_list_end': - - // build the base HTML - $html = "\n$pad"; - - // if this is the closing block for the list, - // put extra newlines after it so the output - // looks nice. - if ($level == 0) { - $html .= "\n\n"; - } - - // done! - return $html; - break; - - case 'bullet_item_start': - case 'number_item_start': - - // pick the proper CSS class - if ($type == 'bullet_item_start') { - $css = $this->formatConf(' class="%s"', 'css_ul_li'); - } else { - $css = $this->formatConf(' class="%s"', 'css_ol_li'); - } - - // build the base HTML - $html = "\n$pad"; - - // for the very first item in the list, do nothing. - // but for additional items, be sure to close the - // previous item. - if ($count > 0) { - $html = "$html"; - } - - // done! - return $html; - break; - - case 'bullet_item_end': - case 'number_item_end': - default: - // ignore item endings and all other types. - // item endings are taken care of by the other types - // depending on their place in the list. - return ''; - break; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Newline.php b/vendor/Text/Wiki/Render/Xhtml/Newline.php deleted file mode 100644 index 6efa7d63f..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Newline.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Newline.php,v 1.5 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders new lines in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Newline extends Text_Wiki_Render { - - - function token($options) - { - return "
    \n"; - } -} - -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Page.php b/vendor/Text/Wiki/Render/Xhtml/Page.php deleted file mode 100644 index a6640fe35..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Page.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Page.php,v 1.2 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders page markers in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Page extends Text_Wiki_Render { - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - return 'PAGE MARKER HERE*&^%$#^$%*PAGEMARKERHERE'; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Paragraph.php b/vendor/Text/Wiki/Render/Xhtml/Paragraph.php deleted file mode 100644 index a62e8c762..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Paragraph.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Paragraph.php,v 1.7 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders paragraphs in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Paragraph extends Text_Wiki_Render { - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - extract($options); //type - - if ($type == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return ""; - } - - if ($type == 'end') { - return "

    \n\n"; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Phplookup.php b/vendor/Text/Wiki/Render/Xhtml/Phplookup.php deleted file mode 100644 index 23b377ba3..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Phplookup.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Phplookup.php,v 1.12 2007/03/15 00:08:47 justinpatrin Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders a link to php functions description in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render { - - var $conf = array( - 'target' => '_blank', - 'css' => null - ); - - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - $text = trim($options['text']); - $css = $this->formatConf(' class="%s"', 'css'); - - // start the html - $output = "getConf('target', ''); - if ($target && $target != '_self') { - // use a "popup" window. this is XHTML compliant, suggested by - // Aaron Kalin. uses the $target as the new window name. - $target = $this->textEncode($target); - $output .= " onclick=\"window.open(this.href, '$target');"; - $output .= " return false;\""; - } - - // take off the final parens for functions - if (substr($text, -2) == '()') { - $q = substr($text, 0, -2); - } else { - $q = $text; - } - - // toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces) - $q = $this->urlEncode($q); - $text = $this->textEncode($text); - - // finish and return - $output .= " href=\"http://php.net/$q\">$text"; - return $output; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Plugin.php b/vendor/Text/Wiki/Render/Xhtml/Plugin.php deleted file mode 100644 index b1e8b572d..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Plugin.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Plugin.php,v 1.2 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders wiki plugins in XHTML. (empty) - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Plugin extends Text_Wiki_Render { - - /** - * - * Renders a token into text matching the requested format. - * Plugins produce wiki markup so are processed by parsing, no tokens produced - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - return ''; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Prefilter.php b/vendor/Text/Wiki/Render/Xhtml/Prefilter.php deleted file mode 100644 index 603cf2c8f..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Prefilter.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Prefilter.php,v 1.7 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class implements a Text_Wiki_Render_Xhtml to "pre-filter" source text so - * that line endings are consistently \n, lines ending in a backslash \ - * are concatenated with the next line, and tabs are converted to spaces. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Prefilter extends Text_Wiki_Render { - function token() - { - return ''; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Preformatted.php b/vendor/Text/Wiki/Render/Xhtml/Preformatted.php deleted file mode 100644 index ca12c37c4..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Preformatted.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Preformatted.php,v 1.3 2007/02/07 13:40:44 mic Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders preformated text in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Preformatted extends Text_Wiki_Render { - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - $text = $this->textEncode($options['text']); - return '
    '.$text.'
    '; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Raw.php b/vendor/Text/Wiki/Render/Xhtml/Raw.php deleted file mode 100644 index 54662c535..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Raw.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Raw.php,v 1.6 2006/06/09 21:32:24 justinpatrin Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders not processed blocks in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Raw extends Text_Wiki_Render { - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - return $this->textEncode($options['text']); - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Revise.php b/vendor/Text/Wiki/Render/Xhtml/Revise.php deleted file mode 100644 index 98d0e356f..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Revise.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Revise.php,v 1.7 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders revision marks in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Revise extends Text_Wiki_Render { - - var $conf = array( - 'css_ins' => null, - 'css_del' => null - ); - - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - if ($options['type'] == 'del_start') { - $css = $this->formatConf(' class="%s"', 'css_del'); - return ""; - } - - if ($options['type'] == 'del_end') { - return ""; - } - - if ($options['type'] == 'ins_start') { - $css = $this->formatConf(' class="%s"', 'css_ins'); - return ""; - } - - if ($options['type'] == 'ins_end') { - return ""; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Smiley.php b/vendor/Text/Wiki/Render/Xhtml/Smiley.php deleted file mode 100644 index a29490083..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Smiley.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @copyright 2005 bertrand Gugger - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Smiley.php,v 1.2 2006/02/10 23:07:03 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * Smiley rule Xhtml render class - * - * @category Text - * @package Text_Wiki - * @author Bertrand Gugger - * @copyright 2005 bertrand Gugger - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - * @see Text_Wiki::Text_Wiki_Render() - */ -class Text_Wiki_Render_Xhtml_Smiley extends Text_Wiki_Render { - - /** - * Configuration keys for this rule - * 'prefix' => the path to smileys images inclusive file name prefix, - * starts with '/' ==> abolute reference - * if no file names prefix but some folder, terminates with '/' - * 'extension' => the file extension (inclusive '.'), e.g. : - * if prefix 'smileys/icon_' and extension '.gif' - * ':)' whose name is 'smile' will give relative file 'smileys/icon_smile.gif' - * if prefix '/image/smileys/' and extension '.png': absolute '/image/smileys/smile.gif' - * 'css' => optional style applied to smileys - * - * @access public - * @var array 'config-key' => mixed config-value - */ - var $conf = array( - 'prefix' => 'images/smiles/icon_', - 'extension' => '.gif', - 'css' => null - ); - - /** - * Renders a token into text matching the requested format. - * process the Smileys - * - * @access public - * @param array $options The "options" portion of the token (second element). - * @return string The text rendered from the token options. - */ - function token($options) - { - $imageFile = $this->getConf('prefix') . $options['name'] . $this->getConf('extension'); - - // attempt to get the image size - $imageSize = @getimagesize($imageFile); - - // return the HTML output - return '' . $options['desc'] . 'formatConf(' class="%s"', 'css') . ' />'; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Specialchar.php b/vendor/Text/Wiki/Render/Xhtml/Specialchar.php deleted file mode 100644 index ed8559da3..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Specialchar.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Specialchar.php,v 1.2 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders special characters in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_SpecialChar extends Text_Wiki_Render { - - var $types = array('~bs~' => '\', - '~hs~' => ' ', - '~amp~' => '&', - '~ldq~' => '“', - '~rdq~' => '”', - '~lsq~' => '‘', - '~rsq~' => '’', - '~c~' => '©', - '~--~' => '—', - '" -- "' => '—', - '" -- "' => '—', - '~lt~' => '<', - '~gt~' => '>'); - - function token($options) - { - if (isset($this->types[$options['char']])) { - return $this->types[$options['char']]; - } else { - return '&#'.substr($options['char'], 1, -1).';'; - } - } -} - -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Strong.php b/vendor/Text/Wiki/Render/Xhtml/Strong.php deleted file mode 100644 index c84d499e8..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Strong.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Strong.php,v 1.7 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders text marked as strong in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Strong extends Text_Wiki_Render { - - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - if ($options['type'] == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return ""; - } - - if ($options['type'] == 'end') { - return ''; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Subscript.php b/vendor/Text/Wiki/Render/Xhtml/Subscript.php deleted file mode 100644 index 9e66f6c85..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Subscript.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Subscript.php,v 1.2 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders subscript text in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Subscript extends Text_Wiki_Render { - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - if ($options['type'] == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return ""; - } - - if ($options['type'] == 'end') { - return ''; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Superscript.php b/vendor/Text/Wiki/Render/Xhtml/Superscript.php deleted file mode 100644 index 3d9640c38..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Superscript.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Superscript.php,v 1.7 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders superscript text in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Superscript extends Text_Wiki_Render { - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - if ($options['type'] == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return ""; - } - - if ($options['type'] == 'end') { - return ''; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Table.php b/vendor/Text/Wiki/Render/Xhtml/Table.php deleted file mode 100644 index 3b8a34fea..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Table.php +++ /dev/null @@ -1,140 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Table.php,v 1.12 2005/12/06 15:29:29 ritzmo Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders tables in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render { - - var $conf = array( - 'css_table' => null, - 'css_caption' => null, - 'css_tr' => null, - 'css_th' => null, - 'css_td' => null - ); - - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - // make nice variable names (type, attr, span) - $span = $rowspan = 1; - extract($options); - - // free format - $format = isset($format) ? ' '. $format : ''; - - $pad = ' '; - - switch ($type) { - - case 'table_start': - $css = $this->formatConf(' class="%s"', 'css_table'); - return "\n\n\n"; - break; - - case 'table_end': - return "\n\n"; - break; - - case 'caption_start': - $css = $this->formatConf(' class="%s"', 'css_caption'); - return "\n"; - break; - - case 'caption_end': - return "\n"; - break; - - case 'row_start': - $css = $this->formatConf(' class="%s"', 'css_tr'); - return "$pad\n"; - break; - - case 'row_end': - return "$pad\n"; - break; - - case 'cell_start': - - // base html - $html = $pad . $pad; - - // is this a TH or TD cell? - if ($attr == 'header') { - // start a header cell - $css = $this->formatConf(' class="%s"', 'css_th'); - $html .= "formatConf(' class="%s"', 'css_td'); - $html .= " 1) { - $html .= " colspan=\"$span\""; - } - - // add the row span - if ($rowspan > 1) { - $html .= " rowspan=\"$rowspan\""; - } - - // add alignment - if ($attr != 'header' && $attr != '') { - $html .= " style=\"text-align: $attr;\""; - } - - // done! - $html .= "$format>"; - return $html; - break; - - case 'cell_end': - if ($attr == 'header') { - return "\n"; - } else { - return "\n"; - } - break; - - default: - return ''; - - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Tighten.php b/vendor/Text/Wiki/Render/Xhtml/Tighten.php deleted file mode 100644 index 44ebf673e..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Tighten.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Tighten.php,v 1.6 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class makes the tightening in XHTML. (empty) - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Tighten extends Text_Wiki_Render { - - - function token() - { - return ''; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Titlebar.php b/vendor/Text/Wiki/Render/Xhtml/Titlebar.php deleted file mode 100644 index 832db4455..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Titlebar.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Titlebar.php,v 1.2 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders a title bar in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Titlebar extends Text_Wiki_Render { - - var $conf = array( - 'css' => 'titlebar' - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - if ($options['type'] == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return ""; - } - - if ($options['type'] == 'end') { - return ''; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Toc.php b/vendor/Text/Wiki/Render/Xhtml/Toc.php deleted file mode 100644 index 28e7352fb..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Toc.php +++ /dev/null @@ -1,115 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Toc.php,v 1.9 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class inserts a table of content in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render { - - var $conf = array( - 'css_list' => null, - 'css_item' => null, - 'title' => 'Table of Contents', - 'div_id' => 'toc', - 'collapse' => true - ); - - var $min = 2; - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - // type, id, level, count, attr - extract($options); - - switch ($type) { - - case 'list_start': - - $css = $this->getConf('css_list'); - $html = ''; - - // collapse div within a table? - if ($this->getConf('collapse')) { - $html .= ''; - $html .= "
    \n"; - } - - // add the div, class, and id - $html .= 'getConf('div_id'); - if ($div_id) { - $html .= " id=\"$div_id\""; - } - - // add the title, and done - $html .= '>'; - $html .= $this->getConf('title'); - return $html; - break; - - case 'list_end': - if ($this->getConf('collapse')) { - return "\n\n
    \n\n"; - } else { - return "\n\n\n"; - } - break; - - case 'item_start': - $html = "\n\tgetConf('css_item'); - if ($css) { - $html .= " class=\"$css\""; - } - - $pad = ($level - $this->min); - $html .= " style=\"margin-left: {$pad}em;\">"; - - $html .= ""; - return $html; - break; - - case 'item_end': - return ""; - break; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Tt.php b/vendor/Text/Wiki/Render/Xhtml/Tt.php deleted file mode 100644 index c99a7cb15..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Tt.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Tt.php,v 1.7 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders monospaced text in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Tt extends Text_Wiki_Render { - - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - if ($options['type'] == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return ""; - } - - if ($options['type'] == 'end') { - return ''; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Underline.php b/vendor/Text/Wiki/Render/Xhtml/Underline.php deleted file mode 100644 index eb83d1ce0..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Underline.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Underline.php,v 1.2 2005/07/30 08:03:29 toggg Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders underlined text in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Underline extends Text_Wiki_Render { - - var $conf = array( - 'css' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - if ($options['type'] == 'start') { - $css = $this->formatConf(' class="%s"', 'css'); - return ""; - } - - if ($options['type'] == 'end') { - return ''; - } - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Url.php b/vendor/Text/Wiki/Render/Xhtml/Url.php deleted file mode 100644 index 41041ced7..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Url.php +++ /dev/null @@ -1,131 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Url.php,v 1.18 2007/05/26 17:15:41 mic Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders URL links in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render { - - - var $conf = array( - 'target' => '_blank', - 'images' => true, - 'img_ext' => array('jpg', 'jpeg', 'gif', 'png'), - 'css_inline' => null, - 'css_footnote' => null, - 'css_descr' => null, - 'css_img' => null - ); - - /** - * - * Renders a token into text matching the requested format. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - // create local variables from the options array (text, - // href, type) - extract($options); - - // find the rightmost dot and determine the filename - // extension. - $pos = strrpos($href, '.'); - $ext = strtolower(substr($href, $pos + 1)); - $href = $this->textEncode($href); - - // does the filename extension indicate an image file? - if ($this->getConf('images') && - in_array($ext, $this->getConf('img_ext', array()))) { - - // create alt text for the image - if ( ! isset($text) || $text == '') { - $text = basename($href); - $text = $this->textEncode($text); - } - - // generate an image tag - $css = $this->formatConf(' class="%s"', 'css_img'); - $start = ""; - - } else { - - // should we build a target clause? - if ($href{0} == '#' || - strtolower(substr($href, 0, 7)) == 'mailto:') { - // targets not allowed for on-page anchors - // and mailto: links. - $target = ''; - } else { - // allow targets on non-anchor non-mailto links - $target = $this->getConf('target'); - } - - // generate a regular link (not an image) - $text = $this->textEncode($text); - $css = $this->formatConf(' class="%s"', "css_$type"); - $start = "textEncode($target); - $start .= " onclick=\"window.open(this.href, '$target');"; - $start .= " return false;\""; - } - - if (isset($name)) { - $start .= " id=\"$name\""; - } - - // finish up output - $start .= ">"; - $end = ""; - - // make numbered references look like footnotes when no - // CSS class specified, make them superscript by default - if ($type == 'footnote' && ! $css) { - $start = '' . $start; - $end = $end . ''; - } - } - - if ($options['type'] == 'start') { - $output = $start; - } else if ($options['type'] == 'end') { - $output = $end; - } else { - $output = $start . $text . $end; - } - return $output; - } -} -?> diff --git a/vendor/Text/Wiki/Render/Xhtml/Wikilink.php b/vendor/Text/Wiki/Render/Xhtml/Wikilink.php deleted file mode 100644 index b706d0d84..000000000 --- a/vendor/Text/Wiki/Render/Xhtml/Wikilink.php +++ /dev/null @@ -1,177 +0,0 @@ - - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Wikilink.php,v 1.22 2006/12/08 21:25:24 justinpatrin Exp $ - * @link http://pear.php.net/package/Text_Wiki - */ - -/** - * This class renders wiki links in XHTML. - * - * @category Text - * @package Text_Wiki - * @author Paul M. Jones - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version Release: @package_version@ - * @link http://pear.php.net/package/Text_Wiki - */ -class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render { - - var $conf = array( - 'pages' => array(), // set to null or false to turn off page checks - 'view_url' => 'http://example.com/index.php?page=%s', - 'new_url' => 'http://example.com/new.php?page=%s', - 'new_text' => '?', - 'new_text_pos' => 'after', // 'before', 'after', or null/false - 'css' => null, - 'css_new' => null, - 'exists_callback' => null // call_user_func() callback - ); - - - /** - * - * Renders a token into XHTML. - * - * @access public - * - * @param array $options The "options" portion of the token (second - * element). - * - * @return string The text rendered from the token options. - * - */ - - function token($options) - { - // make nice variable names (page, anchor, text) - extract($options); - - // is there a "page existence" callback? - // we need to access it directly instead of through - // getConf() because we'll need a reference (for - // object instance method callbacks). - if (isset($this->conf['exists_callback'])) { - $callback =& $this->conf['exists_callback']; - } else { - $callback = false; - } - - if ($callback) { - // use the callback function - $exists = call_user_func($callback, $page); - } else { - // no callback, go to the naive page array. - $list = $this->getConf('pages'); - if (is_array($list)) { - // yes, check against the page list - $exists = in_array($page, $list); - } else { - // no, assume it exists - $exists = true; - } - } - - $anchor = '#'.$this->urlEncode(substr($anchor, 1)); - - // does the page exist? - if ($exists) { - - // PAGE EXISTS. - - // link to the page view, but we have to build - // the HREF. we support both the old form where - // the page always comes at the end, and the new - // form that uses %s for sprintf() - $href = $this->getConf('view_url'); - - if (strpos($href, '%s') === false) { - // use the old form (page-at-end) - $href = $href . $this->urlEncode($page) . $anchor; - } else { - // use the new form (sprintf format string) - $href = sprintf($href, $this->urlEncode($page)) . $anchor; - } - - // get the CSS class and generate output - $css = ' class="'.$this->textEncode($this->getConf('css')).'"'; - - $start = ''; - $end = ''; - } else { - - // PAGE DOES NOT EXIST. - - // link to a create-page url, but only if new_url is set - $href = $this->getConf('new_url', null); - - // set the proper HREF - if ( ! $href || trim($href) == '') { - - // no useful href, return the text as it is - //TODO: This is no longer used, need to look closer into this branch - $output = $text; - - } else { - - // yes, link to the new-page href, but we have to build - // it. we support both the old form where - // the page always comes at the end, and the new - // form that uses sprintf() - if (strpos($href, '%s') === false) { - // use the old form - $href = $href . $this->urlEncode($page); - } else { - // use the new form - $href = sprintf($href, $this->urlEncode($page)); - } - } - - // get the appropriate CSS class and new-link text - $css = ' class="'.$this->textEncode($this->getConf('css_new')).'"'; - $new = $this->getConf('new_text'); - - // what kind of linking are we doing? - $pos = $this->getConf('new_text_pos'); - if ( ! $pos || ! $new) { - // no position (or no new_text), use css only on the page name - - $start = ''; - $end = ''; - } elseif ($pos == 'before') { - // use the new_text BEFORE the page name - $start = ''.$this->textEncode($new).''; - $end = ''; - } else { - // default, use the new_text link AFTER the page name - $start = ''; - $end = ''.$this->textEncode($new).''; - } - } - if ( ! strlen($text)) { - $start .= $this->textEncode($page); - } - if (isset($type)) { - switch ($type) { - case 'start': - $output = $start; - break; - case 'end': - $output = $end; - break; - } - } else { - $output = $start.$this->textEncode($text).$end; - } - return $output; - } -} -?> diff --git a/vendor/spikephpcoverage/CoverageRecorder.php b/vendor/spikephpcoverage/CoverageRecorder.php deleted file mode 100644 index 4eab01664..000000000 --- a/vendor/spikephpcoverage/CoverageRecorder.php +++ /dev/null @@ -1,443 +0,0 @@ - - - * @version $Revision: 14665 $ - */ - class CoverageRecorder { - - // {{{ Members - - protected $includePaths; - protected $excludePaths; - protected $reporter; - protected $coverageData; - protected $isRemote = false; - protected $stripped = false; - protected $phpCoverageFiles = array("phpcoverage.inc.php"); - protected $version; - protected $logger; - - /** - * What extensions are treated as php files. - * - * @param "php" Array of extension strings - */ - protected $phpExtensions; - - // }}} - // {{{ Constructor - - /** - * Constructor (PHP5 only) - * - * @param $includePaths Directories to be included in code coverage report - * @param $excludePaths Directories to be excluded from code coverage report - * @param $reporter Instance of a Reporter subclass - * @access public - */ - public function __construct( - $includePaths=array("."), - $excludePaths=array(), - $reporter="new HtmlCoverageReporter()" - ) { - - $this->includePaths = $includePaths; - $this->excludePaths = $excludePaths; - $this->reporter = $reporter; - // Set back reference - $this->reporter->setCoverageRecorder($this); - $this->excludeCoverageDir(); - $this->version = "0.8"; - - // Configuration - global $spc_config; - $this->phpExtensions = $spc_config['extensions']; - global $util; - $this->logger = $util->getLogger(); - } - - // }}} - // {{{ public function startInstrumentation() - - /** - * Starts the code coverage recording - * - * @access public - */ - public function startInstrumentation() { - if(extension_loaded("xdebug")) { - xdebug_start_code_coverage(); - return true; - } - $this->logger->critical("[CoverageRecorder::startInstrumentation()] " - . "ERROR: Xdebug not loaded.", __FILE__, __LINE__); - return false; - } - - // }}} - // {{{ public function stopInstrumentation() - - /** - * Stops code coverage recording - * - * @access public - */ - public function stopInstrumentation() { - if(extension_loaded("xdebug")) { - $this->coverageData = xdebug_get_code_coverage(); - xdebug_stop_code_coverage(); - $this->logger->debug("[CoverageRecorder::stopInstrumentation()] Code coverage: " . print_r($this->coverageData, true), - __FILE__, __LINE__); - return true; - } - else { - $this->logger->critical("[CoverageRecorder::stopInstrumentation()] Xdebug not loaded.", __FILE__, __LINE__); - } - return false; - } - - // }}} - // {{{ public function generateReport() - - /** - * Generate the code coverage report - * - * @access public - */ - public function generateReport() { - if($this->isRemote) { - $this->logger->info("[CoverageRecorder::generateReport()] " - ."Writing report.", __FILE__, __LINE__); - } - else { - $this->logger->info("[CoverageRecorder::generateReport()] " - . "Writing report:\t\t", __FILE__, __LINE__); - } - $this->logger->debug("[CoverageRecoder::generateReport()] " . print_r($this->coverageData, true), - __FILE__, __LINE__); - $this->unixifyCoverageData(); - $this->coverageData = $this->stripCoverageData(); - $this->reporter->generateReport($this->coverageData); - if($this->isRemote) { - $this->logger->info("[CoverageRecorder::generateReport()] [done]", __FILE__, __LINE__); - } - else { - $this->logger->info("[done]", __FILE__, __LINE__); - } - } - - // }}} - /*{{{ protected function removeAbsentPaths() */ - - /** - * Remove the directories that do not exist from the input array - * - * @param &$dirs Array of directory names - * @access protected - */ - protected function removeAbsentPaths(&$dirs) { - for($i = 0; $i < count($dirs); $i++) { - if( ! file_exists($dirs[$i])) { - // echo "Not found: " . $dirs[$i] . "\n"; - $this->errors[] = "Not found: " . $dirs[$i] - . ". Removing ..."; - array_splice($dirs, $i, 1); - $i--; - } - else { - $dirs[$i] = realpath($dirs[$i]); - } - } - } - - /*}}}*/ - // {{{ protected function processSourcePaths() - - /** - * Processes and validates the source directories - * - * @access protected - */ - protected function processSourcePaths() { - $this->removeAbsentPaths($this->includePaths); - $this->removeAbsentPaths($this->excludePaths); - - sort($this->includePaths, SORT_STRING); - } - - // }}} - /*{{{ protected function getFilesAndDirs() */ - - /** - * Get the list of files that match the extensions in $this->phpExtensions - * - * @param $dir Root directory - * @param &$files Array of filenames to append to - * @access protected - */ - protected function getFilesAndDirs($dir, &$files) { - global $util; - $dirs[] = $dir; - while(count($dirs) > 0) { - $currDir = realpath(array_pop($dirs)); - if( ! is_readable($currDir)) { - continue; - } - //echo "Current Dir: $currDir \n"; - $currFiles = scandir($currDir); - //print_r($currFiles); - for($j = 0; $j < count($currFiles); $j++) { - if($currFiles[$j] == "." || $currFiles[$j] == "..") { - continue; - } - $currFiles[$j] = $currDir . "/" . $currFiles[$j]; - //echo "Current File: " . $currFiles[$j] . "\n"; - if(is_file($currFiles[$j])) { - $pathParts = pathinfo($currFiles[$j]); - if(isset($pathParts['extension']) && in_array($pathParts['extension'], $this->phpExtensions)) { - $files[] = $util->replaceBackslashes($currFiles[$j]); - } - } - if(is_dir($currFiles[$j])) { - $dirs[] = $currFiles[$j]; - } - } - } - } - - /*}}}*/ - /*{{{ protected function addFiles() */ - - /** - * Add all source files to the list of files that need to be parsed. - * - * @access protected - */ - protected function addFiles() { - global $util; - $files = array(); - for($i = 0; $i < count($this->includePaths); $i++) { - $this->includePaths[$i] = $util->replaceBackslashes($this->includePaths[$i]); - if(is_dir($this->includePaths[$i])) { - //echo "Calling getFilesAndDirs with " . $this->includePaths[$i] . "\n"; - $this->getFilesAndDirs($this->includePaths[$i], $files); - } - else if(is_file($this->includePaths[$i])) { - $files[] = $this->includePaths[$i]; - } - } - - $this->logger->debug("Found files:" . print_r($files, true), - __FILE__, __LINE__); - for($i = 0; $i < count($this->excludePaths); $i++) { - $this->excludePaths[$i] = $util->replaceBackslashes($this->excludePaths[$i]); - } - - for($i = 0; $i < count($files); $i++) { - for($j = 0; $j < count($this->excludePaths); $j++) { - $this->logger->debug($files[$i] . "\t" . $this->excludePaths[$j] . "\n", __FILE__, __LINE__); - if(strpos($files[$i], $this->excludePaths[$j]) === 0) { - continue; - } - } - if( ! array_key_exists($files[$i], $this->coverageData)) { - $this->coverageData[$files[$i]] = array(); - } - } - } - - /*}}}*/ - // {{{ protected function stripCoverageData() - - /** - * Removes the unwanted coverage data from the recordings - * - * @return Processed coverage data - * @access protected - */ - protected function stripCoverageData() { - if($this->stripped) { - $this->logger->debug("[CoverageRecorder::stripCoverageData()] Already stripped!", __FILE__, __LINE__); - return $this->coverageData; - } - $this->stripped = true; - if(empty($this->coverageData)) { - $this->logger->warn("[CoverageRecorder::stripCoverageData()] No coverage data found.", __FILE__, __LINE__); - return $this->coverageData; - } - $this->processSourcePaths(); - $this->logger->debug("!!!!!!!!!!!!! Source Paths !!!!!!!!!!!!!!", - __FILE__, __LINE__); - $this->logger->debug(print_r($this->includePaths, true), - __FILE__, __LINE__); - $this->logger->debug(print_r($this->excludePaths, true), - __FILE__, __LINE__); - $this->logger->debug("!!!!!!!!!!!!! Source Paths !!!!!!!!!!!!!!", - __FILE__, __LINE__); - $this->addFiles(); - $altCoverageData = array(); - foreach ($this->coverageData as $filename => &$lines) { - $preserve = false; - $realFile = $filename; - for($i = 0; $i < count($this->includePaths); $i++) { - if(strpos($realFile, $this->includePaths[$i]) === 0) { - $preserve = true; - } - else { - $this->logger->debug("File: " . $realFile - . "\nDoes not match: " . $this->includePaths[$i], - __FILE__, __LINE__); - } - } - // Exclude dirs have a precedence over includes. - for($i = 0; $i < count($this->excludePaths); $i++) { - if(strpos($realFile, $this->excludePaths[$i]) === 0) { - $preserve = false; - } - else if(in_array(basename($realFile), $this->phpCoverageFiles)) { - $preserve = false; - } - } - if($preserve) { - // Should be preserved - $altCoverageData[$filename] = $lines; - } - } - - array_multisort($altCoverageData, SORT_STRING); - return $altCoverageData; - } - - // }}} - /*{{{ protected function unixifyCoverageData() */ - - /** - * Convert filepaths in coverage data to forward slash separated - * paths. - * - * @access protected - */ - protected function unixifyCoverageData() { - global $util; - $tmpCoverageData = array(); - foreach($this->coverageData as $file => &$lines) { - $tmpCoverageData[$util->replaceBackslashes(realpath($file))] = $lines; - } - $this->coverageData = $tmpCoverageData; - } - - /*}}}*/ - // {{{ public function getErrors() - - /** - * Returns the errors array containing all error encountered so far. - * - * @return Array of error messages - * @access public - */ - public function getErrors() { - return $this->errors; - } - - // }}} - // {{{ public function logErrors() - - /** - * Writes all error messages to error log - * - * @access public - */ - public function logErrors() { - $this->logger->error(print_r($this->errors, true), - __FILE__, __LINE__); - } - - // }}} - /*{{{ Getters and Setters */ - - public function getIncludePaths() { - return $this->includePaths; - } - - public function setIncludePaths($includePaths) { - $this->includePaths = $includePaths; - } - - public function getExcludePaths() { - return $this->excludePaths; - } - - public function setExcludePaths($excludePaths) { - $this->excludePaths = $excludePaths; - $this->excludeCoverageDir(); - } - - public function getReporter() { - return $this->reporter; - } - - public function setReporter(&$reporter) { - $this->reporter = $reporter; - } - - public function getPhpExtensions() { - return $this->phpExtensions; - } - - public function setPhpExtensions(&$extensions) { - $this->phpExtensions = $extensions; - } - - public function getVersion() { - return $this->version; - } - - /*}}}*/ - /*{{{ public function excludeCoverageDir() */ - - /** - * Exclude the directory containing the coverage measurement code. - * - * @access public - */ - public function excludeCoverageDir() { - $f = __FILE__; - if(is_link($f)) { - $f = readlink($f); - } - $this->excludePaths[] = realpath(dirname($f)); - } - /*}}}*/ - } -?> diff --git a/vendor/spikephpcoverage/PEAR.php b/vendor/spikephpcoverage/PEAR.php deleted file mode 100644 index 1626126e1..000000000 --- a/vendor/spikephpcoverage/PEAR.php +++ /dev/null @@ -1,1055 +0,0 @@ - | -// | Stig Bakken | -// | Tomas V.V.Cox | -// +--------------------------------------------------------------------+ -// -// $Id: PEAR.php,v 1.82.2.1 2005/03/28 16:46:06 cellog Exp $ -// - -define('PEAR_ERROR_RETURN', 1); -define('PEAR_ERROR_PRINT', 2); -define('PEAR_ERROR_TRIGGER', 4); -define('PEAR_ERROR_DIE', 8); -define('PEAR_ERROR_CALLBACK', 16); -/** - * WARNING: obsolete - * @deprecated - */ -define('PEAR_ERROR_EXCEPTION', 32); -define('PEAR_ZE2', (function_exists('version_compare') && - version_compare(zend_version(), "2-dev", "ge"))); - -if (substr(PHP_OS, 0, 3) == 'WIN') { - define('OS_WINDOWS', true); - define('OS_UNIX', false); - define('PEAR_OS', 'Windows'); -} else { - define('OS_WINDOWS', false); - define('OS_UNIX', true); - define('PEAR_OS', 'Unix'); // blatant assumption -} - -// instant backwards compatibility -if ( ! defined('PATH_SEPARATOR')) { - if (OS_WINDOWS) { - define('PATH_SEPARATOR', ';'); - } else { - define('PATH_SEPARATOR', ':'); - } -} - -$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; -$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; -$GLOBALS['_PEAR_destructor_object_list'] = array(); -$GLOBALS['_PEAR_shutdown_funcs'] = array(); -$GLOBALS['_PEAR_error_handler_stack'] = array(); - -@ini_set('track_errors', true); - -/** - * Base class for other PEAR classes. Provides rudimentary - * emulation of destructors. - * - * If you want a destructor in your class, inherit PEAR and make a - * destructor method called _yourclassname (same name as the - * constructor, but with a "_" prefix). Also, in your constructor you - * have to call the PEAR constructor: $this->PEAR();. - * The destructor method will be called without parameters. Note that - * at in some SAPI implementations (such as Apache), any output during - * the request shutdown (in which destructors are called) seems to be - * discarded. If you need to get any debug information from your - * destructor, use error_log(), syslog() or something similar. - * - * IMPORTANT! To use the emulated destructors you need to create the - * objects by reference: $obj =& new PEAR_child; - * - * @since PHP 4.0.2 - * @author Stig Bakken - * @see http://pear.php.net/manual/ - */ -class PEAR -{ - // {{{ properties - - /** - * Whether to enable internal debug messages. - * - * @var bool - * @access private - */ - var $_debug = false; - - /** - * Default error mode for this object. - * - * @var int - * @access private - */ - var $_default_error_mode = null; - - /** - * Default error options used for this object when error mode - * is PEAR_ERROR_TRIGGER. - * - * @var int - * @access private - */ - var $_default_error_options = null; - - /** - * Default error handler (callback) for this object, if error mode is - * PEAR_ERROR_CALLBACK. - * - * @var string - * @access private - */ - var $_default_error_handler = ''; - - /** - * Which class to use for error objects. - * - * @var string - * @access private - */ - var $_error_class = 'PEAR_Error'; - - /** - * An array of expected errors. - * - * @var array - * @access private - */ - var $_expected_errors = array(); - - // }}} - - // {{{ constructor - - /** - * Constructor. Registers this object in - * $_PEAR_destructor_object_list for destructor emulation if a - * destructor object exists. - * - * @param string $error_class (optional) which class to use for - * error objects, defaults to PEAR_Error. - * @access public - * @return void - */ - function PEAR($error_class = null) - { - $classname = strtolower(get_class($this)); - if ($this->_debug) { - print "PEAR constructor called, class=$classname\n"; - } - if ($error_class !== null) { - $this->_error_class = $error_class; - } - while ($classname && strcasecmp($classname, "pear")) { - $destructor = "_$classname"; - if (method_exists($this, $destructor)) { - global $_PEAR_destructor_object_list; - $_PEAR_destructor_object_list[] = &$this; - if ( ! isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { - register_shutdown_function("_PEAR_call_destructors"); - $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; - } - break; - } else { - $classname = get_parent_class($classname); - } - } - } - - // }}} - // {{{ destructor - - /** - * Destructor (the emulated type of...). Does nothing right now, - * but is included for forward compatibility, so subclass - * destructors should always call it. - * - * See the note in the class desciption about output from - * destructors. - * - * @access public - * @return void - */ - function _PEAR() { - if ($this->_debug) { - printf("PEAR destructor called, class=%s\n", strtolower(get_class($this))); - } - } - - // }}} - // {{{ getStaticProperty() - - /** - * If you have a class that's mostly/entirely static, and you need static - * properties, you can use this method to simulate them. Eg. in your method(s) - * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); - * You MUST use a reference, or they will not persist! - * - * @access public - * @param string $class The calling classname, to prevent clashes - * @param string $var The variable to retrieve. - * @return mixed A reference to the variable. If not set it will be - * auto initialised to NULL. - */ - function &getStaticProperty($class, $var) - { - static $properties; - return $properties[$class][$var]; - } - - // }}} - // {{{ registerShutdownFunc() - - /** - * Use this function to register a shutdown method for static - * classes. - * - * @access public - * @param mixed $func The function name (or array of class/method) to call - * @param mixed $args The arguments to pass to the function - * @return void - */ - function registerShutdownFunc($func, $args = array()) - { - $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); - } - - // }}} - // {{{ isError() - - /** - * Tell whether a value is a PEAR error. - * - * @param mixed $data the value to test - * @param int $code if $data is an error object, return true - * only if $code is a string and - * $obj->getMessage() == $code or - * $code is an integer and $obj->getCode() == $code - * @access public - * @return bool true if parameter is an error - */ - function isError($data, $code = null) - { - if (is_a($data, 'PEAR_Error')) { - if (is_null($code)) { - return true; - } elseif (is_string($code)) { - return $data->getMessage() == $code; - } else { - return $data->getCode() == $code; - } - } - return false; - } - - // }}} - // {{{ setErrorHandling() - - /** - * Sets how errors generated by this object should be handled. - * Can be invoked both in objects and statically. If called - * statically, setErrorHandling sets the default behaviour for all - * PEAR objects. If called in an object, setErrorHandling sets - * the default behaviour for that object. - * - * @param int $mode - * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, - * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, - * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION. - * - * @param mixed $options - * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one - * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). - * - * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected - * to be the callback function or method. A callback - * function is a string with the name of the function, a - * callback method is an array of two elements: the element - * at index 0 is the object, and the element at index 1 is - * the name of the method to call in the object. - * - * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is - * a printf format string used when printing the error - * message. - * - * @access public - * @return void - * @see PEAR_ERROR_RETURN - * @see PEAR_ERROR_PRINT - * @see PEAR_ERROR_TRIGGER - * @see PEAR_ERROR_DIE - * @see PEAR_ERROR_CALLBACK - * @see PEAR_ERROR_EXCEPTION - * - * @since PHP 4.0.5 - */ - - function setErrorHandling($mode = null, $options = null) - { - if (isset($this) && is_a($this, 'PEAR')) { - $setmode = &$this->_default_error_mode; - $setoptions = &$this->_default_error_options; - } else { - $setmode = &$GLOBALS['_PEAR_default_error_mode']; - $setoptions = &$GLOBALS['_PEAR_default_error_options']; - } - - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $setmode = $mode; - $setoptions = $options; - break; - - case PEAR_ERROR_CALLBACK: - $setmode = $mode; - // class/object method callback - if (is_callable($options)) { - $setoptions = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - } - - // }}} - // {{{ expectError() - - /** - * This method is used to tell which errors you expect to get. - * Expected errors are always returned with error mode - * PEAR_ERROR_RETURN. Expected error codes are stored in a stack, - * and this method pushes a new element onto it. The list of - * expected errors are in effect until they are popped off the - * stack with the popExpect() method. - * - * Note that this method can not be called statically - * - * @param mixed $code a single error code or an array of error codes to expect - * - * @return int the new depth of the "expected errors" stack - * @access public - */ - function expectError($code = '*') - { - if (is_array($code)) { - array_push($this->_expected_errors, $code); - } else { - array_push($this->_expected_errors, array($code)); - } - return sizeof($this->_expected_errors); - } - - // }}} - // {{{ popExpect() - - /** - * This method pops one element off the expected error codes - * stack. - * - * @return array the list of error codes that were popped - */ - function popExpect() - { - return array_pop($this->_expected_errors); - } - - // }}} - // {{{ _checkDelExpect() - - /** - * This method checks unsets an error code if available - * - * @param mixed error code - * @return bool true if the error code was unset, false otherwise - * @access private - * @since PHP 4.3.0 - */ - function _checkDelExpect($error_code) - { - $deleted = false; - - foreach ($this->_expected_errors AS $key => $error_array) { - if (in_array($error_code, $error_array)) { - unset($this->_expected_errors[$key][array_search($error_code, $error_array)]); - $deleted = true; - } - - // clean up empty arrays - if (0 == count($this->_expected_errors[$key])) { - unset($this->_expected_errors[$key]); - } - } - return $deleted; - } - - // }}} - // {{{ delExpect() - - /** - * This method deletes all occurences of the specified element from - * the expected error codes stack. - * - * @param mixed $error_code error code that should be deleted - * @return mixed list of error codes that were deleted or error - * @access public - * @since PHP 4.3.0 - */ - function delExpect($error_code) - { - $deleted = false; - - if ((is_array($error_code) && (0 != count($error_code)))) { - // $error_code is a non-empty array here; - // we walk through it trying to unset all - // values - foreach($error_code as $key => $error) { - if ($this->_checkDelExpect($error)) { - $deleted = true; - } else { - $deleted = false; - } - } - return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME - } elseif ( ! empty($error_code)) { - // $error_code comes alone, trying to unset it - if ($this->_checkDelExpect($error_code)) { - return true; - } else { - return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME - } - } else { - // $error_code is empty - return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME - } - } - - // }}} - // {{{ raiseError() - - /** - * This method is a wrapper that returns an instance of the - * configured error class with this object's default error - * handling applied. If the $mode and $options parameters are not - * specified, the object's defaults are used. - * - * @param mixed $message a text error message or a PEAR error object - * - * @param int $code a numeric error code (it is up to your class - * to define these if you want to use codes) - * - * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, - * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, - * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION. - * - * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter - * specifies the PHP-internal error level (one of - * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). - * If $mode is PEAR_ERROR_CALLBACK, this - * parameter specifies the callback function or - * method. In other error modes this parameter - * is ignored. - * - * @param string $userinfo If you need to pass along for example debug - * information, this parameter is meant for that. - * - * @param string $error_class The returned error object will be - * instantiated from this class, if specified. - * - * @param bool $skipmsg If true, raiseError will only pass error codes, - * the error message parameter will be dropped. - * - * @access public - * @return object a PEAR error object - * @see PEAR::setErrorHandling - * @since PHP 4.0.5 - */ - function raiseError($message = null, - $code = null, - $mode = null, - $options = null, - $userinfo = null, - $error_class = null, - $skipmsg = false) - { - // The error is yet a PEAR error object - if (is_object($message)) { - $code = $message->getCode(); - $userinfo = $message->getUserInfo(); - $error_class = $message->getType(); - $message->error_message_prefix = ''; - $message = $message->getMessage(); - } - - if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) { - if ($exp[0] == "*" || - (is_int(reset($exp)) && in_array($code, $exp)) || - (is_string(reset($exp)) && in_array($message, $exp))) { - $mode = PEAR_ERROR_RETURN; - } - } - // No mode given, try global ones - if ($mode === null) { - // Class error handler - if (isset($this) && isset($this->_default_error_mode)) { - $mode = $this->_default_error_mode; - $options = $this->_default_error_options; - // Global error handler - } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) { - $mode = $GLOBALS['_PEAR_default_error_mode']; - $options = $GLOBALS['_PEAR_default_error_options']; - } - } - - if ($error_class !== null) { - $ec = $error_class; - } elseif (isset($this) && isset($this->_error_class)) { - $ec = $this->_error_class; - } else { - $ec = 'PEAR_Error'; - } - if ($skipmsg) { - return new $ec($code, $mode, $options, $userinfo); - } else { - return new $ec($message, $code, $mode, $options, $userinfo); - } - } - - // }}} - // {{{ throwError() - - /** - * Simpler form of raiseError with fewer options. In most cases - * message, code and userinfo are enough. - * - * @param string $message - * - */ - function throwError($message = null, - $code = null, - $userinfo = null) - { - if (isset($this) && is_a($this, 'PEAR')) { - return $this->raiseError($message, $code, null, null, $userinfo); - } else { - return PEAR::raiseError($message, $code, null, null, $userinfo); - } - } - - // }}} - function staticPushErrorHandling($mode, $options = null) - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - $def_mode = &$GLOBALS['_PEAR_default_error_mode']; - $def_options = &$GLOBALS['_PEAR_default_error_options']; - $stack[] = array($def_mode, $def_options); - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $def_mode = $mode; - $def_options = $options; - break; - - case PEAR_ERROR_CALLBACK: - $def_mode = $mode; - // class/object method callback - if (is_callable($options)) { - $def_options = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - $stack[] = array($mode, $options); - return true; - } - - function staticPopErrorHandling() - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - $setmode = &$GLOBALS['_PEAR_default_error_mode']; - $setoptions = &$GLOBALS['_PEAR_default_error_options']; - array_pop($stack); - list($mode, $options) = $stack[sizeof($stack) - 1]; - array_pop($stack); - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $setmode = $mode; - $setoptions = $options; - break; - - case PEAR_ERROR_CALLBACK: - $setmode = $mode; - // class/object method callback - if (is_callable($options)) { - $setoptions = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - return true; - } - - // {{{ pushErrorHandling() - - /** - * Push a new error handler on top of the error handler options stack. With this - * you can easily override the actual error handler for some code and restore - * it later with popErrorHandling. - * - * @param mixed $mode (same as setErrorHandling) - * @param mixed $options (same as setErrorHandling) - * - * @return bool Always true - * - * @see PEAR::setErrorHandling - */ - function pushErrorHandling($mode, $options = null) - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - if (isset($this) && is_a($this, 'PEAR')) { - $def_mode = &$this->_default_error_mode; - $def_options = &$this->_default_error_options; - } else { - $def_mode = &$GLOBALS['_PEAR_default_error_mode']; - $def_options = &$GLOBALS['_PEAR_default_error_options']; - } - $stack[] = array($def_mode, $def_options); - - if (isset($this) && is_a($this, 'PEAR')) { - $this->setErrorHandling($mode, $options); - } else { - PEAR::setErrorHandling($mode, $options); - } - $stack[] = array($mode, $options); - return true; - } - - // }}} - // {{{ popErrorHandling() - - /** - * Pop the last error handler used - * - * @return bool Always true - * - * @see PEAR::pushErrorHandling - */ - function popErrorHandling() - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - array_pop($stack); - list($mode, $options) = $stack[sizeof($stack) - 1]; - array_pop($stack); - if (isset($this) && is_a($this, 'PEAR')) { - $this->setErrorHandling($mode, $options); - } else { - PEAR::setErrorHandling($mode, $options); - } - return true; - } - - // }}} - // {{{ loadExtension() - - /** - * OS independant PHP extension load. Remember to take care - * on the correct extension name for case sensitive OSes. - * - * @param string $ext The extension name - * @return bool Success or not on the dl() call - */ - function loadExtension($ext) - { - if ( ! extension_loaded($ext)) { - // if either returns true dl() will produce a FATAL error, stop that - if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) { - return false; - } - if (OS_WINDOWS) { - $suffix = '.dll'; - } elseif (PHP_OS == 'HP-UX') { - $suffix = '.sl'; - } elseif (PHP_OS == 'AIX') { - $suffix = '.a'; - } elseif (PHP_OS == 'OSX') { - $suffix = '.bundle'; - } else { - $suffix = '.so'; - } - return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); - } - return true; - } - - // }}} -} - -// {{{ _PEAR_call_destructors() - -function _PEAR_call_destructors() -{ - global $_PEAR_destructor_object_list; - if (is_array($_PEAR_destructor_object_list) && - sizeof($_PEAR_destructor_object_list)) - { - reset($_PEAR_destructor_object_list); - if (@PEAR::getStaticProperty('PEAR', 'destructlifo')) { - $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list); - } - while (list($k, $objref) = each($_PEAR_destructor_object_list)) { - $classname = get_class($objref); - while ($classname) { - $destructor = "_$classname"; - if (method_exists($objref, $destructor)) { - $objref->$destructor(); - break; - } else { - $classname = get_parent_class($classname); - } - } - } - // Empty the object list to ensure that destructors are - // not called more than once. - $_PEAR_destructor_object_list = array(); - } - - // Now call the shutdown functions - if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) { - foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) { - call_user_func_array($value[0], $value[1]); - } - } -} - -// }}} - -class PEAR_Error -{ - // {{{ properties - - var $error_message_prefix = ''; - var $mode = PEAR_ERROR_RETURN; - var $level = E_USER_NOTICE; - var $code = -1; - var $message = ''; - var $userinfo = ''; - var $backtrace = null; - - // }}} - // {{{ constructor - - /** - * PEAR_Error constructor - * - * @param string $message message - * - * @param int $code (optional) error code - * - * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN, - * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER, - * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION - * - * @param mixed $options (optional) error level, _OR_ in the case of - * PEAR_ERROR_CALLBACK, the callback function or object/method - * tuple. - * - * @param string $userinfo (optional) additional user/debug info - * - * @access public - * - */ - function PEAR_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { - if ($mode === null) { - $mode = PEAR_ERROR_RETURN; - } - $this->message = $message; - $this->code = $code; - $this->mode = $mode; - $this->userinfo = $userinfo; - if (function_exists("debug_backtrace")) { - if (@!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { - $this->backtrace = debug_backtrace(); - } - } - if ($mode & PEAR_ERROR_CALLBACK) { - $this->level = E_USER_NOTICE; - $this->callback = $options; - } else { - if ($options === null) { - $options = E_USER_NOTICE; - } - $this->level = $options; - $this->callback = null; - } - if ($this->mode & PEAR_ERROR_PRINT) { - if (is_null($options) || is_int($options)) { - $format = "%s"; - } else { - $format = $options; - } - printf($format, $this->getMessage()); - } - if ($this->mode & PEAR_ERROR_TRIGGER) { - trigger_error($this->getMessage(), $this->level); - } - if ($this->mode & PEAR_ERROR_DIE) { - $msg = $this->getMessage(); - if (is_null($options) || is_int($options)) { - $format = "%s"; - if (substr($msg, -1) != "\n") { - $msg .= "\n"; - } - } else { - $format = $options; - } - die(sprintf($format, $msg)); - } - if ($this->mode & PEAR_ERROR_CALLBACK) { - if (is_callable($this->callback)) { - call_user_func($this->callback, $this); - } - } - if ($this->mode & PEAR_ERROR_EXCEPTION) { - trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions", E_USER_WARNING); - eval('$e = new Exception($this->message, $this->code);$e->PEAR_Error = $this;throw($e);'); - } - } - - // }}} - // {{{ getMode() - - /** - * Get the error mode from an error object. - * - * @return int error mode - * @access public - */ - function getMode() { - return $this->mode; - } - - // }}} - // {{{ getCallback() - - /** - * Get the callback function/method from an error object. - * - * @return mixed callback function or object/method array - * @access public - */ - function getCallback() { - return $this->callback; - } - - // }}} - // {{{ getMessage() - - - /** - * Get the error message from an error object. - * - * @return string full error message - * @access public - */ - function getMessage() - { - return ($this->error_message_prefix . $this->message); - } - - - // }}} - // {{{ getCode() - - /** - * Get error code from an error object - * - * @return int error code - * @access public - */ - function getCode() - { - return $this->code; - } - - // }}} - // {{{ getType() - - /** - * Get the name of this error/exception. - * - * @return string error/exception name (type) - * @access public - */ - function getType() - { - return get_class($this); - } - - // }}} - // {{{ getUserInfo() - - /** - * Get additional user-supplied information. - * - * @return string user-supplied information - * @access public - */ - function getUserInfo() - { - return $this->userinfo; - } - - // }}} - // {{{ getDebugInfo() - - /** - * Get additional debug information supplied by the application. - * - * @return string debug information - * @access public - */ - function getDebugInfo() - { - return $this->getUserInfo(); - } - - // }}} - // {{{ getBacktrace() - - /** - * Get the call backtrace from where the error was generated. - * Supported with PHP 4.3.0 or newer. - * - * @param int $frame (optional) what frame to fetch - * @return array Backtrace, or NULL if not available. - * @access public - */ - function getBacktrace($frame = null) - { - if ($frame === null) { - return $this->backtrace; - } - return $this->backtrace[$frame]; - } - - // }}} - // {{{ addUserInfo() - - function addUserInfo($info) - { - if (empty($this->userinfo)) { - $this->userinfo = $info; - } else { - $this->userinfo .= " ** $info"; - } - } - - // }}} - // {{{ toString() - - /** - * Make a string representation of this object. - * - * @return string a string with an object summary - * @access public - */ - function toString() { - $modes = array(); - $levels = array(E_USER_NOTICE => 'notice', - E_USER_WARNING => 'warning', - E_USER_ERROR => 'error'); - if ($this->mode & PEAR_ERROR_CALLBACK) { - if (is_array($this->callback)) { - $callback = (is_object($this->callback[0]) ? - strtolower(get_class($this->callback[0])) : - $this->callback[0]) . '::' . - $this->callback[1]; - } else { - $callback = $this->callback; - } - return sprintf('[%s: message="%s" code=%d mode=callback '. - 'callback=%s prefix="%s" info="%s"]', - strtolower(get_class($this)), $this->message, $this->code, - $callback, $this->error_message_prefix, - $this->userinfo); - } - if ($this->mode & PEAR_ERROR_PRINT) { - $modes[] = 'print'; - } - if ($this->mode & PEAR_ERROR_TRIGGER) { - $modes[] = 'trigger'; - } - if ($this->mode & PEAR_ERROR_DIE) { - $modes[] = 'die'; - } - if ($this->mode & PEAR_ERROR_RETURN) { - $modes[] = 'return'; - } - return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. - 'prefix="%s" info="%s"]', - strtolower(get_class($this)), $this->message, $this->code, - implode("|", $modes), $levels[$this->level], - $this->error_message_prefix, - $this->userinfo); - } - - // }}} -} - -/* - * Local Variables: - * mode: php - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ -?> diff --git a/vendor/spikephpcoverage/XML/Parser.php b/vendor/spikephpcoverage/XML/Parser.php deleted file mode 100644 index 79fd7a405..000000000 --- a/vendor/spikephpcoverage/XML/Parser.php +++ /dev/null @@ -1,690 +0,0 @@ - | -// | Tomas V.V.Cox | -// | Stephan Schmidt | -// +----------------------------------------------------------------------+ -// -// $Id: Parser.php,v 1.28 2006/12/01 16:23:22 schst Exp $ - -/** - * XML Parser class. - * - * This is an XML parser based on PHP's "xml" extension, - * based on the bundled expat library. - * - * @category XML - * @package XML_Parser - * @author Stig Bakken - * @author Tomas V.V.Cox - * @author Stephan Schmidt - */ - -/** - * uses PEAR's error handling - */ -require_once 'PEAR.php'; - -/** - * resource could not be created - */ -define('XML_PARSER_ERROR_NO_RESOURCE', 200); - -/** - * unsupported mode - */ -define('XML_PARSER_ERROR_UNSUPPORTED_MODE', 201); - -/** - * invalid encoding was given - */ -define('XML_PARSER_ERROR_INVALID_ENCODING', 202); - -/** - * specified file could not be read - */ -define('XML_PARSER_ERROR_FILE_NOT_READABLE', 203); - -/** - * invalid input - */ -define('XML_PARSER_ERROR_INVALID_INPUT', 204); - -/** - * remote file cannot be retrieved in safe mode - */ -define('XML_PARSER_ERROR_REMOTE', 205); - -/** - * XML Parser class. - * - * This is an XML parser based on PHP's "xml" extension, - * based on the bundled expat library. - * - * Notes: - * - It requires PHP 4.0.4pl1 or greater - * - From revision 1.17, the function names used by the 'func' mode - * are in the format "xmltag_$elem", for example: use "xmltag_name" - * to handle the tags of your xml file. - * - * @category XML - * @package XML_Parser - * @author Stig Bakken - * @author Tomas V.V.Cox - * @author Stephan Schmidt - * @todo create XML_Parser_Namespace to parse documents with namespaces - * @todo create XML_Parser_Pull - * @todo Tests that need to be made: - * - mixing character encodings - * - a test using all expat handlers - * - options (folding, output charset) - * - different parsing modes - */ -class XML_Parser extends PEAR -{ - // {{{ properties - - /** - * XML parser handle - * - * @var resource - * @see xml_parser_create() - */ - var $parser; - - /** - * File handle if parsing from a file - * - * @var resource - */ - var $fp; - - /** - * Whether to do case folding - * - * If set to true, all tag and attribute names will - * be converted to UPPER CASE. - * - * @var boolean - */ - var $folding = true; - - /** - * Mode of operation, one of "event" or "func" - * - * @var string - */ - var $mode; - - /** - * Mapping from expat handler function to class method. - * - * @var array - */ - var $handler = array( - 'character_data_handler' => 'cdataHandler', - 'default_handler' => 'defaultHandler', - 'processing_instruction_handler' => 'piHandler', - 'unparsed_entity_decl_handler' => 'unparsedHandler', - 'notation_decl_handler' => 'notationHandler', - 'external_entity_ref_handler' => 'entityrefHandler' - ); - - /** - * source encoding - * - * @var string - */ - var $srcenc; - - /** - * target encoding - * - * @var string - */ - var $tgtenc; - - /** - * handler object - * - * @var object - */ - var $_handlerObj; - - /** - * valid encodings - * - * @var array - */ - var $_validEncodings = array('ISO-8859-1', 'UTF-8', 'US-ASCII'); - - // }}} - // {{{ constructor - - /** - * Creates an XML parser. - * - * This is needed for PHP4 compatibility, it will - * call the constructor, when a new instance is created. - * - * @param string $srcenc source charset encoding, use NULL (default) to use - * whatever the document specifies - * @param string $mode how this parser object should work, "event" for - * startelement/endelement-type events, "func" - * to have it call functions named after elements - * @param string $tgenc a valid target encoding - */ - function XML_Parser($srcenc = null, $mode = 'event', $tgtenc = null) - { - XML_Parser::__construct($srcenc, $mode, $tgtenc); - } - // }}} - - /** - * PHP5 constructor - * - * @param string $srcenc source charset encoding, use NULL (default) to use - * whatever the document specifies - * @param string $mode how this parser object should work, "event" for - * startelement/endelement-type events, "func" - * to have it call functions named after elements - * @param string $tgenc a valid target encoding - */ - function __construct($srcenc = null, $mode = 'event', $tgtenc = null) - { - $this->PEAR('XML_Parser_Error'); - - $this->mode = $mode; - $this->srcenc = $srcenc; - $this->tgtenc = $tgtenc; - } - // }}} - - /** - * Sets the mode of the parser. - * - * Possible modes are: - * - func - * - event - * - * You can set the mode using the second parameter - * in the constructor. - * - * This method is only needed, when switching to a new - * mode at a later point. - * - * @access public - * @param string mode, either 'func' or 'event' - * @return boolean|object true on success, PEAR_Error otherwise - */ - function setMode($mode) - { - if ($mode != 'func' && $mode != 'event') { - $this->raiseError('Unsupported mode given', XML_PARSER_ERROR_UNSUPPORTED_MODE); - } - - $this->mode = $mode; - return true; - } - - /** - * Sets the object, that will handle the XML events - * - * This allows you to create a handler object independent of the - * parser object that you are using and easily switch the underlying - * parser. - * - * If no object will be set, XML_Parser assumes that you - * extend this class and handle the events in $this. - * - * @access public - * @param object object to handle the events - * @return boolean will always return true - * @since v1.2.0beta3 - */ - function setHandlerObj(&$obj) - { - $this->_handlerObj = &$obj; - return true; - } - - /** - * Init the element handlers - * - * @access private - */ - function _initHandlers() - { - if ( ! is_resource($this->parser)) { - return false; - } - - if ( ! is_object($this->_handlerObj)) { - $this->_handlerObj = &$this; - } - switch ($this->mode) { - - case 'func': - xml_set_object($this->parser, $this->_handlerObj); - xml_set_element_handler($this->parser, array(&$this, 'funcStartHandler'), array(&$this, 'funcEndHandler')); - break; - - case 'event': - xml_set_object($this->parser, $this->_handlerObj); - xml_set_element_handler($this->parser, 'startHandler', 'endHandler'); - break; - default: - return $this->raiseError('Unsupported mode given', XML_PARSER_ERROR_UNSUPPORTED_MODE); - break; - } - - - /** - * set additional handlers for character data, entities, etc. - */ - foreach ($this->handler as $xml_func => $method) { - if (method_exists($this->_handlerObj, $method)) { - $xml_func = 'xml_set_' . $xml_func; - $xml_func($this->parser, $method); - } - } - } - - // {{{ _create() - - /** - * create the XML parser resource - * - * Has been moved from the constructor to avoid - * problems with object references. - * - * Furthermore it allows us returning an error - * if something fails. - * - * @access private - * @return boolean|object true on success, PEAR_Error otherwise - * - * @see xml_parser_create - */ - function _create() - { - if ($this->srcenc === null) { - $xp = @xml_parser_create(); - } else { - $xp = @xml_parser_create($this->srcenc); - } - if (is_resource($xp)) { - if ($this->tgtenc !== null) { - if ( ! @xml_parser_set_option($xp, XML_OPTION_TARGET_ENCODING, - $this->tgtenc)) { - return $this->raiseError('invalid target encoding', XML_PARSER_ERROR_INVALID_ENCODING); - } - } - $this->parser = $xp; - $result = $this->_initHandlers($this->mode); - if ($this->isError($result)) { - return $result; - } - xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, $this->folding); - return true; - } - if ( ! in_array(strtoupper($this->srcenc), $this->_validEncodings)) { - return $this->raiseError('invalid source encoding', XML_PARSER_ERROR_INVALID_ENCODING); - } - return $this->raiseError('Unable to create XML parser resource.', XML_PARSER_ERROR_NO_RESOURCE); - } - - // }}} - // {{{ reset() - - /** - * Reset the parser. - * - * This allows you to use one parser instance - * to parse multiple XML documents. - * - * @access public - * @return boolean|object true on success, PEAR_Error otherwise - */ - function reset() - { - $result = $this->_create(); - if ($this->isError( $result )) { - return $result; - } - return true; - } - - // }}} - // {{{ setInputFile() - - /** - * Sets the input xml file to be parsed - * - * @param string Filename (full path) - * @return resource fopen handle of the given file - * @throws XML_Parser_Error - * @see setInput(), setInputString(), parse() - * @access public - */ - function setInputFile($file) - { - /** - * check, if file is a remote file - */ - if (eregi('^(http|ftp)://', substr($file, 0, 10))) { - if ( ! ini_get('allow_url_fopen')) { - return $this->raiseError('Remote files cannot be parsed, as safe mode is enabled.', XML_PARSER_ERROR_REMOTE); - } - } - - $fp = @fopen($file, 'rb'); - if (is_resource($fp)) { - $this->fp = $fp; - return $fp; - } - return $this->raiseError('File could not be opened.', XML_PARSER_ERROR_FILE_NOT_READABLE); - } - - // }}} - // {{{ setInputString() - - /** - * XML_Parser::setInputString() - * - * Sets the xml input from a string - * - * @param string $data a string containing the XML document - * @return null - **/ - function setInputString($data) - { - $this->fp = $data; - return null; - } - - // }}} - // {{{ setInput() - - /** - * Sets the file handle to use with parse(). - * - * You should use setInputFile() or setInputString() if you - * pass a string - * - * @param mixed $fp Can be either a resource returned from fopen(), - * a URL, a local filename or a string. - * @access public - * @see parse() - * @uses setInputString(), setInputFile() - */ - function setInput($fp) - { - if (is_resource($fp)) { - $this->fp = $fp; - return true; - } - // see if it's an absolute URL (has a scheme at the beginning) - elseif (eregi('^[a-z]+://', substr($fp, 0, 10))) { - return $this->setInputFile($fp); - } - // see if it's a local file - elseif (file_exists($fp)) { - return $this->setInputFile($fp); - } - // it must be a string - else { - $this->fp = $fp; - return true; - } - - return $this->raiseError('Illegal input format', XML_PARSER_ERROR_INVALID_INPUT); - } - - // }}} - // {{{ parse() - - /** - * Central parsing function. - * - * @return true|object PEAR error returns true on success, or a PEAR_Error otherwise - * @access public - */ - function parse() - { - /** - * reset the parser - */ - $result = $this->reset(); - if ($this->isError($result)) { - return $result; - } - // if $this->fp was fopened previously - if (is_resource($this->fp)) { - - while ($data = fread($this->fp, 4096)) { - if ( ! $this->_parseString($data, feof($this->fp))) { - $error = &$this->raiseError(); - $this->free(); - return $error; - } - } - // otherwise, $this->fp must be a string - } else { - if ( ! $this->_parseString($this->fp, true)) { - $error = &$this->raiseError(); - $this->free(); - return $error; - } - } - $this->free(); - - return true; - } - - /** - * XML_Parser::_parseString() - * - * @param string $data - * @param boolean $eof - * @return bool - * @access private - * @see parseString() - **/ - function _parseString($data, $eof = false) - { - return xml_parse($this->parser, $data, $eof); - } - - // }}} - // {{{ parseString() - - /** - * XML_Parser::parseString() - * - * Parses a string. - * - * @param string $data XML data - * @param boolean $eof If set and TRUE, data is the last piece of data sent in this parser - * @throws XML_Parser_Error - * @return Pear Error|true true on success or a PEAR Error - * @see _parseString() - */ - function parseString($data, $eof = false) - { - if ( ! isset($this->parser) || !is_resource($this->parser)) { - $this->reset(); - } - - if ( ! $this->_parseString($data, $eof)) { - $error = &$this->raiseError(); - $this->free(); - return $error; - } - - if ($eof === true) { - $this->free(); - } - return true; - } - - /** - * XML_Parser::free() - * - * Free the internal resources associated with the parser - * - * @return null - **/ - function free() - { - if (isset($this->parser) && is_resource($this->parser)) { - xml_parser_free($this->parser); - unset( $this->parser ); - } - if (isset($this->fp) && is_resource($this->fp)) { - fclose($this->fp); - } - unset($this->fp); - return null; - } - - /** - * XML_Parser::raiseError() - * - * Throws a XML_Parser_Error - * - * @param string $msg the error message - * @param integer $ecode the error message code - * @return XML_Parser_Error - **/ - function raiseError($msg = null, $ecode = 0) - { - $msg = !is_null($msg) ? $msg : $this->parser; - $err = &new XML_Parser_Error($msg, $ecode); - return parent::raiseError($err); - } - - // }}} - // {{{ funcStartHandler() - - function funcStartHandler($xp, $elem, $attribs) - { - $func = 'xmltag_' . $elem; - $func = str_replace(array('.', '-', ':'), '_', $func); - if (method_exists($this->_handlerObj, $func)) { - call_user_func(array(&$this->_handlerObj, $func), $xp, $elem, $attribs); - } elseif (method_exists($this->_handlerObj, 'xmltag')) { - call_user_func(array(&$this->_handlerObj, 'xmltag'), $xp, $elem, $attribs); - } - } - - // }}} - // {{{ funcEndHandler() - - function funcEndHandler($xp, $elem) - { - $func = 'xmltag_' . $elem . '_'; - $func = str_replace(array('.', '-', ':'), '_', $func); - if (method_exists($this->_handlerObj, $func)) { - call_user_func(array(&$this->_handlerObj, $func), $xp, $elem); - } elseif (method_exists($this->_handlerObj, 'xmltag_')) { - call_user_func(array(&$this->_handlerObj, 'xmltag_'), $xp, $elem); - } - } - - // }}} - // {{{ startHandler() - - /** - * - * @abstract - */ - function startHandler($xp, $elem, &$attribs) - { - return NULL; - } - - // }}} - // {{{ endHandler() - - /** - * - * @abstract - */ - function endHandler($xp, $elem) - { - return NULL; - } - - - // }}}me -} - -/** - * error class, replaces PEAR_Error - * - * An instance of this class will be returned - * if an error occurs inside XML_Parser. - * - * There are three advantages over using the standard PEAR_Error: - * - All messages will be prefixed - * - check for XML_Parser error, using is_a( $error, 'XML_Parser_Error' ) - * - messages can be generated from the xml_parser resource - * - * @package XML_Parser - * @access public - * @see PEAR_Error - */ -class XML_Parser_Error extends PEAR_Error -{ - // {{{ properties - - /** - * prefix for all messages - * - * @var string - */ - var $error_message_prefix = 'XML_Parser: '; - - // }}} - // {{{ constructor() - /** - * construct a new error instance - * - * You may either pass a message or an xml_parser resource as first - * parameter. If a resource has been passed, the last error that - * happened will be retrieved and returned. - * - * @access public - * @param string|resource message or parser resource - * @param integer error code - * @param integer error handling - * @param integer error level - */ - function XML_Parser_Error($msgorparser = 'unknown error', $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) - { - if (is_resource($msgorparser)) { - $code = xml_get_error_code($msgorparser); - $msgorparser = sprintf('%s at XML input line %d:%d', - xml_error_string($code), - xml_get_current_line_number($msgorparser), - xml_get_current_column_number($msgorparser)); - } - $this->PEAR_Error($msgorparser, $code, $mode, $level); - } - // }}} -} -?> \ No newline at end of file diff --git a/vendor/spikephpcoverage/XML/Parser/Simple.php b/vendor/spikephpcoverage/XML/Parser/Simple.php deleted file mode 100644 index 2476c5a0c..000000000 --- a/vendor/spikephpcoverage/XML/Parser/Simple.php +++ /dev/null @@ -1,297 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: Simple.php,v 1.6 2005/03/25 17:13:10 schst Exp $ - -/** - * Simple XML parser class. - * - * This class is a simplified version of XML_Parser. - * In most XML applications the real action is executed, - * when a closing tag is found. - * - * XML_Parser_Simple allows you to just implement one callback - * for each tag that will receive the tag with its attributes - * and CData - * - * @category XML - * @package XML_Parser - * @author Stephan Schmidt - */ - -/** - * built on XML_Parser - */ -require_once 'XML/Parser.php'; - -/** - * Simple XML parser class. - * - * This class is a simplified version of XML_Parser. - * In most XML applications the real action is executed, - * when a closing tag is found. - * - * XML_Parser_Simple allows you to just implement one callback - * for each tag that will receive the tag with its attributes - * and CData. - * - * - * require_once '../Parser/Simple.php'; - * - * class myParser extends XML_Parser_Simple - * { - * function myParser() - * { - * $this->XML_Parser_Simple(); - * } - * - * function handleElement($name, $attribs, $data) - * { - * printf('handle %s
    ', $name); - * } - * } - * - * $p = &new myParser(); - * - * $result = $p->setInputFile('myDoc.xml'); - * $result = $p->parse(); - *
    - * - * @category XML - * @package XML_Parser - * @author Stephan Schmidt - */ -class XML_Parser_Simple extends XML_Parser -{ - /** - * element stack - * - * @access private - * @var array - */ - var $_elStack = array(); - - /** - * all character data - * - * @access private - * @var array - */ - var $_data = array(); - - /** - * element depth - * - * @access private - * @var integer - */ - var $_depth = 0; - - /** - * Mapping from expat handler function to class method. - * - * @var array - */ - var $handler = array( - 'default_handler' => 'defaultHandler', - 'processing_instruction_handler' => 'piHandler', - 'unparsed_entity_decl_handler' => 'unparsedHandler', - 'notation_decl_handler' => 'notationHandler', - 'external_entity_ref_handler' => 'entityrefHandler' - ); - - /** - * Creates an XML parser. - * - * This is needed for PHP4 compatibility, it will - * call the constructor, when a new instance is created. - * - * @param string $srcenc source charset encoding, use NULL (default) to use - * whatever the document specifies - * @param string $mode how this parser object should work, "event" for - * handleElement(), "func" to have it call functions - * named after elements (handleElement_$name()) - * @param string $tgenc a valid target encoding - */ - function XML_Parser_Simple($srcenc = null, $mode = 'event', $tgtenc = null) - { - $this->XML_Parser($srcenc, $mode, $tgtenc); - } - - /** - * inits the handlers - * - * @access private - */ - function _initHandlers() - { - if ( ! is_object($this->_handlerObj)) { - $this->_handlerObj = &$this; - } - - if ($this->mode != 'func' && $this->mode != 'event') { - return $this->raiseError('Unsupported mode given', XML_PARSER_ERROR_UNSUPPORTED_MODE); - } - xml_set_object($this->parser, $this->_handlerObj); - - xml_set_element_handler($this->parser, array(&$this, 'startHandler'), array(&$this, 'endHandler')); - xml_set_character_data_handler($this->parser, array(&$this, 'cdataHandler')); - - /** - * set additional handlers for character data, entities, etc. - */ - foreach ($this->handler as $xml_func => $method) { - if (method_exists($this->_handlerObj, $method)) { - $xml_func = 'xml_set_' . $xml_func; - $xml_func($this->parser, $method); - } - } - } - - /** - * Reset the parser. - * - * This allows you to use one parser instance - * to parse multiple XML documents. - * - * @access public - * @return boolean|object true on success, PEAR_Error otherwise - */ - function reset() - { - $this->_elStack = array(); - $this->_data = array(); - $this->_depth = 0; - - $result = $this->_create(); - if ($this->isError( $result )) { - return $result; - } - return true; - } - - /** - * start handler - * - * Pushes attributes and tagname onto a stack - * - * @access private - * @final - * @param resource xml parser resource - * @param string element name - * @param array attributes - */ - function startHandler($xp, $elem, &$attribs) - { - array_push($this->_elStack, array( - 'name' => $elem, - 'attribs' => $attribs - ) - ); - $this->_depth++; - $this->_data[$this->_depth] = ''; - } - - /** - * end handler - * - * Pulls attributes and tagname from a stack - * - * @access private - * @final - * @param resource xml parser resource - * @param string element name - */ - function endHandler($xp, $elem) - { - $el = array_pop($this->_elStack); - $data = $this->_data[$this->_depth]; - $this->_depth--; - - switch ($this->mode) { - case 'event': - $this->_handlerObj->handleElement($el['name'], $el['attribs'], $data); - break; - case 'func': - $func = 'handleElement_' . $elem; - if (strchr($func, '.')) { - $func = str_replace('.', '_', $func); - } - if (method_exists($this->_handlerObj, $func)) { - call_user_func(array(&$this->_handlerObj, $func), $el['name'], $el['attribs'], $data); - } - break; - } - } - - /** - * handle character data - * - * @access private - * @final - * @param resource xml parser resource - * @param string data - */ - function cdataHandler($xp, $data) - { - $this->_data[$this->_depth] .= $data; - } - - /** - * handle a tag - * - * Implement this in your parser - * - * @access public - * @abstract - * @param string element name - * @param array attributes - * @param string character data - */ - function handleElement($name, $attribs, $data) - { - } - - /** - * get the current tag depth - * - * The root tag is in depth 0. - * - * @access public - * @return integer - */ - function getCurrentDepth() - { - return $this->_depth; - } - - /** - * add some string to the current ddata. - * - * This is commonly needed, when a document is parsed recursively. - * - * @access public - * @param string data to add - * @return void - */ - function addToData( $data ) - { - $this->_data[$this->_depth] .= $data; - } -} -?> diff --git a/vendor/spikephpcoverage/cli/driver.php b/vendor/spikephpcoverage/cli/driver.php deleted file mode 100644 index 52c5d22ef..000000000 --- a/vendor/spikephpcoverage/cli/driver.php +++ /dev/null @@ -1,267 +0,0 @@ - - - */ - - if( ! defined("__PHPCOVERAGE_HOME")) { - define("__PHPCOVERAGE_HOME", dirname(dirname(__FILE__))); - } - require_once __PHPCOVERAGE_HOME . "/conf/phpcoverage.conf.php"; - require_once __PHPCOVERAGE_HOME . "/util/Utility.php"; - - // ###################################################################### - // ###################################################################### - - function usage() { - global $util; - echo "Usage: " . $_SERVER['argv'][0] . " \n"; - echo "\n"; - echo " Options: \n"; - echo " --phpcoverage-home OR -p Path to PHPCoverage home (defaults to PHPCOVERAGE_HOME environment property)\n"; - echo " --init Initialize PHPCoverage Reporting\n"; - echo " --report Generate PHPCoverage Reports\n"; - echo " --cleanup Remove existing PHPCoverage data\n"; - echo " init options \n"; - echo " --cov-url Specify application default url\n"; - echo " --tmp-dir Specify tmp directory location (Defaults to '" . $util->getTmpDir() . "')\n"; - echo " --cov-file-name Specify coverage data file name (Defaults to 'phpcoverage.data.xml')\n"; - echo " report options \n"; - echo " --cov-data-files Coverage data file path [use this instead of --cov-url for a local file path]\n"; - echo " --report-name Report name\n"; - echo " --report-dir Report directory path (Defaults to 'report')\n"; - echo " --appbase-path Application base path (Defaults to PHPCOVERAGE_APPBASE_PATH if specified on the command line)\n"; - echo " --include-paths Comma-separated paths to include in code coverage report. (Includes appbase-path by default)\n"; - echo " --exclude-paths Comma-separated paths to exclude from code coverage report.\n"; - echo " --print-summary Print coverage report summary to console.\n"; - echo " other options \n"; - echo " --verbose OR -v Print verbose information\n"; - echo " --help OR -h Display this usage information\n"; - exit; - } - - // - // Setup command line argument processing - // - - $OPTION["p"] = false; - $OPTION['verbose'] = false; - $OPTION['init'] = false; - $OPTION['report'] = false; - $OPTION['cleanup'] = false; - $OPTION['cov-url'] = false; - $OPTION['report-name'] = false; - $OPTION['report-dir'] = false; - $OPTION['tmp-dir'] = false; - $OPTION['cov-file-name'] = false; - $OPTION['cov-data-files'] = false; - $OPTION['appbase-path'] = false; - - // - // loop through our arguments and see what the user selected - // - - for ($i = 1; $i < $_SERVER["argc"]; $i++) { - switch($_SERVER["argv"][$i]) { - case "--phpcoverage-home": - case "-p": - $OPTION['p'] = $_SERVER['argv'][++$i]; - break; - case "-v": - case "--verbose": - $OPTION['verbose'] = true; - break; - case "--init": - $OPTION['init'] = true; - break; - case "--report": - $OPTION['report'] = true; - break; - case "--cleanup": - $OPTION['cleanup'] = true; - break; - case "--cov-url": - $OPTION['cov-url'] = $_SERVER['argv'][++$i] . "/" . "phpcoverage.remote.top.inc.php"; - break; - case "--tmp-dir": - $OPTION['tmp-dir'] = $_SERVER['argv'][++$i]; - break; - case "--cov-file-name": - $OPTION['cov-file-name'] = $_SERVER['argv'][++$i]; - break; - case "--cov-data-files": - $OPTION['cov-data-files'] = $_SERVER['argv'][++$i]; - break; - case "--report-name": - $OPTION['report-name'] = $_SERVER['argv'][++$i]; - break; - case "--report-dir": - $OPTION['report-dir'] = $_SERVER['argv'][++$i]; - break; - case "--appbase-path": - $OPTION['appbase-path'] = $_SERVER['argv'][++$i]; - break; - case "--include-paths": - $OPTION['include-paths'] = $_SERVER['argv'][++$i]; - break; - case "--exclude-paths": - $OPTION['exclude-paths'] = $_SERVER['argv'][++$i]; - break; - case "--print-summary": - $OPTION['print-summary'] = true; - break; - case "--help": - case "-h": - usage(); - break; - } - } - - if($OPTION['p'] == false) { - $OPTION['p'] = __PHPCOVERAGE_HOME; - if(empty($OPTION['p']) || !is_dir($OPTION['p'])) { - die("PHPCOVERAGE_HOME does not exist. [" . $OPTION['p'] . "]"); - } - } - - putenv("PHPCOVERAGE_HOME=" . $OPTION['p']); - - require_once $OPTION['p'] . "/phpcoverage.inc.php"; - require_once PHPCOVERAGE_HOME . "/remote/RemoteCoverageRecorder.php"; - require_once PHPCOVERAGE_HOME . "/reporter/HtmlCoverageReporter.php"; - - // Initializations - $includePaths = array(); - $excludePaths = array(); - - if ( ! $OPTION['cov-url']){ - if( ! $OPTION['report'] && !$OPTION['cov-data-files']) { - echo "ERROR: No --cov-url option specified.\n"; - exit(1); - } - } - - if($OPTION['init']) { - if( ! $OPTION['tmp-dir']) { - $OPTION['tmp-dir'] = $util->getTmpDir(); - } - if( ! $OPTION['cov-file-name']) { - $OPTION['cov-file-name'] = "phpcoverage.data.xml"; - } - } - - if($OPTION['report']) { - if ( ! $OPTION['report-name']){ - echo "ERROR: No --report-name option specified.\n"; - exit(1); - } - - if( ! $OPTION['report-dir']) { - if( ! empty($PHPCOVERAGE_REPORT_DIR)) { - $OPTION["report-dir"] = $PHPCOVERAGE_REPORT_DIR; - } - else { - $OPTION["report-dir"] = "report"; - } - } - - if(empty($OPTION['appbase-path']) && !empty($PHPCOVERAGE_APPBASE_PATH)) { - $OPTION['appbase-path'] = realpath($PHPCOVERAGE_APPBASE_PATH); - } - - if(isset($OPTION['include-paths'])) { - $includePaths = explode(",", $OPTION['include-paths']); - } - if(isset($OPTION['appbase-path']) && !empty($OPTION["appbase-path"])) { - $includePaths[] = $OPTION['appbase-path']; - } - - if(isset($OPTION['exclude-paths'])) { - $excludePaths = explode(",", $OPTION['exclude-paths']); - } - } - - if ($OPTION['verbose']){ - echo "Options: " . print_r($OPTION, true) . "\n"; - echo "include-paths: " . print_r($includePaths, true) . "\n"; - echo "exclude-paths: " . print_r($excludePaths, true) . "\n"; - } - - // - // - // - - if ($OPTION['init']){ - echo "PHPCoverage: init " . $OPTION['cov-url'] . "?phpcoverage-action=init&cov-file-name=". urlencode($OPTION["cov-file-name"]) . "&tmp-dir=" . urlencode($OPTION['tmp-dir']) . "\n"; - - // - // Initialize the PHPCoverage reporting framework - // - - file_get_contents($OPTION['cov-url'] . "?phpcoverage-action=init&cov-file-name=". urlencode($OPTION["cov-file-name"]) . "&tmp-dir=" . urlencode($OPTION['tmp-dir'])); - - } - else if ($OPTION['report']){ - - - // - // Retrieve coverage data (xml) from the PHPCoverage reporting framework - // - - if($OPTION['cov-data-files']) { - $OPTION['cov-data-fileset'] = explode(",", $OPTION['cov-data-files']); - foreach($OPTION['cov-data-fileset'] as $covDataFile) { - if( ! is_readable($covDataFile)) { - echo "Error: Cannot read cov-data-file: " . $covDataFile . "\n"; - exit(1); - } - $xmlUrl[] = $covDataFile; - } - } - else { - echo "PHPCoverage: report " . $OPTION['cov-url'] . "?phpcoverage-action=get-coverage-xml" . "\n"; - $xmlUrl = $OPTION['cov-url'] . "?phpcoverage-action=get-coverage-xml"; - } - - // - // Configure reporter, and generate the PHPCoverage report - // - - $covReporter = new HtmlCoverageReporter($OPTION['report-name'], "", $OPTION["report-dir"]); - - // - // Notice the coverage recorder is of type RemoteCoverageRecorder - // - - $cov = new RemoteCoverageRecorder($includePaths, $excludePaths, $covReporter); - $cov->generateReport($xmlUrl, true); - $covReporter->printTextSummary($OPTION["report-dir"] . "/report.txt"); - // Should the summary be printed to console ? - if(isset($OPTION['print-summary']) && $OPTION['print-summary']) { - $covReporter->printTextSummary(); - } - - } - else if ($OPTION['cleanup']){ - - echo "PHPCoverage: cleanup " . $OPTION['cov-url'] . "?phpcoverage-action=cleanup"; - file_get_contents($OPTION['cov-url'] . "?phpcoverage-action=cleanup"); - - } - -?> - diff --git a/vendor/spikephpcoverage/cli/instrument.php b/vendor/spikephpcoverage/cli/instrument.php deleted file mode 100644 index f29689e73..000000000 --- a/vendor/spikephpcoverage/cli/instrument.php +++ /dev/null @@ -1,305 +0,0 @@ - - [-p ] [-r] [-u] [-e ]" - . "[-v] [-h] [path1 [path2 [...]]]\n"; - echo "\n"; - echo " Options: \n"; - echo " -b Application directory accessible via HTTP " - . "where PHPCoverage files should be copied.\n"; - echo " -p Path to PHPCoverage Home.\n"; - echo " -r Recursively instrument PHP files.\n"; - echo " -u Undo instrumentation.\n"; - echo " -e Execlude files in the file list.\n"; - echo " -v Be verbose.\n"; - echo " -h Print this help and exit.\n"; - echo "\n"; - exit(0); - } - - /** - * Print error message and exit - * - * @param $msg Message to write to console. - * @access public - */ - function error($msg) { - echo basename(__FILE__) . ": [ERROR] " . $msg . "\n"; - exit(1); - } - - /** - * Write a information message - * - * @param $msg Message to write to console. - * @access public - */ - function writeMsg($msg) { - global $VERBOSE; - if($VERBOSE) { - echo basename(__FILE__) . ": [INFO] " . $msg . "\n"; - } - } - - /** - * Instrument the PHP file. - * - * @param $file File path - * @access public - */ - function instrument($file) { - global $LOCAL_PHPCOVERAGE_LOCATION, $top, $bottom; - $tmpfile = "$file.tmp"; - $contents = file_get_contents($file); - $len = strlen($contents); - if(strpos($contents, $top) === 0 && strrpos($contents, $bottom) === ($len - strlen($bottom))) { - writeMsg("Skipping $file."); - return; - } - - $fp = fopen($tmpfile, "w"); - if( ! $fp) { - error("Cannot write to file: $tmpfile"); - } - fputs($fp, $top); - fwrite($fp, $contents); - fputs($fp, $bottom); - fclose($fp); - // Delete if already exists - 'rename()' on Windows will return false otherwise - if(file_exists($file)) { - unlink($file); - } - $ret = rename($tmpfile, $file); - if( ! $ret) { - error("Cannot save file: $file"); - } - writeMsg("Instrumented: $file."); - } - - /** - * Uninstrument the PHP file - * - * @param $file File path - * @access public - */ - function uninstrument($file) { - global $LOCAL_PHPCOVERAGE_LOCATION, $top, $bottom; - $tmpfile = "$file.tmp"; - - $contents = file_get_contents($file); - $len = strlen($contents); - if(strpos($contents, $top) !== 0 && strrpos($contents, $bottom) !== ($len - strlen($bottom))) { - writeMsg("Skipping $file."); - return; - } - - $fr = fopen($file, "r"); - $fw = fopen($tmpfile, "w"); - if( ! $fr) { - error("Cannot read file: $file"); - } - if( ! $fr) { - error("Cannot write to file: $tmpfile"); - } - while( ! feof($fr)) { - $line = fgets($fr); - if(strpos($line, $top) === false && strpos($line, $bottom) === false) { - fputs($fw, $line); - } - } - fclose($fr); - fclose($fw); - - // Delete if already exists - 'rename()' on Windows will return false otherwise - if(file_exists($file)) { - unlink($file); - } - $ret = rename($tmpfile, $file); - if( ! $ret) { - error("Cannot save file: $file"); - } - writeMsg("Uninstrumented: $file"); - } - - /** - * Retrive a list of all PHP files in the given directory - * - * @param $dir Directory to scan - * @param $recursive True is directory is scanned recursively - * @return Array List of PHP files - * @access public - */ - function get_all_php_files($dir, &$excludeFiles, $recursive) { - global $spc_config; - $phpExtensions = $spc_config["extensions"]; - $dirs[] = $dir; - while(count($dirs) > 0) { - $currDir = realpath(array_pop($dirs)); - if( ! is_readable($currDir)) { - continue; - } - $currFiles = scandir($currDir); - for($j = 0; $j < count($currFiles); $j++) { - if($currFiles[$j] == "." || $currFiles[$j] == "..") { - continue; - } - $currFiles[$j] = $currDir . "/" . $currFiles[$j]; - if(is_file($currFiles[$j])) { - $pathParts = pathinfo($currFiles[$j]); - // Ignore phpcoverage bottom and top stubs - if(strpos($pathParts['basename'], "phpcoverage.remote.") !== false) { - continue; - } - // Ignore files specified in the exclude list - if(in_array(realpath($currFiles[$j]), $excludeFiles) !== false) { - continue; - } - if(isset($pathParts['extension']) - && in_array($pathParts['extension'], $phpExtensions)) { - $files[] = $currFiles[$j]; - } - } - else if(is_dir($currFiles[$j]) && $recursive) { - $dirs[] = $currFiles[$j]; - } - } - } - return $files; - } - - // Initialize - - $RECURSIVE = false; - $UNDO = false; - - $top_file = "/phpcoverage.remote.top.inc.php"; - $bottom_file = "/phpcoverage.remote.bottom.inc.php"; - - //print_r($argv); - for($i = 1; $i < $argc; $i++) { - switch($argv[$i]) { - case "-r": - $RECURSIVE = true; - break; - - case "-p": - $PHPCOVERAGE_HOME = $argv[++$i]; - break; - - case "-b": - $LOCAL_PHPCOVERAGE_LOCATION = $argv[++$i]; - break; - - case "-u": - $UNDO = true; - break; - - case "-e": - $EXCLUDE_FILES = explode(",", $argv[++$i]); - break; - - case "-v": - $VERBOSE = true; - break; - - case "-h": - help(); - break; - - default: - $paths[] = $argv[$i]; - break; - } - } - - - if( ! is_dir($LOCAL_PHPCOVERAGE_LOCATION)) { - error("LOCAL_PHPCOVERAGE_LOCATION [$LOCAL_PHPCOVERAGE_LOCATION] not found."); - } - if(empty($PHPCOVERAGE_HOME) || !is_dir($PHPCOVERAGE_HOME)) { - $PHPCOVERAGE_HOME = __PHPCOVERAGE_HOME; - if(empty($PHPCOVERAGE_HOME) || !is_dir($PHPCOVERAGE_HOME)) { - error("PHPCOVERAGE_HOME does not exist. [" . $PHPCOVERAGE_HOME . "]"); - } - } - - $LOCAL_PHPCOVERAGE_LOCATION = realpath($LOCAL_PHPCOVERAGE_LOCATION); - if(file_exists($LOCAL_PHPCOVERAGE_LOCATION . $top_file)) { - unlink($LOCAL_PHPCOVERAGE_LOCATION . $top_file); - } - $ret = copy($PHPCOVERAGE_HOME . $top_file, $LOCAL_PHPCOVERAGE_LOCATION . $top_file); - if( ! $ret) { - error("Cannot copy to $LOCAL_PHPCOVERAGE_LOCATION"); - } - if(file_exists($LOCAL_PHPCOVERAGE_LOCATION . $bottom_file)) { - unlink($LOCAL_PHPCOVERAGE_LOCATION . $bottom_file); - } - $ret = copy($PHPCOVERAGE_HOME . $bottom_file, $LOCAL_PHPCOVERAGE_LOCATION . $bottom_file); - if( ! $ret) { - error("Cannot copy to $LOCAL_PHPCOVERAGE_LOCATION"); - } - $top="\n"; - $bottom="\n"; - - if(empty($paths)) { - $paths[] = getcwd(); - } - if( ! isset($EXCLUDE_FILES) || empty($EXCLUDE_FILES)) { - $EXCLUDE_FILES = array(); - } - for($i = 0; $i < count($EXCLUDE_FILES); $i++) { - // Remove a file from the array if it does not exist - if( ! file_exists($EXCLUDE_FILES[$i])) { - array_splice($EXCLUDE_FILES, $i, 1); - $i --; - continue; - } - $EXCLUDE_FILES[$i] = realpath($EXCLUDE_FILES[$i]); - } - - //print_r($paths); - foreach($paths as $path) { - unset($files); - if(is_dir($path)) { - $files = get_all_php_files($path, $EXCLUDE_FILES, $RECURSIVE); - } - else if(is_file($path)) { - $files[] = $path; - } - else { - error("Unknown entity: $path"); - } - //print_r($files); - foreach($files as $file) { - if($UNDO) { - uninstrument($file); - } - else { - instrument($file); - } - } - } -?> diff --git a/vendor/spikephpcoverage/conf/phpcoverage.conf.php b/vendor/spikephpcoverage/conf/phpcoverage.conf.php deleted file mode 100644 index a7d75718c..000000000 --- a/vendor/spikephpcoverage/conf/phpcoverage.conf.php +++ /dev/null @@ -1,28 +0,0 @@ - - diff --git a/vendor/spikephpcoverage/parser/BasicXmlParser.php b/vendor/spikephpcoverage/parser/BasicXmlParser.php deleted file mode 100644 index 4585dfc83..000000000 --- a/vendor/spikephpcoverage/parser/BasicXmlParser.php +++ /dev/null @@ -1,171 +0,0 @@ - - - * @version $Revision: $ - * @package SpikePHPCoverage_Parser - */ - class BasicXmlParser extends XML_Parser { - /*{{{ Members */ - - protected $openTags; - protected $docroot; - - /*}}}*/ - /*{{{ Constructor*/ - - /** - * Constructor - * @access public - */ - public function BasicXmlParser() { - parent::XML_Parser(); - } - - /*}}}*/ - /*{{{ public function handleAttrTag() */ - - /** - * Function that handles an element with attributes. - * - * @param $name Name of the element - * @param $attrs Attributes array (name, value pairs) - * @return Array An element - * @access public - */ - public function handleAttrTag($name, $attrs) { - $tag = array(); - foreach($attrs as $attr_name => $value) { - $tag[$attr_name] = $value; - } - return $tag; - } - - /*}}}*/ - /*{{{ public function startHandler() */ - - /** - * Function to handle start of an element - * - * @param $xp XMLParser handle - * @param $name Element name - * @param $attributes Attribute array - * @access public - */ - function startHandler($xp, $name, $attributes) { - $this->openTags[] = $name; - } - - /*}}}*/ - /*{{{ public function endHandler()*/ - - /** - * Function to handle end of an element - * - * @param $xp XML_Parser handle - * @param $name Name of the element - * @access public - */ - public function endHandler($xp, $name) { - // Handle error tags - $lastTag = $this->getLastOpenTag($name); - switch($name) { - case "MESSAGE": - if($lastTag == "ERROR") { - $this->docroot["ERROR"]["MESSAGE"] = $this->getCData(); - } - break; - } - // Empty CData - $this->lastCData = ""; - - // Close tag - if($this->openTags[count($this->openTags)-1] == $name) { - array_pop($this->openTags); - } - } - - /*}}}*/ - /*{{{ public function cdataHandler() */ - - /** - * Function to handle character data - * - * @param $xp XMLParser handle - * @param $cdata Character data - * @access public - */ - public function cdataHandler($xp, $cdata) { - $this->lastCData .= $cdata; - } - - /*}}}*/ - /*{{{ public function getCData() */ - - /** - * Returns the CData collected so far. - * - * @return String Character data collected. - * @access public - */ - public function getCData() { - return $this->lastCData; - } - - /*}}}*/ - /*{{{ public function getLastOpenTag() */ - - /** - * Returns the name of parent tag of give tag - * - * @param $tag Name of a child tag - * @return String Name of the parent tag of $tag - * @access public - */ - public function getLastOpenTag($tag) { - $lastTagIndex = count($this->openTags)-1; - if($this->openTags[$lastTagIndex] == $tag) { - if($lastTagIndex > 0) { - return $this->openTags[$lastTagIndex-1]; - } - } - return false; - } - - /*}}}*/ - /*{{{ public function getDocumentArray() */ - - /** - * Return the document array gathered during parsing. - * Document array is a data structure that mimics the XML - * contents. - * - * @return Array Document array - * @access public - */ - public function getDocumentArray() { - return $this->docroot; - } - - /*}}}*/ - } - -?> diff --git a/vendor/spikephpcoverage/parser/CoverageXmlParser.php b/vendor/spikephpcoverage/parser/CoverageXmlParser.php deleted file mode 100644 index a44342238..000000000 --- a/vendor/spikephpcoverage/parser/CoverageXmlParser.php +++ /dev/null @@ -1,92 +0,0 @@ - - - * - * - * - * - * - * ... - * - * - * - * @author Nimish Pachapurkar - * @version $Revision: $ - * @package SpikePHPCoverage_Parser - */ - class CoverageXmlParser extends BasicXmlParser { - /*{{{ Members */ - - protected $_data = array(); - protected $_lastFilePath; - - /*}}}*/ - /*{{{ public function startHandler() */ - - public function startHandler($xp, $name, $attrs) { - switch($name) { - case "FILE": - $fileAttributes = $this->handleAttrTag($name, $attrs); - $this->_lastFilePath = $fileAttributes["PATH"]; - if( ! isset($this->_data[$this->_lastFilePath])) { - $this->_data[$this->_lastFilePath] = array(); - } - break; - - case "LINE": - $lineAttributes = $this->handleAttrTag($name, $attrs); - $lineNumber = (int)$lineAttributes["LINE-NUMBER"]; - if( ! isset($this->_data[$this->_lastFilePath][$lineNumber])) { - $this->_data[$this->_lastFilePath][$lineNumber] = (int)$lineAttributes["FREQUENCY"]; - } - else { - $this->_data[$this->_lastFilePath][$lineNumber] += (int)$lineAttributes["FREQUENCY"]; - } - break; - } - } - - /*}}}*/ - /*{{{ public function getCoverageData() */ - - /** - * Returns coverage data array from the XML - * Format: - * Array - * ( - * [/php/src/remote/RemoteCoverageRecorder.php] => Array - * ( - * [220] => 1 - * [221] => 1 - * ) - * - * [/opt/oss/share/apache2/htdocs/web/sample.php] => Array - * ( - * [16] => 1 - * [18] => 1 - * ) - * ) - * - * @access public - */ - public function getCoverageData() { - return $this->_data; - } - - /*}}}*/ - } -?> diff --git a/vendor/spikephpcoverage/parser/PHPParser.php b/vendor/spikephpcoverage/parser/PHPParser.php deleted file mode 100644 index 9f6259a48..000000000 --- a/vendor/spikephpcoverage/parser/PHPParser.php +++ /dev/null @@ -1,425 +0,0 @@ - -'; - private $inComment = false; - private $lastLineEndTokenType = ""; - // If one of these tokens occur as the last token of a line - // then the next line can be treated as a continuation line - // depending on how it starts. - public static $contTypes = array( - "(", - ",", - ".", - "=", - T_LOGICAL_XOR, - T_LOGICAL_AND, - T_LOGICAL_OR, - T_PLUS_EQUAL, - T_MINUS_EQUAL, - T_MUL_EQUAL, - T_DIV_EQUAL, - T_CONCAT_EQUAL, - T_MOD_EQUAL, - T_AND_EQUAL, - T_OR_EQUAL, - T_XOR_EQUAL, - T_BOOLEAN_AND, - T_BOOLEAN_OR, - T_OBJECT_OPERATOR, - T_DOUBLE_ARROW, - "[", - "]", - T_LOGICAL_OR, - T_LOGICAL_XOR, - T_LOGICAL_AND - ); - - /*}}}*/ - /*{{{ protected function processLine() */ - - /** - * Process a line read from the file and determine if it is an - * executable line or not. - * - * This is the work horse function that does most of the parsing. - * To parse PHP, get_all_tokens() tokenizer function is used. - * - * @param $line Line to be parsed. - * @access protected - */ - protected function processLine($line) { - - // Default values - $this->lineType = LINE_TYPE_NOEXEC; - $line = trim($line); - $parseLine = $line; - $artificialStart = false; - $artificialEnd = false; - - // If we are not inside PHP opening tag - if( ! $this->inPHP) { - $pos = -1; - - // Confirm that the line does not have T_OPEN_TAG_WITH_ECHO (< ? =) - if(strpos($line, $this->phpStarters[2]) === false) { - // If the line has PHP start tag of the first kind - if(($pos = strpos($line, $this->phpStarters[0])) !== false) { - $pos = $pos + strlen($this->phpStarters[0]); - } - // if the line has PHP start tag of the second kind. - else if(($pos = strpos($line, $this->phpStarters[1])) !== false) { - $pos = $pos + strlen($this->phpStarters[1]); - } - // $pos now points to the character after opening tag - if($pos > 0) { - $this->inPHP = true; - //echo "Going in PHP\n"; - // Remove the part of the line till the PHP opening - // tag and recurse - return $this->processLine(trim(substr($line, $pos))); - } - } - } - // If we are already in PHP - else if($this->inPHP) { - // If we are inside a multi-line comment, that is not ending - // on the same line - if((strpos($line, "/*") !== false && - strpos($line, "*/") === false) || - (strpos($line, "/*") > strpos($line, "*/"))) { - $this->inComment = true; - } - if($this->inComment) { - // Do we need to append an artificial comment start? - // (otherwise the tokenizer might throw error. - if(strpos($line, "/*") === false) { - $line = "/*" . $line; - $artificialStart = true; - } - // Do we need to append an artificial comment end? - if(strpos($line, "*/") === false) { - $line = $line . "*/"; - $artificialEnd = true; - } - } - // Since we are inside php, append php opening and closing tags - // to prevent tokenizer from mis-interpreting the line - $parseLine = ""; - } - - // Tokenize - $tokens = @token_get_all($parseLine); - $this->logger->debug("inPHP? " . $this->inPHP . "\nLine:" . $parseLine, - __FILE__, __LINE__); - $this->logger->debug(print_r($tokens, true), __FILE__, __LINE__); - $seenEnough = false; - $seeMore = false; - $tokenCnt = 0; //tokens in this line - $phpEnded = false; - if($this->isContinuation($this->lastLineEndTokenType)) { - $this->lineType = LINE_TYPE_CONT; - $this->logger->debug("Continuation !", __FILE__, __LINE__); - } - foreach($tokens as $token) { - $tokenCnt ++; - if($this->inPHP) { - if($tokenCnt == 2) { - if($this->isContinuation($token)) { - $this->lineType = LINE_TYPE_CONT; - $this->logger->debug("Continuation! Token: $token", - __FILE__, __LINE__); - break; - } - } - } - - if(is_string($token)) { - // FIXME: Add more cases, if needed - switch($token) { - // Any of these things, are non-executable. - case '{': - case '}': - case '(': - case ')': - case ';': - if($this->lineType != LINE_TYPE_EXEC) { - $this->lineType = LINE_TYPE_NOEXEC; - } - break; - - // Everything else by default is executable. - default: - $this->lineType = LINE_TYPE_EXEC; - break; - } - $this->logger->debug("Status: " . $this->getLineTypeStr($this->lineType) . "\t\tToken: $token", - __FILE__, __LINE__); - } - else { - // The token is an array - list($tokenType, $text) = $token; - switch($tokenType) { - - // If it is a comment end or start, set the correct flag - // If we have put the start or end artificially, ignore! - case T_COMMENT: - case T_DOC_COMMENT: - if(strpos($text, "/*") !== false && !$artificialStart) { - $this->inComment = true; - } - if(strpos($text, "*/") !== false && !$artificialEnd) { - $this->inComment = false; - } - - case T_WHITESPACE: // white space - case T_OPEN_TAG: // < ? - case T_OPEN_TAG_WITH_ECHO: // < ? = - case T_CURLY_OPEN: // - case T_INLINE_HTML: //
    jhsk - //case T_STRING: // - case T_EXTENDS: // extends - case T_STATIC: // static - case T_STRING_VARNAME: // string varname? - case T_CHARACTER: // character - case T_ELSE: // else - case T_CONSTANT_ENCAPSED_STRING: // "some str" - case T_START_HEREDOC: - // Only if decision is not already made - // mark this non-executable. - if($this->lineType != LINE_TYPE_EXEC) { - $this->lineType = LINE_TYPE_NOEXEC; - } - break; - - case T_PRIVATE: // private - case T_PUBLIC: // public - case T_PROTECTED: // protected - case T_VAR: // var - case T_FUNCTION: // function - case T_CLASS: // class - case T_INTERFACE: // interface - case T_REQUIRE: // require - case T_REQUIRE_ONCE: // require_once - case T_INCLUDE: // include - case T_INCLUDE_ONCE: // include_once - case T_ARRAY: // array - case T_SWITCH: // switch - case T_CONST: // const - case T_TRY: // try - $this->lineType = LINE_TYPE_NOEXEC; - // No need to see any further - $seenEnough = true; - break; - - case T_VARIABLE: // $foo - $seeMore = true; - $this->lineType = LINE_TYPE_EXEC; - break; - - case T_CLOSE_TAG: - if($tokenCnt != count($tokens)) { - // Token is not last (because we inserted that) - $this->logger->debug("T_CLOSE_TAG for tokenCnt " . $tokenCnt . " End of PHP code."); - $phpEnded = true; // php end tag found within the line. - } - if($this->lineType != LINE_TYPE_EXEC) { - $this->lineType = LINE_TYPE_NOEXEC; - } - break; - - default: - $seeMore = false; - $this->lineType = LINE_TYPE_EXEC; - break; - } - $this->logger->debug("Status: " . $this->getLineTypeStr($this->lineType) . "\t\tToken type: $tokenType \tText: $text", - __FILE__, __LINE__); - } - if(($this->lineType == LINE_TYPE_EXEC && !$seeMore) - || $seenEnough) { - $this->logger->debug("Made a decision! Exiting. Token Type: $tokenType & Text: $text", - __FILE__, __LINE__); - if($seenEnough) { - $this->logger->debug("Seen enough at Token Type: $tokenType & Text: $text", - __FILE__, __LINE__); - } - break; - } - } // end foreach - $this->logger->debug("Line Type: " . $this->getLineTypeStr($this->lineType), - __FILE__, __LINE__); - if($this->inPHP) { - $this->lastLineEndTokenType = $this->getLastTokenType($tokens); - } - $this->logger->debug("Last End Token: " . $this->lastLineEndTokenType, - __FILE__, __LINE__); - - if($this->inPHP) { - // Check if PHP block ends on this line - if($phpEnded) { - $this->inPHP = false; - // If line is not executable so far, check for the - // remaining part - if($this->lineType != LINE_TYPE_EXEC) { - //return $this->processLine(trim(substr($line, $pos+2))); - } - } - } - } - - /*}}}*/ - /*{{{ public function getLineType() */ - - /** - * Returns the type of line just read - * - * @return Line type - * @access public - */ - public function getLineType() { - return $this->lineType; - } - /*}}}*/ - /*{{{ protected function isContinuation() */ - - /** - * Check if a line is a continuation of the previous line - * - * @param &$token Second token in a line (after PHP start) - * @return Boolean True if the line is a continuation; false otherwise - * @access protected - */ - protected function isContinuation(&$token) { - if(is_string($token)) { - switch($token) { - case ".": - case ","; - case "]": - case "[": - case "(": - case ")": - case "=": - return true; - } - } - else { - list($tokenType, $text) = $token; - switch($tokenType) { - case T_CONSTANT_ENCAPSED_STRING: - case T_ARRAY: - case T_DOUBLE_ARROW: - case T_OBJECT_OPERATOR: - case T_LOGICAL_XOR: - case T_LOGICAL_AND: - case T_LOGICAL_OR: - case T_PLUS_EQUAL: - case T_MINUS_EQUAL: - case T_MUL_EQUAL: - case T_DIV_EQUAL: - case T_CONCAT_EQUAL: - case T_MOD_EQUAL: - case T_AND_EQUAL: - case T_OR_EQUAL: - case T_XOR_EQUAL: - case T_BOOLEAN_AND: - case T_BOOLEAN_OR: - case T_LNUMBER: - case T_DNUMBER: - return true; - - case T_STRING: - case T_VARIABLE: - return in_array($this->lastLineEndTokenType, PHPParser::$contTypes); - } - } - - return false; - } - /*}}}*/ - /*{{{ protected function getTokenType() */ - - /** - * Get the token type of a token (if exists) or - * the token itself. - * - * @param $token Token - * @return Token type or token itself - * @access protected - */ - protected function getTokenType($token) { - if(is_string($token)) { - return $token; - } - else { - list($tokenType, $text) = $token; - return $tokenType; - } - } - /*}}}*/ - /*{{{*/ - - /** - * Return the type of last non-empty token in a line - * - * @param &$tokens Array of tokens for a line - * @return mixed Last non-empty token type (or token) if exists; false otherwise - * @access protected - */ - protected function getLastTokenType(&$tokens) { - for($i = count($tokens)-2; $i > 0; $i--) { - if(empty($tokens[$i])) { - continue; - } - if(is_string($tokens[$i])) { - return $tokens[$i]; - } - else { - list($tokenType, $text) = $tokens[$i]; - if($tokenType != T_WHITESPACE && $tokenType != T_EMPTY) { - return $tokenType; - } - } - } - return false; - } - /*}}}*/ - - /* - // Main - $obj = new PHPParser(); - $obj->parse("test.php"); - while(($line = $obj->getLine()) !== false) { - echo "#########################\n"; - echo "[" . $line . "] Type: [" . $obj->getLineTypeStr($obj->getLineType()) . "]\n"; - echo "#########################\n"; - } - */ - - } -?> diff --git a/vendor/spikephpcoverage/parser/Parser.php b/vendor/spikephpcoverage/parser/Parser.php deleted file mode 100644 index 0dea02f77..000000000 --- a/vendor/spikephpcoverage/parser/Parser.php +++ /dev/null @@ -1,217 +0,0 @@ - -totalLines = 0; - $this->coveredLines = 0; - $this->uncoveredLines = 0; - - $this->fileRef = false; - $this->line = false; - $this->lineType = false; - - $this->logger = $util->getLogger(); - } - - /*}}}*/ - /*{{{ public abstract function parse() */ - - /** - * Parse a given file - * - * @param $filename Full path of the file - * @return FALSE on error. - * @access public - */ - public function parse($filename) { - $this->filename = $filename; - $ret = $this->openFileReadOnly(); - if( ! $ret) { - die("Error: Cannot open file: $this->filename \n"); - } - } - - /*}}}*/ - /*{{{ protected abstract function processLine() */ - - /** - * Process the line and classify it into either - * covered and uncovered. - * - * @param $line - * @return - * @access protected - */ - protected abstract function processLine($line); - - /*}}}*/ - /*{{{ public function getLine() */ - - /** - * Returns the next line from file. - * - * @return Next line from file - * @access public - */ - public function getLine() { - if( ! feof($this->fileRef)) { - $this->line = fgets($this->fileRef); - $this->processLine($this->line); - } - else { - fclose($this->fileRef); - $this->line = false; - } - return $this->line; - } - - /*}}}*/ - /*{{{ public abstract function getLineType() */ - - /** - * Returns the type of last line read. - * - * The type can be either - * * LINE_TYPE_EXEC Line that can be executed. - * * LINE_TYPE_NOEXEC Line that cannot be executed. - * This includes the variable and function definitions - * (without initialization), blank lines, non-PHP lines, - * etc. - * - * @return Type of last line - * @access public - */ - public abstract function getLineType(); - - /*}}}*/ - /*{{{ public function getLineTypeStr() */ - - /** - * Returns the string representation of LINE_TYPE - * - * @param $lineType - * @return Type of line - * @access public - */ - public function getLineTypeStr($lineType) { - if($lineType == LINE_TYPE_EXEC) { - return "LINE_TYPE_EXEC"; - } - else if($lineType == LINE_TYPE_NOEXEC) { - return "LINE_TYPE_NOEXEC"; - } - else if($lineType == LINE_TYPE_CONT) { - return "LINE_TYPE_CONT"; - } - else { - return "LINE_TYPE_UNKNOWN"; - } - } - - /*}}}*/ - /*{{{ protected function openFileReadOnly() */ - - /** - * Opens the file to be parsed in Read-only mode - * - * @return FALSE on failure. - * @access protected - */ - protected function openFileReadOnly() { - $this->fileRef = fopen($this->filename, "r"); - return $this->fileRef !== false; - } - - /*}}}*/ - /*{{{ public function getTotalLines() */ - - /** - * Returns the total lines (PHP, non-PHP) from a file - * - * @return Number of lines - * @access public - */ - public function getTotalLines() { - return $this->totalLines; - } - - /*}}}*/ - /*{{{ public function getCoveredLines() */ - - /** - * Returns the number of covered PHP lines - * - * @return Number of covered lines - * @access public - */ - public function getCoveredLines() { - return $this->coveredLines; - } - - /*}}}*/ - /*{{{ public function getUncoveredLines() */ - - /** - * Returns the number of uncovered PHP lines - * - * Note that the sum of covered and uncovered - * lines may not be equal to total lines. - * - * @return Number of uncovered lines - * @access public - */ - public function getUncoveredLines() { - return $this->uncoveredLines; - } - - /*}}}*/ - } - -?> diff --git a/vendor/spikephpcoverage/phpcoverage.inc.php b/vendor/spikephpcoverage/phpcoverage.inc.php deleted file mode 100644 index d5892e8d4..000000000 --- a/vendor/spikephpcoverage/phpcoverage.inc.php +++ /dev/null @@ -1,56 +0,0 @@ - - PHPCOVERAGE_HOME=/path/to/coverage/home'\n"; - die($msg); - } - - // Fallback - if( ! defined("PHPCOVERAGE_HOME")) { - $include_path = get_include_path(); - set_include_path($PHPCOVERAGE_HOME. PATH_SEPARATOR . $include_path); - define('PHPCOVERAGE_HOME', $PHPCOVERAGE_HOME); - } - - error_log("[phpcoverage.inc.php] PHPCOVERAGE_HOME=" . $PHPCOVERAGE_HOME); - error_log("[phpcoverage.inc.php] PHPCOVERAGE_REPORT_DIR=" . $PHPCOVERAGE_REPORT_DIR); - error_log("[phpcoverage.inc.php] PHPCOVERAGE_APPBASE_PATH=" . $PHPCOVERAGE_APPBASE_PATH); - -?> diff --git a/vendor/spikephpcoverage/phpcoverage.remote.bottom.inc.php b/vendor/spikephpcoverage/phpcoverage.remote.bottom.inc.php deleted file mode 100644 index 18b1d6b37..000000000 --- a/vendor/spikephpcoverage/phpcoverage.remote.bottom.inc.php +++ /dev/null @@ -1,51 +0,0 @@ - -getLogger(); - - // Create a distinct hash (may or may not be unique) - $session_id = md5($_SERVER["REMOTE_ADDR"] . $_SERVER["SERVER_NAME"]); - $tmpFile = $util->getTmpDir() . "/phpcoverage.session." . $session_id; - $logger->info("[phpcoverage.remote.bottom.inc.php] Session id: " . $session_id, - __FILE__, __LINE__); - - if( ! isset($cov)) { - if(file_exists($tmpFile)) { - $object = file_get_contents($tmpFile); - $cov = unserialize($object); - $logger->info("[phpcoverage.remote.bottom.inc.php] Coverage object found: " . $cov, __FILE__, __LINE__); - } - } - - if(isset($cov)) { - // PHPCoverage bottom half - if( ! isset($called_script)) { - $called_script = ""; - } - $logger->info("[phpcoverage.remote.bottom.inc.php] END: " . $called_script, - __FILE__, __LINE__); - // Save the code coverage - $cov->saveCoverageXml(); - $logger->info("[phpcoverage.remote.bottom.inc.php] Saved coverage xml", - __FILE__, __LINE__); - $cov->startInstrumentation(); - $logger->info("[phpcoverage.remote.bottom.inc.php] Instrumentation turned on.", - __FILE__, __LINE__); - $object = serialize($cov); - file_put_contents($tmpFile, $object); - $logger->info("[phpcoverage.remote.bottom.inc.php] ################## END ###################", - __FILE__, __LINE__); - } - } - -?> diff --git a/vendor/spikephpcoverage/phpcoverage.remote.top.inc.php b/vendor/spikephpcoverage/phpcoverage.remote.top.inc.php deleted file mode 100644 index 515082ffc..000000000 --- a/vendor/spikephpcoverage/phpcoverage.remote.top.inc.php +++ /dev/null @@ -1,151 +0,0 @@ - - in your HTTP request."; - error_log("[phpcoverage.remote.top.inc.php] FATAL: " . $msg); - die($msg); - } - else { - $PHPCOVERAGE_HOME = $env_var; - } - } - - if(empty($PHPCOVERAGE_HOME) || !is_dir($PHPCOVERAGE_HOME)) { - $msg = "ERROR: Could not locate PHPCOVERAGE_HOME [$PHPCOVERAGE_HOME]. "; - $msg .= "Use 'php PHPCOVERAGE_HOME=/path/to/coverage/home'\n"; - die($msg); - } - - - // Fallback - if( ! defined("PHPCOVERAGE_HOME")) { - $include_path = get_include_path(); - set_include_path($PHPCOVERAGE_HOME. ":" . $include_path); - define('PHPCOVERAGE_HOME', $PHPCOVERAGE_HOME); - } - - if($debug) error_log("[phpcoverage.remote.top.inc.php] PHPCOVERAGE_HOME=" . $PHPCOVERAGE_HOME); - - // Register the shutdown function to get code coverage results before - // script exits abnormally. - register_shutdown_function('spikephpcoverage_before_shutdown'); - require_once PHPCOVERAGE_HOME . "/conf/phpcoverage.conf.php"; - require_once PHPCOVERAGE_HOME . "/util/Utility.php"; - require_once PHPCOVERAGE_HOME . "/remote/RemoteCoverageRecorder.php"; - require_once PHPCOVERAGE_HOME . "/reporter/HtmlCoverageReporter.php"; - - global $util; - $logger = $util->getLogger(); - - // Create a distinct hash (may or may not be unique) - $session_id = md5($_SERVER["REMOTE_ADDR"] . $_SERVER["SERVER_NAME"]); - $tmpFile = $util->getTmpDir() . "/phpcoverage.session." . $session_id; - $logger->info("[phpcoverage.remote.top.inc.php] Session id: " . $session_id . " Saved in: " . $tmpFile, - __FILE__, __LINE__); - if(file_exists($tmpFile)) { - $object = file_get_contents($tmpFile); - $cov = unserialize($object); - $logger->info("[phpcoverage.remote.top.inc.php] Coverage object found." , - __FILE__, __LINE__); - } - else { - $covReporter = new HtmlCoverageReporter( - "PHPCoverage report", - "", - $util->getTmpDir() . "/php-coverage-report" - ); - $cov = new RemoteCoverageRecorder(array(), array(), $covReporter); - $object = serialize($cov); - file_put_contents($tmpFile, $object); - $logger->info("[phpcoverage.remote.top.inc.php] Stored coverage object found", - __FILE__, __LINE__); - } - - if( ! empty($_REQUEST["phpcoverage-action"])) { - $logger->info("[phpcoverage.remote.top.inc.php] phpcoverage-action=" . strtolower($_REQUEST["phpcoverage-action"]), - __FILE__, __LINE__); - switch(strtolower($_REQUEST["phpcoverage-action"])) { - case "init": - if( ! empty($_REQUEST["tmp-dir"])) { - $cov->setTmpDir($_REQUEST["tmp-dir"]); - } - $cov->setCoverageFileName($_REQUEST["cov-file-name"]); - if( ! $cov->cleanCoverageFile()) { - die("Cannot delete existing coverage data."); - } - break; - - case "instrument": - break; - - case "get-coverage-xml": - $cov->getCoverageXml(); - break; - - case "cleanup": - if(file_exists($tmpFile) && is_writable($tmpFile)) { - unlink($tmpFile); - unset($cov); - $logger->info("[phpcoverage.remote.top.inc.php] Cleaned up!", - __FILE__, __LINE__); - return; - } - else { - $logger->error("[phpcoverage.remote.top.inc.php] Error deleting file: " . $tmpFile, - __FILE__, __LINE__); - } - break; - } - } - - $cov->startInstrumentation(); - $logger->info("[phpcoverage.remote.top.inc.php] Instrumentation turned on.", - __FILE__, __LINE__); - $object = serialize($cov); - file_put_contents($tmpFile, $object); - $logger->info("[phpcoverage.remote.top.inc.php] BEGIN: " . $called_script, - __FILE__, __LINE__); - } - - function spikephpcoverage_before_shutdown() { - global $cov, $logger; - $logger->debug("[phpcoverage.remote.top.inc.php::before_shutdown()] Getting code coverage before shutdown: START", - __FILE__, __LINE__); - require dirname(__FILE__) . "/phpcoverage.remote.bottom.inc.php"; - $logger->debug("[phpcoverage.remote.top.inc.php::before_shutdown()] Getting code coverage before shutdown: FINISH", - __FILE__, __LINE__); - } -?> diff --git a/vendor/spikephpcoverage/remote/RemoteCoverageRecorder.php b/vendor/spikephpcoverage/remote/RemoteCoverageRecorder.php deleted file mode 100644 index 85c989865..000000000 --- a/vendor/spikephpcoverage/remote/RemoteCoverageRecorder.php +++ /dev/null @@ -1,309 +0,0 @@ - - - * @version $Revision: $ - * @package SpikePHPCoverage_Remote - */ - class RemoteCoverageRecorder extends CoverageRecorder { - /*{{{ Members */ - - protected $traceFilePath; - protected $xdebugTraceReader; - protected $tmpDir; - protected $tmpTraceFilename = "phpcoverage.xdebug.trace"; - protected $coverageFileName = "phpcoverage.coverage.xml"; - - protected $xmlStart = ""; - protected $xmlEnd = ""; - - /*}}}*/ - /*{{{ public function __construct() */ - - /** - * Constructor - * - * @access public - */ - public function __construct( - $includePaths=array("."), - $excludePaths=array(), - $reporter="new HtmlCoverageReporter()" - ) { - global $util; - parent::__construct($includePaths, $excludePaths, $reporter); - $this->isRemote = true; - $this->phpCoverageFiles[] = "phpcoverage.remote.inc.php"; - $this->phpCoverageFiles[] = "phpcoverage.remote.top.inc.php"; - $this->phpCoverageFiles[] = "phpcoverage.remote.bottom.inc.php"; - - // configuration - $this->tmpDir = $util->getTmpDir(); - } - - /*}}}*/ - /*{{{ Getters and Setters */ - - public function getTraceFilePath() { - return $this->traceFilePath; - } - - public function setTraceFilePath($traceFilePath) { - $this->traceFilePath = $traceFilePath; - } - - public function getTmpDir() { - return $this->tmpDir; - } - - public function setTmpDir($tmpTraceDir) { - $this->tmpDir = $tmpTraceDir; - } - - public function getCoverageFileName() { - return $this->coverageFileName; - } - - public function setCoverageFileName($covFileName) { - $this->coverageFileName = $covFileName; - } - - /*}}}*/ - /*{{{ public function cleanCoverageFile() */ - - /** - * Deletes a coverage data file if one exists. - * - * @return Boolean True on success, False on failure. - * @access public - */ - public function cleanCoverageFile() { - $filepath = $this->tmpDir . "/" . $this->coverageFileName; - if(file_exists($filepath)) { - if(is_writable($filepath)) { - unlink($filepath); - } - else { - $this->logger->error("[RemoteCoverageRecorder::cleanCoverageFile()] " - . "ERROR: Cannot delete $filepath.", __FILE__, __LINE__); - return false; - } - } - return true; - } - - /*}}}*/ - /*{{{ protected function prepareCoverageXml() */ - - /** - * Convert the Coverage data into an XML. - * - * @return String XML generated from Coverage data - * @access protected - */ - protected function prepareCoverageXml() { - global $util; - $xmlString = ""; - $xmlBody = ""; - if( ! empty($this->coverageData)) { - foreach($this->coverageData as $file => &$lines) { - $xmlBody .= "replaceBackslashes($file) . "\">"; - foreach($lines as $linenum => &$frequency) { - $xmlBody .= ""; - } - $xmlBody .= "\n"; - } - unset($this->coverageData); - } - else { - $this->logger->info("[RemoteCoverageRecorder::prepareCoverageXml()] Coverage data is empty.", - __FILE__, __LINE__); - } - $xmlString .= $xmlBody; - $this->logger->debug("[RemoteCoverageRecorder::prepareCoverageXml()] Xml: " . $xmlString, __FILE__, __LINE__); - return $xmlString; - } - - /*}}}*/ - /*{{{ protected function parseCoverageXml() */ - - /** - * Parse coverage XML to regenerate the Coverage data array. - * - * @param $xml XML String or URL of the coverage data - * @param $stream=false Is the input a stream? - * @return - * @access protected - */ - protected function parseCoverageXml(&$xml, $stream=false) { - // Need to handle multiple xml files. - if( ! is_array($xml)) { - $xml = array($xml); - } - for($i = 0; $i < count($xml); $i++) { - $xmlParser = new CoverageXmlParser(); - if($stream) { - $xmlParser->setInput($xml[$i]); - } - else { - $xmlParser->setInputString($xml[$i]); - } - $xmlParser->parse(); - $data =& $xmlParser->getCoverageData(); - if(empty($this->coverageData)) { - $this->coverageData = $data; - } - else { - $data2 = array_merge_recursive($this->coverageData, $data); - $this->coverageData = $data2; - } - $this->logger->debug("[RemoteCoverageRecorder::prepareCoverageXml()] " . "Coverage data intermediate: " . print_r($this->coverageData, true)); - } - } - - /*}}}*/ - /*{{{ public function getCoverageXml() */ - - /** - * Dumps the coverage data in XML format - * - * @access public - */ - public function getCoverageXml() { - $filepath = $this->tmpDir . "/" . $this->coverageFileName; - if(file_exists($filepath) && is_readable($filepath)) { - $fp = fopen($filepath, "r"); - if($fp) { - while( ! feof($fp)) { - $xml = fread($fp, 4096); - echo $xml; - } - fclose($fp); - return true; - } - else { - $this->logger->error("Could not read coverage data file.", - __FILE__, __LINE__); - } - } - else { - $this->logger->error("[RemoteCoverageRecorder::getCoverageXml()] " - . "ERROR: Cannot read file " . $filepath, __FILE__, __LINE__); - } - return false; - } - - /*}}} */ - /*{{{ protected function appendDataToFile() */ - - /** - * Append coverage data to xml file - * - * @param $newXml New xml recorded - * @return True on success; false otherwise - * @access protected - */ - protected function appendDataToFile($newXml) { - $filepath = $this->tmpDir . "/" . $this->coverageFileName; - if( ! file_exists($filepath)) { - // If new file, write the xml start and end tags - $bytes = file_put_contents($filepath, $this->xmlStart . "\n" . $this->xmlEnd); - if( ! $bytes) { - $this->logger->critical("[RemoteCoverageRecorder::appendDataToFile()] Could not create file: " . $filepath, __FILE__, __LINE__); - return false; - } - } - if(file_exists($filepath) && is_readable($filepath)) { - $res = fopen($filepath, "r+"); - if($res) { - fseek($res, -1 * strlen($this->xmlEnd), SEEK_END); - $ret = fwrite($res, $newXml); - if( ! $ret) { - $this->logger->error("[RemoteCoverageRecorder::appendDataToFile()] Could not append data to file.", - __FILE__, __LINE__); - fclose($res); - return false; - } - fwrite($res, $this->xmlEnd); - fclose($res); - } - else { - $this->logger->error("[RemoteCoverageRecorder::appendDataToFile()] Error opening file for writing: " . $filepath, - __FILE__, __LINE__); - return false; - } - } - return true; - } - - /*}}}*/ - /*{{{ public function saveCoverageXml() */ - - /** - * Append coverage xml to a xml data file. - * - * @return Boolean True on success, False on error - * @access public - */ - public function saveCoverageXml() { - $filepath = $this->tmpDir . "/" . $this->coverageFileName; - if($this->stopInstrumentation()) { - $xml = $this->prepareCoverageXml(); - $ret = $this->appendDataToFile($xml); - if( ! $ret) { - $this->logger->warn("[RemoteCoverageRecorder::saveCoverageXml()] " - . "ERROR: Nothing was written to " . $filepath, - __FILE__, __LINE__); - return false; - } - $this->logger->info("[RemoteCoverageRecorder::saveCoverageXml()] " - . "Saved XML to $filepath; size: [" . filesize($filepath) - . "]", __FILE__, __LINE__); - return true; - } - return false; - } - - /*}}}*/ - /*{{{ public function generateReport() */ - - /** - * Generate report from the xml coverage data - * The preferred method for usage of this function is - * passing a stream of the XML data in. This is much more - * efficient and consumes less memory. - * - * @param $xmlUrl Url where XML data is available or string - * @param $stream=false Is the xml available as stream? - * @access public - */ - public function generateReport($xmlUrl, $stream=false) { - $this->logger->debug("XML Url: " . $xmlUrl, __FILE__, __LINE__); - $this->parseCoverageXml($xmlUrl, true); - $this->logger->debug("Coverage Data final: " . print_r($this->coverageData, true)); - parent::generateReport(); - } - - /*}}}*/ - } -?> diff --git a/vendor/spikephpcoverage/remote/XdebugTraceReader.php b/vendor/spikephpcoverage/remote/XdebugTraceReader.php deleted file mode 100644 index a73cf799a..000000000 --- a/vendor/spikephpcoverage/remote/XdebugTraceReader.php +++ /dev/null @@ -1,125 +0,0 @@ - - - * @version $Revision: $ - * @package SpikePHPCoverage_Parser - */ - class XdebugTraceReader { - /*{{{ Members */ - - protected $traceFilePath; - protected $handle; - protected $coverage = array(); - - /*}}}*/ - /*{{{ Constructor */ - - /** - * Constructor - * - * @param $traceFilePath Path of the Xdebug trace file - * @access public - */ - public function __construct($traceFilePath) { - $this->traceFilePath = $traceFilePath; - } - - /*}}}*/ - /*{{{ protected function openTraceFile() */ - - /** - * Opens the trace file - * - * @return Boolean True on success, false on failure. - * @access protected - */ - protected function openTraceFile() { - $this->handle = fopen($this->traceFilePath, "r"); - return !empty($this->handle); - } - - /*}}}*/ - /*{{{ public function parseTraceFile() */ - - /** - * Parses the trace file - * - * @return Boolean True on success, false on failure. - * @access public - */ - public function parseTraceFile() { - if( ! $this->openTraceFile()) { - error_log("[XdebugTraceReader::parseTraceFile()] Unable to read trace file."); - return false; - } - while( ! feof($this->handle)) { - $line = fgets($this->handle); - // echo "Line: " . $line . "\n"; - $this->processTraceLine($line); - } - fclose($this->handle); - return true; - } - - /*}}}*/ - /*{{{ protected function processTraceLine() */ - - /** - * Process a give trace line - * - * @param $line Line from a trace file - * @return Boolean True on success, false on failure - * @access protected - */ - protected function processTraceLine($line) { - $dataparts = explode("\t", $line); - // print_r($dataparts); - $cnt = count($dataparts); - if($cnt < 2) { - return false; - } - if( ! file_exists($dataparts[$cnt-2])) { - // echo "No file: " . $dataparts[$cnt-2] . "\n"; - return false; - } - // Trim the entries - $dataparts[$cnt-2] = trim($dataparts[$cnt-2]); - $dataparts[$cnt-1] = trim($dataparts[$cnt-1]); - - if( ! isset($this->coverage[$dataparts[$cnt-2]][$dataparts[$cnt-1]])) { - $this->coverage[$dataparts[$cnt-2]][$dataparts[$cnt-1]] = 1; - } - else { - $this->coverage[$dataparts[$cnt-2]][$dataparts[$cnt-1]] ++; - } - return true; - } - - /*}}}*/ - /*{{{ public function getCoverageData() */ - - /** - * Returns the coverage array - * - * @return Array Array of coverage data from parsing. - * @access public - */ - public function getCoverageData() { - return $this->coverage; - } - - /*}}}*/ - } -?> diff --git a/vendor/spikephpcoverage/reporter/CoverageReporter.php b/vendor/spikephpcoverage/reporter/CoverageReporter.php deleted file mode 100644 index af90953ea..000000000 --- a/vendor/spikephpcoverage/reporter/CoverageReporter.php +++ /dev/null @@ -1,302 +0,0 @@ - - - * @version $Revision: 14665 $ - * @package SpikePHPCoverage_Reporter - */ - abstract class CoverageReporter { - // {{{ Members - - protected $logger; - - // Report heading - will be displayed as the title of the main page. - protected $heading; - // CSS file path to be used. - protected $style; - // Directory where the report file(s) are written. - protected $outputDir; - - // Total number of lines in all the source files. - protected $grandTotalLines; - // Total number of lines covered in code coverage measurement. - protected $grandTotalCoveredLines; - // Total number of executable code lines that were left untouched. - protected $grandTotalUncoveredLines; - // Total number of files included - protected $grandTotalFiles; - protected $fileCoverage = array(); - protected $recorder = false; - - // }}} - /*{{{ public function __construct()*/ - - /** - * The constructor (PHP5 compatible) - * - * @param $heading - * @param $style - * @param $dir - * @access public - */ - public function __construct( - $heading="Coverage Report", - $style="", - $dir="report" - ) { - - global $util; - echo get_class($util); - $this->heading = $heading; - $this->style = $style; - $this->outputDir = $util->replaceBackslashes($dir); - // Create the directory if not there - $this->createReportDir(); - $this->grandTotalFiles = 0; - $this->grandTotalLines = 0; - $this->grandTotalCoveredLines = 0; - $this->grandTotalUncoveredLines = 0; - - // Configure - $this->logger = $util->getLogger(); - } - - /*}}}*/ - /*{{{ protected function createReportDir() */ - - /** - * Create the report directory if it does not exists - * - * @access protected - */ - protected function createReportDir() { - global $util; - if( ! file_exists($this->outputDir)) { - $util->makeDirRecursive($this->outputDir, 0755); - } - if(file_exists($this->outputDir)) { - $this->outputDir = $util->replaceBackslashes(realpath($this->outputDir)); - } - } - - /*}}}*/ - /*{{{ protected function updateGrandTotals() */ - - /** - * Update the grand totals - * - * @param &$coverageCounts Coverage counts for a file - * @access protected - */ - protected function updateGrandTotals(&$coverageCounts) { - $this->grandTotalLines += $coverageCounts['total']; - $this->grandTotalCoveredLines += $coverageCounts['covered']; - $this->grandTotalUncoveredLines += $coverageCounts['uncovered']; - - $this->recordFileCoverageInfo($coverageCounts); - } - - /*}}}*/ - /*{{{ public function getGrandCodeCoveragePercentage()*/ - - /** - * Returns Overall Code Coverage percentage - * - * @return double Code Coverage percentage rounded to two decimals - * @access public - */ - public function getGrandCodeCoveragePercentage() { - if($this->grandTotalCoveredLines+$this->grandTotalUncoveredLines == 0) { - return round(0, 2); - } - return round(((double)$this->grandTotalCoveredLines/((double)$this->grandTotalCoveredLines + (double)$this->grandTotalUncoveredLines)) * 100.0, 2); - } - - /*}}}*/ - /*{{{ public function getFileCoverageInfo() */ - - /** - * Return the array containing file coverage information. - * - * The array returned contains following fields - * * filename: Name of the file - * * total: Total number of lines in that file - * * covered: Total number of executed lines in that file - * * uncovered: Total number of executable lines that were not executed. - * - * @return array Array of file coverage information - * @access public - */ - public function getFileCoverageInfo() { - return $this->fileCoverage; - } - - /*}}}*/ - /*{{{ public function recordFileCoverageInfo() */ - - /** - * Record the file coverage information for a file. - * - * @param &$fileCoverage Coverage information for a file - * @access protected - */ - protected function recordFileCoverageInfo(&$fileCoverage) { - $this->fileCoverage[] = $fileCoverage; - } - - /*}}}*/ - /*{{{ public function printTextSummary() */ - - /** - * Print the coverage summary to filename (if specified) or stderr - * - * @param $filename=false Filename to write the log to - * @access public - */ - public function printTextSummary($filename=false) { - global $util; - $str = "\n"; - $str .= "##############################################\n"; - $str .= " Code Coverage Summary: " . $this->heading . "\n"; - $str .= " Total Files: " . $this->grandTotalFiles . "\n"; - $str .= " Total Lines: " . $this->grandTotalLines . "\n"; - $str .= " Total Covered Lines of Code: " . $this->grandTotalCoveredLines . "\n"; - $str .= " Total Missed Lines of Code: " . $this->grandTotalUncoveredLines . "\n"; - $str .= " Total Lines of Code: " . ($this->grandTotalCoveredLines + $this->grandTotalUncoveredLines) . "\n"; - $str .= " Code Coverage: " . $this->getGrandCodeCoveragePercentage() . "%\n"; - $str .= "##############################################\n"; - - if(empty($filename)) { - file_put_contents("php://stdout", $str); - } - else { - $filename = $util->replaceBackslashes($filename); - if( ! file_exists(dirname($filename))) { - $ret = $util->makeDirRecursive(dirname($filename), 0755); - if( ! $ret) { - die ("Cannot create directory " . dirname($filename) . "\n"); - } - } - file_put_contents($filename, $str); - } - } - - /*}}}*/ -/*{{{ protected function makeRelative() */ - - /** - * Convert the absolute path to PHP file markup to a path relative - * to the report dir. - * - * @param $filepath PHP markup file path - * @return Relative file path - * @access protected - */ - protected function makeRelative($filepath) { - $dirPath = realpath($this->outputDir); - $absFilePath = realpath($filepath); - - if(strpos($absFilePath, $dirPath) === 0) { - $relPath = substr($absFilePath, strlen($dirPath)+1); - return $relPath; - } - return $absFilePath; - } - -/*}}}*/ -/*{{{ protected function getRelativeOutputDirPath() */ - - - /** - * Get the relative path of report directory with respect to the given - * filepath - * - * @param $filepath Path of the file (relative to the report dir) - * @return String Relative path of report directory w.r.t. filepath - * @access protected - */ - protected function getRelativeOutputDirPath($filepath) { - $relPath = ""; - $filepath = dirname($filepath); - while($filepath !== false && $filepath != ".") { - $relPath = "../" . $relPath; - $filepath = dirname($filepath); - } - return $relPath; - } - -/*}}}*/ - /*{{{ public abstract function generateReport() */ - - /** - * - * This function generates report using one of the concrete subclasses. - * - * @param &$data Coverage Data recorded by coverage recorder. - * @access public - */ - public abstract function generateReport(&$data); - - /*}}}*/ - /*{{{ Getters and Setters */ - - public function setHeading($heading) { - $this->heading = $heading; - } - - public function getHeading() { - return $this->heading; - } - - public function setStyle($style) { - $this->style = $style; - } - - public function getStyle() { - return $this->style; - } - - public function setOutputDir($dir) { - $this->outputDir = $dir; - } - - public function getOutputDir() { - return $this->outputDir; - } - - public function setCoverageRecorder(&$recorder) { - $this->recorder = $recorder; - } - - /*}}}*/ - } -?> diff --git a/vendor/spikephpcoverage/reporter/HtmlCoverageReporter.php b/vendor/spikephpcoverage/reporter/HtmlCoverageReporter.php deleted file mode 100644 index 75d187d70..000000000 --- a/vendor/spikephpcoverage/reporter/HtmlCoverageReporter.php +++ /dev/null @@ -1,616 +0,0 @@ - - - * @version $Revision: 14665 $ - * @package SpikePHPCoverage_Reporter - */ - class HtmlCoverageReporter extends CoverageReporter { - - /*{{{ Members */ - - private $coverageData; - private $htmlFile; - private $body; - private $header = "html/header.html"; - private $footer = "html/footer.html"; - private $indexHeader = "html/indexheader.html"; - private $indexFooter = "html/indexfooter.html"; - - /*}}}*/ - /*{{{ public function __construct() */ - - /** - * Constructor method (PHP5 only) - * - * @param $heading Heading of the report (shown as title) - * @param $style Name of the stylesheet file - * @param $dir Directory where the report files should be dumped - * @access public - */ - public function __construct( - $heading="Coverage Report", - $style="", - $dir="report" - ) { - parent::__construct($heading, $style, $dir); - } - - /*}}}*/ - /*{{{ public function generateReport() */ - - /** - * Implementaion of generateReport abstract function. - * This is the only function that will be called - * by the instrumentor. - * - * @param &$data Reference to Coverage Data - * @access public - */ - public function generateReport(&$data) { - if( ! file_exists($this->outputDir)) { - mkdir($this->outputDir); - } - $this->coverageData =& $data; - $this->grandTotalFiles = count($this->coverageData); - $ret = $this->writeIndexFile(); - if($ret === FALSE) { - $this->logger->error("Error occured!!!", __FILE__, __LINE__); - } - $this->logger->debug(print_r($data, true), __FILE__, __LINE__); - } - - /*}}}*/ - /*{{{ private function writeIndexFileHeader() */ - - /** - * Write the index file header to a string - * - * @return string String containing HTML code for the index file header - * @access private - */ - private function writeIndexFileHeader() { - $str = false; - $dir = realpath(dirname(__FILE__)); - if($dir !== false) { - $str = file_get_contents($dir . "/" . $this->indexHeader); - if($str == false) { - return $str; - } - $str = str_replace("%%heading%%", $this->heading, $str); - $str = str_replace("%%style%%", $this->style, $str); - } - return $str; - } - - /*}}}*/ - /*{{{ private function writeIndexFileFooter() */ - - /** - * Write the index file footer to a string - * - * @return string String containing HTML code for the index file footer. - * @access private - */ - private function writeIndexFileFooter() { - $str = false; - $dir = realpath(dirname(__FILE__)); - if($dir !== false) { - $str = file_get_contents($dir . "/" . $this->indexFooter); - if($str == false) { - return $str; - } - } - return $str; - } - - /*}}}*/ - /*{{{ private function createJSDir() */ - - /** - * Create a directory for storing Javascript for the report - * - * @access private - */ - private function createJSDir() { - $jsDir = $this->outputDir . "/js"; - if(file_exists($this->outputDir) && !file_exists($jsDir)) { - mkdir($jsDir); - } - $jsSortFile = realpath(dirname(__FILE__)) . "/js/sort_spikesource.js"; - copy($jsSortFile, $jsDir . "/" . "sort_spikesource.js"); - return true; - } - - /*}}}*/ - /*{{{ private function createImagesDir() */ - - /** - * Create a directory for storing images for the report - * - * @access private - */ - private function createImagesDir() { - $imagesDir = $this->outputDir . "/images"; - if(file_exists($this->outputDir) && !file_exists($imagesDir)) { - mkdir($imagesDir); - } - $imagesSpikeDir = $imagesDir . "/spikesource"; - if( ! file_exists($imagesSpikeDir)) { - mkdir($imagesSpikeDir); - } - $imagesArrowUpFile = realpath(dirname(__FILE__)) . "/images/arrow_up.gif"; - $imagesArrowDownFile = realpath(dirname(__FILE__)) . "/images/arrow_down.gif"; - $imagesPHPCoverageLogoFile = realpath(dirname(__FILE__)) . "/images/spikesource/phpcoverage.gif"; - $imagesSpacerFile = realpath(dirname(__FILE__)) . "/images/spacer.gif"; - copy($imagesArrowUpFile, $imagesDir . "/" . "arrow_up.gif"); - copy($imagesArrowDownFile, $imagesDir . "/" . "arrow_down.gif"); - copy($imagesSpacerFile, $imagesDir . "/" . "spacer.gif"); - copy($imagesPHPCoverageLogoFile, $imagesSpikeDir . "/" . "phpcoverage.gif"); - return true; - } - - /*}}}*/ - /*{{{ private function createStyleDir() */ - - private function createStyleDir() { - if(isset($this->style)) { - $this->style = trim($this->style); - } - if(empty($this->style)) { - $this->style = "spikesource.css"; - } - $styleDir = $this->outputDir . "/css"; - if(file_exists($this->outputDir) && !file_exists($styleDir)) { - mkdir($styleDir); - } - $styleFile = realpath(dirname(__FILE__)) . "/css/" . $this->style; - copy($styleFile, $styleDir . "/" . $this->style); - return true; - } - - /*}}}*/ - /*{{{ protected function writeIndexFileTableHead() */ - - /** - * Writes the table heading for index.html - * - * @return string Table heading row code - * @access protected - */ - protected function writeIndexFileTableHead() { - $str = ""; - $str .= '

    Details

    '; - $str .= ''; - $str .= ''; - $str .= ''; - $str .= ''; - $str .= ''; - - // Second row - subheadings - $str .= ''; - $str .= ''; - $str .= ''; - $str .= ''; - $str .= ''; - $str .= ''; - $str .= ''; - return $str; - } - - /*}}}*/ - /*{{{ protected function writeIndexFileTableRow() */ - - /** - * Writes one row in the index.html table to display filename - * and coverage recording. - * - * @param $fileLink link to html details file. - * @param $realFile path to real PHP file. - * @param $fileCoverage Coverage recording for that file. - * @return string HTML code for a single row. - * @access protected - */ - protected function writeIndexFileTableRow($fileLink, $realFile, $fileCoverage) { - - global $util; - $fileLink = $this->makeRelative($fileLink); - $realFileShort = $util->shortenFilename($realFile); - $str = ""; - - $str .= ''; - $str .= '"; - $str .= '"; - $str .= '"; - $str .= '"; - if($fileCoverage['uncovered'] + $fileCoverage['covered'] == 0) { - // If there are no executable lines, assume coverage to be 100% - $str .= ''; - } - else { - $str .= ''; - } - return $str; - } - - /*}}}*/ - /*{{{ protected function writeIndexFileGrandTotalPercentage() */ - - /** - * Writes the grand total for coverage recordings on the index.html - * - * @return string HTML code for grand total row - * @access protected - */ - protected function writeIndexFileGrandTotalPercentage() { - $str = ""; - - $str .= "

    " . $this->heading . "


    "; - - $str .= '
    File Name LinesCode Coverage
    Total Covered Missed Executable
    '; - $str .= '' . $realFileShort. '' . '' . $fileCoverage['total'] . "' . $fileCoverage['covered'] . "' . $fileCoverage['uncovered'] . "' . ($fileCoverage['covered']+$fileCoverage['uncovered']) . "100%
    ' - . round(($fileCoverage['covered']/($fileCoverage['uncovered'] - + $fileCoverage['covered']))*100.0, 2) - . '%
    '; - $str .= ''; - if( ! empty($this->coverageData)) { - foreach($this->coverageData as $filename => &$lines) { - $realFile = realpath($filename); - $fileLink = $this->outputDir . $util->unixifyPath($realFile). ".html"; - $fileCoverage = $this->markFile($realFile, $fileLink, $lines); - if(empty($fileCoverage)) { - return false; - } - $this->recordFileCoverageInfo($fileCoverage); - $this->updateGrandTotals($fileCoverage); - - $str .= $this->writeIndexFileTableRow($fileLink, $realFile, $fileCoverage); - unset($this->coverageData[$filename]); - } - } - $str .= ''; - $str .= "

    Summary

    '; - $str .= ''; - $str .= ''; - $str .= ''; - - $str .= ''; - - $str .= ''; - $str .= ''; - $str .= ''; - - $str .= ''; - - $str .= ''; - $str .= ''; - $str .= ''; - - $str .= ''; - - $str .= ''; - $str .= ''; - $str .= ''; - - $str .= ''; - - $str .= ''; - $str .= ''; - $str .= ''; - - $str .= ''; - - $str .= ''; - $str .= ''; - $str .= ''; - - $str .= '
    Overall Code Coverage ' . $this->getGrandCodeCoveragePercentage() . '%
    Total Covered Lines of Code ' . $this->grandTotalCoveredLines.'(' . TOTAL_COVERED_LINES_EXPLAIN . ')
    Total Missed Lines of Code ' . $this->grandTotalUncoveredLines.'(' . TOTAL_UNCOVERED_LINES_EXPLAIN . ')
    Total Lines of Code ' . ($this->grandTotalCoveredLines + $this->grandTotalUncoveredLines) .'(' . - TOTAL_LINES_OF_CODE_EXPLAIN . ')
    Total Lines ' . $this->grandTotalLines.'(' . TOTAL_LINES_EXPLAIN . ')
    Total Files ' . $this->grandTotalFiles.'(' . TOTAL_FILES_EXPLAIN . ')
    '; - - return $str; - } - - /*}}}*/ - /*{{{ protected function writeIndexFile() */ - - /** - * Writes index.html file from all coverage recordings. - * - * @return boolean FALSE on failure - * @access protected - */ - protected function writeIndexFile() { - global $util; - $str = ""; - $this->createJSDir(); - $this->createImagesDir(); - $this->createStyleDir(); - $this->htmlFile = $this->outputDir . "/index.html"; - $indexFile = fopen($this->htmlFile, "w"); - if(empty($indexFile)) { - $this->logger->error("Cannot open file for writing: $this->htmlFile", - __FILE__, __LINE__); - return false; - } - - $strHead = $this->writeIndexFileHeader(); - if($strHead == false) { - return false; - } - $str .= $this->writeIndexFileTableHead(); - $str .= '
    "; - - $str .= "

    Report Generated On: " . $util->getTimeStamp() . "
    "; - $str .= "Generated using Spike PHPCoverage " . $this->recorder->getVersion() . "

    "; - - // Get the summary - $strSummary = $this->writeIndexFileGrandTotalPercentage(); - - // Merge them - with summary on top - $str = $strHead . $strSummary . $str; - - $str .= $this->writeIndexFileFooter(); - fwrite($indexFile, $str); - fclose($indexFile); - return TRUE; - } - - /*}}}*/ - /*{{{ private function writePhpFileHeader() */ - - /** - * Write the header for the source file with mark-up - * - * @param $filename Name of the php file - * @return string String containing the HTML for PHP file header - * @access private - */ - private function writePhpFileHeader($filename, $fileLink) { - $fileLink = $this->makeRelative($fileLink); - $str = false; - $dir = realpath(dirname(__FILE__)); - if($dir !== false) { - $str = file_get_contents($dir . "/" . $this->header); - if($str == false) { - return $str; - } - $str = str_replace("%%filename%%", $filename, $str); - // Get the path to parent CSS directory - $relativeCssPath = $this->getRelativeOutputDirPath($fileLink); - $relativeCssPath .= "/css/" . $this->style; - $str = str_replace("%%style%%", $relativeCssPath, $str); - } - return $str; - } - - /*}}}*/ - /*{{{ private function writePhpFileFooter() */ - - /** - * Write the footer for the source file with mark-up - * - * @return string String containing the HTML for PHP file footer - * @access private - */ - private function writePhpFileFooter() { - $str = false; - $dir = realpath(dirname(__FILE__)); - if($dir !== false) { - $str = file_get_contents($dir . "/" . $this->footer); - if($str == false) { - return $str; - } - } - return $str; - } - - /*}}}*/ - /*{{{ protected function markFile() */ - - /** - * Mark a source code file based on the coverage data gathered - * - * @param $phpFile Name of the actual source file - * @param $fileLink Link to the html mark-up file for the $phpFile - * @param &$coverageLines Coverage recording for $phpFile - * @return boolean FALSE on failure - * @access protected - */ - protected function markFile($phpFile, $fileLink, &$coverageLines) { - global $util; - $fileLink = $util->replaceBackslashes($fileLink); - $parentDir = $util->replaceBackslashes(dirname($fileLink)); - if( ! file_exists($parentDir)) { - //echo "\nCreating dir: $parentDir\n"; - $util->makeDirRecursive($parentDir, 0755); - } - $writer = fopen($fileLink, "w"); - - if(empty($writer)) { - $this->logger->error("Could not open file for writing: $fileLink", - __FILE__, __LINE__); - return false; - } - - // Get the header for file - $filestr = $this->writePhpFileHeader(basename($phpFile), $fileLink); - - // Add header for table - $filestr .= ''; - $filestr .= $this->writeFileTableHead(); - - $lineCnt = $coveredCnt = $uncoveredCnt = 0; - $parser = new PHPParser(); - $parser->parse($phpFile); - $lastLineType = "non-exec"; - $fileLines = array(); - while(($line = $parser->getLine()) !== false) { - $line = substr($line, 0, strlen($line)-1); - $lineCnt++; - $coverageLineNumbers = array_keys($coverageLines); - if(in_array($lineCnt, $coverageLineNumbers)) { - $lineType = $parser->getLineType(); - if($lineType == LINE_TYPE_EXEC) { - $coveredCnt ++; - $type = "covered"; - } - else if($lineType == LINE_TYPE_CONT) { - // XDebug might return this as covered - when it is - // actually merely a continuation of previous line - if($lastLineType == "covered") { - unset($coverageLines[$lineCnt]); - $type = $lastLineType; - } - else { - if($lineCnt-1 >= 0 && isset($fileLines[$lineCnt-1]["type"])) { - if($fileLines[$lineCnt-1]["type"] == "uncovered") { - $uncoveredCnt --; - } - $fileLines[$lineCnt-1]["type"] = $lastLineType = "covered"; - } - $coveredCnt ++; - $type = "covered"; - } - } - else { - $type = "non-exec"; - $coverageLines[$lineCnt] = 0; - } - } - else if($parser->getLineType() == LINE_TYPE_EXEC) { - $uncoveredCnt ++; - $type = "uncovered"; - } - else if($parser->getLineType() == LINE_TYPE_CONT) { - $type = $lastLineType; - } - else { - $type = "non-exec"; - } - // Save line type - $lastLineType = $type; - //echo $line . "\t[" . $type . "]\n"; - - if( ! isset($coverageLines[$lineCnt])) { - $coverageLines[$lineCnt] = 0; - } - $fileLines[$lineCnt] = array("type" => $type, "lineCnt" => $lineCnt, "line" => $line, "coverageLines" => $coverageLines[$lineCnt]); - } - $this->logger->debug("File lines: ". print_r($fileLines, true), - __FILE__, __LINE__); - for($i = 1; $i <= count($fileLines); $i++) { - $filestr .= $this->writeFileTableRow($fileLines[$i]["type"], - $fileLines[$i]["lineCnt"], - $fileLines[$i]["line"], - $fileLines[$i]["coverageLines"]); - } - $filestr .= "
    "; - $filestr .= $this->writePhpFileFooter(); - fwrite($writer, $filestr); - fclose($writer); - return array( - 'filename' => $phpFile, - 'covered' => $coveredCnt, - 'uncovered' => $uncoveredCnt, - 'total' => $lineCnt - ); - } - - /*}}}*/ - /*{{{ protected function writeFileTableHead() */ - - /** - * Writes table heading for file details table. - * - * @return string HTML string representing one table row. - * @access protected - */ - protected function writeFileTableHead() { - $filestr = ""; - - $filestr .= 'Line #'; - $filestr .= 'Frequency'; - $filestr .= 'Source Line'; - return $filestr; - } - - /*}}}*/ - /*{{{ protected function writeFileTableRow() */ - - /** - * Write a line for file details table. - * - * @param $color Text color - * @param $bgcolor Row bgcolor - * @param $lineCnt Line number - * @param $line The source code line - * @param $coverageLineCnt Number of time the line was executed. - * @return string HTML code for a table row. - * @access protected - */ - protected function writeFileTableRow($type, $lineCnt, $line, $coverageLineCnt) { - $spanstr = ""; - if($type == "covered") { - $spanstr .= ''; - } - else if($type == "uncovered") { - $spanstr .= ''; - } - else { - $spanstr .= ''; - } - - if(empty($coverageLineCnt)) { - $coverageLineCnt = ""; - } - - $filestr = ''; - $filestr .= '' . $spanstr . $lineCnt . ''; - if(empty($coverageLineCnt)) { - $coverageLineCnt = " "; - } - $filestr .= '' . $spanstr . $coverageLineCnt . ''; - $filestr .= '' . $spanstr . $this->preserveSpacing($line) . ''; - $filestr .= ""; - return $filestr; - } - - /*}}}*/ - /*{{{ protected function preserveSpacing() */ - - /** - * Changes all tabs and spaces with HTML non-breakable spaces. - * - * @param $string String containing spaces and tabs. - * @return string HTML string with replacements. - * @access protected - */ - protected function preserveSpacing($string) { - $string = htmlspecialchars($string); - $string = str_replace(" ", " ", $string); - $string = str_replace("\t", "    ", $string); - return $string; - } - - /*}}}*/ - } -?> diff --git a/vendor/spikephpcoverage/reporter/css/spikesource.css b/vendor/spikephpcoverage/reporter/css/spikesource.css deleted file mode 100644 index e299698dc..000000000 --- a/vendor/spikephpcoverage/reporter/css/spikesource.css +++ /dev/null @@ -1,1035 +0,0 @@ -/* www.spikesource.com style */ - -/* colors */ - -.logoBlue{ - background-color:#0066cc -} -.darkBlue{ - background-color:#003399 -} - -.lightBlue { - - background-color:#D2E7FC; -} -.faintBlue{ - background-color:#efefef; -} -/* Overload html tags */ -body{ - background-color:#ffffff; - font-size:11px; - font-family:Arial,Helvetica,sans-serif; - margin:0px; - color:#222222; -} - - -/* major page sections; containers are have "Box" suffix */ - -#pageBox{ - width:800px; - margin-left:20px; -} -#navBox{ - width:800px -} -#contentBox{ - width:800px; - margin-top:10px; -} - -/* spikesource.com elements */ - -#leftBox{ - width:600px; - padding-left:2px; - font-size:11px; - color:#222222; - line-height:14px -} -#rightBox{ - width:190px; - margin-bottom:5px; - margin-left:15px -} -#footerBox{ - border-top:2px solid #0066cc; - margin-top:15px; - width:800px; - height:22px; -} - -#leftNav { - width:165px; - margin-right:10px; -} -#leftRule { - width:175px; - border-right:1px solid #000000; -} - -#rightContent { - margin-left:15px; - width:600px; -} -#userInfo { - height:20px; - width:800px; -} - - -.navCell{ - height:31px; - border-left:1px solid #000000 -} - -.copyright{ - font-family:arial,sans-serif; - color:#666666; - font-size:10px; - font-weight:bold -} - -/* Convention:Do not overload html default styles - use spike[sometag] */ -h1,.spikeh1{ - font-size:17px; - font-family:Arial,Helvetica,sans-serif; - font-weight:bold; - color:#000000; - margin-bottom:4px; - margin-top:0px; -} -h2,.spikeh2{ - font-size:14px; - font-family:Arial,Helvetica,sans-serif; - font-weight:bold; - color:#003399; - margin-bottom:8px -} -h3,.spikeh3{ - font-size:12px; - font-family:Arial,Helvetica,sans-serif; - font-weight:bold; - color:#444444; - margin-bottom:0px -} -.spikep{ - margin-bottom:10px; - margin-top:5px; - padding-left:2px; - font-size:11px; - line-height:15px; - width:90%; -} -p{ - margin-bottom:10px; - margin-top:5px; - padding-left:2px; - font-size:11px; - line-height:15px; -} -.emph{ - font-style:oblique -} -ul,.spikeul{ - margin-left:22px; - padding:0px; - margin-top:5px; -} -li,.spikeli{ - list-style-position:outside; - line-height:14px; - font-size:11px; - margin-top:4px; - margin-left:2px; -} - - -.emphasis{ - font-size:13px; - font-family:Arial,Helvetica,sans-serif; - font-weight:bold; - color:#666666 -} - - -.rightHeader{ - font-size:14px; - font-family:Arial,Helvetica,sans-serif; - color:#222222; - font-weight:bold; - padding-bottom:2px; -} - -.blueRuleBox{ - width:175px; - border-bottom:2px solid #0066cc; - margin-left:15px; -} - -.rightRule{ - border-left:1px solid #000000; -} -.rightIndent{ - width:178px; - margin-left:15px; - font-size:11px; - color:#222222; - line-height:1.3em; - margin-top:7px; - text-align:left; - margin-bottom:5px -} - -.newsHeader{ - width:178px; - margin-left:15px; - font-size:12px; - color:#222222; - margin-bottom:2px; - margin-top:6px; - -} -ul.newsBox{ - margin-left:30px; - padding-bottom:5px -} - - -.content_small{ - font-family:Arial,Helvetica,sans-serif; - font-size:10px; - color:#444444 -} -.content{ - font-family:Arial,Helvetica,sans-serif; - font-size:11px; - color:#444444 -} -.content_gray{ - font-family:Arial,Helvetica,sans-serif; - font-size:11px; - color:#000000; - background-color:#e9e9e9 -} -.content_error{ - font-family:Arial,Helvetica,sans-serif; - font-size:11px; - color:#0066cc; - font-weight:bold -} -.contentError{ - font-family:Arial,Helvetica,sans-serif; - font-size:11px; - color:#990000; - font-weight:bold; -} -.content_required{ - font-family:Arial,Helvetica,sans-serif; - font-size:11px; - color:#0066cc -} -.content_bold { - font-size:11px; - font-weight:bold; -} -/* Tables */ -.spikeDataTable { - border-top:1px solid #5d6c7b; - border-right:1px solid #5d6c7b; - border-left:1px solid #5d6c7b; -} - -/* DataTable headings and cell styles */ -.spikeDataTableHeadRight { - font-size:12px; - font-weight:bold; - background-color:#d2e7fc; - border-right:2px solid #ffffff; - text-align:right; - padding-right:5px; -} -.spikeDataTableHeadLeft { - font-size:12px; - font-weight:bold; - background-color:#d2e7fc; - border-right:2px solid #ffffff; - text-align:left; - padding-left:5px; -} -.spikeDataTableHeadCenter { - font-size:12px; - font-weight:bold; - background-color:#d2e7fc; - border-right:2px solid #ffffff; - text-align:center; - margin-left:auto; - margin-right:auto; -} - -.spikeDataTableSubHeadRight { - font-size:11px; - font-weight:bold; - background-color:#d2e7fc; - border-right:2px solid #ffffff; - border-top:2px solid #ffffff; - text-align:right; - padding-right:5px; -} -.spikeDataTableSubHeadLeft { - font-size:11px; - font-weight:bold; - background-color:#d2e7fc; - border-right:2px solid #ffffff; - border-top:2px solid #ffffff; - text-align:left; - padding-left:5px; -} - -.spikeDataTableSubHeadCenter { - font-size:11px; - font-weight:bold; - background-color:#d2e7fc; - border-right:2px solid #ffffff; - border-top:2px solid #ffffff; - text-align:center; - margin-left:auto; - margin-right:auto; -} - -.spikeDataTableSubHeadLeftLast{ - font-size:11px; - font-weight:bold; - background-color:#d2e7fc; - border-top:2px solid #ffffff; - text-align:left; - padding-left:5px; -} -.spikeDataTableSubHeadCenterLast { - font-size:11px; - font-weight:bold; - background-color:#d2e7fc; - border-top:2px solid #ffffff; - text-align:center; - margin-left:auto; - margin-right:auto; -} -.spikeDataTableHeadRightLast { - font-size:12px; - font-weight:bold; - background-color:#d2e7fc; - text-align:right; - padding-right:5px; -} - -.spikeDataTableHeadLeftLast { - font-size:12px; - font-weight:bold; - background-color:#d2e7fc; - text-align:left; - padding-left:5px; -} -.spikeDataTableHeadCenterLast { - background-color:#d2e7fc; - font-size:12px; - font-weight:bold; - text-align:center; - margin-left:auto; - margin-right:auto; -} - - - -.spikeDataTableCellRight { - font-size:11px; - text-align:right; - border-bottom:1px solid #5d6c7b; - padding-right:5px; -} -.spikeDataTableCellRightBorder { - font-size:11px; - text-align:right; - border-bottom:1px solid #5d6c7b; - border-right:1px solid #cccccc; - padding-right:5px; -} -.spikeDataTableCellLeft { - font-size:11px; - text-align:left; - border-bottom:1px solid #5d6c7b; - padding-left:5px; -} -.spikeDataTableCellLeftBorder { - font-size:11px; - text-align:left; - border-bottom:1px solid #5d6c7b; - border-right:1px solid #cccccc; - padding-left:5px; -} -.spikeDataTableCellCenter { - font-size:11px; - text-align:center; - margin-left:auto; - margin-right:auto; - border-bottom:1px solid #5d6c7b; -} -.spikeDataTableCellCenterBorder { - font-size:11px; - text-align:center; - margin-left:auto; - margin-right:auto; - border-bottom:1px solid #5d6c7b; - border-right:1px solid #cccccc; -} -/* vertical table */ -.spikeVerticalTable { - border:1px solid #5d6c7b; -} -.spikeVerticalTableHead { - - font-size:12px; - font-weight:bold; - background-color:#d2e7fc; - border-bottom:2px solid #ffffff; - text-align:right; - padding-right:5px; - vertical-align:top; -} - -.spikeVerticalTableHeadLast { - - font-size:12px; - font-weight:bold; - background-color:#d2e7fc; - text-align:right; - padding-left:5px; - vertical-align:top; -} - -.spikeVerticalTableCell { - font-size:11px; - text-align:left; - border-bottom:1px solid #5d6c7b; - padding-left:5px; - vertical-align:top; -} -.spikeVerticalTableCellBold { - font-weight:bold; - font-size:11px; - text-align:left; - border-bottom:1px solid #5d6c7b; - padding-left:5px; - vertical-align:top; -} -.spikeVerticalTableCellLast { - font-size:11px; - text-align:left; - padding-left:5px; - vertical-align:top; -} - - -/* Top navigation */ -#navbar { - height:80px; - border-bottom:2px solid #0066cc; - width:642px; -} -.navText{ - padding-left:5px; - font-size:13px; - color:#000000; - font-weight:bold; - letter-spacing:1px; - text-decoration:none -} - -.navText:link,.navText:visited{ - color:#0066cc -} -.navText:hover{ - color:#000000 -} -.navTextOn { - color:#000000; - padding-left:5px; - font-size:13px; - font-weight:bold; - letter-spacing:1px; - text-decoration:none -} -/* left side navigation */ -.parent { - margin-left:15px; - width:160px; - font-weight: bold; - font-size: 11px; - font-family: Arial, Helvetica, sans-serif; - text-decoration:none; - padding-bottom:5px; - color:#0066cc; - vertical-align:top; -} - -.parentChild { - margin-left:0px; - width:175px; - font-weight: bold; - font-size: 11px; - font-family: Arial, Helvetica, sans-serif; - text-decoration:none; - padding-bottom:5px; - color:#0066cc; - vertical-align:top; -} -.submenu { - color:#000000; - width:145px; - text-decoration: none; - padding-top:1px; - padding-bottom:1px; - padding-left:25px; - -} - - -.submenu a { - white-space:normal; -} - - -.child { - padding-left:0px; - width:175px; - font-weight: bold; - font-size: 11px; - text-decoration:none; - display:none; - padding-bottom:2px; -} - - -.menuImage { - margin-right:6px; -} -.submenu a:visited {color: #0066cc; text-decoration:none; border:0px;} -.submenu a:link {color: #0066cc; text-decoration: none; border:0px;} -.submenu a:hover { color: #000000; text-decoration: none ; border:0px;} - -.parentChild a:visited { - color: #0066cc; - text-decoration:none; -} -.parentChild a:link { - color: #0066cc; - text-decoration:none; -} -.parentChild a:hover { - color: #000000; - text-decoration:none -} -.parent a:visited { - color: #0066cc; - text-decoration:none; -} -.parent a:link { - color: #0066cc; - text-decoration:none; -} -.parent a:hover { - color: #000000; - text-decoration:none -} - - -/* links */ -.footerlink:link, .footerlink:visited{ - color:#003399; - font-size:10px; - text-decoration:none -} - -.footerlink:hover{ - color:#000000; - text-decoration:underline -} -.contentlink{ - font-family:arial,sans-serif; - font-size:11px; -} -.contentlink:visited, .contentlink:link { - color:#0055bb; - text-decoration:none; -} -.contentlink:hover{ - color:#000000; - text-decoration:underline -} -.contentlinkBold{ - font-family:arial,sans-serif; - font-size:11px; - font-weight:bold; -} -.contentlinkBold:visited, .contentlinkBold:link { - color:#0055bb; - text-decoration:none; -} -.contentlinkBold:hover{ - color:#000000; - text-decoration:underline -} -a.headerlink{ - color:#000000; - text-decoration:underline; - -} -a.headerlink:hover { - text-decoration:underline; -} -a.externalLink, a.tablelink { - color:#000000; - text-decoration:none; -} -a.externalLink:link,a.tablelink:link { - color:#0055bb; -} -a.externalLink:visited,a.tablelink:visited { - color:#0055bb; -} -a.externalLink:hover,a.tablelink:hover { - color:#000000; - text-decoration:underline; -} - -a.tablelinkBold:link { - font-weight:bold; - text-decoration:none; - color:#0055bb; -} -a.tablelinkBold:visited { - font-weight:bold; - text-decoration:none; - color:#0066cc; -} -a.tablelinkBold:hover { - font-weight:bold; - color:#000000; - text-decoration:underline; -} -.blueHeader,.greyHeader{ - font-size:12px; - font-family:Arial,Helvetica,sans-serif; - color:#0066cc; - font-weight:bold -} - -/* form layout */ -.spikeForm{ - vertical-align:top; - margin:0px; - padding:0px; - border:1px solid #5d6c7b; -} -.spikeButton { - padding-right:10px; -} -.required { - margin-bottom:0px; - text-align:right; -} -.formRule{ - border-left:1px solid #000000; - padding-top:0px; - margin-left:0px; -} - - -.formHeader{ - padding-left:20px; - height: 22px; - background-color:#D2E7FC; - color: #000000; - font-size:12px; - font-weight:bold; -} -.formLabel{ - height:14px; - font-family:Arial,Helvetica,sans-serif; - font-size:11px; - color:#000000; - text-align:right; - font-weight:bold; - white-space:nowrap; -} -.formLabelL { - font-size:11px; - font-weight:bold; - color:#000000; - white-space:nowrap; -} -.formDirection { - padding-left:20px; - height: 20px; - background-color:#ededed; - color: #000000; - font-size:11px; -} -.formNote { - color:#333333; - font-size:10px; - padding-left:2px; -} -.label,.element{ - font-family:Arial,Helvetica,sans-serif; - color:#000000; - font-size:11px; -} -.checkLabel{ - font-family:Arial,Helvetica,sans-serif; - font-size:10px; - color:#000000; - font-weight:bold; - margin-right:2px; - vertical-align:middle; -} -.button{ - font-family:Arial,Helvetica,sans-serif; - font-size:10px; - color:#000000; - background-color:#e9e9e9; - border:1px solid #666666 -} - -.asterickR{ - margin-right:2px -} -.asterickL{ - margin-left:2px -} - -.blueButton{ - font-family:arial,tahoma,sans-serif; - font-size:11px; - font-weight:bold; - color:#ffffff; - background-color:#0066cc; - border-style:none; - border:none; - margin:0px; - padding:1px; -} - -/* Defines input boxes,textareas,and input checkboxes */ -.textfield{ - margin-left:2px; - border:1px solid #3d86ce; - background-color:#E7F1FA; - font-size:11px; - color:#333333 -} -input{ - margin:0px; - padding:0px -} -.checkbox { - margin-right:2px; - margin-left:0px; -} -.selectMenu{ - height:16px; - margin-left:4px; - background-color:#ffffff; - font-size:11px; - color:#333333 -} -.optionElem{ - font-size:11px; - color:#333333; - padding-bottom:2px -} -.multiBox{ - height:50px; - font-size:11px -} - -/* Required by HTML_QuickForm module */ -.errors{ - font-family:Arial,Helvetica,sans-serif; - color:#990000; - font-weight:bold -} -.note{ - font-family:Arial,Helvetica,sans-serif; - font-size:9px; - color:#000000 -} -/* Job Page styles */ - -.jobTitle { - font-family: Arial, Helvetica, sans-serif; - font-size:11px; - text-decoration:none; - line-height:12px; - font-weight:bold; - color:#0066cc; -} - -a.jobTitle:link { - color:#0066cc; - -} - -a.jobTitle:visited { - color:#0066cc; - -} - -a.jobTitle:hover { - color:#000000; - text-decoration:underline; - -} - -.jobTable { - margin-bottom:20px; -} - -.jobTable td { - padding-left:4px; -} - -.jobTable .jobTitle { - font-family:Verdana, Arial, Helvetica, sans-serif; - font-weight:bold; - color:#ffffff; - background-color:#0066cc; - /*background-color:#D2E7FC; */ - font-size:12px; - height:20px; - -} -p.jobDescription { - margin-bottom:5px; - margin-top:2px; -} - - - -/* old stuff */ - -.loginTable{ - width:250px; - padding-bottom:2px; - padding-top:10px -} -.category_sublink:hover,.boxtitlelink:hover,.category_mainlink:hover{ - color:#990000; - text-decoration:underline -} -.spacer,#betaTable{ - background-color:#ffffff -} -.borderedbg{ - background-color:#ffffff; - font-family:arial; - font-size:10px; - color:#333333 -} -table.bordered{ - background-color:#999999 -} -td.boxoff{ - background-color:#ffffff; - color:#000000; - font-size:8pt; - font-family:Arial,Helvetica,sans-serif -} -td.boxon{ - background-color:#eeeeee; - color:#000000; - font-size:8pt; - font-family:Arial,Helvetica,sans-serif -} -.pagetitle{ - font-family:arial; - font-weight:bold; - font-size:18pt; - color:#333333; - border-bottom:1px solid #999999 -} -.boxtitlelink{ - color:#336699; - font-size:9pt; - font-family:tahoma,verdana,arial; - text-decoration:none -} -.sectiontitle{ - font-family:Arial,Helvetica,sans-serif; - font-size:10pt; - color:#990000; - font-weight:bold -} -.subtitle{ - font-family:Arial,Helvetica,sans-serif; - font-size:11pt; - font-weight:bold; - color:#333333; - border-bottom:1px dashed #000000 -} -.subcategory{ - background-color:#eeeeee; - color:#000000; - font-size:8pt; - font-family:Arial,Helvetica,sans-serif; - border-left:5px solid #cccccc -} -.subcategory2{ - background-color:#d9d6c5; - color:#000000; - font-size:8pt; - font-family:Arial,Helvetica,sans-serif; - border-left:5px solid #cccccc -} -.row_title{ - background-color:#999999; - color:#ffffff; - font-family:Arial,Helvetica,sans-serif; - font-size:8pt; - font-weight:bold -} -.row_category{ - background-color:#1D97C3; - font-family:Arial,Helvetica,sans-serif; - font-size:10pt; - font-weight:bold -} -.row1{ - color:#000000; - background-color:#dadada; - font-family:Arial,Helvetica,sans-serif; - font-size:8pt -} -.row2{ - color:#000000; - background-color:#e9e9e9; - font-family:Arial,Helvetica,sans-serif; - font-size:8pt -} -.row3{ - color:#990000; - background-color:#e9e9e9; - font-family:Arial,Helvetica,sans-serif; - font-size:8pt -} -.row4{ - color:#990000; - background-color:#ffffff; - font-family:Arial,Helvetica,sans-serif; - font-size:8pt -} -.rowsection{ - color:#000000; - background-color:#f9f9f9; - font-family:Arial,Helvetica,sans-serif; - font-size:11px; -} -.category{ - background-color:#ffffff; - font-family:Arial,Helvetica,sans-serif; - font-size:9pt -} -.category_mainlink{ - font-family:Arial,Helvetica,sans-serif; - font-size:9pt; - color:#336699; - font-family:Arial,Helvetica,sans-serif; - text-decoration:underline; - font-weight:bold -} -.category_sublink{ - font-family:Arial,Helvetica,sans-serif; - font-size:8pt; - color:#336699; - font-family:Arial,Helvetica,sans-serif; - text-decoration:underline -} -.boxed_sectionheader{ - font-family:trebuchet MS,verdana,arial; - font-size:11pt; - font-weight:bold; - color:#333366; - background-color:#e9e9e9 -} -.dotted_sectionheader{ - font-family:trebuchet MS,verdana,arial; - font-size:11pt; - font-weight:bold; - color:#333366; - background-color:#ffffff -} -.tab_on{ - background-color:#ffffff; - font-size:8pt; - font-family:Arial,Helvetica,sans-serif; - border-left:1px solid #666666; - border-right:1px solid #666666; - border-top:1px solid #666666 -} -.tab_off{ - background-color:#e9e9e9; - font-size:8pt; - font-family:Arial,Helvetica,sans-serif; - border-left:1px solid #666666; - border-right:1px solid #666666; - border-bottom:1px solid #666666; - border-top:1px solid #666666 -} -.tab_spacer{ - background-color:#ffffff; - border-bottom:1px solid #666666 -} -.tab_content{ - background-color:#ffffff; - border-left:1px solid #666666; - border-right:1px solid #666666; - border-bottom:1px solid #666666 -} - -/* PHPCoverage Specific */ - -.emphasis { - font-size:12px; - font-weight:bold; - color:#222222; -} -.note { - vertical-align:text-bottom -} -.coverageDetailsHead { - border-right:2px solid #eeeeee; - background-color:#C0CEDC; - color:#000000; - font-size:12px; - font-weight:bold; - white-space:nowrap; -} -.coverageDetails { - color:#666666; - font-size:13px; - border-right:1px solid #A2AFBC -} -.coverageDetailsCode { - font-weight:normal; - color:#666666; - font-size:13px; -} -.codeExecuted { - color:#003399; - font-weight:bold; -} -.codeMissed { - color:#990000; - font-weight:bold; -} diff --git a/vendor/spikephpcoverage/reporter/html/footer.html b/vendor/spikephpcoverage/reporter/html/footer.html deleted file mode 100644 index 9b66de5e1..000000000 --- a/vendor/spikephpcoverage/reporter/html/footer.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/vendor/spikephpcoverage/reporter/html/header.html b/vendor/spikephpcoverage/reporter/html/header.html deleted file mode 100644 index 41cdf4e17..000000000 --- a/vendor/spikephpcoverage/reporter/html/header.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - Spike PHPCoverage Details: %%filename%% - - - -
    - - - - - - -

    Spike PHPCoverage Details: %%filename%%

    -
    - diff --git a/vendor/spikephpcoverage/reporter/html/indexfooter.html b/vendor/spikephpcoverage/reporter/html/indexfooter.html deleted file mode 100644 index 6d247c293..000000000 --- a/vendor/spikephpcoverage/reporter/html/indexfooter.html +++ /dev/null @@ -1,18 +0,0 @@ -
    - - - - - -
    - spacer
    - - - - diff --git a/vendor/spikephpcoverage/reporter/html/indexheader.html b/vendor/spikephpcoverage/reporter/html/indexheader.html deleted file mode 100644 index cb0702083..000000000 --- a/vendor/spikephpcoverage/reporter/html/indexheader.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - %%heading%% - - - - - -
    - - - - - - - diff --git a/vendor/spikephpcoverage/reporter/images/arrow_down.gif b/vendor/spikephpcoverage/reporter/images/arrow_down.gif deleted file mode 100644 index 582d6f57864e51b65d908f46967f3137b4af9d84..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 169 zcmZ?wbhEHb;5651)S; z$E?)}TkTV@-6eAikL|pLTW%`(E#H6U>EZLwoia9OwjX9PoyBK2pWl8ygYnG&|Nk?f z0>z&!j0_A?3_2iTkev*yY6%62DrKC$%hrVot-ZM@gJpr;gk_37uU=R+rz$YM(qLb_ L&VaFvfx#L8nJGYK diff --git a/vendor/spikephpcoverage/reporter/images/arrow_up.gif b/vendor/spikephpcoverage/reporter/images/arrow_up.gif deleted file mode 100644 index fb398045903a0b9b6f769e90fee8bf3285e3e848..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 169 zcmZ?wbhEHb;5651)S; z$E?)}TkTV@-6eAikL|pLTW%`(E#H6U>EZLwoia9OwjX9PoyBK2pWl8ygYnG&|Nk?f z0>z&!j0_A?3_2iTkev*yY75l-S~IfPOS3K|NG_k8%A@3To=0HTrZby87BR7yv55Bw L6?3*QFjxZsc%wc) diff --git a/vendor/spikephpcoverage/reporter/images/spacer.gif b/vendor/spikephpcoverage/reporter/images/spacer.gif deleted file mode 100644 index fc2560981ee1caca400e225e48d282106f907f2d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 43 ucmZ?wbhEHbWMp7uXkcLY|NlP&1B2pE7Df>utpmhBaYhCPCMFj~25SJyItL8^ diff --git a/vendor/spikephpcoverage/reporter/images/spikesource/phpcoverage.gif b/vendor/spikephpcoverage/reporter/images/spikesource/phpcoverage.gif deleted file mode 100644 index bd580a9317f658c18233ebf035a98a7d95078f91..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4271 zcmb_d=|7Z<<9(jljIlkIF2*)UmfW%>TUoLU=)uoEOK=!Pdw)2nRn2yaxbEA>-l0hvw$y ziHV8Q!F9a@{PoQ*2ab7HH@1n1iM<$~@;#qWQBg6wuoRbG7#c@eTU$HgdIleGsfbyB z`t<4P>1p2mzIX554G#|=Ja|xCT-@5)T1iRC-Q7JmH&;bPMPFb4#EBEDtE-KTjh&sH zk0(}QVqz{{y!ib2^X#TE5{X2k(dz2zT(ce~)C?O$^M3vF&*<#hUQ<^Jg>ul^=UR60 zkFB4>uih9t6Nu52i;1}-<8S9ael22f4%+zWI|S_P{CYY(&h2~>5=&7tJ89%ZSlieP z2v1r1@QE0ia_{d2-h+YB$#;$c5$wKqL6?%OJwtm2UVQoXedxvb%;E~S^YO1=|KwFP zP;N5sc06L;efazL@0PB!9kK2kg1c)RgF@GnTucXxM{44wYd|9?>aiTFP= z?f>|{O#p#ia&U4=YFc^*B{M7g`i-1iYF>Up;mx93#WZ?JX<2y%gL%8Ms+v{9uC3$L z-)U&%HZ|YnwcKlMYwzg1-}T^Och95VzQ<3V_74m`dp`8{Fn{F5=-A6w;}eswr`}Az zeK#}PcxGYo{nGNvhmW5=udc0cY<~GS@V`ZG@BI4b_bvd(6xy*EJt=5OEx&#)vo`}$ zbu6`Sy8Sp?MjtER-&FZD7k4a6-l4f_pg`$Ro!>xn^|M<#!B*A|cUeOvMv))h4Cq%q zudqnLC^(J<4OiM1X!#HFYTY7jDjmxlTk0Owc-;-19&F)wZ~}X?6tYJ+lXuUJ*7^J9 z)=#yD?+!GV9dB)z?lhbKFun7|irf_o7gEHxh5J6BNS+|#7)@jZK?QDzZ*N|F7Pcqs z?fr0zh2aYIU`3}6-b!hy8|Q!wz>^uN34T`YRPye_6x}x^-M_PS?OpdJp(TzfFJPv> zV88m2`^InP@^cSXICq)&FHJnPO8j%WORh%$q z?CfaSU2o$<*WPRcC=J|^tvy~NNcn^(z_H&whh|bBTl<_ODcil|utd$V8DEL$WoE*j z^a*MhL72-=zi^d3m-Q-hnP9b-&Sr)!HJzKk(cHxjwv=j1@5wZHQsZU`%$!@uQ~AtR z-9^Z1^aoORha`It7^yJ}&}Pof1zdt?5>^?6UFIR9z{xVL+NzUQ`Ax+GaX9?#vqhsLUFc7-MKfHm4isalF9HI7{j8z z)Ntozjjm;Pw_uKIcXv6_f;ww?ZIPx9ho`OwTSBo=axnaQCnToE``93<$peUNfsl`% zyW%!~@X>IiedLyH+r7gGj!xp7F-7N$rQhs6lQ+1{3s?ZB%D2x%3v=ms=;%7xf%HZ z_*I4mOemhR!X$Ju^g%Pbr+-bsi{)XnQ~RQl2F@s@_6+7Br>SQ6$mh;9zXO3_sR%LQ z@>oG=R(CzNWF8n5!Mk*rqHi^wdFhmRRCl=m+tK}TLz`^Tn+D^?%OVPb+KnrhI@VW_ z-s?Ih$UkvO$Sy?y7)`_CNjHg6ianp3l!iMu16wt|?>d&NQCsI#@7D9vDv;qp=q2gC z?z4hy4*y*eCzm=cWs%y`FH2F%JvwS$+1Klekx``8-Gboup_Qpc30%l<%2Hgm=~plY@o}Lim`x2 zUJrmd?+%@-eS6M}BHS73rORoYX8_xA&NO zhD@mnsSmCmNtwnzdN3Rwm~}Qx<(N<4W7&~sxJzO3*72I{sn)K-f%twi${7f5Hsp%( zDtm?3?3vtCn-Ogw@WbG7mv^#@n>5eMSpITdbcbXZ?|6-Nm_Y7v=ZLgZszGX*cIj7& zKsOOD1=jV$wdf+%(lbW$=ne0llnbe0ladmS&Ej5|yAp`(x zXl#GRbJ1GIKhbWc6QapyBo%UYn~6PxOqY)~ft*6A0J<1PS*~g30vP)UKymyM+yH;?qvE5vcp8@b2f8hMLZNpR80ztJ+uVxb*-qJ_RH zn~7{%KmoPx%YRLHAIYYo>IFIVdx><>xqu75^&c!fZ#+6K)D>=m=>k^WKem~4$zdY8 z?_HfQ0^ZbtyM~56E%v(yRV864gK=d^R><#u3RT8p{H*1ik_}FpCOq@8uMOd(FP1O1 z`cwL$;OcvMb;jFGEAI7A-{=hq8t?e+m8omtI*+xZfy;(BmFW@O7@?P1Z@ zqvS_NdoIuzvleJGos;SK*vEoB!;O^6{0{1ASeGs>FJZ&tH&eFpS?Gi=E{;dV}ri5E2rDoQS7ZAR4N^D4UV zK-kg#Tgr3v1+A(qqi3h>RU^lLsdb;`=3EYT?)FdMy{s^`$*6{Z=BR|+;Jqg+x(O2b z>#*&CkAYay@NSU%1j*g=SlU~XZwN73xGm$MPyknx6J{CkqLltyq((FO%;8AJGnDMN zWA;3Vz}l|L>)Di6CHUvJSSxa?8JbP)CU!#-<=$2^Yw`Ws6CYadZGAq}I6mt??9G+` z%SPkSjn^KllWp=MLTpj#w_`8wyo^Fe7K-VM`le)b4$hZT@YC8a(%2ecO1OSrpfVVIYz6QO zLP00v!IkUjqwbmXE~DGW!cgIWh7uXL$eJHtyb7R(dpZTH^kVC+J6}r(bKH4 zZ{PQZwEHRAAfhU#-SWcs3-pI5*u@e}>!@pMaIGp(+LP-mR~#q%!>b&9v&JCB@BG%L z(F!{z1HqQICY^rp#qK*65}*4XHN(T9`1g#9@KMt#e#+N&P0zp*#qWtL8caF$KeMaa zN;YfV7!k>LbT5q@|CFG%SuFA4ZRfn68IW76Z`3{12p3><@DK!ZU%P`|*SK*{k&nRf~ zi6;??lW1}ce06OrJQeRH_E#%_l?219&Yq>n8?2`Wc&I?LCl7DQs=nCYEl3Xj&8HNg6E`!ico8C+WaN$oW-1`FP zm5P&Xr-*nLD5fCAHS-e13)F0l_Nf9N`)`ar1*kosI^R%AN6$i2JP2;&e)CeU0Mg01v|QsfKRpR#%ppgK2HHXLSI3+cMR z&?A4UM;|1%-})g@cuqg4@jaM9flkL2Up@&B7L=4h@9I&078_Z?ZMnqmIhtrY!XQ~Eqp-kJgTCzlQwr->`W_N{{i0H#faUJ1e`LtrWl zXd)Aa(k&NAf>kg$!K}=K<^Nl48nFZ}zXIRxi)>`60 zQ1wZZ>Qg?|9`V&)^lG1uYQNXj0o&DqSQf#AMf72j;#ueDtk4eD`PZxq+pM5< zZRRb`y`s32w`@%+oV8F3-q3O_s3TFe$B}J=Rj|jv(6fw$4(J3{JRDn_Z&F+6Q(F{Y zTTHK|chr`euza|13yT`vWbF zrkL8YZB93~{*g(2pHKah_7}?Li6EkbJ%gfD3{4&y;n=v+smLjhHGYM^3{= zB}#mkt>bxHfy#iA>X+#aA37R7y>3_?tUV4P@i^pAmW=i~TXegIh-=8!Lfz=Nld+Ap z*WxtQHD1MVzR|guPOk8ADJv~lZe69B4^)F`I5NmYUTU25foy#s#9+Aqvl2(A3QKSVoMmU&;fyCz#yDcp8_sx4=y MjXK3m0szzh0Z-tDMgRZ+ diff --git a/vendor/spikephpcoverage/reporter/js/sort_spikesource.js b/vendor/spikephpcoverage/reporter/js/sort_spikesource.js deleted file mode 100644 index 45222db7a..000000000 --- a/vendor/spikephpcoverage/reporter/js/sort_spikesource.js +++ /dev/null @@ -1,310 +0,0 @@ -/*---------------------------------------------------\ -| Table Sorter | -|----------------------------------------------------| -| Author: Vinay Srinivasaiah (vsrini@spikesource.com)| -| SpikeSource (http://www.spikesource.com) | -| - DOM 1 based script that makes the table sortable.| -| - Copyright (c) 2004 SpikeSource Inc. | -|---------------------------------------------------*/ -//http://www.w3.org/TR/REC-DOM-Level-1/java-language-binding.html - -var tableBody; -var table2sort; -var imgUp; -var imgDown; - -function TableSorter(table) { - this.table2sort = table; - this.tableBody = this.table2sort.getElementsByTagName("tbody")[0]; - - this.imgUp = document.createElement("img"); - this.imgUp.src = "images/arrow_up.gif"; - this.imgDown = document.createElement("img"); - this.imgDown.src = "images/arrow_down.gif"; -} - -var lastSortCol = -1; -var lastSortOrderAsc = true; -var origChildRows; - -function createImgLink(row, imageSrc) { - var cell = row.cells[0]; - var id = _getInnerText(cell) + "_" + imageSrc; - - imgExpand = document.createElement("img"); - imgExpand.src = "images" + imageSrc + ".gif"; - imgExpand.border="0"; - - imgBlank = document.createElement("img"); - imgBlank.src = "results/images/transdot.gif"; - imgBlank.border="0"; - imgBlank2 = imgBlank.cloneNode(false); - imgBlank3 = imgBlank.cloneNode(false); - - anchorTag = document.createElement("a"); - anchorTag.href="javascript:toggleShowChildren('" + id + "');" - anchorTag.appendChild(imgExpand); - anchorTag.appendChild(imgBlank); - anchorTag.appendChild(imgBlank2); - anchorTag.appendChild(imgBlank3); - anchorTag.id = id; - - cell.id = id + "_cell"; - row.id = id + "_row"; - - cell.insertBefore(anchorTag, cell.firstChild); -} - -TableSorter.prototype.initTable = function () { - this.populateChildRowsMap(); - for (i = 0; i < origChildRows.length; i++) { - if (origChildRows[i].id != "indented_row") { - createImgLink(origChildRows[i], "minus"); - } - } -} - -TableSorter.prototype.collapseAllChildren = function () { - for (i = 0; i < origChildRows.length; i++) { - if (origChildRows[i].id != "indented_row") { - id = _getInnerText(origChildRows[i].cells[0]) + "_" + "minus"; - var anchorTag = document.getElementById(id); - if (anchorTag != null) { - this.togglechildren(id); - } - } - } -} - -TableSorter.prototype.expandAllChildren = function () { - for (i = 0; i < origChildRows.length; i++) { - if (origChildRows[i].id != "indented_row") { - id = _getInnerText(origChildRows[i].cells[0]) + "_" + "plus"; - var anchorTag = document.getElementById(id); - if (anchorTag != null) { - this.togglechildren(id); - } - } - } -} - -TableSorter.prototype.togglechildren = function (id) { - anchorTag = document.getElementById(id); - anchorParent = document.getElementById((id + "_cell")); - anchorParent.removeChild(anchorTag); - row = document.getElementById((id + "_row")); - nextRow = row.nextSibling; - - var addChildren = false; - if (anchorTag.firstChild.src.indexOf("plus") != -1) { - addChildren = true; - createImgLink(row, "minus"); - } else if (anchorTag.firstChild.src.indexOf("minus") != -1) { - addChildren = false; - createImgLink(row, "plus"); - } - for (i = 0; i < origChildRows.length; i++) { - //alert("comparing " + _getInnerText(origChildRows[i].cells[0]) - // + " and " + _getInnerText(row.cells[0])); - if (_getInnerText(origChildRows[i].cells[0]) == _getInnerText(row.cells[0])) { - for (j = i + 1; j < origChildRows.length; j++) { - if (origChildRows[j].id == "indented_row") { - if (addChildren) { - this.tableBody.insertBefore(origChildRows[j], nextRow); - } else { - this.tableBody.removeChild(origChildRows[j]); - } - } else { - // done; - break; - } - } - break; - } - } -} - -TableSorter.prototype.populateChildRowsMap = function () { - var rows = this.tableBody.rows; - origChildRows = new Array(); - var count = 0; - var newRowsCount = 0; - for (i = 0; i < rows.length; i ++) { - if (rows[i].id == "indented_row") { - if (parentRow != null) { - origChildRows[count++] = parentRow; - parentRow = null; - } - origChildRows[count++] = rows[i]; - } else { - parentRow = rows[i]; - } - } -} - -TableSorter.prototype.sort = function (col, type) { - if (lastSortCol != -1) { - sortCell = document.getElementById("sortCell" + lastSortCol); - if (sortCell != null) { - if (lastSortOrderAsc == true) { - sortCell.removeChild(this.imgUp); - } else { - sortCell.removeChild(this.imgDown); - } - } - sortLink = document.getElementById("sortCellLink" + lastSortCol); - if(sortLink != null) { - sortLink.title = "Sort Ascending"; - } - } - - if (lastSortCol == col) { - lastSortOrderAsc = !lastSortOrderAsc; - } else { - lastSortCol = col; - lastSortOrderAsc = true; - } - - var rows = this.tableBody.rows; - var newRows = new Array(); - var parentRow; - - var childRows = new Array(); - var count = 0; - var newRowsCount = 0; - for (i = 0; i < rows.length; i ++) { - if (rows[i].id == "indented_row") { - if (parentRow != null) { - childRows[count++] = parentRow; - parentRow = null; - } - childRows[count++] = rows[i]; - } else { - newRows[newRowsCount++] = rows[i]; - parentRow = rows[i]; - } - } - - // default - sortFunction = sort_caseInsensitive; - if (type == "string") sortFunction = sort_caseSensitive; - if (type == "percentage") sortFunction = sort_numericPercentage; - if (type == "number") sortFunction = sort_numeric; - - newRows.sort(sortFunction); - - if (lastSortOrderAsc == false) { - newRows.reverse(); - } - - for (i = 0; i < newRows.length; i ++) { - this.table2sort.tBodies[0].appendChild(newRows[i]); - var parentRowText = _getInnerText(newRows[i].cells[0]); - var match = -1; - for (j = 0; j < childRows.length; j++) { - var childRowText = _getInnerText(childRows[j].cells[0]); - if (childRowText == parentRowText) { - match = j; - break; - } - } - if (match != -1) { - for (j = match + 1; j < childRows.length; j++) { - if (childRows[j].id == "indented_row") { - this.table2sort.tBodies[0].appendChild(childRows[j]); - } else { - break; - } - } - } - } - - sortCell = document.getElementById("sortCell" + col); - if (sortCell == null) { - } else { - if (lastSortOrderAsc == true) { - sortCell.appendChild(this.imgUp); - } else { - sortCell.appendChild(this.imgDown); - } - } - - sortLink = document.getElementById("sortCellLink" + col); - if (sortLink == null) { - } else { - if (lastSortOrderAsc == true) { - sortLink.title = "Sort Descending"; - } else { - sortLink.title = "Sort Ascending"; - } - } -} - -function sort_caseSensitive(a, b) { - aa = _getInnerText(a.cells[lastSortCol]); - bb = _getInnerText(b.cells[lastSortCol]); - return compareString(aa, bb); -} - -function sort_caseInsensitive(a,b) { - aa = _getInnerText(a.cells[lastSortCol]).toLowerCase(); - bb = _getInnerText(b.cells[lastSortCol]).toLowerCase(); - return compareString(aa, bb); -} - -function sort_numeric(a,b) { - aa = _getInnerText(a.cells[lastSortCol]); - bb = _getInnerText(b.cells[lastSortCol]); - return compareNumber(aa, bb); -} - -function sort_numericPercentage(a,b) { - aa = _getInnerText(a.cells[lastSortCol]); - bb = _getInnerText(b.cells[lastSortCol]); - - var aaindex = aa.indexOf("%"); - var bbindex = bb.indexOf("%"); - - if (aaindex != -1 && bbindex != -1) { - aa = aa.substring(0, aaindex); - bb = bb.substring(0, bbindex); - return compareNumber(aa, bb); - } - - return compareString(aa, bb); -} - -function compareString(a, b) { - if (a == b) return 0; - if (a < b) return -1; - return 1; -} - -function compareNumber(a, b) { - aa = parseFloat(a); - if (isNaN(aa)) aa = 0; - bb = parseFloat(b); - if (isNaN(bb)) bb = 0; - return aa-bb; -} - -function _getInnerText(el) { - if (typeof el == "string") return el; - if (typeof el == "undefined") { return el }; - if (el.innerText) return el.innerText; - var str = ""; - - var cs = el.childNodes; - var l = cs.length; - for (var i = 0; i < l; i++) { - switch (cs[i].nodeType) { - case 1: //ELEMENT_NODE - str += _getInnerText(cs[i]); - break; - case 3: //TEXT_NODE - str += cs[i].nodeValue; - break; - } - } - return str; -} diff --git a/vendor/spikephpcoverage/util/CoverageLogger.php b/vendor/spikephpcoverage/util/CoverageLogger.php deleted file mode 100644 index 47a3865dc..000000000 --- a/vendor/spikephpcoverage/util/CoverageLogger.php +++ /dev/null @@ -1,103 +0,0 @@ - -logLevels); $i++) { - if(strcasecmp($this->logLevels[$i], $level) === 0) { - $level = $i; - break; - } - } - } - $this->level = $level; - } - - public function critical($str, $file="", $line="") { - if($this->level >= 0) { - error_log("[CRITICAL] [" . $file . ":" . $line . "] " . $str); - } - } - - public function error($str, $file="", $line="") { - if($this->level >= 1) { - error_log("[ERROR] [" . $file . ":" . $line . "] " . $str); - } - } - - public function warn($str, $file="", $line="") { - if($this->level >= 2) { - error_log("[WARNING] [" . $file . ":" . $line . "] " . $str); - } - } - - public function notice($str, $file="", $line="") { - if($this->level >= 3) { - error_log("[NOTICE] [" . $file . ":" . $line . "] " . $str); - } - } - - public function info($str, $file="", $line="") { - if($this->level >= 4) { - error_log("[INFO] [" . $file . ":" . $line . "] " . $str); - } - } - - public function debug($str, $file="", $line="") { - if($this->level >= 5) { - error_log("[DEBUG] [" . $file . ":" . $line . "] " . $str); - } - } - - public function getLevelName($level) { - return $this->logLevels[$level]; - } - } - - // testing - if(isset($_SERVER["argv"][1]) && $_SERVER["argv"][1] == "__main__") { - $logger = new CoverageLogger(); - for($i = 0; $i < 6; $i++) { - $logger->setLevel($i); - error_log("############## Level now: " . $i); - $logger->debug(""); - $logger->info(""); - $logger->notice(""); - $logger->warn(""); - $logger->error(""); - $logger->critical(""); - } - - error_log("############# With Level Names"); - for($i = 0; $i < 6; $i++) { - $logger->setLevel($logger->getLevelName($i)); - error_log("############## Level now: " . $logger->getLevelName($i)); - $logger->debug(""); - $logger->info("", __FILE__, __LINE__); - $logger->notice(""); - $logger->warn(""); - $logger->error(""); - $logger->critical(""); - } - } -?> diff --git a/vendor/spikephpcoverage/util/Utility.php b/vendor/spikephpcoverage/util/Utility.php deleted file mode 100644 index 8fcebffbc..000000000 --- a/vendor/spikephpcoverage/util/Utility.php +++ /dev/null @@ -1,224 +0,0 @@ - - - * @version $Revision: $ - * @package SpikePHPCoverage_Util - */ - class Utility { - - public static $logger; - - /*{{{ public function getTimeStamp() */ - - /** - * Return the current timestamp in human readable format. - * Thursday March 17, 2005 19:10:47 - * - * @return Readable timestamp - * @access public - */ - public function getTimeStamp() { - $ts = getdate(); - return $ts["weekday"] . " " . $ts["month"] . " " . $ts["mday"] - . ", " . $ts["year"] . " " . sprintf("%02d:%02d:%02d", $ts["hours"], $ts["minutes"], $ts["seconds"]); - } - - /*}}}*/ - /*{{{ public function shortenFilename() */ - - /** - * Shorten the filename to some maximum characters - * - * @param $filename Complete file path - * @param $maxlength=150 Maximum allowable length of the shortened - * filepath - * @return Shortened file path - * @access public - */ - public function shortenFilename($filename, $maxlength=80) { - $length = strlen($filename); - if($length < $maxlength) { - return $filename; - } - - // trim the first few characters - $filename = substr($filename, $length-$maxlength); - // If there is a path separator slash in first n characters, - // trim upto that point. - $n = 20; - $firstSlash = strpos($filename, "/"); - if($firstSlash === false || $firstSlash > $n) { - $firstSlash = strpos($filename, "\\"); - if($firstSlash === false || $firstSlash > $n) { - return "..." . $filename; - } - return "..." . substr($filename, $firstSlash); - } - return "..." . substr($filename, $firstSlash); - } - - /*}}}*/ - /*{{{ public function writeError() */ - - /** - * Write error log if debug is on - * - * @param $str Error string - * @access public - */ - public function writeError($str) { - if(__PHPCOVERAGE_DEBUG) { - error_log($str); - } - } - /*}}}*/ - /*{{{ public function unixifyPath() */ - - /** - * Convert Windows paths to Unix paths - * - * @param $path File path - * @return String Unixified file path - * @access public - */ - public function unixifyPath($path) { - // Remove the drive-letter: - if(strpos($path, ":") == 1) { - $path = substr($path, 2); - } - $path = $this->replaceBackslashes($path); - return $path; - } - - /*}}}*/ - /*{{{ public function replaceBackslashes() */ - - /** - * Convert the back slash path separators with forward slashes. - * - * @param $path Windows path with backslash path separators - * @return String Path with back slashes replaced with forward slashes. - * @access public - */ - public function replaceBackslashes($path) { - $path = str_replace("\\", "/", $path); - return $this->capitalizeDriveLetter($path); - } - /*}}}*/ - /*{{{ public function capitalizeDriveLetter() */ - - /** - * Convert the drive letter to upper case - * - * @param $path Windows path with "c:" - * @return String Path with driver letter capitalized. - * @access public - */ - public function capitalizeDriveLetter($path) { - if(strpos($path, ":") === 1) { - $path = strtoupper(substr($path, 0, 1)) . substr($path, 1); - } - return $path; - } - - /*}}}*/ - /*{{{ public function makeDirRecursive() */ - /** - * Make directory recursively. - * (Taken from: http://aidan.dotgeek.org/lib/?file=function.mkdirr.php) - * - * @param $dir Directory path to create - * @param $mode=0755 - * @return True on success, False on failure - * @access public - */ - public function makeDirRecursive($dir, $mode=0755) { - // Check if directory already exists - if (is_dir($dir) || empty($dir)) { - return true; - } - - // Ensure a file does not already exist with the same name - if (is_file($dir)) { - $this->getLogger()->debug("File already exists: " . $dir, - __FILE__, __LINE__); - return false; - } - - $dir = $this->replaceBackslashes($dir); - - // Crawl up the directory tree - $next_pathname = substr($dir, 0, strrpos($dir, "/")); - if ($this->makeDirRecursive($next_pathname, $mode)) { - if ( ! file_exists($dir)) { - return mkdir($dir, $mode); - } - } - - return false; - } - /*}}}*/ - /*{{{ public function getOS() */ - /** - * Returns the current OS code - * WIN - Windows, LIN -Linux, etc. - * - * @return String 3 letter code for current OS - * @access public - * @since 0.6.6 - */ - public function getOS() { - return strtoupper(substr(PHP_OS, 0, 3)); - } - /*}}}*/ - /*{{{ public function getTmpDir() */ - - public function getTmpDir() { - global $spc_config; - $OS = $this->getOS(); - switch($OS) { - case "WIN": - return $spc_config['windows_tmpdir']; - default: - return $spc_config['tmpdir']; - } - } - - /*}}}*/ - /*{{{ public function getLogger() */ - - public function getLogger($package=false) { - global $spc_config; - if( ! isset($this->logger) || $this->logger == NULL) { - $this->logger =& new CoverageLogger(); - $this->logger->setLevel($spc_config["log_level"]); - } - return $this->logger; - } - - /*}}}*/ - } - global $util; - $util = new Utility(); -?>