Skip to content

Commit

Permalink
doctrine repository etc reorganized
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorkmaz committed Jul 12, 2020
1 parent b8a1912 commit 916052e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function getContentsByCategoryForClient(string $category, int $offset, in
C.is_active
FROM public.contents C
LEFT JOIN lookup_table L ON L.key=C.category
WHERE C.category = :category AND C.is_deleted = 0
WHERE C.category = :category AND C.is_deleted = 0 AND AND C.is_active = 1
AND (jsonb_path_exists(C.metadata, '$.publishDate') = false OR C.metadata->>'publishDate' <= :nowLocaleDate)
AND (jsonb_path_exists(C.metadata, '$.expireDate') = false OR C.metadata->>'expireDate' >= :nowLocaleDate)
ORDER BY C.sort_order DESC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public function __invoke(ContainerInterface $container, $requestedName, ?array $
{
$connection = $container->get(Connection::class);
$entityManager = $container->get(EntityManager::class);
$rejson = $container->get(ReJSON::class);
$repositoryClassName = str_replace(['Interfaces', 'Repository'], ['Persistence\\Doctrine', ''], $requestedName);

return new $repositoryClassName($entityManager, $connection, $rejson);
$repositoryClassName = str_replace(['Domain', 'Repository'], ['Infrastructure\\Persistence\\Doctrine', ''], $requestedName);

return new $repositoryClassName($entityManager, $connection);
}
}
7 changes: 4 additions & 3 deletions src/BackendBase/Shared/ValueObject/ContactInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
declare(strict_types=1);

namespace BackendBase\Shared\ValueObject;
use BackendBase\Shared\ValueObject\Interfaces\Email;

final class ContactInfo
{
private Email $email;
private PhoneNumber $phoneNumber;
private ? PhoneNumber $phoneNumber;

public function __construct(Email $email, PhoneNumber $phoneNumber)
public function __construct(Email $email, ? PhoneNumber $phoneNumber)
{
$this->email = $email;
$this->phoneNumber = $phoneNumber;
Expand All @@ -20,7 +21,7 @@ public function email() : Email
return $this->email;
}

public function phoneNumber() : PhoneNumber
public function phoneNumber() : ? PhoneNumber
{
return $this->phoneNumber;
}
Expand Down
14 changes: 14 additions & 0 deletions src/BackendBase/Shared/ValueObject/TaxIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ private function __construct(
$this->taxPayerType = $taxPayerType;
}

public static function fromTaxId(
string $taxId,
string $taxAdministrationOfficeName,
string $taxAdministrationOfficeCode
) : self {
$taxIdLength = strlen(trim($taxId));
if ($taxIdLength === 11) {
return self::fromPrivateCompany(new PrivateTaxId($taxId), $taxAdministrationOfficeName, $taxAdministrationOfficeCode);
}
if ($taxIdLength === 10) {
return self::fromCorporateCompany(new CorporateTaxId($taxId), $taxAdministrationOfficeName, $taxAdministrationOfficeCode);
}
}

public static function fromPrivateCompany(
PrivateTaxId $taxId,
string $taxAdministrationOfficeName,
Expand Down

0 comments on commit 916052e

Please sign in to comment.