Elgg\Mocks\Database\EntityTable::addInsertQuerySpecs PHP Method

addInsertQuerySpecs() public method

Query specs for INSERT operations
public addInsertQuerySpecs ( stdClass $row ) : void
$row stdClass Data row
return void
    public function addInsertQuerySpecs(stdClass $row)
    {
        $dbprefix = elgg_get_config('dbprefix');
        $sql = "\n\t\t\tINSERT INTO {$dbprefix}entities\n\t\t\t(type, subtype, owner_guid, container_guid,\n\t\t\t\taccess_id, time_created, time_updated, last_action)\n\t\t\tVALUES\n\t\t\t(:type, :subtype_id, :owner_guid, :container_guid,\n\t\t\t\t:access_id, :time_created, :time_updated, :last_action)\n\t\t";
        $this->query_specs[$row->guid][] = _elgg_services()->db->addQuerySpec(['sql' => $sql, 'params' => [':type' => 'object', ':subtype_id' => $row->subtype, ':owner_guid' => $row->owner_guid, ':container_guid' => $row->container_guid, ':access_id' => $row->access_id, ':time_created' => $row->time_created, ':time_updated' => $row->time_updated, ':last_action' => $row->last_action], 'insert_id' => $row->guid]);
        // Populate objects table
        // @todo: move to objects table mock
        if ($row->type == 'object') {
            $sql = "\n\t\t\t\tINSERT INTO {$dbprefix}objects_entity\n\t\t\t\t(guid, title, description)\n\t\t\t\tVALUES\n\t\t\t\t(:guid, :title, :description)\n\t\t\t";
            $this->query_specs[$row->guid][] = _elgg_services()->db->addQuerySpec(['sql' => $sql, 'params' => [':guid' => $row->guid, ':title' => $row->title, ':description' => $row->description], 'insert_id' => $row->guid]);
        }
    }