Skip to content

Commit

Permalink
Merge pull request #14 from irontec/namespace-enhancement
Browse files Browse the repository at this point in the history
Move application services to domain
  • Loading branch information
mmadariaga authored Feb 8, 2023
2 parents b46c2cb + 0b0b7a1 commit 6ae4652
Show file tree
Hide file tree
Showing 53 changed files with 116 additions and 296 deletions.
12 changes: 5 additions & 7 deletions Application/Service/DataGateway.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Ivoz\Core\Application\Service;

use Doctrine\ORM\EntityManagerInterface;
use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\Event\CommandWasExecuted;
use Ivoz\Core\Application\RequestId;
use Ivoz\Core\Application\Service\Assembler\DtoAssembler;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Event\CommandWasExecuted;
use Ivoz\Core\Domain\RequestId;
use Ivoz\Core\Domain\Service\Assembler\DtoAssembler;
use Ivoz\Core\Domain\Service\DomainEventPublisher;
use Ivoz\Core\Domain\Service\QueryBuilderFactory;
use Ivoz\Core\Infrastructure\Domain\Service\DoctrineEntityPersister;

/**
Expand Down Expand Up @@ -52,9 +53,6 @@ class DataGateway
*/
public static $user = '';

/**
* DataGateway constructor.
*/
public function __construct(
EntityManagerInterface $entityManager,
QueryBuilderFactory $queryBuilderFactory,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application;
namespace Ivoz\Core\Domain;

interface DataTransferObjectInterface
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application\Event;
namespace Ivoz\Core\Domain\Event;

use Ivoz\Core\Domain\Event\DomainEventInterface;

Expand Down
2 changes: 1 addition & 1 deletion Application/Event/CommandWasExecuted.php → Domain/Event/CommandWasExecuted.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application\Event;
namespace Ivoz\Core\Domain\Event;

use Ramsey\Uuid\Uuid;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application;
namespace Ivoz\Core\Domain;

use Doctrine\Common\Collections\ArrayCollection;
use Ivoz\Core\Domain\Model\EntityInterface;
Expand Down
2 changes: 1 addition & 1 deletion Application/Helper/ArrayObjectHelper.php → Domain/Helper/ArrayObjectHelper.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application\Helper;
namespace Ivoz\Core\Domain\Helper;

class ArrayObjectHelper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Ivoz\Core\Application\Helper;
namespace Ivoz\Core\Domain\Helper;

use Doctrine\Persistence\Proxy;
use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Model\EntityInterface;

class EntityClassHelper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application\Helper;
namespace Ivoz\Core\Domain\Helper;

use Doctrine\Common\Inflector\Inflector;
use Ivoz\Core\Domain\Model\EntityInterface;
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/Changelog/ChangelogAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace Ivoz\Core\Domain\Model\Changelog;

use Assert\Assertion;
use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Model\ChangelogTrait;
use Ivoz\Core\Domain\Model\EntityInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\Model\Helper\DateTimeHelper;
use Ivoz\Core\Domain\Model\Commandlog\CommandlogInterface;
use Ivoz\Core\Domain\Model\Commandlog\Commandlog;
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/Changelog/ChangelogDtoAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Ivoz\Core\Domain\Model\Changelog;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\Model\DtoNormalizer;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Model\DtoNormalizer;
use Ivoz\Core\Domain\Model\Commandlog\CommandlogDto;

/**
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/Changelog/ChangelogInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Ivoz\Core\Domain\Model\EntityInterface;
use Ivoz\Core\Domain\Event\EntityEventInterface;
use Ivoz\Core\Domain\Model\Commandlog\CommandlogInterface;
use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;

/**
* ChangelogInterface
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/Changelog/ChangelogTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Ivoz\Core\Domain\Model\Changelog;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;

/**
* @codeCoverageIgnore
Expand Down
2 changes: 1 addition & 1 deletion Domain/Model/ChangelogTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Ivoz\Core\Domain\Model;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;

trait ChangelogTrait
{
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/Commandlog/Commandlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Ivoz\Core\Domain\Model\Commandlog;

use Ivoz\Core\Application\Event\CommandEventInterface;
use Ivoz\Core\Domain\Event\CommandEventInterface;
use Ivoz\Core\Domain\Model\LoggerEntityInterface;

class Commandlog extends CommandlogAbstract implements LoggerEntityInterface, CommandlogInterface
Expand All @@ -20,7 +20,7 @@ public function getId(): ?string
}

/**
* @param \Ivoz\Core\Application\Event\CommandEventInterface $event
* @param \Ivoz\Core\Domain\Event\CommandEventInterface $event
* @return self
*/
public static function fromEvent(CommandEventInterface $event)
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/Commandlog/CommandlogAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace Ivoz\Core\Domain\Model\Commandlog;

use Assert\Assertion;
use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Model\ChangelogTrait;
use Ivoz\Core\Domain\Model\EntityInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\Model\Helper\DateTimeHelper;

/**
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/Commandlog/CommandlogDtoAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Ivoz\Core\Domain\Model\Commandlog;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\Model\DtoNormalizer;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Model\DtoNormalizer;

/**
* CommandlogDtoAbstract
Expand Down
8 changes: 4 additions & 4 deletions Domain/Model/Commandlog/CommandlogInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Ivoz\Core\Domain\Model\Commandlog;

use Ivoz\Core\Domain\Model\EntityInterface;
use Ivoz\Core\Application\Event\CommandEventInterface;
use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\Event\CommandEventInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;

/**
* CommandlogInterface
Expand All @@ -20,7 +20,7 @@ interface CommandlogInterface extends EntityInterface
public function getId(): ?string;

/**
* @param \Ivoz\Core\Application\Event\CommandEventInterface $event
* @param \Ivoz\Core\Domain\Event\CommandEventInterface $event
* @return self
*/
public static function fromEvent(CommandEventInterface $event);
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/Commandlog/CommandlogTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Ivoz\Core\Domain\Model\Commandlog;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;

/**
* @codeCoverageIgnore
Expand Down
2 changes: 1 addition & 1 deletion Application/Model/DtoNormalizer.php → Domain/Model/DtoNormalizer.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application\Model;
namespace Ivoz\Core\Domain\Model;

trait DtoNormalizer
{
Expand Down
4 changes: 2 additions & 2 deletions Domain/Model/EntityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Ivoz\Core\Domain\Model;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;

/**
* Entity interface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application;
namespace Ivoz\Core\Domain;

interface MutexInterface
{
Expand Down
4 changes: 2 additions & 2 deletions Application/RegisterCommandTrait.php → Domain/RegisterCommandTrait.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Ivoz\Core\Application;
namespace Ivoz\Core\Domain;

use Ivoz\Core\Application\Event\CommandWasExecuted;
use Ivoz\Core\Domain\Event\CommandWasExecuted;
use Ivoz\Core\Domain\Service\DomainEventPublisher;

trait RegisterCommandTrait
Expand Down
2 changes: 1 addition & 1 deletion Application/RequestId.php → Domain/RequestId.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application;
namespace Ivoz\Core\Domain;

use Ramsey\Uuid\Uuid;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Ivoz\Core\Application\Service\Assembler;
namespace Ivoz\Core\Domain\Service\Assembler;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Model\EntityInterface;

interface CustomDtoAssemblerInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Ivoz\Core\Application\Service\Assembler;
namespace Ivoz\Core\Domain\Service\Assembler;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\Model\EntityInterface;

interface CustomEntityAssemblerInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Ivoz\Core\Application\Service\Assembler;
namespace Ivoz\Core\Domain\Service\Assembler;

use Ivoz\Core\Application\Helper\EntityClassHelper;
use Ivoz\Core\Domain\Helper\EntityClassHelper;
use Ivoz\Core\Domain\Model\EntityInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Ivoz\Core\Application\Service\Assembler;
namespace Ivoz\Core\Domain\Service\Assembler;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\ForeignKeyTransformerInterface;
use Ivoz\Core\Domain\Model\EntityInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down Expand Up @@ -92,7 +92,7 @@ private function getAssembler(DataTransferObjectInterface $dto)

/**
* @param DataTransferObjectInterface $dto
* @return \Ivoz\Core\Application\Service\Assembler\CustomEntityAssemblerInterface | null
* @return \Ivoz\Core\Domain\Service\Assembler\CustomEntityAssemblerInterface | null
*/
private function create(DataTransferObjectInterface $dto)
{
Expand All @@ -118,7 +118,7 @@ private function getServiceNameByDto(DataTransferObjectInterface $dto)
substr(
str_replace(
'Domain\\Model',
'Application\\Service',
'Domain\\Assembler',
$entityClass
),
0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Ivoz\Core\Application\Service;
namespace Ivoz\Core\Domain\Service;

use Ivoz\Core\Application\Event\CommandEventInterface;
use Ivoz\Core\Domain\Event\CommandEventInterface;
use Ivoz\Core\Domain\Event\DomainEventInterface;
use Ivoz\Core\Domain\Service\DomainEventSubscriberInterface;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application\Service;
namespace Ivoz\Core\Domain\Service;

use Ivoz\Core\Domain\Model\EntityInterface;

Expand Down
6 changes: 3 additions & 3 deletions Application/Service/CreateEntityFromDto.php → Domain/Service/CreateEntityFromDto.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* Time: 10:52
*/

namespace Ivoz\Core\Application\Service;
namespace Ivoz\Core\Domain\Service;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\Service\Assembler\EntityAssembler;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Service\Assembler\EntityAssembler;
use Ivoz\Core\Domain\Model\EntityInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion Domain/Service/EntityPersisterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Ivoz\Core\Domain\Service;

use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Model\EntityInterface;

interface EntityPersisterInterface
Expand Down
7 changes: 4 additions & 3 deletions Application/Service/EntityTools.php → Domain/Service/EntityTools.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

namespace Ivoz\Core\Application\Service;
namespace Ivoz\Core\Domain\Service;

use Doctrine\DBAL\LockMode;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\PessimisticLockException;
use Ivoz\Core\Application\DataTransferObjectInterface;
use Ivoz\Core\Application\Service\Assembler\DtoAssembler;
use Ivoz\Core\Domain\DataTransferObjectInterface;
use Ivoz\Core\Domain\Service\Assembler\DtoAssembler;
use Ivoz\Core\Domain\Model\EntityInterface;
use Ivoz\Core\Domain\Service\EntityPersisterInterface;
use Doctrine\ORM\UnitOfWork;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Ivoz\Core\Application\Service;
namespace Ivoz\Core\Domain\Service;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
Expand Down
Loading

0 comments on commit 6ae4652

Please sign in to comment.