Skip to content

Commit 916052e

Browse files
committed
doctrine repository etc reorganized
1 parent b8a1912 commit 916052e

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

src/BackendBase/Infrastructure/Persistence/Doctrine/Repository/ContentRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public function getContentsByCategoryForClient(string $category, int $offset, in
270270
C.is_active
271271
FROM public.contents C
272272
LEFT JOIN lookup_table L ON L.key=C.category
273-
WHERE C.category = :category AND C.is_deleted = 0
273+
WHERE C.category = :category AND C.is_deleted = 0 AND AND C.is_active = 1
274274
AND (jsonb_path_exists(C.metadata, '$.publishDate') = false OR C.metadata->>'publishDate' <= :nowLocaleDate)
275275
AND (jsonb_path_exists(C.metadata, '$.expireDate') = false OR C.metadata->>'expireDate' >= :nowLocaleDate)
276276
ORDER BY C.sort_order DESC

src/BackendBase/Shared/Factory/Doctrine/DoctrineRepositoryFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public function __invoke(ContainerInterface $container, $requestedName, ?array $
1717
{
1818
$connection = $container->get(Connection::class);
1919
$entityManager = $container->get(EntityManager::class);
20-
$rejson = $container->get(ReJSON::class);
21-
$repositoryClassName = str_replace(['Interfaces', 'Repository'], ['Persistence\\Doctrine', ''], $requestedName);
2220

23-
return new $repositoryClassName($entityManager, $connection, $rejson);
21+
$repositoryClassName = str_replace(['Domain', 'Repository'], ['Infrastructure\\Persistence\\Doctrine', ''], $requestedName);
22+
23+
return new $repositoryClassName($entityManager, $connection);
2424
}
2525
}

src/BackendBase/Shared/ValueObject/ContactInfo.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
declare(strict_types=1);
44

55
namespace BackendBase\Shared\ValueObject;
6+
use BackendBase\Shared\ValueObject\Interfaces\Email;
67

78
final class ContactInfo
89
{
910
private Email $email;
10-
private PhoneNumber $phoneNumber;
11+
private ? PhoneNumber $phoneNumber;
1112

12-
public function __construct(Email $email, PhoneNumber $phoneNumber)
13+
public function __construct(Email $email, ? PhoneNumber $phoneNumber)
1314
{
1415
$this->email = $email;
1516
$this->phoneNumber = $phoneNumber;
@@ -20,7 +21,7 @@ public function email() : Email
2021
return $this->email;
2122
}
2223

23-
public function phoneNumber() : PhoneNumber
24+
public function phoneNumber() : ? PhoneNumber
2425
{
2526
return $this->phoneNumber;
2627
}

src/BackendBase/Shared/ValueObject/TaxIdentity.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ private function __construct(
2525
$this->taxPayerType = $taxPayerType;
2626
}
2727

28+
public static function fromTaxId(
29+
string $taxId,
30+
string $taxAdministrationOfficeName,
31+
string $taxAdministrationOfficeCode
32+
) : self {
33+
$taxIdLength = strlen(trim($taxId));
34+
if ($taxIdLength === 11) {
35+
return self::fromPrivateCompany(new PrivateTaxId($taxId), $taxAdministrationOfficeName, $taxAdministrationOfficeCode);
36+
}
37+
if ($taxIdLength === 10) {
38+
return self::fromCorporateCompany(new CorporateTaxId($taxId), $taxAdministrationOfficeName, $taxAdministrationOfficeCode);
39+
}
40+
}
41+
2842
public static function fromPrivateCompany(
2943
PrivateTaxId $taxId,
3044
string $taxAdministrationOfficeName,

0 commit comments

Comments
 (0)