nette-2.1-dev Call to undefined method SystemContainer::createCache()

Notice: This thread is very old.

7 years ago

arron
Member | 464
+
0
-

Hi,
I recently updated from rev. 97a37f7be3af70f8693f0609c7be1505bd2cafe1 (from 8th March) to the most recent dev version (0f69335b64c69defcf558940d504d6e262ca49f7). Since this update I am having troubles with error in the subject when I am creating cache in presenter (or anywhere directly from container) via

$this->context->createCache();

I searched in generated source code of SystemContainer. Before update, there really were method createCache, now there is none. Now, there are two methods that creating cache (two, because I am declaring my own cache factory in factories section of config.neon which is inherited from nette.cache, I guess): createServiceCache($namespace = NULL) and createServiceNette__cache($namespace = NULL).

Is there any recent undocumented change of behaviour of this or it is simply a bug?

Thank you for help.

7 years ago

jiri.pudil
Member | 921
+
0
-

You might try bisecting Nette to find the commit that introduced this change.

7 years ago

arron
Member | 464
+
0
-

I finally found it. It is introduced by commit 973bd0d5b83a5e3aa0e7d25fc5486c4990fe77c7 from April but it looks like it is not merged into any stable release yet. Thats why it is undocumented. It looks like it introduces a new way how to create services directly from context:

//instead of
$this->context->createCache();
//it works
$this->context->createService('cache');

So not a bug, its a feature :-)