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
dba07641
Commit
dba07641
authored
Oct 07, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Fixing exception messages for mapping fields and associations
parent
bf90126e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
11 deletions
+32
-11
ClassMetadataInfo.php
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
+32
-11
No files found.
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
View file @
dba07641
...
...
@@ -588,7 +588,7 @@ class ClassMetadataInfo
public
function
getFieldMapping
(
$fieldName
)
{
if
(
!
isset
(
$this
->
fieldMappings
[
$fieldName
]))
{
throw
MappingException
::
mappingNotFound
(
$fieldName
);
throw
MappingException
::
mappingNotFound
(
$
this
->
name
,
$
fieldName
);
}
return
$this
->
fieldMappings
[
$fieldName
];
}
...
...
@@ -603,7 +603,7 @@ class ClassMetadataInfo
public
function
getAssociationMapping
(
$fieldName
)
{
if
(
!
isset
(
$this
->
associationMappings
[
$fieldName
]))
{
throw
MappingException
::
mappingNotFound
(
$fieldName
);
throw
MappingException
::
mappingNotFound
(
$
this
->
name
,
$
fieldName
);
}
return
$this
->
associationMappings
[
$fieldName
];
}
...
...
@@ -681,10 +681,10 @@ class ClassMetadataInfo
{
// Check mandatory fields
if
(
!
isset
(
$mapping
[
'fieldName'
]))
{
throw
MappingException
::
missingFieldName
();
throw
MappingException
::
missingFieldName
(
$this
->
name
,
$mapping
);
}
if
(
!
isset
(
$mapping
[
'type'
]))
{
throw
MappingException
::
missingType
();
throw
MappingException
::
missingType
(
$this
->
name
,
$mapping
);
}
// Complete fieldName and columnName mapping
...
...
@@ -752,7 +752,7 @@ class ClassMetadataInfo
public
function
getSingleIdentifierFieldName
()
{
if
(
$this
->
isIdentifierComposite
)
{
throw
DoctrineException
::
singleIdNotAllowedOnCompositePrimaryKey
();
throw
DoctrineException
::
singleIdNotAllowedOnCompositePrimaryKey
(
$this
->
name
);
}
return
$this
->
identifier
[
0
];
}
...
...
@@ -790,6 +790,16 @@ class ClassMetadataInfo
return
isset
(
$this
->
fieldMappings
[
$fieldName
]);
}
public
function
hasInheritedMapping
(
$fieldName
)
{
if
(
isset
(
$this
->
fieldMappings
[
$fieldName
])
||
isset
(
$this
->
associationMappings
[
$fieldName
]))
{
}
else
{
return
false
;
}
}
/**
* Gets all field mappings.
*
...
...
@@ -1086,7 +1096,7 @@ class ClassMetadataInfo
public
function
setInheritanceType
(
$type
)
{
if
(
!
$this
->
_isInheritanceType
(
$type
))
{
throw
MappingException
::
invalidInheritanceType
(
$type
);
throw
MappingException
::
invalidInheritanceType
(
$t
his
->
name
,
$t
ype
);
}
$this
->
inheritanceType
=
$type
;
}
...
...
@@ -1101,6 +1111,17 @@ class ClassMetadataInfo
return
isset
(
$this
->
fieldMappings
[
$fieldName
][
'inherited'
]);
}
/**
* Checks whether a mapped association field is inherited from a superclass.
*
* @param string $fieldName
* @return boolean TRUE if the field is inherited, FALSE otherwise.
*/
public
function
isInheritedAssociation
(
$fieldName
)
{
return
isset
(
$this
->
inheritedAssociationFields
[
$fieldName
]);
}
/**
* Sets the name of the primary table the class is mapped to.
*
...
...
@@ -1192,7 +1213,7 @@ class ClassMetadataInfo
{
$this
->
_validateAndCompleteFieldMapping
(
$mapping
);
if
(
isset
(
$this
->
fieldMappings
[
$mapping
[
'fieldName'
]]))
{
throw
MappingException
::
duplicateFieldMapping
(
$mapping
[
'fieldName'
]);
throw
MappingException
::
duplicateFieldMapping
(
$
this
->
name
,
$
mapping
[
'fieldName'
]);
}
$this
->
fieldMappings
[
$mapping
[
'fieldName'
]]
=
$mapping
;
}
...
...
@@ -1210,7 +1231,7 @@ class ClassMetadataInfo
{
$sourceFieldName
=
$mapping
->
sourceFieldName
;
if
(
isset
(
$this
->
associationMappings
[
$sourceFieldName
]))
{
throw
MappingException
::
duplicate
FieldMapping
(
);
throw
MappingException
::
duplicate
AssociationMapping
(
$this
->
name
,
$sourceFieldName
);
}
$this
->
associationMappings
[
$sourceFieldName
]
=
$mapping
;
if
(
$owningClassName
!==
null
)
{
...
...
@@ -1304,7 +1325,7 @@ class ClassMetadataInfo
{
$sourceFieldName
=
$assocMapping
->
sourceFieldName
;
if
(
isset
(
$this
->
associationMappings
[
$sourceFieldName
]))
{
throw
MappingException
::
duplicateFieldMapping
();
throw
MappingException
::
duplicateFieldMapping
(
$this
->
name
,
$sourceFieldName
);
}
$this
->
associationMappings
[
$sourceFieldName
]
=
$assocMapping
;
$this
->
_registerMappingIfInverse
(
$assocMapping
);
...
...
@@ -1418,7 +1439,7 @@ class ClassMetadataInfo
{
if
(
$columnDef
!==
null
)
{
if
(
!
isset
(
$columnDef
[
'name'
]))
{
throw
new
MappingException
(
"'name' attribute is mandatory for discriminator columns."
);
throw
MappingException
::
nameIsMandatoryForDiscriminatorColumns
(
$this
->
name
,
$columnDef
);
}
if
(
!
isset
(
$columnDef
[
'fieldName'
]))
{
$columnDef
[
'fieldName'
]
=
$columnDef
[
'name'
];
...
...
@@ -1614,7 +1635,7 @@ class ClassMetadataInfo
}
else
if
(
$mapping
[
'type'
]
==
'datetime'
)
{
$mapping
[
'default'
]
=
'CURRENT_TIMESTAMP'
;
}
else
{
throw
DoctrineException
::
unsupportedOptimisticLockingType
(
$mapping
[
'type'
]);
throw
DoctrineException
::
unsupportedOptimisticLockingType
(
$
this
->
name
,
$mapping
[
'fieldName'
],
$
mapping
[
'type'
]);
}
}
}
...
...
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