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
34c830e3
Commit
34c830e3
authored
Sep 12, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved Collection
parent
c24ecd7b
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
440 deletions
+30
-440
EntityManager.php
lib/Doctrine/EntityManager.php
+4
-4
Collection.php
lib/Doctrine/ORM/Collection.php
+3
-3
Entity.php
lib/Doctrine/ORM/Entity.php
+1
-1
ObjectDriver.php
lib/Doctrine/ORM/Internal/Hydration/ObjectDriver.php
+2
-2
Sequence.php
lib/Doctrine/Sequence.php
+0
-73
Transaction.php
lib/Doctrine/Transaction.php
+0
-337
CollectionTest.php
tests/Orm/Component/CollectionTest.php
+5
-5
BasicHydrationTest.php
tests/Orm/Hydration/BasicHydrationTest.php
+15
-15
No files found.
lib/Doctrine/EntityManager.php
View file @
34c830e3
...
...
@@ -698,8 +698,8 @@ class Doctrine_EntityManager
* @param Doctrine::Common::EventManager $eventManager The EventManager instance to use.
* @return Doctrine::ORM::EntityManager The created EntityManager.
*/
public
static
function
create
(
$conn
,
$name
,
Doctrine_Configuration
$config
=
null
,
Doctrine_EventManager
$eventManager
=
null
)
public
static
function
create
(
$conn
,
$name
,
Doctrine_Co
mmon_Co
nfiguration
$config
=
null
,
Doctrine_
Common_
EventManager
$eventManager
=
null
)
{
if
(
is_array
(
$conn
))
{
$connFactory
=
new
Doctrine_DBAL_DriverManager
();
...
...
@@ -709,10 +709,10 @@ class Doctrine_EntityManager
}
if
(
is_null
(
$config
))
{
$config
=
new
Doctrine_Configuration
();
$config
=
new
Doctrine_Co
mmon_Co
nfiguration
();
}
if
(
is_null
(
$eventManager
))
{
$eventManager
=
new
Doctrine_EventManager
();
$eventManager
=
new
Doctrine_
Common_
EventManager
();
}
$em
=
new
Doctrine_EntityManager
(
$conn
,
$name
,
$config
,
$eventManager
);
...
...
lib/Doctrine/Collection.php
→
lib/Doctrine/
ORM/
Collection.php
View file @
34c830e3
<?php
/*
* $Id$
* $Id
: Collection.php 4930 2008-09-12 10:40:23Z romanb
$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
...
...
@@ -41,12 +41,12 @@
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 1.0
* @version $Revision$
* @version $Revision
: 4930
$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @todo Add more typical Collection methods.
*/
class
Doctrine_Collection
implements
Countable
,
IteratorAggregate
,
Serializable
,
ArrayAccess
class
Doctrine_
ORM_
Collection
implements
Countable
,
IteratorAggregate
,
Serializable
,
ArrayAccess
{
/**
* The base type of the collection.
...
...
lib/Doctrine/ORM/Entity.php
View file @
34c830e3
...
...
@@ -543,7 +543,7 @@ abstract class Doctrine_ORM_Entity implements ArrayAccess, Serializable
if
(
$rel
->
isOneToOne
()
&&
!
$value
instanceof
Doctrine_ORM_Entity
)
{
throw
Doctrine_Entity_Exception
::
invalidValueForOneToOneReference
();
}
else
if
((
$rel
->
isOneToMany
()
||
$rel
->
isManyToMany
())
&&
!
$value
instanceof
Doctrine_Collection
)
{
}
else
if
((
$rel
->
isOneToMany
()
||
$rel
->
isManyToMany
())
&&
!
$value
instanceof
Doctrine_
ORM_
Collection
)
{
throw
Doctrine_Entity_Exception
::
invalidValueForOneToManyReference
();
}
...
...
lib/Doctrine/ORM/Internal/Hydration/ObjectDriver.php
View file @
34c830e3
...
...
@@ -49,7 +49,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectDriver
public
function
getElementCollection
(
$component
)
{
$coll
=
new
Doctrine_Collection
(
$component
);
$coll
=
new
Doctrine_
ORM_
Collection
(
$component
);
$this
->
_collections
[]
=
$coll
;
return
$coll
;
...
...
@@ -80,7 +80,7 @@ class Doctrine_ORM_Internal_Hydration_ObjectDriver
}
}
public
function
registerCollection
(
Doctrine_Collection
$coll
)
public
function
registerCollection
(
Doctrine_
ORM_
Collection
$coll
)
{
$this
->
_collections
[]
=
$coll
;
}
...
...
lib/Doctrine/Sequence.php
deleted
100644 → 0
View file @
c24ecd7b
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* The base class for sequence handling drivers.
*
* @package Doctrine
* @subpackage Sequence
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
*/
class
Doctrine_Sequence
extends
Doctrine_Connection_Module
{
/**
* Returns the next free id of a sequence
*
* @param string $seqName name of the sequence
* @param bool when true missing sequences are automatic created
*
* @return integer next id in the given sequence
*/
public
function
nextId
(
$seqName
,
$ondemand
=
true
)
{
throw
new
Doctrine_Sequence_Exception
(
'method not implemented'
);
}
/**
* Returns the autoincrement ID if supported or $id or fetches the current
* ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
*
* @param string name of the table into which a new row was inserted
* @param string name of the field into which a new row was inserted
*/
public
function
lastInsertId
(
$table
=
null
,
$field
=
null
)
{
throw
new
Doctrine_Sequence_Exception
(
'method not implemented'
);
}
/**
* Returns the current id of a sequence
*
* @param string $seqName name of the sequence
*
* @return integer current id in the given sequence
*/
public
function
currId
(
$seqName
)
{
$this
->
warnings
[]
=
'database does not support getting current
sequence value, the sequence value was incremented'
;
return
$this
->
nextId
(
$seqName
);
}
}
\ No newline at end of file
lib/Doctrine/Transaction.php
deleted
100644 → 0
View file @
c24ecd7b
This diff is collapsed.
Click to expand it.
tests/Orm/Component/CollectionTest.php
View file @
34c830e3
...
...
@@ -41,10 +41,10 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
{
parent
::
setUp
();
$this
->
coll
=
new
Doctrine_Collection
(
'ForumUser'
);
$this
->
coll
=
new
Doctrine_
ORM_
Collection
(
'ForumUser'
);
//we create a CmsUser with username as key column and add a user to it
$cmsColl
=
new
Doctrine_Collection
(
'CmsUser'
,
'username'
);
$cmsColl
=
new
Doctrine_
ORM_
Collection
(
'CmsUser'
,
'username'
);
$user
=
new
CmsUser
();
$user
->
username
=
'test'
;
$cmsColl
[]
=
$user
;
...
...
@@ -67,7 +67,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
*/
public
function
shouldUseSpecifiedKeyColumn
()
{
$coll
=
new
Doctrine_Collection
(
'ForumUser'
,
'id'
);
$coll
=
new
Doctrine_
ORM_
Collection
(
'ForumUser'
,
'id'
);
$this
->
assertEquals
(
'id'
,
$coll
->
getKeyField
());
}
...
...
@@ -80,7 +80,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
*/
public
function
shouldThrowExceptionIfNonValidFieldSetAsKey
()
{
$coll
=
new
Doctrine_Collection
(
'ForumUser'
,
'xxNonValidFieldxx'
);
$coll
=
new
Doctrine_
ORM_
Collection
(
'ForumUser'
,
'xxNonValidFieldxx'
);
}
/**
...
...
@@ -99,7 +99,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
{
$serialized
=
serialize
(
$this
->
coll
);
$coll
=
unserialize
(
$serialized
);
$this
->
assertEquals
(
'Doctrine_Collection'
,
get_class
(
$coll
));
$this
->
assertEquals
(
'Doctrine_
ORM_
Collection'
,
get_class
(
$coll
));
}
/**
...
...
tests/Orm/Hydration/BasicHydrationTest.php
View file @
34c830e3
...
...
@@ -85,7 +85,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
}
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_RECORD
)
{
$this
->
assertTrue
(
$result
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
]
instanceof
Doctrine_ORM_Entity
);
}
else
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_ARRAY
)
{
...
...
@@ -187,11 +187,11 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_RECORD
)
{
$this
->
assertTrue
(
$result
[
0
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
][
1
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
]
instanceof
Doctrine_
ORM_
Collection
);
}
else
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_SCALAR
)
{
$this
->
assertTrue
(
is_array
(
$result
));
$this
->
assertEquals
(
3
,
count
(
$result
));
...
...
@@ -379,7 +379,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_RECORD
)
{
$this
->
assertTrue
(
$result
[
0
][
'1'
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
'2'
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
'1'
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
'1'
][
'phonenumbers'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertEquals
(
2
,
count
(
$result
[
0
][
'1'
][
'phonenumbers'
]));
}
else
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_SCALAR
)
{
// NOTE: Indexing has no effect with HYDRATE_SCALAR
...
...
@@ -522,14 +522,14 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_RECORD
)
{
$this
->
assertTrue
(
$result
[
0
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
][
1
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
1
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
1
]
instanceof
Doctrine_ORM_Entity
);
...
...
@@ -708,26 +708,26 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$this
->
assertTrue
(
$result
[
0
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
]
instanceof
Doctrine_ORM_Entity
);
// phonenumbers
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
][
1
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
][
0
]
instanceof
Doctrine_ORM_Entity
);
// articles
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
1
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
1
]
instanceof
Doctrine_ORM_Entity
);
// article comments
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
0
][
'comments'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
0
][
'comments'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
0
][
'comments'
][
0
]
instanceof
Doctrine_ORM_Entity
);
// empty comment collections
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
1
][
'comments'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
1
][
'comments'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertEquals
(
0
,
count
(
$result
[
0
][
0
][
'articles'
][
1
][
'comments'
]));
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
0
][
'comments'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
0
][
'comments'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertEquals
(
0
,
count
(
$result
[
1
][
0
][
'articles'
][
0
][
'comments'
]));
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
1
][
'comments'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
1
][
'comments'
]
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertEquals
(
0
,
count
(
$result
[
1
][
0
][
'articles'
][
1
][
'comments'
]));
}
else
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_SCALAR
)
{
//...
...
...
@@ -848,7 +848,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$this
->
assertTrue
(
is_array
(
$result
[
0
]));
$this
->
assertTrue
(
is_array
(
$result
[
1
]));
}
else
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_RECORD
)
{
$this
->
assertTrue
(
$result
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
instanceof
Doctrine_
ORM_
Collection
);
$this
->
assertTrue
(
$result
[
0
]
instanceof
Doctrine_ORM_Entity
);
$this
->
assertTrue
(
$result
[
1
]
instanceof
Doctrine_ORM_Entity
);
}
else
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_SCALAR
)
{
...
...
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