Pheasant\DomainObject::import PHP Method

import() public static method

Creates and saves a array or arrays as domain objects
public static import ( $records ) : array
return array of saved domain objects
    public static function import($records)
    {
        $objects = array();
        $className = get_called_class();
        $defaults = self::schema()->defaults();
        foreach ($records as $record) {
            $objects[] = $className::fromArray()->load(array_merge($defaults, $record))->markSaved(false)->save();
        }
        return $objects;
    }