Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
33c76f62
Commit
33c76f62
authored
Mar 23, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactorings
parent
7a1beb5b
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
108 additions
and
97 deletions
+108
-97
Doctrine.php
lib/Doctrine.php
+5
-4
ClassMetadata.php
lib/Doctrine/ClassMetadata.php
+7
-7
Factory.php
lib/Doctrine/ClassMetadata/Factory.php
+2
-2
Collection.php
lib/Doctrine/Collection.php
+23
-20
Connection.php
lib/Doctrine/Connection.php
+3
-3
Export.php
lib/Doctrine/Export.php
+1
-1
Mapper.php
lib/Doctrine/Mapper.php
+1
-1
DefaultStrategy.php
lib/Doctrine/Mapper/DefaultStrategy.php
+0
-21
JoinedStrategy.php
lib/Doctrine/Mapper/JoinedStrategy.php
+5
-4
Strategy.php
lib/Doctrine/Mapper/Strategy.php
+21
-0
Abstract.php
lib/Doctrine/Query/Abstract.php
+1
-1
Record.php
lib/Doctrine/Record.php
+2
-2
AllTests.php
tests/Orm/Component/AllTests.php
+1
-1
CollectionTest.php
tests/Orm/Component/CollectionTest.php
+9
-10
TestTest.php
tests/Orm/Component/TestTest.php
+7
-0
admins.php
tests/fixtures/forum/common/admins.php
+1
-5
ForumAdministrator.php
tests/models/forum/ForumAdministrator.php
+3
-1
ForumUser.php
tests/models/forum/ForumUser.php
+3
-3
ClassTableInheritanceTestCase.php
tests_old/ClassTableInheritanceTestCase.php
+1
-1
CollectionTestCase.php
tests_old/CollectionTestCase.php
+2
-2
JoinedTestCase.php
tests_old/Inheritance/JoinedTestCase.php
+1
-1
SingleTableTestCase.php
tests_old/Inheritance/SingleTableTestCase.php
+1
-1
TablePerClassTestCase.php
tests_old/Inheritance/TablePerClassTestCase.php
+1
-1
FactoryTestCase.php
tests_old/Metadata/FactoryTestCase.php
+2
-2
697TestCase.php
tests_old/Ticket/697TestCase.php
+1
-1
BaseSymfonyRecord.php
tests_old/models/BaseSymfonyRecord.php
+1
-0
Entity.php
tests_old/models/Entity.php
+1
-1
InheritanceDealUser.php
tests_old/models/InheritanceDealUser.php
+1
-1
RelationTest.php
tests_old/models/RelationTest.php
+1
-0
No files found.
lib/Doctrine.php
View file @
33c76f62
...
@@ -567,27 +567,28 @@ final class Doctrine
...
@@ -567,27 +567,28 @@ final class Doctrine
/**
/**
* INHERITANCE TYPE CONSTANTS.
* INHERITANCE TYPE CONSTANTS.
*/
*/
const
INHERITANCE_TYPE_NONE
=
0
;
/**
/**
* Constant for Single Table Inheritance.
* Constant for Single Table Inheritance.
*
*
* @see http://martinfowler.com/eaaCatalog/singleTableInheritance.html
* @see http://martinfowler.com/eaaCatalog/singleTableInheritance.html
*/
*/
const
INHERITANCETYPE_SINGLE_TABLE
=
1
;
const
INHERITANCE
_
TYPE_SINGLE_TABLE
=
1
;
/**
/**
* Constant for Class Table Inheritance.
* Constant for Class Table Inheritance.
*
*
* @see http://martinfowler.com/eaaCatalog/classTableInheritance.html
* @see http://martinfowler.com/eaaCatalog/classTableInheritance.html
*/
*/
const
INHERITANCETYPE_JOINED
=
2
;
const
INHERITANCE
_
TYPE_JOINED
=
2
;
/**
/**
* Constant for Concrete Table Inheritance.
* Constant for Concrete Table Inheritance.
*
*
* @see http://martinfowler.com/eaaCatalog/concreteTableInheritance.html
* @see http://martinfowler.com/eaaCatalog/concreteTableInheritance.html
*/
*/
const
INHERITANCETYPE_TABLE_PER_CLASS
=
3
;
const
INHERITANCE
_
TYPE_TABLE_PER_CLASS
=
3
;
/**
/**
...
...
lib/Doctrine/ClassMetadata.php
View file @
33c76f62
...
@@ -87,7 +87,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
...
@@ -87,7 +87,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*
*
* @var integer
* @var integer
*/
*/
protected
$_inheritanceType
=
Doctrine
::
INHERITANCE
TYPE_TABLE_PER_CLASS
;
protected
$_inheritanceType
=
Doctrine
::
INHERITANCE
_TYPE_NONE
;
/**
/**
* An array containing all behaviors attached to the class.
* An array containing all behaviors attached to the class.
...
@@ -1157,11 +1157,11 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
...
@@ -1157,11 +1157,11 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
*/
public
function
setInheritanceType
(
$type
,
array
$options
=
array
())
public
function
setInheritanceType
(
$type
,
array
$options
=
array
())
{
{
if
(
$type
==
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
)
{
if
(
$type
==
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
)
{
$this
->
_checkRequiredDiscriminatorOptions
(
$options
);
$this
->
_checkRequiredDiscriminatorOptions
(
$options
);
}
else
if
(
$type
==
Doctrine
::
INHERITANCETYPE_JOINED
)
{
}
else
if
(
$type
==
Doctrine
::
INHERITANCE
_
TYPE_JOINED
)
{
$this
->
_checkRequiredDiscriminatorOptions
(
$options
);
$this
->
_checkRequiredDiscriminatorOptions
(
$options
);
}
else
if
(
$type
==
Doctrine
::
INHERITANCETYPE_TABLE_PER_CLASS
)
{
}
else
if
(
$type
==
Doctrine
::
INHERITANCE
_
TYPE_TABLE_PER_CLASS
)
{
// concrete table inheritance ...
// concrete table inheritance ...
}
else
{
}
else
{
throw
new
Doctrine_ClassMetadata_Exception
(
"Invalid inheritance type '
$type
'."
);
throw
new
Doctrine_ClassMetadata_Exception
(
"Invalid inheritance type '
$type
'."
);
...
@@ -1268,7 +1268,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
...
@@ -1268,7 +1268,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
// If the class is part of a Single Table Inheritance hierarchy, collect the fields
// If the class is part of a Single Table Inheritance hierarchy, collect the fields
// of all classes in the hierarchy.
// of all classes in the hierarchy.
if
(
$this
->
_inheritanceType
==
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
)
{
if
(
$this
->
_inheritanceType
==
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
)
{
$parents
=
$this
->
getOption
(
'parents'
);
$parents
=
$this
->
getOption
(
'parents'
);
if
(
$parents
)
{
if
(
$parents
)
{
$rootClass
=
$this
->
_conn
->
getClassMetadata
(
array_pop
(
$parents
));
$rootClass
=
$this
->
_conn
->
getClassMetadata
(
array_pop
(
$parents
));
...
@@ -1280,7 +1280,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
...
@@ -1280,7 +1280,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
$subClassMetadata
=
$this
->
_conn
->
getClassMetadata
(
$subClass
);
$subClassMetadata
=
$this
->
_conn
->
getClassMetadata
(
$subClass
);
$allColumns
=
array_merge
(
$allColumns
,
$subClassMetadata
->
getColumns
());
$allColumns
=
array_merge
(
$allColumns
,
$subClassMetadata
->
getColumns
());
}
}
}
else
if
(
$this
->
_inheritanceType
==
Doctrine
::
INHERITANCETYPE_JOINED
)
{
}
else
if
(
$this
->
_inheritanceType
==
Doctrine
::
INHERITANCE
_
TYPE_JOINED
)
{
// Remove inherited, non-pk fields. They're not in the table of this class
// Remove inherited, non-pk fields. They're not in the table of this class
foreach
(
$allColumns
as
$name
=>
$definition
)
{
foreach
(
$allColumns
as
$name
=>
$definition
)
{
if
(
isset
(
$definition
[
'primary'
])
&&
$definition
[
'primary'
]
===
true
)
{
if
(
isset
(
$definition
[
'primary'
])
&&
$definition
[
'primary'
]
===
true
)
{
...
@@ -1293,7 +1293,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
...
@@ -1293,7 +1293,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
unset
(
$allColumns
[
$name
]);
unset
(
$allColumns
[
$name
]);
}
}
}
}
}
else
if
(
$this
->
_inheritanceType
==
Doctrine
::
INHERITANCETYPE_TABLE_PER_CLASS
)
{
}
else
if
(
$this
->
_inheritanceType
==
Doctrine
::
INHERITANCE
_
TYPE_TABLE_PER_CLASS
)
{
// If this is a subclass, just remove existing autoincrement options on the pk
// If this is a subclass, just remove existing autoincrement options on the pk
if
(
$this
->
getParentClasses
())
{
if
(
$this
->
getParentClasses
())
{
foreach
(
$allColumns
as
$name
=>
$definition
)
{
foreach
(
$allColumns
as
$name
=>
$definition
)
{
...
...
lib/Doctrine/ClassMetadata/Factory.php
View file @
33c76f62
...
@@ -114,7 +114,7 @@ class Doctrine_ClassMetadata_Factory
...
@@ -114,7 +114,7 @@ class Doctrine_ClassMetadata_Factory
$this
->
_addInheritedFields
(
$subClass
,
$parent
);
$this
->
_addInheritedFields
(
$subClass
,
$parent
);
$this
->
_addInheritedRelations
(
$subClass
,
$parent
);
$this
->
_addInheritedRelations
(
$subClass
,
$parent
);
$this
->
_loadMetadata
(
$subClass
,
$subclassName
);
$this
->
_loadMetadata
(
$subClass
,
$subclassName
);
if
(
$parent
->
getInheritanceType
()
==
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
)
{
if
(
$parent
->
getInheritanceType
()
==
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
)
{
$subClass
->
setTableName
(
$parent
->
getTableName
());
$subClass
->
setTableName
(
$parent
->
getTableName
());
}
}
$classes
[
$subclassName
]
=
$subClass
;
$classes
[
$subclassName
]
=
$subClass
;
...
@@ -208,7 +208,7 @@ class Doctrine_ClassMetadata_Factory
...
@@ -208,7 +208,7 @@ class Doctrine_ClassMetadata_Factory
{
{
switch
(
count
((
array
)
$class
->
getIdentifier
()))
{
switch
(
count
((
array
)
$class
->
getIdentifier
()))
{
case
0
:
case
0
:
if
(
$class
->
getInheritanceType
()
==
Doctrine
::
INHERITANCETYPE_JOINED
&&
if
(
$class
->
getInheritanceType
()
==
Doctrine
::
INHERITANCE
_
TYPE_JOINED
&&
count
(
$class
->
getOption
(
'parents'
))
>
0
)
{
count
(
$class
->
getOption
(
'parents'
))
>
0
)
{
$parents
=
$class
->
getOption
(
'parents'
);
$parents
=
$class
->
getOption
(
'parents'
);
...
...
lib/Doctrine/Collection.php
View file @
33c76f62
...
@@ -81,7 +81,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -81,7 +81,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*
*
* @var string
* @var string
*/
*/
protected
$
keyColumn
;
protected
$
_keyField
;
/**
/**
* Helper variable. Used for fast null value testing.
* Helper variable. Used for fast null value testing.
...
@@ -101,23 +101,26 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -101,23 +101,26 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
* @param string $keyColumn The field name that will be used as the key
* @param string $keyColumn The field name that will be used as the key
* in the collection.
* in the collection.
*/
*/
public
function
__construct
(
$mapper
,
$key
Column
=
null
)
public
function
__construct
(
$mapper
,
$key
Field
=
null
)
{
{
if
(
is_string
(
$mapper
))
{
if
(
is_string
(
$mapper
))
{
$mapper
=
Doctrine_Manager
::
getInstance
()
->
getMapper
(
$mapper
);
$mapper
=
Doctrine_Manager
::
getInstance
()
->
getMapper
(
$mapper
);
}
}
$this
->
_mapper
=
$mapper
;
$this
->
_mapper
=
$mapper
;
if
(
$key
Column
===
null
)
{
if
(
$key
Field
===
null
)
{
$key
Column
=
$mapper
->
getClassMetadata
()
->
getBoundQueryPart
(
'indexBy'
);
$key
Field
=
$mapper
->
getClassMetadata
()
->
getBoundQueryPart
(
'indexBy'
);
}
}
if
(
$key
Column
===
null
)
{
if
(
$key
Field
===
null
)
{
$key
Column
=
$mapper
->
getClassMetadata
()
->
getAttribute
(
Doctrine
::
ATTR_COLL_KEY
);
$key
Field
=
$mapper
->
getClassMetadata
()
->
getAttribute
(
Doctrine
::
ATTR_COLL_KEY
);
}
}
if
(
$keyColumn
!==
null
)
{
if
(
$keyField
!==
null
)
{
$this
->
keyColumn
=
$keyColumn
;
if
(
!
$this
->
_mapper
->
getClassMetadata
()
->
hasField
(
$keyField
))
{
throw
new
Doctrine_Collection_Exception
(
"Invalid field '
$keyField
' can't be uses as key."
);
}
$this
->
_keyField
=
$keyField
;
}
}
}
}
...
@@ -218,32 +221,32 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -218,32 +221,32 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
}
}
if
(
$keyColumn
!==
null
)
{
if
(
$keyColumn
!==
null
)
{
$this
->
keyColumn
=
$keyColumn
;
$this
->
_keyField
=
$keyColumn
;
}
}
}
}
/**
/**
* setKey
Column
* setKey
Field
* sets the key column for this collection
* sets the key column for this collection
*
*
* @param string $column
* @param string $column
* @return Doctrine_Collection
* @return Doctrine_Collection
*/
*/
public
function
setKey
Column
(
$column
)
public
function
setKey
Field
(
$fieldName
)
{
{
$this
->
keyColumn
=
$column
;
$this
->
_keyField
=
$fieldName
;
return
$this
;
return
$this
;
}
}
/**
/**
* getKey
Column
* getKey
Field
* returns the name of the key column
* returns the name of the key column
*
*
* @return string
* @return string
*/
*/
public
function
getKey
Column
()
public
function
getKey
Field
()
{
{
return
$this
->
keyColumn
;
return
$this
->
_keyField
;
}
}
/**
/**
...
@@ -408,8 +411,8 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -408,8 +411,8 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$this
->
data
[
$key
]
=
$record
;
$this
->
data
[
$key
]
=
$record
;
}
}
if
(
isset
(
$this
->
keyColumn
))
{
if
(
isset
(
$this
->
_keyField
))
{
$record
->
set
(
$this
->
keyColumn
,
$key
);
$record
->
set
(
$this
->
_keyField
,
$key
);
}
}
return
$record
;
return
$record
;
...
@@ -535,10 +538,10 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -535,10 +538,10 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
}
}
// why is this not checked when the keyColumn is set?
// why is this not checked when the keyColumn is set?
if
(
isset
(
$this
->
keyColumn
))
{
if
(
isset
(
$this
->
_keyField
))
{
$value
=
$record
->
get
(
$this
->
keyColumn
);
$value
=
$record
->
get
(
$this
->
_keyField
);
if
(
$value
===
null
)
{
if
(
$value
===
null
)
{
throw
new
Doctrine_Collection_Exception
(
"Couldn't create collection index. Record field '"
.
$this
->
keyColumn
.
"' was null."
);
throw
new
Doctrine_Collection_Exception
(
"Couldn't create collection index. Record field '"
.
$this
->
_keyField
.
"' was null."
);
}
}
$this
->
data
[
$value
]
=
$record
;
$this
->
data
[
$value
]
=
$record
;
}
else
{
}
else
{
...
...
lib/Doctrine/Connection.php
View file @
33c76f62
...
@@ -1144,11 +1144,11 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
...
@@ -1144,11 +1144,11 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
} else {
} else {
// instantiate correct mapper type
// instantiate correct mapper type
$inheritanceType = $metadata->getInheritanceType();
$inheritanceType = $metadata->getInheritanceType();
if ($inheritanceType == Doctrine::INHERITANCETYPE_JOINED) {
if ($inheritanceType == Doctrine::INHERITANCE
_
TYPE_JOINED) {
$mapper = new Doctrine_Mapper_Joined($entityName, $metadata);
$mapper = new Doctrine_Mapper_Joined($entityName, $metadata);
} else if ($inheritanceType == Doctrine::INHERITANCETYPE_SINGLE_TABLE) {
} else if ($inheritanceType == Doctrine::INHERITANCE
_
TYPE_SINGLE_TABLE) {
$mapper = new Doctrine_Mapper_SingleTable($entityName, $metadata);
$mapper = new Doctrine_Mapper_SingleTable($entityName, $metadata);
} else if ($inheritanceType == Doctrine::INHERITANCETYPE_TABLE_PER_CLASS) {
} else if ($inheritanceType == Doctrine::INHERITANCE
_
TYPE_TABLE_PER_CLASS) {
$mapper = new Doctrine_Mapper_TablePerClass($entityName, $metadata);
$mapper = new Doctrine_Mapper_TablePerClass($entityName, $metadata);
} else {
} else {
throw new Doctrine_Connection_Exception("Unknown inheritance type '$inheritanceType'. Can't create mapper.");
throw new Doctrine_Connection_Exception("Unknown inheritance type '$inheritanceType'. Can't create mapper.");
...
...
lib/Doctrine/Export.php
View file @
33c76f62
...
@@ -1158,7 +1158,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1158,7 +1158,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
// In Class Table Inheritance we have to make sure that ALL tables are exported
// In Class Table Inheritance we have to make sure that ALL tables are exported
// as soon as ONE table is exported, because the data of one class is stored
// as soon as ONE table is exported, because the data of one class is stored
// across many tables.
// across many tables.
if
(
$classMetadata
->
getInheritanceType
()
==
Doctrine
::
INHERITANCETYPE_JOINED
)
{
if
(
$classMetadata
->
getInheritanceType
()
==
Doctrine
::
INHERITANCE
_
TYPE_JOINED
)
{
$parents
=
$classMetadata
->
getOption
(
'parents'
);
$parents
=
$classMetadata
->
getOption
(
'parents'
);
foreach
(
$parents
as
$parent
)
{
foreach
(
$parents
as
$parent
)
{
$data
=
$classMetadata
->
getConnection
()
->
getClassMetadata
(
$parent
)
->
getExportableFormat
();
$data
=
$classMetadata
->
getConnection
()
->
getClassMetadata
(
$parent
)
->
getExportableFormat
();
...
...
lib/Doctrine/Mapper.php
View file @
33c76f62
...
@@ -87,7 +87,7 @@ class Doctrine_Mapper
...
@@ -87,7 +87,7 @@ class Doctrine_Mapper
$this
->
_conn
=
$classMetadata
->
getConnection
();
$this
->
_conn
=
$classMetadata
->
getConnection
();
$this
->
_classMetadata
=
$classMetadata
;
$this
->
_classMetadata
=
$classMetadata
;
$this
->
_nullObject
=
Doctrine_Null
::
$INSTANCE
;
$this
->
_nullObject
=
Doctrine_Null
::
$INSTANCE
;
if
(
$classMetadata
->
getInheritanceType
()
==
Doctrine
::
INHERITANCETYPE_JOINED
)
{
if
(
$classMetadata
->
getInheritanceType
()
==
Doctrine
::
INHERITANCE
_
TYPE_JOINED
)
{
$this
->
_mappingStrategy
=
new
Doctrine_Mapper_JoinedStrategy
(
$this
);
$this
->
_mappingStrategy
=
new
Doctrine_Mapper_JoinedStrategy
(
$this
);
}
else
{
}
else
{
$this
->
_mappingStrategy
=
new
Doctrine_Mapper_DefaultStrategy
(
$this
);
$this
->
_mappingStrategy
=
new
Doctrine_Mapper_DefaultStrategy
(
$this
);
...
...
lib/Doctrine/Mapper/DefaultStrategy.php
View file @
33c76f62
...
@@ -58,27 +58,6 @@ class Doctrine_Mapper_DefaultStrategy extends Doctrine_Mapper_Strategy
...
@@ -58,27 +58,6 @@ class Doctrine_Mapper_DefaultStrategy extends Doctrine_Mapper_Strategy
}
}
}
}
/**
* deletes all related composites
* this method is always called internally when a record is deleted
*
* @throws PDOException if something went wrong at database level
* @return void
*/
protected
function
_deleteComposites
(
Doctrine_Record
$record
)
{
$classMetadata
=
$this
->
_mapper
->
getClassMetadata
();
foreach
(
$classMetadata
->
getRelations
()
as
$fk
)
{
if
(
$fk
->
isComposite
())
{
$obj
=
$record
->
get
(
$fk
->
getAlias
());
if
(
$obj
instanceof
Doctrine_Record
&&
$obj
->
state
()
!=
Doctrine_Record
::
STATE_LOCKED
)
{
$obj
->
delete
(
$this
->
_mapper
->
getConnection
());
}
}
}
}
/**
/**
* Inserts a single entity into the database, without any related entities.
* Inserts a single entity into the database, without any related entities.
*
*
...
...
lib/Doctrine/Mapper/JoinedStrategy.php
View file @
33c76f62
...
@@ -135,18 +135,19 @@ class Doctrine_Mapper_JoinedStrategy extends Doctrine_Mapper_Strategy
...
@@ -135,18 +135,19 @@ class Doctrine_Mapper_JoinedStrategy extends Doctrine_Mapper_Strategy
try
{
try
{
$class
=
$this
->
_mapper
->
getClassMetadata
();
$class
=
$this
->
_mapper
->
getClassMetadata
();
$conn
->
beginInternalTransaction
();
$conn
->
beginInternalTransaction
();
$this
->
deleteComposites
(
$record
);
$this
->
_
deleteComposites
(
$record
);
$record
->
state
(
Doctrine_Record
::
STATE_TDIRTY
);
$record
->
state
(
Doctrine_Record
::
STATE_TDIRTY
);
$identifier
=
$this
->
_convertFieldToColumnNames
(
$record
->
identifier
(),
$class
);
$identifier
=
$this
->
_convertFieldToColumnNames
(
$record
->
identifier
(),
$class
);
// run deletions, starting from the class, upwards the hierarchy
$conn
->
delete
(
$class
->
getTableName
(),
$identifier
);
foreach
(
$class
->
getParentClasses
()
as
$parent
)
{
foreach
(
$class
->
getParentClasses
()
as
$parent
)
{
$parentClass
=
$conn
->
getClassMetadata
(
$parent
);
$parentClass
=
$conn
->
getClassMetadata
(
$parent
);
$this
->
_deleteRow
(
$parentClass
->
getTableName
(),
$identifier
);
$this
->
_deleteRow
(
$parentClass
->
getTableName
(),
$identifier
);
}
}
$conn
->
delete
(
$class
->
getTableName
(),
$identifier
);
$record
->
state
(
Doctrine_Record
::
STATE_TCLEAN
);
$record
->
state
(
Doctrine_Record
::
STATE_TCLEAN
);
$this
->
_mapper
->
removeRecord
(
$record
);
$this
->
_mapper
->
removeRecord
(
$record
);
...
...
lib/Doctrine/Mapper/Strategy.php
View file @
33c76f62
...
@@ -60,6 +60,27 @@ abstract class Doctrine_Mapper_Strategy
...
@@ -60,6 +60,27 @@ abstract class Doctrine_Mapper_Strategy
return
$converted
;
return
$converted
;
}
}
/**
* deletes all related composites
* this method is always called internally when a record is deleted
*
* @throws PDOException if something went wrong at database level
* @return void
*/
protected
function
_deleteComposites
(
Doctrine_Record
$record
)
{
$classMetadata
=
$this
->
_mapper
->
getClassMetadata
();
foreach
(
$classMetadata
->
getRelations
()
as
$fk
)
{
if
(
$fk
->
isComposite
())
{
$obj
=
$record
->
get
(
$fk
->
getAlias
());
if
(
$obj
instanceof
Doctrine_Record
&&
$obj
->
state
()
!=
Doctrine_Record
::
STATE_LOCKED
)
{
$obj
->
delete
(
$this
->
_mapper
->
getConnection
());
}
}
}
}
/**
/**
* Callback that is invoked during the SQL construction process.
* Callback that is invoked during the SQL construction process.
*/
*/
...
...
lib/Doctrine/Query/Abstract.php
View file @
33c76f62
...
@@ -562,7 +562,7 @@ abstract class Doctrine_Query_Abstract
...
@@ -562,7 +562,7 @@ abstract class Doctrine_Query_Abstract
$array
=
array
();
$array
=
array
();
foreach
(
$this
->
_queryComponents
as
$componentAlias
=>
$data
)
{
foreach
(
$this
->
_queryComponents
as
$componentAlias
=>
$data
)
{
$sqlTableAlias
=
$this
->
getSqlTableAlias
(
$componentAlias
);
$sqlTableAlias
=
$this
->
getSqlTableAlias
(
$componentAlias
);
if
(
$data
[
'table'
]
->
getInheritanceType
()
!=
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
)
{
if
(
$data
[
'table'
]
->
getInheritanceType
()
!=
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
)
{
$array
[
$sqlTableAlias
][]
=
array
();
$array
[
$sqlTableAlias
][]
=
array
();
}
else
{
}
else
{
$discCol
=
$data
[
'table'
]
->
getInheritanceOption
(
'discriminatorColumn'
);
$discCol
=
$data
[
'table'
]
->
getInheritanceOption
(
'discriminatorColumn'
);
...
...
lib/Doctrine/Record.php
View file @
33c76f62
...
@@ -1237,8 +1237,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -1237,8 +1237,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
// @todo cleanup
// @todo cleanup
// populates the discriminator field in Single & Class Table Inheritance
// populates the discriminator field in Single & Class Table Inheritance
if
(
$this
->
_class
->
getInheritanceType
()
==
Doctrine
::
INHERITANCETYPE_JOINED
||
if
(
$this
->
_class
->
getInheritanceType
()
==
Doctrine
::
INHERITANCE
_
TYPE_JOINED
||
$this
->
_class
->
getInheritanceType
()
==
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
)
{
$this
->
_class
->
getInheritanceType
()
==
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
)
{
$discCol
=
$this
->
_class
->
getInheritanceOption
(
'discriminatorColumn'
);
$discCol
=
$this
->
_class
->
getInheritanceOption
(
'discriminatorColumn'
);
$discMap
=
$this
->
_class
->
getInheritanceOption
(
'discriminatorMap'
);
$discMap
=
$this
->
_class
->
getInheritanceOption
(
'discriminatorMap'
);
$old
=
$this
->
get
(
$discCol
,
false
);
$old
=
$this
->
get
(
$discCol
,
false
);
...
...
tests/Orm/Component/AllTests.php
View file @
33c76f62
...
@@ -21,7 +21,7 @@ class Orm_Component_AllTests
...
@@ -21,7 +21,7 @@ class Orm_Component_AllTests
{
{
$suite
=
new
Doctrine_TestSuite
(
'Doctrine Orm Component'
);
$suite
=
new
Doctrine_TestSuite
(
'Doctrine Orm Component'
);
//
$suite->addTestSuite('Orm_Component_TestTest');
$suite
->
addTestSuite
(
'Orm_Component_TestTest'
);
$suite
->
addTestSuite
(
'Orm_Component_AccessTest'
);
$suite
->
addTestSuite
(
'Orm_Component_AccessTest'
);
$suite
->
addTestSuite
(
'Orm_Component_CollectionTest'
);
$suite
->
addTestSuite
(
'Orm_Component_CollectionTest'
);
...
...
tests/Orm/Component/CollectionTest.php
View file @
33c76f62
...
@@ -57,7 +57,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
...
@@ -57,7 +57,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
*/
*/
public
function
shouldHaveBlankAsDefaultKeyColumn
()
public
function
shouldHaveBlankAsDefaultKeyColumn
()
{
{
$this
->
assertEquals
(
''
,
$this
->
coll
->
getKey
Column
());
$this
->
assertEquals
(
''
,
$this
->
coll
->
getKey
Field
());
}
}
...
@@ -67,7 +67,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
...
@@ -67,7 +67,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
public
function
shouldUseSpecifiedKeyColumn
()
public
function
shouldUseSpecifiedKeyColumn
()
{
{
$coll
=
new
Doctrine_Collection
(
'ForumUser'
,
'id'
);
$coll
=
new
Doctrine_Collection
(
'ForumUser'
,
'id'
);
$this
->
assertEquals
(
'id'
,
$coll
->
getKey
Column
());
$this
->
assertEquals
(
'id'
,
$coll
->
getKey
Field
());
}
}
/**
/**
...
@@ -75,11 +75,11 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
...
@@ -75,11 +75,11 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
* possible to set this to something that is not valid.
* possible to set this to something that is not valid.
*
*
* @test
* @test
* @expectedException Doctrine_Exception
* @expectedException Doctrine_
Collection_
Exception
*/
*/
public
function
shouldThrowExceptionIfNonValidFieldSetAsKey
()
public
function
shouldThrowExceptionIfNonValidFieldSetAsKey
()
{
{
$coll
=
new
Doctrine_Collection
(
'ForumUser'
,
'
rat
'
);
$coll
=
new
Doctrine_Collection
(
'ForumUser'
,
'
xxNonValidFieldxx
'
);
}
}
/**
/**
...
@@ -87,8 +87,8 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
...
@@ -87,8 +87,8 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
*/
*/
public
function
shouldSerializeEmptyCollection
()
public
function
shouldSerializeEmptyCollection
()
{
{
$serialized
FormCollection
=
'C:19:"Doctrine_Collection":158:{a:7:{s:4:"data";a:0:{}s:7:"_mapper";s:9:"ForumUser";s:9:"_snapshot";a:0:{}s:14:"referenceField";N;s:9:"keyColumn";N;s:8:"_locator";N;s:10:"_resources";a:0:{}}}'
;
$serialized
=
serialize
(
$this
->
coll
)
;
$this
->
assert
Equals
(
$serializedFormCollection
,
serialize
(
$this
->
coll
));
$this
->
assert
True
(
is_string
(
$serialized
));
}
}
/**
/**
...
@@ -96,8 +96,8 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
...
@@ -96,8 +96,8 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
*/
*/
public
function
shouldUnserializeEmptyCollectionIntoObject
()
public
function
shouldUnserializeEmptyCollectionIntoObject
()
{
{
$serialized
FormCollection
=
'C:19:"Doctrine_Collection":158:{a:7:{s:4:"data";a:0:{}s:7:"_mapper";s:9:"ForumUser";s:9:"_snapshot";a:0:{}s:14:"referenceField";N;s:9:"keyColumn";N;s:8:"_locator";N;s:10:"_resources";a:0:{}}}'
;
$serialized
=
serialize
(
$this
->
coll
)
;
$coll
=
unserialize
(
$serialized
FormCollection
);
$coll
=
unserialize
(
$serialized
);
$this
->
assertEquals
(
'Doctrine_Collection'
,
get_class
(
$coll
));
$this
->
assertEquals
(
'Doctrine_Collection'
,
get_class
(
$coll
));
}
}
...
@@ -119,12 +119,11 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
...
@@ -119,12 +119,11 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
$serialized
=
serialize
(
$this
->
cmsColl
);
$serialized
=
serialize
(
$this
->
cmsColl
);
$coll
=
unserialize
(
$serialized
);
$coll
=
unserialize
(
$serialized
);
$this
->
assertEquals
(
'username'
,
$coll
->
getKey
Column
());
$this
->
assertEquals
(
'username'
,
$coll
->
getKey
Field
());
$this
->
assertTrue
(
isset
(
$coll
[
'test'
]));
$this
->
assertTrue
(
isset
(
$coll
[
'test'
]));
$user
=
$coll
[
'test'
];
$user
=
$coll
[
'test'
];
$this
->
assertTrue
(
$user
instanceOf
CmsUser
);
$this
->
assertTrue
(
$user
instanceOf
CmsUser
);
$this
->
assertEquals
(
'test'
,
$user
[
'username'
]);
$this
->
assertEquals
(
'test'
,
$user
[
'username'
]);
}
}
}
}
tests/Orm/Component/TestTest.php
View file @
33c76f62
...
@@ -28,4 +28,11 @@ class Orm_Component_TestTest extends Doctrine_OrmTestCase
...
@@ -28,4 +28,11 @@ class Orm_Component_TestTest extends Doctrine_OrmTestCase
$forumUsers
=
$this
->
sharedFixture
[
'connection'
]
->
query
(
"FROM ForumUser u"
);
$forumUsers
=
$this
->
sharedFixture
[
'connection'
]
->
query
(
"FROM ForumUser u"
);
$this
->
assertEquals
(
2
,
count
(
$forumUsers
));
$this
->
assertEquals
(
2
,
count
(
$forumUsers
));
}
}
public
function
testFixture3
()
{
$forumAdmins
=
$this
->
sharedFixture
[
'connection'
]
->
query
(
"FROM ForumAdministrator adm"
);
$this
->
assertEquals
(
1
,
count
(
$forumAdmins
));
$forumAdmins
[
0
]
->
delete
();
}
}
}
\ No newline at end of file
tests/fixtures/forum/common/admins.php
View file @
33c76f62
...
@@ -4,11 +4,7 @@ $fixture = array(
...
@@ -4,11 +4,7 @@ $fixture = array(
'rows'
=>
array
(
'rows'
=>
array
(
array
(
array
(
'id'
=>
1
,
'id'
=>
1
,
'foo'
=>
'bar'
'access_level'
=>
4
),
array
(
'id'
=>
2
,
'foo'
=>
'bar2'
)
)
)
)
);
);
\ No newline at end of file
tests/models/forum/ForumAdministrator.php
View file @
33c76f62
...
@@ -4,6 +4,8 @@ class ForumAdministrator extends ForumUser
...
@@ -4,6 +4,8 @@ class ForumAdministrator extends ForumUser
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
mapColumn
(
'
foo'
,
'string'
,
50
);
$class
->
mapColumn
(
'
access_level as accessLevel'
,
'integer'
,
1
);
}
}
public
function
banUser
(
ForumUser
$user
)
{}
}
}
\ No newline at end of file
tests/models/forum/ForumUser.php
View file @
33c76f62
...
@@ -5,18 +5,18 @@ class ForumUser extends Doctrine_Record
...
@@ -5,18 +5,18 @@ class ForumUser extends Doctrine_Record
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
// inheritance mapping
// inheritance mapping
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_JOINED
,
array
(
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_JOINED
,
array
(
'discriminatorColumn'
=>
'dtype'
,
'discriminatorColumn'
=>
'dtype'
,
'discriminatorMap'
=>
array
(
'discriminatorMap'
=>
array
(
'user'
=>
'ForumUser'
,
'user'
=>
'ForumUser'
,
'admin'
=>
'ForumAdministrator'
)
'admin'
=>
'ForumAdministrator'
)
));
));
// register subclasses
$class
->
setSubclasses
(
array
(
'ForumAdministrator'
));
$class
->
setSubclasses
(
array
(
'ForumAdministrator'
));
// the discriminator column
// the discriminator column
$class
->
mapColumn
(
'dtype'
,
'string'
,
50
);
$class
->
mapColumn
(
'dtype'
,
'string'
,
50
);
// column mapping
// column
-to-field
mapping
$class
->
mapColumn
(
'id'
,
'integer'
,
4
,
array
(
$class
->
mapColumn
(
'id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'primary'
=>
true
,
'autoincrement'
=>
true
));
'autoincrement'
=>
true
));
...
...
tests_old/ClassTableInheritanceTestCase.php
View file @
33c76f62
...
@@ -229,7 +229,7 @@ class CTITestParent1 extends Doctrine_Record
...
@@ -229,7 +229,7 @@ class CTITestParent1 extends Doctrine_Record
{
{
public
function
setTableDefinition
()
public
function
setTableDefinition
()
{
{
$this
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_JOINED
,
array
(
$this
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_JOINED
,
array
(
'CTITestParent1'
=>
1
,
'CTITestParent2'
=>
2
,
'CTITestParent1'
=>
1
,
'CTITestParent2'
=>
2
,
'CTITestParent3'
=>
3
,
'CTITestParent4'
=>
4
,
'CTITestParent3'
=>
3
,
'CTITestParent4'
=>
4
,
'CTITest'
=>
5
));
'CTITest'
=>
5
));
...
...
tests_old/CollectionTestCase.php
View file @
33c76f62
...
@@ -255,14 +255,14 @@ class Doctrine_Collection_TestCase extends Doctrine_UnitTestCase
...
@@ -255,14 +255,14 @@ class Doctrine_Collection_TestCase extends Doctrine_UnitTestCase
$coll
->
setKey
Column
(
'id'
);
$coll
->
setKey
Field
(
'id'
);
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
}
}
public
function
testGenerator
()
public
function
testGenerator
()
{
{
$coll
=
new
Doctrine_Collection
(
$this
->
objTable
);
$coll
=
new
Doctrine_Collection
(
$this
->
objTable
);
$coll
->
setKey
Column
(
'name'
);
$coll
->
setKey
Field
(
'name'
);
$user
=
new
User
();
$user
=
new
User
();
$user
->
name
=
"name"
;
$user
->
name
=
"name"
;
...
...
tests_old/Inheritance/JoinedTestCase.php
View file @
33c76f62
...
@@ -187,7 +187,7 @@ class CTI_User extends Doctrine_Record
...
@@ -187,7 +187,7 @@ class CTI_User extends Doctrine_Record
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_JOINED
,
array
(
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_JOINED
,
array
(
'discriminatorColumn'
=>
'dtype'
,
'discriminatorColumn'
=>
'dtype'
,
'discriminatorMap'
=>
array
(
1
=>
'CTI_User'
,
2
=>
'CTI_Manager'
,
'discriminatorMap'
=>
array
(
1
=>
'CTI_User'
,
2
=>
'CTI_Manager'
,
3
=>
'CTI_Customer'
,
4
=>
'CTI_SuperManager'
)
3
=>
'CTI_Customer'
,
4
=>
'CTI_SuperManager'
)
...
...
tests_old/Inheritance/SingleTableTestCase.php
View file @
33c76f62
...
@@ -67,7 +67,7 @@ class STI_User extends Doctrine_Record
...
@@ -67,7 +67,7 @@ class STI_User extends Doctrine_Record
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
,
array
(
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
,
array
(
'discriminatorColumn'
=>
'type'
,
'discriminatorColumn'
=>
'type'
,
'discriminatorMap'
=>
array
(
'discriminatorMap'
=>
array
(
1
=>
'STI_User'
,
1
=>
'STI_User'
,
...
...
tests_old/Inheritance/TablePerClassTestCase.php
View file @
33c76f62
...
@@ -70,7 +70,7 @@ class CCTI_User extends Doctrine_Record
...
@@ -70,7 +70,7 @@ class CCTI_User extends Doctrine_Record
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_TABLE_PER_CLASS
);
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_TABLE_PER_CLASS
);
$class
->
setTableName
(
'ccti_user'
);
$class
->
setTableName
(
'ccti_user'
);
$class
->
setSubclasses
(
array
(
'CCTI_Manager'
,
'CCTI_Customer'
,
'CCTI_SuperManager'
));
$class
->
setSubclasses
(
array
(
'CCTI_Manager'
,
'CCTI_Customer'
,
'CCTI_SuperManager'
));
$class
->
setColumn
(
'ccti_id as id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
setColumn
(
'ccti_id as id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
...
...
tests_old/Metadata/FactoryTestCase.php
View file @
33c76f62
...
@@ -146,7 +146,7 @@ class Metadata_User extends Doctrine_Record
...
@@ -146,7 +146,7 @@ class Metadata_User extends Doctrine_Record
public
static
function
initMetadata
(
Doctrine_ClassMetadata
$class
)
public
static
function
initMetadata
(
Doctrine_ClassMetadata
$class
)
{
{
$class
->
setTableName
(
'cti_user'
);
$class
->
setTableName
(
'cti_user'
);
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_JOINED
,
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_JOINED
,
array
(
'discriminatorColumn'
=>
'type'
,
array
(
'discriminatorColumn'
=>
'type'
,
'discriminatorMap'
=>
array
(
'discriminatorMap'
=>
array
(
1
=>
'CTI_User'
,
1
=>
'CTI_User'
,
...
@@ -200,7 +200,7 @@ class Metadata_STI_User extends Doctrine_Record
...
@@ -200,7 +200,7 @@ class Metadata_STI_User extends Doctrine_Record
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
setTableName
(
'cti_user'
);
$class
->
setTableName
(
'cti_user'
);
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
,
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
,
array
(
'discriminatorColumn'
=>
'type'
,
array
(
'discriminatorColumn'
=>
'type'
,
'discriminatorMap'
=>
array
(
'discriminatorMap'
=>
array
(
1
=>
'CTI_User'
,
1
=>
'CTI_User'
,
...
...
tests_old/Ticket/697TestCase.php
View file @
33c76f62
...
@@ -40,7 +40,7 @@ class T697_Person extends Doctrine_Record
...
@@ -40,7 +40,7 @@ class T697_Person extends Doctrine_Record
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_JOINED
,
array
(
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_JOINED
,
array
(
'discriminatorColumn'
=>
'dtype'
,
'discriminatorColumn'
=>
'dtype'
,
'discriminatorMap'
=>
array
(
'discriminatorMap'
=>
array
(
1
=>
'T697_Person'
,
2
=>
'T697_User'
1
=>
'T697_Person'
,
2
=>
'T697_User'
...
...
tests_old/models/BaseSymfonyRecord.php
View file @
33c76f62
...
@@ -3,6 +3,7 @@ abstract class BaseSymfonyRecord extends Doctrine_Record
...
@@ -3,6 +3,7 @@ abstract class BaseSymfonyRecord extends Doctrine_Record
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE_TYPE_TABLE_PER_CLASS
);
$class
->
setColumn
(
'name'
,
'string'
,
30
);
$class
->
setColumn
(
'name'
,
'string'
,
30
);
}
}
...
...
tests_old/models/Entity.php
View file @
33c76f62
...
@@ -13,7 +13,7 @@ class Entity extends Doctrine_Record
...
@@ -13,7 +13,7 @@ class Entity extends Doctrine_Record
$class
->
setColumn
(
'email_id'
,
'integer'
);
$class
->
setColumn
(
'email_id'
,
'integer'
);
$class
->
setSubclasses
(
array
(
'Group'
,
'User'
));
$class
->
setSubclasses
(
array
(
'Group'
,
'User'
));
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
,
array
(
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
,
array
(
'discriminatorColumn'
=>
'type'
,
'discriminatorColumn'
=>
'type'
,
'discriminatorMap'
=>
array
(
0
=>
'User'
,
1
=>
'Group'
,
2
=>
'Entity'
)
'discriminatorMap'
=>
array
(
0
=>
'User'
,
1
=>
'Group'
,
2
=>
'Entity'
)
));
));
...
...
tests_old/models/InheritanceDealUser.php
View file @
33c76f62
...
@@ -3,7 +3,7 @@ class InheritanceEntityUser extends Doctrine_Record
...
@@ -3,7 +3,7 @@ class InheritanceEntityUser extends Doctrine_Record
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_SINGLE_TABLE
,
array
(
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE
_
TYPE_SINGLE_TABLE
,
array
(
'discriminatorColumn'
=>
'type'
,
'discriminatorColumn'
=>
'type'
,
'discriminatorMap'
=>
array
(
1
=>
'InheritanceDealUser'
,
2
=>
'InheritanceEntityUser'
)
'discriminatorMap'
=>
array
(
1
=>
'InheritanceDealUser'
,
2
=>
'InheritanceEntityUser'
)
));
));
...
...
tests_old/models/RelationTest.php
View file @
33c76f62
...
@@ -3,6 +3,7 @@ class RelationTest extends Doctrine_Record
...
@@ -3,6 +3,7 @@ class RelationTest extends Doctrine_Record
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
{
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCE_TYPE_TABLE_PER_CLASS
);
$class
->
setColumn
(
'name'
,
'string'
,
200
);
$class
->
setColumn
(
'name'
,
'string'
,
200
);
$class
->
setColumn
(
'parent_id'
,
'integer'
);
$class
->
setColumn
(
'parent_id'
,
'integer'
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment