芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/cms.mgaplay.com.br/lib/Listener/OnFolderMoving/MediaListener.php
. */ namespace Xibo\Listener\OnFolderMoving; use Xibo\Event\FolderMovingEvent; use Xibo\Factory\MediaFactory; class MediaListener { /** * @var MediaFactory */ private $mediaFactory; public function __construct(MediaFactory $mediaFactory) { $this->mediaFactory = $mediaFactory; } public function __invoke(FolderMovingEvent $event) { $folder = $event->getFolder(); $newFolder = $event->getNewFolder(); foreach ($this->mediaFactory->getByFolderId($folder->getId()) as $media) { $media->folderId = $newFolder->getId(); $media->permissionsFolderId = $newFolder->getPermissionFolderIdOrThis(); $media->updateFolders('media'); } } }