Moss/Storage/Query/Relation/ManyRelation.php 1 location
|
@@ 76-84 (lines=9) @@
|
| 73 |
|
public function write(&$result) |
| 74 |
|
{ |
| 75 |
|
$container = $this->accessor->getPropertyValue($result, $this->definition->container()); |
| 76 |
|
if (empty($container)) { |
| 77 |
|
$conditions = []; |
| 78 |
|
foreach ($this->definition->keys() as $local => $foreign) { |
| 79 |
|
$conditions[$foreign][] = $this->accessor->getPropertyValue($result, $local); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
$this->cleanup($this->definition->entity(), [], $conditions); |
| 83 |
|
return $result; |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
$this->assertArrayAccess($container); |
| 87 |
|
|
Moss/Storage/Query/Relation/ManyTroughRelation.php 1 location
|
@@ 94-102 (lines=9) @@
|
| 91 |
|
public function write(&$result) |
| 92 |
|
{ |
| 93 |
|
$container = $this->accessor->getPropertyValue($result, $this->definition->container()); |
| 94 |
|
if (empty($container)) { |
| 95 |
|
$conditions = []; |
| 96 |
|
foreach ($this->definition->localKeys() as $local => $foreign) { |
| 97 |
|
$conditions[$foreign][] = $this->accessor->getPropertyValue($result, $local); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
$this->cleanup($this->definition->mediator(), [], $conditions); |
| 101 |
|
return $result; |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
foreach ($container as $entity) { |
| 105 |
|
$this->storage->write($entity, $this->definition->entity())->execute(); |
Moss/Storage/Query/Relation/OneRelation.php 1 location
|
@@ 71-79 (lines=9) @@
|
| 68 |
|
public function write(&$result) |
| 69 |
|
{ |
| 70 |
|
$entity = $this->accessor->getPropertyValue($result, $this->definition->container()); |
| 71 |
|
if (empty($entity)) { |
| 72 |
|
$conditions = []; |
| 73 |
|
foreach ($this->definition->keys() as $local => $foreign) { |
| 74 |
|
$conditions[$foreign][] = $this->accessor->getPropertyValue($result, $local); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
$this->cleanup($this->definition->entity(), [], $conditions); |
| 78 |
|
return $result; |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
$this->assertInstance($entity); |
| 82 |
|
|
Moss/Storage/Query/Relation/OneTroughRelation.php 1 location
|
@@ 84-92 (lines=9) @@
|
| 81 |
|
public function write(&$result) |
| 82 |
|
{ |
| 83 |
|
$entity = $this->accessor->getPropertyValue($result, $this->definition->container()); |
| 84 |
|
if (empty($entity)) { |
| 85 |
|
$conditions = []; |
| 86 |
|
foreach ($this->definition->localKeys() as $local => $foreign) { |
| 87 |
|
$conditions[$foreign][] = $this->accessor->getPropertyValue($result, $local); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
$this->cleanup($this->definition->mediator(), [], $conditions); |
| 91 |
|
return $result; |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
$this->storage->write($entity, $this->definition->entity())->execute(); |
| 95 |
|
|