|
@@ 1602-1626 (lines=25) @@
|
| 1599 |
|
*/ |
| 1600 |
|
private function deleteRemovedRelations($articleId, $product) |
| 1601 |
|
{ |
| 1602 |
|
if (count($product->related) > 0) { |
| 1603 |
|
$this->manager->getConnection()->executeQuery( |
| 1604 |
|
'DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND related_article_local_id NOT IN (?) AND relationship_type = ?', |
| 1605 |
|
[$articleId, $product->shopId, $product->related, self::RELATION_TYPE_RELATED], |
| 1606 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY, \PDO::PARAM_STR] |
| 1607 |
|
); |
| 1608 |
|
|
| 1609 |
|
$oldRelatedIds = $this->manager->getConnection()->executeQuery( |
| 1610 |
|
'SELECT ar.id |
| 1611 |
|
FROM s_articles_relationships AS ar |
| 1612 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1613 |
|
WHERE ar.articleID = ? AND ci.shop_id = ? AND ci.source_id NOT IN (?)', |
| 1614 |
|
[$articleId, $product->shopId, $product->related], |
| 1615 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY] |
| 1616 |
|
) |
| 1617 |
|
->fetchAll(\PDO::FETCH_COLUMN); |
| 1618 |
|
} else { |
| 1619 |
|
$this->manager->getConnection()->executeQuery( |
| 1620 |
|
'DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND relationship_type = ?', |
| 1621 |
|
[$articleId, $product->shopId, self::RELATION_TYPE_RELATED] |
| 1622 |
|
); |
| 1623 |
|
|
| 1624 |
|
$oldRelatedIds = $this->manager->getConnection()->executeQuery( |
| 1625 |
|
'SELECT ar.id |
| 1626 |
|
FROM s_articles_relationships AS ar |
| 1627 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1628 |
|
WHERE ar.articleID = ? AND ci.shop_id = ?', |
| 1629 |
|
[$articleId, $product->shopId] |
|
@@ 1640-1664 (lines=25) @@
|
| 1637 |
|
[\Doctrine\DBAL\Connection::PARAM_INT_ARRAY] |
| 1638 |
|
); |
| 1639 |
|
|
| 1640 |
|
if (count($product->similar) > 0) { |
| 1641 |
|
$this->manager->getConnection()->executeQuery( |
| 1642 |
|
'DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND related_article_local_id NOT IN (?) AND relationship_type = ?', |
| 1643 |
|
[$articleId, $product->shopId, $product->similar, self::RELATION_TYPE_SIMILAR], |
| 1644 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY, \PDO::PARAM_STR] |
| 1645 |
|
); |
| 1646 |
|
|
| 1647 |
|
$oldSimilarIds = $this->manager->getConnection()->executeQuery( |
| 1648 |
|
'SELECT ar.id |
| 1649 |
|
FROM s_articles_similar AS ar |
| 1650 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1651 |
|
WHERE ar.articleID = ? AND ci.shop_id = ? AND ci.source_id NOT IN (?)', |
| 1652 |
|
[$articleId, $product->shopId, $product->similar], |
| 1653 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY] |
| 1654 |
|
) |
| 1655 |
|
->fetchAll(\PDO::FETCH_COLUMN); |
| 1656 |
|
} else { |
| 1657 |
|
$this->manager->getConnection()->executeQuery( |
| 1658 |
|
'DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND relationship_type = ?', |
| 1659 |
|
[$articleId, $product->shopId, self::RELATION_TYPE_SIMILAR] |
| 1660 |
|
); |
| 1661 |
|
|
| 1662 |
|
$oldSimilarIds = $this->manager->getConnection()->executeQuery( |
| 1663 |
|
'SELECT ar.id |
| 1664 |
|
FROM s_articles_similar AS ar |
| 1665 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1666 |
|
WHERE ar.articleID = ? AND ci.shop_id = ?', |
| 1667 |
|
[$articleId, $product->shopId] |