PSR 2 compliance

This commit is contained in:
Simon Vieille 2021-03-17 15:57:20 +01:00
parent 4273607594
commit 7781298d3f
4 changed files with 19 additions and 17 deletions

View file

@ -6,10 +6,10 @@ use App\Controller\Admin\AdminController;
use App\Entity\Blog\Post as Entity; use App\Entity\Blog\Post as Entity;
use App\Factory\Blog\PostFactory as EntityFactory; use App\Factory\Blog\PostFactory as EntityFactory;
use App\Form\Blog\PostType as EntityType; use App\Form\Blog\PostType as EntityType;
use App\Form\FileUploadHandler;
use App\Manager\EntityManager; use App\Manager\EntityManager;
use App\Repository\Blog\PostRepositoryQuery; use App\Repository\Blog\PostRepositoryQuery;
use App\Repository\Blog\PostRepositoryQuery as RepositoryQuery; use App\Repository\Blog\PostRepositoryQuery as RepositoryQuery;
use App\Form\FileUploadHandler;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;

View file

@ -2,12 +2,12 @@
namespace App\EventSuscriber; namespace App\EventSuscriber;
use App\Event\EntityManager\EntityManagerEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use App\Entity\EntityInterface;
use App\Entity\Blog\Post; use App\Entity\Blog\Post;
use Symfony\Component\Filesystem\Filesystem; use App\Entity\EntityInterface;
use App\Event\EntityManager\EntityManagerEvent;
use App\Repository\Blog\PostRepositoryQuery; use App\Repository\Blog\PostRepositoryQuery;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
/** /**
@ -68,7 +68,8 @@ class BlogPostEventSubscriber implements EventSubscriberInterface
$post = $this->query->create() $post = $this->query->create()
->where('.image = :image') ->where('.image = :image')
->setParameter(':image', $image) ->setParameter(':image', $image)
->findOne(); ->findOne()
;
if (null === $post) { if (null === $post) {
$this->filesystem->remove($file->getRealPath()); $this->filesystem->remove($file->getRealPath());

View file

@ -18,7 +18,8 @@ class PostFactory
$entity $entity
->setAuthor($author) ->setAuthor($author)
->setStatus(0); ->setStatus(0)
;
return $entity; return $entity;
} }

View file

@ -2,22 +2,22 @@
namespace App\Form\Blog; namespace App\Form\Blog;
use App\Entity\Blog\Post;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use App\Entity\Blog\Category; use App\Entity\Blog\Category;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use App\Entity\Blog\Post;
use App\Entity\User;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Validator\Constraints\Date;
use App\Entity\User;
use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Date;
use Symfony\Component\Validator\Constraints\Image; use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\NotBlank;
class PostType extends AbstractType class PostType extends AbstractType
{ {