public function setContent($content) { $this->content = $content; }
/** * @test */ public function comlexQueryWithJoinsCanBeExecutedAfterDeserialization() { $postEntityRepository = new Fixtures\PostRepository(); $postEntityRepository->removeAll(); $commentRepository = new Fixtures\CommentRepository(); $commentRepository->removeAll(); $testEntity1 = new Fixtures\Post(); $testEntity1->setTitle('Flow'); $postEntityRepository->add($testEntity1); $testEntity2 = new Fixtures\Post(); $testEntity2->setTitle('Flow with comment'); $comment = new Fixtures\Comment(); $comment->setContent('Flow'); $testEntity2->setComment($comment); $postEntityRepository->add($testEntity2); $commentRepository->add($comment); $this->persistenceManager->persistAll(); $query = new Query(Fixtures\Post::class); $query->matching($query->equals('comment.content', 'Flow')); $serializedQuery = serialize($query); $unserializedQuery = unserialize($serializedQuery); $this->assertEquals(1, $unserializedQuery->execute()->count()); $this->assertEquals([$testEntity2], $unserializedQuery->execute()->toArray()); }