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
02c57f59
Commit
02c57f59
authored
Jan 23, 2008
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #688
parent
1f18a99f
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
24 additions
and
26 deletions
+24
-26
Collection.php
lib/Doctrine/Collection.php
+4
-3
Record.php
lib/Doctrine/Record.php
+2
-2
Abstract.php
lib/Doctrine/Record/Abstract.php
+2
-5
Entity.php
models/Entity.php
+2
-2
Error.php
models/Error.php
+1
-1
FilterTest.php
models/FilterTest.php
+1
-1
Package.php
models/Package.php
+1
-1
QueryTest_Board.php
models/QueryTest_Board.php
+1
-1
QueryTest_Category.php
models/QueryTest_Category.php
+2
-2
Rec1.php
models/Rec1.php
+1
-1
Rec2.php
models/Rec2.php
+1
-1
ValidatorTest_Person.php
models/ValidatorTest_Person.php
+1
-1
SynchronizeTestCase.php
tests/Record/SynchronizeTestCase.php
+4
-4
TableTestCase.php
tests/TableTestCase.php
+1
-1
No files found.
lib/Doctrine/Collection.php
View file @
02c57f59
...
...
@@ -718,7 +718,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
}
/**
* synchronize
With
Array
* synchronize
From
Array
* synchronizes a Doctrine_Collection with data from an array
*
* it expects an array representation of a Doctrine_Collection similar to the return
...
...
@@ -727,17 +727,18 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*
* @param array $array representation of a Doctrine_Collection
*/
public
function
synchronize
With
Array
(
array
$array
)
public
function
synchronize
From
Array
(
array
$array
)
{
foreach
(
$this
as
$key
=>
$record
)
{
if
(
isset
(
$array
[
$key
]))
{
$record
->
synchronize
With
Array
(
$array
[
$key
]);
$record
->
synchronize
From
Array
(
$array
[
$key
]);
unset
(
$array
[
$key
]);
}
else
{
// remove records that don't exist in the array
$this
->
remove
(
$key
);
}
}
// create new records for each new row in the array
foreach
(
$array
as
$rowKey
=>
$row
)
{
$this
[
$rowKey
]
->
fromArray
(
$row
);
...
...
lib/Doctrine/Record.php
View file @
02c57f59
...
...
@@ -1324,8 +1324,8 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
{
foreach
(
$array
as
$key
=>
$value
)
{
if
(
$this
->
getTable
()
->
hasRelation
(
$key
))
{
$this
->
get
(
$key
)
->
synchronize
With
Array
(
$value
);
}
else
if
(
$this
->
getTable
()
->
has
Field
(
$key
))
{
$this
->
get
(
$key
)
->
synchronize
From
Array
(
$value
);
}
else
if
(
$this
->
getTable
()
->
has
Column
(
$key
))
{
$this
->
set
(
$key
,
$value
);
}
}
...
...
lib/Doctrine/Record/Abstract.php
View file @
02c57f59
...
...
@@ -211,9 +211,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
*/
public
function
ownsOne
()
{
$this
->
_table
->
bind
(
func_get_args
(),
Doctrine_Relation
::
ONE_COMPOSITE
);
return
$this
;
throw
new
Doctrine_Exception
(
'ownsMany() has been deprecated.'
);
}
/**
...
...
@@ -229,8 +227,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
*/
public
function
ownsMany
()
{
$this
->
_table
->
bind
(
func_get_args
(),
Doctrine_Relation
::
MANY_COMPOSITE
);
return
$this
;
throw
new
Doctrine_Exception
(
'ownsOne() has been deprecated.'
);
}
/**
...
...
models/Entity.php
View file @
02c57f59
...
...
@@ -3,9 +3,9 @@ class Entity extends Doctrine_Record
{
public
function
setUp
()
{
$this
->
own
sOne
(
'Email'
,
array
(
'local'
=>
'email_id'
));
$this
->
ha
sOne
(
'Email'
,
array
(
'local'
=>
'email_id'
));
$this
->
hasMany
(
'Phonenumber'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'entity_id'
));
$this
->
own
sOne
(
'Account'
,
array
(
'foreign'
=>
'entity_id'
));
$this
->
ha
sOne
(
'Account'
,
array
(
'foreign'
=>
'entity_id'
));
$this
->
hasMany
(
'Entity'
,
array
(
'local'
=>
'entity1'
,
'refClass'
=>
'EntityReference'
,
'foreign'
=>
'entity2'
,
...
...
models/Error.php
View file @
02c57f59
<?php
class
Error
extends
Doctrine_Record
{
public
function
setUp
()
{
$this
->
own
sMany
(
'Description'
,
'Description.file_md5'
,
'file_md5'
);
$this
->
ha
sMany
(
'Description'
,
'Description.file_md5'
,
'file_md5'
);
}
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'message'
,
'string'
,
200
);
...
...
models/FilterTest.php
View file @
02c57f59
...
...
@@ -4,6 +4,6 @@ class FilterTest extends Doctrine_Record {
$this
->
hasColumn
(
'name'
,
'string'
,
100
);
}
public
function
setUp
()
{
$this
->
own
sMany
(
'FilterTest2 as filtered'
,
'FilterTest2.test1_id'
);
$this
->
ha
sMany
(
'FilterTest2 as filtered'
,
'FilterTest2.test1_id'
);
}
}
models/Package.php
View file @
02c57f59
...
...
@@ -6,6 +6,6 @@ class Package extends Doctrine_Record {
public
function
setUp
()
{
$this
->
own
sMany
(
'PackageVersion as Version'
,
'PackageVersion.package_id'
);
$this
->
ha
sMany
(
'PackageVersion as Version'
,
'PackageVersion.package_id'
);
}
}
models/QueryTest_Board.php
View file @
02c57f59
...
...
@@ -22,6 +22,6 @@ class QueryTest_Board extends Doctrine_Record
public
function
setUp
()
{
$this
->
hasOne
(
'QueryTest_Category as category'
,
'QueryTest_Board.categoryId'
);
$this
->
own
sOne
(
'QueryTest_Entry as lastEntry'
,
'QueryTest_Board.lastEntryId'
);
$this
->
ha
sOne
(
'QueryTest_Entry as lastEntry'
,
'QueryTest_Board.lastEntryId'
);
}
}
models/QueryTest_Category.php
View file @
02c57f59
...
...
@@ -29,8 +29,8 @@ class QueryTest_Category extends Doctrine_Record
*/
public
function
setUp
()
{
$this
->
own
sMany
(
'QueryTest_Category as subCategories'
,
'subCategories.parentCategoryId'
);
$this
->
ha
sMany
(
'QueryTest_Category as subCategories'
,
'subCategories.parentCategoryId'
);
$this
->
hasOne
(
'QueryTest_Category as rootCategory'
,
'QueryTest_Category.rootCategoryId'
);
$this
->
own
sMany
(
'QueryTest_Board as boards'
,
'QueryTest_Board.categoryId'
);
$this
->
ha
sMany
(
'QueryTest_Board as boards'
,
'QueryTest_Board.categoryId'
);
}
}
models/Rec1.php
View file @
02c57f59
...
...
@@ -8,7 +8,7 @@ class Rec1 extends Doctrine_Record
public
function
setUp
()
{
$this
->
own
sOne
(
'Rec2 as Account'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'user_id'
));
$this
->
ha
sOne
(
'Rec2 as Account'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'user_id'
));
}
}
...
...
models/Rec2.php
View file @
02c57f59
...
...
@@ -9,7 +9,7 @@ class Rec2 extends Doctrine_Record
public
function
setUp
()
{
$this
->
own
sOne
(
'Rec1 as User'
,
'Rec2.user_id'
);
$this
->
ha
sOne
(
'Rec1 as User'
,
'Rec2.user_id'
);
}
}
models/ValidatorTest_Person.php
View file @
02c57f59
...
...
@@ -6,6 +6,6 @@ class ValidatorTest_Person extends Doctrine_Record {
}
public
function
setUp
()
{
$this
->
own
sOne
(
'ValidatorTest_FootballPlayer'
,
'ValidatorTest_FootballPlayer.person_id'
);
$this
->
ha
sOne
(
'ValidatorTest_FootballPlayer'
,
'ValidatorTest_FootballPlayer.person_id'
);
}
}
tests/Record/SynchronizeTestCase.php
View file @
02c57f59
...
...
@@ -60,13 +60,13 @@ class Doctrine_Record_Synchronize_TestCase extends Doctrine_UnitTestCase
// delete a Phonenumber
array_pop
(
$userArray
[
'Phonenumber'
]);
$user
->
synchronize
With
Array
(
$userArray
);
$user
->
synchronize
From
Array
(
$userArray
);
$this
->
assertEqual
(
$user
->
Phonenumber
->
count
(),
1
);
$this
->
assertEqual
(
$user
->
Phonenumber
[
0
]
->
phonenumber
,
'555 321'
);
// change Email
$userArray
[
'Email'
][
'address'
]
=
'johndow@mail.com'
;
$user
->
synchronize
With
Array
(
$userArray
);
$user
->
synchronize
From
Array
(
$userArray
);
$this
->
assertEqual
(
$user
->
Email
->
address
,
'johndow@mail.com'
);
$user
->
save
();
...
...
@@ -86,7 +86,7 @@ class Doctrine_Record_Synchronize_TestCase extends Doctrine_UnitTestCase
$userArray
=
$user
->
toArray
(
true
);
$userArray
[
'Phonenumber'
][]
=
array
(
'phonenumber'
=>
'333 238'
);
$user
->
synchronize
With
Array
(
$userArray
);
$user
->
synchronize
From
Array
(
$userArray
);
$this
->
assertEqual
(
$user
->
Phonenumber
->
count
(),
2
);
$this
->
assertEqual
(
$user
->
Phonenumber
[
1
]
->
phonenumber
,
'333 238'
);
$user
->
save
();
...
...
@@ -106,7 +106,7 @@ class Doctrine_Record_Synchronize_TestCase extends Doctrine_UnitTestCase
unset
(
$userArray
[
'Phonenumber'
]);
unset
(
$userArray
[
'Email'
]);
$user
->
synchronize
With
Array
(
$userArray
);
$user
->
synchronize
From
Array
(
$userArray
);
$this
->
assertEqual
(
$user
->
Phonenumber
->
count
(),
0
);
$this
->
assertTrue
(
!
isset
(
$user
->
Email
));
$user
->
save
();
...
...
tests/TableTestCase.php
View file @
02c57f59
...
...
@@ -106,7 +106,7 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
$fk
=
$this
->
objTable
->
getTable
()
->
getRelation
(
"Email"
);
$this
->
assertTrue
(
$fk
instanceof
Doctrine_Relation_LocalKey
);
$this
->
assertTrue
(
$fk
->
getTable
()
instanceof
Doctrine_Table
);
$this
->
assertTrue
(
$fk
->
getType
()
==
Doctrine_Relation
::
ONE_
COMPOSI
TE
);
$this
->
assertTrue
(
$fk
->
getType
()
==
Doctrine_Relation
::
ONE_
AGGREGA
TE
);
$this
->
assertTrue
(
$fk
->
getLocal
()
==
"email_id"
);
$this
->
assertTrue
(
$fk
->
getForeign
()
==
$fk
->
getTable
()
->
getIdentifier
());
...
...
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