You are here

public function MigrateSourceYaml::getNextRow in Migrate Source YAML 7

Get the next record.

Use PHP native array functionality to return the item that the internal array pointer is currently at and then advance the pointer to the next record.

Return value

NULL|object NULL if the last item has been reached otherwise an object representing the current row.

File

includes/MigrateSourceYaml.inc, line 91
Contains MigrateSourceYaml.

Class

MigrateSourceYaml
Migrate source class to import from a YAML file.

Code

public function getNextRow() {
  if ($item = current($this->data)) {

    // Advance the internal pointer of the array.
    next($this->data);

    // Cast the item from an array into an StdClass object.
    return (object) $item;
  }
  return NULL;
}