public function generate()
    {
        if ($this->parentIdentifier && !$this->parentObj) {
            $this->determineParentObj();
        }


        $i = 0;
        $ids = array();
        $parentField = $this->parentField;
        while ($i < $this->count) {
            $obj = Injector::inst()->create($this->subjectClass);
            if ($this->parentObj) {
                $obj->$parentField = $this->parentObj->ID;
            }
            $obj->fill(array(
                'only_empty' => $this->onlyEmpty,
                'include_relations' => $this->includeRelations,
                'download_images' => $this->downloadImages,
                'relation_create_limit' => $this->relationCreateLimit
            ));
            if ($this->parentObj) {
                $obj->write();
            }
            if ($this->isSiteTree) {
                $ids[] = $obj->write();
                $obj->publish("Stage", "Live");
            }
            $this->log("Created {$this->subjectClass} \"{$obj->getTitle()}\".");
            $i++;
        }

        return $ids;
    }
public function generate()
    {
        if ($this->parentIdentifier && !$this->parentObj) {
            $this->determineParentObj();
        }


        $i = 0;
        $ids = array();
        $parentField = $this->parentField;
        while ($i < $this->count) {
            $obj = Injector::inst()->create($this->subjectClass);
            if ($this->parentObj) {
                $obj->$parentField = $this->parentObj->ID;
            }
            $obj->fill(array(
                'only_empty' => $this->onlyEmpty,
                'include_relations' => $this->includeRelations,
                'download_images' => $this->downloadImages,
                'relation_create_limit' => $this->relationCreateLimit
            ));
            if ($this->parentObj) {
                $obj->write();
            }
            if ($this->isSiteTree) {
                $ids[] = $obj->write();
                $obj->publish("Stage", "Live");
            }
            $this->log("Created {$this->subjectClass} \"{$obj->getTitle()}\".");
            $i++;
        }

        return $ids;
    }
public function generate ( ) { if ( $ this -> parentIdentifier && ! $ this -> parentObj ) { $ this -> determineParentObj ( ) ; } $ i = 0 ; $ ids = array ( ) ; $ parentField = $ this -> parentField ; while ( $ i < $ this -> count ) { $ obj = Injector :: inst ( ) -> create ( $ this -> subjectClass ) ; if ( $ this -> parentObj ) { $ obj -> $ parentField = $ this -> parentObj -> ID ; } $ obj -> fill ( array ( 'only_empty' => $ this -> onlyEmpty , 'include_relations' => $ this -> includeRelations , 'download_images' => $ this -> downloadImages , 'relation_create_limit' => $ this -> relationCreateLimit ) ) ; if ( $ this -> parentObj ) { $ obj -> write ( ) ; } if ( $ this -> isSiteTree ) { $ ids [ ] = $ obj -> write ( ) ; $ obj -> publish ( "Stage" , "Live" ) ; } $ this -> log ( "Created {$this->subjectClass} \"{$obj->getTitle()}\"." ) ; $ i ++ ; } return $ ids ; }
Generates new records for the subject class

@return array A list of the new ids inserted to the table
Generates new records for the subject class