From 16e4296626f3ae273455269c9f2512f60b618e21 Mon Sep 17 00:00:00 2001 From: hansbrix Date: Thu, 12 Apr 2007 20:52:30 +0000 Subject: [PATCH] combined codes and docs manpages; deleted codes (obsolete) --- ...nced components - Cache - Introduction.php | 0 ...anced components - Cache - Query cache.php | 0 ...ponents - Db_Profiler - Advanced usage.php | 0 ...components - Db_Profiler - Basic usage.php | 0 ...omponents - Db_Profiler - Introduction.php | 0 ...ents - Evenlisteners - AccessorInvoker.php | 32 -------- ...nts - Eventlisteners - AccessorInvoker.php | 0 ...components - Eventlisteners - Chaining.php | 0 ...s - Eventlisteners - Creating a logger.php | 0 ...Eventlisteners - Creating new listener.php | 34 -------- ...onents - Eventlisteners - Introduction.php | 0 ...ents - Eventlisteners - List of events.php | 45 ----------- ...ts - Eventlisteners - Listening events.php | 13 --- ...d components - Hook - Building queries.php | 0 ...anced components - Hook - Introduction.php | 0 ...ed components - Hook - List of parsers.php | 0 ...omponents - Locking Manager - Examples.php | 61 -------------- ...nents - Locking Manager - Introduction.php | 0 ...ponents - Locking Manager - Maintainer.php | 0 ...components - Locking Manager - Planned.php | 0 ... - Locking Manager - Technical Details.php | 0 ...components - Validators - Introduction.php | 5 -- ...dators - List of predefined validators.php | 0 ...ponents - Validators - More Validation.php | 28 ------- ...ents - Validators - Valid or Not Valid.php | 30 ------- ...vanced components - View - Intoduction.php | 0 ...ced components - View - Managing views.php | 15 ---- ...vanced components - View - Using views.php | 13 --- ...ding standards - Coding Style - Arrays.php | 12 --- ...ing standards - Coding Style - Classes.php | 8 -- ...ds - Coding Style - Control statements.php | 0 ...- Coding Style - Functions and methods.php | 0 ... - Coding Style - Inline documentation.php | 0 ... - Coding Style - PHP code demarcation.php | 0 ...ing standards - Coding Style - Strings.php | 18 ----- ...andards - Naming Conventions - Classes.php | 0 ...dards - Naming Conventions - Constants.php | 6 -- ...dards - Naming Conventions - Filenames.php | 0 ...ng Conventions - Functions and methods.php | 0 ...ards - Naming Conventions - Interfaces.php | 0 ... - Naming Conventions - Record columns.php | 0 .../Coding standards - Overview - Goals.php | 0 .../Coding standards - Overview - Scope.php | 0 ...ndards - PHP File Formatting - General.php | 0 ...ds - PHP File Formatting - Indentation.php | 0 ... File Formatting - Maximum line length.php | 0 ...ng standards - Testing - Writing tests.php | 0 manual/codes/Configuration - Introduction.php | 5 -- ...onfiguration - Levels of configuration.php | 20 ----- ...tion - Setting attributes - Batch size.php | 5 -- ... - Setting attributes - Event listener.php | 5 -- ...Setting attributes - Fetching strategy.php | 5 -- ...etting attributes - Identifier quoting.php | 0 ...g attributes - Offset collection limit.php | 5 -- ...ion - Setting attributes - Portability.php | 0 ... Setting attributes - Session lockmode.php | 5 -- ... - Setting attributes - Table creation.php | 5 -- ...tion - Setting attributes - Validation.php | 5 -- ...agement - Connection-component binding.php | 0 ...nagement - Lazy-connecting to database.php | 0 ...tion management - Managing connections.php | 0 ... management - Opening a new connection.php | 0 ...ataDict - Getting database declaration.php | 0 ...les - DataDict - Getting portable type.php | 0 ...modules - DataDict - Reserved keywords.php | 0 ...tion modules - Export - Altering table.php | 39 --------- ... modules - Export - Creating new table.php | 22 ------ ...ection modules - Export - Introduction.php | 0 ...es - Import - Getting foreign key info.php | 0 ... modules - Import - Getting table info.php | 0 ...n modules - Import - Getting view info.php | 0 ...ection modules - Import - Introduction.php | 0 ...nection modules - Util - Using explain.php | 0 .../DQL (Doctrine Query Language) - BNF.php | 0 ... expressions - All and Any Expressions.php | 0 ...l expressions - All or Any Expressions.php | 0 ...ssions - Collection Member Expressions.php | 0 ...mpty Collection Comparison Expressions.php | 0 ...ional expressions - Exists Expressions.php | 0 ...nditional expressions - In expressions.php | 0 ...itional expressions - Input parameters.php | 14 ---- ...itional expressions - Like Expressions.php | 8 -- ...) - Conditional expressions - Literals.php | 0 ...ressions - Null Comparison Expressions.php | 0 ...ns - Operators and operator precedence.php | 0 ...itional expressions - Path expressions.php | 0 ...- Conditional expressions - Subqueries.php | 19 ----- ...trine Query Language) - DELETE queries.php | 16 ---- ...L (Doctrine Query Language) - Examples.php | 0 ...Doctrine Query Language) - FROM clause.php | 0 ...nal Expressions - Arithmetic Functions.php | 0 ...nal Expressions - Collection functions.php | 0 ...ional Expressions - Datetime Functions.php | 0 ...ctional Expressions - String Functions.php | 0 ...Query Language) - Functions - Contains.php | 7 -- ...ine Query Language) - Functions - Like.php | 7 -- ...e Query Language) - Functions - Regexp.php | 7 -- ...y Language) - GROUP BY, HAVING clauses.php | 10 --- ...ine Query Language) - GROUP BY, HAVING.php | 0 ...octrine Query Language) - Introduction.php | 26 ------ ...nd OFFSET clauses - Driver portability.php | 0 ...IMIT and OFFSET clauses - Introduction.php | 0 ...clauses - The limit-subquery-algorithm.php | 0 ...y Language) - LIMIT and OFFSET clauses.php | 14 ---- ...ine Query Language) - LIMIT and OFFSET.php | 0 ...rine Query Language) - ORDER BY clause.php | 0 ...L (Doctrine Query Language) - ORDER BY.php | 0 ...guage) - Operators - Logical operators.php | 0 ...e) - SELECT queries - Aggregate values.php | 14 ---- ...trine Query Language) - SELECT queries.php | 0 ...trine Query Language) - UPDATE queries.php | 16 ---- ...octrine Query Language) - WHERE clause.php | 0 .../Drivers - Mysql - Tips and tricks.php | 0 ...cle - Making unsuported functions work.php | 0 manual/codes/Functions - Contains.php | 0 manual/codes/Functions - Like.php | 0 manual/codes/Functions - Regexp.php | 0 manual/codes/Getting started - Compiling.php | 7 -- .../Getting started - Data types - Array.php | 0 .../Getting started - Data types - Blob.php | 0 ...Getting started - Data types - Boolean.php | 0 .../Getting started - Data types - Clob.php | 0 .../Getting started - Data types - Date.php | 0 .../Getting started - Data types - Enum.php | 0 .../Getting started - Data types - Float.php | 0 .../Getting started - Data types - Gzip.php | 0 ...Getting started - Data types - Integer.php | 0 .../Getting started - Data types - Object.php | 0 .../Getting started - Data types - String.php | 0 ...tting started - Data types - Timestamp.php | 0 .../codes/Getting started - Requirements.php | 0 ...efinition - Constraints and validators.php | 15 ---- ...le definition - Data types and lengths.php | 27 ------- ...ting table definition - Default values.php | 0 ...ting table definition - Enum emulation.php | 19 ----- ...tting table definition - Table options.php | 0 ...l data - Adjacency list - Introduction.php | 0 .../Hierarchical data - Introduction.php | 0 ...ata - Materialized path - Introduction.php | 0 ...hical data - Nested set - Introduction.php | 0 ...chical data - NestedSet - Introduction.php | 0 .../codes/Native SQL - Component queries.php | 0 ...ive SQL - Fetching multiple components.php | 0 manual/codes/Native SQL - Scalar queries.php | 0 ...nal mapping - Columns - Column aliases.php | 12 --- ...onal mapping - Columns - Column naming.php | 0 ...mapping - Columns - Data types - Array.php | 7 -- ... mapping - Columns - Data types - Blob.php | 7 -- ...pping - Columns - Data types - Boolean.php | 7 -- ... mapping - Columns - Data types - Clob.php | 7 -- ... mapping - Columns - Data types - Date.php | 7 -- ... mapping - Columns - Data types - Enum.php | 15 ---- ...mapping - Columns - Data types - Float.php | 7 -- ... mapping - Columns - Data types - Gzip.php | 7 -- ...pping - Columns - Data types - Integer.php | 7 -- ... - Columns - Data types - Introduction.php | 0 ...apping - Columns - Data types - Object.php | 7 -- ...apping - Columns - Data types - String.php | 7 -- ... mapping - Columns - Data types - Time.php | 7 -- ...ing - Columns - Data types - Timestamp.php | 7 -- ... Columns - Data types - Type modifiers.php | 0 ...- Record identifiers - Autoincremented.php | 8 -- ...pping - Record identifiers - Composite.php | 8 -- ...ng - Record identifiers - Introduction.php | 0 ...mapping - Record identifiers - Natural.php | 7 -- ...apping - Record identifiers - Sequence.php | 0 ...ping - Record identifiers - Sequential.php | 0 ... Relations - Composites and aggregates.php | 0 ...ssociations - One-to-Many, Many-to-One.php | 18 ----- ... Foreign key associations - One-to-One.php | 28 ------- ...eign key associations - Tree structure.php | 12 --- ...- Inheritance - One table many classes.php | 14 ---- ...ns - Inheritance - One table one class.php | 26 ------ ...nal mapping - Relations - Introduction.php | 0 ...Join table associations - Many-to-Many.php | 54 ------------- ...ssociations - One-to-Many, Many-to-One.php | 0 ...- Join table associations - One-to-One.php | 0 ... table associations - Self-referencing.php | 16 ---- ...mapping - Relations - Relation aliases.php | 26 ------ ...ional mapping - Table and class naming.php | 0 .../codes/Operators - Logical operators.php | 0 .../Real world examples - Album lister.php | 0 ...eal world examples - Forum application.php | 52 ------------ ...orld examples - User management system.php | 78 ------------------ .../Runtime classes - Doctrine_Record.php | 40 ---------- .../Runtime classes - Doctrine_Session.php | 30 ------- manual/codes/Technology - Architecture.php | 0 .../Technology - Design patterns used.php | 0 ...logy - Internal optimizations - DELETE.php | 0 ...logy - Internal optimizations - INSERT.php | 0 ...logy - Internal optimizations - UPDATE.php | 0 manual/codes/Technology - Speed.php | 0 manual/codes/Transactions - Deadlocks.php | 0 manual/codes/Transactions - Introduction.php | 13 --- .../codes/Transactions - Isolation levels.php | 0 manual/codes/Transactions - Lock modes.php | 0 ...ocking strategies - Optimistic locking.php | 0 ...cking strategies - Pessimistic locking.php | 0 manual/codes/Transactions - Nesting.php | 23 ------ manual/codes/Transactions - Savepoints.php | 0 manual/codes/Transactions - Unit of work.php | 18 ----- ...view - Collection - Accessing elements.php | 15 ---- ...iew - Collection - Adding new elements.php | 8 -- ...ew - Collection - Collection expanding.php | 0 ...iew - Collection - Deleting collection.php | 7 -- ...iew - Collection - Fetching strategies.php | 52 ------------ ... Collection - Getting collection count.php | 9 --- ...t overview - Collection - Introduction.php | 18 ----- ...nt overview - Collection - Key mapping.php | 31 -------- ...- Collection - Loading related records.php | 20 ----- ...w - Collection - Saving the collection.php | 9 --- ...rview - Connection - Available drivers.php | 0 ...rview - Connection - Availible drivers.php | 0 ...- Connection - Flushing the connection.php | 11 --- ... - Connection - Getting a table object.php | 11 --- ... Connection - Getting connection state.php | 16 ---- ...w - Connection - Querying the database.php | 14 ---- ...ent overview - Db - Chaining listeners.php | 34 -------- ...erview - Db - Connecting to a database.php | 1 - ...Component overview - Db - Introduction.php | 0 ... overview - Db - Using event listeners.php | 36 --------- ...view - Exceptions - List of exceptions.php | 0 ...onent overview - Exceptions - Overview.php | 0 ...nent overview - Manager - Introduction.php | 0 ...rview - Manager - Managing connections.php | 25 ------ ...w - Manager - Opening a new connection.php | 18 ----- ...overview - Query - Aggregate functions.php | 15 ---- ...nt overview - Query - Bound parameters.php | 6 -- ...verview - Query - DQL - SQL conversion.php | 0 ...view - Query - FROM - selecting tables.php | 24 ------ ...t overview - Query - HAVING conditions.php | 0 ...ponent overview - Query - Introduction.php | 12 --- ...nd OFFSET - limiting the query results.php | 13 --- ... overview - Query - Method overloading.php | 20 ----- ...ery - ORDER BY - sorting query results.php | 20 ----- ... overview - Query - Relation operators.php | 15 ---- ...ery - WHERE - setting query conditions.php | 1 - ... overview - RawSql - Adding components.php | 13 --- ...onent overview - RawSql - Introduction.php | 0 ...overview - RawSql - Method overloading.php | 10 --- ...omponent overview - RawSql - Using SQL.php | 7 -- ...erview - Record - Accessing properties.php | 21 ----- ...omponent overview - Record - Callbacks.php | 0 ...overview - Record - Checking existence.php | 10 --- ...erview - Record - Creating new records.php | 20 ----- ...t overview - Record - Deleting records.php | 16 ---- ...verview - Record - Getting object copy.php | 3 - ...erview - Record - Getting record state.php | 31 -------- ...onent overview - Record - Introduction.php | 0 ...- Record - Retrieving existing records.php | 23 ------ ...ponent overview - Record - Serializing.php | 5 -- ...t overview - Record - Updating records.php | 12 --- ...nent overview - Table - Custom finders.php | 24 ------ ...verview - Table - Custom table classes.php | 13 --- ...nent overview - Table - Finder methods.php | 21 ----- ...iew - Table - Getting relation objects.php | 0 ...ew - Table - Getting table information.php | 11 --- ...ponent overview - Table - Introduction.php | 0 ...h relations - Creating related records.php | 14 ---- ...h relations - Deleting related records.php | 9 --- ...relations - Retrieving related records.php | 7 -- ...h relations - Updating related records.php | 9 --- ... relations - Working with associations.php | 0 ...nced components - Cache - Introduction.php | 1 + ...anced components - Cache - Query cache.php | 1 + ...ponents - Db_Profiler - Advanced usage.php | 1 + ...components - Db_Profiler - Basic usage.php | 1 + ...omponents - Db_Profiler - Introduction.php | 1 + ...ents - Evenlisteners - AccessorInvoker.php | 33 ++++++++ ...nts - Eventlisteners - AccessorInvoker.php | 1 + ...components - Eventlisteners - Chaining.php | 1 + ...s - Eventlisteners - Creating a logger.php | 1 + ...Eventlisteners - Creating new listener.php | 35 ++++++++ ...onents - Eventlisteners - Introduction.php | 1 + ...ents - Eventlisteners - List of events.php | 46 +++++++++++ ...ts - Eventlisteners - Listening events.php | 14 ++++ ...d components - Hook - Building queries.php | 1 + ...anced components - Hook - Introduction.php | 1 + ...ed components - Hook - List of parsers.php | 1 + ... components - Hook - Parameter hooking.php | 5 +- ...omponents - Locking Manager - Examples.php | 62 +++++++++++++++ ...nents - Locking Manager - Introduction.php | 1 + ...ponents - Locking Manager - Maintainer.php | 2 +- ...components - Locking Manager - Planned.php | 2 +- ... - Locking Manager - Technical Details.php | 1 + ...components - Validators - Introduction.php | 6 ++ ...dators - List of predefined validators.php | 1 + ...ponents - Validators - More Validation.php | 29 +++++++ ...ents - Validators - Valid or Not Valid.php | 31 ++++++++ ...vanced components - View - Intoduction.php | 1 + ...ced components - View - Managing views.php | 16 ++++ ...vanced components - View - Using views.php | 14 ++++ ...ding standards - Coding Style - Arrays.php | 13 +++ ...ing standards - Coding Style - Classes.php | 9 +++ ...ds - Coding Style - Control statements.php | 1 + ...- Coding Style - Functions and methods.php | 1 + ... - Coding Style - Inline documentation.php | 1 + ... - Coding Style - PHP code demarcation.php | 1 + ...ing standards - Coding Style - Strings.php | 19 +++++ ...andards - Naming Conventions - Classes.php | 1 + ...dards - Naming Conventions - Constants.php | 7 ++ ...dards - Naming Conventions - Filenames.php | 1 + ...ng Conventions - Functions and methods.php | 1 + ...ards - Naming Conventions - Interfaces.php | 1 + ... - Naming Conventions - Record columns.php | 1 + ...dards - Naming Conventions - Variables.php | 2 + .../Coding standards - Overview - Goals.php | 1 + .../Coding standards - Overview - Scope.php | 1 + ...ndards - PHP File Formatting - General.php | 1 + ...ds - PHP File Formatting - Indentation.php | 1 + ...PHP File Formatting - Line termination.php | 2 + ... File Formatting - Maximum line length.php | 1 + ...ng standards - Testing - Writing tests.php | 1 + ...iguration - Custom getters and setters.php | 5 +- ...figuration - Custom primary key column.php | 5 +- manual/docs/Configuration - Introduction.php | 6 ++ ...onfiguration - Levels of configuration.php | 21 +++++ ...tion - Setting attributes - Batch size.php | 6 ++ ... - Setting attributes - Event listener.php | 6 ++ ...Setting attributes - Fetching strategy.php | 6 ++ ...etting attributes - Identifier quoting.php | 1 + ...g attributes - Offset collection limit.php | 6 ++ ...ion - Setting attributes - Portability.php | 1 + ... Setting attributes - Session lockmode.php | 6 ++ ... - Setting attributes - Table creation.php | 6 ++ ...tion - Setting attributes - Validation.php | 6 ++ ...ration - Setting default eventlistener.php | 5 +- ...figuration - Setting default fetchmode.php | 5 +- .../Configuration - Using sequences.php | 5 +- ...agement - Connection-component binding.php | 1 + ...nagement - Lazy-connecting to database.php | 1 + ...tion management - Managing connections.php | 1 + ... management - Opening a new connection.php | 1 + ...ataDict - Getting database declaration.php | 1 + ...les - DataDict - Getting portable type.php | 1 + ...modules - DataDict - Reserved keywords.php | 1 + ...tion modules - Export - Altering table.php | 40 ++++++++++ ... modules - Export - Creating new table.php | 23 ++++++ ...ection modules - Export - Introduction.php | 1 + ...es - Import - Getting foreign key info.php | 1 + ... modules - Import - Getting table info.php | 1 + ...n modules - Import - Getting view info.php | 1 + ...ection modules - Import - Introduction.php | 1 + ...nection modules - Util - Using explain.php | 1 + .../DQL (Doctrine Query Language) - BNF.php | 1 + ... expressions - All and Any Expressions.php | 1 + ... expressions - All or Any Expressions.php} | 2 +- ...onal expressions - Between expressions.php | 2 + ...ssions - Collection Member Expressions.php | 1 + ...mpty Collection Comparison Expressions.php | 1 + ...ional expressions - Exists Expressions.php | 1 + ...nditional expressions - In expressions.php | 1 + ...itional expressions - Input parameters.php | 15 ++++ ...itional expressions - Like Expressions.php | 9 +++ ...) - Conditional expressions - Literals.php | 1 + ...ressions - Null Comparison Expressions.php | 1 + ...ns - Operators and operator precedence.php | 1 + ...itional expressions - Path expressions.php | 1 + ...- Conditional expressions - Subqueries.php | 20 +++++ ...trine Query Language) - DELETE queries.php | 17 ++++ ...L (Doctrine Query Language) - Examples.php | 1 + ...Doctrine Query Language) - FROM clause.php | 1 + ...nal Expressions - Arithmetic functions.php | 1 + ...nal Expressions - Collection functions.php | 1 + ...ional Expressions - Datetime functions.php | 1 + ...ctional Expressions - String functions.php | 1 + ...Query Language) - Functions - Contains.php | 8 ++ ...ine Query Language) - Functions - Like.php | 8 ++ ...e Query Language) - Functions - Regexp.php | 8 ++ ...y Language) - GROUP BY, HAVING clauses.php | 11 +++ ...ne Query Language) - GROUP BY, HAVING.php} | 2 +- ...octrine Query Language) - Introduction.php | 27 +++++++ ...nd OFFSET clauses - Driver portability.php | 1 + ...IMIT and OFFSET clauses - Introduction.php | 1 + ...clauses - The limit-subquery-algorithm.php | 1 + ...y Language) - LIMIT and OFFSET clauses.php | 15 ++++ ...ne Query Language) - LIMIT and OFFSET.php} | 2 +- ...ine Query Language) - ORDER BY clause.php} | 2 +- ...L (Doctrine Query Language) - ORDER BY.php | 1 + ...guage) - Operators - Logical operators.php | 1 + ...e) - SELECT queries - Aggregate values.php | 15 ++++ ...trine Query Language) - SELECT queries.php | 1 + ...trine Query Language) - UPDATE queries.php | 17 ++++ ...octrine Query Language) - WHERE clause.php | 1 + ...Database operations - Limit and offset.php | 5 +- ...abase operations - Nested transactions.php | 5 +- .../Database operations - Query logging.php | 5 +- .../Database operations - Sequences.php | 5 +- .../Database operations - Transactions.php | 5 +- .../Drivers - Mysql - Tips and tricks.php | 1 + ...cle - Making unsuported functions work.php | 1 + manual/docs/Functions - Contains.php | 1 + manual/docs/Functions - Like.php | 1 + manual/docs/Functions - Regexp.php | 1 + .../Getting started - Compile.php | 1 + manual/docs/Getting started - Compiling.php | 8 ++ .../Getting started - Data types - Array.php | 1 + .../Getting started - Data types - Blob.php | 1 + ...Getting started - Data types - Boolean.php | 1 + .../Getting started - Data types - Clob.php | 1 + .../Getting started - Data types - Date.php | 1 + .../Getting started - Data types - Enum.php | 1 + .../Getting started - Data types - Float.php | 1 + .../Getting started - Data types - Gzip.php | 1 + ...Getting started - Data types - Integer.php | 1 + .../Getting started - Data types - Object.php | 1 + .../Getting started - Data types - String.php | 1 + ...tting started - Data types - Timestamp.php | 1 + .../docs/Getting started - Requirements.php | 1 + ...efinition - Constraints and validators.php | 16 ++++ ...le definition - Data types and lengths.php | 28 +++++++ ...ting table definition - Default values.php | 1 + ...ting table definition - Enum emulation.php | 20 +++++ ...tting table definition - Table options.php | 1 + ...ing started - Setting table definition.php | 5 +- ...l data - Adjacency list - Introduction.php | 1 + .../Hierarchical data - Examples.php | 5 +- ...l data - Introduction - Node interface.php | 5 +- ...hical data - Introduction - Setting up.php | 5 +- ...oduction - Traversing or Walking Trees.php | 5 +- ...l data - Introduction - Tree interface.php | 5 +- .../docs/Hierarchical data - Introduction.php | 1 + ...ata - Materialized path - Introduction.php | 1 + ...hical data - Nested set - Introduction.php | 1 + ...rchical data - Nested set - Setting up.php | 5 +- ...hical data - Nested set - Tree options.php | 5 +- ...chical data - NestedSet - Introduction.php | 1 + .../docs/Native SQL - Component queries.php | 1 + ...ive SQL - Fetching multiple components.php | 1 + manual/docs/Native SQL - Scalar queries.php | 1 + ...nal mapping - Columns - Column aliases.php | 13 +++ ...onal mapping - Columns - Column naming.php | 1 + ...mapping - Columns - Data types - Array.php | 8 ++ ... mapping - Columns - Data types - Blob.php | 8 ++ ...pping - Columns - Data types - Boolean.php | 8 ++ ... mapping - Columns - Data types - Clob.php | 8 ++ ... mapping - Columns - Data types - Date.php | 8 ++ ... mapping - Columns - Data types - Enum.php | 16 ++++ ...mapping - Columns - Data types - Float.php | 8 ++ ... mapping - Columns - Data types - Gzip.php | 8 ++ ...pping - Columns - Data types - Integer.php | 8 ++ ... - Columns - Data types - Introduction.php | 1 + ...apping - Columns - Data types - Object.php | 8 ++ ...apping - Columns - Data types - String.php | 8 ++ ... mapping - Columns - Data types - Time.php | 8 ++ ...ing - Columns - Data types - Timestamp.php | 8 ++ ... Columns - Data types - Type modifiers.php | 1 + ...- Record identifiers - Autoincremented.php | 9 +++ ...pping - Record identifiers - Composite.php | 9 +++ ...ng - Record identifiers - Introduction.php | 1 + ...mapping - Record identifiers - Natural.php | 8 ++ ...apping - Record identifiers - Sequence.php | 1 + ...ping - Record identifiers - Sequential.php | 1 + ... Relations - Composites and aggregates.php | 1 + ...ssociations - One-to-Many, Many-to-One.php | 19 +++++ ... Foreign key associations - One-to-One.php | 29 +++++++ ...eign key associations - Tree structure.php | 13 +++ ...- Inheritance - One table many classes.php | 15 ++++ ...ns - Inheritance - One table one class.php | 27 +++++++ ...nal mapping - Relations - Introduction.php | 1 + ...Join table associations - Many-to-Many.php | 55 +++++++++++++ ...ssociations - One-to-Many, Many-to-One.php | 1 + ...- Join table associations - One-to-One.php | 1 + ... table associations - Self-referencing.php | 17 ++++ ...mapping - Relations - Relation aliases.php | 27 +++++++ ...ional mapping - Table and class naming.php | 1 + manual/docs/Operators - Logical operators.php | 1 + ...ance - Internal optimizations - DELETE.php | 5 +- ...ance - Internal optimizations - INSERT.php | 5 +- .../Real world examples - Album lister.php | 1 + ...eal world examples - Forum application.php | 53 +++++++++++++ ...orld examples - User management system.php | 79 +++++++++++++++++++ .../Runtime classes - Doctrine_Record.php | 41 ++++++++++ .../Runtime classes - Doctrine_Session.php | 31 ++++++++ manual/docs/Technology - Architecture.php | 1 + .../Technology - Design patterns used.php | 1 + ...logy - Internal optimizations - DELETE.php | 1 + ...logy - Internal optimizations - INSERT.php | 1 + ...logy - Internal optimizations - UPDATE.php | 1 + manual/docs/Technology - Speed.php | 1 + manual/docs/Transactions - Deadlocks.php | 1 + manual/docs/Transactions - Introduction.php | 14 ++++ .../docs/Transactions - Isolation levels.php | 1 + manual/docs/Transactions - Lock modes.php | 1 + ...ocking strategies - Optimistic locking.php | 1 + ...cking strategies - Pessimistic locking.php | 1 + manual/docs/Transactions - Nesting.php | 24 ++++++ manual/docs/Transactions - Savepoints.php | 1 + manual/docs/Transactions - Unit of work.php | 19 +++++ ...view - Collection - Accessing elements.php | 16 ++++ ...iew - Collection - Adding new elements.php | 9 +++ ...ew - Collection - Collection expanding.php | 1 + ...iew - Collection - Deleting collection.php | 8 ++ ...iew - Collection - Fetching strategies.php | 53 +++++++++++++ ... Collection - Getting collection count.php | 10 +++ ...t overview - Collection - Introduction.php | 19 +++++ ...nt overview - Collection - Key mapping.php | 32 ++++++++ ...- Collection - Loading related records.php | 21 +++++ ...w - Collection - Saving the collection.php | 10 +++ ...rview - Connection - Available drivers.php | 1 + ...rview - Connection - Availible drivers.php | 1 + ...- Connection - Flushing the connection.php | 12 +++ ... - Connection - Getting a table object.php | 12 +++ ... Connection - Getting connection state.php | 17 ++++ ...t overview - Connection - Introduction.php | 2 + ...w - Connection - Querying the database.php | 15 ++++ ...ent overview - Db - Chaining listeners.php | 35 ++++++++ ...erview - Db - Connecting to a database.php | 2 + ...Component overview - Db - Introduction.php | 1 + ... overview - Db - Using event listeners.php | 37 +++++++++ ...view - Exceptions - List of exceptions.php | 1 + ...onent overview - Exceptions - Overview.php | 1 + ...nent overview - Manager - Introduction.php | 1 + ...rview - Manager - Managing connections.php | 26 ++++++ ...w - Manager - Opening a new connection.php | 19 +++++ ...overview - Query - Aggregate functions.php | 16 ++++ ...nt overview - Query - Bound parameters.php | 7 ++ ...verview - Query - DQL - SQL conversion.php | 1 + ...view - Query - FROM - selecting tables.php | 25 ++++++ ...overview - Query - Fetching strategies.php | 5 +- ...t overview - Query - HAVING conditions.php | 1 + ...ponent overview - Query - Introduction.php | 13 +++ ...nd OFFSET - limiting the query results.php | 14 ++++ ...rview - Query - Lazy property fetching.php | 5 +- ... overview - Query - Method overloading.php | 21 +++++ ...ery - ORDER BY - sorting query results.php | 21 +++++ ... overview - Query - Relation operators.php | 16 ++++ ...ery - WHERE - setting query conditions.php | 2 + ... overview - RawSql - Adding components.php | 14 ++++ ...onent overview - RawSql - Introduction.php | 1 + ...overview - RawSql - Method overloading.php | 11 +++ ...omponent overview - RawSql - Using SQL.php | 8 ++ ...erview - Record - Accessing properties.php | 22 ++++++ ...omponent overview - Record - Callbacks.php | 1 + ...overview - Record - Checking Existence.php | 11 +++ ...erview - Record - Creating new records.php | 21 +++++ ...t overview - Record - Deleting records.php | 17 ++++ ...verview - Record - Getting object copy.php | 4 + ...erview - Record - Getting record state.php | 32 ++++++++ ...onent overview - Record - Introduction.php | 1 + ...- Record - Retrieving existing records.php | 24 ++++++ ...ponent overview - Record - Serializing.php | 6 ++ ...t overview - Record - Updating records.php | 13 +++ ...nent overview - Table - Custom finders.php | 25 ++++++ ...verview - Table - Custom table classes.php | 14 ++++ ...nent overview - Table - Finder methods.php | 22 ++++++ ...iew - Table - Getting relation objects.php | 1 + ...ew - Table - Getting table information.php | 12 +++ ...ponent overview - Table - Introduction.php | 1 + ...h relations - Creating related records.php | 15 ++++ ...h relations - Deleting related records.php | 10 +++ ...relations - Retrieving related records.php | 8 ++ ...h relations - Updating related records.php | 10 +++ ... relations - Working with associations.php | 1 + 554 files changed, 2330 insertions(+), 2041 deletions(-) delete mode 100644 manual/codes/Advanced components - Cache - Introduction.php delete mode 100644 manual/codes/Advanced components - Cache - Query cache.php delete mode 100644 manual/codes/Advanced components - Db_Profiler - Advanced usage.php delete mode 100644 manual/codes/Advanced components - Db_Profiler - Basic usage.php delete mode 100644 manual/codes/Advanced components - Db_Profiler - Introduction.php delete mode 100644 manual/codes/Advanced components - Evenlisteners - AccessorInvoker.php delete mode 100644 manual/codes/Advanced components - Eventlisteners - AccessorInvoker.php delete mode 100644 manual/codes/Advanced components - Eventlisteners - Chaining.php delete mode 100644 manual/codes/Advanced components - Eventlisteners - Creating a logger.php delete mode 100644 manual/codes/Advanced components - Eventlisteners - Creating new listener.php delete mode 100644 manual/codes/Advanced components - Eventlisteners - Introduction.php delete mode 100644 manual/codes/Advanced components - Eventlisteners - List of events.php delete mode 100644 manual/codes/Advanced components - Eventlisteners - Listening events.php delete mode 100644 manual/codes/Advanced components - Hook - Building queries.php delete mode 100644 manual/codes/Advanced components - Hook - Introduction.php delete mode 100644 manual/codes/Advanced components - Hook - List of parsers.php delete mode 100644 manual/codes/Advanced components - Locking Manager - Examples.php delete mode 100644 manual/codes/Advanced components - Locking Manager - Introduction.php delete mode 100644 manual/codes/Advanced components - Locking Manager - Maintainer.php delete mode 100644 manual/codes/Advanced components - Locking Manager - Planned.php delete mode 100644 manual/codes/Advanced components - Locking Manager - Technical Details.php delete mode 100644 manual/codes/Advanced components - Validators - Introduction.php delete mode 100644 manual/codes/Advanced components - Validators - List of predefined validators.php delete mode 100644 manual/codes/Advanced components - Validators - More Validation.php delete mode 100644 manual/codes/Advanced components - Validators - Valid or Not Valid.php delete mode 100644 manual/codes/Advanced components - View - Intoduction.php delete mode 100644 manual/codes/Advanced components - View - Managing views.php delete mode 100644 manual/codes/Advanced components - View - Using views.php delete mode 100644 manual/codes/Coding standards - Coding Style - Arrays.php delete mode 100644 manual/codes/Coding standards - Coding Style - Classes.php delete mode 100644 manual/codes/Coding standards - Coding Style - Control statements.php delete mode 100644 manual/codes/Coding standards - Coding Style - Functions and methods.php delete mode 100644 manual/codes/Coding standards - Coding Style - Inline documentation.php delete mode 100644 manual/codes/Coding standards - Coding Style - PHP code demarcation.php delete mode 100644 manual/codes/Coding standards - Coding Style - Strings.php delete mode 100644 manual/codes/Coding standards - Naming Conventions - Classes.php delete mode 100644 manual/codes/Coding standards - Naming Conventions - Constants.php delete mode 100644 manual/codes/Coding standards - Naming Conventions - Filenames.php delete mode 100644 manual/codes/Coding standards - Naming Conventions - Functions and methods.php delete mode 100644 manual/codes/Coding standards - Naming Conventions - Interfaces.php delete mode 100644 manual/codes/Coding standards - Naming Conventions - Record columns.php delete mode 100644 manual/codes/Coding standards - Overview - Goals.php delete mode 100644 manual/codes/Coding standards - Overview - Scope.php delete mode 100644 manual/codes/Coding standards - PHP File Formatting - General.php delete mode 100644 manual/codes/Coding standards - PHP File Formatting - Indentation.php delete mode 100644 manual/codes/Coding standards - PHP File Formatting - Maximum line length.php delete mode 100644 manual/codes/Coding standards - Testing - Writing tests.php delete mode 100644 manual/codes/Configuration - Introduction.php delete mode 100644 manual/codes/Configuration - Levels of configuration.php delete mode 100644 manual/codes/Configuration - Setting attributes - Batch size.php delete mode 100644 manual/codes/Configuration - Setting attributes - Event listener.php delete mode 100644 manual/codes/Configuration - Setting attributes - Fetching strategy.php delete mode 100644 manual/codes/Configuration - Setting attributes - Identifier quoting.php delete mode 100644 manual/codes/Configuration - Setting attributes - Offset collection limit.php delete mode 100644 manual/codes/Configuration - Setting attributes - Portability.php delete mode 100644 manual/codes/Configuration - Setting attributes - Session lockmode.php delete mode 100644 manual/codes/Configuration - Setting attributes - Table creation.php delete mode 100644 manual/codes/Configuration - Setting attributes - Validation.php delete mode 100644 manual/codes/Connection management - Connection-component binding.php delete mode 100644 manual/codes/Connection management - Lazy-connecting to database.php delete mode 100644 manual/codes/Connection management - Managing connections.php delete mode 100644 manual/codes/Connection management - Opening a new connection.php delete mode 100644 manual/codes/Connection modules - DataDict - Getting database declaration.php delete mode 100644 manual/codes/Connection modules - DataDict - Getting portable type.php delete mode 100644 manual/codes/Connection modules - DataDict - Reserved keywords.php delete mode 100644 manual/codes/Connection modules - Export - Altering table.php delete mode 100644 manual/codes/Connection modules - Export - Creating new table.php delete mode 100644 manual/codes/Connection modules - Export - Introduction.php delete mode 100644 manual/codes/Connection modules - Import - Getting foreign key info.php delete mode 100644 manual/codes/Connection modules - Import - Getting table info.php delete mode 100644 manual/codes/Connection modules - Import - Getting view info.php delete mode 100644 manual/codes/Connection modules - Import - Introduction.php delete mode 100644 manual/codes/Connection modules - Util - Using explain.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - BNF.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Literals.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - DELETE queries.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Examples.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - FROM clause.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic Functions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Datetime Functions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Functional Expressions - String Functions.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Functions - Contains.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Functions - Like.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Functions - Regexp.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Introduction.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - ORDER BY clause.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - ORDER BY.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - Operators - Logical operators.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - SELECT queries.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - UPDATE queries.php delete mode 100644 manual/codes/DQL (Doctrine Query Language) - WHERE clause.php delete mode 100644 manual/codes/Drivers - Mysql - Tips and tricks.php delete mode 100644 manual/codes/Drivers - Oracle - Making unsuported functions work.php delete mode 100644 manual/codes/Functions - Contains.php delete mode 100644 manual/codes/Functions - Like.php delete mode 100644 manual/codes/Functions - Regexp.php delete mode 100644 manual/codes/Getting started - Compiling.php delete mode 100644 manual/codes/Getting started - Data types - Array.php delete mode 100644 manual/codes/Getting started - Data types - Blob.php delete mode 100644 manual/codes/Getting started - Data types - Boolean.php delete mode 100644 manual/codes/Getting started - Data types - Clob.php delete mode 100644 manual/codes/Getting started - Data types - Date.php delete mode 100644 manual/codes/Getting started - Data types - Enum.php delete mode 100644 manual/codes/Getting started - Data types - Float.php delete mode 100644 manual/codes/Getting started - Data types - Gzip.php delete mode 100644 manual/codes/Getting started - Data types - Integer.php delete mode 100644 manual/codes/Getting started - Data types - Object.php delete mode 100644 manual/codes/Getting started - Data types - String.php delete mode 100644 manual/codes/Getting started - Data types - Timestamp.php delete mode 100644 manual/codes/Getting started - Requirements.php delete mode 100644 manual/codes/Getting started - Setting table definition - Constraints and validators.php delete mode 100644 manual/codes/Getting started - Setting table definition - Data types and lengths.php delete mode 100644 manual/codes/Getting started - Setting table definition - Default values.php delete mode 100644 manual/codes/Getting started - Setting table definition - Enum emulation.php delete mode 100644 manual/codes/Getting started - Setting table definition - Table options.php delete mode 100644 manual/codes/Hierarchical data - Adjacency list - Introduction.php delete mode 100644 manual/codes/Hierarchical data - Introduction.php delete mode 100644 manual/codes/Hierarchical data - Materialized path - Introduction.php delete mode 100644 manual/codes/Hierarchical data - Nested set - Introduction.php delete mode 100644 manual/codes/Hierarchical data - NestedSet - Introduction.php delete mode 100644 manual/codes/Native SQL - Component queries.php delete mode 100644 manual/codes/Native SQL - Fetching multiple components.php delete mode 100644 manual/codes/Native SQL - Scalar queries.php delete mode 100644 manual/codes/Object relational mapping - Columns - Column aliases.php delete mode 100644 manual/codes/Object relational mapping - Columns - Column naming.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Array.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Blob.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Boolean.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Clob.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Date.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Enum.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Float.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Gzip.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Integer.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Introduction.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Object.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - String.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Time.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Timestamp.php delete mode 100644 manual/codes/Object relational mapping - Columns - Data types - Type modifiers.php delete mode 100644 manual/codes/Object relational mapping - Record identifiers - Autoincremented.php delete mode 100644 manual/codes/Object relational mapping - Record identifiers - Composite.php delete mode 100644 manual/codes/Object relational mapping - Record identifiers - Introduction.php delete mode 100644 manual/codes/Object relational mapping - Record identifiers - Natural.php delete mode 100644 manual/codes/Object relational mapping - Record identifiers - Sequence.php delete mode 100644 manual/codes/Object relational mapping - Record identifiers - Sequential.php delete mode 100644 manual/codes/Object relational mapping - Relations - Composites and aggregates.php delete mode 100644 manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php delete mode 100644 manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-One.php delete mode 100644 manual/codes/Object relational mapping - Relations - Foreign key associations - Tree structure.php delete mode 100644 manual/codes/Object relational mapping - Relations - Inheritance - One table many classes.php delete mode 100644 manual/codes/Object relational mapping - Relations - Inheritance - One table one class.php delete mode 100644 manual/codes/Object relational mapping - Relations - Introduction.php delete mode 100644 manual/codes/Object relational mapping - Relations - Join table associations - Many-to-Many.php delete mode 100644 manual/codes/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php delete mode 100644 manual/codes/Object relational mapping - Relations - Join table associations - One-to-One.php delete mode 100644 manual/codes/Object relational mapping - Relations - Join table associations - Self-referencing.php delete mode 100644 manual/codes/Object relational mapping - Relations - Relation aliases.php delete mode 100644 manual/codes/Object relational mapping - Table and class naming.php delete mode 100644 manual/codes/Operators - Logical operators.php delete mode 100644 manual/codes/Real world examples - Album lister.php delete mode 100644 manual/codes/Real world examples - Forum application.php delete mode 100644 manual/codes/Real world examples - User management system.php delete mode 100644 manual/codes/Runtime classes - Doctrine_Record.php delete mode 100644 manual/codes/Runtime classes - Doctrine_Session.php delete mode 100644 manual/codes/Technology - Architecture.php delete mode 100644 manual/codes/Technology - Design patterns used.php delete mode 100644 manual/codes/Technology - Internal optimizations - DELETE.php delete mode 100644 manual/codes/Technology - Internal optimizations - INSERT.php delete mode 100644 manual/codes/Technology - Internal optimizations - UPDATE.php delete mode 100644 manual/codes/Technology - Speed.php delete mode 100644 manual/codes/Transactions - Deadlocks.php delete mode 100644 manual/codes/Transactions - Introduction.php delete mode 100644 manual/codes/Transactions - Isolation levels.php delete mode 100644 manual/codes/Transactions - Lock modes.php delete mode 100644 manual/codes/Transactions - Locking strategies - Optimistic locking.php delete mode 100644 manual/codes/Transactions - Locking strategies - Pessimistic locking.php delete mode 100644 manual/codes/Transactions - Nesting.php delete mode 100644 manual/codes/Transactions - Savepoints.php delete mode 100644 manual/codes/Transactions - Unit of work.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Accessing elements.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Adding new elements.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Collection expanding.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Deleting collection.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Fetching strategies.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Getting collection count.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Introduction.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Key mapping.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Loading related records.php delete mode 100644 manual/codes/Working with objects - Component overview - Collection - Saving the collection.php delete mode 100644 manual/codes/Working with objects - Component overview - Connection - Available drivers.php delete mode 100644 manual/codes/Working with objects - Component overview - Connection - Availible drivers.php delete mode 100644 manual/codes/Working with objects - Component overview - Connection - Flushing the connection.php delete mode 100644 manual/codes/Working with objects - Component overview - Connection - Getting a table object.php delete mode 100644 manual/codes/Working with objects - Component overview - Connection - Getting connection state.php delete mode 100644 manual/codes/Working with objects - Component overview - Connection - Querying the database.php delete mode 100644 manual/codes/Working with objects - Component overview - Db - Chaining listeners.php delete mode 100644 manual/codes/Working with objects - Component overview - Db - Connecting to a database.php delete mode 100644 manual/codes/Working with objects - Component overview - Db - Introduction.php delete mode 100644 manual/codes/Working with objects - Component overview - Db - Using event listeners.php delete mode 100644 manual/codes/Working with objects - Component overview - Exceptions - List of exceptions.php delete mode 100644 manual/codes/Working with objects - Component overview - Exceptions - Overview.php delete mode 100644 manual/codes/Working with objects - Component overview - Manager - Introduction.php delete mode 100644 manual/codes/Working with objects - Component overview - Manager - Managing connections.php delete mode 100644 manual/codes/Working with objects - Component overview - Manager - Opening a new connection.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - Aggregate functions.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - Bound parameters.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - DQL - SQL conversion.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - FROM - selecting tables.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - HAVING conditions.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - Introduction.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - Method overloading.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - ORDER BY - sorting query results.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - Relation operators.php delete mode 100644 manual/codes/Working with objects - Component overview - Query - WHERE - setting query conditions.php delete mode 100644 manual/codes/Working with objects - Component overview - RawSql - Adding components.php delete mode 100644 manual/codes/Working with objects - Component overview - RawSql - Introduction.php delete mode 100644 manual/codes/Working with objects - Component overview - RawSql - Method overloading.php delete mode 100644 manual/codes/Working with objects - Component overview - RawSql - Using SQL.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Accessing properties.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Callbacks.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Checking existence.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Creating new records.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Deleting records.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Getting object copy.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Getting record state.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Introduction.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Retrieving existing records.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Serializing.php delete mode 100644 manual/codes/Working with objects - Component overview - Record - Updating records.php delete mode 100644 manual/codes/Working with objects - Component overview - Table - Custom finders.php delete mode 100644 manual/codes/Working with objects - Component overview - Table - Custom table classes.php delete mode 100644 manual/codes/Working with objects - Component overview - Table - Finder methods.php delete mode 100644 manual/codes/Working with objects - Component overview - Table - Getting relation objects.php delete mode 100644 manual/codes/Working with objects - Component overview - Table - Getting table information.php delete mode 100644 manual/codes/Working with objects - Component overview - Table - Introduction.php delete mode 100644 manual/codes/Working with objects - Dealing with relations - Creating related records.php delete mode 100644 manual/codes/Working with objects - Dealing with relations - Deleting related records.php delete mode 100644 manual/codes/Working with objects - Dealing with relations - Retrieving related records.php delete mode 100644 manual/codes/Working with objects - Dealing with relations - Updating related records.php delete mode 100644 manual/codes/Working with objects - Dealing with relations - Working with associations.php rename manual/{codes => docs}/Advanced components - Hook - Parameter hooking.php (59%) rename manual/{codes => docs}/Configuration - Custom getters and setters.php (91%) rename manual/{codes => docs}/Configuration - Custom primary key column.php (81%) rename manual/{codes => docs}/Configuration - Setting default eventlistener.php (87%) rename manual/{codes => docs}/Configuration - Setting default fetchmode.php (89%) rename manual/{codes => docs}/Configuration - Using sequences.php (79%) rename manual/{codes/Coding standards - Naming Conventions - Variables.php => docs/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php} (50%) rename manual/{codes/Coding standards - PHP File Formatting - Line termination.php => docs/DQL (Doctrine Query Language) - GROUP BY, HAVING.php} (50%) rename manual/{codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php => docs/DQL (Doctrine Query Language) - LIMIT and OFFSET.php} (50%) rename manual/{codes/Working with objects - Component overview - Connection - Introduction.php => docs/DQL (Doctrine Query Language) - ORDER BY clause.php} (50%) create mode 100644 manual/docs/DQL (Doctrine Query Language) - ORDER BY.php rename manual/{codes => docs}/Database operations - Limit and offset.php (84%) rename manual/{codes => docs}/Database operations - Nested transactions.php (85%) rename manual/{codes => docs}/Database operations - Query logging.php (85%) rename manual/{codes => docs}/Database operations - Sequences.php (82%) rename manual/{codes => docs}/Database operations - Transactions.php (84%) rename manual/{codes => docs}/Getting started - Compile.php (98%) create mode 100644 manual/docs/Getting started - Data types - Array.php create mode 100644 manual/docs/Getting started - Data types - Blob.php create mode 100644 manual/docs/Getting started - Data types - Boolean.php create mode 100644 manual/docs/Getting started - Data types - Clob.php create mode 100644 manual/docs/Getting started - Data types - Date.php create mode 100644 manual/docs/Getting started - Data types - Enum.php create mode 100644 manual/docs/Getting started - Data types - Float.php create mode 100644 manual/docs/Getting started - Data types - Gzip.php create mode 100644 manual/docs/Getting started - Data types - Integer.php create mode 100644 manual/docs/Getting started - Data types - Object.php create mode 100644 manual/docs/Getting started - Data types - String.php create mode 100644 manual/docs/Getting started - Data types - Timestamp.php create mode 100644 manual/docs/Getting started - Setting table definition - Table options.php rename manual/{codes => docs}/Getting started - Setting table definition.php (90%) create mode 100644 manual/docs/Hierarchical data - Adjacency list - Introduction.php rename manual/{codes => docs}/Hierarchical data - Examples.php (99%) rename manual/{codes => docs}/Hierarchical data - Introduction - Node interface.php (98%) rename manual/{codes => docs}/Hierarchical data - Introduction - Setting up.php (96%) rename manual/{codes => docs}/Hierarchical data - Introduction - Traversing or Walking Trees.php (96%) rename manual/{codes => docs}/Hierarchical data - Introduction - Tree interface.php (96%) create mode 100644 manual/docs/Hierarchical data - Introduction.php create mode 100644 manual/docs/Hierarchical data - Materialized path - Introduction.php create mode 100644 manual/docs/Hierarchical data - Nested set - Introduction.php rename manual/{codes => docs}/Hierarchical data - Nested set - Setting up.php (96%) rename manual/{codes => docs}/Hierarchical data - Nested set - Tree options.php (97%) create mode 100644 manual/docs/Object relational mapping - Record identifiers - Sequential.php rename manual/{codes => docs}/Performance - Internal optimizations - DELETE.php (94%) rename manual/{codes => docs}/Performance - Internal optimizations - INSERT.php (95%) rename manual/{codes => docs}/Working with objects - Component overview - Query - Fetching strategies.php (89%) rename manual/{codes => docs}/Working with objects - Component overview - Query - Lazy property fetching.php (77%) diff --git a/manual/codes/Advanced components - Cache - Introduction.php b/manual/codes/Advanced components - Cache - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Cache - Query cache.php b/manual/codes/Advanced components - Cache - Query cache.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Db_Profiler - Advanced usage.php b/manual/codes/Advanced components - Db_Profiler - Advanced usage.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Db_Profiler - Basic usage.php b/manual/codes/Advanced components - Db_Profiler - Basic usage.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Db_Profiler - Introduction.php b/manual/codes/Advanced components - Db_Profiler - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Evenlisteners - AccessorInvoker.php b/manual/codes/Advanced components - Evenlisteners - AccessorInvoker.php deleted file mode 100644 index 1d9e464cd..000000000 --- a/manual/codes/Advanced components - Evenlisteners - AccessorInvoker.php +++ /dev/null @@ -1,32 +0,0 @@ -hasColumn("name", "string", 200); - $this->hasColumn("password", "string", 32); - } - public function setPassword($password) { - return md5($password); - } - public function getName($name) { - return strtoupper($name); - } -} - -$user = new User(); - -$user->name = 'someone'; - -print $user->name; // someone - -$user->password = '123'; - -print $user->password; // 123 - -$user->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker()); - -print $user->name; // SOMEONE - -$user->password = '123'; - -print $user->password; // 202cb962ac59075b964b07152d234b70 -?> diff --git a/manual/codes/Advanced components - Eventlisteners - AccessorInvoker.php b/manual/codes/Advanced components - Eventlisteners - AccessorInvoker.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Eventlisteners - Chaining.php b/manual/codes/Advanced components - Eventlisteners - Chaining.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Eventlisteners - Creating a logger.php b/manual/codes/Advanced components - Eventlisteners - Creating a logger.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Eventlisteners - Creating new listener.php b/manual/codes/Advanced components - Eventlisteners - Creating new listener.php deleted file mode 100644 index b0fe91a85..000000000 --- a/manual/codes/Advanced components - Eventlisteners - Creating new listener.php +++ /dev/null @@ -1,34 +0,0 @@ -getTable()->getComponentName()." just got loaded!"; - } - public function onSave(Doctrine_Record $record) { - print "saved data access object!"; - } -} -class MyListener2 extends Doctrine_EventListener { - public function onPreUpdate() { - try { - $record->set("updated",time()); - } catch(InvalidKeyException $e) { - } - } -} - - -// setting global listener -$manager = Doctrine_Manager::getInstance(); - -$manager->setAttribute(Doctrine::ATTR_LISTENER,new MyListener()); - -// setting connection level listener -$conn = $manager->openConnection($dbh); - -$conn->setAttribute(Doctrine::ATTR_LISTENER,new MyListener2()); - -// setting factory level listener -$table = $conn->getTable("User"); - -$table->setAttribute(Doctrine::ATTR_LISTENER,new MyListener()); -?> diff --git a/manual/codes/Advanced components - Eventlisteners - Introduction.php b/manual/codes/Advanced components - Eventlisteners - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Eventlisteners - List of events.php b/manual/codes/Advanced components - Eventlisteners - List of events.php deleted file mode 100644 index b8ade15ed..000000000 --- a/manual/codes/Advanced components - Eventlisteners - List of events.php +++ /dev/null @@ -1,45 +0,0 @@ -getTable("User"); - -$table->setEventListener(new MyListener2()); - -// retrieve user whose primary key is 2 -$user = $table->find(2); - -$user->name = "John Locke"; - -// update event will be listened and current time will be assigned to the field 'updated' -$user->save(); -?> diff --git a/manual/codes/Advanced components - Hook - Building queries.php b/manual/codes/Advanced components - Hook - Building queries.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Hook - Introduction.php b/manual/codes/Advanced components - Hook - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Hook - List of parsers.php b/manual/codes/Advanced components - Hook - List of parsers.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Locking Manager - Examples.php b/manual/codes/Advanced components - Locking Manager - Examples.php deleted file mode 100644 index 0f2407697..000000000 --- a/manual/codes/Advanced components - Locking Manager - Examples.php +++ /dev/null @@ -1,61 +0,0 @@ -At the page where the lock is requested... -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... -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 -} -?> diff --git a/manual/codes/Advanced components - Locking Manager - Introduction.php b/manual/codes/Advanced components - Locking Manager - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Locking Manager - Maintainer.php b/manual/codes/Advanced components - Locking Manager - Maintainer.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Locking Manager - Planned.php b/manual/codes/Advanced components - Locking Manager - Planned.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Locking Manager - Technical Details.php b/manual/codes/Advanced components - Locking Manager - Technical Details.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Validators - Introduction.php b/manual/codes/Advanced components - Validators - Introduction.php deleted file mode 100644 index be47e66bd..000000000 --- a/manual/codes/Advanced components - Validators - Introduction.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_VLD, true); -?> diff --git a/manual/codes/Advanced components - Validators - List of predefined validators.php b/manual/codes/Advanced components - Validators - List of predefined validators.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - Validators - More Validation.php b/manual/codes/Advanced components - Validators - More Validation.php deleted file mode 100644 index d4f206bd1..000000000 --- a/manual/codes/Advanced components - Validators - More Validation.php +++ /dev/null @@ -1,28 +0,0 @@ -ownsOne("Email","User.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")); - } -} -?> diff --git a/manual/codes/Advanced components - Validators - Valid or Not Valid.php b/manual/codes/Advanced components - Validators - Valid or Not Valid.php deleted file mode 100644 index 53b17737f..000000000 --- a/manual/codes/Advanced components - Validators - Valid or Not Valid.php +++ /dev/null @@ -1,30 +0,0 @@ -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/codes/Advanced components - View - Intoduction.php b/manual/codes/Advanced components - View - Intoduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Advanced components - View - Managing views.php b/manual/codes/Advanced components - View - Managing views.php deleted file mode 100644 index 8f41faa93..000000000 --- a/manual/codes/Advanced components - View - Managing views.php +++ /dev/null @@ -1,15 +0,0 @@ -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(); -?> diff --git a/manual/codes/Advanced components - View - Using views.php b/manual/codes/Advanced components - View - Using views.php deleted file mode 100644 index 6975c0a94..000000000 --- a/manual/codes/Advanced components - View - Using views.php +++ /dev/null @@ -1,13 +0,0 @@ -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/codes/Coding standards - Coding Style - Arrays.php b/manual/codes/Coding standards - Coding Style - Arrays.php deleted file mode 100644 index 28cf67d53..000000000 --- a/manual/codes/Coding standards - Coding Style - Arrays.php +++ /dev/null @@ -1,12 +0,0 @@ - 'firstValue', - 'second' => 'secondValue'); - diff --git a/manual/codes/Coding standards - Coding Style - Classes.php b/manual/codes/Coding standards - Coding Style - Classes.php deleted file mode 100644 index 587d8f9c0..000000000 --- a/manual/codes/Coding standards - Coding Style - Classes.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/manual/codes/Coding standards - Naming Conventions - Filenames.php b/manual/codes/Coding standards - Naming Conventions - Filenames.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - Naming Conventions - Functions and methods.php b/manual/codes/Coding standards - Naming Conventions - Functions and methods.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - Naming Conventions - Interfaces.php b/manual/codes/Coding standards - Naming Conventions - Interfaces.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - Naming Conventions - Record columns.php b/manual/codes/Coding standards - Naming Conventions - Record columns.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - Overview - Goals.php b/manual/codes/Coding standards - Overview - Goals.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - Overview - Scope.php b/manual/codes/Coding standards - Overview - Scope.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - PHP File Formatting - General.php b/manual/codes/Coding standards - PHP File Formatting - General.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - PHP File Formatting - Indentation.php b/manual/codes/Coding standards - PHP File Formatting - Indentation.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - PHP File Formatting - Maximum line length.php b/manual/codes/Coding standards - PHP File Formatting - Maximum line length.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Coding standards - Testing - Writing tests.php b/manual/codes/Coding standards - Testing - Writing tests.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Configuration - Introduction.php b/manual/codes/Configuration - Introduction.php deleted file mode 100644 index 48c9dbfd8..000000000 --- a/manual/codes/Configuration - Introduction.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_LISTENER, new MyListener()); -?> diff --git a/manual/codes/Configuration - Levels of configuration.php b/manual/codes/Configuration - Levels of configuration.php deleted file mode 100644 index dd31bcd70..000000000 --- a/manual/codes/Configuration - Levels of configuration.php +++ /dev/null @@ -1,20 +0,0 @@ -setAttribute(Doctrine::ATTR_VLD, false); - -// 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_VLD, true); - -// 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/codes/Configuration - Setting attributes - Batch size.php b/manual/codes/Configuration - Setting attributes - Batch size.php deleted file mode 100644 index d7640f7e3..000000000 --- a/manual/codes/Configuration - Setting attributes - Batch size.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_BATCH_SIZE, 7); -?> diff --git a/manual/codes/Configuration - Setting attributes - Event listener.php b/manual/codes/Configuration - Setting attributes - Event listener.php deleted file mode 100644 index 9d308e058..000000000 --- a/manual/codes/Configuration - Setting attributes - Event listener.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_LISTENER, new MyListener()); -?> diff --git a/manual/codes/Configuration - Setting attributes - Fetching strategy.php b/manual/codes/Configuration - Setting attributes - Fetching strategy.php deleted file mode 100644 index 576f6aa7f..000000000 --- a/manual/codes/Configuration - Setting attributes - Fetching strategy.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_LAZY); -?> diff --git a/manual/codes/Configuration - Setting attributes - Identifier quoting.php b/manual/codes/Configuration - Setting attributes - Identifier quoting.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Configuration - Setting attributes - Offset collection limit.php b/manual/codes/Configuration - Setting attributes - Offset collection limit.php deleted file mode 100644 index 1f3c02bae..000000000 --- a/manual/codes/Configuration - Setting attributes - Offset collection limit.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_COLL_LIMIT, 10); -?> diff --git a/manual/codes/Configuration - Setting attributes - Portability.php b/manual/codes/Configuration - Setting attributes - Portability.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Configuration - Setting attributes - Session lockmode.php b/manual/codes/Configuration - Setting attributes - Session lockmode.php deleted file mode 100644 index e92f4e233..000000000 --- a/manual/codes/Configuration - Setting attributes - Session lockmode.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_LOCKMODE, Doctrine::LOCK_PESSIMISTIC); -?> diff --git a/manual/codes/Configuration - Setting attributes - Table creation.php b/manual/codes/Configuration - Setting attributes - Table creation.php deleted file mode 100644 index 87b2c645a..000000000 --- a/manual/codes/Configuration - Setting attributes - Table creation.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_CREATE_TABLES, false); -?> diff --git a/manual/codes/Configuration - Setting attributes - Validation.php b/manual/codes/Configuration - Setting attributes - Validation.php deleted file mode 100644 index 008d2b7b9..000000000 --- a/manual/codes/Configuration - Setting attributes - Validation.php +++ /dev/null @@ -1,5 +0,0 @@ -setAttribute(Doctrine::ATTR_VLD, true); -?> diff --git a/manual/codes/Connection management - Connection-component binding.php b/manual/codes/Connection management - Connection-component binding.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection management - Lazy-connecting to database.php b/manual/codes/Connection management - Lazy-connecting to database.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection management - Managing connections.php b/manual/codes/Connection management - Managing connections.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection management - Opening a new connection.php b/manual/codes/Connection management - Opening a new connection.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - DataDict - Getting database declaration.php b/manual/codes/Connection modules - DataDict - Getting database declaration.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - DataDict - Getting portable type.php b/manual/codes/Connection modules - DataDict - Getting portable type.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - DataDict - Reserved keywords.php b/manual/codes/Connection modules - DataDict - Reserved keywords.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - Export - Altering table.php b/manual/codes/Connection modules - Export - Altering table.php deleted file mode 100644 index 4533b6661..000000000 --- a/manual/codes/Connection modules - Export - Altering table.php +++ /dev/null @@ -1,39 +0,0 @@ - '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' => 'text', - 'length' => 20 - ) - ) - ), - 'rename' => array( - 'sex' => array( - 'name' => 'gender', - 'definition' => array( - 'type' => 'text', - 'length' => 1, - 'default' => 'M' - ) - ) - ) - - ); - -$dbh = new PDO('dsn','username','pw'); -$conn = Doctrine_Manager::getInstance()->openConnection($dbh); - -$conn->export->alterTable('mytable', $a); -?> diff --git a/manual/codes/Connection modules - Export - Creating new table.php b/manual/codes/Connection modules - Export - Creating new table.php deleted file mode 100644 index 9632ea4f2..000000000 --- a/manual/codes/Connection modules - Export - Creating new table.php +++ /dev/null @@ -1,22 +0,0 @@ -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/codes/Connection modules - Export - Introduction.php b/manual/codes/Connection modules - Export - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - Import - Getting foreign key info.php b/manual/codes/Connection modules - Import - Getting foreign key info.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - Import - Getting table info.php b/manual/codes/Connection modules - Import - Getting table info.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - Import - Getting view info.php b/manual/codes/Connection modules - Import - Getting view info.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - Import - Introduction.php b/manual/codes/Connection modules - Import - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Connection modules - Util - Using explain.php b/manual/codes/Connection modules - Util - Using explain.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - BNF.php b/manual/codes/DQL (Doctrine Query Language) - BNF.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php deleted file mode 100644 index 48eac3fca..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php +++ /dev/null @@ -1,14 +0,0 @@ -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%')); -?> diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php deleted file mode 100644 index 7312d7452..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php +++ /dev/null @@ -1,8 +0,0 @@ -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%'"); -?> diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Literals.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Literals.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php b/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php deleted file mode 100644 index e9ddef1da..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php +++ /dev/null @@ -1,19 +0,0 @@ -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/codes/DQL (Doctrine Query Language) - DELETE queries.php b/manual/codes/DQL (Doctrine Query Language) - DELETE queries.php deleted file mode 100644 index a2a2398f0..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - DELETE queries.php +++ /dev/null @@ -1,16 +0,0 @@ - ?'; - -$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/codes/DQL (Doctrine Query Language) - Examples.php b/manual/codes/DQL (Doctrine Query Language) - Examples.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - FROM clause.php b/manual/codes/DQL (Doctrine Query Language) - FROM clause.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic Functions.php b/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic Functions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php b/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Datetime Functions.php b/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - Datetime Functions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - String Functions.php b/manual/codes/DQL (Doctrine Query Language) - Functional Expressions - String Functions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Functions - Contains.php b/manual/codes/DQL (Doctrine Query Language) - Functions - Contains.php deleted file mode 100644 index 126a7c0c4..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - Functions - Contains.php +++ /dev/null @@ -1,7 +0,0 @@ -from('User')->where('User.Phonenumber.phonenumber.contains(?,?,?)'); - -$users = $q->execute(array('123 123 123', '0400 999 999', '+358 100 100')); -?> diff --git a/manual/codes/DQL (Doctrine Query Language) - Functions - Like.php b/manual/codes/DQL (Doctrine Query Language) - Functions - Like.php deleted file mode 100644 index 873fd47bc..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - Functions - Like.php +++ /dev/null @@ -1,7 +0,0 @@ -from('User')->where('User.Phonenumber.phonenumber.like(?,?)'); - -$users = $q->execute(array('%123%', '456%')); -?> diff --git a/manual/codes/DQL (Doctrine Query Language) - Functions - Regexp.php b/manual/codes/DQL (Doctrine Query Language) - Functions - Regexp.php deleted file mode 100644 index 6739d6a5f..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - Functions - Regexp.php +++ /dev/null @@ -1,7 +0,0 @@ -from('User')->where('User.Phonenumber.phonenumber.regexp(?,?)'); - -$users = $q->execute(array('[123]', '^[3-5]')); -?> diff --git a/manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php b/manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php deleted file mode 100644 index aac784d6a..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php +++ /dev/null @@ -1,10 +0,0 @@ -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/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING.php b/manual/codes/DQL (Doctrine Query Language) - GROUP BY, HAVING.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Introduction.php b/manual/codes/DQL (Doctrine Query Language) - Introduction.php deleted file mode 100644 index 223c0a623..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - Introduction.php +++ /dev/null @@ -1,26 +0,0 @@ -getTable('User')->findAll(); - -foreach($users as $user) { - print $user->name."
"; - foreach($user->Phonenumber as $phonenumber) { - print $phonenumber."
"; - } -} - -// same thing implemented much more efficiently: -// (using only one sql query for object population) - -$users = $conn->query("FROM User.Phonenumber"); - -foreach($users as $user) { - print $user->name."
"; - foreach($user->Phonenumber as $phonenumber) { - print $phonenumber."
"; - } -} - -?> diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php deleted file mode 100644 index b9dc2e986..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php +++ /dev/null @@ -1,14 +0,0 @@ -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'; - } -} -?> diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - ORDER BY clause.php b/manual/codes/DQL (Doctrine Query Language) - ORDER BY clause.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - ORDER BY.php b/manual/codes/DQL (Doctrine Query Language) - ORDER BY.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - Operators - Logical operators.php b/manual/codes/DQL (Doctrine Query Language) - Operators - Logical operators.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php b/manual/codes/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php deleted file mode 100644 index 052101363..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php +++ /dev/null @@ -1,14 +0,0 @@ -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/codes/DQL (Doctrine Query Language) - SELECT queries.php b/manual/codes/DQL (Doctrine Query Language) - SELECT queries.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/DQL (Doctrine Query Language) - UPDATE queries.php b/manual/codes/DQL (Doctrine Query Language) - UPDATE queries.php deleted file mode 100644 index 0deaeff90..000000000 --- a/manual/codes/DQL (Doctrine Query Language) - UPDATE queries.php +++ /dev/null @@ -1,16 +0,0 @@ - 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/codes/DQL (Doctrine Query Language) - WHERE clause.php b/manual/codes/DQL (Doctrine Query Language) - WHERE clause.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Drivers - Mysql - Tips and tricks.php b/manual/codes/Drivers - Mysql - Tips and tricks.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Drivers - Oracle - Making unsuported functions work.php b/manual/codes/Drivers - Oracle - Making unsuported functions work.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Functions - Contains.php b/manual/codes/Functions - Contains.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Functions - Like.php b/manual/codes/Functions - Like.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Functions - Regexp.php b/manual/codes/Functions - Regexp.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Compiling.php b/manual/codes/Getting started - Compiling.php deleted file mode 100644 index 4e25e99ec..000000000 --- a/manual/codes/Getting started - Compiling.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/manual/codes/Getting started - Data types - Array.php b/manual/codes/Getting started - Data types - Array.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Blob.php b/manual/codes/Getting started - Data types - Blob.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Boolean.php b/manual/codes/Getting started - Data types - Boolean.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Clob.php b/manual/codes/Getting started - Data types - Clob.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Date.php b/manual/codes/Getting started - Data types - Date.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Enum.php b/manual/codes/Getting started - Data types - Enum.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Float.php b/manual/codes/Getting started - Data types - Float.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Gzip.php b/manual/codes/Getting started - Data types - Gzip.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Integer.php b/manual/codes/Getting started - Data types - Integer.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Object.php b/manual/codes/Getting started - Data types - Object.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - String.php b/manual/codes/Getting started - Data types - String.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Data types - Timestamp.php b/manual/codes/Getting started - Data types - Timestamp.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Requirements.php b/manual/codes/Getting started - Requirements.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Setting table definition - Constraints and validators.php b/manual/codes/Getting started - Setting table definition - Constraints and validators.php deleted file mode 100644 index 77e8b11b8..000000000 --- a/manual/codes/Getting started - Setting table definition - Constraints and validators.php +++ /dev/null @@ -1,15 +0,0 @@ -hasColumn("name", "string", 50, array("nospace" => true)); - - // the email should be a valid email - $this->hasColumn("email", "string", 200, array("email" => true)); - - // home_country should be a valid country code and not null - $this->hasColumn("home_country", "string", 2, array("country" => true, "notnull" => true)); - - } -} -?> diff --git a/manual/codes/Getting started - Setting table definition - Data types and lengths.php b/manual/codes/Getting started - Setting table definition - Data types and lengths.php deleted file mode 100644 index 89fbc5267..000000000 --- a/manual/codes/Getting started - Setting table definition - Data types and lengths.php +++ /dev/null @@ -1,27 +0,0 @@ -hasColumn("title","string",100); - - // maps into TEXT on mysql - $this->hasColumn("content","string",4000); - - // maps into TINYINT on mysql - $this->hasColumn("type","integer",1); - - // maps into INT on mysql - $this->hasColumn("type2","integer",11); - - // maps into BIGINT on mysql - $this->hasColumn("type3","integer",20); - - // maps into TEXT on mysql - // (serialized and unserialized automatically by doctrine) - $this->hasColumn("types","array",4000); - - } -} -?> diff --git a/manual/codes/Getting started - Setting table definition - Default values.php b/manual/codes/Getting started - Setting table definition - Default values.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Getting started - Setting table definition - Enum emulation.php b/manual/codes/Getting started - Setting table definition - Enum emulation.php deleted file mode 100644 index 98bf3d838..000000000 --- a/manual/codes/Getting started - Setting table definition - Enum emulation.php +++ /dev/null @@ -1,19 +0,0 @@ -hasColumn("title","string", 200); - - // maps to TINYINT on mysql - $this->hasColumn("section", "enum", 2, array('values' => array("PHP","Python","Java","Ruby"))); - } -} -$article = new Article; -$article->title = 'My first php article'; -// doctrine auto-converts the section to integer when the -// record is being saved -$article->section = 'PHP'; -$article->save(); - -// on insert query with values 'My first php article' and 0 -// would be issued -?> diff --git a/manual/codes/Getting started - Setting table definition - Table options.php b/manual/codes/Getting started - Setting table definition - Table options.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Hierarchical data - Adjacency list - Introduction.php b/manual/codes/Hierarchical data - Adjacency list - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Hierarchical data - Introduction.php b/manual/codes/Hierarchical data - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Hierarchical data - Materialized path - Introduction.php b/manual/codes/Hierarchical data - Materialized path - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Hierarchical data - Nested set - Introduction.php b/manual/codes/Hierarchical data - Nested set - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Hierarchical data - NestedSet - Introduction.php b/manual/codes/Hierarchical data - NestedSet - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Native SQL - Component queries.php b/manual/codes/Native SQL - Component queries.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Native SQL - Fetching multiple components.php b/manual/codes/Native SQL - Fetching multiple components.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Native SQL - Scalar queries.php b/manual/codes/Native SQL - Scalar queries.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Columns - Column aliases.php b/manual/codes/Object relational mapping - Columns - Column aliases.php deleted file mode 100644 index 0ced54cc6..000000000 --- a/manual/codes/Object relational mapping - Columns - Column aliases.php +++ /dev/null @@ -1,12 +0,0 @@ -hasColumn('bookName as name', 'string'); - } -} -$book = new Book(); -$book->name = 'Some book'; -$book->save(); -?> diff --git a/manual/codes/Object relational mapping - Columns - Column naming.php b/manual/codes/Object relational mapping - Columns - Column naming.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Columns - Data types - Array.php b/manual/codes/Object relational mapping - Columns - Data types - Array.php deleted file mode 100644 index f6446c774..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Array.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('arraytest', 'array', 10000); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Blob.php b/manual/codes/Object relational mapping - Columns - Data types - Blob.php deleted file mode 100644 index c20257a73..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Blob.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('blobtest', 'blob'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Boolean.php b/manual/codes/Object relational mapping - Columns - Data types - Boolean.php deleted file mode 100644 index 1f0ab9cd2..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Boolean.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('booltest', 'boolean'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Clob.php b/manual/codes/Object relational mapping - Columns - Data types - Clob.php deleted file mode 100644 index d25420d08..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Clob.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('clobtest', 'clob'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Date.php b/manual/codes/Object relational mapping - Columns - Data types - Date.php deleted file mode 100644 index 50bcca1e4..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Date.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('datetest', 'date'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Enum.php b/manual/codes/Object relational mapping - Columns - Data types - Enum.php deleted file mode 100644 index 384a50dee..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Enum.php +++ /dev/null @@ -1,15 +0,0 @@ -hasColumn('enumtest', 'enum', 4, - array( - 'values' => array( - 'php', - 'java', - 'python' - ) - ) - ); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Float.php b/manual/codes/Object relational mapping - Columns - Data types - Float.php deleted file mode 100644 index bd12c57a1..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Float.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('floattest', 'float'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Gzip.php b/manual/codes/Object relational mapping - Columns - Data types - Gzip.php deleted file mode 100644 index aaf1a0a17..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Gzip.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('gziptest', 'gzip'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Integer.php b/manual/codes/Object relational mapping - Columns - Data types - Integer.php deleted file mode 100644 index 1fcf5aa97..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Integer.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('integertest', 'integer', 4, array('unsigned' => true)); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Introduction.php b/manual/codes/Object relational mapping - Columns - Data types - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Columns - Data types - Object.php b/manual/codes/Object relational mapping - Columns - Data types - Object.php deleted file mode 100644 index 641815133..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Object.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('objecttest', 'object'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - String.php b/manual/codes/Object relational mapping - Columns - Data types - String.php deleted file mode 100644 index 5e53f6a06..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - String.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('stringtest', 'string', 200, array('fixed' => true)); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Time.php b/manual/codes/Object relational mapping - Columns - Data types - Time.php deleted file mode 100644 index fc69af27a..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Time.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('timetest', 'time'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Timestamp.php b/manual/codes/Object relational mapping - Columns - Data types - Timestamp.php deleted file mode 100644 index bd069ab91..000000000 --- a/manual/codes/Object relational mapping - Columns - Data types - Timestamp.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('timestamptest', 'timestamp'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Columns - Data types - Type modifiers.php b/manual/codes/Object relational mapping - Columns - Data types - Type modifiers.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Record identifiers - Autoincremented.php b/manual/codes/Object relational mapping - Record identifiers - Autoincremented.php deleted file mode 100644 index d1c007033..000000000 --- a/manual/codes/Object relational mapping - Record identifiers - Autoincremented.php +++ /dev/null @@ -1,8 +0,0 @@ -hasColumn('uid','integer',20,'primary|autoincrement'); - - } -} -?> diff --git a/manual/codes/Object relational mapping - Record identifiers - Composite.php b/manual/codes/Object relational mapping - Record identifiers - Composite.php deleted file mode 100644 index db653bfd5..000000000 --- a/manual/codes/Object relational mapping - Record identifiers - Composite.php +++ /dev/null @@ -1,8 +0,0 @@ -hasColumn('user_id', 'integer', 20, 'primary'); - $this->hasColumn('group_id', 'integer', 20, 'primary'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Record identifiers - Introduction.php b/manual/codes/Object relational mapping - Record identifiers - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Record identifiers - Natural.php b/manual/codes/Object relational mapping - Record identifiers - Natural.php deleted file mode 100644 index 2eaccf222..000000000 --- a/manual/codes/Object relational mapping - Record identifiers - Natural.php +++ /dev/null @@ -1,7 +0,0 @@ -hasColumn('name','string',200,'primary'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Record identifiers - Sequence.php b/manual/codes/Object relational mapping - Record identifiers - Sequence.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Record identifiers - Sequential.php b/manual/codes/Object relational mapping - Record identifiers - Sequential.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Relations - Composites and aggregates.php b/manual/codes/Object relational mapping - Relations - Composites and aggregates.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php b/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php deleted file mode 100644 index 7b8908c2d..000000000 --- a/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php +++ /dev/null @@ -1,18 +0,0 @@ -ownsMany('Phonenumber','Phonenumber.user_id'); - } - public function setTableDefition() { - $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'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-One.php b/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-One.php deleted file mode 100644 index 23703b19c..000000000 --- a/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-One.php +++ /dev/null @@ -1,28 +0,0 @@ -hasOne('Address','Address.user_id'); - $this->ownsOne('Email','User.email_id'); - $this->ownsMany('Phonenumber','Phonenumber.user_id'); - } - public function setTableDefition() { - $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'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Relations - Foreign key associations - Tree structure.php b/manual/codes/Object relational mapping - Relations - Foreign key associations - Tree structure.php deleted file mode 100644 index 768bbb663..000000000 --- a/manual/codes/Object relational mapping - Relations - Foreign key associations - Tree structure.php +++ /dev/null @@ -1,12 +0,0 @@ -hasOne('Task as Parent','Task.parent_id'); - $this->hasMany('Task as Subtask','Subtask.parent_id'); - } - public function setTableDefinition() { - $this->hasColumn('name','string',100); - $this->hasColumn('parent_id','integer'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Relations - Inheritance - One table many classes.php b/manual/codes/Object relational mapping - Relations - Inheritance - One table many classes.php deleted file mode 100644 index f7911739a..000000000 --- a/manual/codes/Object relational mapping - Relations - Inheritance - One table many classes.php +++ /dev/null @@ -1,14 +0,0 @@ -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 { } -?> diff --git a/manual/codes/Object relational mapping - Relations - Inheritance - One table one class.php b/manual/codes/Object relational mapping - Relations - Inheritance - One table one class.php deleted file mode 100644 index 7f1895f10..000000000 --- a/manual/codes/Object relational mapping - Relations - Inheritance - One table one class.php +++ /dev/null @@ -1,26 +0,0 @@ -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(); - } -} -?> diff --git a/manual/codes/Object relational mapping - Relations - Introduction.php b/manual/codes/Object relational mapping - Relations - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Relations - Join table associations - Many-to-Many.php b/manual/codes/Object relational mapping - Relations - Join table associations - Many-to-Many.php deleted file mode 100644 index 8593fa7d0..000000000 --- a/manual/codes/Object relational mapping - Relations - Join table associations - Many-to-Many.php +++ /dev/null @@ -1,54 +0,0 @@ -hasMany('Group','Groupuser.group_id'); - } - public function setTableDefinition() { - $this->hasColumn('name','string',30); - } -} - -class Group extends Doctrine_Record { - public function setUp() { - $this->hasMany('User','Groupuser.user_id'); - } - public function setTableDefinition() { - $this->hasColumn('name','string',30); - } -} - -class Groupuser extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('user_id','integer'); - $this->hasColumn('group_id','integer'); - } -} - - -$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' - -?> diff --git a/manual/codes/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php b/manual/codes/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Relations - Join table associations - One-to-One.php b/manual/codes/Object relational mapping - Relations - Join table associations - One-to-One.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Object relational mapping - Relations - Join table associations - Self-referencing.php b/manual/codes/Object relational mapping - Relations - Join table associations - Self-referencing.php deleted file mode 100644 index 3a441dcda..000000000 --- a/manual/codes/Object relational mapping - Relations - Join table associations - Self-referencing.php +++ /dev/null @@ -1,16 +0,0 @@ -hasMany('User as Friend','UserReference.user_id-user_id2'); - } - public function setTableDefinition() { - $this->hasColumn('name','string',30); - } -} -class UserReference extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn('user_id','integer'); - $this->hasColumn('user_id2','integer'); - } -} -?> diff --git a/manual/codes/Object relational mapping - Relations - Relation aliases.php b/manual/codes/Object relational mapping - Relations - Relation aliases.php deleted file mode 100644 index 52cfb981d..000000000 --- a/manual/codes/Object relational mapping - Relations - Relation aliases.php +++ /dev/null @@ -1,26 +0,0 @@ -hasColumn('name', 'string', 100); - $this->hasColumn('description', 'string', 5000); - } - public function setUp() { - // notice the 'as' keyword here - $this->ownsMany('Forum_Thread as Threads', 'Forum_Thread.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', 'Forum_Thread.board_id'); - } -} -$board = new Board(); -$board->Threads[0]->updated = time(); -?> diff --git a/manual/codes/Object relational mapping - Table and class naming.php b/manual/codes/Object relational mapping - Table and class naming.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Operators - Logical operators.php b/manual/codes/Operators - Logical operators.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Real world examples - Album lister.php b/manual/codes/Real world examples - Album lister.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Real world examples - Forum application.php b/manual/codes/Real world examples - Forum application.php deleted file mode 100644 index dbe0fe77e..000000000 --- a/manual/codes/Real world examples - Forum application.php +++ /dev/null @@ -1,52 +0,0 @@ -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/codes/Real world examples - User management system.php b/manual/codes/Real world examples - User management system.php deleted file mode 100644 index d0f8eb853..000000000 --- a/manual/codes/Real world examples - User management system.php +++ /dev/null @@ -1,78 +0,0 @@ -ownsOne("Email","Entity.email_id"); - $this->ownsMany("Phonenumber","Phonenumber.entity_id"); - $this->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_BATCH); - $this->setAttribute(Doctrine::ATTR_LISTENER,new EntityListener()); - } - public function setTableDefinition() { - $this->hasColumn("name","string",50); - $this->hasColumn("loginname","string",20); - $this->hasColumn("password","string",16); - $this->hasColumn("type","integer",1); - $this->hasColumn("created","integer",11); - $this->hasColumn("updated","integer",11); - $this->hasColumn("email_id","integer"); - } -} -class Group extends Entity { - public function setUp() { - parent::setUp(); - $this->hasMany("User","Groupuser.user_id"); - $this->setInheritanceMap(array("type"=>1)); - } -} -class User extends Entity { - public function setUp() { - parent::setUp(); - $this->hasMany("Group","Groupuser.group_id"); - $this->setInheritanceMap(array("type"=>0)); - } -} -class Groupuser extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn("group_id","integer"); - $this->hasColumn("user_id","integer"); - } -} - -class Phonenumber extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn("phonenumber","string",20); - $this->hasColumn("entity_id","integer"); - } -} -class Email extends Doctrine_Record { - public function setTableDefinition() { - $this->hasColumn("address","string",150,"email|unique"); - } -} -class EntityListener extends Doctrine_EventListener { - public function onPreUpdate(Doctrine_Record $record) { - $record->updated = time(); - } - public function onPreInsert(Doctrine_Record $record) { - $record->created = time(); - } -} - -// USER MANAGEMENT SYSTEM IN ACTION: - -$manager = Doctrine_Manager::getInstance(); - -$conn = $manager->openConnection(new PDO("DSN","username","password")); - -$user = new User(); - -$user->name = "Jack Daniels"; -$user->Email->address = "jackdaniels@drinkmore.info"; -$user->Phonenumber[0]->phonenumber = "123 123"; -$user->Phonenumber[1]->phonenumber = "133 133"; -$user->save(); - -$user->Group[0]->name = "beer lovers"; -$user->Group[0]->Email->address = "beerlovers@drinkmore.info"; -$user->Group[0]->save(); - -?> diff --git a/manual/codes/Runtime classes - Doctrine_Record.php b/manual/codes/Runtime classes - Doctrine_Record.php deleted file mode 100644 index 0264a5ccf..000000000 --- a/manual/codes/Runtime classes - Doctrine_Record.php +++ /dev/null @@ -1,40 +0,0 @@ -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/codes/Runtime classes - Doctrine_Session.php b/manual/codes/Runtime classes - Doctrine_Session.php deleted file mode 100644 index dccfa2d05..000000000 --- a/manual/codes/Runtime classes - Doctrine_Session.php +++ /dev/null @@ -1,30 +0,0 @@ -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/codes/Technology - Architecture.php b/manual/codes/Technology - Architecture.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Technology - Design patterns used.php b/manual/codes/Technology - Design patterns used.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Technology - Internal optimizations - DELETE.php b/manual/codes/Technology - Internal optimizations - DELETE.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Technology - Internal optimizations - INSERT.php b/manual/codes/Technology - Internal optimizations - INSERT.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Technology - Internal optimizations - UPDATE.php b/manual/codes/Technology - Internal optimizations - UPDATE.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Technology - Speed.php b/manual/codes/Technology - Speed.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Transactions - Deadlocks.php b/manual/codes/Transactions - Deadlocks.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Transactions - Introduction.php b/manual/codes/Transactions - Introduction.php deleted file mode 100644 index 1d03edd11..000000000 --- a/manual/codes/Transactions - Introduction.php +++ /dev/null @@ -1,13 +0,0 @@ -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/codes/Transactions - Isolation levels.php b/manual/codes/Transactions - Isolation levels.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Transactions - Lock modes.php b/manual/codes/Transactions - Lock modes.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Transactions - Locking strategies - Optimistic locking.php b/manual/codes/Transactions - Locking strategies - Optimistic locking.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Transactions - Locking strategies - Pessimistic locking.php b/manual/codes/Transactions - Locking strategies - Pessimistic locking.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Transactions - Nesting.php b/manual/codes/Transactions - Nesting.php deleted file mode 100644 index 405831c5f..000000000 --- a/manual/codes/Transactions - Nesting.php +++ /dev/null @@ -1,23 +0,0 @@ -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/codes/Transactions - Savepoints.php b/manual/codes/Transactions - Savepoints.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Transactions - Unit of work.php b/manual/codes/Transactions - Unit of work.php deleted file mode 100644 index dd2acb22d..000000000 --- a/manual/codes/Transactions - Unit of work.php +++ /dev/null @@ -1,18 +0,0 @@ -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/codes/Working with objects - Component overview - Collection - Accessing elements.php b/manual/codes/Working with objects - Component overview - Collection - Accessing elements.php deleted file mode 100644 index b6d08a5bb..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Accessing elements.php +++ /dev/null @@ -1,15 +0,0 @@ -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; -?> diff --git a/manual/codes/Working with objects - Component overview - Collection - Adding new elements.php b/manual/codes/Working with objects - Component overview - Collection - Adding new elements.php deleted file mode 100644 index dec8c7693..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Adding new elements.php +++ /dev/null @@ -1,8 +0,0 @@ -findAll(); - -print count($users); // 5 - -$users[5]->name = "new user 1"; -$users[6]->name = "new user 2"; -?> diff --git a/manual/codes/Working with objects - Component overview - Collection - Collection expanding.php b/manual/codes/Working with objects - Component overview - Collection - Collection expanding.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Collection - Deleting collection.php b/manual/codes/Working with objects - Component overview - Collection - Deleting collection.php deleted file mode 100644 index 125cfba6a..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Deleting collection.php +++ /dev/null @@ -1,7 +0,0 @@ -findByDql("name LIKE '%John%'"); - -$users->delete(); -?> diff --git a/manual/codes/Working with objects - Component overview - Collection - Fetching strategies.php b/manual/codes/Working with objects - Component overview - Collection - Fetching strategies.php deleted file mode 100644 index d36911490..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Fetching strategies.php +++ /dev/null @@ -1,52 +0,0 @@ -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/codes/Working with objects - Component overview - Collection - Getting collection count.php b/manual/codes/Working with objects - Component overview - Collection - Getting collection count.php deleted file mode 100644 index a2e88a5d1..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Getting collection count.php +++ /dev/null @@ -1,9 +0,0 @@ -findAll(); - -$users->count(); - -// or - -count($users); // Doctrine_Collection implements Countable interface -?> diff --git a/manual/codes/Working with objects - Component overview - Collection - Introduction.php b/manual/codes/Working with objects - Component overview - Collection - Introduction.php deleted file mode 100644 index edb2c33e9..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Introduction.php +++ /dev/null @@ -1,18 +0,0 @@ -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 -$coll[0]->name = 'Arnold'; - -$coll[1]->name = 'Somebody'; - -// finally save it! -$coll->save(); -?> diff --git a/manual/codes/Working with objects - Component overview - Collection - Key mapping.php b/manual/codes/Working with objects - Component overview - Collection - Key mapping.php deleted file mode 100644 index c2081f544..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Key mapping.php +++ /dev/null @@ -1,31 +0,0 @@ -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; -} -?> diff --git a/manual/codes/Working with objects - Component overview - Collection - Loading related records.php b/manual/codes/Working with objects - Component overview - Collection - Loading related records.php deleted file mode 100644 index 4407e7240..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Loading related records.php +++ /dev/null @@ -1,20 +0,0 @@ -query("FROM User"); - -// now lets load phonenumbers for all users - -$users->loadRelated("Phonenumber"); - -foreach($users as $user) { - print $user->Phonenumber->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->name; -} -?> diff --git a/manual/codes/Working with objects - Component overview - Collection - Saving the collection.php b/manual/codes/Working with objects - Component overview - Collection - Saving the collection.php deleted file mode 100644 index 7ef541270..000000000 --- a/manual/codes/Working with objects - Component overview - Collection - Saving the collection.php +++ /dev/null @@ -1,9 +0,0 @@ -findAll(); - -$users[0]->name = "Jack Daniels"; - -$users[1]->name = "John Locke"; - -$users->save(); -?> diff --git a/manual/codes/Working with objects - Component overview - Connection - Available drivers.php b/manual/codes/Working with objects - Component overview - Connection - Available drivers.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Connection - Availible drivers.php b/manual/codes/Working with objects - Component overview - Connection - Availible drivers.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Connection - Flushing the connection.php b/manual/codes/Working with objects - Component overview - Connection - Flushing the connection.php deleted file mode 100644 index f5f99e967..000000000 --- a/manual/codes/Working with objects - Component overview - Connection - Flushing the connection.php +++ /dev/null @@ -1,11 +0,0 @@ -name = 'Jack'; - -$group = $conn->create('Group'); -$group->name = 'Drinking Club'; - -// saves all the changed objects into database - -$conn->flush(); -?> diff --git a/manual/codes/Working with objects - Component overview - Connection - Getting a table object.php b/manual/codes/Working with objects - Component overview - Connection - Getting a table object.php deleted file mode 100644 index ea9e6e48e..000000000 --- a/manual/codes/Working with objects - Component overview - Connection - Getting a table object.php +++ /dev/null @@ -1,11 +0,0 @@ -openConnection(new PDO('dsn','username','password')); - -// getting a table object - -$table = $conn->getTable('User'); -?> diff --git a/manual/codes/Working with objects - Component overview - Connection - Getting connection state.php b/manual/codes/Working with objects - Component overview - Connection - Getting connection state.php deleted file mode 100644 index 42b184b3c..000000000 --- a/manual/codes/Working with objects - Component overview - Connection - Getting connection state.php +++ /dev/null @@ -1,16 +0,0 @@ -getState()): - case Doctrine_Connection::STATE_ACTIVE: - // connection open and zero open transactions - break; - case Doctrine_Connection::STATE_ACTIVE: - // one open transaction - break; - case Doctrine_Connection::STATE_BUSY: - // multiple open transactions - break; - case Doctrine_Connection::STATE_CLOSED: - // connection closed - break; -endswitch; -?> diff --git a/manual/codes/Working with objects - Component overview - Connection - Querying the database.php b/manual/codes/Working with objects - Component overview - Connection - Querying the database.php deleted file mode 100644 index 531c6fdce..000000000 --- a/manual/codes/Working with objects - Component overview - Connection - Querying the database.php +++ /dev/null @@ -1,14 +0,0 @@ -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')); -?> diff --git a/manual/codes/Working with objects - Component overview - Db - Chaining listeners.php b/manual/codes/Working with objects - Component overview - Db - Chaining listeners.php deleted file mode 100644 index 3f3d7de5a..000000000 --- a/manual/codes/Working with objects - Component overview - Db - Chaining listeners.php +++ /dev/null @@ -1,34 +0,0 @@ -queries++; - } - public function count() { - return count($this->queries); - } -} -class OutputLogger extends Doctrine_Overloadable { - public function __call($m, $a) { - print $m." called!"; - } -} -$counter = new Counter(); - -$dbh->addListener($counter); -$dbh->addListener(new OutputLogger()); - -$dbh->query("SELECT * FROM foo"); -// prints: -// onPreQuery called! -// onQuery called! - -print $counter->count(); // 1 - -?> diff --git a/manual/codes/Working with objects - Component overview - Db - Connecting to a database.php b/manual/codes/Working with objects - Component overview - Db - Connecting to a database.php deleted file mode 100644 index d3f5a12fa..000000000 --- a/manual/codes/Working with objects - Component overview - Db - Connecting to a database.php +++ /dev/null @@ -1 +0,0 @@ - diff --git a/manual/codes/Working with objects - Component overview - Db - Introduction.php b/manual/codes/Working with objects - Component overview - Db - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Db - Using event listeners.php b/manual/codes/Working with objects - Component overview - Db - Using event listeners.php deleted file mode 100644 index 43ef6a141..000000000 --- a/manual/codes/Working with objects - Component overview - Db - Using event listeners.php +++ /dev/null @@ -1,36 +0,0 @@ -getQuery(); - } -} - -$dbh->setListener(new MyLogger()); - -$dbh->query("SELECT * FROM foo"); -// prints: -// database is going to be queried -// executed: SELECT * FROM foo - - -class MyLogger2 extends Doctrine_Overloadable { - public function __call($m, $a) { - print $m." called!"; - } -} - -$dbh->setListener(new MyLogger2()); - -$dbh->exec("DELETE FROM foo"); -// prints: -// onPreExec called! -// onExec called! -?> diff --git a/manual/codes/Working with objects - Component overview - Exceptions - List of exceptions.php b/manual/codes/Working with objects - Component overview - Exceptions - List of exceptions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Exceptions - Overview.php b/manual/codes/Working with objects - Component overview - Exceptions - Overview.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Manager - Introduction.php b/manual/codes/Working with objects - Component overview - Manager - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Manager - Managing connections.php b/manual/codes/Working with objects - Component overview - Manager - Managing connections.php deleted file mode 100644 index 80e1a920f..000000000 --- a/manual/codes/Working with objects - Component overview - Manager - Managing connections.php +++ /dev/null @@ -1,25 +0,0 @@ -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/codes/Working with objects - Component overview - Manager - Opening a new connection.php b/manual/codes/Working with objects - Component overview - Manager - Opening a new connection.php deleted file mode 100644 index 98f417c46..000000000 --- a/manual/codes/Working with objects - Component overview - Manager - Opening a new connection.php +++ /dev/null @@ -1,18 +0,0 @@ -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(); -?> diff --git a/manual/codes/Working with objects - Component overview - Query - Aggregate functions.php b/manual/codes/Working with objects - Component overview - Query - Aggregate functions.php deleted file mode 100644 index 52af72495..000000000 --- a/manual/codes/Working with objects - Component overview - Query - Aggregate functions.php +++ /dev/null @@ -1,15 +0,0 @@ -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/codes/Working with objects - Component overview - Query - Bound parameters.php b/manual/codes/Working with objects - Component overview - Query - Bound parameters.php deleted file mode 100644 index 9bb9a97af..000000000 --- a/manual/codes/Working with objects - Component overview - Query - Bound parameters.php +++ /dev/null @@ -1,6 +0,0 @@ -from("User") - ->where("User.name = ?"); - -$query->execute(array('Jack Daniels')); -?> diff --git a/manual/codes/Working with objects - Component overview - Query - DQL - SQL conversion.php b/manual/codes/Working with objects - Component overview - Query - DQL - SQL conversion.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Query - FROM - selecting tables.php b/manual/codes/Working with objects - Component overview - Query - FROM - selecting tables.php deleted file mode 100644 index 484a24f09..000000000 --- a/manual/codes/Working with objects - Component overview - Query - FROM - selecting tables.php +++ /dev/null @@ -1,24 +0,0 @@ -from("FROM Group"); - -// find all users and user emails - -$coll = $q->from("FROM User u LEFT JOIN u.Email e"); - -// find all users and user emails with only user name and -// age + email address loaded - -$coll = $q->select('u.name, u.age, e.address') - ->from('FROM User u') - ->leftJoin('u.Email e') - ->execute(); - -// find all users, user email and user phonenumbers - -$coll = $q->from('FROM User u') - ->innerJoin('u.Email e') - ->innerJoin('u.Phonenumber p') - ->execute(); -?> diff --git a/manual/codes/Working with objects - Component overview - Query - HAVING conditions.php b/manual/codes/Working with objects - Component overview - Query - HAVING conditions.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Query - Introduction.php b/manual/codes/Working with objects - Component overview - Query - Introduction.php deleted file mode 100644 index 218466fa7..000000000 --- a/manual/codes/Working with objects - Component overview - Query - Introduction.php +++ /dev/null @@ -1,12 +0,0 @@ -from('User')->execute(); -?> diff --git a/manual/codes/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php b/manual/codes/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php deleted file mode 100644 index 5b94b58ec..000000000 --- a/manual/codes/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php +++ /dev/null @@ -1,13 +0,0 @@ -from('User u LEFT JOIN u.Email e')->limit(10); - -// find the first ten users starting from the user number 5 - -$coll = $q->from('User u')->limit(10)->offset(5); - -?> diff --git a/manual/codes/Working with objects - Component overview - Query - Method overloading.php b/manual/codes/Working with objects - Component overview - Query - Method overloading.php deleted file mode 100644 index d9aae392d..000000000 --- a/manual/codes/Working with objects - Component overview - Query - Method overloading.php +++ /dev/null @@ -1,20 +0,0 @@ -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/codes/Working with objects - Component overview - Query - ORDER BY - sorting query results.php b/manual/codes/Working with objects - Component overview - Query - ORDER BY - sorting query results.php deleted file mode 100644 index beaa5e092..000000000 --- a/manual/codes/Working with objects - Component overview - Query - ORDER BY - sorting query results.php +++ /dev/null @@ -1,20 +0,0 @@ -from('User u')->orderby('u.name DESC'); - -// find all users sort by name ascending - -$users = $q->from('User u')->orderby('u.name ASC'); - -// find all users and their emails, sort by email address in ascending order - -$users = $q->from('User u')->leftJoin('u.Email e')->orderby('e.address'); - -// find all users and their emails, sort by user name and email address - -$users = $q->from('User u')->leftJoin('u.Email e') - ->addOrderby('u.name')->addOrderby('e.address'); -?> diff --git a/manual/codes/Working with objects - Component overview - Query - Relation operators.php b/manual/codes/Working with objects - Component overview - Query - Relation operators.php deleted file mode 100644 index a917daea4..000000000 --- a/manual/codes/Working with objects - Component overview - Query - Relation operators.php +++ /dev/null @@ -1,15 +0,0 @@ -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/codes/Working with objects - Component overview - Query - WHERE - setting query conditions.php b/manual/codes/Working with objects - Component overview - Query - WHERE - setting query conditions.php deleted file mode 100644 index d3f5a12fa..000000000 --- a/manual/codes/Working with objects - Component overview - Query - WHERE - setting query conditions.php +++ /dev/null @@ -1 +0,0 @@ - diff --git a/manual/codes/Working with objects - Component overview - RawSql - Adding components.php b/manual/codes/Working with objects - Component overview - RawSql - Adding components.php deleted file mode 100644 index be3f2ff44..000000000 --- a/manual/codes/Working with objects - Component overview - RawSql - Adding components.php +++ /dev/null @@ -1,13 +0,0 @@ -parseQuery("SELECT {entity.*}, {phonenumber.*} - FROM entity - LEFT JOIN phonenumber - ON phonenumber.entity_id = entity.id"); - -$query->addComponent("entity", "Entity"); -$query->addComponent("phonenumber", "Entity.Phonenumber"); - -$entities = $query->execute(); -?> diff --git a/manual/codes/Working with objects - Component overview - RawSql - Introduction.php b/manual/codes/Working with objects - Component overview - RawSql - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - RawSql - Method overloading.php b/manual/codes/Working with objects - Component overview - RawSql - Method overloading.php deleted file mode 100644 index e99f6f747..000000000 --- a/manual/codes/Working with objects - Component overview - RawSql - Method overloading.php +++ /dev/null @@ -1,10 +0,0 @@ -select('{entity.name}') - ->from('entity'); - -$query->addComponent("entity", "User"); - -$coll = $query->execute(); -?> diff --git a/manual/codes/Working with objects - Component overview - RawSql - Using SQL.php b/manual/codes/Working with objects - Component overview - RawSql - Using SQL.php deleted file mode 100644 index a409801f4..000000000 --- a/manual/codes/Working with objects - Component overview - RawSql - Using SQL.php +++ /dev/null @@ -1,7 +0,0 @@ -parseQuery("SELECT {entity.name} FROM entity"); - -$entities = $query->execute(); -?> diff --git a/manual/codes/Working with objects - Component overview - Record - Accessing properties.php b/manual/codes/Working with objects - Component overview - Record - Accessing properties.php deleted file mode 100644 index f02e1d2c7..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Accessing properties.php +++ /dev/null @@ -1,21 +0,0 @@ -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 through properties - -foreach($user as $key => $value) { - -} -?> diff --git a/manual/codes/Working with objects - Component overview - Record - Callbacks.php b/manual/codes/Working with objects - Component overview - Record - Callbacks.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Record - Checking existence.php b/manual/codes/Working with objects - Component overview - Record - Checking existence.php deleted file mode 100644 index 19b2d36c3..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Checking existence.php +++ /dev/null @@ -1,10 +0,0 @@ -exists(); // false - -$record->name = 'someone'; -$record->save(); - -$record->exists(); // true -?> diff --git a/manual/codes/Working with objects - Component overview - Record - Creating new records.php b/manual/codes/Working with objects - Component overview - Record - Creating new records.php deleted file mode 100644 index 182505abd..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Creating new records.php +++ /dev/null @@ -1,20 +0,0 @@ -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(); -?> diff --git a/manual/codes/Working with objects - Component overview - Record - Deleting records.php b/manual/codes/Working with objects - Component overview - Record - Deleting records.php deleted file mode 100644 index d15b0cd14..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Deleting records.php +++ /dev/null @@ -1,16 +0,0 @@ -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(); -?> diff --git a/manual/codes/Working with objects - Component overview - Record - Getting object copy.php b/manual/codes/Working with objects - Component overview - Record - Getting object copy.php deleted file mode 100644 index e5d527d75..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Getting object copy.php +++ /dev/null @@ -1,3 +0,0 @@ -copy(); -?> diff --git a/manual/codes/Working with objects - Component overview - Record - Getting record state.php b/manual/codes/Working with objects - Component overview - Record - Getting record state.php deleted file mode 100644 index fd2bd3b4a..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Getting record state.php +++ /dev/null @@ -1,31 +0,0 @@ -getState(); - -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; -endswitch; -?> diff --git a/manual/codes/Working with objects - Component overview - Record - Introduction.php b/manual/codes/Working with objects - Component overview - Record - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Record - Retrieving existing records.php b/manual/codes/Working with objects - Component overview - Record - Retrieving existing records.php deleted file mode 100644 index 5b7623cdb..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Retrieving existing records.php +++ /dev/null @@ -1,23 +0,0 @@ -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 WHERE User.name LIKE '%John%'"); -?> diff --git a/manual/codes/Working with objects - Component overview - Record - Serializing.php b/manual/codes/Working with objects - Component overview - Record - Serializing.php deleted file mode 100644 index 1ae2e9933..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Serializing.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/manual/codes/Working with objects - Component overview - Record - Updating records.php b/manual/codes/Working with objects - Component overview - Record - Updating records.php deleted file mode 100644 index 217639483..000000000 --- a/manual/codes/Working with objects - Component overview - Record - Updating records.php +++ /dev/null @@ -1,12 +0,0 @@ -getTable("User"); - - -$user = $table->find(2); - -if($user !== false) { - $user->name = "Jack Daniels"; - - $user->save(); -} -?> diff --git a/manual/codes/Working with objects - Component overview - Table - Custom finders.php b/manual/codes/Working with objects - Component overview - Table - Custom finders.php deleted file mode 100644 index 2301ca495..000000000 --- a/manual/codes/Working with objects - Component overview - Table - Custom finders.php +++ /dev/null @@ -1,24 +0,0 @@ -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"); - -?> diff --git a/manual/codes/Working with objects - Component overview - Table - Custom table classes.php b/manual/codes/Working with objects - Component overview - Table - Custom table classes.php deleted file mode 100644 index 138d5a445..000000000 --- a/manual/codes/Working with objects - Component overview - Table - Custom table classes.php +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/manual/codes/Working with objects - Component overview - Table - Finder methods.php b/manual/codes/Working with objects - Component overview - Table - Finder methods.php deleted file mode 100644 index 9b462c449..000000000 --- a/manual/codes/Working with objects - Component overview - Table - Finder methods.php +++ /dev/null @@ -1,21 +0,0 @@ -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; -} -?> diff --git a/manual/codes/Working with objects - Component overview - Table - Getting relation objects.php b/manual/codes/Working with objects - Component overview - Table - Getting relation objects.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Component overview - Table - Getting table information.php b/manual/codes/Working with objects - Component overview - Table - Getting table information.php deleted file mode 100644 index 5a90872b1..000000000 --- a/manual/codes/Working with objects - Component overview - Table - Getting table information.php +++ /dev/null @@ -1,11 +0,0 @@ -getTable('User'); - -// getting column names - -$names = $table->getColumnNames(); - -// getting column information - -$columns = $table->getColumns(); -?> diff --git a/manual/codes/Working with objects - Component overview - Table - Introduction.php b/manual/codes/Working with objects - Component overview - Table - Introduction.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/codes/Working with objects - Dealing with relations - Creating related records.php b/manual/codes/Working with objects - Dealing with relations - Creating related records.php deleted file mode 100644 index edb3ab559..000000000 --- a/manual/codes/Working with objects - Dealing with relations - Creating related records.php +++ /dev/null @@ -1,14 +0,0 @@ -Email; - -$email->address = 'jackdaniels@drinkmore.info'; - -$user->save(); - -// alternative: - -$user->Email->address = 'jackdaniels@drinkmore.info'; - -$user->save(); -?> diff --git a/manual/codes/Working with objects - Dealing with relations - Deleting related records.php b/manual/codes/Working with objects - Dealing with relations - Deleting related records.php deleted file mode 100644 index e936c3cff..000000000 --- a/manual/codes/Working with objects - Dealing with relations - Deleting related records.php +++ /dev/null @@ -1,9 +0,0 @@ -Email->delete(); - -$user->Phonenumber[3]->delete(); - -// deleting user and all related objects: - -$user->delete(); -?> diff --git a/manual/codes/Working with objects - Dealing with relations - Retrieving related records.php b/manual/codes/Working with objects - Dealing with relations - Retrieving related records.php deleted file mode 100644 index 0fe75cee5..000000000 --- a/manual/codes/Working with objects - Dealing with relations - Retrieving related records.php +++ /dev/null @@ -1,7 +0,0 @@ -Email['address']; - -print $user->Phonenumber[0]->phonenumber; - -print $user->Group[0]->name; -?> diff --git a/manual/codes/Working with objects - Dealing with relations - Updating related records.php b/manual/codes/Working with objects - Dealing with relations - Updating related records.php deleted file mode 100644 index 66f928bdf..000000000 --- a/manual/codes/Working with objects - Dealing with relations - Updating related records.php +++ /dev/null @@ -1,9 +0,0 @@ -Email['address'] = 'koskenkorva@drinkmore.info'; - -$user->Phonenumber[0]->phonenumber = '123123'; - -$user->save(); - -// saves the email and phonenumber -?> diff --git a/manual/codes/Working with objects - Dealing with relations - Working with associations.php b/manual/codes/Working with objects - Dealing with relations - Working with associations.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/manual/docs/Advanced components - Cache - Introduction.php b/manual/docs/Advanced components - Cache - Introduction.php index e7abab911..2c302a479 100644 --- a/manual/docs/Advanced components - Cache - Introduction.php +++ b/manual/docs/Advanced components - Cache - Introduction.php @@ -1,2 +1,3 @@ Caching is one of the most influental things when it comes to performance tuning. Doctrine_Cache provides means for caching queries and for managing the cached queries. + diff --git a/manual/docs/Advanced components - Cache - Query cache.php b/manual/docs/Advanced components - Cache - Query cache.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Cache - Query cache.php +++ b/manual/docs/Advanced components - Cache - Query cache.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Advanced components - Db_Profiler - Advanced usage.php b/manual/docs/Advanced components - Db_Profiler - Advanced usage.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Db_Profiler - Advanced usage.php +++ b/manual/docs/Advanced components - Db_Profiler - Advanced usage.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Advanced components - Db_Profiler - Basic usage.php b/manual/docs/Advanced components - Db_Profiler - Basic usage.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Db_Profiler - Basic usage.php +++ b/manual/docs/Advanced components - Db_Profiler - Basic usage.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Advanced components - Db_Profiler - Introduction.php b/manual/docs/Advanced components - Db_Profiler - Introduction.php index 83bd47179..fdf942647 100644 --- a/manual/docs/Advanced components - Db_Profiler - Introduction.php +++ b/manual/docs/Advanced components - Db_Profiler - Introduction.php @@ -10,3 +10,4 @@ renderCode(""); ?> + diff --git a/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php b/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php index d3f5a12fa..6ae287d87 100644 --- a/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php +++ b/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php @@ -1 +1,34 @@ + + +class User { + public function setTableDefinition() { + $this->hasColumn("name", "string", 200); + $this->hasColumn("password", "string", 32); + } + public function setPassword($password) { + return md5($password); + } + public function getName($name) { + return strtoupper($name); + } +} + +$user = new User(); + +$user->name = 'someone'; + +print $user->name; // someone + +$user->password = '123'; + +print $user->password; // 123 + +$user->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker()); + +print $user->name; // SOMEONE + +$user->password = '123'; + +print $user->password; // 202cb962ac59075b964b07152d234b70 + diff --git a/manual/docs/Advanced components - Eventlisteners - AccessorInvoker.php b/manual/docs/Advanced components - Eventlisteners - AccessorInvoker.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Eventlisteners - AccessorInvoker.php +++ b/manual/docs/Advanced components - Eventlisteners - AccessorInvoker.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Advanced components - Eventlisteners - Chaining.php b/manual/docs/Advanced components - Eventlisteners - Chaining.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Eventlisteners - Chaining.php +++ b/manual/docs/Advanced components - Eventlisteners - Chaining.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Advanced components - Eventlisteners - Creating a logger.php b/manual/docs/Advanced components - Eventlisteners - Creating a logger.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Eventlisteners - Creating a logger.php +++ b/manual/docs/Advanced components - Eventlisteners - Creating a logger.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Advanced components - Eventlisteners - Creating new listener.php b/manual/docs/Advanced components - Eventlisteners - Creating new listener.php index 1137b8917..da9bec4b7 100644 --- a/manual/docs/Advanced components - Eventlisteners - Creating new listener.php +++ b/manual/docs/Advanced components - Eventlisteners - Creating new listener.php @@ -1 +1,36 @@ Creating a new listener is very easy. You can set the listener in global, connection or factory level. + + +class MyListener extends Doctrine_EventListener { + public function onLoad(Doctrine_Record $record) { + print $record->getTable()->getComponentName()." just got loaded!"; + } + public function onSave(Doctrine_Record $record) { + print "saved data access object!"; + } +} +class MyListener2 extends Doctrine_EventListener { + public function onPreUpdate() { + try { + $record->set("updated",time()); + } catch(InvalidKeyException $e) { + } + } +} + + +// setting global listener +$manager = Doctrine_Manager::getInstance(); + +$manager->setAttribute(Doctrine::ATTR_LISTENER,new MyListener()); + +// setting connection level listener +$conn = $manager->openConnection($dbh); + +$conn->setAttribute(Doctrine::ATTR_LISTENER,new MyListener2()); + +// setting factory level listener +$table = $conn->getTable("User"); + +$table->setAttribute(Doctrine::ATTR_LISTENER,new MyListener()); + diff --git a/manual/docs/Advanced components - Eventlisteners - Introduction.php b/manual/docs/Advanced components - Eventlisteners - Introduction.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Eventlisteners - Introduction.php +++ b/manual/docs/Advanced components - Eventlisteners - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Advanced components - Eventlisteners - List of events.php b/manual/docs/Advanced components - Eventlisteners - List of events.php index 95524cd93..3ef2d9f29 100644 --- a/manual/docs/Advanced components - Eventlisteners - List of events.php +++ b/manual/docs/Advanced components - Eventlisteners - List of events.php @@ -1 +1,47 @@ Here is a list of availible events and their parameters: + + +interface Doctrine_EventListener_Interface { + + public function onLoad(Doctrine_Record $record); + public function onPreLoad(Doctrine_Record $record); + + public function onUpdate(Doctrine_Record $record); + public function onPreUpdate(Doctrine_Record $record); + + public function onCreate(Doctrine_Record $record); + public function onPreCreate(Doctrine_Record $record); + + public function onSave(Doctrine_Record $record); + public function onPreSave(Doctrine_Record $record); + + public function onInsert(Doctrine_Record $record); + public function onPreInsert(Doctrine_Record $record); + + public function onDelete(Doctrine_Record $record); + public function onPreDelete(Doctrine_Record $record); + + public function onEvict(Doctrine_Record $record); + public function onPreEvict(Doctrine_Record $record); + + public function onSleep(Doctrine_Record $record); + + public function onWakeUp(Doctrine_Record $record); + + public function onClose(Doctrine_Connection $connection); + public function onPreClose(Doctrine_Connection $connection); + + public function onOpen(Doctrine_Connection $connection); + + public function onTransactionCommit(Doctrine_Connection $connection); + public function onPreTransactionCommit(Doctrine_Connection $connection); + + public function onTransactionRollback(Doctrine_Connection $connection); + public function onPreTransactionRollback(Doctrine_Connection $connection); + + public function onTransactionBegin(Doctrine_Connection $connection); + public function onPreTransactionBegin(Doctrine_Connection $connection); + + public function onCollectionDelete(Doctrine_Collection $collection); + public function onPreCollectionDelete(Doctrine_Collection $collection); +} diff --git a/manual/docs/Advanced components - Eventlisteners - Listening events.php b/manual/docs/Advanced components - Eventlisteners - Listening events.php index e69de29bb..be619e48b 100644 --- a/manual/docs/Advanced components - Eventlisteners - Listening events.php +++ b/manual/docs/Advanced components - Eventlisteners - Listening events.php @@ -0,0 +1,14 @@ + + +$table = $conn->getTable("User"); + +$table->setEventListener(new MyListener2()); + +// retrieve user whose primary key is 2 +$user = $table->find(2); + +$user->name = "John Locke"; + +// update event will be listened and current time will be assigned to the field 'updated' +$user->save(); + diff --git a/manual/docs/Advanced components - Hook - Building queries.php b/manual/docs/Advanced components - Hook - Building queries.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Hook - Building queries.php +++ b/manual/docs/Advanced components - Hook - Building queries.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Advanced components - Hook - Introduction.php b/manual/docs/Advanced components - Hook - Introduction.php index f5e977f91..b6f9a4314 100644 --- a/manual/docs/Advanced components - Hook - Introduction.php +++ b/manual/docs/Advanced components - Hook - Introduction.php @@ -1,3 +1,4 @@ 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. + diff --git a/manual/docs/Advanced components - Hook - List of parsers.php b/manual/docs/Advanced components - Hook - List of parsers.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Advanced components - Hook - List of parsers.php +++ b/manual/docs/Advanced components - Hook - List of parsers.php @@ -0,0 +1 @@ + diff --git a/manual/codes/Advanced components - Hook - Parameter hooking.php b/manual/docs/Advanced components - Hook - Parameter hooking.php similarity index 59% rename from manual/codes/Advanced components - Hook - Parameter hooking.php rename to manual/docs/Advanced components - Hook - Parameter hooking.php index 44eb80df5..c899f011d 100644 --- a/manual/codes/Advanced components - Hook - Parameter hooking.php +++ b/manual/docs/Advanced components - Hook - Parameter hooking.php @@ -1,3 +1,4 @@ - $hook = new Doctrine_Hook($table, $fields); -?> + diff --git a/manual/docs/Advanced components - Locking Manager - Examples.php b/manual/docs/Advanced components - Locking Manager - Examples.php index fe02a525e..44ccf1903 100644 --- a/manual/docs/Advanced components - Locking Manager - Examples.php +++ b/manual/docs/Advanced components - Locking Manager - Examples.php @@ -1 +1,63 @@ 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 +} + diff --git a/manual/docs/Advanced components - Locking Manager - Introduction.php b/manual/docs/Advanced components - Locking Manager - Introduction.php index 52833e691..99f934c75 100644 --- a/manual/docs/Advanced components - Locking Manager - Introduction.php +++ b/manual/docs/Advanced components - Locking Manager - Introduction.php @@ -21,3 +21,4 @@ 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. + diff --git a/manual/docs/Advanced components - Locking Manager - Maintainer.php b/manual/docs/Advanced components - Locking Manager - Maintainer.php index 9934f77d7..9d242f34e 100644 --- a/manual/docs/Advanced components - Locking Manager - Maintainer.php +++ b/manual/docs/Advanced components - Locking Manager - Maintainer.php @@ -1,2 +1,2 @@ Roman Borschel - romanb at #doctrine (freenode)
-Don't hesitate to contact me if you have questions, ideas, ect. \ No newline at end of file +Don't hesitate to contact me if you have questions, ideas, ect. diff --git a/manual/docs/Advanced components - Locking Manager - Planned.php b/manual/docs/Advanced components - Locking Manager - Planned.php index 42ce24c57..d995f70bb 100644 --- a/manual/docs/Advanced components - Locking Manager - Planned.php +++ b/manual/docs/Advanced components - Locking Manager - Planned.php @@ -1,2 +1,2 @@ - Possibility to release locks of a specific Record type (i.e. releasing all locks on 'User' -objects). \ No newline at end of file +objects). diff --git a/manual/docs/Advanced components - Locking Manager - Technical Details.php b/manual/docs/Advanced components - Locking Manager - Technical Details.php index 7a4a56aca..57efaa9fe 100644 --- a/manual/docs/Advanced components - Locking Manager - Technical Details.php +++ b/manual/docs/Advanced components - Locking Manager - Technical Details.php @@ -3,3 +3,4 @@ The required locking table is automatically created when you try to instantiate 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. + diff --git a/manual/docs/Advanced components - Validators - Introduction.php b/manual/docs/Advanced components - Validators - Introduction.php index ef9d61bd2..6be899668 100644 --- a/manual/docs/Advanced components - Validators - Introduction.php +++ b/manual/docs/Advanced components - Validators - Introduction.php @@ -15,3 +15,9 @@ are both valid integers whilst "3f" is not. Type validations occur on every colu 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_VLD, true); + diff --git a/manual/docs/Advanced components - Validators - List of predefined validators.php b/manual/docs/Advanced components - Validators - List of predefined validators.php index 52227c216..af30adc69 100644 --- a/manual/docs/Advanced components - Validators - List of predefined validators.php +++ b/manual/docs/Advanced components - Validators - List of predefined validators.php @@ -11,3 +11,4 @@ Here is a list of predefined validators. You cannot use these names for your cus || range || [min,max] || Checks if value is in range specified by arguments.|| || unique || || Checks if value is unique in its database table. || || regexp || [expression] || Check if valie matches a given regexp. || + diff --git a/manual/docs/Advanced components - Validators - More Validation.php b/manual/docs/Advanced components - Validators - More Validation.php index d44722616..fa2783c1f 100644 --- a/manual/docs/Advanced components - Validators - More Validation.php +++ b/manual/docs/Advanced components - Validators - More Validation.php @@ -26,3 +26,32 @@ Within thess methods you can use all the power of PHP to validate your fields. W 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","User.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")); + } +} + diff --git a/manual/docs/Advanced components - Validators - Valid or Not Valid.php b/manual/docs/Advanced components - Validators - Valid or Not Valid.php index 6478020eb..4b08396e8 100644 --- a/manual/docs/Advanced components - Validators - Valid or Not Valid.php +++ b/manual/docs/Advanced components - Validators - Valid or Not Valid.php @@ -20,3 +20,34 @@ 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/Advanced components - View - Intoduction.php b/manual/docs/Advanced components - View - Intoduction.php index 8ca580f33..da4e96544 100644 --- a/manual/docs/Advanced components - View - Intoduction.php +++ b/manual/docs/Advanced components - View - Intoduction.php @@ -1,2 +1,3 @@ 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. + diff --git a/manual/docs/Advanced components - View - Managing views.php b/manual/docs/Advanced components - View - Managing views.php index e69de29bb..f9e0d5359 100644 --- a/manual/docs/Advanced components - View - Managing views.php +++ b/manual/docs/Advanced components - View - Managing views.php @@ -0,0 +1,16 @@ + + +$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(); + diff --git a/manual/docs/Advanced components - View - Using views.php b/manual/docs/Advanced components - View - Using views.php index d3f5a12fa..346a45435 100644 --- a/manual/docs/Advanced components - View - Using views.php +++ b/manual/docs/Advanced components - View - Using views.php @@ -1 +1,15 @@ + + +$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/Coding standards - Coding Style - Arrays.php b/manual/docs/Coding standards - Coding Style - Arrays.php index 4eafdf10b..e41f40962 100644 --- a/manual/docs/Coding standards - Coding Style - Arrays.php +++ b/manual/docs/Coding standards - Coding Style - Arrays.php @@ -13,3 +13,16 @@
  • 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'); + diff --git a/manual/docs/Coding standards - Coding Style - Classes.php b/manual/docs/Coding standards - Coding Style - Classes.php index 6951fc07e..61c93a9df 100644 --- a/manual/docs/Coding standards - Coding Style - Classes.php +++ b/manual/docs/Coding standards - Coding Style - Classes.php @@ -19,3 +19,12 @@ This is an example of an acceptable class declaration: + + +/** + * Documentation here + */ +class Doctrine_SampleClass { + // entire content of class + // must be indented four spaces +} diff --git a/manual/docs/Coding standards - Coding Style - Control statements.php b/manual/docs/Coding standards - Coding Style - Control statements.php index 164cea7b9..408e80089 100644 --- a/manual/docs/Coding standards - Coding Style - Control statements.php +++ b/manual/docs/Coding standards - Coding Style - Control statements.php @@ -73,3 +73,4 @@ switch (\$case) {
  • The construct default may never be omitted from a switch statement.
+ diff --git a/manual/docs/Coding standards - Coding Style - Functions and methods.php b/manual/docs/Coding standards - Coding Style - Functions and methods.php index 32aabcb2e..a7f8b0d94 100644 --- a/manual/docs/Coding standards - Coding Style - Functions and methods.php +++ b/manual/docs/Coding standards - Coding Style - Functions and methods.php @@ -97,3 +97,4 @@ threeArguments(array(1, 2, 3, 'Framework', ?>"); ?> + diff --git a/manual/docs/Coding standards - Coding Style - Inline documentation.php b/manual/docs/Coding standards - Coding Style - Inline documentation.php index ee680961f..cb02c60a4 100644 --- a/manual/docs/Coding standards - Coding Style - Inline documentation.php +++ b/manual/docs/Coding standards - Coding Style - Inline documentation.php @@ -33,3 +33,4 @@ Methods:
  • @throws exceptionclass [description]
+ diff --git a/manual/docs/Coding standards - Coding Style - PHP code demarcation.php b/manual/docs/Coding standards - Coding Style - PHP code demarcation.php index 673505441..0a66ad8ba 100644 --- a/manual/docs/Coding standards - Coding Style - PHP code demarcation.php +++ b/manual/docs/Coding standards - Coding Style - PHP code demarcation.php @@ -2,3 +2,4 @@ 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 + diff --git a/manual/docs/Coding standards - Coding Style - Strings.php b/manual/docs/Coding standards - Coding Style - Strings.php index bb016d70d..86fe80046 100644 --- a/manual/docs/Coding standards - Coding Style - Strings.php +++ b/manual/docs/Coding standards - Coding Style - Strings.php @@ -16,3 +16,22 @@
  • 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: + + +// literal string +$string = 'something'; + +// string contains apostrophes +$sql = "SELECT id, name FROM people WHERE name = 'Fred' OR name = 'Susan'"; + +// variable substitution +$greeting = "Hello $name, welcome back!"; + +// concatenation +$framework = 'Doctrine' . ' ORM ' . 'Framework'; + +// concatenation line breaking + +$sql = "SELECT id, name FROM user " + . "WHERE name = ? " + . "ORDER BY name ASC"; diff --git a/manual/docs/Coding standards - Naming Conventions - Classes.php b/manual/docs/Coding standards - Naming Conventions - Classes.php index 88aa837ee..e20a3f674 100644 --- a/manual/docs/Coding standards - Naming Conventions - Classes.php +++ b/manual/docs/Coding standards - Naming Conventions - Classes.php @@ -11,3 +11,4 @@ Underscores are only permitted in place of the path separator, eg. the filename
  • 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. + diff --git a/manual/docs/Coding standards - Naming Conventions - Constants.php b/manual/docs/Coding standards - Naming Conventions - Constants.php index 4d0e67a1b..023ec3ab1 100644 --- a/manual/docs/Coding standards - Naming Conventions - Constants.php +++ b/manual/docs/Coding standards - Naming Conventions - Constants.php @@ -8,3 +8,10 @@ Following rules must apply to all constants used within Doctrine framework:
    • 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; + diff --git a/manual/docs/Coding standards - Naming Conventions - Filenames.php b/manual/docs/Coding standards - Naming Conventions - Filenames.php index 7dbebdd9c..b5a2a11f3 100644 --- a/manual/docs/Coding standards - Naming Conventions - Filenames.php +++ b/manual/docs/Coding standards - Naming Conventions - Filenames.php @@ -12,3 +12,4 @@ Doctrine/Connection/Transaction.php
    • File names must follow the mapping to class names described above.
    + diff --git a/manual/docs/Coding standards - Naming Conventions - Functions and methods.php b/manual/docs/Coding standards - Naming Conventions - Functions and methods.php index 5511f1b7f..94399901e 100644 --- a/manual/docs/Coding standards - Naming Conventions - Functions and methods.php +++ b/manual/docs/Coding standards - Naming Conventions - Functions and methods.php @@ -18,3 +18,4 @@ for this is that since all user defined ActiveRecords inherit Doctrine_Record, i
    • Functions in the global scope ("floating functions") are NOT permmitted. All static functions should be wrapped in a static class.
    + diff --git a/manual/docs/Coding standards - Naming Conventions - Interfaces.php b/manual/docs/Coding standards - Naming Conventions - Interfaces.php index 173f59c13..847b0274e 100644 --- a/manual/docs/Coding standards - Naming Conventions - Interfaces.php +++ b/manual/docs/Coding standards - Naming Conventions - Interfaces.php @@ -7,3 +7,4 @@ Doctrine_Db_EventListener_Interface

    Doctrine_EventListener_Interface
    + diff --git a/manual/docs/Coding standards - Naming Conventions - Record columns.php b/manual/docs/Coding standards - Naming Conventions - Record columns.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Coding standards - Naming Conventions - Record columns.php +++ b/manual/docs/Coding standards - Naming Conventions - Record columns.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Coding standards - Naming Conventions - Variables.php b/manual/docs/Coding standards - Naming Conventions - Variables.php index bbf3094b2..54b280794 100644 --- a/manual/docs/Coding standards - Naming Conventions - Variables.php +++ b/manual/docs/Coding standards - Naming Conventions - Variables.php @@ -26,3 +26,5 @@ All variables must satisfy the following conditions: 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. + + diff --git a/manual/docs/Coding standards - Overview - Goals.php b/manual/docs/Coding standards - Overview - Goals.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Coding standards - Overview - Goals.php +++ b/manual/docs/Coding standards - Overview - Goals.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Coding standards - Overview - Scope.php b/manual/docs/Coding standards - Overview - Scope.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Coding standards - Overview - Scope.php +++ b/manual/docs/Coding standards - Overview - Scope.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Coding standards - PHP File Formatting - General.php b/manual/docs/Coding standards - PHP File Formatting - General.php index 168fb64f7..73d61f660 100644 --- a/manual/docs/Coding standards - PHP File Formatting - General.php +++ b/manual/docs/Coding standards - PHP File Formatting - General.php @@ -2,3 +2,4 @@ For files that contain only PHP code, the closing tag ("?>") is never permitted.

    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. + diff --git a/manual/docs/Coding standards - PHP File Formatting - Indentation.php b/manual/docs/Coding standards - PHP File Formatting - Indentation.php index dcc2bc522..9e8070543 100644 --- a/manual/docs/Coding standards - PHP File Formatting - Indentation.php +++ b/manual/docs/Coding standards - PHP File Formatting - Indentation.php @@ -1 +1,2 @@ Use an indent of 4 spaces, with no tabs. + diff --git a/manual/docs/Coding standards - PHP File Formatting - Line termination.php b/manual/docs/Coding standards - PHP File Formatting - Line termination.php index b0a8fdda3..d13c8fa17 100644 --- a/manual/docs/Coding standards - PHP File Formatting - Line termination.php +++ b/manual/docs/Coding standards - PHP File Formatting - Line termination.php @@ -7,3 +7,5 @@
    • Do not use the carriage return/linefeed combination (CRLF) as Windows computers (0x0D, 0x0A).
    + + diff --git a/manual/docs/Coding standards - PHP File Formatting - Maximum line length.php b/manual/docs/Coding standards - PHP File Formatting - Maximum line length.php index 390c03d59..a8a34b421 100644 --- a/manual/docs/Coding standards - PHP File Formatting - Maximum line length.php +++ b/manual/docs/Coding standards - PHP File Formatting - Maximum line length.php @@ -1 +1,2 @@ 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. + diff --git a/manual/docs/Coding standards - Testing - Writing tests.php b/manual/docs/Coding standards - Testing - Writing tests.php index 9b683ab39..6823a464b 100644 --- a/manual/docs/Coding standards - Testing - Writing tests.php +++ b/manual/docs/Coding standards - Testing - Writing tests.php @@ -31,3 +31,4 @@ divide the method into smaller methods. ASSERTIONS

    • There should never be assertions within any loops and rarely within functions. + diff --git a/manual/codes/Configuration - Custom getters and setters.php b/manual/docs/Configuration - Custom getters and setters.php similarity index 91% rename from manual/codes/Configuration - Custom getters and setters.php rename to manual/docs/Configuration - Custom getters and setters.php index 0cf8a244f..5b975baad 100644 --- a/manual/codes/Configuration - Custom getters and setters.php +++ b/manual/docs/Configuration - Custom getters and setters.php @@ -1,4 +1,5 @@ - class Customer extends Doctrine_Record { public function setUp() { // setup code goes here @@ -18,4 +19,4 @@ class Customer extends Doctrine_Record { return $this->get("name"); } } -?> + diff --git a/manual/codes/Configuration - Custom primary key column.php b/manual/docs/Configuration - Custom primary key column.php similarity index 81% rename from manual/codes/Configuration - Custom primary key column.php rename to manual/docs/Configuration - Custom primary key column.php index 1535df124..b5b1d3fc5 100644 --- a/manual/codes/Configuration - Custom primary key column.php +++ b/manual/docs/Configuration - Custom primary key column.php @@ -1,4 +1,5 @@ - // custom primary key column name class Group extends Doctrine_Record { @@ -6,4 +7,4 @@ class Group extends Doctrine_Record { $this->setPrimaryKeyColumn("group_id"); } } -?> + diff --git a/manual/docs/Configuration - Introduction.php b/manual/docs/Configuration - Introduction.php index e69de29bb..32726fecb 100644 --- a/manual/docs/Configuration - Introduction.php +++ b/manual/docs/Configuration - Introduction.php @@ -0,0 +1,6 @@ + + +$manager = Doctrine_Manager::getInstance(); + +$manager->setAttribute(Doctrine::ATTR_LISTENER, new MyListener()); + diff --git a/manual/docs/Configuration - Levels of configuration.php b/manual/docs/Configuration - Levels of configuration.php index bead615b7..7fee77891 100644 --- a/manual/docs/Configuration - Levels of configuration.php +++ b/manual/docs/Configuration - Levels of configuration.php @@ -16,3 +16,24 @@ the lazy fetching strategy will be used whenever the records of 'example' table
        The attributes set in table level will take effect only on that table.
      + + +// setting a global level attribute +$manager = Doctrine_Manager::getInstance(); + +$manager->setAttribute(Doctrine::ATTR_VLD, false); + +// 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_VLD, true); + +// 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/Configuration - Setting attributes - Batch size.php b/manual/docs/Configuration - Setting attributes - Batch size.php index e69de29bb..077117e6f 100644 --- a/manual/docs/Configuration - Setting attributes - Batch size.php +++ b/manual/docs/Configuration - Setting attributes - Batch size.php @@ -0,0 +1,6 @@ + + +// setting default batch size for batch collections + +$manager->setAttribute(Doctrine::ATTR_BATCH_SIZE, 7); + diff --git a/manual/docs/Configuration - Setting attributes - Event listener.php b/manual/docs/Configuration - Setting attributes - Event listener.php index e69de29bb..d1652dd56 100644 --- a/manual/docs/Configuration - Setting attributes - Event listener.php +++ b/manual/docs/Configuration - Setting attributes - Event listener.php @@ -0,0 +1,6 @@ + + +// setting default event listener + +$manager->setAttribute(Doctrine::ATTR_LISTENER, new MyListener()); + diff --git a/manual/docs/Configuration - Setting attributes - Fetching strategy.php b/manual/docs/Configuration - Setting attributes - Fetching strategy.php index e69de29bb..70dc56c8b 100644 --- a/manual/docs/Configuration - Setting attributes - Fetching strategy.php +++ b/manual/docs/Configuration - Setting attributes - Fetching strategy.php @@ -0,0 +1,6 @@ + + +// sets the default collection type (fetching strategy) + +$manager->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_LAZY); + diff --git a/manual/docs/Configuration - Setting attributes - Identifier quoting.php b/manual/docs/Configuration - Setting attributes - Identifier quoting.php index 8f1eb1ae4..9422007c1 100644 --- a/manual/docs/Configuration - Setting attributes - Identifier quoting.php +++ b/manual/docs/Configuration - Setting attributes - Identifier quoting.php @@ -48,3 +48,4 @@ will result in a SQL statement that all the field names are quoted with the back as opposed to:
      SELECT * FROM sometable WHERE id='123'
      + diff --git a/manual/docs/Configuration - Setting attributes - Offset collection limit.php b/manual/docs/Configuration - Setting attributes - Offset collection limit.php index e69de29bb..bcdc5e8ec 100644 --- a/manual/docs/Configuration - Setting attributes - Offset collection limit.php +++ b/manual/docs/Configuration - Setting attributes - Offset collection limit.php @@ -0,0 +1,6 @@ + + +// sets the default offset collection limit + +$manager->setAttribute(Doctrine::ATTR_COLL_LIMIT, 10); + diff --git a/manual/docs/Configuration - Setting attributes - Portability.php b/manual/docs/Configuration - Setting attributes - Portability.php index 75e7976f9..d1591e677 100644 --- a/manual/docs/Configuration - Setting attributes - Portability.php +++ b/manual/docs/Configuration - Setting attributes - Portability.php @@ -76,3 +76,4 @@ renderCode(""); ?> + diff --git a/manual/docs/Configuration - Setting attributes - Session lockmode.php b/manual/docs/Configuration - Setting attributes - Session lockmode.php index e69de29bb..302a8d758 100644 --- a/manual/docs/Configuration - Setting attributes - Session lockmode.php +++ b/manual/docs/Configuration - Setting attributes - Session lockmode.php @@ -0,0 +1,6 @@ + + +// setting default lockmode + +$manager->setAttribute(Doctrine::ATTR_LOCKMODE, Doctrine::LOCK_PESSIMISTIC); + diff --git a/manual/docs/Configuration - Setting attributes - Table creation.php b/manual/docs/Configuration - Setting attributes - Table creation.php index e69de29bb..82eca78a7 100644 --- a/manual/docs/Configuration - Setting attributes - Table creation.php +++ b/manual/docs/Configuration - Setting attributes - Table creation.php @@ -0,0 +1,6 @@ + + +// turns automatic table creation off + +$manager->setAttribute(Doctrine::ATTR_CREATE_TABLES, false); + diff --git a/manual/docs/Configuration - Setting attributes - Validation.php b/manual/docs/Configuration - Setting attributes - Validation.php index e69de29bb..3c770280d 100644 --- a/manual/docs/Configuration - Setting attributes - Validation.php +++ b/manual/docs/Configuration - Setting attributes - Validation.php @@ -0,0 +1,6 @@ + + +// turns transactional validation on + +$manager->setAttribute(Doctrine::ATTR_VLD, true); + diff --git a/manual/codes/Configuration - Setting default eventlistener.php b/manual/docs/Configuration - Setting default eventlistener.php similarity index 87% rename from manual/codes/Configuration - Setting default eventlistener.php rename to manual/docs/Configuration - Setting default eventlistener.php index a3cb4920b..1dc8551db 100644 --- a/manual/codes/Configuration - Setting default eventlistener.php +++ b/manual/docs/Configuration - Setting default eventlistener.php @@ -1,4 +1,5 @@ - class Email extends Doctrine_Record { public function setUp() { $this->setAttribute(Doctrine::ATTR_LISTENER,new MyListener()); @@ -7,4 +8,4 @@ class Email extends Doctrine_Record { $this->hasColumn("address","string",150,"email|unique"); } } -?> + diff --git a/manual/codes/Configuration - Setting default fetchmode.php b/manual/docs/Configuration - Setting default fetchmode.php similarity index 89% rename from manual/codes/Configuration - Setting default fetchmode.php rename to manual/docs/Configuration - Setting default fetchmode.php index bee2e999c..dbb0d02a4 100644 --- a/manual/codes/Configuration - Setting default fetchmode.php +++ b/manual/docs/Configuration - Setting default fetchmode.php @@ -1,4 +1,5 @@ - // setting default fetchmode // availible fetchmodes are Doctrine::FETCH_LAZY, Doctrine::FETCH_IMMEDIATE and Doctrine::FETCH_BATCH // the default fetchmode is Doctrine::FETCH_LAZY @@ -8,4 +9,4 @@ class Address extends Doctrine_Record { $this->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_IMMEDIATE); } } -?> + diff --git a/manual/codes/Configuration - Using sequences.php b/manual/docs/Configuration - Using sequences.php similarity index 79% rename from manual/codes/Configuration - Using sequences.php rename to manual/docs/Configuration - Using sequences.php index 16ed99419..87efa219c 100644 --- a/manual/codes/Configuration - Using sequences.php +++ b/manual/docs/Configuration - Using sequences.php @@ -1,4 +1,5 @@ - // using sequences class User extends Doctrine_Record { @@ -6,4 +7,4 @@ class User extends Doctrine_Record { $this->setSequenceName("user_seq"); } } -?> + diff --git a/manual/docs/Connection management - Connection-component binding.php b/manual/docs/Connection management - Connection-component binding.php index fd4fbfdcd..5ac935b34 100644 --- a/manual/docs/Connection management - Connection-component binding.php +++ b/manual/docs/Connection management - Connection-component binding.php @@ -21,3 +21,4 @@ renderCode("from('Group g')->where('g.id IN (1,2,3)')->execute(); ?>"); ?> + diff --git a/manual/docs/Connection management - Lazy-connecting to database.php b/manual/docs/Connection management - Lazy-connecting to database.php index 44646ea6b..83e291aae 100644 --- a/manual/docs/Connection management - Lazy-connecting to database.php +++ b/manual/docs/Connection management - Lazy-connecting to database.php @@ -19,3 +19,4 @@ renderCode(""); ?> + diff --git a/manual/docs/Connection management - Managing connections.php b/manual/docs/Connection management - Managing connections.php index 4279c5c3b..d33f95112 100644 --- a/manual/docs/Connection management - Managing connections.php +++ b/manual/docs/Connection management - Managing connections.php @@ -69,3 +69,4 @@ foreach(\$manager as \$conn) { } ?>"); ?> + diff --git a/manual/docs/Connection management - Opening a new connection.php b/manual/docs/Connection management - Opening a new connection.php index 0b6dffa9d..cec6c99d2 100644 --- a/manual/docs/Connection management - Opening a new connection.php +++ b/manual/docs/Connection management - Opening a new connection.php @@ -38,3 +38,4 @@ renderCode(""); ?> + diff --git a/manual/docs/Connection modules - DataDict - Getting database declaration.php b/manual/docs/Connection modules - DataDict - Getting database declaration.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - DataDict - Getting database declaration.php +++ b/manual/docs/Connection modules - DataDict - Getting database declaration.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Connection modules - DataDict - Getting portable type.php b/manual/docs/Connection modules - DataDict - Getting portable type.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - DataDict - Getting portable type.php +++ b/manual/docs/Connection modules - DataDict - Getting portable type.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Connection modules - DataDict - Reserved keywords.php b/manual/docs/Connection modules - DataDict - Reserved keywords.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - DataDict - Reserved keywords.php +++ b/manual/docs/Connection modules - DataDict - Reserved keywords.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Connection modules - Export - Altering table.php b/manual/docs/Connection modules - Export - Altering table.php index d79aa70c1..814b3e683 100644 --- a/manual/docs/Connection modules - Export - Altering table.php +++ b/manual/docs/Connection modules - Export - Altering table.php @@ -53,3 +53,43 @@ Associative array with the names of the fields to be changed as indexes of the a
    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' => 'text', + 'length' => 20 + ) + ) + ), + 'rename' => array( + 'sex' => array( + 'name' => 'gender', + 'definition' => array( + 'type' => 'text', + 'length' => 1, + 'default' => 'M' + ) + ) + ) + + ); + +$dbh = new PDO('dsn','username','pw'); +$conn = Doctrine_Manager::getInstance()->openConnection($dbh); + +$conn->export->alterTable('mytable', $a); + diff --git a/manual/docs/Connection modules - Export - Creating new table.php b/manual/docs/Connection modules - Export - Creating new table.php index e69de29bb..84ce54319 100644 --- a/manual/docs/Connection modules - Export - Creating new table.php +++ b/manual/docs/Connection modules - Export - Creating new table.php @@ -0,0 +1,23 @@ + + +$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/Connection modules - Export - Introduction.php b/manual/docs/Connection modules - Export - Introduction.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - Export - Introduction.php +++ b/manual/docs/Connection modules - Export - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Connection modules - Import - Getting foreign key info.php b/manual/docs/Connection modules - Import - Getting foreign key info.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - Import - Getting foreign key info.php +++ b/manual/docs/Connection modules - Import - Getting foreign key info.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Connection modules - Import - Getting table info.php b/manual/docs/Connection modules - Import - Getting table info.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - Import - Getting table info.php +++ b/manual/docs/Connection modules - Import - Getting table info.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Connection modules - Import - Getting view info.php b/manual/docs/Connection modules - Import - Getting view info.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - Import - Getting view info.php +++ b/manual/docs/Connection modules - Import - Getting view info.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Connection modules - Import - Introduction.php b/manual/docs/Connection modules - Import - Introduction.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - Import - Introduction.php +++ b/manual/docs/Connection modules - Import - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Connection modules - Util - Using explain.php b/manual/docs/Connection modules - Util - Using explain.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Connection modules - Util - Using explain.php +++ b/manual/docs/Connection modules - Util - Using explain.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - BNF.php b/manual/docs/DQL (Doctrine Query Language) - BNF.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - BNF.php +++ b/manual/docs/DQL (Doctrine Query Language) - BNF.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php index f79d91190..85f7a6d84 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php @@ -48,3 +48,4 @@ FROM C WHERE C.col1 <> ALL (FROM C2(col1)); FROM C WHERE C.col1 NOT IN (FROM C2(col1)); + diff --git a/manual/codes/Coding standards - Naming Conventions - Variables.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php similarity index 50% rename from manual/codes/Coding standards - Naming Conventions - Variables.php rename to manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php index d3f5a12fa..8b1378917 100644 --- a/manual/codes/Coding standards - Naming Conventions - Variables.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php @@ -1 +1 @@ - + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php index d3f5a12fa..4e3ae44db 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php @@ -1 +1,3 @@ + + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php index f8e2ebcc7..fa97cea36 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php @@ -24,3 +24,4 @@ FROM Article WHERE ReaderLog.article_id = Article.id) + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php index ba8406719..aae88e927 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php @@ -26,3 +26,4 @@ FROM C1 WHERE C1.col1 IN (FROM C2(col1)); + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php index e69de29bb..8e4a0c527 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php @@ -0,0 +1,15 @@ + + + +// 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%')); + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php index 092c51e65..192eb47b7 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php @@ -22,3 +22,12 @@ Examples: 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%'"); + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php index 29fd3a35a..3c4299cc3 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php @@ -48,3 +48,4 @@ FROM User WHERE User.type = 'admin'
    Predefined reserved literals are case insensitive, although its a good standard to write them in uppercase. + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php index ec193d0ba..9e2a75aa6 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php @@ -12,3 +12,4 @@ NOT
    AND
    OR
    + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php index 54a4c4f1c..bc62779c7 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php +++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php @@ -9,3 +9,23 @@ Some advantages of the subqueries:
  • 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/DQL (Doctrine Query Language) - DELETE queries.php b/manual/docs/DQL (Doctrine Query Language) - DELETE queries.php index 357dfd51f..76b235f7d 100644 --- a/manual/docs/DQL (Doctrine Query Language) - DELETE queries.php +++ b/manual/docs/DQL (Doctrine Query Language) - DELETE queries.php @@ -18,3 +18,20 @@ Without WHERE clause, all records are 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/DQL (Doctrine Query Language) - Examples.php b/manual/docs/DQL (Doctrine Query Language) - Examples.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Examples.php +++ b/manual/docs/DQL (Doctrine Query Language) - Examples.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - FROM clause.php b/manual/docs/DQL (Doctrine Query Language) - FROM clause.php index 084b837a6..72aec367c 100644 --- a/manual/docs/DQL (Doctrine Query Language) - FROM clause.php +++ b/manual/docs/DQL (Doctrine Query Language) - FROM clause.php @@ -29,3 +29,4 @@ SELECT u.*, p.* FROM User u INNER JOIN u.Phonenumber p + diff --git a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic functions.php b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic functions.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic functions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic functions.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Datetime functions.php b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Datetime functions.php index e69de29bb..8b1378917 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Datetime functions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Datetime functions.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - String functions.php b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - String functions.php index 525bfeb34..54e7c9709 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - String functions.php +++ b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - String functions.php @@ -74,3 +74,4 @@ returned.
  • The LENGTH function returns the length of the string in characters as an integer. + diff --git a/manual/docs/DQL (Doctrine Query Language) - Functions - Contains.php b/manual/docs/DQL (Doctrine Query Language) - Functions - Contains.php index e69de29bb..86497ee87 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Functions - Contains.php +++ b/manual/docs/DQL (Doctrine Query Language) - Functions - Contains.php @@ -0,0 +1,8 @@ + + +$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/DQL (Doctrine Query Language) - Functions - Like.php b/manual/docs/DQL (Doctrine Query Language) - Functions - Like.php index e69de29bb..32bf2999e 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Functions - Like.php +++ b/manual/docs/DQL (Doctrine Query Language) - Functions - Like.php @@ -0,0 +1,8 @@ + + +$q = new Doctrine_Query(); + +$q->from('User')->where('User.Phonenumber.phonenumber.like(?,?)'); + +$users = $q->execute(array('%123%', '456%')); + diff --git a/manual/docs/DQL (Doctrine Query Language) - Functions - Regexp.php b/manual/docs/DQL (Doctrine Query Language) - Functions - Regexp.php index e69de29bb..6e1fb4736 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Functions - Regexp.php +++ b/manual/docs/DQL (Doctrine Query Language) - Functions - Regexp.php @@ -0,0 +1,8 @@ + + +$q = new Doctrine_Query(); + +$q->from('User')->where('User.Phonenumber.phonenumber.regexp(?,?)'); + +$users = $q->execute(array('[123]', '^[3-5]')); + diff --git a/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php b/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php index 2dc50e8fe..8d61ce2f7 100644 --- a/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php +++ b/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php @@ -38,3 +38,14 @@ 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/codes/Coding standards - PHP File Formatting - Line termination.php b/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING.php similarity index 50% rename from manual/codes/Coding standards - PHP File Formatting - Line termination.php rename to manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING.php index d3f5a12fa..8b1378917 100644 --- a/manual/codes/Coding standards - PHP File Formatting - Line termination.php +++ b/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING.php @@ -1 +1 @@ - + diff --git a/manual/docs/DQL (Doctrine Query Language) - Introduction.php b/manual/docs/DQL (Doctrine Query Language) - Introduction.php index c45e19ff6..a432af305 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Introduction.php +++ b/manual/docs/DQL (Doctrine Query Language) - Introduction.php @@ -21,3 +21,30 @@ When compared to using raw SQL, DQL has several benefits:
    If the power of DQL isn't enough, you should consider using the rawSql API for object population. + + +// DO NOT USE THE FOLLOWING CODE +// (using many sql queries for object population): + +$users = $conn->getTable('User')->findAll(); + +foreach($users as $user) { + print $user->name."
    "; + foreach($user->Phonenumber as $phonenumber) { + print $phonenumber."
    "; + } +} + +// same thing implemented much more efficiently: +// (using only one sql query for object population) + +$users = $conn->query("FROM User.Phonenumber"); + +foreach($users as $user) { + print $user->name."
    "; + foreach($user->Phonenumber as $phonenumber) { + print $phonenumber."
    "; + } +} + +
    diff --git a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php index ae2abfd56..6720d7a82 100644 --- a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php +++ b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php @@ -10,3 +10,4 @@ LIMIT clause in subqueries

    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. + diff --git a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php index 987beee70..67f187990 100644 --- a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php +++ b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php @@ -1,3 +1,4 @@ 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. + diff --git a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php index 736a72e02..86e03d01d 100644 --- a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php +++ b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php @@ -66,3 +66,4 @@ WHERE (e2.type = 0) LIMIT 20) AND (e.type = 0) + diff --git a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php index d3f5a12fa..06228c5ca 100644 --- a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php +++ b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php @@ -1 +1,16 @@ + + + +// 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'; + } +} + diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET.php similarity index 50% rename from manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php rename to manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET.php index d3f5a12fa..8b1378917 100644 --- a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php +++ b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET.php @@ -1 +1 @@ - + diff --git a/manual/codes/Working with objects - Component overview - Connection - Introduction.php b/manual/docs/DQL (Doctrine Query Language) - ORDER BY clause.php similarity index 50% rename from manual/codes/Working with objects - Component overview - Connection - Introduction.php rename to manual/docs/DQL (Doctrine Query Language) - ORDER BY clause.php index d3f5a12fa..8b1378917 100644 --- a/manual/codes/Working with objects - Component overview - Connection - Introduction.php +++ b/manual/docs/DQL (Doctrine Query Language) - ORDER BY clause.php @@ -1 +1 @@ - + diff --git a/manual/docs/DQL (Doctrine Query Language) - ORDER BY.php b/manual/docs/DQL (Doctrine Query Language) - ORDER BY.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/DQL (Doctrine Query Language) - ORDER BY.php @@ -0,0 +1 @@ + diff --git a/manual/docs/DQL (Doctrine Query Language) - Operators - Logical operators.php b/manual/docs/DQL (Doctrine Query Language) - Operators - Logical operators.php index 3b63ada08..37e479bc8 100644 --- a/manual/docs/DQL (Doctrine Query Language) - Operators - Logical operators.php +++ b/manual/docs/DQL (Doctrine Query Language) - Operators - Logical operators.php @@ -108,3 +108,4 @@

  • + diff --git a/manual/docs/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php b/manual/docs/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php index d703c3f47..5e83d3074 100644 --- a/manual/docs/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php +++ b/manual/docs/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php @@ -1 +1,16 @@ 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/DQL (Doctrine Query Language) - SELECT queries.php b/manual/docs/DQL (Doctrine Query Language) - SELECT queries.php index cf4df113f..3c4c2a070 100644 --- a/manual/docs/DQL (Doctrine Query Language) - SELECT queries.php +++ b/manual/docs/DQL (Doctrine Query Language) - SELECT queries.php @@ -67,3 +67,4 @@ SELECT u.* FROM User u LIMIT 20 + diff --git a/manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php b/manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php index ab308d48c..8d34a2a8d 100644 --- a/manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php +++ b/manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php @@ -22,3 +22,20 @@ Without WHERE clause, all records are updated. 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/DQL (Doctrine Query Language) - WHERE clause.php b/manual/docs/DQL (Doctrine Query Language) - WHERE clause.php index c3f4b29d1..f115102a8 100644 --- a/manual/docs/DQL (Doctrine Query Language) - WHERE clause.php +++ b/manual/docs/DQL (Doctrine Query Language) - WHERE clause.php @@ -14,3 +14,4 @@ WHERE where_condition
  • When narrowing results with aggregate function values HAVING clause should be used instead of WHERE clause

    + diff --git a/manual/codes/Database operations - Limit and offset.php b/manual/docs/Database operations - Limit and offset.php similarity index 84% rename from manual/codes/Database operations - Limit and offset.php rename to manual/docs/Database operations - Limit and offset.php index eca98ea2e..99889887d 100644 --- a/manual/codes/Database operations - Limit and offset.php +++ b/manual/docs/Database operations - Limit and offset.php @@ -1,7 +1,8 @@ - $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/codes/Database operations - Nested transactions.php b/manual/docs/Database operations - Nested transactions.php similarity index 85% rename from manual/codes/Database operations - Nested transactions.php rename to manual/docs/Database operations - Nested transactions.php index a2c5683ab..18efcfbeb 100644 --- a/manual/codes/Database operations - Nested transactions.php +++ b/manual/docs/Database operations - Nested transactions.php @@ -1,4 +1,5 @@ - try { $conn->beginTransaction(); @@ -14,4 +15,4 @@ try { } catch(Exception $e) { $conn->rollback(); } -?> + diff --git a/manual/codes/Database operations - Query logging.php b/manual/docs/Database operations - Query logging.php similarity index 85% rename from manual/codes/Database operations - Query logging.php rename to manual/docs/Database operations - Query logging.php index 84aba9454..e63dcfb2b 100644 --- a/manual/codes/Database operations - Query logging.php +++ b/manual/docs/Database operations - Query logging.php @@ -1,4 +1,5 @@ - // works only if you use doctrine database handler @@ -12,4 +13,4 @@ foreach($dbh->getQueries() as $index => $query) { print $query." ".$times[$index]; } -?> + diff --git a/manual/codes/Database operations - Sequences.php b/manual/docs/Database operations - Sequences.php similarity index 82% rename from manual/codes/Database operations - Sequences.php rename to manual/docs/Database operations - Sequences.php index f5f3846a5..233b3e378 100644 --- a/manual/codes/Database operations - Sequences.php +++ b/manual/docs/Database operations - Sequences.php @@ -1,7 +1,8 @@ - $sess = Doctrine_Manager::getInstance()->openConnection(new PDO("dsn","username","password")); // gets the next ID from a sequence $sess->getNextID($sequence); -?> + diff --git a/manual/codes/Database operations - Transactions.php b/manual/docs/Database operations - Transactions.php similarity index 84% rename from manual/codes/Database operations - Transactions.php rename to manual/docs/Database operations - Transactions.php index 08f1838ae..5a5ce8f49 100644 --- a/manual/codes/Database operations - Transactions.php +++ b/manual/docs/Database operations - Transactions.php @@ -1,4 +1,5 @@ - $sess = Doctrine_Manager::getInstance()->openConnection(new PDO("dsn","username","password")); try { $sess->beginTransaction(); @@ -11,4 +12,4 @@ $sess->commit(); $sess->rollback(); } -?> + diff --git a/manual/docs/Drivers - Mysql - Tips and tricks.php b/manual/docs/Drivers - Mysql - Tips and tricks.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Drivers - Mysql - Tips and tricks.php +++ b/manual/docs/Drivers - Mysql - Tips and tricks.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Drivers - Oracle - Making unsuported functions work.php b/manual/docs/Drivers - Oracle - Making unsuported functions work.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Drivers - Oracle - Making unsuported functions work.php +++ b/manual/docs/Drivers - Oracle - Making unsuported functions work.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Functions - Contains.php b/manual/docs/Functions - Contains.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Functions - Contains.php +++ b/manual/docs/Functions - Contains.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Functions - Like.php b/manual/docs/Functions - Like.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Functions - Like.php +++ b/manual/docs/Functions - Like.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Functions - Regexp.php b/manual/docs/Functions - Regexp.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Functions - Regexp.php +++ b/manual/docs/Functions - Regexp.php @@ -0,0 +1 @@ + diff --git a/manual/codes/Getting started - Compile.php b/manual/docs/Getting started - Compile.php similarity index 98% rename from manual/codes/Getting started - Compile.php rename to manual/docs/Getting started - Compile.php index 9fb4f35ca..7ade52f99 100644 --- a/manual/codes/Getting started - Compile.php +++ b/manual/docs/Getting started - Compile.php @@ -1,3 +1,4 @@ + 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 diff --git a/manual/docs/Getting started - Compiling.php b/manual/docs/Getting started - Compiling.php index 6eb50663a..96e5d7519 100644 --- a/manual/docs/Getting started - Compiling.php +++ b/manual/docs/Getting started - Compiling.php @@ -6,3 +6,11 @@

    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/Getting started - Data types - Array.php b/manual/docs/Getting started - Data types - Array.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Array.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Blob.php b/manual/docs/Getting started - Data types - Blob.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Blob.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Boolean.php b/manual/docs/Getting started - Data types - Boolean.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Boolean.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Clob.php b/manual/docs/Getting started - Data types - Clob.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Clob.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Date.php b/manual/docs/Getting started - Data types - Date.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Date.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Enum.php b/manual/docs/Getting started - Data types - Enum.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Enum.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Float.php b/manual/docs/Getting started - Data types - Float.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Float.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Gzip.php b/manual/docs/Getting started - Data types - Gzip.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Gzip.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Integer.php b/manual/docs/Getting started - Data types - Integer.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Integer.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Object.php b/manual/docs/Getting started - Data types - Object.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Object.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - String.php b/manual/docs/Getting started - Data types - String.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - String.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Data types - Timestamp.php b/manual/docs/Getting started - Data types - Timestamp.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Data types - Timestamp.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Getting started - Requirements.php b/manual/docs/Getting started - Requirements.php index be29d5ba4..0c9b7213c 100644 --- a/manual/docs/Getting started - Requirements.php +++ b/manual/docs/Getting started - Requirements.php @@ -1,2 +1,3 @@ Doctrine requires PHP >= 5.1. it doesn't require any external libraries. For database abstraction Doctrine uses PDO which is bundled with php by default. Doctrine also requires a little adodb-hack for table creation, which comes with doctrine. + diff --git a/manual/docs/Getting started - Setting table definition - Constraints and validators.php b/manual/docs/Getting started - Setting table definition - Constraints and validators.php index 11f69ac63..8b9ef5b89 100644 --- a/manual/docs/Getting started - Setting table definition - Constraints and validators.php +++ b/manual/docs/Getting started - Setting table definition - Constraints and validators.php @@ -240,3 +240,19 @@ Following attributes are availible for columns + + +class User extends Doctrine_Record { + public function setTableDefinition() { + // the name cannot contain whitespace + $this->hasColumn("name", "string", 50, array("nospace" => true)); + + // the email should be a valid email + $this->hasColumn("email", "string", 200, array("email" => true)); + + // home_country should be a valid country code and not null + $this->hasColumn("home_country", "string", 2, array("country" => true, "notnull" => true)); + + } +} + diff --git a/manual/docs/Getting started - Setting table definition - Data types and lengths.php b/manual/docs/Getting started - Setting table definition - Data types and lengths.php index f90719b15..4dca2aaa0 100644 --- a/manual/docs/Getting started - Setting table definition - Data types and lengths.php +++ b/manual/docs/Getting started - Setting table definition - Data types and lengths.php @@ -36,3 +36,31 @@ However when the record is validated it is only allowed to have 'content' -colum In general Doctrine is smart enough to know which integer/string type to use depending on the specified length.
    + + +class Article extends Doctrine_Record { + public function setTableDefinition() { + // few mapping examples: + + // maps into VARCHAR(100) on mysql + $this->hasColumn("title","string",100); + + // maps into TEXT on mysql + $this->hasColumn("content","string",4000); + + // maps into TINYINT on mysql + $this->hasColumn("type","integer",1); + + // maps into INT on mysql + $this->hasColumn("type2","integer",11); + + // maps into BIGINT on mysql + $this->hasColumn("type3","integer",20); + + // maps into TEXT on mysql + // (serialized and unserialized automatically by doctrine) + $this->hasColumn("types","array",4000); + + } +} + diff --git a/manual/docs/Getting started - Setting table definition - Default values.php b/manual/docs/Getting started - Setting table definition - Default values.php index a80071b9d..ea1648215 100644 --- a/manual/docs/Getting started - Setting table definition - Default values.php +++ b/manual/docs/Getting started - Setting table definition - Default values.php @@ -17,3 +17,4 @@ 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/Getting started - Setting table definition - Enum emulation.php b/manual/docs/Getting started - Setting table definition - Enum emulation.php index 2126d34bb..ab05ad413 100644 --- a/manual/docs/Getting started - Setting table definition - Enum emulation.php +++ b/manual/docs/Getting started - Setting table definition - Enum emulation.php @@ -1,3 +1,23 @@ Doctrine offers enum data type emulation for all databases. The enum data type of Doctrine maps to integer on database. Doctrine takes care of converting the enumerated value automatically to its valuelist equivalent when a record is being fetched and the valuelist value back to its enumerated equivalent when record is being saved. + + +class Article extends Doctrine_Record { + public function setTableDefinition() { + $this->hasColumn("title","string", 200); + + // maps to TINYINT on mysql + $this->hasColumn("section", "enum", 2, array('values' => array("PHP","Python","Java","Ruby"))); + } +} +$article = new Article; +$article->title = 'My first php article'; +// doctrine auto-converts the section to integer when the +// record is being saved +$article->section = 'PHP'; +$article->save(); + +// on insert query with values 'My first php article' and 0 +// would be issued + diff --git a/manual/docs/Getting started - Setting table definition - Table options.php b/manual/docs/Getting started - Setting table definition - Table options.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Getting started - Setting table definition - Table options.php @@ -0,0 +1 @@ + diff --git a/manual/codes/Getting started - Setting table definition.php b/manual/docs/Getting started - Setting table definition.php similarity index 90% rename from manual/codes/Getting started - Setting table definition.php rename to manual/docs/Getting started - Setting table definition.php index 23b9057be..2007b4dbb 100644 --- a/manual/codes/Getting started - Setting table definition.php +++ b/manual/docs/Getting started - Setting table definition.php @@ -1,4 +1,5 @@ - class Email extends Doctrine_Record { public function setTableDefinition() { /** @@ -12,4 +13,4 @@ class Email extends Doctrine_Record { $this->hasColumn("address","string",200,"email|unique"); } } -?> + diff --git a/manual/docs/Hierarchical data - Adjacency list - Introduction.php b/manual/docs/Hierarchical data - Adjacency list - Introduction.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Hierarchical data - Adjacency list - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/codes/Hierarchical data - Examples.php b/manual/docs/Hierarchical data - Examples.php similarity index 99% rename from manual/codes/Hierarchical data - Examples.php rename to manual/docs/Hierarchical data - Examples.php index 5886a866d..db1c059ea 100644 --- a/manual/codes/Hierarchical data - Examples.php +++ b/manual/docs/Hierarchical data - Examples.php @@ -1,4 +1,5 @@ - require_once("path/to/Doctrine.php"); @@ -385,4 +386,4 @@ function output_message($msg) { echo "
    $msg".'
    '; } -?> \ No newline at end of file + \ No newline at end of file diff --git a/manual/codes/Hierarchical data - Introduction - Node interface.php b/manual/docs/Hierarchical data - Introduction - Node interface.php similarity index 98% rename from manual/codes/Hierarchical data - Introduction - Node interface.php rename to manual/docs/Hierarchical data - Introduction - Node interface.php index f63357bc8..fd8db564c 100644 --- a/manual/codes/Hierarchical data - Introduction - Node interface.php +++ b/manual/docs/Hierarchical data - Introduction - Node interface.php @@ -1,4 +1,5 @@ - interface Doctrine_Node_Interface { /** @@ -89,4 +90,4 @@ interface Doctrine_Node_Interface { // if your model acts as tree you can retrieve the associated node object as follows $record = $manager->getTable('Model')->find($pk); $nodeObj = $record->getNode(); -?> \ No newline at end of file + \ No newline at end of file diff --git a/manual/codes/Hierarchical data - Introduction - Setting up.php b/manual/docs/Hierarchical data - Introduction - Setting up.php similarity index 96% rename from manual/codes/Hierarchical data - Introduction - Setting up.php rename to manual/docs/Hierarchical data - Introduction - Setting up.php index e53653553..19db1ec5e 100644 --- a/manual/codes/Hierarchical data - Introduction - Setting up.php +++ b/manual/docs/Hierarchical data - Introduction - Setting up.php @@ -1,4 +1,5 @@ - class Menu extends Doctrine_Record { public function setTableDefinition() { @@ -20,4 +21,4 @@ class Menu extends Doctrine_Record { return $this->get('name'); } } -?> \ No newline at end of file + \ No newline at end of file diff --git a/manual/codes/Hierarchical data - Introduction - Traversing or Walking Trees.php b/manual/docs/Hierarchical data - Introduction - Traversing or Walking Trees.php similarity index 96% rename from manual/codes/Hierarchical data - Introduction - Traversing or Walking Trees.php rename to manual/docs/Hierarchical data - Introduction - Traversing or Walking Trees.php index 40337b672..3282fb0d2 100644 --- a/manual/codes/Hierarchical data - Introduction - Traversing or Walking Trees.php +++ b/manual/docs/Hierarchical data - Introduction - Traversing or Walking Trees.php @@ -1,4 +1,5 @@ - /* * traverse the entire tree from root */ @@ -39,4 +40,4 @@ while($node = $branch->traverse()) // output your tree here } -?> \ No newline at end of file + \ No newline at end of file diff --git a/manual/codes/Hierarchical data - Introduction - Tree interface.php b/manual/docs/Hierarchical data - Introduction - Tree interface.php similarity index 96% rename from manual/codes/Hierarchical data - Introduction - Tree interface.php rename to manual/docs/Hierarchical data - Introduction - Tree interface.php index 3cac1f234..0f0ebc23d 100644 --- a/manual/codes/Hierarchical data - Introduction - Tree interface.php +++ b/manual/docs/Hierarchical data - Introduction - Tree interface.php @@ -1,4 +1,5 @@ - interface Doctrine_Tree_Interface { @@ -26,4 +27,4 @@ interface Doctrine_Tree_Interface { // if your model acts as tree you can retrieve the associated tree object as follows $treeObj = $manager->getTable('Model')->getTree(); -?> \ No newline at end of file + \ No newline at end of file diff --git a/manual/docs/Hierarchical data - Introduction.php b/manual/docs/Hierarchical data - Introduction.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Hierarchical data - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Hierarchical data - Materialized path - Introduction.php b/manual/docs/Hierarchical data - Materialized path - Introduction.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Hierarchical data - Materialized path - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Hierarchical data - Nested set - Introduction.php b/manual/docs/Hierarchical data - Nested set - Introduction.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Hierarchical data - Nested set - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/codes/Hierarchical data - Nested set - Setting up.php b/manual/docs/Hierarchical data - Nested set - Setting up.php similarity index 96% rename from manual/codes/Hierarchical data - Nested set - Setting up.php rename to manual/docs/Hierarchical data - Nested set - Setting up.php index 5d992a909..ed993414f 100644 --- a/manual/codes/Hierarchical data - Nested set - Setting up.php +++ b/manual/docs/Hierarchical data - Nested set - Setting up.php @@ -1,4 +1,5 @@ - class Menu extends Doctrine_Record { public function setTableDefinition() { @@ -18,4 +19,4 @@ class Menu extends Doctrine_Record { return $this->get('name'); } } -?> \ No newline at end of file + \ No newline at end of file diff --git a/manual/codes/Hierarchical data - Nested set - Tree options.php b/manual/docs/Hierarchical data - Nested set - Tree options.php similarity index 97% rename from manual/codes/Hierarchical data - Nested set - Tree options.php rename to manual/docs/Hierarchical data - Nested set - Tree options.php index 9ef993901..be13f74c3 100644 --- a/manual/codes/Hierarchical data - Nested set - Tree options.php +++ b/manual/docs/Hierarchical data - Nested set - Tree options.php @@ -1,4 +1,5 @@ - //use these options in the setTableDefinition $options = array('hasManyRoots' => true, // enable many roots 'rootColumnName' => 'root_id'); // set root column name, defaults to 'root_id' @@ -23,4 +24,4 @@ $another_root = $manager->getTable('Menu')->getTree()->fetchRoot(2); // fetching all roots $roots = $manager->getTable('Menu')->getTree()->fetchRoots(); -?> + diff --git a/manual/docs/Hierarchical data - NestedSet - Introduction.php b/manual/docs/Hierarchical data - NestedSet - Introduction.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Hierarchical data - NestedSet - Introduction.php +++ b/manual/docs/Hierarchical data - NestedSet - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Native SQL - Component queries.php b/manual/docs/Native SQL - Component queries.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Native SQL - Component queries.php +++ b/manual/docs/Native SQL - Component queries.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Native SQL - Fetching multiple components.php b/manual/docs/Native SQL - Fetching multiple components.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Native SQL - Fetching multiple components.php +++ b/manual/docs/Native SQL - Fetching multiple components.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Native SQL - Scalar queries.php b/manual/docs/Native SQL - Scalar queries.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Native SQL - Scalar queries.php +++ b/manual/docs/Native SQL - Scalar queries.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Object relational mapping - Columns - Column aliases.php b/manual/docs/Object relational mapping - Columns - Column aliases.php index e9fdde783..923788bf9 100644 --- a/manual/docs/Object relational mapping - Columns - Column aliases.php +++ b/manual/docs/Object relational mapping - Columns - Column aliases.php @@ -1,2 +1,15 @@ 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/Object relational mapping - Columns - Column naming.php b/manual/docs/Object relational mapping - Columns - Column naming.php index 485159914..1bf034c49 100644 --- a/manual/docs/Object relational mapping - Columns - Column naming.php +++ b/manual/docs/Object relational mapping - Columns - Column naming.php @@ -12,3 +12,4 @@ access it through $record->myField (or $record['myField'], whatever you prefer) or Postgres or Oracle ect.

    In short: You can name your fields however you want, using under_scores, camelCase or whatever you prefer. + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Array.php b/manual/docs/Object relational mapping - Columns - Data types - Array.php index 449cbabd1..5a5d60239 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Array.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Array.php @@ -1 +1,9 @@ This is the same as 'array' type in PHP. + + +class Test extends Doctrine_Record { + public function setTableDefinition() { + $this->hasColumn('arraytest', 'array', 10000); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Blob.php b/manual/docs/Object relational mapping - Columns - Data types - Blob.php index 39960564c..8d4ea45f8 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Blob.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Blob.php @@ -1,3 +1,11 @@ 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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Boolean.php b/manual/docs/Object relational mapping - Columns - Data types - Boolean.php index 455f92351..39caa37e8 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Boolean.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Boolean.php @@ -3,3 +3,11 @@ Do not assume that these data types are stored as integers because some DBMS dri 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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Clob.php b/manual/docs/Object relational mapping - Columns - Data types - Clob.php index 5baca179e..67fc62735 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Clob.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Clob.php @@ -3,3 +3,11 @@ Clob (Character Large OBject) data type is meant to store data of undefined leng 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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Date.php b/manual/docs/Object relational mapping - Columns - Data types - Date.php index 77ca90f66..937dd2312 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Date.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Date.php @@ -4,3 +4,11 @@ The format defined by the ISO-8601 standard for dates is YYYY-MM-DD where YYYY i

    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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Enum.php b/manual/docs/Object relational mapping - Columns - Data types - Enum.php index 12d32e777..ded9d05a9 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Enum.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Enum.php @@ -1,2 +1,18 @@ 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' + ) + ) + ); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Float.php b/manual/docs/Object relational mapping - Columns - Data types - Float.php index fcee1d5b0..e32f9c484 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Float.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Float.php @@ -1 +1,9 @@ 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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Gzip.php b/manual/docs/Object relational mapping - Columns - Data types - Gzip.php index 44bb0616d..58d270876 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Gzip.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Gzip.php @@ -1 +1,9 @@ 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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Integer.php b/manual/docs/Object relational mapping - Columns - Data types - Integer.php index 9ccfefba7..1077b3811 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Integer.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Integer.php @@ -4,3 +4,11 @@ Fields of this type may be created optionally as unsigned integers but not all D 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)); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Introduction.php b/manual/docs/Object relational mapping - Columns - Data types - Introduction.php index af4218785..a7fb8bd4a 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Introduction.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Introduction.php @@ -22,3 +22,4 @@ Example 2. Column with type 'integer' and length 1 results in 'TINYINT' on many

    In general Doctrine is smart enough to know which integer/string type to use depending on the specified length. + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Object.php b/manual/docs/Object relational mapping - Columns - Data types - Object.php index b8dc1b29f..3686b1eef 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Object.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Object.php @@ -1,2 +1,10 @@ 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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - String.php b/manual/docs/Object relational mapping - Columns - Data types - String.php index a7ca626bd..da6179f8a 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - String.php +++ b/manual/docs/Object relational mapping - Columns - Data types - String.php @@ -5,3 +5,11 @@ The length limited option is the most recommended for efficiency reasons. The un 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)); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Time.php b/manual/docs/Object relational mapping - Columns - Data types - Time.php index dc3928777..2a50227c4 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Time.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Time.php @@ -4,3 +4,11 @@ The format defined by the ISO-8601 standard for the time of the day is HH:MI:SS

    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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Timestamp.php b/manual/docs/Object relational mapping - Columns - Data types - Timestamp.php index 4699e811a..783093395 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Timestamp.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Timestamp.php @@ -2,3 +2,11 @@ The timestamp data type is a mere combination of the date and the time of the da 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'); + } +} + diff --git a/manual/docs/Object relational mapping - Columns - Data types - Type modifiers.php b/manual/docs/Object relational mapping - Columns - Data types - Type modifiers.php index f9796c975..44f1284f3 100644 --- a/manual/docs/Object relational mapping - Columns - Data types - Type modifiers.php +++ b/manual/docs/Object relational mapping - Columns - Data types - Type modifiers.php @@ -45,3 +45,4 @@ Using the above example, we can also explore the default field operator. Default

    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. + diff --git a/manual/docs/Object relational mapping - Record identifiers - Autoincremented.php b/manual/docs/Object relational mapping - Record identifiers - Autoincremented.php index 2c107e319..2472be09f 100644 --- a/manual/docs/Object relational mapping - Record identifiers - Autoincremented.php +++ b/manual/docs/Object relational mapping - Record identifiers - Autoincremented.php @@ -1,2 +1,11 @@ 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,'primary|autoincrement'); + + } +} + diff --git a/manual/docs/Object relational mapping - Record identifiers - Composite.php b/manual/docs/Object relational mapping - Record identifiers - Composite.php index 37f636a03..ec30807ab 100644 --- a/manual/docs/Object relational mapping - Record identifiers - Composite.php +++ b/manual/docs/Object relational mapping - Record identifiers - Composite.php @@ -2,3 +2,12 @@ Composite primary key can be used efficiently in association tables (tables that 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, 'primary'); + $this->hasColumn('group_id', 'integer', 20, 'primary'); + } +} + diff --git a/manual/docs/Object relational mapping - Record identifiers - Introduction.php b/manual/docs/Object relational mapping - Record identifiers - Introduction.php index 2965d26eb..b111e4ab7 100644 --- a/manual/docs/Object relational mapping - Record identifiers - Introduction.php +++ b/manual/docs/Object relational mapping - Record identifiers - Introduction.php @@ -2,3 +2,4 @@ Doctrine supports many kind of identifiers. For most cases it is recommended not 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. + diff --git a/manual/docs/Object relational mapping - Record identifiers - Natural.php b/manual/docs/Object relational mapping - Record identifiers - Natural.php index 4dc0d94c2..cfb204e61 100644 --- a/manual/docs/Object relational mapping - Record identifiers - Natural.php +++ b/manual/docs/Object relational mapping - Record identifiers - Natural.php @@ -1,2 +1,10 @@ Natural identifier is a property or combination of properties that is unique and non-null. The use of natural identifiers is discouraged. You should consider using autoincremented or sequential primary keys as they make your system more scalable. + + +class User extends Doctrine_Record { + public function setTableDefinition() { + $this->hasColumn('name','string',200,'primary'); + } +} + diff --git a/manual/docs/Object relational mapping - Record identifiers - Sequence.php b/manual/docs/Object relational mapping - Record identifiers - Sequence.php index 9235c9532..c42f08731 100644 --- a/manual/docs/Object relational mapping - Record identifiers - Sequence.php +++ b/manual/docs/Object relational mapping - Record identifiers - Sequence.php @@ -66,3 +66,4 @@ class Book extends Doctrine_Record { } ?>"); ?> + diff --git a/manual/docs/Object relational mapping - Record identifiers - Sequential.php b/manual/docs/Object relational mapping - Record identifiers - Sequential.php new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/manual/docs/Object relational mapping - Record identifiers - Sequential.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Object relational mapping - Relations - Composites and aggregates.php b/manual/docs/Object relational mapping - Relations - Composites and aggregates.php index efbe9f42e..ff03450b4 100644 --- a/manual/docs/Object relational mapping - Relations - Composites and aggregates.php +++ b/manual/docs/Object relational mapping - Relations - Composites and aggregates.php @@ -7,3 +7,4 @@ 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/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php b/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php index e69de29bb..8bb9230a8 100644 --- a/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php +++ b/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php @@ -0,0 +1,19 @@ + + +class User extends Doctrine_Record { + public function setUp() { + $this->ownsMany('Phonenumber','Phonenumber.user_id'); + } + public function setTableDefition() { + $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'); + } +} + diff --git a/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-One.php b/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-One.php index b279556ff..f7dfc414a 100644 --- a/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-One.php +++ b/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-One.php @@ -5,3 +5,32 @@ 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','Address.user_id'); + $this->ownsOne('Email','User.email_id'); + $this->ownsMany('Phonenumber','Phonenumber.user_id'); + } + public function setTableDefition() { + $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'); + } +} + diff --git a/manual/docs/Object relational mapping - Relations - Foreign key associations - Tree structure.php b/manual/docs/Object relational mapping - Relations - Foreign key associations - Tree structure.php index e69de29bb..ecb9e7c12 100644 --- a/manual/docs/Object relational mapping - Relations - Foreign key associations - Tree structure.php +++ b/manual/docs/Object relational mapping - Relations - Foreign key associations - Tree structure.php @@ -0,0 +1,13 @@ + + +class Task extends Doctrine_Record { + public function setUp() { + $this->hasOne('Task as Parent','Task.parent_id'); + $this->hasMany('Task as Subtask','Subtask.parent_id'); + } + public function setTableDefinition() { + $this->hasColumn('name','string',100); + $this->hasColumn('parent_id','integer'); + } +} + diff --git a/manual/docs/Object relational mapping - Relations - Inheritance - One table many classes.php b/manual/docs/Object relational mapping - Relations - Inheritance - One table many classes.php index 689114886..ffe77627a 100644 --- a/manual/docs/Object relational mapping - Relations - Inheritance - One table many classes.php +++ b/manual/docs/Object relational mapping - Relations - Inheritance - One table many classes.php @@ -5,3 +5,18 @@ 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 { } + diff --git a/manual/docs/Object relational mapping - Relations - Inheritance - One table one class.php b/manual/docs/Object relational mapping - Relations - Inheritance - One table one class.php index 603eef0e8..4d27c8423 100644 --- a/manual/docs/Object relational mapping - Relations - Inheritance - One table one class.php +++ b/manual/docs/Object relational mapping - Relations - Inheritance - One table one class.php @@ -3,3 +3,30 @@ 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(); + } +} + diff --git a/manual/docs/Object relational mapping - Relations - Introduction.php b/manual/docs/Object relational mapping - Relations - Introduction.php index 8f3da94ca..37508325b 100644 --- a/manual/docs/Object relational mapping - Relations - Introduction.php +++ b/manual/docs/Object relational mapping - Relations - Introduction.php @@ -1,2 +1,3 @@ In Doctrine all record relations are being set with hasMany, hasOne, ownsMany and ownsOne methods. Doctrine supports almost any kind of database relation from simple one-to-one foreign key relations to join table self-referencing relations. + diff --git a/manual/docs/Object relational mapping - Relations - Join table associations - Many-to-Many.php b/manual/docs/Object relational mapping - Relations - Join table associations - Many-to-Many.php index 499adcd80..c651dd67f 100644 --- a/manual/docs/Object relational mapping - Relations - Join table associations - Many-to-Many.php +++ b/manual/docs/Object relational mapping - Relations - Join table associations - Many-to-Many.php @@ -12,3 +12,58 @@ this behoviour by setting the relations to association component (in this case G 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','Groupuser.group_id'); + } + public function setTableDefinition() { + $this->hasColumn('name','string',30); + } +} + +class Group extends Doctrine_Record { + public function setUp() { + $this->hasMany('User','Groupuser.user_id'); + } + public function setTableDefinition() { + $this->hasColumn('name','string',30); + } +} + +class Groupuser extends Doctrine_Record { + public function setTableDefinition() { + $this->hasColumn('user_id','integer'); + $this->hasColumn('group_id','integer'); + } +} + + +$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' + + diff --git a/manual/docs/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php b/manual/docs/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php +++ b/manual/docs/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Object relational mapping - Relations - Join table associations - One-to-One.php b/manual/docs/Object relational mapping - Relations - Join table associations - One-to-One.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Object relational mapping - Relations - Join table associations - One-to-One.php +++ b/manual/docs/Object relational mapping - Relations - Join table associations - One-to-One.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php b/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php index 7e41044c4..1ac461341 100644 --- a/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php +++ b/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php @@ -1 +1,18 @@ Self-referencing with join tables is done as follows: + + +class User extends Doctrine_Record { + public function setUp() { + $this->hasMany('User as Friend','UserReference.user_id-user_id2'); + } + public function setTableDefinition() { + $this->hasColumn('name','string',30); + } +} +class UserReference extends Doctrine_Record { + public function setTableDefinition() { + $this->hasColumn('user_id','integer'); + $this->hasColumn('user_id2','integer'); + } +} + diff --git a/manual/docs/Object relational mapping - Relations - Relation aliases.php b/manual/docs/Object relational mapping - Relations - Relation aliases.php index 6ba9c1515..b1acca309 100644 --- a/manual/docs/Object relational mapping - Relations - Relation aliases.php +++ b/manual/docs/Object relational mapping - Relations - Relation aliases.php @@ -1 +1,28 @@ 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->ownsMany('Forum_Thread as Threads', 'Forum_Thread.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', 'Forum_Thread.board_id'); + } +} +$board = new Board(); +$board->Threads[0]->updated = time(); + diff --git a/manual/docs/Object relational mapping - Table and class naming.php b/manual/docs/Object relational mapping - Table and class naming.php index 4aa8d9883..3cb96d21d 100644 --- a/manual/docs/Object relational mapping - Table and class naming.php +++ b/manual/docs/Object relational mapping - Table and class naming.php @@ -16,3 +16,4 @@ Doctrine automatically creates table names from the record class names. For this 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/Operators - Logical operators.php b/manual/docs/Operators - Logical operators.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Operators - Logical operators.php +++ b/manual/docs/Operators - Logical operators.php @@ -0,0 +1 @@ + diff --git a/manual/codes/Performance - Internal optimizations - DELETE.php b/manual/docs/Performance - Internal optimizations - DELETE.php similarity index 94% rename from manual/codes/Performance - Internal optimizations - DELETE.php rename to manual/docs/Performance - Internal optimizations - DELETE.php index f9fd255ea..9842097df 100644 --- a/manual/codes/Performance - Internal optimizations - DELETE.php +++ b/manual/docs/Performance - Internal optimizations - DELETE.php @@ -1,4 +1,5 @@ - /** * lets presume $users contains a collection of users * each having 0-1 email and 0-* phonenumbers @@ -21,4 +22,4 @@ $users->delete(); */ -?> + diff --git a/manual/codes/Performance - Internal optimizations - INSERT.php b/manual/docs/Performance - Internal optimizations - INSERT.php similarity index 95% rename from manual/codes/Performance - Internal optimizations - INSERT.php rename to manual/docs/Performance - Internal optimizations - INSERT.php index 43a9958b0..29c51746d 100644 --- a/manual/codes/Performance - Internal optimizations - INSERT.php +++ b/manual/docs/Performance - Internal optimizations - INSERT.php @@ -1,4 +1,5 @@ - // lets presume $users contains a collection of new users // each having 0-1 email and 0-* phonenumbers $users->save(); @@ -25,4 +26,4 @@ $users->save(); * These operations are considerably fast, since many databases perform multiple * prepared queries very rapidly */ -?> + diff --git a/manual/docs/Real world examples - Album lister.php b/manual/docs/Real world examples - Album lister.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Real world examples - Album lister.php +++ b/manual/docs/Real world examples - Album lister.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Real world examples - Forum application.php b/manual/docs/Real world examples - Forum application.php index e69de29bb..ab9a2514e 100644 --- a/manual/docs/Real world examples - Forum application.php +++ b/manual/docs/Real world examples - Forum application.php @@ -0,0 +1,53 @@ + + +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/Real world examples - User management system.php b/manual/docs/Real world examples - User management system.php index 3ba1e772f..87e6f8c5a 100644 --- a/manual/docs/Real world examples - User management system.php +++ b/manual/docs/Real world examples - User management system.php @@ -19,3 +19,82 @@ In the following example we make a user management system where 9. When an entity is updated a current timestamp will be assigned to 'updated' field

    10. Entities will always be fetched in batches + + +class Entity extends Doctrine_Record { + public function setUp() { + $this->ownsOne("Email","Entity.email_id"); + $this->ownsMany("Phonenumber","Phonenumber.entity_id"); + $this->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_BATCH); + $this->setAttribute(Doctrine::ATTR_LISTENER,new EntityListener()); + } + public function setTableDefinition() { + $this->hasColumn("name","string",50); + $this->hasColumn("loginname","string",20); + $this->hasColumn("password","string",16); + $this->hasColumn("type","integer",1); + $this->hasColumn("created","integer",11); + $this->hasColumn("updated","integer",11); + $this->hasColumn("email_id","integer"); + } +} +class Group extends Entity { + public function setUp() { + parent::setUp(); + $this->hasMany("User","Groupuser.user_id"); + $this->setInheritanceMap(array("type"=>1)); + } +} +class User extends Entity { + public function setUp() { + parent::setUp(); + $this->hasMany("Group","Groupuser.group_id"); + $this->setInheritanceMap(array("type"=>0)); + } +} +class Groupuser extends Doctrine_Record { + public function setTableDefinition() { + $this->hasColumn("group_id","integer"); + $this->hasColumn("user_id","integer"); + } +} + +class Phonenumber extends Doctrine_Record { + public function setTableDefinition() { + $this->hasColumn("phonenumber","string",20); + $this->hasColumn("entity_id","integer"); + } +} +class Email extends Doctrine_Record { + public function setTableDefinition() { + $this->hasColumn("address","string",150,"email|unique"); + } +} +class EntityListener extends Doctrine_EventListener { + public function onPreUpdate(Doctrine_Record $record) { + $record->updated = time(); + } + public function onPreInsert(Doctrine_Record $record) { + $record->created = time(); + } +} + +// USER MANAGEMENT SYSTEM IN ACTION: + +$manager = Doctrine_Manager::getInstance(); + +$conn = $manager->openConnection(new PDO("DSN","username","password")); + +$user = new User(); + +$user->name = "Jack Daniels"; +$user->Email->address = "jackdaniels@drinkmore.info"; +$user->Phonenumber[0]->phonenumber = "123 123"; +$user->Phonenumber[1]->phonenumber = "133 133"; +$user->save(); + +$user->Group[0]->name = "beer lovers"; +$user->Group[0]->Email->address = "beerlovers@drinkmore.info"; +$user->Group[0]->save(); + + diff --git a/manual/docs/Runtime classes - Doctrine_Record.php b/manual/docs/Runtime classes - Doctrine_Record.php index 488d59ab9..c05645e6c 100644 --- a/manual/docs/Runtime classes - Doctrine_Record.php +++ b/manual/docs/Runtime classes - Doctrine_Record.php @@ -1,2 +1,43 @@ 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/Runtime classes - Doctrine_Session.php b/manual/docs/Runtime classes - Doctrine_Session.php index 3d9eb19e3..9bb515b4d 100644 --- a/manual/docs/Runtime classes - Doctrine_Session.php +++ b/manual/docs/Runtime classes - Doctrine_Session.php @@ -1,3 +1,34 @@ 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/Technology - Architecture.php b/manual/docs/Technology - Architecture.php index f7611d5cb..d798b4c1c 100644 --- a/manual/docs/Technology - Architecture.php +++ b/manual/docs/Technology - Architecture.php @@ -13,3 +13,4 @@ Doctrine is divided into 3 main packages: >> Doctrine ORM + diff --git a/manual/docs/Technology - Design patterns used.php b/manual/docs/Technology - Design patterns used.php index 8ff792ee0..10c805c97 100644 --- a/manual/docs/Technology - Design patterns used.php +++ b/manual/docs/Technology - Design patterns used.php @@ -44,3 +44,4 @@ Enterprise application design patterns used:
    For lazy loading of objects and object properties
  • Query Object
    DQL API is actually an extension to the basic idea of Query Object pattern + diff --git a/manual/docs/Technology - Internal optimizations - DELETE.php b/manual/docs/Technology - Internal optimizations - DELETE.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Technology - Internal optimizations - DELETE.php +++ b/manual/docs/Technology - Internal optimizations - DELETE.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Technology - Internal optimizations - INSERT.php b/manual/docs/Technology - Internal optimizations - INSERT.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Technology - Internal optimizations - INSERT.php +++ b/manual/docs/Technology - Internal optimizations - INSERT.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Technology - Internal optimizations - UPDATE.php b/manual/docs/Technology - Internal optimizations - UPDATE.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Technology - Internal optimizations - UPDATE.php +++ b/manual/docs/Technology - Internal optimizations - UPDATE.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Technology - Speed.php b/manual/docs/Technology - Speed.php index 258471fb4..f626b82a5 100644 --- a/manual/docs/Technology - Speed.php +++ b/manual/docs/Technology - Speed.php @@ -33,3 +33,4 @@ Doctrine knows if the the state of the record has changed. PDO is by far the fastest availible database abstraction layer for php.

    + diff --git a/manual/docs/Transactions - Deadlocks.php b/manual/docs/Transactions - Deadlocks.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Transactions - Deadlocks.php +++ b/manual/docs/Transactions - Deadlocks.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Transactions - Introduction.php b/manual/docs/Transactions - Introduction.php index 607b8f700..63e5418c5 100644 --- a/manual/docs/Transactions - Introduction.php +++ b/manual/docs/Transactions - Introduction.php @@ -26,3 +26,17 @@ are performed in the following order: all inserts, all updates and last all dele 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/Transactions - Isolation levels.php b/manual/docs/Transactions - Isolation levels.php index 3651fa063..c939144a3 100644 --- a/manual/docs/Transactions - Isolation levels.php +++ b/manual/docs/Transactions - Isolation levels.php @@ -29,3 +29,4 @@ renderCode("getIsolation(); ?>"); ?> + diff --git a/manual/docs/Transactions - Lock modes.php b/manual/docs/Transactions - Lock modes.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Transactions - Lock modes.php +++ b/manual/docs/Transactions - Lock modes.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Transactions - Locking strategies - Optimistic locking.php b/manual/docs/Transactions - Locking strategies - Optimistic locking.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Transactions - Locking strategies - Optimistic locking.php +++ b/manual/docs/Transactions - Locking strategies - Optimistic locking.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Transactions - Locking strategies - Pessimistic locking.php b/manual/docs/Transactions - Locking strategies - Pessimistic locking.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Transactions - Locking strategies - Pessimistic locking.php +++ b/manual/docs/Transactions - Locking strategies - Pessimistic locking.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Transactions - Nesting.php b/manual/docs/Transactions - Nesting.php index e69de29bb..8fa868563 100644 --- a/manual/docs/Transactions - Nesting.php +++ b/manual/docs/Transactions - Nesting.php @@ -0,0 +1,24 @@ + + +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/Transactions - Savepoints.php b/manual/docs/Transactions - Savepoints.php index 9bd027f28..f1016ac6b 100644 --- a/manual/docs/Transactions - Savepoints.php +++ b/manual/docs/Transactions - Savepoints.php @@ -54,3 +54,4 @@ try { } ?>"); ?> + diff --git a/manual/docs/Transactions - Unit of work.php b/manual/docs/Transactions - Unit of work.php index e69de29bb..dc1336c43 100644 --- a/manual/docs/Transactions - Unit of work.php +++ b/manual/docs/Transactions - Unit of work.php @@ -0,0 +1,19 @@ + + +$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/Working with objects - Component overview - Collection - Accessing elements.php b/manual/docs/Working with objects - Component overview - Collection - Accessing elements.php index 1fe766630..4df4467d4 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Accessing elements.php +++ b/manual/docs/Working with objects - Component overview - Collection - Accessing elements.php @@ -1 +1,17 @@ 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; + diff --git a/manual/docs/Working with objects - Component overview - Collection - Adding new elements.php b/manual/docs/Working with objects - Component overview - Collection - Adding new elements.php index 62239965f..b6b9eb11d 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Adding new elements.php +++ b/manual/docs/Working with objects - Component overview - Collection - Adding new elements.php @@ -4,3 +4,12 @@ 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"; + diff --git a/manual/docs/Working with objects - Component overview - Collection - Collection expanding.php b/manual/docs/Working with objects - Component overview - Collection - Collection expanding.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Collection expanding.php +++ b/manual/docs/Working with objects - Component overview - Collection - Collection expanding.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Working with objects - Component overview - Collection - Deleting collection.php b/manual/docs/Working with objects - Component overview - Collection - Deleting collection.php index b8776bc01..997b332e1 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Deleting collection.php +++ b/manual/docs/Working with objects - Component overview - Collection - Deleting collection.php @@ -11,3 +11,11 @@ DELETE FROM phonenumber WHERE id IN (1,2,3, ... ,M)
    It should also be noted that Doctrine is smart enough to perform single-shot-delete per table when transactions are used. So if you are deleting a lot of records and want to optimize the operation just wrap the delete calls in Doctrine_Connection transaction. + + +// delete all users with name 'John' + +$users = $table->findByDql("name LIKE '%John%'"); + +$users->delete(); + diff --git a/manual/docs/Working with objects - Component overview - Collection - Fetching strategies.php b/manual/docs/Working with objects - Component overview - Collection - Fetching strategies.php index a03c5b11d..dc71711eb 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Fetching strategies.php +++ b/manual/docs/Working with objects - Component overview - Collection - Fetching strategies.php @@ -40,3 +40,56 @@ 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/Working with objects - Component overview - Collection - Getting collection count.php b/manual/docs/Working with objects - Component overview - Collection - Getting collection count.php index b69b6fad3..4485a1228 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Getting collection count.php +++ b/manual/docs/Working with objects - Component overview - Collection - Getting collection count.php @@ -1 +1,11 @@ The Doctrine_Collection method count returns the number of elements currently in the collection. + + +$users = $table->findAll(); + +$users->count(); + +// or + +count($users); // Doctrine_Collection implements Countable interface + diff --git a/manual/docs/Working with objects - Component overview - Collection - Introduction.php b/manual/docs/Working with objects - Component overview - Collection - Introduction.php index d446c7a90..2a3cb2703 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Introduction.php +++ b/manual/docs/Working with objects - Component overview - Collection - Introduction.php @@ -5,3 +5,22 @@ When fetching data from database with either DQL API (see Doctrine_Query) or raw 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 +$coll[0]->name = 'Arnold'; + +$coll[1]->name = 'Somebody'; + +// finally save it! +$coll->save(); + diff --git a/manual/docs/Working with objects - Component overview - Collection - Key mapping.php b/manual/docs/Working with objects - Component overview - Collection - Key mapping.php index a8b9cf891..6a3c5ecb2 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Key mapping.php +++ b/manual/docs/Working with objects - Component overview - Collection - Key mapping.php @@ -1,3 +1,35 @@ 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; +} + diff --git a/manual/docs/Working with objects - Component overview - Collection - Loading related records.php b/manual/docs/Working with objects - Component overview - Collection - Loading related records.php index 24b8ebd42..1dfed0b19 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Loading related records.php +++ b/manual/docs/Working with objects - Component overview - Collection - Loading related records.php @@ -1,3 +1,24 @@ Doctrine provides means for effiently 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. + + +$users = $conn->query("FROM User"); + +// now lets load phonenumbers for all users + +$users->loadRelated("Phonenumber"); + +foreach($users as $user) { + print $user->Phonenumber->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->name; +} + diff --git a/manual/docs/Working with objects - Component overview - Collection - Saving the collection.php b/manual/docs/Working with objects - Component overview - Collection - Saving the collection.php index 0d937c242..cd4e65abb 100644 --- a/manual/docs/Working with objects - Component overview - Collection - Saving the collection.php +++ b/manual/docs/Working with objects - Component overview - Collection - Saving the collection.php @@ -1 +1,11 @@ As with records the collection can be saved by calling the save method. + + +$users = $table->findAll(); + +$users[0]->name = "Jack Daniels"; + +$users[1]->name = "John Locke"; + +$users->save(); + diff --git a/manual/docs/Working with objects - Component overview - Connection - Available drivers.php b/manual/docs/Working with objects - Component overview - Connection - Available drivers.php index 041a5033f..779829fdd 100644 --- a/manual/docs/Working with objects - Component overview - Connection - Available drivers.php +++ b/manual/docs/Working with objects - Component overview - Connection - Available drivers.php @@ -9,3 +9,4 @@ Doctrine has drivers for every PDO-supported database. The supported databases a
  • PostgreSQL
  • Sqlite + diff --git a/manual/docs/Working with objects - Component overview - Connection - Availible drivers.php b/manual/docs/Working with objects - Component overview - Connection - Availible drivers.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Working with objects - Component overview - Connection - Availible drivers.php +++ b/manual/docs/Working with objects - Component overview - Connection - Availible drivers.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Working with objects - Component overview - Connection - Flushing the connection.php b/manual/docs/Working with objects - Component overview - Connection - Flushing the connection.php index 12f1b8e42..d3a0757c0 100644 --- a/manual/docs/Working with objects - Component overview - Connection - Flushing the connection.php +++ b/manual/docs/Working with objects - Component overview - Connection - Flushing the connection.php @@ -1,2 +1,14 @@ 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 simple 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(); + diff --git a/manual/docs/Working with objects - Component overview - Connection - Getting a table object.php b/manual/docs/Working with objects - Component overview - Connection - Getting a table object.php index 5a557e304..bddde1ff0 100644 --- a/manual/docs/Working with objects - Component overview - Connection - Getting a table object.php +++ b/manual/docs/Working with objects - Component overview - Connection - Getting a table object.php @@ -1 +1,13 @@ 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'); + diff --git a/manual/docs/Working with objects - Component overview - Connection - Getting connection state.php b/manual/docs/Working with objects - Component overview - Connection - Getting connection state.php index 5d5ebcbe7..671a04b6d 100644 --- a/manual/docs/Working with objects - Component overview - Connection - Getting connection state.php +++ b/manual/docs/Working with objects - Component overview - Connection - Getting connection state.php @@ -1,2 +1,19 @@ Connection state gives you information about how active connection currently is. You can get the current state by calling Doctrine_Connection::getState(). + + +switch($conn->getState()): + case Doctrine_Connection::STATE_ACTIVE: + // connection open and zero open transactions + break; + case Doctrine_Connection::STATE_ACTIVE: + // one open transaction + break; + case Doctrine_Connection::STATE_BUSY: + // multiple open transactions + break; + case Doctrine_Connection::STATE_CLOSED: + // connection closed + break; +endswitch; + diff --git a/manual/docs/Working with objects - Component overview - Connection - Introduction.php b/manual/docs/Working with objects - Component overview - Connection - Introduction.php index 9d62a2446..6e6dd9235 100644 --- a/manual/docs/Working with objects - Component overview - Connection - Introduction.php +++ b/manual/docs/Working with objects - Component overview - Connection - Introduction.php @@ -18,3 +18,5 @@ Doctrine_Connection is a wrapper for database connection. It handles several thi full information of possible errors. + + diff --git a/manual/docs/Working with objects - Component overview - Connection - Querying the database.php b/manual/docs/Working with objects - Component overview - Connection - Querying the database.php index 62cab24de..030399e5c 100644 --- a/manual/docs/Working with objects - Component overview - Connection - Querying the database.php +++ b/manual/docs/Working with objects - Component overview - Connection - Querying the database.php @@ -1 +1,16 @@ 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')); + diff --git a/manual/docs/Working with objects - Component overview - Db - Chaining listeners.php b/manual/docs/Working with objects - Component overview - Db - Chaining listeners.php index af3cfa7b5..85fe6f671 100644 --- a/manual/docs/Working with objects - Component overview - Db - Chaining listeners.php +++ b/manual/docs/Working with objects - Component overview - Db - Chaining listeners.php @@ -5,3 +5,38 @@ For example you might want to add different aspects to your Doctrine_Db instance caching, query profiling etc.

    + + + +// using PDO dsn for connecting sqlite memory table + +$dbh = Doctrine_Db::getConnection('sqlite::memory:'); + +class Counter extends Doctrine_Db_EventListener { + private $queries = 0; + + public function onQuery(Doctrine_Db_Event $event) { + $this->queries++; + } + public function count() { + return count($this->queries); + } +} +class OutputLogger extends Doctrine_Overloadable { + public function __call($m, $a) { + print $m." called!"; + } +} +$counter = new Counter(); + +$dbh->addListener($counter); +$dbh->addListener(new OutputLogger()); + +$dbh->query("SELECT * FROM foo"); +// prints: +// onPreQuery called! +// onQuery called! + +print $counter->count(); // 1 + + diff --git a/manual/docs/Working with objects - Component overview - Db - Connecting to a database.php b/manual/docs/Working with objects - Component overview - Db - Connecting to a database.php index 7f160addf..670d2a3c0 100644 --- a/manual/docs/Working with objects - Component overview - Db - Connecting to a database.php +++ b/manual/docs/Working with objects - Component overview - Db - Connecting to a database.php @@ -54,3 +54,5 @@ try { ?>"; renderCode($str); ?> + + diff --git a/manual/docs/Working with objects - Component overview - Db - Introduction.php b/manual/docs/Working with objects - Component overview - Db - Introduction.php index a1b30849f..46e7fb65f 100644 --- a/manual/docs/Working with objects - Component overview - Db - Introduction.php +++ b/manual/docs/Working with objects - Component overview - Db - Introduction.php @@ -8,3 +8,4 @@ Doctrine_Db fits perfectly for application using for example page caching. 3. It has many short cuts for commonly used fetching methods like Doctrine_Db::fetchOne().

    4. Supports PEAR-like data source names as well as PDO data source names. + diff --git a/manual/docs/Working with objects - Component overview - Db - Using event listeners.php b/manual/docs/Working with objects - Component overview - Db - Using event listeners.php index 0a1cd5b26..e849fed45 100644 --- a/manual/docs/Working with objects - Component overview - Db - Using event listeners.php +++ b/manual/docs/Working with objects - Component overview - Db - Using event listeners.php @@ -37,3 +37,40 @@ renderCode($str);

    Now the next thing we need to do is bind the eventlistener objects to our database handler.

    + + + +// using PDO dsn for connecting sqlite memory table + +$dbh = Doctrine_Db::getConnection('sqlite::memory:'); + +class MyLogger extends Doctrine_Db_EventListener { + public function onPreQuery(Doctrine_Db_Event $event) { + print "database is going to be queried!"; + } + public function onQuery(Doctrine_Db_Event $event) { + print "executed: " . $event->getQuery(); + } +} + +$dbh->setListener(new MyLogger()); + +$dbh->query("SELECT * FROM foo"); +// prints: +// database is going to be queried +// executed: SELECT * FROM foo + + +class MyLogger2 extends Doctrine_Overloadable { + public function __call($m, $a) { + print $m." called!"; + } +} + +$dbh->setListener(new MyLogger2()); + +$dbh->exec("DELETE FROM foo"); +// prints: +// onPreExec called! +// onExec called! + diff --git a/manual/docs/Working with objects - Component overview - Exceptions - List of exceptions.php b/manual/docs/Working with objects - Component overview - Exceptions - List of exceptions.php index f0d55afd2..453f5fd76 100644 --- a/manual/docs/Working with objects - Component overview - Exceptions - List of exceptions.php +++ b/manual/docs/Working with objects - Component overview - Exceptions - List of exceptions.php @@ -22,3 +22,4 @@ Doctrine_Table_Exception thrown when user tries to initialize a ne Doctrine_Mapping_Exception thrown when user tries to get a foreign key object but the mapping is not done right + diff --git a/manual/docs/Working with objects - Component overview - Exceptions - Overview.php b/manual/docs/Working with objects - Component overview - Exceptions - Overview.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Working with objects - Component overview - Exceptions - Overview.php +++ b/manual/docs/Working with objects - Component overview - Exceptions - Overview.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Working with objects - Component overview - Manager - Introduction.php b/manual/docs/Working with objects - Component overview - Manager - Introduction.php index 18ebaf169..e6c4f534b 100644 --- a/manual/docs/Working with objects - Component overview - Manager - Introduction.php +++ b/manual/docs/Working with objects - Component overview - Manager - Introduction.php @@ -1 +1,2 @@ Doctrine_Manager is the heart of every Doctrine based application. Doctrine_Manager handles all connections (database connections). + diff --git a/manual/docs/Working with objects - Component overview - Manager - Managing connections.php b/manual/docs/Working with objects - Component overview - Manager - Managing connections.php index 9c40720ab..b97a00edb 100644 --- a/manual/docs/Working with objects - Component overview - Manager - Managing connections.php +++ b/manual/docs/Working with objects - Component overview - Manager - Managing connections.php @@ -1,3 +1,29 @@ 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/Working with objects - Component overview - Manager - Opening a new connection.php b/manual/docs/Working with objects - Component overview - Manager - Opening a new connection.php index cdc125e62..4b3759813 100644 --- a/manual/docs/Working with objects - Component overview - Manager - Opening a new connection.php +++ b/manual/docs/Working with objects - Component overview - Manager - Opening a new connection.php @@ -1,3 +1,22 @@ 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(); + diff --git a/manual/docs/Working with objects - Component overview - Query - Aggregate functions.php b/manual/docs/Working with objects - Component overview - Query - Aggregate functions.php index e69de29bb..f8ffe17ff 100644 --- a/manual/docs/Working with objects - Component overview - Query - Aggregate functions.php +++ b/manual/docs/Working with objects - Component overview - Query - Aggregate functions.php @@ -0,0 +1,16 @@ + + +$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/Working with objects - Component overview - Query - Bound parameters.php b/manual/docs/Working with objects - Component overview - Query - Bound parameters.php index e69de29bb..9c47359e6 100644 --- a/manual/docs/Working with objects - Component overview - Query - Bound parameters.php +++ b/manual/docs/Working with objects - Component overview - Query - Bound parameters.php @@ -0,0 +1,7 @@ + + +$query->from("User") + ->where("User.name = ?"); + +$query->execute(array('Jack Daniels')); + diff --git a/manual/docs/Working with objects - Component overview - Query - DQL - SQL conversion.php b/manual/docs/Working with objects - Component overview - Query - DQL - SQL conversion.php index 58592aada..8c597c207 100644 --- a/manual/docs/Working with objects - Component overview - Query - DQL - SQL conversion.php +++ b/manual/docs/Working with objects - Component overview - Query - DQL - SQL conversion.php @@ -55,3 +55,4 @@ foreach($e as $line) { renderQueries($str); */ ?> + diff --git a/manual/docs/Working with objects - Component overview - Query - FROM - selecting tables.php b/manual/docs/Working with objects - Component overview - Query - FROM - selecting tables.php index 0b6a273c8..28c9e48bf 100644 --- a/manual/docs/Working with objects - Component overview - Query - FROM - selecting tables.php +++ b/manual/docs/Working with objects - Component overview - Query - FROM - selecting tables.php @@ -17,3 +17,28 @@ renderCode(""); ?>

    The following example shows how to use leftJoin and innerJoin methods:

    + + +// find all groups + +$coll = $q->from("FROM Group"); + +// find all users and user emails + +$coll = $q->from("FROM User u LEFT JOIN u.Email e"); + +// find all users and user emails with only user name and +// age + email address loaded + +$coll = $q->select('u.name, u.age, e.address') + ->from('FROM User u') + ->leftJoin('u.Email e') + ->execute(); + +// find all users, user email and user phonenumbers + +$coll = $q->from('FROM User u') + ->innerJoin('u.Email e') + ->innerJoin('u.Phonenumber p') + ->execute(); + diff --git a/manual/codes/Working with objects - Component overview - Query - Fetching strategies.php b/manual/docs/Working with objects - Component overview - Query - Fetching strategies.php similarity index 89% rename from manual/codes/Working with objects - Component overview - Query - Fetching strategies.php rename to manual/docs/Working with objects - Component overview - Query - Fetching strategies.php index 8654ac3b5..beb54fe92 100644 --- a/manual/codes/Working with objects - Component overview - Query - Fetching strategies.php +++ b/manual/docs/Working with objects - Component overview - Query - Fetching strategies.php @@ -1,4 +1,5 @@ - // select all users and load the data directly (Immediate fetching strategy) $coll = $conn->query("FROM User-I"); @@ -22,4 +23,4 @@ $coll = $conn->query("FROM User-L"); // or $coll = $conn->query("FROM User-LAZY"); -?> + diff --git a/manual/docs/Working with objects - Component overview - Query - HAVING conditions.php b/manual/docs/Working with objects - Component overview - Query - HAVING conditions.php index 1fb8206e4..413e320ec 100644 --- a/manual/docs/Working with objects - Component overview - Query - HAVING conditions.php +++ b/manual/docs/Working with objects - Component overview - Query - HAVING conditions.php @@ -12,3 +12,4 @@ renderCode("having('COUNT(p.id) > 3'); ?>"); ?> + diff --git a/manual/docs/Working with objects - Component overview - Query - Introduction.php b/manual/docs/Working with objects - Component overview - Query - Introduction.php index a798f91b7..9294fd6bd 100644 --- a/manual/docs/Working with objects - Component overview - Query - Introduction.php +++ b/manual/docs/Working with objects - Component overview - Query - Introduction.php @@ -7,3 +7,16 @@ For more info about DQL see the actual DQL chapter. Doctrine_Query along with Doctrine_Expression provide an easy-to-use wrapper for writing DQL queries. Creating a new query object can be done by either using the new operator or by calling create method. The create method exists for allowing easy method call chaining. + + +// initalizing a new Doctrine_Query (using the current connection) +$q = new Doctrine_Query(); + +// initalizing a new Doctrine_Query (using custom connection parameter) +// here $conn is an instance of Doctrine_Connection +$q = new Doctrine_Query($conn); + +// an example using the create method +// here we simple fetch all users +$users = Doctrine_Query::create()->from('User')->execute(); + diff --git a/manual/docs/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php b/manual/docs/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php index e69de29bb..ffd0993fc 100644 --- a/manual/docs/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php +++ b/manual/docs/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php @@ -0,0 +1,14 @@ + + + +// find the first ten users and associated emails + +$q = new Doctrine_Query(); + +$coll = $q->from('User u LEFT JOIN u.Email e')->limit(10); + +// find the first ten users starting from the user number 5 + +$coll = $q->from('User u')->limit(10)->offset(5); + + diff --git a/manual/codes/Working with objects - Component overview - Query - Lazy property fetching.php b/manual/docs/Working with objects - Component overview - Query - Lazy property fetching.php similarity index 77% rename from manual/codes/Working with objects - Component overview - Query - Lazy property fetching.php rename to manual/docs/Working with objects - Component overview - Query - Lazy property fetching.php index 28660b72e..2608e2c30 100644 --- a/manual/codes/Working with objects - Component overview - Query - Lazy property fetching.php +++ b/manual/docs/Working with objects - Component overview - Query - Lazy property fetching.php @@ -1,6 +1,7 @@ - // retrieve all users with only their properties id and name loaded $users = $conn->query("FROM User(id, name)"); -?> + diff --git a/manual/docs/Working with objects - Component overview - Query - Method overloading.php b/manual/docs/Working with objects - Component overview - Query - Method overloading.php index 1dfc1c89e..7118ce5e1 100644 --- a/manual/docs/Working with objects - Component overview - Query - Method overloading.php +++ b/manual/docs/Working with objects - Component overview - Query - Method overloading.php @@ -1 +1,22 @@ 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/Working with objects - Component overview - Query - ORDER BY - sorting query results.php b/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php index 642ec5d6e..0256f2273 100644 --- a/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php +++ b/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php @@ -1 +1,22 @@ ORDER BY - part works in much same way as SQL ORDER BY. + + +$q = new Doctrine_Query(); + +// find all users, sort by name descending + +$users = $q->from('User u')->orderby('u.name DESC'); + +// find all users sort by name ascending + +$users = $q->from('User u')->orderby('u.name ASC'); + +// find all users and their emails, sort by email address in ascending order + +$users = $q->from('User u')->leftJoin('u.Email e')->orderby('e.address'); + +// find all users and their emails, sort by user name and email address + +$users = $q->from('User u')->leftJoin('u.Email e') + ->addOrderby('u.name')->addOrderby('e.address'); + diff --git a/manual/docs/Working with objects - Component overview - Query - Relation operators.php b/manual/docs/Working with objects - Component overview - Query - Relation operators.php index 1ebde18d7..a9aabdde7 100644 --- a/manual/docs/Working with objects - Component overview - Query - Relation operators.php +++ b/manual/docs/Working with objects - Component overview - Query - Relation operators.php @@ -5,3 +5,19 @@ for SQL INNER JOINs. Basically you should use dot operator if you want for examp 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/Working with objects - Component overview - Query - WHERE - setting query conditions.php b/manual/docs/Working with objects - Component overview - Query - WHERE - setting query conditions.php index 07f71049c..b92f2f9f3 100644 --- a/manual/docs/Working with objects - Component overview - Query - WHERE - setting query conditions.php +++ b/manual/docs/Working with objects - Component overview - Query - WHERE - setting query conditions.php @@ -57,3 +57,5 @@ renderCode("where(\"u.name LIKE '%Jack%' OR u.name LIKE '%John%') AND e.address LIKE '%@drinkmore.info'\"); ?>"); ?> + + diff --git a/manual/docs/Working with objects - Component overview - RawSql - Adding components.php b/manual/docs/Working with objects - Component overview - RawSql - Adding components.php index 39919f33e..8f30e9f5f 100644 --- a/manual/docs/Working with objects - Component overview - RawSql - Adding components.php +++ b/manual/docs/Working with objects - Component overview - RawSql - Adding components.php @@ -4,3 +4,17 @@ wrap all the columns in curly brackets but we also specify what tables associate First we specify that table entity maps to record class 'Entity'

    Then we specify that table phonenumber maps to Entity.Phonenumber (meaning phonenumber associated with an entity) + + +$query = new Doctrine_RawSql($conn); + +$query->parseQuery("SELECT {entity.*}, {phonenumber.*} + FROM entity + LEFT JOIN phonenumber + ON phonenumber.entity_id = entity.id"); + +$query->addComponent("entity", "Entity"); +$query->addComponent("phonenumber", "Entity.Phonenumber"); + +$entities = $query->execute(); + diff --git a/manual/docs/Working with objects - Component overview - RawSql - Introduction.php b/manual/docs/Working with objects - Component overview - RawSql - Introduction.php index 2deb1d519..b342e3b41 100644 --- a/manual/docs/Working with objects - Component overview - RawSql - Introduction.php +++ b/manual/docs/Working with objects - Component overview - RawSql - Introduction.php @@ -2,3 +2,4 @@ In Doctrine you may express your queries in the native SQL dialect of your datab This is useful if you want to use the full power of your database vendor's features (like query hints or the CONNECT keyword in Oracle).

    It should be noted that not all the sql is portable. So when you make database portable applications you might want to use the DQL API instead. + diff --git a/manual/docs/Working with objects - Component overview - RawSql - Method overloading.php b/manual/docs/Working with objects - Component overview - RawSql - Method overloading.php index e69de29bb..d8d7ae43f 100644 --- a/manual/docs/Working with objects - Component overview - RawSql - Method overloading.php +++ b/manual/docs/Working with objects - Component overview - RawSql - Method overloading.php @@ -0,0 +1,11 @@ + + +$query = new Doctrine_RawSql($conn); + +$query->select('{entity.name}') + ->from('entity'); + +$query->addComponent("entity", "User"); + +$coll = $query->execute(); + diff --git a/manual/docs/Working with objects - Component overview - RawSql - Using SQL.php b/manual/docs/Working with objects - Component overview - RawSql - Using SQL.php index 5bc392372..a22567f39 100644 --- a/manual/docs/Working with objects - Component overview - RawSql - Using SQL.php +++ b/manual/docs/Working with objects - Component overview - RawSql - Using SQL.php @@ -8,3 +8,11 @@ $q->parseQuery(). There are some differences though: The following example represents a very simple case where no addComponent() calls are needed. Here we select all entities from table entity with all the columns loaded in the records. + + +$query = new Doctrine_RawSql($conn); + +$query->parseQuery("SELECT {entity.name} FROM entity"); + +$entities = $query->execute(); + diff --git a/manual/docs/Working with objects - Component overview - Record - Accessing properties.php b/manual/docs/Working with objects - Component overview - Record - Accessing properties.php index 1ac201eb1..54c744d9c 100644 --- a/manual/docs/Working with objects - Component overview - Record - Accessing properties.php +++ b/manual/docs/Working with objects - Component overview - Record - Accessing properties.php @@ -1,3 +1,25 @@ You can retrieve existing objects (database rows) with Doctrine_Table or Doctrine_Connection. Doctrine_Table provides simple methods like findBySql, findAll and find for finding objects whereas Doctrine_Connection provides complete OQL API for retrieving objects (see chapter 9). + + +$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 through properties + +foreach($user as $key => $value) { + +} + diff --git a/manual/docs/Working with objects - Component overview - Record - Callbacks.php b/manual/docs/Working with objects - Component overview - Record - Callbacks.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Working with objects - Component overview - Record - Callbacks.php +++ b/manual/docs/Working with objects - Component overview - Record - Callbacks.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Working with objects - Component overview - Record - Checking Existence.php b/manual/docs/Working with objects - Component overview - Record - Checking Existence.php index e69de29bb..a3cb7fab4 100644 --- a/manual/docs/Working with objects - Component overview - Record - Checking Existence.php +++ b/manual/docs/Working with objects - Component overview - Record - Checking Existence.php @@ -0,0 +1,11 @@ + + +$record = new User(); + +$record->exists(); // false + +$record->name = 'someone'; +$record->save(); + +$record->exists(); // true + diff --git a/manual/docs/Working with objects - Component overview - Record - Creating new records.php b/manual/docs/Working with objects - Component overview - Record - Creating new records.php index efd35dc19..28816254e 100644 --- a/manual/docs/Working with objects - Component overview - Record - Creating new records.php +++ b/manual/docs/Working with objects - Component overview - Record - Creating new records.php @@ -1,3 +1,24 @@ 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(); + diff --git a/manual/docs/Working with objects - Component overview - Record - Deleting records.php b/manual/docs/Working with objects - Component overview - Record - Deleting records.php index f70a095e3..31d99e38f 100644 --- a/manual/docs/Working with objects - Component overview - Record - Deleting records.php +++ b/manual/docs/Working with objects - Component overview - Record - Deleting records.php @@ -1,2 +1,19 @@ 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(); + diff --git a/manual/docs/Working with objects - Component overview - Record - Getting object copy.php b/manual/docs/Working with objects - Component overview - Record - Getting object copy.php index 89858805f..ff008f2ec 100644 --- a/manual/docs/Working with objects - Component overview - Record - Getting object copy.php +++ b/manual/docs/Working with objects - Component overview - Record - Getting object copy.php @@ -1,2 +1,6 @@ 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(); + diff --git a/manual/docs/Working with objects - Component overview - Record - Getting record state.php b/manual/docs/Working with objects - Component overview - Record - Getting record state.php index dc9a5c9d3..76d130cea 100644 --- a/manual/docs/Working with objects - Component overview - Record - Getting record state.php +++ b/manual/docs/Working with objects - Component overview - Record - Getting record state.php @@ -5,3 +5,35 @@ 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. + + +$state = $record->getState(); + +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; +endswitch; + diff --git a/manual/docs/Working with objects - Component overview - Record - Introduction.php b/manual/docs/Working with objects - Component overview - Record - Introduction.php index fc6dc682f..9e1fa695e 100644 --- a/manual/docs/Working with objects - Component overview - Record - Introduction.php +++ b/manual/docs/Working with objects - Component overview - Record - Introduction.php @@ -2,3 +2,4 @@ Doctrine_Record is a wrapper for database row but along with that it speficies w 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. + diff --git a/manual/docs/Working with objects - Component overview - Record - Retrieving existing records.php b/manual/docs/Working with objects - Component overview - Record - Retrieving existing records.php index 0a7afdda4..ade9fb2db 100644 --- a/manual/docs/Working with objects - Component overview - Record - Retrieving existing records.php +++ b/manual/docs/Working with objects - Component overview - Record - Retrieving existing records.php @@ -1,3 +1,27 @@ 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 DQL API and Doctrine_Connection::query method. + + +$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 WHERE User.name LIKE '%John%'"); + diff --git a/manual/docs/Working with objects - Component overview - Record - Serializing.php b/manual/docs/Working with objects - Component overview - Record - Serializing.php index 45a642d0c..ca505e906 100644 --- a/manual/docs/Working with objects - Component overview - Record - Serializing.php +++ b/manual/docs/Working with objects - Component overview - Record - Serializing.php @@ -1,2 +1,8 @@ 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); + diff --git a/manual/docs/Working with objects - Component overview - Record - Updating records.php b/manual/docs/Working with objects - Component overview - Record - Updating records.php index 5194632e3..c68b264ed 100644 --- a/manual/docs/Working with objects - Component overview - Record - Updating records.php +++ b/manual/docs/Working with objects - Component overview - Record - Updating records.php @@ -1,3 +1,16 @@ Updating objects is very easy, you just call the Doctrine_Record::save() method. The other way (perhaps even easier) 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(); +} + diff --git a/manual/docs/Working with objects - Component overview - Table - Custom finders.php b/manual/docs/Working with objects - Component overview - Table - Custom finders.php index 000badb0b..bed97fb58 100644 --- a/manual/docs/Working with objects - Component overview - Table - Custom finders.php +++ b/manual/docs/Working with objects - Component overview - Table - Custom finders.php @@ -1,2 +1,27 @@ 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"); + + diff --git a/manual/docs/Working with objects - Component overview - Table - Custom table classes.php b/manual/docs/Working with objects - Component overview - Table - Custom table classes.php index f267c2ac9..836902abd 100644 --- a/manual/docs/Working with objects - Component overview - Table - Custom table classes.php +++ b/manual/docs/Working with objects - Component overview - Table - Custom table classes.php @@ -1,2 +1,16 @@ 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 { } + + + diff --git a/manual/docs/Working with objects - Component overview - Table - Finder methods.php b/manual/docs/Working with objects - Component overview - Table - Finder methods.php index b3198484e..c1e041d77 100644 --- a/manual/docs/Working with objects - Component overview - Table - Finder methods.php +++ b/manual/docs/Working with objects - Component overview - Table - Finder methods.php @@ -1,2 +1,24 @@ 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; +} + diff --git a/manual/docs/Working with objects - Component overview - Table - Getting relation objects.php b/manual/docs/Working with objects - Component overview - Table - Getting relation objects.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Working with objects - Component overview - Table - Getting relation objects.php +++ b/manual/docs/Working with objects - Component overview - Table - Getting relation objects.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Working with objects - Component overview - Table - Getting table information.php b/manual/docs/Working with objects - Component overview - Table - Getting table information.php index e69de29bb..762f16b1e 100644 --- a/manual/docs/Working with objects - Component overview - Table - Getting table information.php +++ b/manual/docs/Working with objects - Component overview - Table - Getting table information.php @@ -0,0 +1,12 @@ + + +$table = $conn->getTable('User'); + +// getting column names + +$names = $table->getColumnNames(); + +// getting column information + +$columns = $table->getColumns(); + diff --git a/manual/docs/Working with objects - Component overview - Table - Introduction.php b/manual/docs/Working with objects - Component overview - Table - Introduction.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Working with objects - Component overview - Table - Introduction.php +++ b/manual/docs/Working with objects - Component overview - Table - Introduction.php @@ -0,0 +1 @@ + diff --git a/manual/docs/Working with objects - Dealing with relations - Creating related records.php b/manual/docs/Working with objects - Dealing with relations - Creating related records.php index 6955476a6..07bbd529b 100644 --- a/manual/docs/Working with objects - Dealing with relations - Creating related records.php +++ b/manual/docs/Working with objects - Dealing with relations - Creating related records.php @@ -1 +1,16 @@ When accessing related records and if those records do not exists Doctrine automatically creates new records. + + +// NOTE: related record have always the first letter in uppercase +$email = $user->Email; + +$email->address = 'jackdaniels@drinkmore.info'; + +$user->save(); + +// alternative: + +$user->Email->address = 'jackdaniels@drinkmore.info'; + +$user->save(); + diff --git a/manual/docs/Working with objects - Dealing with relations - Deleting related records.php b/manual/docs/Working with objects - Dealing with relations - Deleting related records.php index 37f75d0c2..56156563c 100644 --- a/manual/docs/Working with objects - Dealing with relations - Deleting related records.php +++ b/manual/docs/Working with objects - Dealing with relations - Deleting related records.php @@ -1,2 +1,12 @@ You can delete related records individually be calling delete() on each record. If you want to delete a whole record graph just call delete on the owner record. + + +$user->Email->delete(); + +$user->Phonenumber[3]->delete(); + +// deleting user and all related objects: + +$user->delete(); + diff --git a/manual/docs/Working with objects - Dealing with relations - Retrieving related records.php b/manual/docs/Working with objects - Dealing with relations - Retrieving related records.php index 903277284..43ffb533f 100644 --- a/manual/docs/Working with objects - Dealing with relations - Retrieving related records.php +++ b/manual/docs/Working with objects - Dealing with relations - Retrieving related records.php @@ -1,2 +1,10 @@ You can retrieve related records by the very same Doctrine_Record methods you've already propably used for accessing record properties. When accessing related record you just simply use the class names. + + +print $user->Email['address']; + +print $user->Phonenumber[0]->phonenumber; + +print $user->Group[0]->name; + diff --git a/manual/docs/Working with objects - Dealing with relations - Updating related records.php b/manual/docs/Working with objects - Dealing with relations - Updating related records.php index 687028d7d..9eab04af0 100644 --- a/manual/docs/Working with objects - Dealing with relations - Updating related records.php +++ b/manual/docs/Working with objects - Dealing with relations - Updating related records.php @@ -1,2 +1,12 @@ 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 + diff --git a/manual/docs/Working with objects - Dealing with relations - Working with associations.php b/manual/docs/Working with objects - Dealing with relations - Working with associations.php index e69de29bb..8b1378917 100644 --- a/manual/docs/Working with objects - Dealing with relations - Working with associations.php +++ b/manual/docs/Working with objects - Dealing with relations - Working with associations.php @@ -0,0 +1 @@ +