/** * Delete a tag for a master * * The system will detect the change and delete the entry in the map. * The tag itself will not be affected. */ public function testDeleteATagForAMaster() { $this->restoreData(['masters', 'maps', 'tags']); $repo = $this->repo[Master::class]; $master = $repo->getById(1); $tag = $master->tags->getById(1); $master->tags->remove($tag); $this->unitOfWork->commit(); $this->entityRegistry->clear(); $master = $repo->getById(1); $tags = $master->tags->findAll()->columns('tag')->getItems(); $this->assertEquals(['Tag 2', 'Tag 3'], $tags); $tagRepo = $this->repo[Tag::class]; $tag = $tagRepo->getById(1); $this->assertEquals('Tag 1', $tag->tag); }
/** * Persists all changes * * @return void */ public function commit() { $this->unitOfWork->commit(); }