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
3cd669ad
Commit
3cd669ad
authored
Jul 26, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[amadeus] added Record::has() and Table::hasForeignKey(),hasRelatedComponent()
parent
a20d0544
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
24 deletions
+58
-24
Record.php
Doctrine/Record.php
+12
-0
Table.php
Doctrine/Table.php
+46
-24
No files found.
Doctrine/Record.php
View file @
3cd669ad
...
...
@@ -607,6 +607,18 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this
->
modified
[]
=
$name
;
}
}
/**
* has
* method for checking existence of properties and Doctrine_Record references
*
* @param mixed $name name of the property or reference
* @return boolean
*/
public
function
has
(
$name
)
{
if
(
isset
(
$this
->
data
[
$name
])
OR
isset
(
$this
->
id
[
$name
]))
return
true
;
return
$this
->
table
->
hasForeignKey
(
$name
);
}
/**
* set
* method for altering properties and Doctrine_Record references
...
...
Doctrine/Table.php
View file @
3cd669ad
...
...
@@ -513,6 +513,28 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
final
public
function
getCache
()
{
return
$this
->
cache
;
}
/**
* hasRelatedComponent
* @return boolean
*/
final
public
function
hasRelatedComponent
(
$name
,
$component
)
{
return
(
strpos
(
$this
->
bound
[
$name
][
0
],
$component
.
'.'
)
!==
false
);
}
/**
* @param string $name component name of which a foreign key object is bound
* @return boolean
*/
final
public
function
hasForeignKey
(
$name
)
{
if
(
isset
(
$this
->
bound
[
$name
]))
return
true
;
foreach
(
$this
->
bound
as
$k
=>
$v
)
{
if
(
$this
->
hasRelatedComponent
(
$k
,
$name
))
return
true
;
}
return
false
;
}
/**
* @param string $name component name of which a foreign key object is bound
* @return Doctrine_Relation
...
...
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