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
c43f9588
Commit
c43f9588
authored
Jul 11, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanups, improvements, fixes.
parent
3cd7b954
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
191 additions
and
217 deletions
+191
-217
ClassMetadata.php
lib/Doctrine/ClassMetadata.php
+121
-165
Factory.php
lib/Doctrine/ClassMetadata/Factory.php
+2
-2
Entity.php
lib/Doctrine/Entity.php
+4
-4
HydratorNew.php
lib/Doctrine/HydratorNew.php
+37
-38
MappingException.php
lib/Doctrine/MappingException.php
+17
-0
PathExpressionEndingWithAsterisk.php
...ine/Query/Production/PathExpressionEndingWithAsterisk.php
+1
-1
AccessorTest.php
tests/Orm/Entity/AccessorTest.php
+7
-5
AllTests.php
tests/Orm/Entity/AllTests.php
+2
-2
No files found.
lib/Doctrine/ClassMetadata.php
View file @
c43f9588
This diff is collapsed.
Click to expand it.
lib/Doctrine/ClassMetadata/Factory.php
View file @
c43f9588
...
@@ -130,7 +130,7 @@ class Doctrine_ClassMetadata_Factory
...
@@ -130,7 +130,7 @@ class Doctrine_ClassMetadata_Factory
protected
function
_addInheritedFields
(
$subClass
,
$parentClass
)
protected
function
_addInheritedFields
(
$subClass
,
$parentClass
)
{
{
foreach
(
$parentClass
->
get
Column
s
()
as
$name
=>
$definition
)
{
foreach
(
$parentClass
->
get
FieldMapping
s
()
as
$name
=>
$definition
)
{
$fullName
=
"
$name
as "
.
$parentClass
->
getFieldName
(
$name
);
$fullName
=
"
$name
as "
.
$parentClass
->
getFieldName
(
$name
);
$definition
[
'inherited'
]
=
true
;
$definition
[
'inherited'
]
=
true
;
$subClass
->
mapColumn
(
$subClass
->
mapColumn
(
...
@@ -246,7 +246,7 @@ class Doctrine_ClassMetadata_Factory
...
@@ -246,7 +246,7 @@ class Doctrine_ClassMetadata_Factory
case
1
:
// A single identifier is in the mapping
case
1
:
// A single identifier is in the mapping
foreach
(
$class
->
getIdentifier
()
as
$pk
)
{
foreach
(
$class
->
getIdentifier
()
as
$pk
)
{
$columnName
=
$class
->
getColumnName
(
$pk
);
$columnName
=
$class
->
getColumnName
(
$pk
);
$thisColumns
=
$class
->
get
Column
s
();
$thisColumns
=
$class
->
get
FieldMapping
s
();
$e
=
$thisColumns
[
$columnName
];
$e
=
$thisColumns
[
$columnName
];
$found
=
false
;
$found
=
false
;
...
...
lib/Doctrine/Entity.php
View file @
c43f9588
...
@@ -342,12 +342,12 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
...
@@ -342,12 +342,12 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
$this
->
_data
=
array_merge
(
$this
->
_data
,
$this
->
_id
);
$this
->
_data
=
array_merge
(
$this
->
_data
,
$this
->
_id
);
foreach
(
$this
->
_data
as
$k
=>
$v
)
{
foreach
(
$this
->
_data
as
$k
=>
$v
)
{
if
(
$v
instanceof
Doctrine_Entity
&&
$this
->
_class
->
getTypeOf
(
$k
)
!=
'object'
)
{
if
(
$v
instanceof
Doctrine_Entity
&&
$this
->
_class
->
getTypeOf
Field
(
$k
)
!=
'object'
)
{
unset
(
$vars
[
'_data'
][
$k
]);
unset
(
$vars
[
'_data'
][
$k
]);
}
else
if
(
$v
===
Doctrine_Null
::
$INSTANCE
)
{
}
else
if
(
$v
===
Doctrine_Null
::
$INSTANCE
)
{
unset
(
$vars
[
'_data'
][
$k
]);
unset
(
$vars
[
'_data'
][
$k
]);
}
else
{
}
else
{
switch
(
$this
->
_class
->
getTypeOf
(
$k
))
{
switch
(
$this
->
_class
->
getTypeOf
Field
(
$k
))
{
case
'array'
:
case
'array'
:
case
'object'
:
case
'object'
:
$vars
[
'_data'
][
$k
]
=
serialize
(
$vars
[
'_data'
][
$k
]);
$vars
[
'_data'
][
$k
]
=
serialize
(
$vars
[
'_data'
][
$k
]);
...
@@ -400,7 +400,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
...
@@ -400,7 +400,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
$this
->
_class
=
$this
->
_em
->
getClassMetadata
(
$this
->
_entityName
);
$this
->
_class
=
$this
->
_em
->
getClassMetadata
(
$this
->
_entityName
);
foreach
(
$this
->
_data
as
$k
=>
$v
)
{
foreach
(
$this
->
_data
as
$k
=>
$v
)
{
switch
(
$this
->
_class
->
getTypeOf
(
$k
))
{
switch
(
$this
->
_class
->
getTypeOf
Field
(
$k
))
{
case
'array'
:
case
'array'
:
case
'object'
:
case
'object'
:
$this
->
_data
[
$k
]
=
unserialize
(
$this
->
_data
[
$k
]);
$this
->
_data
[
$k
]
=
unserialize
(
$this
->
_data
[
$k
]);
...
@@ -1024,7 +1024,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
...
@@ -1024,7 +1024,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
}
}
foreach
(
$modifiedFields
as
$field
)
{
foreach
(
$modifiedFields
as
$field
)
{
$type
=
$this
->
_class
->
getTypeOf
(
$field
);
$type
=
$this
->
_class
->
getTypeOf
Field
(
$field
);
if
(
$this
->
_data
[
$field
]
===
Doctrine_Null
::
$INSTANCE
)
{
if
(
$this
->
_data
[
$field
]
===
Doctrine_Null
::
$INSTANCE
)
{
$dataSet
[
$field
]
=
null
;
$dataSet
[
$field
]
=
null
;
...
...
lib/Doctrine/HydratorNew.php
View file @
c43f9588
This diff is collapsed.
Click to expand it.
lib/Doctrine/MappingException.php
0 → 100644
View file @
c43f9588
<?php
/**
* A MappingException indicates that something is wrong with the mapping setup.
*
* @since 2.0
*/
class
Doctrine_MappingException
extends
Doctrine_Exception
{
public
static
function
identifierRequired
(
$entityName
)
{
return
new
self
(
"No identifier specified for Entity '
$entityName
'."
.
" Every Entity must have an identifier."
);
}
}
?>
\ No newline at end of file
lib/Doctrine/Query/Production/PathExpressionEndingWithAsterisk.php
View file @
c43f9588
...
@@ -133,7 +133,7 @@ class Doctrine_Query_Production_PathExpressionEndingWithAsterisk extends Doctrin
...
@@ -133,7 +133,7 @@ class Doctrine_Query_Production_PathExpressionEndingWithAsterisk extends Doctrin
}
}
// Generating the SQL piece
// Generating the SQL piece
$fields
=
$this
->
_queryComponent
[
'metadata'
]
->
get
MappedColumn
s
();
$fields
=
$this
->
_queryComponent
[
'metadata'
]
->
get
FieldMapping
s
();
$tableAlias
=
$parserResult
->
getTableAliasFromComponentAlias
(
$componentAlias
);
$tableAlias
=
$parserResult
->
getTableAliasFromComponentAlias
(
$componentAlias
);
$str
=
''
;
$str
=
''
;
...
...
tests/Orm/Entity/AccessorTest
Case
.php
→
tests/Orm/Entity/AccessorTest.php
View file @
c43f9588
<?php
<?php
require_once
'lib/DoctrineTestInit.php'
;
require_once
'lib/DoctrineTestInit.php'
;
class
Orm_Entity_AccessorTest
Case
extends
Doctrine_OrmTestCase
class
Orm_Entity_AccessorTest
extends
Doctrine_OrmTestCase
{
{
public
function
testGetterSetterOverride
()
public
function
testGetterSetterOverride
()
{
{
$em
=
new
Doctrine_EntityManager
(
new
Doctrine_Connection_Mock
());
$entity1
=
new
CustomAccessorMutatorTestEntity
();
$entity1
=
new
CustomAccessorMutatorTestEntity
();
$entity1
->
username
=
'romanb'
;
$entity1
->
username
=
'romanb'
;
$this
->
assertEquals
(
'romanb?!'
,
$entity1
->
username
);
$this
->
assertEquals
(
'romanb?!'
,
$entity1
->
username
);
...
@@ -14,10 +12,14 @@ class Orm_Entity_AccessorTestCase extends Doctrine_OrmTestCase
...
@@ -14,10 +12,14 @@ class Orm_Entity_AccessorTestCase extends Doctrine_OrmTestCase
$entity2
=
new
MagicAccessorMutatorTestEntity
();
$entity2
=
new
MagicAccessorMutatorTestEntity
();
$entity2
->
username
=
'romanb'
;
$entity2
->
username
=
'romanb'
;
$this
->
assertEquals
(
'romanb?!'
,
$entity1
->
username
);
$this
->
assertEquals
(
'romanb?!'
,
$entity1
->
username
);
}
}
}
}
/* Local test classes */
class
CustomAccessorMutatorTestEntity
extends
Doctrine_Entity
class
CustomAccessorMutatorTestEntity
extends
Doctrine_Entity
{
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
...
...
tests/Orm/Entity/AllTests.php
View file @
c43f9588
...
@@ -6,7 +6,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
...
@@ -6,7 +6,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
require_once
'lib/DoctrineTestInit.php'
;
require_once
'lib/DoctrineTestInit.php'
;
// Tests
// Tests
require_once
'Orm/Entity/AccessorTest
Case
.php'
;
require_once
'Orm/Entity/AccessorTest.php'
;
require_once
'Orm/Entity/ConstructorTest.php'
;
require_once
'Orm/Entity/ConstructorTest.php'
;
class
Orm_Entity_AllTests
class
Orm_Entity_AllTests
...
@@ -20,7 +20,7 @@ class Orm_Entity_AllTests
...
@@ -20,7 +20,7 @@ class Orm_Entity_AllTests
{
{
$suite
=
new
Doctrine_TestSuite
(
'Doctrine Orm Entity Tests'
);
$suite
=
new
Doctrine_TestSuite
(
'Doctrine Orm Entity Tests'
);
$suite
->
addTestSuite
(
'Orm_Entity_AccessorTest
Case
'
);
$suite
->
addTestSuite
(
'Orm_Entity_AccessorTest'
);
$suite
->
addTestSuite
(
'Orm_Entity_ConstructorTest'
);
$suite
->
addTestSuite
(
'Orm_Entity_ConstructorTest'
);
return
$suite
;
return
$suite
;
...
...
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