I have a column viewedAt which is a DATETIME and accept NULL values. It’s a software restriction to set that column on each new record as 0000-00-00 00:00:00 so I go through the easy way using Symfony and Doctrine as show below: But surprise PHP change that date to this -0001-11-30 00:00:00 and SQL mode in MySQL server is set
Tag: symfony
heroku local does not find pdo_postgres driver
I am trying to use heroku local on mac to run a Symfony project. But unfortunately it does not find the postgresql driver… which is found when I run php app/console server:run Here is the resulting output. How can I solve this? Answer Did you see these ? http://www.somacon.com/p520.php http://www.unixmen.com/solved-php-warning-module-pdo-already-loaded-in-unknown-on-line-0/ Point is that if you have postgres compiled into php
Execute Laravel/Symfony/Artisan Command in Background
I need to execute a Laravel long running process in the background for consuming the Twitter Streaming API. Effectively the php artisan CLI command I need to run is nohup php artisan startStreaming &…
Working directly with libraries instead of bundles in Symfony2
How can I use a library directly inside an existing Symfony2 project. I am, for instance, trying to add the faker library. I installed it via composer but I don’t know how and where to put the code I need. According to documentation: What is a simple explanation of auto loader? How to use a library directly without a bundle?
Symfony: Overriding Symfony service ( compiler pass )
I’m on symfony 2.7 and need to override SymfonyComponentAssetUrlPackage I’ve looked at http://symfony.com/doc/current/cookbook/bundles/override.html and http://symfony.com/doc/current/cookbook/service_container/compiler_passes.html but can’t get it working. I have made a file in my bundle MyAppCoreBundleOverridesUrlPackage; I registered UrlPackage as a service and added a function: The weird thing is, if I call $this->has(‘assets.url_package’) in any controller, it returns false. I did grab it from the services
Symfony2 app.php receiving POST request as GET app_dev.php works fine
So I’m creating a route that requires posting. The route is as follows: So I use postman to hit app_dev.php/myroute/login and I get the correct response that I am looking for, currently the page just returns “hello world”. Now when I change postman to just hit app.php/myroute/login I get an error saying: I’m really confused as to why it says
extract untagged elements with symfony dom crawler
How to extract untagged elements with symfony dom crawler. For example in the sample html below I want to extract Hello World. titleHello WorldSub-Title
SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: YES) symfony2
When I try to login I get an error: SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: YES) parametrs.yml: This file is auto-generated during the composer install My OS is Debian Thanks for your help. Answer This is due to your mysql configuration. According to this error you are trying to connect with the user ‘root’ to the database
Symfony form collection rendering
I’m using symfony 2.3 I have form with field of type “collection” Visualization code in twig: Everything work, expect when form.fields is empty. Then nothing is visualized in twig loop, witch is fine. But at the end of the form there is “label” for the element “form.fields”. Only label. Workaround: If there are elements, they will be rendered in the
Doctrine migrations table collation
Trying to find a way to programatically create tables with certain collation, but can’t seem to find a way how to do it properly. I am using the “doctrine/doctrine-migrations-bundle”: “2.1.*@dev” and Symfony 2.3, I set up in my config.yml: It creates the database with LATIN1 charset and latin1_swedish_ci as default collation, when I run doctrine:database:create tool. Then I run my