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
827755af
Commit
827755af
authored
May 16, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
82ba74e2
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
54 additions
and
2609 deletions
+54
-2609
Collection.php
draft/new-core/Collection.php
+0
-632
Hydrate.php
draft/new-core/Hydrate.php
+0
-633
Query.php
draft/new-core/Query.php
+0
-1294
Collection.php
lib/Doctrine/Collection.php
+9
-1
Connection.php
lib/Doctrine/Connection.php
+0
-2
UnitOfWork.php
lib/Doctrine/Connection/UnitOfWork.php
+20
-9
Query.php
lib/Doctrine/Query.php
+4
-4
Check.php
lib/Doctrine/Query/Check.php
+2
-2
Association.php
lib/Doctrine/Relation/Association.php
+4
-0
HydrateTestCase.php
tests/HydrateTestCase.php
+0
-8
RecordTestCase.php
tests/RecordTestCase.php
+11
-20
UnitTestCase.php
tests/UnitTestCase.php
+4
-4
No files found.
draft/new-core/Collection.php
deleted
100644 → 0
View file @
82ba74e2
This diff is collapsed.
Click to expand it.
draft/new-core/Hydrate.php
deleted
100644 → 0
View file @
82ba74e2
This diff is collapsed.
Click to expand it.
draft/new-core/Query.php
deleted
100644 → 0
View file @
82ba74e2
This diff is collapsed.
Click to expand it.
lib/Doctrine/Collection.php
View file @
827755af
...
@@ -555,12 +555,20 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -555,12 +555,20 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*/
*/
public
function
processDiff
()
public
function
processDiff
()
{
{
foreach
(
array_diff
(
$this
->
_snapshot
,
$this
->
data
)
as
$record
)
{
foreach
(
array_diff
(
$this
->
_snapshot
,
$this
->
data
)
as
$record
)
{
$record
->
delete
();
$record
->
delete
();
}
}
return
$this
;
return
$this
;
}
}
public
function
getDeleteDiff
()
{
return
array_diff
(
$this
->
_snapshot
,
$this
->
data
);
}
public
function
getInsertDiff
()
{
return
array_diff
(
$this
->
data
,
$this
->
_snapshot
);
}
/**
/**
* save
* save
* saves all records of this collection and processes the
* saves all records of this collection and processes the
...
...
lib/Doctrine/Connection.php
View file @
827755af
...
@@ -785,8 +785,6 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
...
@@ -785,8 +785,6 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
}
}
$tableObject
->
getRelations
();
$tableObject
->
getRelations
();
//$this->getTable('RelationTestChild')->getRelation('Children');
}
}
$next
=
count
(
$this
->
tables
);
$next
=
count
(
$this
->
tables
);
}
}
...
...
lib/Doctrine/Connection/UnitOfWork.php
View file @
827755af
...
@@ -30,7 +30,7 @@ Doctrine::autoload('Doctrine_Connection_Module');
...
@@ -30,7 +30,7 @@ Doctrine::autoload('Doctrine_Connection_Module');
* @version $Revision$
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
*/
class
Doctrine_Connection_UnitOfWork
extends
Doctrine_Connection_Module
implements
IteratorAggregate
,
Countable
class
Doctrine_Connection_UnitOfWork
extends
Doctrine_Connection_Module
{
{
/**
/**
* buildFlushTree
* buildFlushTree
...
@@ -163,6 +163,20 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
...
@@ -163,6 +163,20 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
}
}
}
elseif
(
$fk
instanceof
Doctrine_Relation_Association
)
{
}
elseif
(
$fk
instanceof
Doctrine_Relation_Association
)
{
$assocTable
=
$fk
->
getAssociationTable
();
foreach
(
$v
->
getDeleteDiff
()
as
$r
)
{
$query
=
'DELETE FROM '
.
$assocTable
->
getTableName
()
.
' WHERE '
.
$fk
->
getForeign
()
.
' = ?'
.
' AND '
.
$fk
->
getLocal
()
.
' = ?'
;
$this
->
query
(
$r
->
getIncremented
(),
$record
->
getIncremented
());
}
foreach
(
$v
->
getInsertDiff
as
$r
)
{
$assocRecord
=
$assocTable
->
create
();
$assocRecord
->
set
(
$fk
->
getForeign
(),
$r
);
$assocRecord
->
set
(
$fk
->
getLocal
(),
$record
);
$assocRecord
->
save
(
$this
->
conn
);
}
$v
->
save
(
$this
->
conn
);
$v
->
save
(
$this
->
conn
);
}
}
}
}
...
@@ -186,8 +200,10 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
...
@@ -186,8 +200,10 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
public
function
saveAssociations
(
Doctrine_Record
$record
)
public
function
saveAssociations
(
Doctrine_Record
$record
)
{
{
foreach
(
$record
->
getTable
()
->
getRelations
()
as
$rel
)
{
foreach
(
$record
->
getTable
()
->
getRelations
()
as
$rel
)
{
$table
=
$rel
->
getTable
();
$table
=
$rel
->
getTable
();
$alias
=
$rel
->
getAlias
();
$alias
=
$rel
->
getAlias
();
}
}
}
}
/**
/**
...
@@ -206,7 +222,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
...
@@ -206,7 +222,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
$obj
=
$record
->
get
(
$fk
->
getAlias
());
$obj
=
$record
->
get
(
$fk
->
getAlias
());
$obj
->
delete
(
$this
->
conn
);
$obj
->
delete
(
$this
->
conn
);
break
;
break
;
}
;
}
}
}
}
}
/**
/**
...
@@ -347,9 +363,4 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
...
@@ -347,9 +363,4 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
return
true
;
return
true
;
}
}
public
function
getIterator
()
{
}
public
function
count
()
{
}
}
}
lib/Doctrine/Query.php
View file @
827755af
...
@@ -30,7 +30,7 @@ Doctrine::autoload('Doctrine_Hydrate');
...
@@ -30,7 +30,7 @@ Doctrine::autoload('Doctrine_Hydrate');
* @version $Revision$
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
*/
class
Doctrine_Query
extends
Doctrine_Hydrate
implements
Countable
class
Doctrine_Query
extends
Doctrine_Hydrate
implements
Countable
{
{
/**
/**
* @param array $subqueryAliases the table aliases needed in some LIMIT subqueries
* @param array $subqueryAliases the table aliases needed in some LIMIT subqueries
...
@@ -205,7 +205,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable
...
@@ -205,7 +205,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable
*/
*/
public
function
parseSelect
(
$dql
)
public
function
parseSelect
(
$dql
)
{
{
$refs
=
Doctrine_
Query
::
bracketExplode
(
$dql
,
','
);
$refs
=
Doctrine_
Tokenizer
::
bracketExplode
(
$dql
,
','
);
foreach
(
$refs
as
$reference
)
{
foreach
(
$refs
as
$reference
)
{
if
(
strpos
(
$reference
,
'('
)
!==
false
)
{
if
(
strpos
(
$reference
,
'('
)
!==
false
)
{
...
@@ -237,7 +237,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable
...
@@ -237,7 +237,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable
*/
*/
public
function
parseSubselect
(
$reference
)
public
function
parseSubselect
(
$reference
)
{
{
$e
=
Doctrine_
Query
::
bracketExplode
(
$reference
,
' '
);
$e
=
Doctrine_
Tokenizer
::
bracketExplode
(
$reference
,
' '
);
$alias
=
$e
[
1
];
$alias
=
$e
[
1
];
if
(
count
(
$e
)
>
2
)
{
if
(
count
(
$e
)
>
2
)
{
...
@@ -253,7 +253,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable
...
@@ -253,7 +253,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable
}
}
public
function
parseAggregateFunction2
(
$func
)
public
function
parseAggregateFunction2
(
$func
)
{
{
$e
=
Doctrine_
Query
::
bracketExplode
(
$func
,
' '
);
$e
=
Doctrine_
Tokenizer
::
bracketExplode
(
$func
,
' '
);
$func
=
$e
[
0
];
$func
=
$e
[
0
];
$pos
=
strpos
(
$func
,
'('
);
$pos
=
strpos
(
$func
,
'('
);
...
...
lib/Doctrine/Query/Check.php
View file @
827755af
...
@@ -83,7 +83,7 @@ class Doctrine_Query_Check
...
@@ -83,7 +83,7 @@ class Doctrine_Query_Check
*/
*/
public
function
parseClause
(
$dql
)
public
function
parseClause
(
$dql
)
{
{
$parts
=
Doctrine_
Query
::
sqlExplode
(
$dql
,
' AND '
);
$parts
=
Doctrine_
Tokenizer
::
sqlExplode
(
$dql
,
' AND '
);
if
(
count
(
$parts
)
>
1
)
{
if
(
count
(
$parts
)
>
1
)
{
$ret
=
array
();
$ret
=
array
();
...
@@ -93,7 +93,7 @@ class Doctrine_Query_Check
...
@@ -93,7 +93,7 @@ class Doctrine_Query_Check
$r
=
implode
(
' AND '
,
$ret
);
$r
=
implode
(
' AND '
,
$ret
);
}
else
{
}
else
{
$parts
=
Doctrine_
Query
::
quoteExplode
(
$dql
,
' OR '
);
$parts
=
Doctrine_
Tokenizer
::
quoteExplode
(
$dql
,
' OR '
);
if
(
count
(
$parts
)
>
1
)
{
if
(
count
(
$parts
)
>
1
)
{
$ret
=
array
();
$ret
=
array
();
foreach
(
$parts
as
$part
)
{
foreach
(
$parts
as
$part
)
{
...
...
lib/Doctrine/Relation/Association.php
View file @
827755af
...
@@ -42,6 +42,10 @@ class Doctrine_Relation_Association extends Doctrine_Relation
...
@@ -42,6 +42,10 @@ class Doctrine_Relation_Association extends Doctrine_Relation
{
{
return
$this
->
definition
[
'assocTable'
];
return
$this
->
definition
[
'assocTable'
];
}
}
public
function
getAssociationTable
()
{
return
$this
->
definition
[
'assocTable'
];
}
/**
/**
* processDiff
* processDiff
*
*
...
...
tests/HydrateTestCase.php
View file @
827755af
...
@@ -19,12 +19,6 @@
...
@@ -19,12 +19,6 @@
* <http://www.phpdoctrine.com>.
* <http://www.phpdoctrine.com>.
*/
*/
require_once
(
'../draft/new-core/Record.php'
);
require_once
(
'../draft/new-core/Hydrate.php'
);
require_once
(
'../draft/new-core/Query.php'
);
require_once
(
'../draft/new-core/Collection.php'
);
/**
/**
* Doctrine_Hydrate_TestCase
* Doctrine_Hydrate_TestCase
*
*
...
@@ -36,8 +30,6 @@ require_once('../draft/new-core/Collection.php');
...
@@ -36,8 +30,6 @@ require_once('../draft/new-core/Collection.php');
* @since 1.0
* @since 1.0
* @version $Revision$
* @version $Revision$
*/
*/
class
Doctrine_Hydrate_TestCase
extends
Doctrine_UnitTestCase
class
Doctrine_Hydrate_TestCase
extends
Doctrine_UnitTestCase
{
{
protected
$testData1
=
array
(
protected
$testData1
=
array
(
...
...
tests/RecordTestCase.php
View file @
827755af
...
@@ -31,14 +31,14 @@
...
@@ -31,14 +31,14 @@
* @version $Revision$
* @version $Revision$
*/
*/
class
Doctrine_Record_TestCase
extends
Doctrine_UnitTestCase
{
class
Doctrine_Record_TestCase
extends
Doctrine_UnitTestCase
{
/**
public
function
prepareTables
()
{
public
function
prepareTables
()
{
$this
->
tables
[]
=
"enumTest"
;
$this
->
tables
[]
=
"enumTest"
;
$this
->
tables
[]
=
"fieldNameTest"
;
$this
->
tables
[]
=
"fieldNameTest"
;
$this
->
tables
[]
=
"GzipTest"
;
$this
->
tables
[]
=
"GzipTest"
;
parent
::
prepareTables
();
parent
::
prepareTables
();
}
}
*/
public
function
testIssetForPrimaryKey
()
{
public
function
testIssetForPrimaryKey
()
{
$this
->
assertTrue
(
isset
(
$this
->
users
[
0
]
->
id
));
$this
->
assertTrue
(
isset
(
$this
->
users
[
0
]
->
id
));
$this
->
assertTrue
(
isset
(
$this
->
users
[
0
][
'id'
]));
$this
->
assertTrue
(
isset
(
$this
->
users
[
0
][
'id'
]));
...
@@ -50,7 +50,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
...
@@ -50,7 +50,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
$this
->
assertFalse
(
isset
(
$user
[
'id'
]));
$this
->
assertFalse
(
isset
(
$user
[
'id'
]));
$this
->
assertFalse
(
$user
->
contains
(
'id'
));
$this
->
assertFalse
(
$user
->
contains
(
'id'
));
}
}
/**
public
function
testUnknownColumn
()
{
public
function
testUnknownColumn
()
{
}
}
...
@@ -299,14 +299,6 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
...
@@ -299,14 +299,6 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$user
->
name
,
null
);
$this
->
assertEqual
(
$user
->
name
,
null
);
}
}
public function testDateTimeType() {
$date = new DateTest();
}
public
function
testSerialize
()
{
public
function
testSerialize
()
{
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$str
=
serialize
(
$user
);
$str
=
serialize
(
$user
);
...
@@ -324,9 +316,6 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
...
@@ -324,9 +316,6 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
$user
->
call
(
'substr'
,
'name'
,
0
,
1
);
$user
->
call
(
'substr'
,
'name'
,
0
,
1
);
$this
->
assertEqual
(
$user
->
name
,
'z'
);
$this
->
assertEqual
(
$user
->
name
,
'z'
);
}
}
public
function
testCompositePK
()
{
public
function
testCompositePK
()
{
$record
=
new
EntityReference
();
$record
=
new
EntityReference
();
$this
->
assertEqual
(
$record
->
getTable
()
->
getIdentifier
(),
array
(
"entity1"
,
"entity2"
));
$this
->
assertEqual
(
$record
->
getTable
()
->
getIdentifier
(),
array
(
"entity1"
,
"entity2"
));
...
@@ -711,8 +700,8 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
...
@@ -711,8 +700,8 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$new
->
loginname
,
'jackd'
);
$this
->
assertEqual
(
$new
->
loginname
,
'jackd'
);
}
}
public function testReferences()
{
public
function
testReferences
()
{
$user
=
$this
->
objTable
->
find
(
5
);
$user
=
$this
->
objTable
->
find
(
5
);
$pf
=
$this
->
connection
->
getTable
(
"Phonenumber"
);
$pf
=
$this
->
connection
->
getTable
(
"Phonenumber"
);
...
@@ -946,13 +935,15 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
...
@@ -946,13 +935,15 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
}
}
public function testCount() {
public
function
testCount
()
{
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$this
->
assertTrue
(
is_integer
(
$user
->
count
()));
$this
->
assertTrue
(
is_integer
(
$user
->
count
()));
}
}
public function testGetReference() {
public
function
testGetReference
()
{
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$this
->
assertTrue
(
$user
->
Email
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$user
->
Email
instanceof
Doctrine_Record
);
...
@@ -961,10 +952,10 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
...
@@ -961,10 +952,10 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase {
$this
->
assertTrue
(
$user
->
Phonenumber
->
count
()
==
1
);
$this
->
assertTrue
(
$user
->
Phonenumber
->
count
()
==
1
);
}
}
public function testGetIterator() {
public
function
testGetIterator
()
{
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$user
=
$this
->
connection
->
getTable
(
"User"
)
->
find
(
4
);
$this
->
assertTrue
(
$user
->
getIterator
()
instanceof
ArrayIterator
);
$this
->
assertTrue
(
$user
->
getIterator
()
instanceof
ArrayIterator
);
}
}
*/
}
}
?>
?>
tests/UnitTestCase.php
View file @
827755af
...
@@ -228,10 +228,10 @@ class Doctrine_UnitTestCase extends UnitTestCase {
...
@@ -228,10 +228,10 @@ class Doctrine_UnitTestCase extends UnitTestCase {
}
}
}
}
public
function
setUp
()
{
public
function
setUp
()
{
if
(
!
$this
->
init
)
$this
->
init
();
if
(
!
$this
->
init
)
{
$this
->
init
();
if
(
isset
(
$this
->
objTable
))
}
$this
->
objTable
->
clear
();
$this
->
objTable
->
clear
();
$this
->
init
=
true
;
$this
->
init
=
true
;
}
}
...
...
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