PHP Hints

July 10, 2011

6 Comments »

  1. Thanks so much for this!

    So, in a production environment, would it be smart to swap line 18 in the second snippet with this?:
    new \Doctrine\Common\Cache\ApcCache());

    Comment by Matthew — July 20, 2011 @ 5:00 pm | Reply

  2. You are quite welcome for the article. Thank you for your comment. No, line 18 has nothing to do with the overall caching policy of the ORM. In Bisna the caching policy is controlled by this entry in the configs/application.ini:

    resources.doctrine.cache.instances.default.adapterClass = “Doctrine\Common\Cache\ArrayCache”

    In a production environment you do want to change this line. If you have APC installed, then it should be:

    resources.doctrine.cache.instances.default.adapterClass = “Doctrine\Common\Cache\ApcCache”

    You, of course, will also need to change this line

    resources.doctrine.orm.entityManagers.default.proxy.autoGenerateClasses = true

    It needs to be false, in a production environment. Line 18 involves the annotations reader, which is only used when proxies are auto-generated or when the doctrine command line tool is used to generate the proxies. In a production environment you should have already manually generated your proxies by running the doctrine command line tool. Bisna has its own
    version of the command line tool, doctrine.php. Thus, you should have already done

    # php scripts/doctrine.php orm:generate-proxies

    If you have repositories annotated in your entities, you will also need to

    # php scripts/doctrine.php orm:generate-repositories library/

    The line above depends on the directory from which you execute the command. If you are in the script directory already, then

    # php ./doctrine.php orm:generate-repositories ../library/

    is what you want. Also be sure to do:

    # php scripts/doctrine.php orm:ensure-production-settings

    I believe the author of Bisna intends to soon update library on Github. I don’t know if that has been done already? Also the article I wrote about “Using Custom Types” and “Using Custom Types with Bisna” doesn’t work with Doctrine 2.1 (because, I believe, of a bug in Doctrine 2.1).

    Comment by kkruecke — July 20, 2011 @ 6:10 pm | Reply

  3. If you having a very strange error saying:

    Warning: require(Bisna/Doctrine/Container.php): failed to open stream: No such file or directory in /…/…/library/Doctrine/Common/ClassLoader.php

    It looks like the file doesn’t exist while it does, but in my case the permissions of the Doctrine directory in library/Bisna/Doctrine were wrong. Changing this to 775 with chmod solved the problem.

    Cheers!

    Comment by Kees Schepers — October 21, 2011 @ 9:28 am | Reply

  4. i had been wrestling with an “Annotation Not Found” exception, and i didn’t know where exactly where to put that snippet of code.
    thanks a million!

    Comment by Jeremias — December 30, 2011 @ 7:26 am | Reply

    • Glad it helped you.

      Comment by kkruecke — December 30, 2011 @ 9:34 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Rubric. Clone this site at WordPress.com

Follow

Get every new post delivered to your Inbox.