PartKeepr\CoreBundle\DoctrineMigrations\Version20151031163951::up PHP Method

up() public method

public up ( Doctrine\DBAL\Schema\Schema $schema )
$schema Doctrine\DBAL\Schema\Schema
    public function up(Schema $schema)
    {
        $footprintRepository = $this->getEM()->getRepository('PartKeeprFootprintBundle:Footprint');
        $rootNode = $this->getContainer()->get('partkeepr.footprint.category_service')->getRootNode();
        $footprints = $footprintRepository->findAll();
        foreach ($footprints as $footprint) {
            if ($footprint->getCategory() === null) {
                $footprint->setCategory($rootNode);
            }
        }
        $this->getEM()->flush();
    }
Version20151031163951