|
@@ 1580-1604 (lines=25) @@
|
| 1577 |
|
*/ |
| 1578 |
|
private function deleteRemovedRelations($articleId, $product) |
| 1579 |
|
{ |
| 1580 |
|
if (count($product->related) > 0) { |
| 1581 |
|
$this->manager->getConnection()->executeQuery('DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND related_article_local_id NOT IN (?) AND relationship_type = ?', |
| 1582 |
|
[$articleId, $product->shopId, $product->related, self::RELATION_TYPE_RELATED], |
| 1583 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY, \PDO::PARAM_STR]); |
| 1584 |
|
|
| 1585 |
|
$oldRelatedIds = $this->manager->getConnection()->executeQuery( |
| 1586 |
|
'SELECT ar.id |
| 1587 |
|
FROM s_articles_relationships AS ar |
| 1588 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1589 |
|
WHERE ar.articleID = ? AND ci.shop_id = ? AND ci.source_id NOT IN (?)', |
| 1590 |
|
[$articleId, $product->shopId, $product->related], |
| 1591 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY]) |
| 1592 |
|
->fetchAll(\PDO::FETCH_COLUMN); |
| 1593 |
|
} else { |
| 1594 |
|
$this->manager->getConnection()->executeQuery('DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND relationship_type = ?', |
| 1595 |
|
[$articleId, $product->shopId, self::RELATION_TYPE_RELATED]); |
| 1596 |
|
|
| 1597 |
|
$oldRelatedIds = $this->manager->getConnection()->executeQuery( |
| 1598 |
|
'SELECT ar.id |
| 1599 |
|
FROM s_articles_relationships AS ar |
| 1600 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1601 |
|
WHERE ar.articleID = ? AND ci.shop_id = ?', |
| 1602 |
|
[$articleId, $product->shopId]) |
| 1603 |
|
->fetchAll(\PDO::FETCH_COLUMN); |
| 1604 |
|
} |
| 1605 |
|
|
| 1606 |
|
$this->manager->getConnection()->executeQuery('DELETE FROM s_articles_relationships WHERE id IN (?)', |
| 1607 |
|
[$oldRelatedIds], |
|
@@ 1610-1634 (lines=25) @@
|
| 1607 |
|
[$oldRelatedIds], |
| 1608 |
|
[\Doctrine\DBAL\Connection::PARAM_INT_ARRAY]); |
| 1609 |
|
|
| 1610 |
|
if (count($product->similar) > 0) { |
| 1611 |
|
$this->manager->getConnection()->executeQuery('DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND related_article_local_id NOT IN (?) AND relationship_type = ?', |
| 1612 |
|
[$articleId, $product->shopId, $product->similar, self::RELATION_TYPE_SIMILAR], |
| 1613 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY, \PDO::PARAM_STR]); |
| 1614 |
|
|
| 1615 |
|
$oldSimilarIds = $this->manager->getConnection()->executeQuery( |
| 1616 |
|
'SELECT ar.id |
| 1617 |
|
FROM s_articles_similar AS ar |
| 1618 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1619 |
|
WHERE ar.articleID = ? AND ci.shop_id = ? AND ci.source_id NOT IN (?)', |
| 1620 |
|
[$articleId, $product->shopId, $product->similar], |
| 1621 |
|
[\PDO::PARAM_INT, \PDO::PARAM_INT, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY]) |
| 1622 |
|
->fetchAll(\PDO::FETCH_COLUMN); |
| 1623 |
|
} else { |
| 1624 |
|
$this->manager->getConnection()->executeQuery('DELETE FROM s_plugin_connect_article_relations WHERE article_id = ? AND shop_id = ? AND relationship_type = ?', |
| 1625 |
|
[$articleId, $product->shopId, self::RELATION_TYPE_SIMILAR]); |
| 1626 |
|
|
| 1627 |
|
$oldSimilarIds = $this->manager->getConnection()->executeQuery( |
| 1628 |
|
'SELECT ar.id |
| 1629 |
|
FROM s_articles_similar AS ar |
| 1630 |
|
INNER JOIN s_plugin_connect_items AS ci ON ar.relatedarticle = ci.article_id |
| 1631 |
|
WHERE ar.articleID = ? AND ci.shop_id = ?', |
| 1632 |
|
[$articleId, $product->shopId]) |
| 1633 |
|
->fetchAll(\PDO::FETCH_COLUMN); |
| 1634 |
|
} |
| 1635 |
|
|
| 1636 |
|
$this->manager->getConnection()->executeQuery('DELETE FROM s_articles_similar WHERE id IN (?)', |
| 1637 |
|
[$oldSimilarIds], |