Skip to content

Commit

Permalink
check to see if we have the video URL imported
Browse files Browse the repository at this point in the history
  • Loading branch information
emarchak committed Apr 15, 2016
1 parent be0cc54 commit d4e8098
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/ImportService.php
Expand Up @@ -110,7 +110,7 @@ public function import() {
$video_url = $this->getVideoURl($results[$i]);

// Check to see if we have the video url imported.
$is_new = TRUE;
$is_new = $this->uniqueField('field_video', $video_url);
// If we don't have it imported, import it.
if ($is_new) {}

Expand Down Expand Up @@ -166,4 +166,21 @@ protected function getVideoURL($item = []) {
return $video_url;
}

/**
* Check if file is unique among nodes.
*
* @param string $field
* @param string $value
* @return bool
*/
protected function uniqueField($field = '', $value = '') {
$result = $this->entity_query->get('node')
->condition($field, $value, '=')
->execute();

$unique = empty($result);

return $unique;
}

}

0 comments on commit d4e8098

Please sign in to comment.