client = static::createClient(); $entityManager = $this->entityManager(); $metadata = $entityManager->getMetadataFactory()->getAllMetadata(); $tool = new SchemaTool($entityManager); $tool->dropSchema($metadata); $tool->createSchema($metadata); } protected function entityManager(): EntityManagerInterface { return static::getContainer()->get(EntityManagerInterface::class); } protected function createBook(int $id, string $title = 'Title', string $author = 'Author'): Book { $book = (new Book())->setId($id)->setTitle($title)->setAuthor($author); $this->entityManager()->persist($book); $this->entityManager()->flush(); return $book; } protected function findBook(int $id): ?Book { $this->entityManager()->clear(); return $this->entityManager()->find(Book::class, $id); } }