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

Commit

Permalink
Merge pull request #982 from webstacknl/develop
Browse files Browse the repository at this point in the history
Support PHP 8 and Symfony 6
  • Loading branch information
Seb33300 authored Mar 3, 2022
2 parents a9f18ef + a8b0fcb commit 7762593
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 342 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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.

Loading

0 comments on commit 7762593

Please sign in to comment.