diff --git a/build/GPBMetadata/Proto/Translation.php b/build/GPBMetadata/Proto/Translation.php
index 2be77fc..dc78422 100644
--- a/build/GPBMetadata/Proto/Translation.php
+++ b/build/GPBMetadata/Proto/Translation.php
@@ -15,7 +15,7 @@ public static function initOnce() {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
- "0ad2060a1770726f746f2f7472616e736c6174696f6e2e70726f746f12127472616e736c6174696f6e5061636b61676522a9010a105472616e736c6174696f6e517565727912150a0d6c616e67756167655f636f646518012001280912100a087265736f7572636518022001280912130a0b7265736f757263655f6964180320012809120c0a0470616765180420012805120d0a056669727374180520012805120b0a036b6579180620012809122d0a086f726465725f627918072001280b321b2e7472616e736c6174696f6e5061636b6167652e4f726465724279229f020a0f5472616e736c6174696f6e4974656d120a0a026964180120012805120b0a036b6579180220012809120d0a0576616c756518032001280912150a0d6c616e67756167655f636f646518042001280912100a087265736f7572636518052001280912130a0b7265736f757263655f6964180620012809120e0a06656469746f7218072001280912120a0a637265617465645f617418082001280912120a0a757064617465645f6174180920012809123f0a06706172616d73180a2003280b322f2e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d2e506172616d73456e7472791a2d0a0b506172616d73456e747279120b0a036b6579180120012809120d0a0576616c75651802200128093a02380122280a074f726465724279120e0a06636f6c756d6e180120012809120d0a056f7264657218022001280922550a105472616e736c6174696f6e4974656d7312320a056974656d7318012003280b32232e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d120d0a05746f74616c18022001280532cb010a0b5472616e736c6174696f6e125d0a115570646174655472616e736c6174696f6e12232e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d1a232e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d125d0a0f4765745472616e736c6174696f6e7312242e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e51756572791a242e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d73620670726f746f33"
+ "0abe060a1770726f746f2f7472616e736c6174696f6e2e70726f746f12127472616e736c6174696f6e5061636b61676522a9010a105472616e736c6174696f6e517565727912150a0d6c616e67756167655f636f646518012001280912100a087265736f7572636518022001280912130a0b7265736f757263655f6964180320012809120c0a0470616765180420012805120d0a056669727374180520012805120b0a036b6579180620012809122d0a086f726465725f627918072001280b321b2e7472616e736c6174696f6e5061636b6167652e4f726465724279228b020a0f5472616e736c6174696f6e4974656d120a0a026964180120012805120b0a036b6579180220012809120d0a0576616c756518032001280912150a0d6c616e67756167655f636f646518042001280912100a087265736f7572636518052001280912130a0b7265736f757263655f6964180620012809120e0a06656469746f7218072001280912120a0a757064617465645f6174180820012809123f0a06706172616d7318092003280b322f2e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d2e506172616d73456e7472791a2d0a0b506172616d73456e747279120b0a036b6579180120012809120d0a0576616c75651802200128093a02380122280a074f726465724279120e0a06636f6c756d6e180120012809120d0a056f7264657218022001280922550a105472616e736c6174696f6e4974656d7312320a056974656d7318012003280b32232e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d120d0a05746f74616c18022001280532cb010a0b5472616e736c6174696f6e125d0a115570646174655472616e736c6174696f6e12232e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d1a232e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d125d0a0f4765745472616e736c6174696f6e7312242e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e51756572791a242e7472616e736c6174696f6e5061636b6167652e5472616e736c6174696f6e4974656d73620670726f746f33"
), true);
static::$is_initialized = true;
diff --git a/build/TranslationPackage/TranslationItem.php b/build/TranslationPackage/TranslationItem.php
index ecf7d4a..4ec8cf6 100644
--- a/build/TranslationPackage/TranslationItem.php
+++ b/build/TranslationPackage/TranslationItem.php
@@ -42,15 +42,11 @@ class TranslationItem extends \Google\Protobuf\Internal\Message
*/
protected $editor = '';
/**
- * Generated from protobuf field string created_at = 8;
- */
- protected $created_at = '';
- /**
- * Generated from protobuf field string updated_at = 9;
+ * Generated from protobuf field string updated_at = 8;
*/
protected $updated_at = '';
/**
- * Generated from protobuf field map params = 10;
+ * Generated from protobuf field map params = 9;
*/
private $params;
@@ -67,7 +63,6 @@ class TranslationItem extends \Google\Protobuf\Internal\Message
* @type string $resource
* @type string $resource_id
* @type string $editor
- * @type string $created_at
* @type string $updated_at
* @type array|\Google\Protobuf\Internal\MapField $params
* }
@@ -232,29 +227,7 @@ public function setEditor($var)
}
/**
- * Generated from protobuf field string created_at = 8;
- * @return string
- */
- public function getCreatedAt()
- {
- return $this->created_at;
- }
-
- /**
- * Generated from protobuf field string created_at = 8;
- * @param string $var
- * @return $this
- */
- public function setCreatedAt($var)
- {
- GPBUtil::checkString($var, True);
- $this->created_at = $var;
-
- return $this;
- }
-
- /**
- * Generated from protobuf field string updated_at = 9;
+ * Generated from protobuf field string updated_at = 8;
* @return string
*/
public function getUpdatedAt()
@@ -263,7 +236,7 @@ public function getUpdatedAt()
}
/**
- * Generated from protobuf field string updated_at = 9;
+ * Generated from protobuf field string updated_at = 8;
* @param string $var
* @return $this
*/
@@ -276,7 +249,7 @@ public function setUpdatedAt($var)
}
/**
- * Generated from protobuf field map params = 10;
+ * Generated from protobuf field map params = 9;
* @return \Google\Protobuf\Internal\MapField
*/
public function getParams()
@@ -285,7 +258,7 @@ public function getParams()
}
/**
- * Generated from protobuf field map params = 10;
+ * Generated from protobuf field map params = 9;
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
diff --git a/proto/translation.proto b/proto/translation.proto
index bba951b..933d07a 100644
--- a/proto/translation.proto
+++ b/proto/translation.proto
@@ -25,9 +25,8 @@ message TranslationItem {
string resource = 5;
string resource_id = 6;
string editor = 7;
- string created_at = 8;
- string updated_at = 9;
- map params = 10;
+ string updated_at = 8;
+ map params = 9;
}
message OrderBy {
diff --git a/src/Enums/ColumnEnum.php b/src/Enums/ColumnEnum.php
index 507e770..037afa0 100644
--- a/src/Enums/ColumnEnum.php
+++ b/src/Enums/ColumnEnum.php
@@ -7,5 +7,5 @@
enum ColumnEnum: string
{
case KEY = 'key';
- case CREATED_AT = 'created_at';
+ case UPDATED_AT = 'updated_at';
}
diff --git a/src/TranslationAppClient.php b/src/TranslationAppClient.php
index 1d5cba1..333d99d 100644
--- a/src/TranslationAppClient.php
+++ b/src/TranslationAppClient.php
@@ -53,7 +53,6 @@ public function getTranslations(TranslationQueryValueObject $valueObject): array
'id' => $translationItem->getId(),
'key' => $translationItem->getKey(),
'value' => $translationItem->getValue(),
- 'createdAt' => $translationItem->getCreatedAt(),
'updatedAt' => $translationItem->getUpdatedAt(),
'editor' => $translationItem->getEditor(),
'params' => $translationItem->getParams(),
@@ -66,27 +65,23 @@ public function getTranslations(TranslationQueryValueObject $valueObject): array
}
/**
- * Update translation if id exists, or create new one.
+ * Update translation by id.
*
* @param \Uc\TranslationAppSdk\ValueObjects\TranslationItemValueObject $valueObject
*
* @return array
*/
- public function updateOrCreate(TranslationItemValueObject $valueObject): array
+ public function update(TranslationItemValueObject $valueObject): array
{
$data = new TranslationItem();
- if ($valueObject->hasId()) {
- $data->setId($valueObject->getId());
- }
-
if ($valueObject->hasParams()) {
$data->setParams($valueObject->getParams());
}
+ $data->setId($valueObject->getId());
$data->setKey($valueObject->getKey());
$data->setValue($valueObject->getValue());
- $data->setCreatedAt($valueObject->getCreatedAt());
$data->setUpdatedAt($valueObject->getUpdatedAt());
$data->setEditor($valueObject->getEditor());
$data->setResource($valueObject->getResource());
@@ -101,7 +96,6 @@ public function updateOrCreate(TranslationItemValueObject $valueObject): array
'id' => $data->getId(),
'key' => $data->getKey(),
'value' => $data->getValue(),
- 'createdAt' => $data->getCreatedAt(),
'updatedAt' => $data->getUpdatedAt(),
'editor' => $data->getEditor(),
'resource' => $data->getResource(),
diff --git a/src/ValueObjects/TranslationItemValueObject.php b/src/ValueObjects/TranslationItemValueObject.php
index ae8f964..eadb3a7 100644
--- a/src/ValueObjects/TranslationItemValueObject.php
+++ b/src/ValueObjects/TranslationItemValueObject.php
@@ -4,19 +4,18 @@
namespace Uc\TranslationAppSdk\ValueObjects;
-class TranslationItemValueObject
+readonly class TranslationItemValueObject
{
public function __construct(
- protected readonly string $key,
- protected readonly string $value,
- protected readonly string $languageCode,
- protected readonly string $createdAt,
- protected readonly string $updatedAt,
- protected readonly string $resource,
- protected readonly int $resourceId,
- protected readonly string $editor,
- protected readonly ?int $id,
- protected readonly ?array $params,
+ protected string $key,
+ protected string $value,
+ protected string $languageCode,
+ protected string $updatedAt,
+ protected string $resource,
+ protected int $resourceId,
+ protected string $editor,
+ protected int $id,
+ protected ?array $params,
)
{
}
@@ -61,14 +60,6 @@ public function getLanguageCode(): string
return $this->languageCode;
}
- /**
- * @return string
- */
- public function getCreatedAt(): string
- {
- return $this->createdAt;
- }
-
/**
* @return string
*/
@@ -86,21 +77,13 @@ public function getResourceId(): int
}
/**
- * @return int|null
+ * @return int
*/
- public function getId(): ?int
+ public function getId(): int
{
return $this->id;
}
- /**
- * @return bool
- */
- public function hasId(): bool
- {
- return !empty($this->getId());
- }
-
/**
* @return array|null
*/
diff --git a/src/ValueObjects/TranslationQueryValueObject.php b/src/ValueObjects/TranslationQueryValueObject.php
index bafd491..8e4ce9d 100644
--- a/src/ValueObjects/TranslationQueryValueObject.php
+++ b/src/ValueObjects/TranslationQueryValueObject.php
@@ -4,16 +4,16 @@
namespace Uc\TranslationAppSdk\ValueObjects;
-class TranslationQueryValueObject
+readonly class TranslationQueryValueObject
{
public function __construct(
- protected readonly int $resourceId,
- protected readonly string $languageCode,
- protected readonly string $resource,
- protected readonly ?string $key = null,
- protected readonly array $orderBy = [],
- protected readonly int $page = 0,
- protected readonly int $first = 10,
+ protected int $resourceId,
+ protected string $languageCode,
+ protected string $resource,
+ protected ?string $key = null,
+ protected array $orderBy = [],
+ protected int $page = 0,
+ protected int $first = 10,
){
}