Imbo\EventManager\EventInterface::getStorage PHP Method

getStorage() public method

Get the storage adapter
public getStorage ( ) : Imbo\Storage\StorageInterface
return Imbo\Storage\StorageInterface
    function getStorage();

Usage Example

Example #1
0
 /**
  * Insert an image
  *
  * @param EventInterface $event An event instance
  */
 public function insertImage(EventInterface $event)
 {
     $request = $event->getRequest();
     $user = $request->getUser();
     $image = $request->getImage();
     $imageIdentifier = $image->getImageIdentifier();
     $blob = $image->getBlob();
     try {
         $exists = $event->getStorage()->imageExists($user, $imageIdentifier);
         $event->getStorage()->store($user, $imageIdentifier, $blob);
     } catch (StorageException $e) {
         $event->getDatabase()->deleteImage($user, $imageIdentifier);
         throw $e;
     }
     $event->getResponse()->setStatusCode($exists ? 200 : 201);
 }
All Usage Examples Of Imbo\EventManager\EventInterface::getStorage