Version20170601175559.php (1039B)
1 <?php 2 3 namespace PartKeepr\CoreBundle\DoctrineMigrations; 4 5 use Doctrine\DBAL\Schema\Schema; 6 use PartKeepr\DistributorBundle\Entity\Distributor; 7 8 /** 9 * Sets all existing distributors to be used for price calculations to reflect behaviour of previous versions. 10 */ 11 class Version20170601175559 extends BaseMigration 12 { 13 /** 14 * @param Schema $schema 15 */ 16 public function up(Schema $schema) 17 { 18 $this->performDatabaseUpgrade(); 19 20 $distributorRepository = $this->getEM()->getRepository( 21 'PartKeeprDistributorBundle:Distributor' 22 ); 23 24 $distributors = $distributorRepository->findAll(); 25 26 foreach ($distributors as $distributor) { 27 /** 28 * @var Distributor 29 */ 30 $distributor->setEnabledForReports(true); 31 } 32 33 $this->getEM()->flush(); 34 } 35 36 /** 37 * @param Schema $schema 38 */ 39 public function down(Schema $schema) 40 { 41 // this down() migration is auto-generated, please modify it to your needs 42 } 43 }