Xpressengine\Storage\Storage::unBindAll PHP Méthode

unBindAll() public méthode

unset all fileable's files to fileable
public unBindAll ( string $fileableId ) : void
$fileableId string fileable identifier
Résultat void
    public function unBindAll($fileableId)
    {
        $model = $this->createModel();
        $files = $model::getByFileable($fileableId);
        foreach ($files as $file) {
            $this->unBind($fileableId, $file, true);
        }
    }

Usage Example

 /**
  * Set site representative image
  *
  * @param Image $image image instance
  * @return void
  */
 public function setSiteImage(Image $image)
 {
     $this->storage->unBindAll($this->get('uuid'));
     $this->storage->bind($this->get('uuid'), $image);
     $this->image = $image;
 }