Symfony2, Doctrine2 Fatal error: Call to a member function getMetadataFactory() on a non-object in

This problem meets me after upload my Symfony2 app from my laptop to production server. Then, when I try run app I get:

Symfony2, Doctrine2 Fatal error: Call to a member function getMetadataFactory() on a non-object in…

After lot of searching I found solution. In my case was eAccelerator on production server.

In default configuration eAccelerator remove comments (and – of course – annotations from Entity definition class) probably to speed execution code. This is a reason for this error.

You have two options: say good bay to eAccelerator or compile it with

--with-eaccelerator-doc-comment-inclusion

switch.

So step by step second solution:

/usr/local/php5/bin/phpize

./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php5/bin/php-config --with-eaccelerator-doc-comment-inclusion

make

make install

That`s it! Have a nice day :-)

 

Posted in No category | Tagged , , , | Leave a comment

Debian install php_intl problem configure: error: Unable to detect ICU prefix

Problem with install php_intl on Debian?

Get: configure: error: Unable to detect ICU prefix or /usr/local/icu/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.?

Easy solution – just:

apt-get install libicu-dev
Posted in No category | Tagged , , | Leave a comment

Easy and visual explain SQL joins queries

Have you ever had a problem with coding JOIN queries in SQL? This is something which can help you. One picture = 1000 words ;-)
Continue reading

Posted in No category | Leave a comment

PHP Warning: PHP Startup: apc: Unable to initialize module Module compiled with module API=20060613 PHP compiled with module API=20090626

Did you see that?

PHP Warning:  PHP Startup: apc: Unable to initialize module
Module compiled with module API=20060613
PHP    compiled with module API=20090626
These options need to match
in Unknown on line 0

It may happen with other pecl modules because those mostly was compiled for php 5.2.

My configuration DirectAdmin, Debian 5

Solution? Continue reading

Posted in No category | Tagged , , | Leave a comment

Imagick install error: “configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.”

Simple solution:

aptitude install php-pear imagemagick php5-dev libmagick9-dev

libmagick9-dev – this remove all trouble from “configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.”. Continue reading

Posted in No category | Tagged , , | Leave a comment

Symfony – send HTML mail from task with view partial

Do you need send mail from symfony task? No problem! Continue reading

Posted in No category | Tagged , | Leave a comment

Solution for sfForkedDoctrineApplyPlugin Unknown record property / related component “fullname” on “sfGuardUserProfile”

When I use sfForkedDoctrineApplyPluginon my page, after try create new account I got:

Unknown record property / related component “fullname” on “sfGuardUserProfile”

Solutions is easy… of course if you know it ;-) Continue reading

Posted in No category | Tagged , | Leave a comment

How to change form input size in symfony forms?

Sometimes you need to change size (length) in html form elements input. In symfony you can do this in form configure function by using: Continue reading

Posted in No category | Tagged , | Leave a comment

How to remove form element label in symfony forms?

Sometimes you need remove label from forms in symfony. How to do this? Continue reading

Posted in No category | Tagged , | Leave a comment

How to set original filename in symfony file upload

When you upload files in symfony, then save filename will be random. If you want set to original filename add to model class (where you want to upload files):

public function generateYourColumnNameForStoreFileFileName($file)
{
return $file->getOriginalName();
}

where YourColumnNameForStoreFile it`s your column name.

If you want your uploaded files to stay with the original file name (which is not randomly generated by symfony), just add following lines to the model class you want to upload files:

public function generateXxxFileName($file)
{
  return $file->getOriginalName();
}

where Xxx is the name of the column that stores the filename in the database model related table.

Posted in No category | Tagged , | Leave a comment