Categories
reviews symfony

Play with me in symfony2 game

Hi to all who can’t live without symfony 🙂

I’ve finally decided today to install symfony2 under Windows7 and see what the beast it is. Also it’s interesting to see its status, I really can’t believe s2 can be ready until end of year.

So I’ve decided to go with simplest “sandbox” way and after unzipping verify my environment by using this script (as proposed in quick start manual):

http://localhost/sandbox/web/check.php

It turned out that I missed a few things

1. my PHP version is 5.2.6 (I had to install 5.3.2 so it’s good chance to finally look into namespaces and other goodies which it provides)
2. date.timezone = EU (I had to enter manually timezone in php.ini as it was commented out by default)
3. uncomment extension_dir = “ext” (this is commented by default) and uncomment these lines as well:
extension=php_pdo_mysql.dll
extension=php_xsl.dll

Once it’s done I’m good to go with example script:

http://localhost/sandbox/web/index_dev.php/hello/SymfonyLab

Oops.. the following error appears:

Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘[WARNING 1549] failed to load external entity “file:///C:usr/www/sandbox/src/vendor/symfony/src/Symfony/Components/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd” (in n/a – line 0, column 0) [WARNING 3084] Element ‘{http://www.w3.org/2001/XMLSchema}import’: Failed to locate a schema at location ‘file:///C:usr/www/sandbox/src/vendor/symfony/src/Symfony/Components/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd’. Skipping the import. (in in_memory_buffer – line 8, column 0) [ERROR 1845] Element ‘{http://www.symfony-project.org/schema/dic/services}container’: No matching global declaration available for the validation root. (in file:///C:/usr/www/sandbox/src/vendor/symfony/src/Symfony/Foundation/Resources/config/services.xml – line 5, column 0)’ in C:\usr\www\sandbox\src\vendor\symfony\src\Symfony\Components\DependencyInjection\Loader\XmlFileLoader.php:283 Stack trace: #0 C:\usr\www\sandbox\src\vendor\symfony\src\Symfony in C:\usr\www\sandbox\src\vendor\symfony\src\Symfony\Components\DependencyInjection\Loader\XmlFileLoader.php on line 283

That was like the red stop sign to me but “no fear for the beer” 🙂
My friend google says that there is already solution (it is discussed here).

So the actual patch is provided here (it says patch going to be included into next symfony2 release):

http://github.com/fabpot/symfony/commit/269651235ae830fe8d93800f3fc70c6142b8bbc4

Next attempt to run http://localhost/sandbox/web/index_dev.php/hello/SymfonyLab is failed again:

Uncaught exception ‘ErrorException’ with message ‘Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Europe/Helsinki’ for ‘3.0/DST’ instead in C:\usr\www\sandbox\src\vendor\zend\library\Zend\Log\Logger.php line 255′ in C:\usr\www\sandbox\src\vendor\symfony\src\Symfony\Foundation\bootstrap.php:302 Stack trace: #0 [internal function]: Symfony\Foundation\Debug\ErrorHandler->handle(2, ‘date()

That’s easier to resolve as I used wrong timezone “EU” and had to replace with e.g. Europe/Helsinki.
Wuala, it works now!

New symfony2 manual is starting here. So if you like to play games like that one (fix and run) – it has definitely enough space for playing 🙂

In general it was very interesting also to read custom symfony2-related documentations on their “learn” page http://symfony-reloaded.org/learn.
I realized that symfony2 is actually very different. I’m also did not really find any mention about using of splitting application into modules which seems to be strange. I’d upset if they remove that part of symfony architecture. Oh symfony 1.0.x I’m missing you sooo much 🙁