Whenever I call this code, a warning is given:
Warning: rmdir(/path/to/assets/photo-albums/example): Directory not empty
The reason is quite obvious. there are still pictures in there. In Doctrine they will be removed by cacade configuration.
Is it possible to tell Gaufrette to ignore directory contents, and just remove everything at once without needing to loop over the albums photo's?
...
use Knp\Bundle\GaufretteBundle\Filesystem;
/**
* @var Filesystem
*/
private $_photoAssetFilesystem;
public function RemovePhotoAlbum(PhotoAlbum $photoAlbum) : RedirectResponse
{
...
$this->_photoAssetFilesystem->delete($photoAlbum->getDir());
...
}
Note: $photoAssetFilesystem is injected into this controller with DI