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

        $set = DataList::create($this->subjectClass);
        if ($this->parentObj) {
            $set = $set->filter(array(
                $this->parentField => $this->parentObj->ID
            ));
        }
        foreach ($set as $obj) {
            $obj->fill(array(
                'only_empty' => $this->onlyEmpty,
                'include_relations' => $this->includeRelations,
                'download_images' => $this->downloadImages,
                'relation_create_limit' => $this->relationCreateLimit
            ));

            if ($this->isSiteTree) {
                $obj->write();
                $obj->publish("Stage", "Live");
            }

            $this->log("Updated {$this->subjectClass} \"{$obj->getTitle()}\".");
        }
    }
public function populate()
    {
        if ($this->parentIdentifier && !$this->parentObj) {
            $this->determineParentObj();
        }

        $set = DataList::create($this->subjectClass);
        if ($this->parentObj) {
            $set = $set->filter(array(
                $this->parentField => $this->parentObj->ID
            ));
        }
        foreach ($set as $obj) {
            $obj->fill(array(
                'only_empty' => $this->onlyEmpty,
                'include_relations' => $this->includeRelations,
                'download_images' => $this->downloadImages,
                'relation_create_limit' => $this->relationCreateLimit
            ));

            if ($this->isSiteTree) {
                $obj->write();
                $obj->publish("Stage", "Live");
            }

            $this->log("Updated {$this->subjectClass} \"{$obj->getTitle()}\".");
        }
    }
public function populate ( ) { if ( $ this -> parentIdentifier && ! $ this -> parentObj ) { $ this -> determineParentObj ( ) ; } $ set = DataList :: create ( $ this -> subjectClass ) ; if ( $ this -> parentObj ) { $ set = $ set -> filter ( array ( $ this -> parentField => $ this -> parentObj -> ID ) ) ; } foreach ( $ set as $ obj ) { $ obj -> fill ( array ( 'only_empty' => $ this -> onlyEmpty , 'include_relations' => $ this -> includeRelations , 'download_images' => $ this -> downloadImages , 'relation_create_limit' => $ this -> relationCreateLimit ) ) ; if ( $ this -> isSiteTree ) { $ obj -> write ( ) ; $ obj -> publish ( "Stage" , "Live" ) ; } $ this -> log ( "Updated {$this->subjectClass} \"{$obj->getTitle()}\"." ) ; } }
Populates existing records with mock data
Populates existing records with mock data