Conditions | 5 |
Paths | 2 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
40 | public function run( |
||
41 | string $field, |
||
42 | string $source, |
||
43 | string $target, |
||
44 | int $siteId = null |
||
45 | ) { |
||
46 | |||
47 | // Resolve |
||
48 | $field = $this->resolveField($field); |
||
49 | $source = $this->resolveElement($source); |
||
50 | $target = $this->resolveElement($target); |
||
51 | |||
52 | /** @var Field $field */ |
||
53 | |||
54 | $siteId = SiteHelper::ensureSiteId($siteId ?: $source->siteId); |
||
55 | |||
56 | $record = Association::find() |
||
57 | ->fieldId($field->id) |
||
58 | ->sourceId($source->getId() ?: false) |
||
59 | ->targetId($target->getId() ?: false) |
||
60 | ->siteId($siteId) |
||
61 | ->one(); |
||
62 | |||
63 | if (!$record) { |
||
64 | return true; |
||
65 | } |
||
66 | |||
67 | return $this->runInternal($record); |
||
68 | } |
||
69 | |||
81 |