Skip to content

Commit

Permalink
Styling and making mappers compatible with being called with $patch
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzondervan committed Nov 28, 2024
1 parent 6b29788 commit 11bfadd
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/Controller/DirectoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function update(): JSONResponse
$url = $this->request->getParam('directory');

// Sync the external directory with the provided URL
try{
try {
$data = $this->directoryService->syncExternalDirectory($url);
} catch (DirectoryUrlException $exception) {
if($exception->getMessage() === 'URL is required') {
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/ListingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function add(): JSONResponse
$url = $this->request->getParam('url');

// Add the new listing using the provided URL
try{
try {
$result = $this->directoryService->syncExternalDirectory($url);
} catch (DirectoryUrlException $exception) {
if($exception->getMessage() === 'URL is required') {
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/AttachmentMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function createFromArray(array $object): Attachment
* @throws DoesNotExistException If the entity is not found
* @throws MultipleObjectsReturnedException|\OCP\DB\Exception If multiple entities are found
*/
public function updateFromArray(int $id, array $object, bool $updateVersion = true): Attachment
public function updateFromArray(int $id, array $object, bool $updateVersion = true, bool $patch = false): Attachment
{
$attachment = $this->find($id);
// Fallback to create if the attachment does not exist
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/CatalogMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ public function createFromArray(array $object): Catalog
*
* @return Catalog The updated Catalog entity
*/
public function updateFromArray(int $id, array $object, bool $updateVersion = true): Catalog
public function updateFromArray(int $id, array $object, bool $updateVersion = true, bool $patch = false): Catalog
{
$catalog = $this->find($id);
$catalog = $this->find($id);
// Fallback to create if the catalog does not exist
if ($catalog === null) {
$object['uuid'] = $id;
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/ListingMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function createFromArray(array $object): Listing
* @return Listing The updated Listing entity
* @throws Exception
*/
public function updateFromArray(int|string $id, array $object, bool $updateVersion = true): Listing
public function updateFromArray(int|string $id, array $object, bool $updateVersion = true, bool $patch = false): Listing
{
$listing = $this->find($id);
// Fallback to create if the listing does not exist
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/OrganizationMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function createFromArray(array $object): Organization
*
* @return Organization The updated Organization entity
*/
public function updateFromArray(int $id, array $object, bool $updateVersion = true): Organization
public function updateFromArray(int $id, array $object, bool $updateVersion = true, bool $patch = false): Organization
{
$organization = $this->find($id);
// Fallback to create if the organization does not exist
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/PublicationMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function createFromArray(array $object): Publication
*
* @return Publication The updated Publication entity
*/
public function updateFromArray(int $id, array $object, bool $updateVersion = true): Publication
public function updateFromArray(int $id, array $object, bool $updateVersion = true, bool $patch = false): Publication
{
$publication = $this->find(id: $id);
// Fallback to create if the publication does not exist
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/PublicationTypeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function createFromArray(array $object): PublicationType
* @throws DoesNotExistException If the entity is not found
* @throws MultipleObjectsReturnedException|\OCP\DB\Exception If multiple entities are found
*/
public function updateFromArray(int $id, array $object, bool $updateVersion = true): PublicationType
public function updateFromArray(int $id, array $object, bool $updateVersion = true, bool $patch = false): PublicationType
{
$publicationType = $this->find($id);
// Fallback to create if the publication type does not exist
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/ThemeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function createFromArray(array $object): Theme
* @throws DoesNotExistException If the entity is not found
* @throws MultipleObjectsReturnedException|\OCP\DB\Exception If multiple entities are found
*/
public function updateFromArray(int $id, array $object, bool $updateVersion = true): Theme
public function updateFromArray(int $id, array $object, bool $updateVersion = true, bool $patch = false): Theme
{
$theme = $this->find($id);
// Fallback to create if the theme does not exist
Expand Down

0 comments on commit 11bfadd

Please sign in to comment.