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
ecbecaa6
Commit
ecbecaa6
authored
May 30, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new attribute Doctrine::ATTR_LOAD_REFERENCES
parent
b8559e37
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
19 deletions
+17
-19
Configurable.php
lib/Doctrine/Configurable.php
+1
-0
Manager.php
lib/Doctrine/Manager.php
+1
-0
Record.php
lib/Doctrine/Record.php
+5
-14
Relation.php
lib/Doctrine/Relation.php
+2
-1
Association.php
lib/Doctrine/Relation/Association.php
+1
-1
ForeignKey.php
lib/Doctrine/Relation/ForeignKey.php
+6
-2
LocalKey.php
lib/Doctrine/Relation/LocalKey.php
+1
-1
No files found.
lib/Doctrine/Configurable.php
View file @
ecbecaa6
...
...
@@ -138,6 +138,7 @@ abstract class Doctrine_Configurable
case
Doctrine
::
ATTR_DEFAULT_SEQUENCE
:
case
Doctrine
::
ATTR_EXPORT
:
case
Doctrine
::
ATTR_DECIMAL_PLACES
:
case
Doctrine
::
ATTR_LOAD_REFERENCES
:
break
;
case
Doctrine
::
ATTR_SEQCOL_NAME
:
...
...
lib/Doctrine/Manager.php
View file @
ecbecaa6
...
...
@@ -103,6 +103,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
Doctrine
::
ATTR_DQL_PARSER_CACHE
=>
null
,
Doctrine
::
ATTR_DQL_CACHE
=>
null
,
Doctrine
::
ATTR_SQL_CACHE
=>
null
,
Doctrine
::
ATTR_LOAD_REFERENCES
=>
true
,
Doctrine
::
ATTR_LISTENER
=>
new
Doctrine_EventListener
(),
Doctrine
::
ATTR_LOCKMODE
=>
1
,
Doctrine
::
ATTR_VLD
=>
false
,
...
...
lib/Doctrine/Record.php
View file @
ecbecaa6
...
...
@@ -145,10 +145,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
// get the table of this class
$this
->
_table
=
Doctrine_Manager
::
getInstance
()
->
getTable
(
get_class
(
$this
));
$exists
=
false
;
}
// initialize the filter object
$this
->
_filter
=
new
Doctrine_Record_Filter
(
$this
);
...
...
@@ -370,7 +369,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this
->
_data
[
$k
]
=
$v
;
}
$this
->
_data
=
$this
->
_filter
->
cleanData
(
$this
->
_data
);
$this
->
prepareIdentifiers
();
$this
->
prepareIdentifiers
(
true
);
}
/**
* prepareIdentifiers
...
...
@@ -1254,18 +1253,10 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* @param string $name
* @return void
*/
final
public
function
loadReference
(
$name
)
public
function
loadReference
(
$name
)
{
$fk
=
$this
->
_table
->
getRelation
(
$name
);
if
(
$fk
->
isOneToOne
())
{
$this
->
_references
[
$name
]
=
$fk
->
fetchRelatedFor
(
$this
);
}
else
{
$coll
=
$fk
->
fetchRelatedFor
(
$this
);
$this
->
_references
[
$name
]
=
$coll
;
}
$rel
=
$this
->
_table
->
getRelation
(
$name
);
$this
->
_references
[
$name
]
=
$rel
->
fetchRelatedFor
(
$this
);
}
/**
* ownsOne
...
...
lib/Doctrine/Relation.php
View file @
ecbecaa6
...
...
@@ -61,6 +61,7 @@ abstract class Doctrine_Relation
'local'
=>
true
,
'class'
=>
true
,
'type'
=>
true
,
'table'
=>
true
,
'name'
=>
false
,
'refTable'
=>
false
,
'onDelete'
=>
false
,
...
...
@@ -129,7 +130,7 @@ abstract class Doctrine_Relation
$this
->
definition
=
$def
;
}
/**
/**
* toArray
*
* @return array
...
...
lib/Doctrine/Relation/Association.php
View file @
ecbecaa6
...
...
@@ -88,7 +88,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
public
function
fetchRelatedFor
(
Doctrine_Record
$record
)
{
$id
=
$record
->
getIncremented
();
if
(
empty
(
$id
))
{
if
(
empty
(
$id
)
||
!
$this
->
definition
[
'table'
]
->
getAttribute
(
Doctrine
::
ATTR_LOAD_REFERENCES
)
)
{
$coll
=
new
Doctrine_Collection
(
$this
->
getTable
());
}
else
{
$coll
=
Doctrine_Query
::
create
()
->
parseQuery
(
$this
->
getRelationDql
(
1
))
->
execute
(
array
(
$id
));
...
...
lib/Doctrine/Relation/ForeignKey.php
View file @
ecbecaa6
...
...
@@ -51,7 +51,9 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
}
}
if
(
$this
->
isOneToOne
())
{
if
(
!
$record
->
exists
()
||
empty
(
$id
))
{
if
(
!
$record
->
exists
()
||
empty
(
$id
)
||
!
$this
->
definition
[
'table'
]
->
getAttribute
(
Doctrine
::
ATTR_LOAD_REFERENCES
))
{
$related
=
$this
->
getTable
()
->
create
();
}
else
{
$dql
=
'FROM '
.
$this
->
getTable
()
->
getComponentName
()
...
...
@@ -65,7 +67,9 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
}
else
{
if
(
!
$record
->
exists
()
||
empty
(
$id
))
{
if
(
!
$record
->
exists
()
||
empty
(
$id
)
||
!
$this
->
definition
[
'table'
]
->
getAttribute
(
Doctrine
::
ATTR_LOAD_REFERENCES
))
{
$related
=
new
Doctrine_Collection
(
$this
->
getTable
());
}
else
{
$query
=
$this
->
getRelationDql
(
1
);
...
...
lib/Doctrine/Relation/LocalKey.php
View file @
ecbecaa6
...
...
@@ -45,7 +45,7 @@ class Doctrine_Relation_LocalKey extends Doctrine_Relation
{
$id
=
$record
->
get
(
$this
->
definition
[
'local'
]);
if
(
empty
(
$id
))
{
if
(
empty
(
$id
)
||
!
$this
->
definition
[
'table'
]
->
getAttribute
(
Doctrine
::
ATTR_LOAD_REFERENCES
)
)
{
$related
=
$this
->
getTable
()
->
create
();
}
else
{
$related
=
$this
->
getTable
()
->
find
(
$id
);
...
...
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