You are here

protected function RelationFeedsProcessor::entityLoad in Relation 7

File

relation_feeds/RelationFeedsProcessor.inc, line 41
Class definition of RelationFeedsProcessor.

Class

RelationFeedsProcessor
Creates relations from feed items.

Code

protected function entityLoad(FeedsSource $source, $rid) {
  if ($this->config['update_existing'] == FEEDS_UPDATE_EXISTING) {
    $relation = relation_load($rid, NULL, TRUE);
  }
  else {

    // We're replacing the existing relation. Only save the absolutely necessary.
    $relation = db_query("SELECT created, rid, vid, relation_type FROM {relation} WHERE rid = :rid", array(
      ':rid' => $rid,
    ))
      ->fetchObject();
    $relation->uid = $this->config['author'];
  }
  return $relation;
}