Skip to content

Commit 549dd61

Browse files
committed
ManyToMany and TaggableDaoWorker first version of hardfix
1 parent d9f69ab commit 549dd61

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

main/DAOs/Workers/CommonDaoWorker.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ public function dropById($id)
484484
* @return Closure
485485
*/
486486
public function getUncacheByIdFunc($id) {
487-
$dao = $this->dao();
487+
$dao = $this->dao;
488488
$function = parent::getUncacheByIdFunc($id);
489489
return function () use ($function, $dao) {
490490
$dao->uncacheLists();

main/DAOs/Workers/TaggableSmartHandler.class.php

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,29 @@ public function getUncacheObjectTags(IdentifiableObject $object, $className)
2727
$tags = array_merge($this->getDefaultTags($className), $tags);
2828

2929
foreach ($this->getLinkProperties($className) as $name => $property) {
30+
/* @var $property LightMetaProperty */
3031
if ($name == 'id') {
3132
continue;
3233
}
3334
if ($property->getClassName()) {
34-
if ($property->getFetchStrategyId() == FetchStrategy::LAZY) {
35-
if ($linkedObjectId = $object->{$property->getGetter().'Id'}()) {
36-
$tags[] = $this->getTagByClassAndId($property->getClassName(), $linkedObjectId);
37-
}
38-
} elseif ($property->getFetchStrategyId()) {
39-
if (
40-
($linkedObject = $object->{$property->getGetter()}())
41-
&& $linkedObject instanceof IdentifiableObject
42-
&& $linkedObjectId = $linkedObject->getId()
43-
) {
44-
$tags[] = $this->getTagByClassAndId($property->getClassName(), $linkedObjectId);
35+
if ($property->getRelationId() == MetaRelation::ONE_TO_ONE) {
36+
if ($property->getFetchStrategyId() == FetchStrategy::LAZY) {
37+
if ($linkedObjectId = $object->{$property->getGetter().'Id'}()) {
38+
$tags[] = $this->getTagByClassAndId($property->getClassName(), $linkedObjectId);
39+
}
40+
} elseif ($property->getFetchStrategyId()) {
41+
if (
42+
($linkedObject = $object->{$property->getGetter()}())
43+
&& $linkedObject instanceof IdentifiableObject
44+
&& $linkedObjectId = $linkedObject->getId()
45+
) {
46+
$tags[] = $this->getTagByClassAndId($property->getClassName(), $linkedObjectId);
47+
}
4548
}
49+
} elseif ($property->getRelationId() == MetaRelation::MANY_TO_MANY) {
50+
$daoHelper = $object->{$property->getGetter()}();
51+
/* @var $daoHelper ManyToManyLinked */
52+
$tags[] = $daoHelper->getHelperTable();
4653
}
4754
}
4855
}
@@ -83,7 +90,6 @@ public function getQueryTags(SelectQuery $query, $className)
8390
}
8491
}
8592

86-
8793
return $tagList;
8894
}
8995

@@ -166,7 +172,9 @@ protected function getLinkObjectColumnListByClass($className)
166172
$columnList = array();
167173
foreach ($this->getLinkProperties($className) as $property) {
168174
/* @var $property LightMetaProperty */
169-
$columnList[$property->getColumnName()] = $property->getClassName();
175+
if ($property->getRelationId() == MetaRelation::ONE_TO_ONE || $property->getName() == 'id') {
176+
$columnList[$property->getColumnName()] = $property->getClassName();
177+
}
170178
}
171179
$result[$className] = $columnList;
172180
}
@@ -206,10 +214,12 @@ protected function getLinkProperties($className) {
206214
);
207215
} elseif ($property instanceof LightMetaProperty) {
208216
switch ($property->getType()) {
209-
case 'identifierList':
210217
case 'identifier':
218+
case 'identifierList':
211219
case 'integerIdentifier':
220+
case 'integerIdentifierList':
212221
case 'scalarIdentifier':
222+
case 'scalarIdentifierList':
213223
if ($property->getClassName()) {
214224
$propertyList[] = $property;
215225
}

main/UnifiedContainer/UnifiedContainer.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ public function save()
330330

331331
$this->clones = array();
332332
$this->syncClones();
333+
$this->parent->dao()->uncacheById($this->getParentObject()->getId());
333334
$this->dao->uncacheLists();
334335

335336
return $this;

0 commit comments

Comments
 (0)