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
223daae2
Commit
223daae2
authored
Mar 19, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added xsl stylesheet to generate changelogs from svn log. merged a few patches from 0.10
parent
82efe45c
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
532 additions
and
51 deletions
+532
-51
Doctrine.php
lib/Doctrine.php
+1
-2
Access.php
lib/Doctrine/Access.php
+1
-1
Configurable.php
lib/Doctrine/Configurable.php
+1
-1
Mssql.php
lib/Doctrine/Connection/Mssql.php
+11
-0
Hydrator.php
lib/Doctrine/Hydrator.php
+1
-1
Abstract.php
lib/Doctrine/Hydrator/Abstract.php
+7
-2
RecordDriver.php
lib/Doctrine/Hydrator/RecordDriver.php
+8
-2
Manager.php
lib/Doctrine/Manager.php
+1
-2
Mapper.php
lib/Doctrine/Mapper.php
+1
-1
Null.php
lib/Doctrine/Null.php
+4
-5
Record.php
lib/Doctrine/Record.php
+19
-28
Mssql.php
lib/Doctrine/Sequence/Mssql.php
+1
-1
Validator.php
lib/Doctrine/Validator.php
+6
-3
svn2cl.xsl
svn2cl.xsl
+463
-0
OneToOneTestCase.php
tests_old/Relation/OneToOneTestCase.php
+1
-1
run.php
tests_old/run.php
+6
-1
No files found.
lib/Doctrine.php
View file @
223daae2
...
...
@@ -193,7 +193,7 @@ final class Doctrine
const
ATTR_EMULATE_DATABASE
=
116
;
// manager/session attribute
const
ATTR_USE_NATIVE_ENUM
=
117
;
// manager/session attribute
const
ATTR_DEFAULT_SEQUENCE
=
133
;
// ??
const
ATTR_FETCHMODE
=
118
;
// deprecated
const
ATTR_FETCHMODE
=
118
;
// deprecated
? might use them again for associations
const
ATTR_NAME_PREFIX
=
121
;
// ??
const
ATTR_CREATE_TABLES
=
122
;
// manager/session attribute
const
ATTR_COLL_LIMIT
=
123
;
// manager/session attribute
...
...
@@ -208,7 +208,6 @@ final class Doctrine
const
ATTR_QUERY_CACHE
=
157
;
// manager/session attribute
const
ATTR_QUERY_CACHE_LIFESPAN
=
158
;
// manager/session attribute
const
ATTR_MODEL_LOADING
=
161
;
// manager/session attribute
const
ATTR_LOCK
=
162
;
// ??
const
ATTR_HYDRATE
=
163
;
// ??
const
ATTR_IDENTIFIER
=
164
;
// ??
const
ATTR_METADATA_CACHE
=
165
;
// manager/session attribute
...
...
lib/Doctrine/Access.php
View file @
223daae2
...
...
@@ -33,7 +33,7 @@
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
abstract
class
Doctrine_Access
extends
Doctrine_Locator_Injectable
implements
ArrayAccess
abstract
class
Doctrine_Access
implements
ArrayAccess
{
/**
* setArray
...
...
lib/Doctrine/Configurable.php
View file @
223daae2
...
...
@@ -31,7 +31,7 @@
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
abstract
class
Doctrine_Configurable
extends
Doctrine_Locator_Injectable
abstract
class
Doctrine_Configurable
{
/**
* @var array $attributes an array of containing all attributes
...
...
lib/Doctrine/Connection/Mssql.php
View file @
223daae2
...
...
@@ -84,6 +84,17 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
if
(
$checkOption
&&
!
$this
->
getAttribute
(
Doctrine
::
ATTR_QUOTE_IDENTIFIER
))
{
return
$identifier
;
}
if
(
strpos
(
$identifier
,
'.'
)
!==
false
)
{
$parts
=
explode
(
'.'
,
$identifier
);
$quotedParts
=
array
();
foreach
(
$parts
as
$p
)
{
$quotedParts
[]
=
$this
->
quoteIdentifier
(
$p
);
}
return
implode
(
'.'
,
$quotedParts
);
}
return
'['
.
str_replace
(
']'
,
']]'
,
$identifier
)
.
']'
;
}
...
...
lib/Doctrine/Hydrator.php
View file @
223daae2
...
...
@@ -254,7 +254,7 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
*/
protected
function
_setLastElement
(
&
$prev
,
&
$coll
,
$index
,
$dqlAlias
,
$oneToOne
)
{
if
(
$coll
===
self
::
$_null
)
{
if
(
$coll
===
$this
->
_nullObject
)
{
return
false
;
}
...
...
lib/Doctrine/Hydrator/Abstract.php
View file @
223daae2
...
...
@@ -30,7 +30,7 @@
* @version $Revision: 3192 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
abstract
class
Doctrine_Hydrator_Abstract
extends
Doctrine_Locator_Injectable
abstract
class
Doctrine_Hydrator_Abstract
{
/**
* @var array $_aliasMap two dimensional array containing the map for query aliases
...
...
@@ -54,12 +54,17 @@ abstract class Doctrine_Hydrator_Abstract extends Doctrine_Locator_Injectable
*/
protected
$_hydrationMode
=
Doctrine
::
HYDRATE_RECORD
;
protected
$_nullObject
;
/**
* constructor
*
* @param Doctrine_Connection|null $connection
*/
public
function
__construct
()
{}
public
function
__construct
()
{
$this
->
_nullObject
=
Doctrine_Null
::
$INSTANCE
;
}
/**
* Sets the fetchmode.
...
...
lib/Doctrine/Hydrator/RecordDriver.php
View file @
223daae2
...
...
@@ -32,10 +32,16 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
class
Doctrine_Hydrator_RecordDriver
extends
Doctrine_Locator_Injectable
class
Doctrine_Hydrator_RecordDriver
{
protected
$_collections
=
array
();
protected
$_mappers
=
array
();
private
$_nullObject
;
public
function
__construct
()
{
$this
->
_nullObject
=
Doctrine_Null
::
$INSTANCE
;
}
public
function
getElementCollection
(
$component
)
{
...
...
@@ -98,7 +104,7 @@ class Doctrine_Hydrator_RecordDriver extends Doctrine_Locator_Injectable
public
function
getNullPointer
()
{
return
self
::
$_null
;
return
$this
->
_nullObject
;
}
public
function
getElement
(
array
$data
,
$className
)
...
...
lib/Doctrine/Manager.php
View file @
223daae2
...
...
@@ -77,7 +77,6 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
private
function
__construct
()
{
$this
->
_root
=
dirname
(
__FILE__
);
Doctrine_Locator_Injectable
::
initNullObject
(
new
Doctrine_Null
);
}
/**
...
...
@@ -543,7 +542,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
}
/**
* Creates a new native
query (instance of Doctrine_RawSql)
.
* Creates a new native
(SQL) query
.
*
* @return Doctrine_RawSql
*/
...
...
lib/Doctrine/Mapper.php
View file @
223daae2
...
...
@@ -86,7 +86,7 @@ class Doctrine_Mapper
$this
->
_domainClassName
=
$name
;
$this
->
_conn
=
$classMetadata
->
getConnection
();
$this
->
_classMetadata
=
$classMetadata
;
$this
->
_nullObject
=
Doctrine_Null
::
getInstance
()
;
$this
->
_nullObject
=
Doctrine_Null
::
$INSTANCE
;
if
(
$classMetadata
->
getInheritanceType
()
==
Doctrine
::
INHERITANCETYPE_JOINED
)
{
$this
->
_mappingStrategy
=
new
Doctrine_Mapper_JoinedStrategy
(
$this
);
}
else
{
...
...
lib/Doctrine/Null.php
View file @
223daae2
...
...
@@ -33,17 +33,16 @@
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
// static initializer
Doctrine_Null
::
$INSTANCE
=
new
Doctrine_Null
();
final
class
Doctrine_Null
{
p
rivate
static
$_instance
;
p
ublic
static
$INSTANCE
;
public
function
__construct
()
{}
public
static
function
getInstance
()
{
if
(
is_null
(
self
::
$_instance
))
{
self
::
$_instance
=
new
Doctrine_Null
();
}
return
self
::
$_instance
;
return
self
::
$INSTANCE
;
}
public
function
exists
()
...
...
lib/Doctrine/Record.php
View file @
223daae2
...
...
@@ -208,7 +208,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
{
if
(
isset
(
$mapper
)
&&
$mapper
instanceof
Doctrine_Mapper
)
{
$class
=
get_class
(
$this
);
$this
->
_mapper
=
Doctrine_Manager
::
getInstance
()
->
getMapper
(
$class
)
;
$this
->
_mapper
=
$mapper
;
$this
->
_class
=
$this
->
_mapper
->
getClassMetadata
();
$exists
=
!
$isNewEntry
;
}
else
{
...
...
@@ -263,16 +263,6 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
return
self
::
$_index
;
}
/**
* setUp
* this method is used for setting up relations and attributes
* it should be implemented by child classes
*
* @return void
*/
/*public function setUp()
{ }*/
/**
* construct
* Empty template method to provide concrete Record classes with the possibility
...
...
@@ -485,7 +475,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
continue
;
}
if
(
$value
===
self
::
$_null
||
$overwrite
)
{
if
(
$value
===
Doctrine_Null
::
$INSTANCE
||
$overwrite
)
{
$this
->
_data
[
$column
]
=
$default
;
$this
->
_modified
[]
=
$column
;
$this
->
_state
=
Doctrine_Record
::
STATE_TDIRTY
;
...
...
@@ -513,9 +503,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
if
(
isset
(
$tmp
[
$fieldName
]))
{
$data
[
$fieldName
]
=
$tmp
[
$fieldName
];
}
else
if
(
array_key_exists
(
$fieldName
,
$tmp
))
{
$data
[
$fieldName
]
=
self
::
$_null
;
$data
[
$fieldName
]
=
Doctrine_Null
::
$INSTANCE
;
}
else
if
(
!
isset
(
$this
->
_data
[
$fieldName
]))
{
$data
[
$fieldName
]
=
self
::
$_null
;
$data
[
$fieldName
]
=
Doctrine_Null
::
$INSTANCE
;
}
unset
(
$tmp
[
$fieldName
]);
}
...
...
@@ -554,7 +544,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$name
=
(
array
)
$this
->
_class
->
getIdentifier
();
$name
=
$name
[
0
];
if
(
$exists
)
{
if
(
isset
(
$this
->
_data
[
$name
])
&&
$this
->
_data
[
$name
]
!==
self
::
$_null
)
{
if
(
isset
(
$this
->
_data
[
$name
])
&&
$this
->
_data
[
$name
]
!==
Doctrine_Null
::
$INSTANCE
)
{
$this
->
_id
[
$name
]
=
$this
->
_data
[
$name
];
}
}
...
...
@@ -563,7 +553,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$names
=
(
array
)
$this
->
_class
->
getIdentifier
();
foreach
(
$names
as
$name
)
{
if
(
$this
->
_data
[
$name
]
===
self
::
$_null
)
{
if
(
$this
->
_data
[
$name
]
===
Doctrine_Null
::
$INSTANCE
)
{
$this
->
_id
[
$name
]
=
null
;
}
else
{
$this
->
_id
[
$name
]
=
$this
->
_data
[
$name
];
...
...
@@ -600,7 +590,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
foreach
(
$this
->
_data
as
$k
=>
$v
)
{
if
(
$v
instanceof
Doctrine_Record
&&
$this
->
_class
->
getTypeOf
(
$k
)
!=
'object'
)
{
unset
(
$vars
[
'_data'
][
$k
]);
}
else
if
(
$v
===
self
::
$_null
)
{
}
else
if
(
$v
===
Doctrine_Null
::
$INSTANCE
)
{
unset
(
$vars
[
'_data'
][
$k
]);
}
else
{
switch
(
$this
->
_class
->
getTypeOf
(
$k
))
{
...
...
@@ -838,7 +828,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
if
(
!
isset
(
$this
->
_data
[
$fieldName
]))
{
throw
new
Doctrine_Record_Exception
(
'Unknown property '
.
$fieldName
);
}
if
(
$this
->
_data
[
$fieldName
]
===
self
::
$_null
)
{
if
(
$this
->
_data
[
$fieldName
]
===
Doctrine_Null
::
$INSTANCE
)
{
return
null
;
}
...
...
@@ -895,15 +885,16 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
}*/
// Use built-in accessor functionality
$value
=
self
::
$_null
;
$nullObj
=
Doctrine_Null
::
$INSTANCE
;
$value
=
$nullObj
;
if
(
isset
(
$this
->
_data
[
$fieldName
]))
{
if
(
$this
->
_data
[
$fieldName
]
!==
self
::
$_null
)
{
if
(
$this
->
_data
[
$fieldName
]
!==
$nullObj
)
{
return
$this
->
_data
[
$fieldName
];
}
if
(
$this
->
_data
[
$fieldName
]
===
self
::
$_null
&&
$load
)
{
if
(
$this
->
_data
[
$fieldName
]
===
$nullObj
&&
$load
)
{
$this
->
load
();
}
if
(
$this
->
_data
[
$fieldName
]
===
self
::
$_null
)
{
if
(
$this
->
_data
[
$fieldName
]
===
$nullObj
)
{
$value
=
null
;
}
return
$value
;
...
...
@@ -982,7 +973,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
if
(
$old
!==
$value
)
{
if
(
$value
===
null
)
{
$value
=
self
::
$_null
;
$value
=
Doctrine_Null
::
$INSTANCE
;
}
$this
->
_data
[
$fieldName
]
=
$value
;
...
...
@@ -1032,7 +1023,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
return
$this
;
}
}
else
{
if
(
$value
!==
self
::
$_null
)
{
if
(
$value
!==
Doctrine_Null
::
$INSTANCE
)
{
$relatedTable
=
$value
->
getTable
();
$foreignFieldName
=
$rel
->
getForeignFieldName
();
$localFieldName
=
$rel
->
getLocalFieldName
();
...
...
@@ -1083,7 +1074,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
return
true
;
}
if
(
isset
(
$this
->
_references
[
$fieldName
])
&&
$this
->
_references
[
$fieldName
]
!==
self
::
$_null
)
{
$this
->
_references
[
$fieldName
]
!==
Doctrine_Null
::
$INSTANCE
)
{
return
true
;
}
return
false
;
...
...
@@ -1100,7 +1091,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
}
else
if
(
isset
(
$this
->
_references
[
$fieldName
]))
{
if
(
$this
->
_references
[
$fieldName
]
instanceof
Doctrine_Record
)
{
// todo: delete related record when saving $this
$this
->
_references
[
$fieldName
]
=
self
::
$_null
;
$this
->
_references
[
$fieldName
]
=
Doctrine_Null
::
$INSTANCE
;
}
else
if
(
$this
->
_references
[
$fieldName
]
instanceof
Doctrine_Collection
)
{
$this
->
_references
[
$fieldName
]
->
setData
(
array
());
}
...
...
@@ -1211,7 +1202,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
foreach
(
$modifiedFields
as
$field
)
{
$type
=
$this
->
_class
->
getTypeOf
(
$field
);
if
(
$this
->
_data
[
$field
]
===
self
::
$_null
)
{
if
(
$this
->
_data
[
$field
]
===
Doctrine_Null
::
$INSTANCE
)
{
$dataSet
[
$field
]
=
null
;
continue
;
}
...
...
@@ -1286,7 +1277,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$a
=
array
();
foreach
(
$this
as
$column
=>
$value
)
{
if
(
$value
===
self
::
$_null
||
is_object
(
$value
))
{
if
(
$value
===
Doctrine_Null
::
$INSTANCE
||
is_object
(
$value
))
{
$value
=
null
;
}
$a
[
$column
]
=
$value
;
...
...
lib/Doctrine/Sequence/Mssql.php
View file @
223daae2
...
...
@@ -138,7 +138,7 @@ class Doctrine_Sequence_Mssql extends Doctrine_Sequence
$query
=
'SELECT @@IDENTITY'
;
}
return
$this
->
conn
->
fetchOne
(
$query
);
return
(
string
)
floor
((
float
)
$this
->
conn
->
fetchOne
(
$query
)
);
}
/**
...
...
lib/Doctrine/Validator.php
View file @
223daae2
...
...
@@ -29,9 +29,10 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Roman Borschel <roman@code-factory.org>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class
Doctrine_Validator
extends
Doctrine_Locator_Injectable
class
Doctrine_Validator
{
/**
* @var array $validators an array of validator objects
...
...
@@ -50,6 +51,8 @@ class Doctrine_Validator extends Doctrine_Locator_Injectable
$class
=
'Doctrine_Validator_'
.
ucwords
(
strtolower
(
$name
));
if
(
class_exists
(
$class
))
{
self
::
$validators
[
$name
]
=
new
$class
;
}
else
if
(
class_exists
(
$name
))
{
self
::
$validators
[
$name
]
=
new
$name
;
}
else
{
throw
new
Doctrine_Exception
(
"Validator named '
$name
' not available."
);
}
...
...
@@ -78,7 +81,7 @@ class Doctrine_Validator extends Doctrine_Locator_Injectable
$fields
=
(
$record
->
exists
())
?
$record
->
getModified
()
:
$record
->
getData
();
$err
=
array
();
foreach
(
$fields
as
$fieldName
=>
$value
)
{
if
(
$value
===
self
::
$_null
)
{
if
(
$value
===
Doctrine_Null
::
$INSTANCE
)
{
$value
=
null
;
}
else
if
(
$value
instanceof
Doctrine_Record
)
{
$value
=
$value
->
getIncremented
();
...
...
svn2cl.xsl
0 → 100644
View file @
223daae2
This diff is collapsed.
Click to expand it.
tests_old/Relation/OneToOneTestCase.php
View file @
223daae2
...
...
@@ -81,7 +81,7 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase
$user
->
Email
=
$email
;
$user
->
save
();
$this
->
assertTrue
(
$user
->
Email
instanceOf
Email
);
$user
->
Email
=
Email
::
getNullObject
()
;
$user
->
Email
=
Doctrine_Null
::
$INSTANCE
;
$user
->
save
();
$this
->
assertTrue
(
$user
->
Email
instanceOf
Doctrine_Null
);
}
...
...
tests_old/run.php
View file @
223daae2
...
...
@@ -303,6 +303,11 @@ $data->addTestCase(new Doctrine_Data_Import_TestCase());
$data
->
addTestCase
(
new
Doctrine_Data_Export_TestCase
());
$test
->
addTestCase
(
$data
);
$s
=
microtime
(
true
);
$test
->
run
();
$e
=
microtime
(
true
);
echo
memory_get_peak_usage
()
/
1024
.
"
\n
"
;
echo
'test run took: '
.
(
$e
-
$s
)
.
' seconds<br />'
;
echo
"peak memory usage: "
.
memory_get_peak_usage
()
/
1024
.
"KB
\n
"
;
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