Set Category
public setCategory ( |
||
$category |
/** * @dataProvider entityManagerDataProvider * @param EntityManager $em */ public function testReverseConditionalRelationship(EntityManager $em) { $category = new Category(); $category->setId(2000)->setName('Conditional Category'); $em->persist($category)->flush(); for ($i = 65; $i < 76; $i++) { $article = new Article(); $article->setId($i)->setTitle('Conditional Article #' . $i); if ($i == 73) { $article->setPublished(false); } else { $article->setPublished(true); } $article->setCategory($category); $em->persist($article); } for ($i = 65; $i < 76; $i++) { $asset = new Asset(); $asset->setId($i)->setTitle('Conditional Asset #' . $i); if ($i == 73) { $asset->setPublished(false); } else { $asset->setPublished(true); } $asset->setCategory($category); $em->persist($asset); } $em->flush(); $articles = $em->sortedQuery(new SortedQuery($category, 'articles', 'last_modified')); $this->assertCount(10, $articles); $articles = $em->sortedQuery(new SortedQuery($category, 'articles', 'id')); $this->assertCount(11, $articles); $assets = $em->sortedQuery(new SortedQuery($category, 'assets', 'last_modified')); $this->assertCount(10, $assets); $assets = $em->sortedQuery(new SortedQuery($category, 'assets', 'id')); $this->assertCount(11, $assets); }