Skip to content

Commit

Permalink
Merge pull request #35 from swagindustries/feature/refactor-structure
Browse files Browse the repository at this point in the history
Melodiia is a Symfony bundle
  • Loading branch information
Nek- authored Aug 19, 2020
2 parents 9cb4995 + ab587ca commit dec0860
Show file tree
Hide file tree
Showing 55 changed files with 67 additions and 88 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
to follow HTTP verbs.
- Removal of the dependency to zend json (thanks to php 7.3 upgrade)
- BC Break: the ApiResponse now contains also headers. If you do not extends another response you will need to add the missing method
- BC Break: many many many changes of namespaces because the Bridge do not exists anymore.

## Removed
- BC break: the documentation is no more automatically generated. This removes a lot of configuration for Melodiia.
Expand Down
11 changes: 0 additions & 11 deletions src/Bridge/Symfony/Exception/ConfigException.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Crud/Controller/BaseCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace SwagIndustries\Melodiia\Crud\Controller;

use SwagIndustries\Melodiia\Bridge\Symfony\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Crud\CrudControllerInterface;
use SwagIndustries\Melodiia\Response\ApiResponse;
use SwagIndustries\Melodiia\Response\FormErrorResponse;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Crud/Controller/GetAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace SwagIndustries\Melodiia\Crud\Controller;

use SwagIndustries\Melodiia\Bridge\Symfony\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Crud\CrudControllerInterface;
use SwagIndustries\Melodiia\Crud\FilterCollectionFactoryInterface;
use SwagIndustries\Melodiia\Crud\Pagination\PaginationRequestFactoryInterface;
use SwagIndustries\Melodiia\Crud\Persistence\DataStoreInterface;
use SwagIndustries\Melodiia\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Response\OkContent;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Crud/FilterCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace SwagIndustries\Melodiia\Crud;

use SwagIndustries\Melodiia\Bridge\Symfony\Form\Type\ApiType;
use SwagIndustries\Melodiia\Exception\NoFormFilterCreatedException;
use SwagIndustries\Melodiia\Form\Type\ApiType;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\DependencyInjection;
namespace SwagIndustries\Melodiia\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\DependencyInjection;
namespace SwagIndustries\Melodiia\DependencyInjection;

use SwagIndustries\Melodiia\Crud\FilterInterface;
use SwagIndustries\Melodiia\Serialization\Context\ContextBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Doctrine;
namespace SwagIndustries\Melodiia\Doctrine;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\EventListener;
namespace SwagIndustries\Melodiia\EventListener;

use Nekland\Tools\StringTools;
use Psr\Log\LoggerInterface;
Expand Down
9 changes: 9 additions & 0 deletions src/Exception/ConfigException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Exception;

class ConfigException extends MelodiiaLogicException
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form;
namespace SwagIndustries\Melodiia\Form;

use SwagIndustries\Melodiia\Bridge\Symfony\Form\Type\ApiType;
use SwagIndustries\Melodiia\Form\Type\ApiType;
use Symfony\Component\Form\AbstractType as BaseType;

abstract class AbstractType extends BaseType
Expand Down
2 changes: 1 addition & 1 deletion src/Form/ApiRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SwagIndustries\Melodiia\Form;

use SwagIndustries\Melodiia\Bridge\Symfony\Form\Type\ApiType;
use SwagIndustries\Melodiia\Form\Type\ApiType;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form;
namespace SwagIndustries\Melodiia\Form;

use Symfony\Component\Form\DataMapperInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form;
namespace SwagIndustries\Melodiia\Form;

use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\FormInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form\Extension;
namespace SwagIndustries\Melodiia\Form\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form\Listener;
namespace SwagIndustries\Melodiia\Form\Listener;

use SwagIndustries\Melodiia\Crud\MelodiiaModel;
use SwagIndustries\Melodiia\Exception\MelodiiaLogicException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form\Type;
namespace SwagIndustries\Melodiia\Form\Type;

use SwagIndustries\Melodiia\Bridge\Symfony\Form\DomainObjectDataMapperInterface;
use SwagIndustries\Melodiia\Bridge\Symfony\Form\DomainObjectsDataMapper;
use SwagIndustries\Melodiia\Form\ApiRequestHandler;
use SwagIndustries\Melodiia\Form\DomainObjectDataMapperInterface;
use SwagIndustries\Melodiia\Form\DomainObjectsDataMapper;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\FormBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form\Type;
namespace SwagIndustries\Melodiia\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form\Type;
namespace SwagIndustries\Melodiia\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType as OriginalDateTimeType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Form\Type;
namespace SwagIndustries\Melodiia\Form\Type;

use SwagIndustries\Melodiia\Bridge\Symfony\Form\Listener\ReorderDataToMatchCollectionListener;
use SwagIndustries\Melodiia\Form\Listener\ReorderDataToMatchCollectionListener;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
use Symfony\Component\Form\Extension\Core\Type\TextType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony;
namespace SwagIndustries\Melodiia;

use SwagIndustries\Melodiia\Bridge\Symfony\DependencyInjection\MelodiiaExtension;
use SwagIndustries\Melodiia\DependencyInjection\MelodiiaExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class MelodiiaBundle extends Bundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony;
namespace SwagIndustries\Melodiia;

use SwagIndustries\Melodiia\MelodiiaConfigurationInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouterInterface;

final class MelodiiaConfiguration implements MelodiiaConfigurationInterface
{
Expand All @@ -18,15 +15,9 @@ final class MelodiiaConfiguration implements MelodiiaConfigurationInterface
*/
private $config;

/**
* @var RouterInterface
*/
private $router;

public function __construct(array $config, RouterInterface $router)
public function __construct(array $config)
{
$this->config = $config;
$this->router = $router;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
melodiia.doctrine.data_provider:
class: SwagIndustries\Melodiia\Bridge\Doctrine\DoctrineDataStore
class: SwagIndustries\Melodiia\Doctrine\DoctrineDataStore
arguments:
$registry: '@doctrine'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<argument type="service" key="$serializer" id="serializer" />
</service>

<service id="melodiia.exception.listener" class="SwagIndustries\Melodiia\Bridge\Symfony\EventListener\ExceptionListener">
<service id="melodiia.exception.listener" class="SwagIndustries\Melodiia\EventListener\ExceptionListener">
<argument type="service" key="$config" id="melodiia.configuration" />
<argument type="service" key="$controller" id="melodiia.configuration" />
<argument key="$debug">false</argument>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
melodiia.form.extension.datetime:
class: SwagIndustries\Melodiia\Bridge\Symfony\Form\Extension\DateTimeExtension
class: SwagIndustries\Melodiia\Form\Extension\DateTimeExtension
tags:
- { name: form.type_extension }

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ services:
$templating: '@twig'

melodiia.configuration:
class: SwagIndustries\Melodiia\Bridge\Symfony\MelodiiaConfiguration
class: SwagIndustries\Melodiia\MelodiiaConfiguration
arguments:
$config: '%melodiia.config%'
$router: '@router.default'


# Priority -1 is DX. It allow the user to implement its own normalizers
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Bridge\Symfony\Response;
namespace SwagIndustries\Melodiia\Response;

use Nekland\Tools\StringTools;
use SwagIndustries\Melodiia\Exception\InvalidResponseException;
use SwagIndustries\Melodiia\Response\AbstractUserDataErrorResponse;
use SwagIndustries\Melodiia\Response\Model\UserDataError;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormInterface;
Expand Down
2 changes: 1 addition & 1 deletion tests/Melodiia/Crud/Controller/CreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
use SwagIndustries\Melodiia\Bridge\Symfony\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Crud\Controller\Create;
use SwagIndustries\Melodiia\Crud\CrudControllerInterface;
use SwagIndustries\Melodiia\Crud\Event\CrudEvent;
use SwagIndustries\Melodiia\Crud\Event\CustomResponseEvent;
use SwagIndustries\Melodiia\Crud\Persistence\DataStoreInterface;
use SwagIndustries\Melodiia\Response\ApiResponse;
use SwagIndustries\Melodiia\Response\Created;
use SwagIndustries\Melodiia\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Test\MockDispatcherTrait;
use SwagIndustries\Melodiia\Test\TestFixtures\FakeMelodiiaFormType;
use SwagIndustries\Melodiia\Test\TestFixtures\FakeMelodiiaModel;
Expand Down
2 changes: 1 addition & 1 deletion tests/Melodiia/Crud/Controller/GetAllTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
use SwagIndustries\Melodiia\Bridge\Symfony\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Crud\Controller\GetAll;
use SwagIndustries\Melodiia\Crud\CrudControllerInterface;
use SwagIndustries\Melodiia\Crud\FilterCollection;
use SwagIndustries\Melodiia\Crud\FilterCollectionFactoryInterface;
use SwagIndustries\Melodiia\Crud\Pagination\PaginationRequest;
use SwagIndustries\Melodiia\Crud\Pagination\PaginationRequestFactoryInterface;
use SwagIndustries\Melodiia\Crud\Persistence\DataStoreInterface;
use SwagIndustries\Melodiia\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Response\OkContent;
use SwagIndustries\Melodiia\Test\TestFixtures\FakeMelodiiaModel;
use Symfony\Component\Form\FormInterface;
Expand Down
2 changes: 1 addition & 1 deletion tests/Melodiia/Crud/Controller/UpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
use SwagIndustries\Melodiia\Bridge\Symfony\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Crud\Controller\Update;
use SwagIndustries\Melodiia\Crud\CrudControllerInterface;
use SwagIndustries\Melodiia\Crud\Event\CrudEvent;
use SwagIndustries\Melodiia\Crud\Event\CustomResponseEvent;
use SwagIndustries\Melodiia\Crud\Persistence\DataStoreInterface;
use SwagIndustries\Melodiia\Crud\Tools\IdResolverInterface;
use SwagIndustries\Melodiia\Response\ApiResponse;
use SwagIndustries\Melodiia\Response\FormErrorResponse;
use SwagIndustries\Melodiia\Response\OkContent;
use SwagIndustries\Melodiia\Test\MockDispatcherTrait;
use SwagIndustries\Melodiia\Test\TestFixtures\FakeMelodiiaFormType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Test\Bridge\Symfony\DependencyInjection;
namespace SwagIndustries\Melodiia\Test\DependencyInjection;

use PHPUnit\Framework\TestCase;
use SwagIndustries\Melodiia\Bridge\Symfony\DependencyInjection\MelodiiaExtension;
use SwagIndustries\Melodiia\DependencyInjection\MelodiiaExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class MelodiiaExtensionTest extends TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Test\Bridge\Doctrine;
namespace SwagIndustries\Melodiia\Test\Doctrine;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
Expand All @@ -11,9 +11,9 @@
use Pagerfanta\Pagerfanta;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use SwagIndustries\Melodiia\Bridge\Doctrine\DoctrineDataStore;
use SwagIndustries\Melodiia\Crud\FilterCollection;
use SwagIndustries\Melodiia\Crud\Persistence\DataStoreInterface;
use SwagIndustries\Melodiia\Doctrine\DoctrineDataStore;

class DoctrineDataStoreTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace SwagIndustries\Melodiia\Test\Bridge\Symfony\EventListener;
namespace SwagIndustries\Melodiia\Test\EventListener;

use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
use SwagIndustries\Melodiia\Bridge\Symfony\EventListener\ExceptionListener;
use SwagIndustries\Melodiia\EventListener\ExceptionListener;
use SwagIndustries\Melodiia\MelodiiaConfigurationInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
Expand Down
2 changes: 1 addition & 1 deletion tests/Melodiia/Form/ApiRequestHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use SwagIndustries\Melodiia\Bridge\Symfony\Form\Type\ApiType;
use SwagIndustries\Melodiia\Form\ApiRequestHandler;
use SwagIndustries\Melodiia\Form\Type\ApiType;
use Symfony\Component\Form\FormConfigInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormInterface;
Expand Down
Loading

0 comments on commit dec0860

Please sign in to comment.