/**
  * Save the image assignment to the database
  *
  * @param Bundle $bundle     The bundle the image is assigned to
  * @param bool $delete       If set to true, existing images will be deleted from the database. Defaults to true.
  */
 public function save(Bundle $bundle, $delete = true)
 {
     if ($delete) {
         $this->_query->run("\n\t\t\t\tDELETE FROM\n\t\t\t\t\tdiscount_bundle_image\n\t\t\t\tWHERE\n\t\t\t\t\tbundle_id = :id?i\n\t\t\t", ['id' => $bundle->getID()]);
     }
     if ($bundle->getImage()) {
         $this->_query->run("\n\t\t\t\tINSERT INTO\n\t\t\t\t\tdiscount_bundle_image\n\t\t\t\t\t(\n\t\t\t\t\t\tbundle_id,\n\t\t\t\t\t\tfile_id\n\t\t\t\t\t)\n\t\t\t\tVALUES\n\t\t\t\t\t(\n\t\t\t\t\t\t:bundleID?i,\n\t\t\t\t\t\t:fileID?i\n\t\t\t\t\t)\n\t\t\t", ['bundleID' => $bundle->getID(), 'fileID' => $bundle->getImage()->id]);
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getImage()
 {
     if (null === parent::getImage() && null !== $this->_imageID) {
         $image = $this->_loaders->get('file')->getImage($this);
         if ($image) {
             $this->setImage($image);
         }
     }
     return parent::getImage();
 }