Disable extbase reflection cache during development (TYPO3 4.6+)

Hey folks,
remember the annotations in extbase and their functions? Sure, you do. And I bet you have had this error when changing an annotation, for example the validation of a field, when you reload the page or submit some data and nothing happens. Instead some strange message occurs. Something like “child object type could not be determined” or some other crazy stuff. Most probably you encountered a very common error during development, not caused by your own fault, but by the caching machanism of extbase.

It’s very easy. Extbase uses a nice feature, called reflection, you can read PHP comments (PHP docs) with. Exactly, these annotation you make in your source code. And for sure this process takes quite a lot of cpu power, so the developers of extbase implemented a cache for all these annotations for not doing the reflection every time. And it’s great in production environments, but if you are developing your domain models it’s just annoying because you have to delete the cache every time.

So here’s how you can disable the caching for extbase.

$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_reflection']['backend'] = 't3lib_cache_backend_NullBackend';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_object']['backend'] = 't3lib_cache_backend_NullBackend';

Just place these lines in your localconf.php.

But be sure you are using TYPO3 4.6, means using the caching framework with the extbase caching tables as follows:
cf_extbase_object
cf_extbase_object_tags
cf_extbase_reflection
cf_extbase_reflection_tags

Alright.
Hope that helps you saving time and pain during your coding fun.

And as always, leave a reply if you want.

2 Responses to Disable extbase reflection cache during development (TYPO3 4.6+)

  1. This is also possible in versions <= 4.5:
    Just put the configuration into ext_localconf.php of an extension. The extensions needs to be loaded after extbase.

    Disabling reflection cache is also very handy when you use extension_builder for development.

  2. foertel says:

    never really had to disable that … just think first, then code. ;-) you shouldn’t have to change your annotations too much …

    regards, foertel

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>