Specto + Symfony 2 + Git

If you install specto following these instructions and not from the ubuntu software center repository then you will be getting the latest version:

http://code.google.com/p/specto/wiki/Installing

Then set up a feed subscription on reader.google.com the service that is supported nicely by specto. Set this name label into your specto and you will get notifications of pushes into the central git repository be github or other rss commit url.

This will be good to communicate across team members.

Symfony2 PSSBlogBundle: The Missing Instructions To Contribute

I finally figured out the instructions for PSSBlogBundle:

// deps
[PSSBlogBundle]
    git=https://cordoval@github.com/cordoval/PSSBlogBundle.git
    target=/bundles/PSS/Bundle/BlogBundle
[Zend]
    git=https://github.com/zendframework/zf2.git
[KnpPaginatorBundle]
    git=http://github.com/knplabs/KnpPaginatorBundle.git
    target=/bundles/Knp/Bundle/PaginatorBundle
[buzz]
    git=https://github.com/kriswallsmith/Buzz.git
    target=/buzz
[SahiClient]
    git=https://github.com/Behat/SahiClient
    target=/behat/sahi
[MinkBundle]
    git=https://github.com/Behat/MinkBundle.git
    target=/bundles/Behat/MinkBundle
[Mink]
    git=https://github.com/Behat/Mink.git
    target=/behat/mink
[BehatBundle]
    git=https://github.com/Behat/BehatBundle.git
    target=/bundles/Behat/BehatBundle
[Gherkin]
    git=https://github.com/Behat/Gherkin.git
    target=/behat/Gherkin
[Behat]
    git=https://github.com/Behat/Behat.git
    target=/behat/Behat
    version=origin/feature/aliased-subcontexts
[JMSDebuggingBundle]
    git=https://github.com/schmittjoh/JMSDebuggingBundle.git
    target=/bundles/JMS/DebuggingBundle
[goutte]
    git=https://github.com/fabpot/Goutte.git
    target=/goutte
 
// don't forget bin/vendors update
 
// kernel registration
            new PSS\Bundle\BlogBundle\PSSBlogBundle(),
        new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
 
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Behat\MinkBundle\MinkBundle();
            $bundles[] = new Behat\BehatBundle\BehatBundle();
            $bundles[] = new JMS\DebuggingBundle\JMSDebuggingBundle($this);
 
// autoload
    'PSS'              => __DIR__.'/../vendor/bundles',
    'Knp'                       => __DIR__.'/../vendor/bundles',
    'Zend'                => __DIR__.'/../vendor/Zend/library',
    'Behat\Mink' => __DIR__.'/../vendor/behat/mink/src',
    'Behat\MinkBundle' => __DIR__.'/../vendor/bundles',
    'Behat\SahiClient' => __DIR__.'/../vendor/behat/sahi/src',
    'Behat\BehatBundle' => __DIR__.'/../vendor/bundles',
    'Behat\Behat'       => __DIR__.'/../vendor/behat/Behat/src',
    'Behat\Gherkin'     => __DIR__.'/../vendor/behat/Gherkin/src',
    'Goutte'           => __DIR__.'/../vendor/goutte/src',
    'Buzz'             => __DIR__.'/../vendor/buzz/lib',
 
// import the twig blog service
imports:
    - { resource: parameters.ini }
    - { resource: security.yml }
    - { resource: "@PSSBlogBundle/Resources/config/services.yml" }
 
// config dependencies
knp_paginator:
    templating: ~ # enables view helper and twig

mink:
    base_url:   http://wp.local/web/app_test.php
    sahi:
      host:     wp.local
    goutte:     ~
    show_cmd:   firefox %%s #google-chrome
    browser_name:    firefox  #chrome
    #default_session: sahi
    default_session: symfony
behat: ~
 
framework:
    test: ~
    session:
        storage_id: session.storage.filesystem
 
// activate routing
blog:
    resource: "@PSSBlogBundle/Controller/BlogController.php"
    prefix:   /
    type:     annotation

After this you will need to create database schema and build system:

php app/console doctrine:schema:create
php app/console --env=dev behat @PSSBlogBundle

This last step will generate schema database and also pour information into database.
Now point your browser to /app_dev.php/blog and you will see it.

A Symfon2 PHPStorm MUST HAVE Template

http://ethanschoonover.com/solarized

Followed instructions with this file here:

https://github.com/jkaving/intellij-colors-solarized/blob/master/settings.jar?raw=true

Option 1: Install using “Import Settings…”

Go to File | Import Settings… and specify the intellij-colors-solarized directory. Clik OK in the dialog that appears.

Restart IntelliJ IDEA

Go to Preferences | Editor | Colors & Fonts and select one of the new color themes.

Great!

After:

Before:

My first post in rst

How to configure AsseticBundle

System Message: ERROR/3 (/home/cordoval/sites-2/sf2docs/cookbook/assetic.rst, line 1)

Unknown directive type "index".

.. index::
   single: Assets; AsseticBundle

This is an introduction on Assetic use.

Looking at the symfony bundle at vendor/symfony/src/Symfony/Bundle/AsseticBundle/Resources/config/filters we find that Assetic support several filters for different styling frameworks:

System Message: WARNING/2 (/home/cordoval/sites-2/sf2docs/cookbook/assetic.rst, line 23)

Bullet list ends without a blank line; unexpected unindent.

yui_css.xml cssrewrite.xml less.xml scss.xml yui_js.xml

Tip

Instead of using your regular Gmail account, it’s of course recommended that you create a special account.

In the development configuration file, change the transport setting to gmail and set the username and password to the Google credentials:

System Message: ERROR/3 (/home/cordoval/sites-2/sf2docs/cookbook/assetic.rst, line 38)

Unknown directive type "configuration-block".

.. configuration-block::

    .. code-block:: yaml

        # app/config/config_dev.yml
        swiftmailer:
            transport: gmail
            username:  your_gmail_username
            password:  your_gmail_password

    .. code-block:: xml

        <!-- app/config/config_dev.xml -->

        <!--
        xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
        http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd
        -->

        <swiftmailer:config
            transport="gmail"
            username="your_gmail_username"
            password="your_gmail_password" />

    .. code-block:: php

        // app/config/config_dev.php
        $container->loadFromExtension('swiftmailer', array(
            'transport' => "gmail",
            'username'  => "your_gmail_username",
            'password'  => "your_gmail_password",
        ));

You’re done!

Note

The gmail transport is simply a shortcut that uses the smtp transport and sets encryption, auth_mode and host to work with Gmail.

Stof’s rule of thumb

apriori:

  • owning side is the side that owns the foreign key
  • inversed side in a many to one relationship is the one side
  • owning side in a many to one relationship is the many side
  • the issue is that the setter of the inversed side needs to update the owning side otherwise you will not be able to use it yourself. And you cannot call the setter of the inversed side from the one of the owning side as it would make an infinite loop

    – Stof