Closed Mohammadtrabelsi closed 4 years ago
Your admin bundle package is outdated, please upgrade
After upgrading the error still exists.
You can include a long stack trace using the <details>
html5 tag
This is the full stack trace :+1:
Did you update your SonataTranslations? This was fixed in 2.3 and you are using 2.2
Yes, I tried your solution updating SonataTranslations to 2.3 but the error still exists.
Do you use request
anywhere in your Admin classes? this workaround could fix your problem
Thanks a lot ,and the solution is to override the get request function because she throws an exception:
public function getRequest()
{
if (!$this->request) {
throw new \RuntimeException('The Request object has not been set');
}
return $this->request;
}
so I create a class that extends the abstract admin and make every class in my admin folder extends from it:
class MYAdmin extends AbstractAdmin
{
/**
* {@inheritdoc}
*/
public function getRequest()
{
if (!$this->request) {
return $this->request = $this->getConfigurationPool()->getContainer()->get('request_stack')->getCurrentRequest();
}
return $this->request;
}
}
Did you use that getRequest()
anywhere in your admin classes? I would like to try and reproduce the issue so I can fix it, this is just a workaround.
22 days and the user didn't answer. The issue is solved with a workaround.
Closing for now, if he answers back and gives more info to fix the issue, we can reopen. Otherwise we don't have enough here to fix anything.
@jordisala1991 what if we would add that workaround to the AbstractAdmin?
Currently, we throw an exception if there is no request and we can maybe get it from the container?
I dont understand why the request is not there in the first place.
Because you are doing a search and you are not entering any admin, so there is no request object in admin and maybe there is some function that works with the request and it is triggered?
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I have this issue. When I try to make a quick search I always get "The Request object has not been set" exception.
I have encountered the same issue. I have a getRequest
call in an override of \Sonata\AdminBundle\Admin\AbstractAdmin::createQuery()
.
I'll be using a workaround, but here is a stack trace to hopefully help fix this in the future:
Environment Debian 8
Sonata packages
Symfony packages
PHP version
Subject
I want to activate the sonata admin search feature after the migration to of symfony to version 3.4.2. I found a problem in sonata block service:
An exception has been thrown during the rendering of a template ("The Request object has not been set").
Steps to reproduce
Type any word in sonata search input and press search
Expected results
Give the search result.
Actual results
Show an exception
An exception has been thrown during the rendering of a template ("The Request object has not been set").
sorry the full stack trace is too long:
This is sonata block configuration :
sonata_block.yml