Open ProfM2 opened 5 years ago
Hi ! I know someone else tell that but I can't find response. I'm on Symfony 4.1 and I can't use Datatable bundle
There are no commands defined in the "sg:datatable" namespace. Did you mean this? doctrine:database
Thank's by advance
Hi ! I know someone else tell that but I can't find response. I'm on Symfony 4.1 and I can't use Datatable bundle
> php bin/console sg:datatable:generate AppBundle:Post
There are no commands defined in the "sg:datatable" namespace. Did you mean this? doctrine:database
Thank's by advance
I believe this is for a different question. The above is for Symfony 4.2 that deprecated Controller for AbstractController and the modifications necessary to allow proper dependency injection.
In addition the route annotations
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
got superseded by a single
use Symfony\Component\Routing\Annotation\Route;
@Seb33300 @stwe guys plz check and merge Symfony 4(actual for Symfony 5) issues. Have to use forks =(
If you are encountering issue, feel free to submit a pull request.
@Seb33300 #762 #833 #922 I haven't access for submit pull requests. plz check this PRs and merge
Starting with Symfony 4.2, Controller is deprecated, recommending AbstractController to be used. However, by using AbstractController the 'old' way of getting the factory service no longer works.
Old:
$datatable = $this->get('sg_datatables.factory')->create(EntityDatatable::class);
The new way to use the datatables factory is to use dependency injection in the constructor of the controller.
This allows to access the factory:
$datatable = $this->dtFactory->create(EntityDatatable::class);
And the response:$responseService = $this->dtResponse;
in the Ajax response portion of the function.However, now, Symfony complains:
The fix for this is in the
services.yaml
to add the following:At this point, everything should be working properly.