/**
  * Find related to order entity ids for checking of new items in archive
  *
  * @param Enterprise_SalesArchive_Model_Archive $archive
  * @param string $archiveEntity
  * @param array $ids
  * @return array
  */
 public function getRelatedIds($archive, $archiveEntity, $ids)
 {
     $resourceClass = $archive->getEntityModel($archiveEntity);
     if (empty($resourceClass) || empty($ids)) {
         return array();
     }
     /** @var $resource Mage_Sales_Model_Resource_Abstract */
     $resource = Mage::getResourceSingleton($resourceClass);
     $select = $this->_getReadAdapter()->select()->from(array('main_table' => $resource->getMainTable()), 'entity_id')->joinInner(array('order_archive' => $this->getArchiveEntityTable('order')), 'main_table.order_id = order_archive.entity_id', array())->where('main_table.entity_id IN(?)', $ids);
     return $this->_getReadAdapter()->fetchCol($select);
 }