Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/CrowdinApiClient/Api/ProjectApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public function get(int $projectId): ?Project
* boolean $data[skipUntranslatedStrings]<br>
* boolean $data[skipUntranslatedFiles]<br>
* integer $data[exportWithMinApprovalsCount]<br>
* integer $data[exportApprovedOnly]
* integer $data[exportApprovedOnly]<br>
* integer $data[defaultTmId]<br>
* integer $data[defaultGlossaryId]
* @return Project|null
*/
public function create(array $data): ?Project
Expand Down
44 changes: 44 additions & 0 deletions src/CrowdinApiClient/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ class Project extends BaseModel
*/
protected $notificationSettings = [];

/**
* @var integer
*/
protected $defaultTmId;

/**
* @var integer
*/
protected $defaultGlossaryId;

public function __construct(array $data = [])
{
parent::__construct($data);
Expand Down Expand Up @@ -293,6 +303,8 @@ public function __construct(array $data = [])
$this->normalizePlaceholder = (bool)$this->getDataProperty('normalizePlaceholder');
$this->saveMetaInfoInSource = (bool)$this->getDataProperty('saveMetaInfoInSource');
$this->notificationSettings = (array)$this->getDataProperty('notificationSettings');
$this->defaultTmId = (integer)$this->getDataProperty('defaultTmId');
$this->defaultGlossaryId = (integer)$this->getDataProperty('defaultGlossaryId');
}

/**
Expand Down Expand Up @@ -1034,4 +1046,36 @@ public function setNotificationSettings(array $notificationSettings): void
{
$this->notificationSettings = $notificationSettings;
}

/**
* @return int|null
*/
public function getDefaultTmId(): ?int
{
return $this->defaultTmId;
}

/**
* @param int|null $defaultTmId
*/
public function setDefaultTmId(?int $defaultTmId): void
{
$this->defaultTmId = $defaultTmId;
}

/**
* @return int|null
*/
public function getDefaultGlossaryId(): ?int
{
return $this->defaultGlossaryId;
}

/**
* @param int|null $defaultGlossaryId
*/
public function setDefaultGlossaryId(?int $defaultGlossaryId): void
{
$this->defaultGlossaryId = $defaultGlossaryId;
}
}
8 changes: 8 additions & 0 deletions tests/CrowdinApiClient/Model/ProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class ProjectTest extends TestCase
],
'joinPolicy' => null,
'visibility' => null,
'defaultTmId' => 10,
'defaultGlossaryId' => 20,
];

public function testLoadData()
Expand All @@ -157,12 +159,16 @@ public function testSetData()
$this->project->setTargetLanguageIds(['uk']);
$this->project->setLanguageAccessPolicy('moderate');
$this->project->setDescription($this->data['description']);
$this->project->setDefaultTmId($this->data['defaultTmId']);
$this->project->setDefaultGlossaryId($this->data['defaultGlossaryId']);

$this->assertEquals($this->data['name'], $this->project->getName());
$this->assertEquals($this->data['cname'], $this->project->getCname());
$this->assertEquals($this->data['description'], $this->project->getDescription());
$this->assertEquals(['uk'], $this->project->getTargetLanguageIds());
$this->assertEquals('moderate', $this->project->getLanguageAccessPolicy());
$this->assertEquals($this->data['defaultTmId'], $this->project->getDefaultTmId());
$this->assertEquals($this->data['defaultGlossaryId'], $this->project->getDefaultGlossaryId());
}

public function checkData()
Expand Down Expand Up @@ -214,5 +220,7 @@ public function checkData()
$this->assertEquals($this->data['normalizePlaceholder'], $this->project->isNormalizePlaceholder());
$this->assertEquals($this->data['saveMetaInfoInSource'], $this->project->isSaveMetaInfoInSource());
$this->assertEquals($this->data['notificationSettings'], $this->project->getNotificationSettings());
$this->assertEquals($this->data['defaultTmId'], $this->project->getDefaultTmId());
$this->assertEquals($this->data['defaultGlossaryId'], $this->project->getDefaultGlossaryId());
}
}