Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

EdgedesignCZ/DoctrineMigrations

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Zenify/DoctrineMigrations

Implementation of Doctrine\Migrations to Nette.

Tip: Symfony bundle is more clear to read.

Installation

The best way to install is using Composer.

Add to your composer.json:

"require": {
	"doctrine/migrations": "@dev"
	"zenify/doctrine-migrations": "@dev"
}

and run:

$ composer update

Register the extension in config.neon:

extensions:
	migrations: Zenify\DoctrineMigrations\DI\MigrationsExtension

Configuration

config.neon with default values

migrations:
	table: doctrine_migrations # database table for applied migrations
	dirs: # list of dirs to load migrations from
		- %appDir%/../migrations # first dir is used for generating migrations
	namespace: Migrations # namespace of migration classes
	enabled: FALSE # cli based loading; set TRUE to force loading in non-cli

Features

Injected migrations

namespace Migrations;


class Version20140801152432 extends AbstractMigration
{
	/**
	 * @inject
	 * @var \Kdyby\Doctrine\EntityManager
	 */
	public $em;


	public function up(Schema $schema)
	{
		$product = new Product;
		$product->setName('Chips without fish')
		$this->em->persist(product);

		$this->em->flush();
	}

	// ...

}

Packages

No packages published