for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare( strict_types = 1);
namespace WMDE\Fundraising\AddressChangeContext\Tests;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\SchemaTool;
class DatabaseSchema {
private $entityManager;
public function __construct( EntityManager $entityManager ) {
$this->entityManager = $entityManager;
}
public function createSchema() {
$this->getSchemaTool()->createSchema( $this->getClassMetaData() );
public function dropSchema(): void {
$this->getSchemaTool()->dropSchema( $this->getClassMetaData() );
private function getSchemaTool(): SchemaTool {
return new SchemaTool( $this->entityManager );
private function getClassMetaData(): array {
return $this->entityManager->getMetadataFactory()->getAllMetadata();