Beispiel #1
0
 public function prepareRow(Row $row)
 {
     // do my row mods here..
     // e.g.
     $temp_title = $row->getSourceProperty("title");
     $row->setSourceProperty("title", strtoupper($temp_title));
     return parent::prepareRow($row);
     // TODO: Change the autogenerated stub
 }
 public function prepareRow(Row $row)
 {
     // do my row mods here..
     // Bail if this is a non-published recipe
     //$status = $row->getSourceProperty("status");
     //if ($status != 'Published') {
     //  return FALSE;
     //}
     //$title = $row->getSourceProperty("title");
     //$photos = $row->getSourceProperty("photos");
     //$photos = $this->preparePhotos($title, $photos);
     //$row->setSourceProperty("uri", $photos);
     // set created to now..
     return parent::prepareRow($row);
 }
 public function prepareRow(Row $row)
 {
     // do my row mods here..
     $title = $row->getSourceProperty("title");
     $str = sprintf("Processing: %s", $title);
     drush_print_r($str);
     // Bail if this is a non-published recipe
     $status = $row->getSourceProperty("status");
     if ($status != 'Published') {
         return FALSE;
         // Don't migrate non-published recipes.
     }
     $nutrition = $row->getSourceProperty("basic_nutrition");
     $nutrition_string = $this->prepareNutritionInfo($nutrition);
     $row->setSourceProperty("basic_nutrition", $nutrition_string);
     $ingredients = $row->getSourceProperty("ingredients");
     $ingredients = $this->prepareIngredients($ingredients);
     $row->setSourceProperty("ingredients", $ingredients);
     $title = $row->getSourceProperty("title");
     $photos = $row->getSourceProperty("photos");
     $photos = $this->preparePhotos($title, $photos);
     $row->setSourceProperty("photos", $photos);
     return parent::prepareRow($row);
 }
 public function prepareRow(Row $row)
 {
     // Perform source row modification here.
     // Bail if this is a non-published store
     $status = $row->getSourceProperty("status");
     if ($status != 'OPEN') {
         return FALSE;
     }
     $geo = $row->getSourceProperty("geo_location");
     $x = $geo['coordinates'][0];
     $y = $geo['coordinates'][1];
     $row->setSourceProperty("geox", $x);
     $row->setSourceProperty("geoy", $y);
     $hours = $row->getSourceProperty("hours");
     $row->setSourceProperty("hours", ltrim($hours));
     $country = $row->getSourceProperty("country");
     $country = $this->getIsoCountryCode($country);
     $row->setSourceProperty("country", $country);
     $state = $row->getSourceProperty("state");
     if ($country == "US") {
         $state = $this->getUsaStateCode($state);
         $row->setSourceProperty("state", $state);
     }
     $facebook = $row->getSourceProperty("facebook");
     if (!empty($facebook)) {
         $facebook = "https://www.facebook.com/" . ltrim(trim($facebook));
     }
     $row->setSourceProperty("facebook", $facebook);
     $has_alcohol = $row->getSourceProperty("has_alcohol");
     if (empty($has_alcohol)) {
         $has_alcohol = 0;
         $row->setSourceProperty("has_alcohol", $has_alcohol);
     }
     //TODO: "states" not in USA - ie UK & Canada
     //TODO: lookup region eg. NE in taxonomy and store region actual taxonomy in field_store_region
     $tlc = $row->getSourceProperty("tlc");
     $name = $row->getSourceProperty("name");
     $country = $row->getSourceProperty("country");
     $state = $row->getSourceProperty("state");
     $has_alcohol = $row->getSourceProperty("has_alcohol");
     $str = sprintf("%s: %s %s %s alc:%s", $tlc, $name, $state, $country, $has_alcohol);
     drush_print_r($str);
     return parent::prepareRow($row);
 }
 public function prepareRow(Row $row)
 {
     // do my row mods here..
     // Bail if this is a non-published recipe
     //$status = $row->getSourceProperty("status");
     //if ($status != 'Published') {
     //  return FALSE;
     //}
     //$filename = $row->getSourceProperty("filename") ;
     //$str = sprintf("Processing: %s", $filename);
     //drush_print_r($str);
     $uri = $row->getSourceProperty("uri");
     $str = sprintf("Processing: %s", $uri);
     drush_print_r($str);
     return parent::prepareRow($row);
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $row->setSourceProperty('uid', 0);
     $email = $row->getSourceProperty('email');
     $user = $this->entityQuery->get('user')->condition('mail', $email)->execute();
     if ($user) {
         $row->setSourceProperty('uid', key($user));
     }
     return parent::prepareRow($row);
 }