mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 02:38:50 +02:00
Added links to part_lists on part info page.
This commit is contained in:
parent
2040178460
commit
429a4ebd17
5 changed files with 76 additions and 33 deletions
|
@ -77,9 +77,19 @@ class EntityURLGenerator
|
|||
{
|
||||
$class = get_class($entity);
|
||||
|
||||
//Check if we have an mapping for the given class
|
||||
//Check if we have an direct mapping for the given class
|
||||
if (!array_key_exists($class, $map)) {
|
||||
throw new EntityNotSupported('The given entity is not supported yet!');
|
||||
//Check if we need to check inheritance by looping through our map
|
||||
foreach ($map as $key => $value) {
|
||||
if (is_a($entity, $key)) {
|
||||
return $map[$key];
|
||||
}
|
||||
}
|
||||
|
||||
throw new EntityNotSupported(sprintf(
|
||||
'The given entity is not supported yet! Passed class type: %s',
|
||||
get_class($entity)
|
||||
));
|
||||
}
|
||||
|
||||
return $map[$class];
|
||||
|
@ -144,7 +154,10 @@ class EntityURLGenerator
|
|||
}
|
||||
|
||||
//Otherwise throw an error
|
||||
throw new EntityNotSupported('The given entity is not supported yet!');
|
||||
throw new EntityNotSupported(sprintf(
|
||||
'The given entity is not supported yet! Passed class type: %s',
|
||||
get_class($entity)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue