芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/cms.mgaplay.com.br/lib/Listener/OnLayoutOwnerChange.php
. */ namespace Xibo\Listener; use Xibo\Event\LayoutOwnerChangeEvent; use Xibo\Factory\LayoutFactory; use Xibo\Support\Exception\InvalidArgumentException; class OnLayoutOwnerChange { /** @var LayoutFactory */ private $layoutFactory; public function __construct(LayoutFactory $layoutFactory) { $this->layoutFactory = $layoutFactory; } /** * @param object $event * @throws InvalidArgumentException * @throws \Xibo\Support\Exception\GeneralException */ public function __invoke(object $event) { /** @var LayoutOwnerChangeEvent $event */ $campaignId = $event->getCampaignId(); $ownerId = $event->getOwnerId(); foreach ($this->layoutFactory->getByCampaignId($campaignId, true, true) as $layout) { $layout->setOwner($ownerId, true); $layout->save(['notify' => false]); } } }