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
4e99dcb5
Commit
4e99dcb5
authored
May 24, 2008
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for test case in DQL
parent
0ad6aee3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
ClassMetadata.php
lib/Doctrine/ClassMetadata.php
+45
-0
Connection.php
lib/Doctrine/Connection.php
+1
-1
IndexBy.php
lib/Doctrine/Query/Production/IndexBy.php
+2
-2
No files found.
lib/Doctrine/ClassMetadata.php
View file @
4e99dcb5
...
@@ -338,6 +338,51 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
...
@@ -338,6 +338,51 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
return
in_array
(
$fieldName
,
$this
->
_identifier
);
return
in_array
(
$fieldName
,
$this
->
_identifier
);
}
}
/**
* Check if the field is unique
*
* @param string $fieldName The field name
* @return boolean TRUE if the field is unique, FALSE otherwise.
*/
public
function
isIdentifierComposite
()
{
return
(
$this
->
_identifierType
==
Doctrine
::
IDENTIFIER_COMPOSITE
);
}
/**
* Check if the field is unique
*
* @param string $fieldName The field name
* @return boolean TRUE if the field is unique, FALSE otherwise.
*/
public
function
isUniqueField
(
$fieldName
)
{
$mapping
=
$this
->
getColumnMapping
(
$fieldName
);
if
(
$mapping
!==
false
)
{
return
isset
(
$mapping
[
'unique'
])
&&
$mapping
[
'unique'
]
==
true
;
}
return
false
;
}
/**
* Check if the field is not null
*
* @param string $fieldName The field name
* @return boolean TRUE if the field is not null, FALSE otherwise.
*/
public
function
isNotNull
(
$fieldName
)
{
$mapping
=
$this
->
getColumnMapping
(
$fieldName
);
if
(
$mapping
!==
false
)
{
return
isset
(
$mapping
[
'notnull'
])
&&
$mapping
[
'notnull'
]
==
true
;
}
return
false
;
}
/**
/**
* addIndex
* addIndex
*
*
...
...
lib/Doctrine/Connection.php
View file @
4e99dcb5
...
@@ -853,7 +853,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
...
@@ -853,7 +853,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
*
*
* @return string
* @return string
*/
*/
public
function
modifyLimitQuery
(
$query
,
$
query
,
$
limit
=
false
,
$offset
=
false
,
$isManip
=
false
)
public
function
modifyLimitQuery
(
$query
,
$limit
=
false
,
$offset
=
false
,
$isManip
=
false
)
{
{
return
$query
;
return
$query
;
}
}
...
...
lib/Doctrine/Query/Production/IndexBy.php
View file @
4e99dcb5
...
@@ -79,7 +79,7 @@ class Doctrine_Query_Production_IndexBy extends Doctrine_Query_Production
...
@@ -79,7 +79,7 @@ class Doctrine_Query_Production_IndexBy extends Doctrine_Query_Production
// The INDEXBY field must be either the (primary && not part of composite pk) || (unique && notnull)
// The INDEXBY field must be either the (primary && not part of composite pk) || (unique && notnull)
$columnMapping
=
$classMetadata
->
getColumnMapping
(
$this
->
_fieldName
);
$columnMapping
=
$classMetadata
->
getColumnMapping
(
$this
->
_fieldName
);
if
(
!
$classMetadata
->
isIdentifier
(
$
field
)
&&
!
$classMetadata
->
isUniqueField
(
$field
)
&&
!
$classMetadata
->
isNotNull
(
$field
))
{
if
(
!
$classMetadata
->
isIdentifier
(
$
this
->
_fieldName
)
&&
!
$classMetadata
->
isUniqueField
(
$this
->
_fieldName
)
&&
!
$classMetadata
->
isNotNull
(
$this
->
_fieldName
))
{
$this
->
_parser
->
semanticalError
(
$this
->
_parser
->
semanticalError
(
"Field '"
.
$this
->
_fieldName
.
"' of component '"
.
$classMetadata
->
getClassName
()
.
"Field '"
.
$this
->
_fieldName
.
"' of component '"
.
$classMetadata
->
getClassName
()
.
"' must be unique and notnull to be used as index."
,
"' must be unique and notnull to be used as index."
,
...
@@ -87,7 +87,7 @@ class Doctrine_Query_Production_IndexBy extends Doctrine_Query_Production
...
@@ -87,7 +87,7 @@ class Doctrine_Query_Production_IndexBy extends Doctrine_Query_Production
);
);
}
}
if
(
$classMetadata
->
isIdentifier
(
$
field
)
&&
$classMetadata
->
isIdentifierComposite
())
{
if
(
$classMetadata
->
isIdentifier
(
$
this
->
_fieldName
)
&&
$classMetadata
->
isIdentifierComposite
())
{
$this
->
_parser
->
semanticalError
(
$this
->
_parser
->
semanticalError
(
"Field '"
.
$this
->
_fieldName
.
"' of component '"
.
$classMetadata
->
getClassName
()
.
"Field '"
.
$this
->
_fieldName
.
"' of component '"
.
$classMetadata
->
getClassName
()
.
"' must be primary and not part of a composite primary key to be used as index."
,
"' must be primary and not part of a composite primary key to be used as index."
,
...
...
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