Thursday, January 13, 2011

You need to enable either the SQLite or PDO_SQLite extension for the profiler to run properly.

After installation of Symfony2 sandbox, I wanted to view new debug profiler. But I have got the error:

You need to enable either the SQLite or PDO_SQLite extension for the profiler to run properly.

It means your apache server doesn't have enabled sqlite extension.

On linux just install it through:

apt-get install php5-sqlite

and restart apache.

Saturday, January 8, 2011

Generating URL from Model or Task

I needed to send emails from a task.

I have tried to load certain helpers but it did not work properly. In my output url was still "/symfony/symfony/".

To make it work I had to define context:
And then I have created a helper in my lib/helper directory (myUrlHelper.class.php), that defines my needs: 
class myUrlHelper
  public static function url_for($lang, $request, $token)
    $url = 
            sfConfig::get('app_web_address','') .
            $lang . '/'.
            $request . '/'.

    return $url;

Then you can call your new url helper like this:
myUrlHelper::url_for($reminder->getUser()->getCulture(), 'url_link_request', $item->getToken)); 

Wednesday, December 22, 2010

Parse error: syntax error, unexpected T_OBJECT_OPERATOR

After uploading project on my webserver I came up with this kind of error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in path\to\project\web\index.php on line 12

which is this line:

The problem was in PHP version set on webserver. So when I looked at check_configuration.php is saw that webserver is set for PHP4.
After changing into PHP5, everything went all right.

Monday, December 6, 2010

Javascript syntax highlighting problem in Netbeans 6.9

I had troubles figuring out how to highlight my javascript syntax in netbeans 6.9. it worked fine in 6.8. Even when I tried to make a new file, a javascript option doesn't show. Any help would be greatly appreciated. Thanks.

On a fresh install of 10.10 and 6.9, I found the NetBeans Update Centre was not ticked under Tools|Plugins|Settings tab.

I tried an update first, and got the message that the IDE was up to date. After ticking this box, I got many updates, and my code formatting is back to how I expect.

Tuesday, November 23, 2010

Configure virtual host on linux to run symfony project

Let's assume you have created your project in /var/www/sfsite.

To create a virtual host for symfony project on Linux follow these steps:

sudo gedit /etc/apache2/sites-available/sfsite.lcl.conf - generate configuration for your new host

insert into file your settings of host:

<VirtualHost *:80>
    ServerName sfsite.lcl
    DocumentRoot "/var/www/sfsite/web"
    DirectoryIndex index.php
    <Directory /var/www/sfsite/web >
        AllowOverride All
Alias /sf /var/www/symfony/data/web/sf
<Directory "/var/www/symfony/data/web/sf ">
AllowOverride All
Allow from All

sudo a2ensite sfsite.lcl.conf – enable this site for the server

sudo gedit /etc/hosts

insert name of your host, so that your local server knows that it has to look in for your local sites, not on the internet: sfsite.lcl

sudo /etc/init.d/apache2 restart – restart apache server and you can work on your symfony project by typing sfsite.lcl link into your web browser

Monday, November 22, 2010

Ubuntu 10.10 Can not Select Checkbox in Netbeans 6.9

After installing new version of Netbeans IDE 6.9 on Ubuntu 10.10, I had problem to select installing particular plugins. There were no possibility to tick a checkbox.

Problem was because Java Platform (java-6-open-jdk) is not Compatible with Ubuntu 10.10.
I solved the problem by uninstalling the newest all dependencies of jdk. 
The solution is to install sun-java6-jdk like this:

sudo apt-get install sun-java6-jdk

Then you can install Netbeans on your Ubuntu.

symfony: undefined method Doctrine_Collection::offset()

i got the following error when paginating results with sfDoctrinePager:
Fatal error: Call to undefined method Doctrine_Collection::offset() in /path/to/symfony/lib/plugins/sfDoctrinePlugin/lib/pager/sfDoctrinePager.class.php on line 84
if you're like me you'll think there's something wrong with symfony and search all over google and couldn't find anything.
this is not an error in symfony but could be in your own code.
in module action.class.php:
$this->pager->setQuery($this->getResult()); // you should return QUERY, not fetched array

Be sure you are returning from getReult() method query, not fetched array.
$q = Doctrine_Query::create()->from('Model m'); 
return $q;