MetaModels\DcGeneral\Events\Table\AbstractAddAllHandler::perform PHP Method

perform() private method

Perform the action.
private perform ( integer $startSort, integer $pid ) : void
$startSort integer The first sort index.
$pid integer The pid.
return void
    private function perform($startSort, $pid)
    {
        $this->loadLanguageFiles();
        // Loop over all attributes now.
        foreach ($this->metaModel->getAttributes() as $attribute) {
            if (!$this->accepts($attribute)) {
                continue;
            }
            $attrId = $attribute->get('id');
            if ($this->knowsAttribute($attribute) || !$this->input->hasValue('attribute_' . $attrId)) {
                continue;
            }
            $data = array_replace_recursive($this->createEmptyDataFor($attribute), array('pid' => $pid, 'sorting' => $startSort, 'tstamp' => time(), 'attr_id' => $attrId));
            $startSort += 128;
            $query = $this->database->prepare('INSERT INTO ' . static::$table . ' %s')->set($data);
            $query->execute();
            $data['id'] = $query->insertId;
            $this->knownAttributes[$attrId] = $data;
        }
    }