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
2291272e
Commit
2291272e
authored
May 16, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
827755af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
66 deletions
+22
-66
Connection.php
lib/Doctrine/Connection.php
+1
-1
UnitOfWork.php
lib/Doctrine/Connection/UnitOfWork.php
+19
-19
Hydrate.php
lib/Doctrine/Hydrate.php
+2
-3
Association.php
lib/Doctrine/Relation/Association.php
+0
-43
No files found.
lib/Doctrine/Connection.php
View file @
2291272e
...
...
@@ -492,7 +492,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
// prepare and execute the statement
$this
->
execute
(
$query
,
array_values
(
$values
));
print
$query
.
'('
.
implode
(
', '
,
$values
)
.
")<br>"
;
return
true
;
}
/**
...
...
lib/Doctrine/Connection/UnitOfWork.php
View file @
2291272e
...
...
@@ -162,22 +162,6 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
}
}
}
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
);
}
}
return
$saveLater
;
...
...
@@ -199,11 +183,27 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
*/
public
function
saveAssociations
(
Doctrine_Record
$record
)
{
foreach
(
$record
->
getTable
()
->
getRelations
()
as
$rel
)
{
$table
=
$rel
->
getTable
();
$alias
=
$rel
->
getAlias
();
foreach
(
$record
->
getReferences
()
as
$k
=>
$v
)
{
$rel
=
$record
->
getTable
()
->
getRelation
(
$k
);
if
(
$rel
instanceof
Doctrine_Relation_Association
)
{
$v
->
save
(
$this
->
conn
);
$assocTable
=
$rel
->
getAssociationTable
();
foreach
(
$v
->
getDeleteDiff
()
as
$r
)
{
$query
=
'DELETE FROM '
.
$assocTable
->
getTableName
()
.
' WHERE '
.
$rel
->
getForeign
()
.
' = ?'
.
' AND '
.
$rel
->
getLocal
()
.
' = ?'
;
$this
->
query
(
$r
->
getIncremented
(),
$record
->
getIncremented
());
}
foreach
(
$v
->
getInsertDiff
()
as
$r
)
{
$assocRecord
=
$assocTable
->
create
();
$assocRecord
->
set
(
$rel
->
getForeign
(),
$r
);
$assocRecord
->
set
(
$rel
->
getLocal
(),
$record
);
$assocRecord
->
save
(
$this
->
conn
);
}
}
}
}
/**
...
...
lib/Doctrine/Hydrate.php
View file @
2291272e
...
...
@@ -400,11 +400,10 @@ class Doctrine_Hydrate
$rootAlias
=
key
(
$this
->
_aliasMap
);
$coll
=
new
Doctrine_Collection
(
$rootMap
[
'table'
]);
$prev
[
$rootAlias
]
=
$coll
;
// we keep track of all the collections
$colls
=
array
();
$colls
[]
=
$coll
;
$colls
[]
=
$coll
;
print_r
(
$array
);
$prevRow
=
array
();
/**
* iterate over the fetched data
...
...
lib/Doctrine/Relation/Association.php
View file @
2291272e
...
...
@@ -46,49 +46,6 @@ class Doctrine_Relation_Association extends Doctrine_Relation
{
return
$this
->
definition
[
'assocTable'
];
}
/**
* processDiff
*
* @param Doctrine_Record $record
* @param Doctrine_Connection $conn
*/
public
function
processDiff
(
Doctrine_Record
$record
,
$conn
=
null
)
{
if
(
!
$conn
)
{
$conn
=
$this
->
getTable
()
->
getConnection
();
}
$asf
=
$this
->
getAssociationFactory
();
$alias
=
$this
->
getAlias
();
if
(
$record
->
hasReference
(
$alias
))
{
$new
=
$record
->
obtainReference
(
$alias
);
if
(
!
$record
->
obtainOriginals
(
$alias
))
{
$record
->
loadReference
(
$alias
);
}
$operations
=
Doctrine_Relation
::
getDeleteOperations
(
$record
->
obtainOriginals
(
$alias
),
$new
);
foreach
(
$operations
as
$r
)
{
$query
=
'DELETE FROM '
.
$asf
->
getTableName
()
.
' WHERE '
.
$this
->
getForeign
()
.
' = ?'
.
' AND '
.
$this
->
getLocal
()
.
' = ?'
;
$conn
->
execute
(
$query
,
array
(
$r
->
getIncremented
(),
$record
->
getIncremented
()));
}
$operations
=
Doctrine_Relation
::
getInsertOperations
(
$record
->
obtainOriginals
(
$alias
),
$new
);
foreach
(
$operations
as
$r
)
{
$reldao
=
$asf
->
create
();
$reldao
->
set
(
$this
->
getForeign
(),
$r
);
$reldao
->
set
(
$this
->
getLocal
(),
$record
);
$reldao
->
save
(
$conn
);
}
$record
->
assignOriginals
(
$alias
,
clone
$record
->
get
(
$alias
));
}
}
/**
* getRelationDql
*
...
...
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