Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Support PHP 8 and Symfony 6 #982

Merged
merged 1 commit into from Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,10 @@
# Version 1.3

* Dropped support for PHP 7.1
* Dropped support for Symfony 3.4 and <=4.3
* Support for PHP 8
* Support for Symfony 6

# Version 1.1.1

* Bugfix: DateRangeFilter overwrites other filter (#803)
Expand Down
213 changes: 0 additions & 213 deletions Command/CreateDatatableCommand.php

This file was deleted.

16 changes: 7 additions & 9 deletions Controller/DatatableController.php
Expand Up @@ -13,6 +13,7 @@

use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
use Exception;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -37,7 +38,7 @@ class DatatableController extends AbstractController
*
* @return Response
*/
public function editAction(Request $request)
public function editAction(Request $request, EntityManagerInterface $entityManager): Response
{
if ($request->isXmlHttpRequest()) {
// x-editable sends some default parameters
Expand All @@ -57,7 +58,7 @@ public function editAction(Request $request)
}

// get an object by its primary key
$entity = $this->getEntityByPk($entityClassName, $pk);
$entity = $this->getEntityByPk($entityClassName, $pk, $entityManager);

/** @var PropertyAccessor $accessor */
/** @noinspection PhpUndefinedMethodInspection */
Expand All @@ -73,9 +74,8 @@ public function editAction(Request $request)
null !== $path ? $accessor->setValue($entity, $path, $value) : $accessor->setValue($entity, $field, $value);

// save all
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$entityManager->persist($entity);
$entityManager->flush();

return new Response('Success', 200);
}
Expand All @@ -92,11 +92,9 @@ public function editAction(Request $request)
*
* @param string $entityClassName
*/
private function getEntityByPk($entityClassName, $pk): object
private function getEntityByPk($entityClassName, $pk, EntityManagerInterface $entityManager): object
{
$em = $this->getDoctrine()->getManager();

$entity = $em->getRepository($entityClassName)->find($pk);
$entity = $entityManager->getRepository($entityClassName)->find($pk);
if (! $entity) {
throw $this->createNotFoundException('DatatableController::getEntityByPk(): The entity does not exist.');
}
Expand Down
106 changes: 0 additions & 106 deletions Generator/DatatableGenerator.php

This file was deleted.