mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Check whether subdef exists before perform get on it
This commit is contained in:
@@ -129,6 +129,24 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
$this->AvSubdefs = $avSubdefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $subdef_type
|
||||
* @param string $subdef_name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSubdef($subdef_type, $subdef_name)
|
||||
{
|
||||
$type = strtolower($subdef_type);
|
||||
$name = strtolower($subdef_name);
|
||||
|
||||
if (isset($this->AvSubdefs[$type][$name])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $subdef_type
|
||||
* @param string $subdef_name
|
||||
|
Reference in New Issue
Block a user