client = static::createClient(); $this->manager = static::getContainer()->get('doctrine')->getManager(); (new SchemaTool($this->manager)) ->createSchema($this->manager->getMetadataFactory()->getAllMetadata()); $this->repository = $this->manager->getRepository($this->getEntityClass()); foreach ($this->repository->findAll() as $object) { $this->manager->remove($object); } $this->manager->flush(); } }