|
@@ 62-76 (lines=15) @@
|
| 59 |
|
* |
| 60 |
|
* @return $this |
| 61 |
|
*/ |
| 62 |
|
public function addAssociationInfo(DataContainer\EntityInterface $fromDataItem, DataContainer\EntityInterface $toDataItem, DataContainer\Association $association) |
| 63 |
|
{ |
| 64 |
|
$fromDataItemId = $fromDataItem->getId(); |
| 65 |
|
if (!array_key_exists($fromDataItemId, $this->associationMap)) { |
| 66 |
|
$this->associationMap[$fromDataItemId] = []; |
| 67 |
|
} |
| 68 |
|
$associationName = $association->getName(); |
| 69 |
|
if (!array_key_exists($associationName, $this->associationMap[$fromDataItemId])) { |
| 70 |
|
$this->associationMap[$fromDataItemId][$associationName] = []; |
| 71 |
|
} |
| 72 |
|
$toDataItemId = $toDataItem->getId(); |
| 73 |
|
$this->associationMap[$fromDataItemId][$associationName][$toDataItemId] = $toDataItemId; |
| 74 |
|
|
| 75 |
|
return $this; |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
/** |
| 79 |
|
* Добавляет обратную связь |
|
@@ 87-100 (lines=14) @@
|
| 84 |
|
* |
| 85 |
|
* @return $this |
| 86 |
|
*/ |
| 87 |
|
public function addReverseAssociationInfo(DataContainer\EntityInterface $fromDataItem, DataContainer\EntityInterface $toDataItem, $associationName) |
| 88 |
|
{ |
| 89 |
|
$fromDataItemId = $fromDataItem->getId(); |
| 90 |
|
if (!array_key_exists($fromDataItemId, $this->associationMap)) { |
| 91 |
|
$this->associationMap[$fromDataItemId] = []; |
| 92 |
|
} |
| 93 |
|
if (!array_key_exists($associationName, $this->associationMap[$fromDataItemId])) { |
| 94 |
|
$this->associationMap[$fromDataItemId][$associationName] = []; |
| 95 |
|
} |
| 96 |
|
$toDataItemId = $toDataItem->getId(); |
| 97 |
|
$this->associationMap[$fromDataItemId][$associationName][$toDataItemId] = $toDataItemId; |
| 98 |
|
|
| 99 |
|
return $this; |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
/** |
| 103 |
|
* Связывает id контейнера с данными, с именем класса сущности |