php csfixes

This commit is contained in:
2022-05-04 13:00:46 +02:00
parent 416a88b93d
commit e19cac168b
12 changed files with 136 additions and 138 deletions

View File

@@ -19,7 +19,6 @@ use Symfony\Component\Security\Core\Security;
final class PrivateCommentDataMapper extends AbstractType implements DataMapperInterface
{
private Security $security;
public function __construct(Security $security)
@@ -40,8 +39,6 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI
$forms = iterator_to_array($forms);
$forms['comments']->setData($viewData->getCommentForUser($this->security->getUser()));
}
public function mapFormsToData($forms, &$viewData)
@@ -50,5 +47,4 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI
$viewData->setCommentForUser($this->security->getUser(), $forms['comments']->getData());
}
}
}

View File

@@ -11,17 +11,11 @@ declare(strict_types=1);
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Chill\MainBundle\Form\DataMapper\PrivateCommentDataMapper;
use DateTime;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -30,10 +24,10 @@ use Symfony\Component\Security\Core\User\UserInterface;
class PrivateCommentType extends AbstractType
{
protected UserInterface $user;
protected PrivateCommentDataMapper $dataMapper;
protected UserInterface $user;
public function __construct(TokenStorageInterface $tokenStorage, PrivateCommentDataMapper $dataMapper)
{
$this->user = $tokenStorage->getToken()->getUser();
@@ -44,7 +38,7 @@ class PrivateCommentType extends AbstractType
{
$builder
->add('comments', ChillTextareaType::class, [
'label' => 'private comment'
'label' => 'private comment',
])
->setDataMapper($this->dataMapper);
}