diff --git a/app/AppKernel.php b/app/AppKernel.php index a75d4a0..9be1531 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -16,7 +16,9 @@ class AppKernel extends Kernel new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), + new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), + new DT\Bundle\GeshiBundle\DTGeshiBundle(), new Skobkin\Bundle\CopyPasteBundle\SkobkinCopyPasteBundle(), ); diff --git a/composer.json b/composer.json index e75cc92..f675302 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,10 @@ "sensio/framework-extra-bundle": "~3.0,>=3.0.2", "incenteev/composer-parameter-handler": "~2.0", "doctrine/migrations": "1.0.*@dev", - "doctrine/doctrine-migrations-bundle": "2.1.*@dev" + "doctrine/doctrine-migrations-bundle": "2.1.*@dev", + "doctrine/doctrine-fixtures-bundle": "2.2.*", + "theodordiaconu/geshi": "dev-master", + "theodordiaconu/geshi-bundle" : "dev-master" }, "require-dev": { "sensio/generator-bundle": "~2.3" diff --git a/composer.lock b/composer.lock index c0f9202..071deca 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5fc11fb887ef6aed953b90118745b7f8", + "hash": "e36598c346f19a7d683f1c1f3d58399f", "packages": [ { "name": "doctrine/annotations", @@ -290,6 +290,62 @@ ], "time": "2014-05-21 19:28:51" }, + { + "name": "doctrine/data-fixtures", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/data-fixtures.git", + "reference": "b4a135c7db56ecc4602b54a2184368f440cac33e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/b4a135c7db56ecc4602b54a2184368f440cac33e", + "reference": "b4a135c7db56ecc4602b54a2184368f440cac33e", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.2,<2.5-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/orm": ">=2.2,<2.5-dev" + }, + "suggest": { + "doctrine/mongodb-odm": "For loading MongoDB ODM fixtures", + "doctrine/orm": "For loading ORM fixtures", + "doctrine/phpcr-odm": "For loading PHPCR ODM fixtures" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\DataFixtures": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" + } + ], + "description": "Data Fixtures for all Doctrine Object Managers", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database" + ], + "time": "2013-07-10 17:04:07" + }, { "name": "doctrine/dbal", "version": "v2.4.4", @@ -514,6 +570,66 @@ ], "time": "2014-11-28 09:43:36" }, + { + "name": "doctrine/doctrine-fixtures-bundle", + "version": "v2.2.0", + "target-dir": "Doctrine/Bundle/FixturesBundle", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", + "reference": "c811f96f0cf83b997e3a3ed037cac729bbe3e803" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/c811f96f0cf83b997e3a3ed037cac729bbe3e803", + "reference": "c811f96f0cf83b997e3a3ed037cac729bbe3e803", + "shasum": "" + }, + "require": { + "doctrine/data-fixtures": "~1.0", + "doctrine/doctrine-bundle": "~1.0", + "php": ">=5.3.2", + "symfony/doctrine-bridge": "~2.1" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Bundle\\FixturesBundle": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Doctrine Project", + "homepage": "http://www.doctrine-project.org" + } + ], + "description": "Symfony DoctrineFixturesBundle", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "Fixture", + "persistence" + ], + "time": "2013-09-05 11:23:37" + }, { "name": "doctrine/doctrine-migrations-bundle", "version": "dev-master", @@ -1621,6 +1737,86 @@ ], "time": "2015-03-02 10:21:01" }, + { + "name": "theodordiaconu/geshi", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/theodorDiaconu/geshi.git", + "reference": "c2a5294496b34d7561db5c0641b7f960d930f6b1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theodorDiaconu/geshi/zipball/c2a5294496b34d7561db5c0641b7f960d930f6b1", + "reference": "c2a5294496b34d7561db5c0641b7f960d930f6b1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "GeSHi": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Geshi library", + "homepage": "http://qbnz.com/highlighter/", + "keywords": [ + "Symfony2", + "geshi", + "highlighter" + ], + "time": "2013-03-19 00:39:21" + }, + { + "name": "theodordiaconu/geshi-bundle", + "version": "dev-master", + "target-dir": "DT/Bundle/GeshiBundle", + "source": { + "type": "git", + "url": "https://github.com/theodorDiaconu/geshi-bundle.git", + "reference": "4606ec8c7e338054f589147a6a6e1355f7262094" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theodorDiaconu/geshi-bundle/zipball/4606ec8c7e338054f589147a6a6e1355f7262094", + "reference": "4606ec8c7e338054f589147a6a6e1355f7262094", + "shasum": "" + }, + "require": { + "theodordiaconu/geshi": "dev-master" + }, + "type": "symfony-bundle", + "autoload": { + "psr-0": { + "DT\\Bundle\\GeshiBundle": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Theodor Diaconu", + "email": "diaconu.theodor@gmail.com" + } + ], + "description": "Symfony GeshiBundle", + "homepage": "http://www.datati.ro", + "keywords": [ + "geshi", + "highlight", + "highlighter", + "syntax highlight" + ], + "time": "2013-03-29 12:54:06" + }, { "name": "twig/extensions", "version": "v1.2.0", @@ -1786,7 +1982,9 @@ "stability-flags": { "symfony/symfony": 20, "doctrine/migrations": 20, - "doctrine/doctrine-migrations-bundle": 20 + "doctrine/doctrine-migrations-bundle": 20, + "theodordiaconu/geshi": 20, + "theodordiaconu/geshi-bundle": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/src/Skobkin/Bundle/CopyPasteBundle/DataFixtures/ORM/LoadLanguages.php b/src/Skobkin/Bundle/CopyPasteBundle/DataFixtures/ORM/LoadLanguages.php new file mode 100644 index 0000000..bb8b8b9 --- /dev/null +++ b/src/Skobkin/Bundle/CopyPasteBundle/DataFixtures/ORM/LoadLanguages.php @@ -0,0 +1,98 @@ +container = $container; + } + + /** + * {@inheritDoc} + */ + public function load(ObjectManager $manager) + { + $output = new ConsoleOutput(); + + $geshiPath = $this->container->get('kernel')->getRootDir() . '/../vendor/theodordiaconu/geshi/src/GeSHi/geshi'; + + $finder = new Finder(); + $finder->files()->in($geshiPath); + + // Fix constants + define('GESHI_CAPS_NO_CHANGE', true); + define('GESHI_COMMENTS', true); + define('GESHI_NEVER', true); + define('GESHI_SEARCH', true); + define('GESHI_REPLACE', true); + define('GESHI_MODIFIERS', true); + define('GESHI_BEFORE', true); + define('GESHI_AFTER', true); + define('GESHI_MAYBE', true); + define('GESHI_NUMBER_INT_BASIC', true); + define('GESHI_NUMBER_HEX_PREFIX_DOLLAR', true); + define('GESHI_NUMBER_BIN_PREFIX_PERCENT', true); + define('GESHI_NUMBER_FLT_NONSCI', true); + define('GESHI_NUMBER_HEX_PREFIX', true); + define('GESHI_NUMBER_FLT_SCI_ZERO', true); + define('GESHI_NUMBER_OCT_PREFIX', true); + define('GESHI_ALWAYS', true); + define('GESHI_CAPS_UPPER', true); + define('GESHI_NUMBER_FLT_NONSCI_F', true); + define('GESHI_NUMBER_FLT_SCI_SHORT', true); + define('GESHI_NUMBER_HEX_SUFFIX', true); + define('GESHI_NUMBER_INT_CSTYLE', true); + define('GESHI_NUMBER_BIN_PREFIX_0B', true); + define('GESHI_NUMBER_BIN_SUFFIX', true); + define('GESHI_NUMBER_OCT_SUFFIX', true); + define('GESHI_CLASS', true); + define('GESHI_NUMBER_OCT_PREFIX_0O', true); + define('GESHI_NUMBER_OCT_PREFIX_AT', true); + + /* @var $file SplFileInfo */ + foreach ($finder as $file) { + $output->writeln($file->getRelativePathname() . ' found. Parsing...'); + + include $geshiPath . DIRECTORY_SEPARATOR .$file->getRelativePathname(); + + $language = new Language(); + $language + ->setName($language_data['LANG_NAME']) + ->setCode(basename($file->getRelativePathname(), '.php')) + ->setEnabled(true) + ; + + $output->write('---> "' . $language->getName() . '"'); + $manager->persist($language); + $manager->flush(); + $output->writeln(' [ PERSISTED ]'); + } + + $output->writeln('Import finished!'); + } +}