Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1140327
add sulu 3.0 support
wachterjohannes Aug 22, 2025
4bc20b2
Remove unsupported php version from checks
mamazu Nov 11, 2025
87459cb
Removing deprecated stuff
mamazu Nov 11, 2025
d8c3c25
Fixing the tagged_iterator situation
mamazu Nov 11, 2025
32ff0e9
Stuff
mamazu Nov 12, 2025
72c5e54
More fixes
mamazu Nov 12, 2025
2b3384e
Merge remote-tracking branch 'upstream/2.5' into sulu3.0-compat
mamazu Nov 12, 2025
48de412
Removing unsupported routing config
mamazu Nov 12, 2025
a38bb59
Fixing locale issues
mamazu Nov 12, 2025
0ce8a32
Using the new content structur
mamazu Nov 12, 2025
4363d45
Stuff
mamazu Dec 6, 2025
d5a9ec5
Tagging the form loader and removing the routing bundle
mamazu Dec 7, 2025
6c77754
First semi working version
mamazu Dec 8, 2025
860188d
Fixing the frontend rendering
mamazu Dec 8, 2025
795189b
Fixing more stuff
mamazu Dec 8, 2025
d3c32cc
Fixing view data
mamazu Dec 8, 2025
c6a48fc
Moving the configs to php
mamazu Dec 10, 2025
aaac3d6
Fixing property loading
mamazu Dec 10, 2025
566c291
Fixing the service loading
mamazu Dec 10, 2025
d5ff08f
Fixing service stuff
mamazu Dec 10, 2025
93a393e
Fixing pipeline
mamazu Dec 10, 2025
18570b7
Fixing the missing parameters
mamazu Dec 10, 2025
bff4919
Using snapshot testing for the form metadata
mamazu Dec 10, 2025
8092e5a
Removing default helper config
mamazu Dec 10, 2025
fe5f745
Article Title provider
mamazu Dec 10, 2025
41de60b
Removing redundant kernel
mamazu Dec 10, 2025
46f0979
Fixing typo
mamazu Dec 10, 2025
e944ab1
Using the correct service id
mamazu Dec 10, 2025
6ec2126
Fixing services
mamazu Dec 10, 2025
99d79cf
Fixing type errors
mamazu Dec 11, 2025
a532df3
Fixing more tests
mamazu Dec 11, 2025
1463d40
Fixing types
mamazu Dec 11, 2025
72ff20f
Reverting AbstractType
mamazu Dec 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,6 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '7.2'
database: postgres
dependency-versions: 'lowest'
tools: 'composer:v2'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
DATABASE_URL: postgres://postgres:postgres@127.0.0.1/sulu_form_test?serverVersion=12.5
DATABASE_CHARSET: UTF8
DATABASE_COLLATE:

- php-version: '7.4'
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
DATABASE_URL: mysql://root:root@127.0.0.1/sulu_form_test?serverVersion=5.7
DATABASE_CHARSET: utf8mb4
DATABASE_COLLATE: utf8mb4_unicode_ci

- php-version: '8.0'
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
DATABASE_URL: mysql://root:root@127.0.0.1/sulu_form_test?serverVersion=5.7
DATABASE_CHARSET: utf8mb4
DATABASE_COLLATE: utf8mb4_unicode_ci

- php-version: '8.1'
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
DATABASE_URL: mysql://root:root@127.0.0.1/sulu_form_test?serverVersion=5.7
DATABASE_CHARSET: utf8mb4
DATABASE_COLLATE: utf8mb4_unicode_ci

- php-version: '8.2'
database: postgres
dependency-versions: 'highest'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
* with this source code in the file LICENSE.
*/

namespace Sulu\Bundle\FormBundle\Controller;
namespace Sulu\Bundle\FormBundle\Admin\Controller;

use Doctrine\ORM\EntityManager;
use FOS\RestBundle\Controller\ControllerTrait;
use FOS\RestBundle\Routing\ClassResourceInterface;
use FOS\RestBundle\View\ViewHandler;
use Sulu\Bundle\FormBundle\Admin\ListBuilder\DynamicListFactoryInterface;
use Sulu\Bundle\FormBundle\Entity\Dynamic;
use Sulu\Bundle\FormBundle\Entity\Form;
use Sulu\Bundle\FormBundle\ListBuilder\DynamicListFactory;
use Sulu\Bundle\FormBundle\Repository\DynamicRepository;
use Sulu\Bundle\FormBundle\Repository\FormRepository;
use Sulu\Bundle\MediaBundle\Media\Exception\MediaNotFoundException;
Expand All @@ -30,54 +29,17 @@
/**
* Controller to create dynamic form entries list.
*/
class DynamicController implements ClassResourceInterface
class DynamicController
{
use ControllerTrait;

/**
* @var DynamicRepository
*/
private $dynamicRepository;

/**
* @var DynamicListFactory
*/
private $dynamicListFactory;

/**
* @var MediaManagerInterface
*/
private $mediaManager;

/**
* @var EntityManager
*/
private $entityManager;

/**
* @var FormRepository
*/
private $formRepository;

/**
* @var ViewHandler
*/
private $viewHandler;

public function __construct(
DynamicRepository $dynamicRepository,
DynamicListFactory $dynamicListFactory,
MediaManagerInterface $mediaManager,
EntityManager $entityManager,
FormRepository $formRepository,
ViewHandler $viewHandler
private DynamicRepository $dynamicRepository,
private DynamicListFactoryInterface $dynamicListFactory,
private MediaManagerInterface $mediaManager,
private EntityManager $entityManager,
private ViewHandler $viewHandler
) {
$this->dynamicRepository = $dynamicRepository;
$this->dynamicListFactory = $dynamicListFactory;
$this->mediaManager = $mediaManager;
$this->entityManager = $entityManager;
$this->formRepository = $formRepository;
$this->viewHandler = $viewHandler;
}

/**
Expand All @@ -90,12 +52,10 @@ public function cgetAction(Request $request): Response
$page = (int) $request->query->getInt('page', 1);
$limit = (int) $request->query->getInt('limit');
$offset = (int) (($page - 1) * $limit);
/** @var string $view */
$view = $request->query->get('view', 'default');
/** @var string $sortOrder */
$sortOrder = $request->query->get('sortOrder', 'asc');
/** @var string $sortBy */
$sortBy = $request->query->get('sortBy', 'created');

$view = $request->query->getString('view', 'default');
$sortOrder = $request->query->getString('sortOrder', 'asc');
$sortBy = $request->query->getString('sortBy', 'created');

$entries = $this->dynamicRepository->findByFilters(
$filters,
Expand Down Expand Up @@ -131,7 +91,11 @@ public function cgetAction(Request $request): Response
public function deleteAction(Request $request, int $id): Response
{
$dynamic = $this->dynamicRepository->find($id);
if ($dynamic === null) {
return new Response('', Response::HTTP_NO_CONTENT);
}

/** @var array<array<int>> $attachments */
$attachments = \array_filter(\array_values($dynamic->getFieldsByType(Dynamic::TYPE_ATTACHMENT)));

foreach ($attachments as $mediaIds) {
Expand All @@ -149,7 +113,7 @@ public function deleteAction(Request $request, int $id): Response
$this->entityManager->remove($dynamic);
$this->entityManager->flush();

return new Response('', 204);
return new Response('', Response::HTTP_NO_CONTENT);
}

/**
Expand All @@ -171,17 +135,6 @@ protected function getFilters(Request $request): array
return \array_filter($filters);
}

protected function loadForm(Request $request): Form
{
$formId = (int) $request->get('form');

if (!$formId) {
throw new BadRequestHttpException('"form" is required parameter');
}

return $this->formRepository->loadById($formId);
}

public function getLocale(Request $request): string
{
return $request->query->get('locale', $request->getLocale());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
* with this source code in the file LICENSE.
*/

namespace Sulu\Bundle\FormBundle\Controller;
namespace Sulu\Bundle\FormBundle\Admin\Controller;

use FOS\RestBundle\Routing\ClassResourceInterface;
use FOS\RestBundle\View\ViewHandlerInterface;
use Sulu\Bundle\FormBundle\Admin\FormAdmin;
use Sulu\Bundle\FormBundle\Entity\Form;
Expand All @@ -21,58 +20,28 @@
use Sulu\Component\Rest\Exception\RestException;
use Sulu\Component\Rest\ListBuilder\AbstractListBuilder;
use Sulu\Component\Rest\ListBuilder\Doctrine\DoctrineListBuilderFactoryInterface;
use Sulu\Component\Rest\ListBuilder\ListRepresentation;
use Sulu\Component\Rest\ListBuilder\ListRestHelperInterface;
use Sulu\Component\Rest\ListBuilder\Metadata\FieldDescriptorFactoryInterface;
use Sulu\Component\Rest\ListBuilder\PaginatedRepresentation;
use Sulu\Component\Rest\RestHelperInterface;
use Sulu\Component\Security\SecuredControllerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

class FormController extends AbstractRestController implements ClassResourceInterface, SecuredControllerInterface
class FormController extends AbstractRestController implements SecuredControllerInterface
{
/**
* @var FormManager
*/
private $formManager;

/**
* @var RestHelperInterface
*/
private $restHelper;

/**
* @var DoctrineListBuilderFactoryInterface
*/
private $factory;

/**
* @var FieldDescriptorFactoryInterface
*/
private $fieldDescriptorFactory;

/**
* @var ListRestHelperInterface
*/
private $listRestHelper;

public function __construct(
ViewHandlerInterface $viewHandler,
TokenStorageInterface $tokenStorage,
FormManager $formManager,
RestHelperInterface $restHelper,
DoctrineListBuilderFactoryInterface $factory,
FieldDescriptorFactoryInterface $fieldDescriptorFactory,
ListRestHelperInterface $listRestHelper
private FormManager $formManager,
private RestHelperInterface $restHelper,
private DoctrineListBuilderFactoryInterface $factory,
private FieldDescriptorFactoryInterface $fieldDescriptorFactory,
private ListRestHelperInterface $listRestHelper
) {
parent::__construct($viewHandler, $tokenStorage);
$this->formManager = $formManager;
$this->restHelper = $restHelper;
$this->factory = $factory;
$this->fieldDescriptorFactory = $fieldDescriptorFactory;
$this->listRestHelper = $listRestHelper;
}

/**
Expand Down Expand Up @@ -102,7 +71,7 @@
$filters = $this->getFilters($request);

// flatted entities
if ('true' === $request->get('flat')) {
if ($request->query->getBoolean('flat')) {
// get model class
/** @var AbstractListBuilder $listBuilder */
$listBuilder = $this->factory->create($this->getModelClass());
Expand All @@ -110,7 +79,7 @@
// get fieldDescriptors
$fieldDescriptors = $this->fieldDescriptorFactory->getFieldDescriptors(Form::RESOURCE_KEY);

$this->restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);

Check failure on line 82 in Admin/Controller/FormController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Parameter #2 $fieldDescriptors of method Sulu\Component\Rest\RestHelperInterface::initializeListBuilder() expects array<Sulu\Component\Rest\ListBuilder\FieldDescriptorInterface>, array<Sulu\Component\Rest\ListBuilder\FieldDescriptorInterface>|null given.

$listBuilder->setParameter('locale', $locale);

Expand Down Expand Up @@ -142,13 +111,11 @@
}

// create list representation
$representation = new ListRepresentation(
$representation = new PaginatedRepresentation(
$list,
$this->getListName(),
$request->get('_route'),
$request->query->all(),
$page,
$limit,

Check failure on line 118 in Admin/Controller/FormController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Parameter #4 $limit of class Sulu\Component\Rest\ListBuilder\PaginatedRepresentation constructor expects int, int|null given.
$total
);

Expand All @@ -175,7 +142,7 @@
// create entity
$entity = $this->formManager->save($this->getData($request), $locale);

return $this->handleView($this->view($this->getApiEntity($entity, $locale), 201));

Check failure on line 145 in Admin/Controller/FormController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Parameter #1 $entity of method Sulu\Bundle\FormBundle\Admin\Controller\FormController::getApiEntity() expects Sulu\Bundle\FormBundle\Entity\Form, Sulu\Bundle\FormBundle\Entity\Form|null given.
}

public function postTriggerAction(Request $request, int $id): Response
Expand Down Expand Up @@ -232,7 +199,7 @@

public function getLocale(Request $request): string
{
return $request->get('locale', $request->getLocale());

Check failure on line 202 in Admin/Controller/FormController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Method Sulu\Bundle\FormBundle\Admin\Controller\FormController::getLocale() should return string but returns mixed.
}

/**
Expand Down Expand Up @@ -292,7 +259,7 @@
return 10;
}

return $filters['limit'];

Check failure on line 262 in Admin/Controller/FormController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Method Sulu\Bundle\FormBundle\Admin\Controller\FormController::getLimit() should return int but returns mixed.
}

/**
Expand All @@ -304,7 +271,7 @@
return 0;
}

return $filters['offset'];

Check failure on line 274 in Admin/Controller/FormController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Method Sulu\Bundle\FormBundle\Admin\Controller\FormController::getOffset() should return int but returns mixed.
}

/**
Expand All @@ -320,7 +287,7 @@
return 1;
}

return $filters['page'];

Check failure on line 290 in Admin/Controller/FormController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Method Sulu\Bundle\FormBundle\Admin\Controller\FormController::getPage() should return int but returns mixed.
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,37 @@
* with this source code in the file LICENSE.
*/

namespace Sulu\Bundle\FormBundle\Controller;
namespace Sulu\Bundle\FormBundle\Admin\Controller;

use FOS\RestBundle\Routing\ClassResourceInterface;
use FOS\RestBundle\View\ViewHandlerInterface;
use Sulu\Bundle\FormBundle\Provider\ListProviderRegistry;
use Sulu\Component\Rest\AbstractRestController;
use Sulu\Component\Rest\ListBuilder\Doctrine\DoctrineListBuilderFactoryInterface;
use Sulu\Component\Rest\ListBuilder\ListRepresentation;
use Sulu\Component\Rest\ListBuilder\PaginatedRepresentation;
use Sulu\Component\Rest\RestHelperInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

class ListController extends AbstractRestController implements ClassResourceInterface
class ListController extends AbstractRestController
{
/**
* @var RestHelperInterface
*/
private $restHelper;

/**
* @var DoctrineListBuilderFactoryInterface
*/
private $listBuilderFactory;

/**
* @var ListProviderRegistry
*/
private $providerRegistry;

public function __construct(
ViewHandlerInterface $viewHandler,
TokenStorageInterface $tokenStorage,
RestHelperInterface $restHelper,
DoctrineListBuilderFactoryInterface $listBuilderFactory,
ListProviderRegistry $providerRegistry
private RestHelperInterface $restHelper,
private DoctrineListBuilderFactoryInterface $listBuilderFactory,
private ListProviderRegistry $providerRegistry
) {
parent::__construct($viewHandler, $tokenStorage);
$this->restHelper = $restHelper;
$this->listBuilderFactory = $listBuilderFactory;
$this->providerRegistry = $providerRegistry;
}

public function cgetFieldsAction(Request $request): Response
{
$template = $request->get('template');
$locale = $request->get('locale');
$webspace = $request->get('webspace');
$uuid = $request->get('uuid');
$template = $request->query->getString('template');
$locale = $request->query->getString('locale');
$webspace = $request->query->getString('webspace');
$uuid = $request->query->getString('uuid');

if (!$template) {
throw new NotFoundHttpException('"template" is required parameter!');
Expand All @@ -71,10 +52,10 @@

public function cgetAction(Request $request): Response
{
$template = $request->get('template');
$webspace = $request->get('webspace');
$locale = $request->get('locale');
$uuid = $request->get('uuid');
$template = $request->query->getString('template');
$webspace = $request->query->getString('webspace');
$locale = $request->query->getString('locale');
$uuid = $request->query->getString('uuid');

if (!$template) {
throw new NotFoundHttpException('"template" is required parameter');
Expand All @@ -84,7 +65,7 @@
$entityName = $this->providerRegistry->getEntityName($template, $webspace, $locale, $uuid);

// get model class
$listBuilder = $this->listBuilderFactory->create($entityName);

Check failure on line 68 in Admin/Controller/ListController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Parameter #1 $entityName of method Sulu\Component\Rest\ListBuilder\Doctrine\DoctrineListBuilderFactoryInterface::create() expects class-string, string given.

// add filters
if (isset($fieldDescriptors['uuid'])) {
Expand All @@ -109,13 +90,11 @@
$limit = $listBuilder->getLimit();

// create list representation
$representation = new ListRepresentation(
$representation = new PaginatedRepresentation(
$list,
'entries',
$request->get('_route'),
$request->query->all(),
$page,
$limit,

Check failure on line 97 in Admin/Controller/ListController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Parameter #4 $limit of class Sulu\Component\Rest\ListBuilder\PaginatedRepresentation constructor expects int, int|null given.
$total
);

Expand Down
Loading
Loading