|
@@ 1630-1654 (lines=25) @@
|
| 1627 |
|
*/ |
| 1628 |
|
private function deleteRemovedRelations($articleId, $product) |
| 1629 |
|
{ |
| 1630 |
|
if (count($product->related) > 0) { |
| 1631 |
|
$this->manager->getConnection()->executeQuery( |
| 1632 |
|
'DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND related_article_local_id NOT IN (?) AND relationship_type = ?', |
| 1633 |
|
[$articleId, $product->shopId, $product->related, self::RELATION_TYPE_RELATED], |
| 1634 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY, \PDO::PARAM_STR] |
| 1635 |
|
); |
| 1636 |
|
|
| 1637 |
|
$oldRelatedIds = $this->manager->getConnection()->executeQuery( |
| 1638 |
|
'SELECT ar.id |
| 1639 |
|
FROM s_articles_relationships AS ar |
| 1640 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1641 |
|
WHERE ar.articleID = ? AND ci.shop_id = ? AND ci.source_id NOT IN (?)', |
| 1642 |
|
[$articleId, $product->shopId, $product->related], |
| 1643 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY] |
| 1644 |
|
) |
| 1645 |
|
->fetchAll(\PDO::FETCH_COLUMN); |
| 1646 |
|
} else { |
| 1647 |
|
$this->manager->getConnection()->executeQuery( |
| 1648 |
|
'DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND relationship_type = ?', |
| 1649 |
|
[$articleId, $product->shopId, self::RELATION_TYPE_RELATED] |
| 1650 |
|
); |
| 1651 |
|
|
| 1652 |
|
$oldRelatedIds = $this->manager->getConnection()->executeQuery( |
| 1653 |
|
'SELECT ar.id |
| 1654 |
|
FROM s_articles_relationships AS ar |
| 1655 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1656 |
|
WHERE ar.articleID = ? AND ci.shop_id = ?', |
| 1657 |
|
[$articleId, $product->shopId] |
|
@@ 1668-1692 (lines=25) @@
|
| 1665 |
|
[\Doctrine\DBAL\Connection::PARAM_INT_ARRAY] |
| 1666 |
|
); |
| 1667 |
|
|
| 1668 |
|
if (count($product->similar) > 0) { |
| 1669 |
|
$this->manager->getConnection()->executeQuery( |
| 1670 |
|
'DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND related_article_local_id NOT IN (?) AND relationship_type = ?', |
| 1671 |
|
[$articleId, $product->shopId, $product->similar, self::RELATION_TYPE_SIMILAR], |
| 1672 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY, \PDO::PARAM_STR] |
| 1673 |
|
); |
| 1674 |
|
|
| 1675 |
|
$oldSimilarIds = $this->manager->getConnection()->executeQuery( |
| 1676 |
|
'SELECT ar.id |
| 1677 |
|
FROM s_articles_similar AS ar |
| 1678 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1679 |
|
WHERE ar.articleID = ? AND ci.shop_id = ? AND ci.source_id NOT IN (?)', |
| 1680 |
|
[$articleId, $product->shopId, $product->similar], |
| 1681 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY] |
| 1682 |
|
) |
| 1683 |
|
->fetchAll(\PDO::FETCH_COLUMN); |
| 1684 |
|
} else { |
| 1685 |
|
$this->manager->getConnection()->executeQuery( |
| 1686 |
|
'DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND relationship_type = ?', |
| 1687 |
|
[$articleId, $product->shopId, self::RELATION_TYPE_SIMILAR] |
| 1688 |
|
); |
| 1689 |
|
|
| 1690 |
|
$oldSimilarIds = $this->manager->getConnection()->executeQuery( |
| 1691 |
|
'SELECT ar.id |
| 1692 |
|
FROM s_articles_similar AS ar |
| 1693 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1694 |
|
WHERE ar.articleID = ? AND ci.shop_id = ?', |
| 1695 |
|
[$articleId, $product->shopId] |