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
b7bf2265
Commit
b7bf2265
authored
Aug 01, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enhanced InvalidKeyException messages
parent
d0528260
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
Query.php
Doctrine/Query.php
+3
-3
Table.php
Doctrine/Table.php
+7
-5
No files found.
Doctrine/Query.php
View file @
b7bf2265
...
@@ -38,11 +38,11 @@ class Doctrine_Query extends Doctrine_Hydrate {
...
@@ -38,11 +38,11 @@ class Doctrine_Query extends Doctrine_Hydrate {
$where
=
$this
->
where
;
$where
=
$this
->
where
;
$having
=
$this
->
having
;
$having
=
$this
->
having
;
$q
=
"SELECT COUNT(1) FROM "
.
$table
.
" "
;
$q
=
"SELECT COUNT(1) FROM "
.
$table
->
getComponentName
()
.
" "
;
foreach
(
$join
as
$j
)
{
foreach
(
$join
as
$j
)
{
$q
.=
implode
(
" "
,
$j
);
$q
.=
implode
(
" "
,
$j
);
}
}
$string
=
$
query
->
applyInheritance
();
$string
=
$
this
->
applyInheritance
();
if
(
!
empty
(
$where
))
{
if
(
!
empty
(
$where
))
{
$q
.=
" WHERE "
.
implode
(
" AND "
,
$where
);
$q
.=
" WHERE "
.
implode
(
" AND "
,
$where
);
...
@@ -56,7 +56,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
...
@@ -56,7 +56,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
if
(
!
empty
(
$having
))
if
(
!
empty
(
$having
))
$q
.=
" HAVING "
.
implode
(
' AND '
,
$having
);
$q
.=
" HAVING "
.
implode
(
' AND '
,
$having
);
$a
=
$this
->
table
->
getSession
()
->
execute
(
$q
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
);
$a
=
$this
->
getSession
()
->
execute
(
$q
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
);
return
$a
[
0
];
return
$a
[
0
];
}
}
/**
/**
...
...
Doctrine/Table.php
View file @
b7bf2265
...
@@ -398,7 +398,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
...
@@ -398,7 +398,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
*/
*/
final
public
function
getBound
(
$name
)
{
final
public
function
getBound
(
$name
)
{
if
(
!
isset
(
$this
->
bound
[
$name
]))
if
(
!
isset
(
$this
->
bound
[
$name
]))
throw
new
InvalidKeyException
();
throw
new
InvalidKeyException
(
'Unknown bound '
.
$name
);
return
$this
->
bound
[
$name
];
return
$this
->
bound
[
$name
];
}
}
...
@@ -414,7 +414,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
...
@@ -414,7 +414,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
return
$this
->
bound
[
$k
];
return
$this
->
bound
[
$k
];
}
}
}
}
throw
new
InvalidKeyException
();
throw
new
InvalidKeyException
(
'Unknown bound '
.
$name
);
}
}
/**
/**
* returns the alias for given component name
* returns the alias for given component name
...
@@ -438,7 +438,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
...
@@ -438,7 +438,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
if
(
$name
=
array_search
(
$this
->
boundAliases
,
$alias
))
if
(
$name
=
array_search
(
$this
->
boundAliases
,
$alias
))
return
$name
;
return
$name
;
throw
new
InvalidKeyException
();
throw
new
InvalidKeyException
(
'Unknown alias '
.
$alias
);
}
}
/**
/**
* unbinds all relations
* unbinds all relations
...
@@ -480,7 +480,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
...
@@ -480,7 +480,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
*/
*/
final
public
function
bind
(
$name
,
$field
,
$type
,
$localKey
)
{
final
public
function
bind
(
$name
,
$field
,
$type
,
$localKey
)
{
if
(
isset
(
$this
->
relations
[
$name
]))
if
(
isset
(
$this
->
relations
[
$name
]))
throw
new
InvalidKeyException
();
throw
new
InvalidKeyException
(
'Relation already set for '
.
$name
);
$e
=
explode
(
" as "
,
$name
);
$e
=
explode
(
" as "
,
$name
);
$name
=
$e
[
0
];
$name
=
$e
[
0
];
...
@@ -540,6 +540,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
...
@@ -540,6 +540,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
* @return Doctrine_Relation
* @return Doctrine_Relation
*/
*/
final
public
function
getForeignKey
(
$name
)
{
final
public
function
getForeignKey
(
$name
)
{
$original
=
$name
;
if
(
isset
(
$this
->
relations
[
$name
]))
if
(
isset
(
$this
->
relations
[
$name
]))
return
$this
->
relations
[
$name
];
return
$this
->
relations
[
$name
];
...
@@ -614,7 +616,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
...
@@ -614,7 +616,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
$this
->
relations
[
$alias
]
=
$relation
;
$this
->
relations
[
$alias
]
=
$relation
;
return
$this
->
relations
[
$alias
];
return
$this
->
relations
[
$alias
];
}
}
throw
new
InvalidKeyException
();
throw
new
InvalidKeyException
(
'Unknown relation '
.
$original
);
}
}
/**
/**
* returns an array containing all foreign key objects
* returns an array containing all foreign key objects
...
...
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