/** * @depends testAddFolderToContent */ public function testRemoveFolder(ContentFolder $association) { $event = new ContentRemoveFolderEvent($association->getContent(), $association->getFolder()->getId()); $event->setDispatcher($this->dispatcher); $contentAction = new Content($this->getContainer()); $contentAction->removeFolder($event); $testAssociation = ContentFolderQuery::create()->filterByContent($association->getContent())->filterByFolder($association->getFolder())->findOne(); $this->assertNull($testAssociation); }
public function removeFolder(ContentRemoveFolderEvent $event) { $contentFolder = ContentFolderQuery::create()->filterByContent($event->getContent())->filterByFolderId($event->getFolderId())->findOne(); if (null !== $contentFolder) { $contentFolder->delete(); } }