Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sulu/sulu-workshop
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4a3b90ca69d9339d16c3e2656f76ea40bfb067f4
Choose a base ref
..
head repository: sulu/sulu-workshop
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f0109931f37232e2e5c6c8b025e8c8c978e9c106
Choose a head ref
61 changes: 0 additions & 61 deletions .gitlab-ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@
"@phpunit"
],
"security-check": "bin/websiteconsole security:check",
"phpunit": "SYMFONY_PHPUNIT_VERSION=8.3 vendor/bin/simple-phpunit",
"phpunit": "bin/phpunit",
"phpstan": [
"bin/websiteconsole cache:warmup --env=dev",
"@test install",
16 changes: 14 additions & 2 deletions config/forms/event_details.xml
Original file line number Diff line number Diff line change
@@ -6,13 +6,25 @@
<key>event_details</key>

<properties>
<property name="title" type="text_line" mandatory="true" colspan="9">
<property name="title" type="text_line" mandatory="true">
<meta>
<title>sulu_admin.title</title>
</meta>
<params>
<param name="headline" value="true"/>
</params>
</property>

<property name="location" type="text_line" colspan="3">
<property name="image" type="single_media_selection" colspan="6">
<meta>
<title>app.image</title>
</meta>
<params>
<param name="types" value="image"/>
</params>
</property>

<property name="location" type="text_line" colspan="6">
<meta>
<title>app.location</title>
</meta>
9 changes: 9 additions & 0 deletions config/image-formats.xml
Original file line number Diff line number Diff line change
@@ -14,6 +14,15 @@
<scale y="400"/>
</format>

<format key="1920x">
<meta>
<title lang="en">Event image</title>
<title lang="de">Event Bild</title>
</meta>

<scale x="1920"/>
</format>

<format key="200x">
<meta>
<title lang="en">Block Image</title>
File renamed without changes.
2 changes: 2 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ services:
$listBuilderFactory: '@sulu_core.doctrine_list_builder_factory'
$pathCleanup: '@sulu.content.path_cleaner'
$entityManager: '@doctrine.orm.entity_manager'
$storage: '@sulu_media.storage'
$mediaRepository: '@sulu.repository.media'

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ parameters:
- config
inferPrivatePropertyTypeFromConstructor: true
bootstrapFiles:
- vendor/bin/.phpunit/phpunit-8.3-0/vendor/autoload.php
- bin/.phpunit/phpunit-8.5-0/vendor/autoload.php
symfony:
container_xml_path: %rootDir%/../../../var/cache/website/dev/App_KernelDevDebugContainer.xml
console_application_loader: tests/phpstan/console-application.php
4 changes: 3 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
@@ -11,6 +11,8 @@
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<!-- Set the phpunit version: https://symfony.com/doc/current/components/phpunit_bridge.html#modified-phpunit-script -->
<server name="SYMFONY_PHPUNIT_VERSION" value="8.5" />
<!-- See: https://symfony.com/doc/current/components/phpunit_bridge.html#modified-phpunit-script -->
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
<!-- Set "SYMFONY_PHPUNIT_REMOVE" to "symfony/yaml" will install also "prophecy" see phpunit bridge docs for more information. -->
16 changes: 15 additions & 1 deletion src/Controller/Admin/EventController.php
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Routing\ClassResourceInterface;
use FOS\RestBundle\View\ViewHandlerInterface;
use Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface;
use Sulu\Component\Rest\AbstractRestController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -23,18 +24,25 @@ class EventController extends AbstractRestController implements ClassResourceInt
*/
private $repository;

/**
* @var MediaRepositoryInterface
*/
private $mediaRepository;

/**
* @var DoctrineListRepresentationFactory
*/
private $doctrineListRepresentationFactory;

public function __construct(
EventRepository $repository,
MediaRepositoryInterface $mediaRepository,
DoctrineListRepresentationFactory $doctrineListRepresentationFactory,
ViewHandlerInterface $viewHandler,
?TokenStorageInterface $tokenStorage = null
) {
$this->repository = $repository;
$this->mediaRepository = $mediaRepository;
$this->doctrineListRepresentationFactory = $doctrineListRepresentationFactory;

parent::__construct($viewHandler, $tokenStorage);
@@ -119,12 +127,18 @@ public function deleteAction(int $id): Response
}

/**
* @param string[] $data
* @param array<string, mixed> $data
*/
protected function mapDataToEntity(array $data, Event $entity): void
{
$entity->setTitle($data['title']);

$image = null;
if ($imageId = ($data['image']['id'] ?? null)) {
$image = $this->mediaRepository->findMediaById($imageId);
}
$entity->setImage($image);

if ($teaser = $data['teaser'] ?? null) {
$entity->setTeaser($teaser);
}
Loading