Commit 087bb2b4 authored by Arnaud Bey's avatar Arnaud Bey
Browse files

install fixtures

parent c76cc139
install: composer npm permission dbupdate assets cache
install: composer npm permission dbupdate dbpopulate assets cache
update: composer npm permission dbupdate assets cache
dbpopulate:
mysql -u root -proot -h db dbmw < mw_fixtures.sql
php bin/console magicword:fixtures
dbupdate:
php bin/console doctrine:schema:update --force
......
-- phpMyAdmin SQL Dump
-- version 4.2.12deb2+deb8u2
-- http://www.phpmyadmin.net
--
-- Client : localhost
-- Généré le : Mar 04 Juillet 2017 à 12:04
-- Version du serveur : 5.5.55-0+deb8u1-log
-- Version de PHP : 5.6.30-0+deb8u1
SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de données : `magicw`
--
-- --------------------------------------------------------
--
-- Structure de la table `access_type`
--
CREATE TABLE IF NOT EXISTS `access_type` (
`id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `access_type`
--
INSERT INTO `access_type` (`id`, `name`) VALUES
(1, 'public'),
(2, 'link');
-- --------------------------------------------------------
--
-- Structure de la table `combo_points`
--
CREATE TABLE IF NOT EXISTS `combo_points` (
`id` int(11) NOT NULL,
`length` int(11) NOT NULL,
`points` int(11) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `combo_points`
--
INSERT INTO `combo_points` (`id`, `length`, `points`) VALUES
(1, 2, 4),
(2, 3, 6),
(3, 4, 10),
(4, 5, 15),
(5, 6, 20),
(6, 7, 25),
(7, 8, 25),
(8, 9, 25),
(9, 10, 25);
-- --------------------------------------------------------
--
-- Structure de la table `general_parameters`
--
CREATE TABLE IF NOT EXISTS `general_parameters` (
`id` int(11) NOT NULL,
`tutorial_id` int(11) DEFAULT NULL,
`selfregistration` tinyint(1) NOT NULL,
`home_text` longtext COLLATE utf8_unicode_ci,
`piwik_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `general_parameters`
--
INSERT INTO `general_parameters` (`id`, `tutorial_id`, `selfregistration`, `home_text`, `piwik_url`) VALUES
(1, 7, 1, 'Magic Word was created as part of the GAMER work package in the Innovalangues project at the Stendhal University in Grenoble, France. Innovalangues is a language learning centered IDEFI project (Initiatives in Excellence for Innovative Education) and will run from 2012 to 2018..... test', NULL);
-- --------------------------------------------------------
--
-- Structure de la table `language_ui`
--
CREATE TABLE IF NOT EXISTS `language_ui` (
`id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`value` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `language_ui`
--
INSERT INTO `language_ui` (`id`, `name`, `value`) VALUES
(1, 'french', 'fr'),
(2, 'english', 'en');
-- --------------------------------------------------------
--
-- Structure de la table `roundType`
--
CREATE TABLE IF NOT EXISTS `roundType` (
`id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`class` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `roundType`
--
INSERT INTO `roundType` (`id`, `name`, `class`) VALUES
(2, 'rush', 'RoundType\\Rush'),
(3, 'conquer', 'RoundType\\Conquer');
-- --------------------------------------------------------
--
-- Structure de la table `wordbox_acquisition_type`
--
CREATE TABLE IF NOT EXISTS `wordbox_acquisition_type` (
`id` int(11) NOT NULL,
`value` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Contenu de la table `wordbox_acquisition_type`
--
INSERT INTO `wordbox_acquisition_type` (`id`, `value`) VALUES
(1, 'manual');
--
-- Index pour les tables exportées
--
--
-- Index pour la table `access_type`
--
ALTER TABLE `access_type`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `combo_points`
--
ALTER TABLE `combo_points`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `general_parameters`
--
ALTER TABLE `general_parameters`
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `UNIQ_75AC6A6F89366B7B` (`tutorial_id`);
--
-- Index pour la table `language_ui`
--
ALTER TABLE `language_ui`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `roundType`
--
ALTER TABLE `roundType`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `wordbox_acquisition_type`
--
ALTER TABLE `wordbox_acquisition_type`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `access_type`
--
ALTER TABLE `access_type`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `combo_points`
--
ALTER TABLE `combo_points`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT pour la table `general_parameters`
--
ALTER TABLE `general_parameters`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT pour la table `language_ui`
--
ALTER TABLE `language_ui`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `roundType`
--
ALTER TABLE `roundType`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `wordbox_acquisition_type`
--
ALTER TABLE `wordbox_acquisition_type`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- Contraintes pour la table `general_parameters`
--
ALTER TABLE `general_parameters`
ADD CONSTRAINT `FK_75AC6A6F89366B7B` FOREIGN KEY (`tutorial_id`) REFERENCES `game` (`id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<?php
namespace MagicWordBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use MagicWordBundle\Entity\AccessType;
use MagicWordBundle\Entity\GeneralParameters;
use MagicWordBundle\Entity\LanguageUI;
use MagicWordBundle\Entity\Wordbox\AcquisitionType;
use MagicWordBundle\Entity\RoundType\RoundType;
class FixturesCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('magicword:fixtures')
->setDescription('Fixtures');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>############ FIXTURES #############</info>');
$em = $this->getContainer()->get('doctrine')->getEntityManager('default');
// access type
echo "access types... \n";
$accessTypes = ["public", "link"];
foreach ($accessTypes as $type) {
$accessType = new AccessType;
$accessType->setName($type);
$em->persist($accessType);
}
// combo_points TODO
// general_parameters
echo "General parameters... \n";
$parameters = new GeneralParameters();
$parameters->setSelfRegistration(true);
$parameters->setHomeText("Magic Word was created as part of the GAMER work package in the Innovalangues project at the Stendhal University in Grenoble, France. Innovalangues is a language learning centered IDEFI project (Initiatives in Excellence for Innovative Education) and will run from 2012 to 2018.");
$parameters->setFooter("footer à personnaliser");
$em->persist($parameters);
// language_ui
echo "languages UI... \n";
$languages = [
"french" => "fr",
"english" => "en"
];
foreach ($languages as $name => $value) {
$languageUI = new LanguageUI;
$languageUI->setName($name);
$languageUI->setValue($value);
}
$em->persist($languageUI);
// roundType
echo "round types... \n";
$roundTypes = [
"rush" => 'RoundType\\Rush',
"conquer" => 'RoundType\\Conquer'
];
foreach ($roundTypes as $name => $class) {
$roundType = new RoundType;
$roundType->setName($name);
$roundType->setClass($name);
$em->persist($roundType);
}
// wordbox_acquisition_type
echo "wordbox acquisition types... \n";
$acquisitionTypes = ["manual"];
foreach ($acquisitionTypes as $type) {
$acquisitionType = new AcquisitionType;
$acquisitionType->setValue($type);
$em->persist($acquisitionType);
}
$output->writeln('<info>########## FIXTURES DONE ###########</info>');
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment