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
4ed44771
Commit
4ed44771
authored
Jun 26, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
87474aa0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
24 deletions
+34
-24
UnitOfWork.php
lib/Doctrine/Connection/UnitOfWork.php
+33
-0
Record.php
lib/Doctrine/Record.php
+1
-24
No files found.
lib/Doctrine/Connection/UnitOfWork.php
View file @
4ed44771
...
...
@@ -131,6 +131,39 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
}
return
array_values
(
$tree
);
}
/**
* saves the given record
*
* @param Doctrine_Record $record
* @return void
*/
public
function
saveGraph
(
Doctrine_Record
$record
)
{
$conn
=
$this
->
getConnection
();
$conn
->
beginTransaction
();
$saveLater
=
$this
->
saveRelated
(
$record
);
if
(
$record
->
isValid
())
{
$this
->
save
(
$record
);
}
else
{
$conn
->
transaction
->
addInvalid
(
$record
);
}
foreach
(
$saveLater
as
$fk
)
{
$alias
=
$fk
->
getAlias
();
if
(
$record
->
hasReference
(
$alias
))
{
$obj
=
$record
->
$alias
;
$obj
->
save
(
$conn
);
}
}
// save the MANY-TO-MANY associations
$this
->
saveAssociations
(
$record
);
$conn
->
commit
();
}
/**
* saves the given record
*
...
...
lib/Doctrine/Record.php
View file @
4ed44771
...
...
@@ -948,30 +948,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
if
(
$conn
===
null
)
{
$conn
=
$this
->
_table
->
getConnection
();
}
$conn
->
beginTransaction
();
$saveLater
=
$conn
->
unitOfWork
->
saveRelated
(
$this
);
if
(
$this
->
isValid
())
{
$conn
->
unitOfWork
->
save
(
$this
);
}
else
{
$conn
->
transaction
->
addInvalid
(
$this
);
}
foreach
(
$saveLater
as
$fk
)
{
$alias
=
$fk
->
getAlias
();
if
(
isset
(
$this
->
_references
[
$alias
]))
{
$obj
=
$this
->
_references
[
$alias
];
$obj
->
save
(
$conn
);
}
}
// save the MANY-TO-MANY associations
$conn
->
unitOfWork
->
saveAssociations
(
$this
);
//$this->saveAssociations();
$conn
->
commit
();
$conn
->
unitOfWork
->
saveGraph
(
$this
);
}
/**
* Tries to save the object and all its related components.
...
...
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