Add support for calling Media object as function to get medium by filename

This commit is contained in:
Matias Griese
2016-12-12 09:31:33 +02:00
parent 156f645576
commit 9db04abd1c
2 changed files with 12 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
1. [](#improved)
* Better error handling in cache clear
* Add support for calling Media object as function to get medium by filename
1. [](#bugfix)
* Added new parameter `remove` for `onBeforeCacheClear` event
* YAML syntax fixes

View File

@@ -31,6 +31,17 @@ abstract class AbstractMedia extends Getters
return $this->offsetGet($filename);
}
/**
* Call object as function to get medium by filename.
*
* @param string $filename
* @return mixed
*/
public function __invoke($filename)
{
return $this->offsetGet($filename);
}
/**
* Get a list of all media.
*