Skip to content

Commit

Permalink
[harvest] common identfier behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
rastislav-chynoransky committed Nov 2, 2023
1 parent c16407a commit 49e801b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion app/Harvest/Harvesters/GmuhkItemHarvester.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Harvest\Harvesters;

use App\Harvest\Harvesters\AbstractHarvester;
use App\Harvest\Importers\GmuhkItemImporter;
use App\Harvest\Repositories\GmuhkItemRepository;

Expand Down
7 changes: 5 additions & 2 deletions app/Harvest/Importers/AbstractImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ public function __construct(AbstractMapper $mapper) {
* @param array $row
* @return mixed
*/
abstract function getModelId(array $row);
abstract public function getModelId(array $row);

/**
* @param array $row
* @return string
*/
abstract function getIdentifier(array $row);
public function getIdentifier(array $row)
{
return $this->getModelId($row);
}

/**
* @param array $row
Expand Down
4 changes: 0 additions & 4 deletions app/Harvest/Importers/AuthorityImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ public function getModelId(array $row) {
return $this->mapper->mapId($row);
}

public function getIdentifier(array $row) {
return $this->getModelId($row);
}

protected function upsertModel(Model $model, array $row) {
if ($model->exists) {
unset($row['biography']);
Expand Down
4 changes: 0 additions & 4 deletions app/Harvest/Importers/ItemImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public function getModelId(array $row) {
return $this->mapper->mapId($row);
}

public function getIdentifier(array $row) {
return $this->getModelId($row);
}

protected function processHasMany(Model $model, $field, array $relatedRows, $allowDelete = true) {
$allowDelete &= !in_array($field, ['images']);
parent::processHasMany($model, $field, $relatedRows, $allowDelete);
Expand Down

0 comments on commit 49e801b

Please sign in to comment.