コード例 #1
0
 function setShowInRelated($value)
 {
     $select = $this->getReadAdapter()->select()->from($this->wrappedProduct->getSchema()->mappingsTable(), array('count(*)'))->where('entity_id = ' . $this->getId());
     if (0 == $select->query()->fetchColumn() && $value) {
         $this->query(sprintf("\n                    REPLACE INTO\n                    `" . $this->wrappedProduct->getSchema()->mappingsTable() . "`\n                    (\n                    `related`,\n                    `entity_id`\n                    )\n                    VALUES\n                    (\n                    %d,\n                    %d\n                    )\n                    ", 1, (int) $this->getId()));
     }
     $this->query('UPDATE ' . $this->wrappedProduct->getSchema()->mappingsTable() . ' set related = ' . (int) $value . ' where entity_id = ' . (int) $this->getId());
 }