-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Symfony version(s) affected
6.2.0
Description
I'm trying to switch from the SensioFrameworkExtraBundle to the new built-in cache attributes from Symfony 6.2, but I'm getting an error.
- #[\Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache(maxage: 120, lastModified: 'entity.getUpdatedAt()', etag: 'entity.getETag()')]
+ #[\Symfony\Component\HttpKernel\Attribute\Cache(maxage: 120, lastModified: 'entity.getUpdatedAt()', etag: 'entity.getETag()')]
public function someAction(Entity $entity) : Response
{
}
This used to work, but now it gives an error:
Variable "entity" is not valid around position 1 for expression
entity.getUpdatedAt()
.
Any idea why this doesn't work? I can dive into it, but maybe someone has already found out why this doesn't work.
How to reproduce
final class Controller extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{
#[\Symfony\Component\HttpKernel\Attribute\Cache(maxage: 120, lastModified: 'entity.getUpdatedAt()', etag: 'entity.getETag()')]
public function someAction(Entity $entity) : Response
{
}
}
Possible Solution
No response
Additional Context
No response
JohJohan