Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
12eba562
Commit
12eba562
authored
Jul 26, 2013
by
alexpott
Browse files
Issue
#1980464
by Xano: EntityManager::getControllerClass() throws confusing exceptions.
parent
34aaed60
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Entity/EntityManager.php
View file @
12eba562
...
...
@@ -154,8 +154,12 @@ public function hasController($entity_type, $controller_type) {
public
function
getControllerClass
(
$entity_type
,
$controller_type
,
$nested
=
NULL
)
{
$definition
=
$this
->
getDefinition
(
$entity_type
);
$definition
=
$definition
[
'controllers'
];
if
(
!
$definition
)
{
throw
new
\
InvalidArgumentException
(
sprintf
(
'The entity type (%s) does not exist.'
,
$entity_type
));
}
if
(
empty
(
$definition
[
$controller_type
]))
{
throw
new
\
InvalidArgumentException
(
sprintf
(
'The entity (%s) did not specify a %s.'
,
$entity_type
,
$controller_type
));
throw
new
\
InvalidArgumentException
(
sprintf
(
'The entity
type
(%s) did not specify a %s
controller
.'
,
$entity_type
,
$controller_type
));
}
$class
=
$definition
[
$controller_type
];
...
...
@@ -163,14 +167,14 @@ public function getControllerClass($entity_type, $controller_type, $nested = NUL
// Some class definitions can be nested.
if
(
isset
(
$nested
))
{
if
(
empty
(
$class
[
$nested
]))
{
throw
new
\
InvalidArgumentException
(
sprintf
(
"
Missing '%s: %s' for entity '%s'"
,
$controller_type
,
$nested
,
$entity_type
));
throw
new
\
InvalidArgumentException
(
sprintf
(
"
The entity type (%s) did not specify a %s controller: %s."
,
$entity_type
,
$controller_type
,
$nested
));
}
$class
=
$class
[
$nested
];
}
if
(
!
class_exists
(
$class
))
{
throw
new
\
InvalidArgumentException
(
sprintf
(
'
Entity (%s) %s
"%s" does not exist.'
,
$entity_type
,
$controller_type
,
$class
));
throw
new
\
InvalidArgumentException
(
sprintf
(
'
The entity type (%s) %s controller
"%s" does not exist.'
,
$entity_type
,
$controller_type
,
$class
));
}
return
$class
;
...
...
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