Nette\DI\ServiceCreationException Service ‘cache.storage’ not found in definitions. (used in Nette\Bridges\Ca

mcmatak
Member | 504
+
0
-

what could be the problem?

firstly why it needs to configure default cache.storage

and why it is not found if the definition is specified?

services.neon


services:
	cache.storage: Nette\Caching\Storages\FileStorage("%tempDir%/cache")

composer info


nette/application                  v3.2.3             🏆 Nette Application: a full-stack component-based MVC kernel for PHP that helps you write powerful and modern web applications. Write les...
nette/bootstrap                    v3.2.3             🅱  Nette Bootstrap: the simple way to configure and bootstrap your Nette application.
nette/caching                      v3.3.0             ⏱ Nette Caching: library with easy-to-use API and many cache backends.
nette/component-model              v3.1.0             ⚛ Nette Component Model
nette/database                     v3.2.0             💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, Postgre...
nette/di                           v3.2.1             💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new...
nette/finder                       v3.0.0             🔍 Nette Finder: find files and directories with an intuitive API.
nette/forms                        v3.2.2             📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server & client side validation ...
nette/http                         v3.3.0             🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and utility for URL and cookies mani...
nette/mail                         v4.0.2             📧 Nette Mail: handy email creation and transfer library for PHP with both text and MIME-compliant support.
nette/neon                         v3.4.1             🍸 Nette NEON: encodes and decodes NEON file format.
nette/nette                        v3.2.2             👪 Nette Framework - innovative framework for fast and easy development of secured web applications in PHP (metapackage)
nette/php-generator                v4.1.4             🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.3 features.
nette/robot-loader                 v4.0.1             🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.
nette/routing                      v3.1.0             Nette Routing: two-ways URL conversion
nette/safe-stream                  v3.0.1             Nette SafeStream: provides isolation for thread safe manipulation with files via native PHP functions.
nette/schema                       v1.3.0             📐 Nette Schema: validating data structures against a given Schema.
nette/security                     v3.2.0             🔑 Nette Security: provides authentication, authorization and a role-based access control management via ACL (Access Control List)
nette/tokenizer                    v3.1.1             Nette Tokenizer
nette/utils                        v4.0.4             🛠  Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or s...

mcmatak
Member | 504
+
0
-

the problem is, that

kdyby/redis creates definition cache.storage as RedisStorage

definition

but latte search for FileStorage

https://pasteboard.co/…0nsa4c5b.png

how to solve this?

where is the problem?

David Grudl
Nette Core | 8218
+
+1
-

Latte is definitely not looking for cache storage.

mcmatak
Member | 504
+
0
-

https://github.com/…xtension.php#L28

the colission is here, it is looking for Nette\Caching\Storage

but RedisStorage

implements

https://github.com/…xtension.php#L28

class RedisStorage implements \Kdyby\Redis\IMultiReadStorage

and the IMultiReadStorage extends what cachelatte looking for

interface IMultiReadStorage extends \Nette\Caching\Storage

https://github.com/…dStorage.php#…

Marek Bartoš
Nette Blogger | 1261
+
0
-

nette/caching has nothing to do with Latte.
RedisStorage implements \Nette\Caching\Storage, just not directly.
Why do you set your own cache storage and also enable storage in redis extension? This is where it collides.

mcmatak
Member | 504
+
0
-

sorry for missinterpretation, i dont define cache.storage, that was only try how to solve it

RedisStorage is defined here

https://github.com/…xtension.php#L148

mcmatak
Member | 504
+
0
-

what i dont understand is why at this position

https://github.com/…Resolver.php#L359

the RedisStorage is not found?

mcmatak
Member | 504
+
0
-

tracy

does it help to understand?

mcmatak
Member | 504
+
0
-

problem start with nette/di 3.2.0, on 3.1.10 there is no problem

H0w4rd
Member | 96
+
0
-

We are facing the same problem. Unfortunatelly I cannot downgrade nette/di because

 - nette/di[v3.1.0, ..., v3.1.2] require php >=7.2 <8.3 -> your php version (8.3.6) does not satisfy that requirement.

It is happening in a branch with a new upcoming version running on PHP 8.3.

Is there any solution for this please?

David Grudl
Nette Core | 8218
+
0
-

Can you create a minimal sample demonstrating the problem based on webproject?

kropacekt
Member | 2
+
0
-

Repo with the minimal sample is available here: https://github.com/…ette32-php83

David Grudl
Nette Core | 8218
+
0
-

@kropacekt I've run it and it wants to connect to Redis, I haven't encountered any problem building the DI container.

mcmatak
Member | 504
+
0
-

Is it possible that the RedisClient is created in constructor of service, and tried to connect to redis, so the problem we are talking raise later?

It means, can you try to run your local redis database instance and you will see the problem after you connect to redis?

Marek Bartoš
Nette Blogger | 1261
+
0
-

@mcmatak Likely not, it is a DIC compilation error.

@kropacekt Try to test it with xdebug disabled. It caused some weird errors in last few versions with PHP 8.3

Last edited by Marek Bartoš (2024-05-07 12:55)

kropacekt
Member | 2
+
+1
-

@MarekBartoš Xdebug is not installed in the sample repo.

Last edited by kropacekt (2024-05-07 13:14)

David Grudl
Nette Core | 8218
+
+3
-

It was really making a connection with Redis when it was compiled.

Anyway, I found the bug and it is fixed in nette/application v3.2.x-dev

mcmatak
Member | 504
+
0
-

still not solved

mcmatak
Member | 504
+
0
-

is it possible to explain me why you think that this could be equal?

Screenshot1
Screenshot2

David Grudl
Nette Core | 8218
+
+1
-

@mcmatak update nette/application

mcmatak
Member | 504
+
0
-

seems to be ok

mcmatak
Member | 504
+
0
-

thanks a lot, it works for now :) can it go to new tag? not dev?