fix form and take null cases into account

This commit is contained in:
Julie Lenaerts 2022-05-04 12:30:44 +02:00
parent 784a725ce3
commit 416a88b93d
3 changed files with 9 additions and 2 deletions

View File

@ -20,6 +20,7 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Form\Type\ChillCollectionType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\CommentType;
use Chill\MainBundle\Form\Type\PrivateCommentType;
use Chill\MainBundle\Form\Type\ScopePickerType;
use Chill\MainBundle\Form\Type\UserPickerType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;

View File

@ -81,10 +81,13 @@
{% endif %}
{%- if form.comment is defined -%}
{# TODO .. public and private #}
{{ form_row(form.comment) }}
{% endif %}
{%- if form.privateComment is defined -%}
{{ form_row(form.privateComment) }}
{% endif %}
{%- if form.attendee is defined -%}
{{ form_row(form.attendee) }}
{% endif %}

View File

@ -51,7 +51,10 @@ class PrivateCommentEmbeddable
public function merge(PrivateCommentEmbeddable $newComment): self
{
$mergedComments = $newComment->getComments() + $this->getComments();
$currentComments = null === $this->getComments() ? [] : $this->getComments();
$mergedComments = $newComment->getComments() + $currentComments;
$this->setComments($mergedComments);