public function load(ObjectManager $manager) { $p1 = new Post(); $p1->setPublicationDate(new \DateTime('20151201T12:00')); $p1->setPublish(true); $p1->setTitle('Installation de Symfony'); $p1->setAbstract("Ce tutoriel présente l'installation du framework symfony dans sa dernière version stable. C'est une base pour commencer à développer une application web avec. Il couvre l'installation du serveur apache, mysql ainsi que le langage php et l'interface d'administration de base de donnée phpmyadmin."); $article = "Installer les prérequis"; $article = $article . "\n" . "----------------------"; $article = $article . "\n" . ""; $article = $article . "\n" . "```bash"; $article = $article . "\n" . "liste=\\"; $article = $article . "\n" . "apache2 \\"; $article = $article . "\n" . "php5 \\"; $article = $article . "\n" . "mysql-server \\"; $article = $article . "\n" . "libapache2-mod-php5 \\"; $article = $article . "\n" . "php5-mysql \\"; $article = $article . "\n" . "phpmyadmin \\"; $article = $article . "\n" . "php5-intl\""; $article = $article . "\n" . ""; $article = $article . "\n" . "sudo apt-get install \$liste"; $article = $article . "\n" . ""; $article = $article . "\n" . "sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\\/Paris/g' /etc/php5/apache2/php.ini"; $article = $article . "\n" . "sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\\/Paris/g' /etc/php5/cli/php.ini"; $article = $article . "\n" . "```"; $article = $article . "\n" . ""; $article = $article . "\n" . "Installer symfony et un alias"; $article = $article . "\n" . "------------------------------"; $article = $article . "\n" . ""; $article = $article . "\n" . "```bash"; $article = $article . "\n" . "sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony"; $article = $article . "\n" . "sudo chmod a+x /usr/local/bin/symfony"; $article = $article . "\n" . "echo alias sy=\\\"php app/console\\\" >> \$HOME/.bashrc"; $article = $article . "\n" . "```"; $article = $article . "\n" . ""; $article = $article . "\n" . "Installer composer"; $article = $article . "\n" . "------------------"; $article = $article . "\n" . ""; $article = $article . "\n" . "```bash"; $article = $article . "\n" . "curl -sS https://getcomposer.org/installer | php"; $article = $article . "\n" . "sudo mv composer.phar /usr/local/bin/composer"; $article = $article . "\n" . "```"; $article = $article . "\n" . ""; $article = $article . "\n" . "Sources :"; $article = $article . "\n" . "---------"; $article = $article . "\n" . ""; $article = $article . "\n" . "1. http://symfony.com/download"; $article = $article . "\n" . "2. http://doc.ubuntu-fr.org/composer"; $p1->setContent($article); $p1->setAuthor($this->getReference('user-admin')); $manager->persist($p1); $manager->flush(); $p1 = new Post(); $p1->setPublicationDate(new \DateTime('20151202T12:00')); $p1->setPublish(true); $p1->setTitle('Installer et configurer un projet symfony'); $p1->setAbstract("Comment démarrer la toute base d'un projet symfony ? Cette article répond aux questions de configuration mail pour le dev, creation du projet, mise en relation de symfony avec sublime text. Il faut aussi gérer les droits que vous donner à apache ou autre serveur ! Sinon il ne pourra pas écrire dans le dossier de cache et de logs ainsi que les fichiers que vous uploaderez !"); $article = "Installation des fichiers"; $article = $article . "\n" . "-------------------------"; $article = $article . "\n" . ""; $article = $article . "\n" . "```bash"; $article = $article . "\n" . "# installe la dernière version LTS"; $article = $article . "\n" . "symfony new my_project lts"; $article = $article . "\n" . "cd my_project"; $article = $article . "\n" . ""; $article = $article . "\n" . "mkdir web/uploads"; $article = $article . "\n" . "HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\\ -f1`"; $article = $article . "\n" . "# ajouter les dossiers dans lesquels ils faut écrire"; $article = $article . "\n" . "sudo setfacl -R -m u:\"\$HTTPDUSER\":rwX -m u:`whoami`:rwX app/cache app/logs web/uploads"; $article = $article . "\n" . "sudo setfacl -dR -m u:\"\$HTTPDUSER\":rwX -m u:`whoami`:rwX app/cache app/logs web/uploads"; $article = $article . "\n" . "```"; $article = $article . "\n" . ""; $article = $article . "\n" . "Configuration des fichiers"; $article = $article . "\n" . "---------------------------"; $article = $article . "\n" . ""; $article = $article . "\n" . "### parameters.yml"; $article = $article . "\n" . ""; $article = $article . "\n" . "La base de donnée, c'est facile"; $article = $article . "\n" . ""; $article = $article . "\n" . "Pour les mails :"; $article = $article . "\n" . "```yml"; $article = $article . "\n" . "parameters:"; $article = $article . "\n" . " mailer_transport: gmail"; $article = $article . "\n" . " mailer_host: ~"; $article = $article . "\n" . " mailer_user: your_gmail_username"; $article = $article . "\n" . " mailer_password: your_gmail_password"; $article = $article . "\n" . "```"; $article = $article . "\n" . ""; $article = $article . "\n" . "### config.yml"; $article = $article . "\n" . ""; $article = $article . "\n" . "```yml"; $article = $article . "\n" . "parameters:"; $article = $article . "\n" . " locale: fr|en"; $article = $article . "\n" . ""; $article = $article . "\n" . "framework:"; $article = $article . "\n" . " ide: \"subl:///%%f:%%1\""; $article = $article . "\n" . "```"; $article = $article . "\n" . ""; $article = $article . "\n" . "**Note :** Il faut installer le paquet \"subl protocol\" dans sublime text pour avoir les liens"; $article = $article . "\n" . ""; $article = $article . "\n" . "Sources :"; $article = $article . "\n" . "-------"; $article = $article . "\n" . ""; $article = $article . "\n" . "1. http://symfony.com/fr/doc/current/book/installation.html"; $p1->setContent($article); $p1->setAuthor($this->getReference('user-admin')); $manager->persist($p1); $manager->flush(); $p1 = new Post(); $p1->setPublicationDate(new \DateTime('20151203T12:00')); $p1->setPublish(true); $p1->setTitle("Configuration d'assetic et de bootstrap-bundle"); $p1->setAbstract("Configuration de assetic associer a bootstrap bundle. Ces deux bundles vous permettront de gérer très facilement la minification de vos sources css, js. Mais aussi de créer des formulaires avec le style de bootstrap aussi facilement que le template de base qu'utilise symfony. Si vous voulez allez plus loin. Je vous montre aussi comment utiliser knp-menu-bundle pour faire des menus bootstrap."); $article = "Step 1 : Installer less, bootstrap, jquery, jsqueeze"; $article = $article . "\n" . '--------------------------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```bash'; $article = $article . "\n" . 'composer require twbs/bootstrap \'^3.3\''; $article = $article . "\n" . 'composer require components/jquery \'^1.11\''; $article = $article . "\n" . 'composer require patchwork/jsqueeze \'~1.0\''; $article = $article . "\n" . 'composer require braincrafted/bootstrap-bundle \'~2.0\''; $article = $article . "\n" . 'composer require symfony/assetic-bundle'; $article = $article . "\n" . 'sudo apt-get install java-common nodejs npm'; $article = $article . "\n" . 'sudo ln -s /usr/bin/nodejs /usr/bin/node # only needed on ubuntu 14.04 <='; $article = $article . "\n" . 'sudo npm install -g less'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 2 : Ajouter le bundle au AppKernel.php'; $article = $article . "\n" . '-------------------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```php'; $article = $article . "\n" . 'class AppKernel extends Kernel'; $article = $article . "\n" . '{'; $article = $article . "\n" . ' public function registerBundles()'; $article = $article . "\n" . ' {'; $article = $article . "\n" . ' $bundles = array('; $article = $article . "\n" . ' // ...'; $article = $article . "\n" . ' new Symfony\\Bundle\\AsseticBundle\\AsseticBundle(),'; $article = $article . "\n" . ' new Braincrafted\\Bundle\\BootstrapBundle\\BraincraftedBootstrapBundle(),'; $article = $article . "\n" . ' );'; $article = $article . "\n" . ' // ...'; $article = $article . "\n" . ' }'; $article = $article . "\n" . '}'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 3 : Configurer les paramètres'; $article = $article . "\n" . '----------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Dans app/config/config.yml'; $article = $article . "\n" . '```yml'; $article = $article . "\n" . 'assetic:'; $article = $article . "\n" . ' filters:'; $article = $article . "\n" . ' less:'; $article = $article . "\n" . ' node: /usr/bin/node'; $article = $article . "\n" . ' node_paths: [/usr/local/lib/node_modules]'; $article = $article . "\n" . ' apply_to: "\\.less$"'; $article = $article . "\n" . ' cssrewrite: ~'; $article = $article . "\n" . ' jsqueeze: ~'; $article = $article . "\n" . ''; $article = $article . "\n" . 'braincrafted_bootstrap:'; $article = $article . "\n" . ' output_dir:'; $article = $article . "\n" . ' assets_dir: %kernel.root_dir%/../vendor/twbs/bootstrap'; $article = $article . "\n" . ' jquery_path: %kernel.root_dir%/../vendor/components/jquery.min.js'; $article = $article . "\n" . ' less_filter: less'; $article = $article . "\n" . ' fonts_dir: %kernel.root_dir%/../web/fonts'; $article = $article . "\n" . ' auto_configure:'; $article = $article . "\n" . ' assetic: true'; $article = $article . "\n" . ' twig: true'; $article = $article . "\n" . ' knp_menu: true'; $article = $article . "\n" . ' knp_paginator: true'; $article = $article . "\n" . ' customize:'; $article = $article . "\n" . ' variables_file: ~'; $article = $article . "\n" . ' bootstrap_output: %kernel.root_dir%/Resources/less/bootstrap.less'; $article = $article . "\n" . ' bootstrap_template: BraincraftedBootstrapBundle:Bootstrap:bootstrap.less.twig'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 4 : auto install the glyphicons and fonts'; $article = $article . "\n" . '----------------------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```json'; $article = $article . "\n" . '{'; $article = $article . "\n" . ' ...'; $article = $article . "\n" . ' "scripts": {'; $article = $article . "\n" . ' "post-install-cmd": ['; $article = $article . "\n" . ' ...'; $article = $article . "\n" . ' "Braincrafted\\\\Bundle\\\\BootstrapBundle\\\\Composer\\\\ScriptHandler::install"'; $article = $article . "\n" . ' ],'; $article = $article . "\n" . ' "post-update-cmd": ['; $article = $article . "\n" . ' ...'; $article = $article . "\n" . ' "Braincrafted\\\\Bundle\\\\BootstrapBundle\\\\Composer\\\\ScriptHandler::install"'; $article = $article . "\n" . ' ]'; $article = $article . "\n" . ' }'; $article = $article . "\n" . ' ...'; $article = $article . "\n" . '}'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 5 : Mettre à jour le projet (installera les fonts)'; $article = $article . "\n" . '-------------------------------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```bash'; $article = $article . "\n" . 'composer update'; $article = $article . "\n" . '# ou juste'; $article = $article . "\n" . 'sy braincrafted:bootstrap:install'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 6 : Installer jpegoptim'; $article = $article . "\n" . '----------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```bash'; $article = $article . "\n" . 'sudo apt-get install jpegoptim'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 7 : Créer le filtre jpegoptim pour assetic'; $article = $article . "\n" . '-----------------------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Dans config.yml'; $article = $article . "\n" . '```yml'; $article = $article . "\n" . 'assetic:'; $article = $article . "\n" . ' filters:'; $article = $article . "\n" . ' jpegoptim:'; $article = $article . "\n" . ' bin: /usr/bin/jpegoptim'; $article = $article . "\n" . ' max: 70'; $article = $article . "\n" . ' twig:'; $article = $article . "\n" . ' functions:'; $article = $article . "\n" . ' jpegoptim: ~'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . '**Note :** On peut aussi utiliser http://knpbundles.com/liip/LiipImagineBundle, à approndir'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 8 : L\'utiliser'; $article = $article . "\n" . '--------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```twig'; $article = $article . "\n" . '<img src="{{ jpegoptim(\'@AcmeFooBundle/Resources/public/images/example.jpg\') }}" alt="Example"/>'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 9 : Lancer pour la production'; $article = $article . "\n" . '----------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```bash'; $article = $article . "\n" . 'sy assetic:dump --env=prod --no-debug;'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Sources :'; $article = $article . "\n" . '---------'; $article = $article . "\n" . ''; $article = $article . "\n" . '1. (http://symfony.com/fr/doc/current/cookbook/assetic/asset_management.html)'; $article = $article . "\n" . '2. (http://bootstrap.braincrafted.com/)'; $article = $article . "\n" . '3. (http://openclassrooms.com/courses/developpez-votre-site-web-avec-le-framework-symfony2/utiliser-assetic-pour-gerer-les-codes-css-et-js-de-votre-site)'; $article = $article . "\n" . '4. (https://github.com/yui/yuicompressor/releases)'; $article = $article . "\n" . ''; $p1->setContent($article); $p1->setAuthor($this->getReference('user-admin')); $manager->persist($p1); $manager->flush(); $p1 = new Post(); $p1->setPublicationDate(new \DateTime('20151204T12:00')); $p1->setPublish(true); $p1->setTitle("Installer et configurer fosuserbundle"); $p1->setAbstract("Tout simplement indispensable pour gérer vos utilisateurs simplement, ce bundle gère la validation d'inscription par email, les droits, les groupes. Une fois l'override des formulaires, profiter pleinement de cette solution efficace pour gérer vos utilisateurs."); $article = 'Step 1: Download FOSUserBundle using composer'; $article = $article . "\n" . '---------------------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```bash'; $article = $article . "\n" . 'composer require friendsofsymfony/user-bundle "dev-master"'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 2: Enable the bundle'; $article = $article . "\n" . '-------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'In the AppKernel.php'; $article = $article . "\n" . '```php'; $article = $article . "\n" . '<?php'; $article = $article . "\n" . '// app/AppKernel.php'; $article = $article . "\n" . ''; $article = $article . "\n" . 'public function registerBundles()'; $article = $article . "\n" . '{'; $article = $article . "\n" . ' $bundles = array('; $article = $article . "\n" . ' // ...'; $article = $article . "\n" . ' new FOS\\UserBundle\\FOSUserBundle(),'; $article = $article . "\n" . ' );'; $article = $article . "\n" . '}'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 3: Create your User class'; $article = $article . "\n" . '------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Créer le dossier src/Pm/UserBundle puis le fichier PmUserBundle.php'; $article = $article . "\n" . '```php'; $article = $article . "\n" . '<?php'; $article = $article . "\n" . ''; $article = $article . "\n" . 'namespace Pm\\UserBundle;'; $article = $article . "\n" . ''; $article = $article . "\n" . 'use Symfony\\Component\\HttpKernel\\Bundle\\Bundle;'; $article = $article . "\n" . ''; $article = $article . "\n" . 'class PmUserBundle extends Bundle'; $article = $article . "\n" . '{'; $article = $article . "\n" . ' public function getParent() {'; $article = $article . "\n" . ' return \'FOSUserBundle\';'; $article = $article . "\n" . ' }'; $article = $article . "\n" . '}'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . ''; $article = $article . "\n" . 'Puis le fichier src/Pm/UserBundle/Entity/User.php'; $article = $article . "\n" . '```php'; $article = $article . "\n" . '<?php'; $article = $article . "\n" . ''; $article = $article . "\n" . 'namespace Pm\\UserBundle\\Entity;'; $article = $article . "\n" . ''; $article = $article . "\n" . 'use FOS\\UserBundle\\Model\\User as BaseUser;'; $article = $article . "\n" . 'use Doctrine\\ORM\\Mapping as ORM;'; $article = $article . "\n" . ''; $article = $article . "\n" . '/**'; $article = $article . "\n" . ' * @ORM\\Entity'; $article = $article . "\n" . ' * @ORM\\Table(name="`user`")'; $article = $article . "\n" . ' */'; $article = $article . "\n" . 'class User extends BaseUser'; $article = $article . "\n" . '{'; $article = $article . "\n" . ' /**'; $article = $article . "\n" . ' * @ORM\\Id'; $article = $article . "\n" . ' * @ORM\\Column(type="integer")'; $article = $article . "\n" . ' * @ORM\\GeneratedValue(strategy="AUTO")'; $article = $article . "\n" . ' */'; $article = $article . "\n" . ' protected $id;'; $article = $article . "\n" . '}'; $article = $article . "\n" . ''; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 4: Configure your application\'s security.yml'; $article = $article . "\n" . '-------------------------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```yml'; $article = $article . "\n" . '# app/config/security.yml'; $article = $article . "\n" . 'security:'; $article = $article . "\n" . ' encoders:'; $article = $article . "\n" . ' FOS\\UserBundle\\Model\\UserInterface: bcrypt'; $article = $article . "\n" . ''; $article = $article . "\n" . ' role_hierarchy:'; $article = $article . "\n" . ' ROLE_ADMIN: ROLE_USER'; $article = $article . "\n" . ' ROLE_SUPER_ADMIN: ROLE_ADMIN'; $article = $article . "\n" . ''; $article = $article . "\n" . ' providers:'; $article = $article . "\n" . ' fos_userbundle:'; $article = $article . "\n" . ' id: fos_user.user_provider.username'; $article = $article . "\n" . ''; $article = $article . "\n" . ' firewalls:'; $article = $article . "\n" . ' main:'; $article = $article . "\n" . ' pattern: ^/'; $article = $article . "\n" . ' form_login:'******' provider: fos_userbundle'; $article = $article . "\n" . ' csrf_provider: security.csrf.token_manager'; $article = $article . "\n" . ' login_path: fos_user_security_login'; $article = $article . "\n" . ' check_path: fos_user_security_check'; $article = $article . "\n" . ' default_target_path: blog'; $article = $article . "\n" . ''; $article = $article . "\n" . ' logout:'; $article = $article . "\n" . ' path: fos_user_security_logout'; $article = $article . "\n" . ' target: blog'; $article = $article . "\n" . ''; $article = $article . "\n" . ' anonymous: true'; $article = $article . "\n" . ''; $article = $article . "\n" . ' access_control:'; $article = $article . "\n" . ' - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }'; $article = $article . "\n" . ' - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }'; $article = $article . "\n" . ' - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }'; $article = $article . "\n" . ' - { path: ^/admin/, role: ROLE_ADMIN }'; $article = $article . "\n" . ''; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 5: Configure the FOSUserBundle'; $article = $article . "\n" . '-----------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Dans app/config/config.yml'; $article = $article . "\n" . '```yml'; $article = $article . "\n" . 'fos_user:'******' db_driver: orm'; $article = $article . "\n" . ' firewall_name: main'; $article = $article . "\n" . ' user_class: AppBundle\\Entity\\User'; $article = $article . "\n" . ' registration:'; $article = $article . "\n" . ' confirmation:'; $article = $article . "\n" . ' enabled: true'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 6: Import FOSUserBundle routing files'; $article = $article . "\n" . '------------------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Dans app/config/routing.yml'; $article = $article . "\n" . '```yml'; $article = $article . "\n" . 'fos_user:'******' resource: "@FOSUserBundle/Resources/config/routing/all.xml"'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 7: Update your database schema'; $article = $article . "\n" . '-----------------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '```bash'; $article = $article . "\n" . 'sy doctrine:schema:update --force'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Step 8: Override twig files'; $article = $article . "\n" . '---------------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . '- Copy the folder vendor/frien.../Resources/views in app/Resources/FOSUserbundle/Resources'; $article = $article . "\n" . '- Customize as you want'; $article = $article . "\n" . '- do not forget to clear the dev cache after customizing'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Sources'; $article = $article . "\n" . '-------'; $article = $article . "\n" . ''; $article = $article . "\n" . '1. https://github.com/FriendsOfSymfony/FOSUserBundle'; $p1->setContent($article); $p1->setAuthor($this->getReference('user-admin')); $manager->persist($p1); $manager->flush(); $p1 = new Post(); $p1->setPublicationDate(new \DateTime('20151205T12:00')); $p1->setPublish(true); $p1->setTitle("Installer et configurer corespherebundle"); $p1->setAbstract("Ce bundle permet d'accéder à la console directement dans le navigateur, plus que pratique quand on est en production ! Il vous permettra de créer votre base de donnée, y loader vos fixtures et toute les commandes que vous aurez créer vous même !"); $article = "Installer les sources"; $article = $article . "\n" . '---------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Executer la commande suivante :'; $article = $article . "\n" . '```bash'; $article = $article . "\n" . 'composer require coresphere/console-bundle "dev-master"'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Ajout de la route'; $article = $article . "\n" . '-----------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Dans app/config/routing_dev.yml'; $article = $article . "\n" . '```yml'; $article = $article . "\n" . 'coresphere_console:'; $article = $article . "\n" . ' resource: .'; $article = $article . "\n" . ' type: extra'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Enregistrer le bundle'; $article = $article . "\n" . '-------------------'; $article = $article . "\n" . '```php'; $article = $article . "\n" . 'public function registerBundles()'; $article = $article . "\n" . '{'; $article = $article . "\n" . ' $bundles = array('; $article = $article . "\n" . ' // other bundles here...'; $article = $article . "\n" . ' );'; $article = $article . "\n" . ''; $article = $article . "\n" . ' if (in_array($this->getEnvironment(), array(\'dev\', \'test\'))) {'; $article = $article . "\n" . ' // ...'; $article = $article . "\n" . ' $bundles[] = new CoreSphere\\ConsoleBundle\\CoreSphereConsoleBundle();'; $article = $article . "\n" . ' }'; $article = $article . "\n" . ''; $article = $article . "\n" . ' return $bundles;'; $article = $article . "\n" . '}'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Installer les assets'; $article = $article . "\n" . '--------------------'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Executer la commande suivante :'; $article = $article . "\n" . '```bash'; $article = $article . "\n" . 'sy assets:install --symlink'; $article = $article . "\n" . '```'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Sources'; $article = $article . "\n" . '-------'; $article = $article . "\n" . ''; $article = $article . "\n" . '1. https://github.com/CoreSphere/ConsoleBundle'; $article = $article . "\n" . '2. http://openclassrooms.com/courses/developpez-votre-site-web-avec-le-framework-symfony2/utiliser-la-console-directement-depuis-le-navigateur'; $p1->setContent($article); $p1->setAuthor($this->getReference('user-admin')); $manager->persist($p1); $manager->flush(); $p1 = new Post(); $p1->setPublicationDate(new \DateTime('20151221T12:00')); $p1->setPublish(true); $p1->setTitle("Calcul d'un MDD et d'un MDI"); $p1->setAbstract("Cet article vous donne toute les formules utiles au calcul d'un mdd/mdi et les applique à un exemple."); $article = "# Examen de robotique Industrielle"; $article = $article . "\n" . ''; $article = $article . "\n" . '## I. Calcul du MDD'; $article = $article . "\n" . ''; $article = $article . "\n" . '### 1. Calcul de la jacobienne préférentielle'; $article = $article . "\n" . ''; $article = $article . "\n" . '#### (a) Calcul de p, i, j'; $article = $article . "\n" . ''; $article = $article . "\n" . '- n = nombre de liason'; $article = $article . "\n" . '- p = partie entière (n / 2)'; $article = $article . "\n" . '- i = p + 1'; $article = $article . "\n" . '- j = p'; $article = $article . "\n" . ''; $article = $article . "\n" . '#### (b) Calcul des $z_{k(j)}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '**Formule :** $z_{k(j)} = R_{kj}.O_kO_j(j)$'; $article = $article . "\n" . ''; $article = $article . "\n" . '- $z_{1(2)} = R_{12}.\\begin{pmatrix}0 & 0 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . '- $z_{2(2)} = R_{22}.\\begin{pmatrix}0 & 0 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . '- $z_{3(2)} = R_{32}.\\begin{pmatrix}0 & 0 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . '- $z_{4(2)} = R_{42}.\\begin{pmatrix}0 & 0 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . '- $z_{5(2)} = R_{52}.\\begin{pmatrix}0 & 0 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$R_{12} = '; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c2 & -s2 & 0 \\\\'; $article = $article . "\n" . ' s2 & c2 & 0 \\\\'; $article = $article . "\n" . ' 0 & 0 & 1'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$R_{22} = '; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 1 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 1 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 1'; $article = $article . "\n" . '\\end{pmatrix} \\rightarrow$ pas de rotation'; $article = $article . "\n" . ''; $article = $article . "\n" . '$R_{32} = R_{23}^{-1} = R_{23}^T ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 1 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & -1\\\\'; $article = $article . "\n" . ' 0 & 1 & 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$R_{42} = R_{43}.R_{32} = R_{34}^T.R_{32} = '; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c4 & 0 & s4\\\\'; $article = $article . "\n" . ' s4 & 0 & c4\\\\'; $article = $article . "\n" . ' 0 & -1 & 0'; $article = $article . "\n" . '\\end{pmatrix}.'; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 1 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & -1\\\\'; $article = $article . "\n" . ' 0 & 1 & 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$R_{42} = '; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c4 & s4 & 0\\\\'; $article = $article . "\n" . ' s4 & c4 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 1'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$R_{52} = R_{54}.R_{43} = R_{45}^T.R_{42} = '; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c5 & 0 & -s5\\\\'; $article = $article . "\n" . ' -s5 & 0 & -c5\\\\'; $article = $article . "\n" . ' 0 & 1 & 0'; $article = $article . "\n" . '\\end{pmatrix}.'; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c4 & s4 & 0\\\\'; $article = $article . "\n" . ' s4 & c4 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 1'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$R_{52} = '; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c4.c5 & c5.s4 & -s5\\\\'; $article = $article . "\n" . ' -c4.s5 & -s4.s5 & -c5\\\\'; $article = $article . "\n" . ' s4 & c4 & 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{1(2)} = \\begin{pmatrix}0 & 0 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{2(2)} = \\begin{pmatrix}0 & 0 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{3(2)} = \\begin{pmatrix}0 & 0 & 0\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{4(2)} = \\begin{pmatrix}0 & 0 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{5(2)} = \\begin{pmatrix}-s5 & -c5 & 1\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '#### (c) Calcul des $p_{ki(j)}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '**Formule :** $p_{ki(j)} = O_kO_i(j)$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$O_1O_3(2) = O_1O_2(2) + O_2O_3(2) = 0 + \\begin{pmatrix}0 & q3 & 0\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$O_2O_3(2) = \\begin{pmatrix}0 & q3 & 0\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$O_3O_3(2) = \\begin{pmatrix}0 & 0 & 0\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$O_4O_3(2) = \\begin{pmatrix}0 & 0 & 0\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$O_5O_3(2) = \\begin{pmatrix}0 & 0 & 0\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '#### (d) Calcul des $z_{k(j)} \\land p_{ki(j)}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '**Formule :**'; $article = $article . "\n" . '$\\begin{pmatrix}a \\\\ b \\\\ c\\end{pmatrix} \\land \\begin{pmatrix}d \\\\ e \\\\ f\\end{pmatrix} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' b.f - c.e\\\\'; $article = $article . "\n" . ' c.d - a.f\\\\'; $article = $article . "\n" . ' a.e - b.d'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{1(2)} \\land p_{13(2)} = \\begin{pmatrix}0 \\\\ 0 \\\\ 1\\end{pmatrix} \\land \\begin{pmatrix}0 \\\\ q3 \\\\ 0\\end{pmatrix} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' -q3\\\\'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{2(2)} \\land p_{23(2)} = \\begin{pmatrix}0 \\\\ 0 \\\\ 1\\end{pmatrix} \\land \\begin{pmatrix}0 \\\\ q3 \\\\ 0\\end{pmatrix} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' -q3\\\\'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{3(2)} \\land p_{33(2)} = \\begin{pmatrix}0 \\\\ 0 \\\\ 0\\end{pmatrix} \\land \\begin{pmatrix}0 \\\\ 0 \\\\ 0\\end{pmatrix} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{4(2)} \\land p_{43(2)} = \\begin{pmatrix}0 \\\\ 0 \\\\ 1\\end{pmatrix} \\land \\begin{pmatrix}0 \\\\ 0 \\\\ 0\\end{pmatrix} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$z_{5(2)} \\land p_{53(2)} = \\begin{pmatrix}-s5 \\\\ -c5 \\\\ 1\\end{pmatrix} \\land \\begin{pmatrix}0 \\\\ 0 \\\\ 0\\end{pmatrix} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '#### Ecriture de la jacobienne préférentielle'; $article = $article . "\n" . ''; $article = $article . "\n" . '**Formule :**'; $article = $article . "\n" . '$$'; $article = $article . "\n" . 'J_{i(j)} = '; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' \\sigma_1.z_1 + \\bar{\\sigma_1}.z_{1(j)}\\land p_{1i(j)} & \\dots & \\sigma_n.z_{n(j)} + \\bar{\\sigma_{n(j)}}.z_{n(j)}\\land p_{ni(j)} \\\\'; $article = $article . "\n" . ' \\bar{\\sigma_1}.z_{1(j)} & \\dots & \\bar{\\sigma_n}.z_{n(j)}'; $article = $article . "\n" . '\\end{pmatrix}'; $article = $article . "\n" . '$$'; $article = $article . "\n" . ''; $article = $article . "\n" . 'Simplification avec connaissance de la nature des liaisons'; $article = $article . "\n" . ''; $article = $article . "\n" . '$$'; $article = $article . "\n" . '\\begin{align}'; $article = $article . "\n" . ' J_{3(2)} &= '; $article = $article . "\n" . ' \\begin{pmatrix}'; $article = $article . "\n" . ' z_{1(2)}\\land p_{13(2)} & z_{2(2)}\\land p_{23(2)} & z_{3(2)} & z_{4(2)}\\land p_{43(2)} & z_{5(2)}\\land p_{53(2)}\\\\'; $article = $article . "\n" . ' z_{1(2)} & z_{2(2)} & O_{3\\times1} & z_{4(2)} & z_{5(2)}'; $article = $article . "\n" . ' \\end{pmatrix}\\\\'; $article = $article . "\n" . ' &='; $article = $article . "\n" . ' \\begin{pmatrix}'; $article = $article . "\n" . ' -q3 & -q3 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & -s5\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & -c5\\\\'; $article = $article . "\n" . ' 1 & 1 & 0 & 1 & 1'; $article = $article . "\n" . ' \\end{pmatrix}'; $article = $article . "\n" . '\\end{align}'; $article = $article . "\n" . '$$'; $article = $article . "\n" . ''; $article = $article . "\n" . '### 2. Calcul de $\\hat{P}_{in(j)}$ selon le vecteur $p_{in(j)}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '**Formule :** $\\hat{P}_{in(j)} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 0 & -z & y\\\\'; $article = $article . "\n" . ' z & 0 & -x\\\\'; $article = $article . "\n" . ' -y & x & 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . 'avec $p_{in(j)} = \\begin{pmatrix}x & y & z\\end{pmatrix}^T$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$p_{35(2)} = \\begin{pmatrix}0\\\\0\\\\0\\end{pmatrix}$ donc $\\hat{P}_{in(j)} = O_{3\\times3}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '### 3. Calcul de $dp_{(0)}$ et $d\\varphi_{(0)}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '**Formule :**'; $article = $article . "\n" . '$\\begin{pmatrix}dp_{(0)} \\\\ d\\varphi_{(0)}\\end{pmatrix} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' R_{03} & O_{33}\\\\'; $article = $article . "\n" . ' O_{33} & R_{03}'; $article = $article . "\n" . '\\end{pmatrix}.'; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' I_{33} & -\\hat{P}_{in(j)}\\\\'; $article = $article . "\n" . ' O_{33} & I_{33}'; $article = $article . "\n" . '\\end{pmatrix}.J_{3(2)}.dq$'; $article = $article . "\n" . 'avec'; $article = $article . "\n" . '$dq = \\begin{pmatrix}dq1 \\\\ \\vdots \\\\ dqn\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . 'or $\\hat{P}_{in(j)} = O_{3\\times3}$ donc'; $article = $article . "\n" . '$\\begin{pmatrix}dp_{(0)} \\\\ d\\varphi_{(0)}\\end{pmatrix} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' R_{03} & O_{33}\\\\'; $article = $article . "\n" . ' O_{33} & R_{03}'; $article = $article . "\n" . '\\end{pmatrix}.J_{3(2)}.dq$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$R_{03} = R_{12}.R_{23}.R_{34} ='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 1 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 1 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 1'; $article = $article . "\n" . '\\end{pmatrix}.'; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c2 & -s2 & 0 \\\\'; $article = $article . "\n" . ' s2 & c2 & 0 \\\\'; $article = $article . "\n" . ' 0 & 0 & 1'; $article = $article . "\n" . '\\end{pmatrix}.'; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' 1 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 1\\\\'; $article = $article . "\n" . ' 0 & -1 & 0'; $article = $article . "\n" . '\\end{pmatrix} = '; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c2 & 0 & -s2\\\\'; $article = $article . "\n" . ' s2 & 0 & c2\\\\'; $article = $article . "\n" . ' 0 & -1 & 0'; $article = $article . "\n" . '\\end{pmatrix}$'; $article = $article . "\n" . ''; $article = $article . "\n" . '$$'; $article = $article . "\n" . '\\begin{align}'; $article = $article . "\n" . '\\begin{pmatrix}dp_{(0)} \\\\ d\\varphi_{(0)}\\end{pmatrix} &='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' c2 & 0 & -s2 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' s2 & 0 & c2 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & -1 & 0 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & c2 & 0 & -s2\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & s2 & 0 & c2\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & -1 & 0'; $article = $article . "\n" . '\\end{pmatrix}.'; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' -q3 & -q3 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & 0\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & -s5\\\\'; $article = $article . "\n" . ' 0 & 0 & 0 & 0 & -c5\\\\'; $article = $article . "\n" . ' 1 & 1 & 0 & 1 & 1'; $article = $article . "\n" . '\\end{pmatrix}.'; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' dq1\\\\ dq2\\\\ dq3\\\\ dq4\\\\ dq5'; $article = $article . "\n" . '\\end{pmatrix}\\\\'; $article = $article . "\n" . '&='; $article = $article . "\n" . '\\begin{pmatrix}'; $article = $article . "\n" . ' - c2.dq1.q3 - c2.dq2.q3\\\\'; $article = $article . "\n" . ' - dq1.q3.s2 - dq2.q3.s2\\\\'; $article = $article . "\n" . ' 0\\\\'; $article = $article . "\n" . ' - dq1.s2 - dq2.s2 - dq4.s2 - dq5.(s2 + c2.s5)\\\\'; $article = $article . "\n" . ' c2.dq1 + c2.dq2 + c2.dq4 + dq5.(c2 - s2.s5)\\\\'; $article = $article . "\n" . ' c5.dq5'; $article = $article . "\n" . '\\end{pmatrix}'; $article = $article . "\n" . '\\end{align}'; $article = $article . "\n" . '$$'; $p1->setContent($article); $p1->setAuthor($this->getReference('user-admin')); $p1->setMathematics(true); $manager->persist($p1); $manager->flush(); }