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
4d0310bf
Commit
4d0310bf
authored
Jun 04, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
63bca659
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
Collection.php
lib/Doctrine/Collection.php
+4
-0
Record.php
lib/Doctrine/Hydrate/Record.php
+13
-0
Record.php
lib/Doctrine/Record.php
+10
-5
No files found.
lib/Doctrine/Collection.php
View file @
4d0310bf
...
...
@@ -277,6 +277,10 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
{
return
isset
(
$this
->
data
[
$key
]);
}
public
function
search
(
Doctrine_Record
$record
)
{
return
array_search
(
$record
,
$this
->
data
,
true
);
}
/**
* get
* returns a record for given key
...
...
lib/Doctrine/Hydrate/Record.php
View file @
4d0310bf
...
...
@@ -46,6 +46,19 @@ class Doctrine_Hydrate_Record
return
$coll
;
}
public
function
search
(
Doctrine_Record
$record
,
Doctrine_Collection
$coll
)
{
return
array_search
(
$record
,
$coll
->
getData
(),
true
);
}
public
function
initRelated
(
$record
,
$name
)
{
if
(
!
is_array
(
$record
))
{
$record
[
$name
];
return
true
;
}
return
false
;
}
public
function
registerCollection
(
Doctrine_Collection
$coll
)
{
$this
->
_collections
[]
=
$coll
;
...
...
lib/Doctrine/Record.php
View file @
4d0310bf
...
...
@@ -690,11 +690,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* returns a value of a property or a related component
*
* @param mixed $name name of the property or related component
* @param boolean $
invoke whether or not to invoke the onGetProperty listener
* @param boolean $
load whether or not to invoke the loading procedure
* @throws Doctrine_Record_Exception if trying to get a value of unknown property / related component
* @return mixed
*/
public
function
get
(
$name
,
$
invoke
=
true
)
public
function
get
(
$name
,
$
load
=
true
)
{
$value
=
self
::
$_null
;
$lower
=
strtolower
(
$name
);
...
...
@@ -726,9 +726,14 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
}
try
{
if
(
!
isset
(
$this
->
_references
[
$name
]))
{
$this
->
loadReference
(
$name
);
if
(
!
isset
(
$this
->
_references
[
$name
])
&&
$load
)
{
$rel
=
$this
->
_table
->
getRelation
(
$name
);
$this
->
_references
[
$name
]
=
$rel
->
fetchRelatedFor
(
$this
);
}
}
catch
(
Doctrine_Table_Exception
$e
)
{
throw
new
Doctrine_Record_Exception
(
"Unknown property / related component '
$name
'."
);
}
...
...
@@ -816,7 +821,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
// one-to-many or one-to-one relation
if
(
$rel
instanceof
Doctrine_Relation_ForeignKey
||
$rel
instanceof
Doctrine_Relation_LocalKey
)
{
$rel
instanceof
Doctrine_Relation_LocalKey
)
{
if
(
!
$rel
->
isOneToOne
())
{
// one-to-many relation found
if
(
!
(
$value
instanceof
Doctrine_Collection
))
{
...
...
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