コード例 #1
0
 /**
  * @param string $colors
  * @return void
  */
 public function indexAction($colors = null)
 {
     $oldColors = new \Doctrine\Common\Collections\ArrayCollection($this->colorRepository->findAll()->toArray());
     $colorNames = "";
     if ($colors === null) {
         foreach ($oldColors as $color) {
             if (!empty($colorNames)) {
                 $colorNames .= "\n";
             }
             $colorNames .= $color->getName();
         }
     } else {
         $colorNames = $colors;
         foreach (explode("\n", $colors) as $colorName) {
             $colorName = trim($colorName);
             if (empty($colorName)) {
                 continue;
             }
             $color = $this->colorRepository->findOneByName($colorName);
             if (empty($color)) {
                 $color = new Color($colorName);
                 $this->colorRepository->add($color);
             }
             if ($oldColors) {
                 $oldColors->removeElement($color);
             }
         }
         if ($oldColors) {
             foreach ($oldColors as $color) {
                 $this->colorRepository->remove($color);
             }
         }
     }
     $this->view->assign('colors', $colorNames);
 }
コード例 #2
0
 public function reverseTransform($string)
 {
     if ($this->options['multiple']) {
         if (!$string) {
             $result = new \Doctrine\Common\Collections\ArrayCollection();
         } else {
             $items = explode(',', $string);
             $result = new \Doctrine\Common\Collections\ArrayCollection();
             $repo = $this->repository;
             foreach ($items as $item) {
                 $id = preg_replace('/^([0-9]+)\\:.*/', '$1', $item);
                 $itemEntity = $repo->findOneById((int) $id);
                 if (is_object($itemEntity)) {
                     $result->add($itemEntity);
                 }
             }
         }
     } else {
         if (!$string) {
             $result = null;
         } else {
             $id = preg_replace('/^([0-9]+)\\:.*/', '$1', $string);
             $itemEntity = $this->repository->findOneById((int) $id);
             if (is_object($itemEntity)) {
                 $result = $itemEntity;
             }
         }
     }
     return $result;
 }
コード例 #3
0
 public function denormalize(array $input, $context = null)
 {
     $collection = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($array as $key => $value) {
         $collection->set($key, parent::normalize($input));
     }
     return new PersistentCollection($this->getEntityManager(), $this->getClassMetadata()->getName(), $collection);
 }
コード例 #4
0
ファイル: Site.php プロジェクト: jewelhuq/fraym
 /**
  * @return \Doctrine\Common\Collections\ArrayCollection
  */
 public function getRootMenuItems()
 {
     $rootItems = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($this->menuItems as &$m) {
         if ($m->parent == null) {
             $rootItems->add($m);
         }
     }
     return $rootItems;
 }
コード例 #5
0
ファイル: UserTest.php プロジェクト: mhilker/usermanager
 public function testGetAddRemoveRoles()
 {
     $roles = new \Doctrine\Common\Collections\ArrayCollection();
     $roles->add($this->getMock('Usermanager\\Entity\\Role'));
     $roles->add($this->getMock('Usermanager\\Entity\\Role'));
     $this->assertCount(0, $this->entity->getRoles());
     $this->entity->addRoles($roles);
     $this->assertCount(2, $this->entity->getRoles());
     $this->entity->removeRoles($roles);
     $this->assertCount(0, $this->entity->getRoles());
 }
コード例 #6
0
ファイル: RoleTest.php プロジェクト: mhilker/usermanager
 public function testGetAddRemovePermissions()
 {
     $permissions = new \Doctrine\Common\Collections\ArrayCollection();
     $permissions->add($this->getMock('Usermanager\\Entity\\Permission'));
     $permissions->add($this->getMock('Usermanager\\Entity\\Permission'));
     $this->assertCount(0, $this->entity->getPermissions());
     $this->entity->addPermissions($permissions);
     $this->assertCount(2, $this->entity->getPermissions());
     $this->entity->removePermissions($permissions);
     $this->assertCount(0, $this->entity->getPermissions());
 }
コード例 #7
0
 /**
  * @test
  */
 public function setQuestionsWorks()
 {
     $question1 = new MultipleChoiceQuestion();
     $question2 = new MultipleChoiceQuestion();
     $questions = new \Doctrine\Common\Collections\ArrayCollection();
     $questions->add($question1);
     $questions->add($question2);
     $exercise = new MultipleChoiceSameAnswerExercise();
     $exercise->setQuestions($questions);
     $this->assertEquals(2, $exercise->getMaxScore());
 }
コード例 #8
0
 private function mockRepository()
 {
     $productRepository = $this->getMockBuilder('\\Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $productRepository->expects($this->any())->method('find')->will($this->returnValue($this->mockProduct()));
     $products = new Doctrine\Common\Collections\ArrayCollection();
     $products->add($this->mockProduct());
     $products->add($this->mockProduct());
     $products->add($this->mockProduct());
     $productRepository->expects($this->any())->method('findAll')->will($this->returnValue($products));
     return $productRepository;
 }
コード例 #9
0
ファイル: RepositoryRepository.php プロジェクト: mrimann/como
 /**
  * Takes a pile of commits, then puts together all the repositories that are affected by
  * at least one of the given commits.
  *
  * @param \TYPO3\Flow\Persistence\QueryResultInterface the pile of commits
  * @return \Doctrine\Common\Collections\ArrayCollection the resulting stack of repositories
  */
 public function extractTheRepositoriesFromAStackOfCommits(\TYPO3\Flow\Persistence\QueryResultInterface $commits)
 {
     $result = new \Doctrine\Common\Collections\ArrayCollection();
     if ($commits->count()) {
         foreach ($commits as $commit) {
             if (!$result->contains($commit->getRepository())) {
                 $result->add($commit->getRepository());
             }
         }
     }
     return $result;
 }
 /**
  * @dataProvider questionsDataProvider
  * @param array $data
  */
 public function testSetQuestions($data)
 {
     $exercise = new SpellingAndGrammarCommaExercise();
     $questions = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($data as $row) {
         $question = new SpellingAndGrammarCommaQuestion();
         $question->setQuestionWithComma($row['questionWithComma']);
         $question->setQuestionWithoutComma($row['questionWithoutComma']);
         $questions->add($question);
     }
     $this->assertNull($exercise->setQuestions($questions));
     $this->assertSame($questions, $exercise->getQuestions());
 }
コード例 #11
0
 /**
  * @dataProvider questionDataProvider
  * @param array $data
  */
 public function testGetQuestions($data)
 {
     $exercise = new DragAndDropWordToQuestionExercise();
     $questions = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($data as $row) {
         $question = new DragAndDropQuestion();
         $question->setQuestion($row['question']);
         $question->setAnswer($row['answer']);
         $questions->add($question);
     }
     $this->assertNull($exercise->setQuestions($questions));
     $this->assertSame($questions, $exercise->getQuestions());
 }
コード例 #12
0
ファイル: UserManagerTest.php プロジェクト: northern/core
 /**
  * Tests if a returned collection of UserEntity objects is of the correct type and
  * of the correct length.
  */
 public function testGetUserEntityCollectionSucessful()
 {
     $expectedUserEntityCollection = new \Doctrine\Common\Collections\ArrayCollection();
     $expectedUserEntityCollection->add(new Entity\UserEntity());
     $expectedUserEntityCollection->add(new Entity\UserEntity());
     $expectedUserEntityCollection->add(new Entity\UserEntity());
     $mockUserRepository = $this->getMockUserRepository();
     $mockUserRepository->method('getUserEntityCollection')->will($this->returnValue($expectedUserEntityCollection));
     $userManager = new UserManager();
     $userManager->setUserRepository($mockUserRepository);
     $userEntityCollection = $userManager->getUserEntityCollection();
     $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $userEntityCollection);
     $this->assertEquals(count($userEntityCollection), count($expectedUserEntityCollection));
 }
コード例 #13
0
ファイル: MenuController.php プロジェクト: kokmok/SKCMS-Admin
 private function menuArrayToEntities($menuArray, \Doctrine\ORM\EntityManager $em, MenuElement $parent = null, $locale)
 {
     $collection = new \Doctrine\Common\Collections\ArrayCollection();
     $repo = $em->getRepository('SKCMSCoreBundle:MenuElement');
     $repo->setDefaultLocale($locale);
     foreach ($menuArray as $menuElement) {
         //            //dump($menuElement);
         //            die();
         $element = null;
         if (isset($menuElement->elementId)) {
             $element = $repo->find($menuElement->elementId);
             $element->setTranslatableLocale($locale);
             $em->refresh($element);
         }
         if (null === $element) {
             $element = new MenuElement();
         }
         $element->setName($menuElement->name);
         $element->setEntityId($menuElement->targetId);
         $element->setEntityClass($menuElement->entityClass);
         $element->setPosition($menuElement->position);
         if (isset($menuElement->children) && count($menuElement->children)) {
             $element->setChildren($this->menuArrayToEntities($menuElement->children, $em, $element, $locale));
         }
         $collection->add($element);
         if (null !== $parent) {
             $element->setParent($parent);
         }
         $em->persist($element);
     }
     return $collection;
 }
コード例 #14
0
 /**
  * Transforms a string (id) to an object (media).
  *
  * @param string $id
  *
  * @return Media|null
  *
  * @throws TransformationFailedException if object (media) is not found.
  */
 public function reverseTransform($array)
 {
     $medias = new \Doctrine\Common\Collections\ArrayCollection();
     if (!$array || !preg_match('#^[0-9]+(;[0-9])*$#', $array)) {
         return $medias;
     }
     $ids = explode(';', $array);
     foreach ($ids as $id) {
         $media = $this->objectManager->getRepository($this->mediaClass)->find($id);
         if (null === $media) {
             throw new TransformationFailedException(sprintf('Media "%s" is not found !', $id));
         }
         $medias->add($media);
     }
     return $medias;
 }
コード例 #15
0
 /**
  * Transforms a string (id) to an object (PlaceImage).
  *
  * @param  string $ids
  *
  * @return PlaceImage[]|null
  *
  * @throws TransformationFailedException if object (PlaceImage) is not found.
  */
 public function reverseTransform($ids)
 {
     //var_dump($ids);die('transformer');
     if (!$ids) {
         return null;
     }
     $ids = explode($this->separator, $ids);
     $collection = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($ids as $id) {
         if ($tmp = $this->om->getRepository(PlaceHallImage::class)->findOneBy(['id' => $id])) {
             //var_dump($tmp);die();
             $collection->add($tmp);
         }
     }
     return $collection;
 }
コード例 #16
0
ファイル: RestController.php プロジェクト: BPurified/ZendCMS
 public function getList()
 {
     $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     $albumRepo = $em->getRepository('\\Application\\Entity\\Album');
     $albums = $albumRepo->findAll();
     $collection = new \Doctrine\Common\Collections\ArrayCollection($albums);
     $data = $collection->map(function ($a) {
         // if this is a comment, map each element as an array, and the container as an array
         $a->comments = $a->comments->map(function ($p) {
             return $p->toArray();
         })->toArray();
         // map each of the elements within the collection as an array
         return $a->toArray();
     })->toArray();
     // result will stil be an array collection, that needs to be cast to an array
     return new JsonModel(array('data' => $data));
 }
コード例 #17
0
 /**
  *
  * @param string $string String to transform
  *
  * @return Tag $tag
  *
  */
 public function reverseTransform($string)
 {
     $tags = new \Doctrine\Common\Collections\ArrayCollection();
     $arrayOfTags = explode(",", $string);
     foreach ($arrayOfTags as $nameOfTag) {
         $result = $this->om->getRepository('AcmeBlogBundle:Tag')->findOneByName($nameOfTag);
         if (!$result) {
             //Action when tag don't exist
             $tag = new Tag();
             $tag->setName($nameOfTag);
             $tags->add($tag);
         } else {
             $tags->add($result);
         }
     }
     return $tags;
 }
コード例 #18
0
 /**
  * Count the total of rows
  *
  * @return int
  */
 public function getAdverts($start, $end, $section = null)
 {
     if ($count == 0) {
         $count2 = 0;
         $qb2 = $this->getQueryBuilder()->join('a.located', 'l')->where('l.name = :section')->andWhere('a.from <= :start')->andWhere('a.to >= :end')->andWhere('a.active = :active')->setParameters(array('section' => $section, 'start' => $start, 'end' => $end, 'active' => true));
         $query = $qb2->getQuery();
     }
     //->orderBy('s.day', 'ASC')
     $adverts = array();
     if (is_object($query)) {
         $adverts = $query->getResult();
     }
     $arr = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($adverts as $ad) {
         $arr->add($ad);
     }
     return $arr;
 }
コード例 #19
0
 public function retrieveUsers($date)
 {
     $users = new \Doctrine\Common\Collections\ArrayCollection();
     $articleRepo = $this->getManager()->getRepository('AppBundle:Article');
     $articles = $articleRepo->findWithNotifications($date);
     foreach ($articles as $article) {
         if ($article->getAnswers()->count()) {
             foreach ($article->getAnswers() as $answer) {
                 if ($answer->getCreated() < $date && !$answer->getEmailSent()) {
                     if (!$users->contains($answer->getUser())) {
                         $users->add($answer->getUser());
                     }
                     $answer->setEmailSent(true);
                     $this->getEntityManager()->persist($answer);
                     $this->getEntityManager()->flush($answer);
                 }
             }
         }
         if ($article->getRatings()->count()) {
             foreach ($article->getRatings() as $rating) {
                 if ($rating->getCreated() < $date && $rating->getEmailSent()) {
                     if (!$users->contains($rating->getUser())) {
                         $users->add($rating->getUser());
                     }
                     $rating->setEmailSent(true);
                     $this->getEntityManager()->persist($rating);
                     $this->getEntityManager()->flush($rating);
                 }
             }
         }
     }
     return $users;
 }
コード例 #20
0
 public function findAll()
 {
     $albums = $this->objectRepository->findAll();
     $collection = new \Doctrine\Common\Collections\ArrayCollection($albums);
     $arrays = $collection->map(function ($a) {
         $a->songs = $a->songs->map(function ($p) {
             return $p->toArray();
         })->toArray();
         return $a->toArray();
     })->toArray();
     //****************************************************************************************
     $fractal = new Manager();
     $resource = new Resource\Collection($arrays, function (array $array) {
         $songs = array();
         for ($i = 0; $i < count($array['songs']); $i++) {
             $songs[$i]['href'] = '/album/' . $array['id'] . '/' . $array['songs'][$i]['songTitle'];
         }
         return ['id' => (int) $array['id'], 'title' => $array['title'], 'artist' => $array['artist'], '_embedded' => ['songs' => $array['songs'], '_links' => ['rel' => $songs]], '_links' => [['rel' => 'self', 'uri' => '/albums/' . $array['id']]]];
     });
     $result = $fractal->createData($resource)->toArray();
     return $result;
 }
コード例 #21
0
ファイル: MyTagTransformer.php プロジェクト: krombox/motion
 /**
  * Transforms a string (number) to an object (issue).
  *
  * @param  string $number
  *
  * @return Issue|null
  *
  * @throws TransformationFailedException if object (issue) is not found.
  */
 public function reverseTransform($tags)
 {
     if (!$tags) {
         return null;
     }
     $tags = explode($this->separator, $tags);
     $ret = array();
     $collection = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($tags as $t) {
         if ($tmp = $this->om->getRepository(MyTag::class)->findOneBy(['name' => $t])) {
             $collection->add($tmp);
         } else {
             $tag = new MyTag();
             $tag->setName($t);
             $this->om->persist($tag);
             $this->om->flush();
             /*Add ne tag to collection*/
             $collection->add($tag);
         }
     }
     return $collection;
 }
コード例 #22
0
 public function onFlush(OnFlushEventArgs $args)
 {
     if (PHP_SAPI === 'cli') {
         return;
     }
     $this->em = $args->getEntityManager();
     $eventManager = $this->em->getEventManager();
     $eventManager->removeEventListener('onFlush', $this);
     $this->uow = $this->em->getUnitOfWork();
     $histories = new \Doctrine\Common\Collections\ArrayCollection();
     $this->hmeta = $this->em->getClassMetadata('DLigo\\Animaltool\\Domain\\Model\\HistoryChange');
     $user = $this->session->getUser();
     $this->userId = $this->persistenceManager->getIdentifierByObject($user);
     $this->userLabel = $user->__toString();
     foreach ($this->uow->getScheduledEntityInsertions() as $entity) {
         $meta = $this->em->getClassMetadata(get_class($entity));
         $this->putAnimal($entity, $meta);
         $history = array('entity' => $entity, 'changes' => $this->uow->getEntityChangeSet($entity), 'meta' => $meta, 'type' => 'INSERT');
         $histories->add($history);
         $this->em->getUnitOfWork()->recomputeSingleEntityChangeSet($meta, $entity);
     }
     foreach ($this->uow->getScheduledEntityDeletions() as $entity) {
         $meta = $this->em->getClassMetadata(get_class($entity));
         $this->putAnimal($entity, $meta);
         $history = array('entity' => $entity, 'changes' => null, 'meta' => $meta, 'type' => 'DELETE');
         $histories->add($history);
     }
     foreach ($this->uow->getScheduledEntityUpdates() as $key => $entity) {
         $meta = $this->em->getClassMetadata(get_class($entity));
         $this->putAnimal($entity, $meta);
         $history = array('entity' => $entity, 'changes' => $this->uow->getEntityChangeSet($entity), 'meta' => $meta, 'type' => 'UPDATE');
         $histories->add($history);
         $this->uow->computeChangeSet($meta, $entity);
     }
     foreach ($histories as $h) {
         $this->processHistory($h);
     }
     $eventManager->addEventListener('onFlush', $this);
 }
コード例 #23
0
ファイル: Article.php プロジェクト: usebee/FB_App
 public function hasLanguage(Language $language)
 {
     $result = false;
     if (count($this->article_languages->toArray()) > 0) {
         foreach ($this->article_languages as $plTemp) {
             if ($language->getId() == $plTemp->getLanguage()->getId()) {
                 $result = true;
                 break;
             }
         }
     }
     return $result;
 }
コード例 #24
0
ファイル: Push.php プロジェクト: nlegoff/Phraseanet
 protected function getUsersInSelectionExtractor()
 {
     return function (array $selection) {
         $Users = new \Doctrine\Common\Collections\ArrayCollection();
         foreach ($selection as $record) {
             /* @var $record record_adapter */
             foreach ($record->get_caption()->get_fields() as $caption_field) {
                 foreach ($caption_field->get_values() as $value) {
                     if (!$value->getVocabularyType()) {
                         continue;
                     }
                     if ($value->getVocabularyType()->getType() !== 'User') {
                         continue;
                     }
                     $user = $value->getRessource();
                     $Users->set($user->getId(), $user);
                 }
             }
         }
         return $Users;
     };
 }
コード例 #25
0
ファイル: ConfigDefaultsEvent.php プロジェクト: symbb/symbb
 public function setDefaultConfig($key, $value, $type, $section = "default")
 {
     $valueArray = new \Doctrine\Common\Collections\ArrayCollection();
     $valueArray->set('value', $value);
     $valueArray->set('section', $section);
     $valueArray->set('key', $key);
     $valueArray->set('type', $type);
     $this->configList->set($section . '.' . $key, $valueArray);
 }
コード例 #26
0
 /**
  * @test
  * @author Christopher Hlubek <*****@*****.**>
  */
 public function entityReferencesReturnsSimpleAndArrayReferences()
 {
     $baseEntity = new \TYPO3\CouchDB\Tests\Functional\Fixtures\Domain\Model\TestEntity();
     $simpleReferencedEntity = new \TYPO3\CouchDB\Tests\Functional\Fixtures\Domain\Model\TestEntity();
     $baseEntity->setRelatedEntity($simpleReferencedEntity);
     $arrayReferencedEntity = new \TYPO3\CouchDB\Tests\Functional\Fixtures\Domain\Model\TestEntity();
     $relatedEntities = new \Doctrine\Common\Collections\ArrayCollection();
     $relatedEntities->add($arrayReferencedEntity);
     $relatedEntities->add($baseEntity);
     $baseEntity->setRelatedEntities($relatedEntities);
     $this->persistenceManager->add($baseEntity);
     $baseIdentifier = $this->persistenceManager->getIdentifierByObject($baseEntity);
     $simpleReferenceIdentifier = $this->persistenceManager->getIdentifierByObject($simpleReferencedEntity);
     $arrayReferenceIdentifier = $this->persistenceManager->getIdentifierByObject($arrayReferencedEntity);
     $this->persistenceManager->persistAll();
     $identifiers = $this->design->entityReferences($simpleReferenceIdentifier);
     $this->assertEquals(1, count($identifiers));
     $this->assertEquals($baseIdentifier, $identifiers[0]);
     $identifiers = $this->design->entityReferences($arrayReferenceIdentifier);
     $this->assertEquals(1, count($identifiers));
     $this->assertEquals($baseIdentifier, $identifiers[0]);
     $identifiers = $this->design->entityReferences($baseIdentifier);
     $this->assertEquals(0, count($identifiers));
 }
コード例 #27
0
ファイル: CustomMenu.php プロジェクト: fraym/core
 /**
  * @param \SimpleXMLElement $obj
  * @param null $parent
  * @return \Doctrine\Common\Collections\ArrayCollection
  */
 protected function getItems(\SimpleXMLElement $obj, $parent = null)
 {
     $returnChildren = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($obj->children() as $objData) {
         $id = $this->blockParser->getXmlAttr($objData, 'id');
         $menuItemTranslation = $this->db->createQueryBuilder()->select("menu, translation")->from('\\Fraym\\Menu\\Entity\\MenuItemTranslation', 'translation')->join('translation.menuItem', 'menu')->where('menu.id = :id AND translation.locale = :localeId AND translation.active = 1')->setParameter('id', $id)->setParameter('localeId', $this->route->getCurrentMenuItemTranslation()->locale->id)->getQuery()->getOneOrNullResult();
         $this->db->free();
         if ($menuItemTranslation) {
             $menuItem = clone $this->db->getRepository('\\Fraym\\Menu\\Entity\\MenuItem')->findOneById($menuItemTranslation->menuItem->id);
             $children = $this->getItems($objData, $menuItem);
             $menuItem->parent = $parent;
             $menuItem->children = $children;
             $returnChildren->set($menuItem->id, $menuItem);
         }
     }
     return $returnChildren;
 }
コード例 #28
0
 /**
  * @param \BoilerAppAccessControl\Entity\AuthAccessEntity $oAuthAccess
  * @return \Doctrine\Common\Collections\ArrayCollection
  */
 public function getLatestActivityLogs(\BoilerAppAccessControl\Entity\AuthAccessEntity $oAuthAccess)
 {
     $oLatestsActivityLogs = new \Doctrine\Common\Collections\ArrayCollection();
     while ($oLatestsActivityLogs->count() < 5) {
         $oCriteria = new \Doctrine\Common\Collections\Criteria(null, array('entity_create' => 'DESC'), null, 1);
         $aCriteria = array();
         if ($oLatestsActivityLogs->count()) {
             $oLastLog = $oLatestsActivityLogs->last();
             $oCriteria->andWhere(\Doctrine\Common\Collections\Criteria::expr()->neq('log_session_id', $oLastLog->getLogSessionId()))->andWhere(\Doctrine\Common\Collections\Criteria::expr()->lt('entity_create', $oLastLog->getEntityCreate()));
         }
         if (!($oLogs = $this->matching($oCriteria)) || !$oLogs->count()) {
             break;
         }
         $oLatestsActivityLogs->add($oLogs->current());
     }
     return $oLatestsActivityLogs;
 }
コード例 #29
0
ファイル: Hole.php プロジェクト: pitrackster/ExoBundle
 public function __clone()
 {
     if ($this->id) {
         $this->id = null;
         $newWordResponses = new \Doctrine\Common\Collections\ArrayCollection();
         foreach ($this->wordResponses as $wordResponse) {
             $newWordResponse = clone $wordResponse;
             $newWordResponse->setHole($this);
             $newWordResponses->add($newWordResponse);
         }
         $this->wordResponses = $newWordResponses;
     }
 }
コード例 #30
0
 /**
  * @covers Core\Entity\SubjectRound::addTeacher
  * @covers Core\Entity\SubjectRound::removeTeacher
  */
 public function testAddRemoveTeacher()
 {
     $sr = new SubjectRound();
     $this->assertEquals(0, $sr->getTeacher()->count());
     $mockTeacher = $this->getMockBuilder('Core\\Entity\\Teacher')->getMock();
     $teachers = new \Doctrine\Common\Collections\ArrayCollection();
     $teachers->add($mockTeacher);
     $sr->addTeacher($teachers);
     $this->assertEquals(1, $sr->getTeacher()->count());
     $this->assertEquals($mockTeacher, $sr->getTeacher()->first());
     $sr->removeTeacher($teachers);
     $this->assertEquals(0, $sr->getTeacher()->count());
 }