@param array $data Arreglo asociativo de los campos a insertar del registro

@return int Filas afectadas
976730
protected function _insert(array $data = array())
    {
        if (!is_null($this->_table)) {
            $this->_affectedRows = $this->_db->insert($this->_table, $data);
            if ($this->_affectedRows > 0) {
                $this->id = $this->_db->lastInsertId();
            }
            return $this->_affectedRows;
        }
    }
208204
protected static function getFirstRow(array $data)
    {
        if (empty($data)) {
            throw new \InvalidArgumentException('Empty data.');
        }

        list($first) = $data;

        if (!is_array($first)) {
            throw new \InvalidArgumentException('$data is not an array of array.');
        }

        return $first;
    }
1089689
public function getWithMulti(array $data) {
        $results = $this->getQueryResults($data);
        return $this->buildRelation($data, $results);
    }
227168
public function fill(array $data)
    {
        foreach ($data as $key => &$row) {
            $this->original = $value = Arr::get($row, $this->name);

            $value = $this->htmlEntityEncode($value);

            Arr::set($row, $this->name, $value);

            if ($this->isDefinedColumn()) {
                $this->useDefinedColumn();
            }

            if ($this->hasDisplayCallbacks()) {
                $value = $this->callDisplayCallbacks($this->original, $key);
                Arr::set($row, $this->name, $value);
            }
        }

        return $data;
    }
495472
public function updateTranslation(array $data)
    {
        $translations = $this->translations()->where([
            'record_id'     => $this->id,
            'language_code' => array_get($data, 'language_code'),
        ])->first();

        if (is_null($translations))
            $translations = $this->translations()->create($data);
        else
            $translations->update($data);

        return $translations;
    }
140702
public function getIdentifyingValues(array $data)
    {
        $keys = array();

        foreach ($this->getIdentifyingProperties() as $key) {
            if ($key->isMaterializable($data)) {
                $keys[$key->getName()] = $key->materialize($data, null);
            }
        }

        return $keys;
    }
1131829
public function add($data = [])
    {
        $insertId = $this->db->insert($data)->into($this->table)->execute(FALSE);

        return $insertId;
    }
578464
protected function getMemberFromData(array $data)
    {
        if (!empty($data['Email'])) {
            $uniqueIdentifier = Member::config()->get('unique_identifier_field');
            return Member::get()->filter([$uniqueIdentifier => $data['Email']])->first();
        }
    }
1330376
public function create(array $data)
    {
        $user = User::create([
            'name'                  => $data['name'],
            'email'                 => $data['email'],
            'password'              => bcrypt($data['password']),
            'birthday_at'           => $data['birthday_at'],
            'locale'                => $data['locale'],
            'gender'                => $data['gender'],
            'city'                  => $data['city'],
            'about'                 => $data['about'],
            'profession'            => $data['profession'],
            'hobbies'               => $data['hobbies'],
            'homepage'              => $data['homepage'],
            'skype'                 => $data['skype'],
            'facebook'              => $data['facebook'],
            'twitter'               => $data['twitter'],
            'main_character'        => $data['main_character'],
            'main_guild'            => $data['main_guild'],
            'favorite_race'         => $data['favorite_race'],
            'favorite_spec'         => $data['favorite_spec'],
            'favorite_instance'     => $data['favorite_instance'],
            'favorite_battleground' => $data['favorite_battleground'],
        ]);

        return $user;
    }
602095
protected function prepareInsertData(array $data)
    {
        $dbData       = [];
        $extraColumns = $this->extraColumns ? $this->extraColumns : [];

        foreach ($data as $key => $value) {
            $dbData[] = array_merge($extraColumns, [
                $this->keyColumn   => $key,
                $this->valueColumn => $value,
            ]);
        }

        return $dbData;
    }
254752
protected function getCountCommon($data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select(
            [
                $this->tableAlias . '.id',
                $this->tableAlias . '.blog_id',
                'b.label blog_label',
                $this->tableAlias . '.slug',
                $this->tableAlias . '.title',
                $this->tableAlias . '.image_id',
                $this->tableAlias . '.excerpt',
                $this->tableAlias . '.seo_title',
                $this->tableAlias . '.seo_description',
                $this->tableAlias . '.seo_keywords',
                $this->tableAlias . '.is_published',
                $this->tableAlias . '.is_deleted',
                $this->tableAlias . '.created',
                $this->tableAlias . '.created_by',
                $this->tableAlias . '.modified',
                $this->tableAlias . '.modified_by',
                $this->tableAlias . '.published',
                $this->tableAlias . '.comments_enabled',
                $this->tableAlias . '.comments_expire',
                $this->tableAlias . '.type',
                $this->tableAlias . '.audio_url',
                $this->tableAlias . '.video_url',
                'u.first_name',
                'u.last_name',
                'ue.email',
                'u.profile_img',
                'u.gender',
            ]
        );

        $oDb->join(NAILS_DB_PREFIX . 'blog b', $this->tableAlias . '.blog_id = b.id', 'LEFT');
        $oDb->join(NAILS_DB_PREFIX . 'user u', $this->tableAlias . '.modified_by = u.id', 'LEFT');
        $oDb->join(NAILS_DB_PREFIX . 'user_email ue', 'ue.user_id = u.id AND ue.is_primary = 1', 'LEFT');

        // --------------------------------------------------------------------------

        if (!empty($data['include_body'])) {
            $oDb->select($this->tableAlias . '.body');
        }

        // --------------------------------------------------------------------------

        if (!empty($data['keywords'])) {

            if (empty($data['or_like'])) {

                $data['or_like'] = [];
            }

            $data['or_like'][] = [
                'column' => $this->tableAlias . '.title',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.excerpt',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.body',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.seo_description',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.seo_keywords',
                'value'  => $data['keywords'],
            ];
        }

        // --------------------------------------------------------------------------

        parent::getCountCommon($data);
    }
347321
public function add(array $data)
    {
        $result = null;
        $this->hook->attach('category.group.add.before', $data, $result, $this);

        if (isset($result)) {
            return (int) $result;
        }

        $result = $data['category_group_id'] = $this->db->insert('category_group', $data);

        $this->setTranslations($data, $this->translation_entity, 'category_group', false);

        $this->hook->attach('category.group.add.after', $data, $result, $this);
        return (int) $result;
    }
160963
public function insert($data)
    {
        $row = $this->getTable()->insert($data);
        if (!$row instanceof IRow) {
            return $row;
        }

        if ($this->auditLogRepository) {
            $to = $this->filterValues($this->excludeColumns((array)$data));

            $data = [
                'version' => '1',
                'from' => [],
                'to' => $to,
            ];
            $this->pushAuditLog(AuditLogRepository::OPERATION_CREATE, $row->getSignature(), $data);
        }

        return $row;
    }
1191670
protected function getLengths(array $data)
    {
        for ($i = 0; $i < $this->columns; $i++) {
            $this->maxLength[$i] = 0;
            foreach ($this->headers as $field) {
                $field = strip_tags($field);
                if (strlen($field) > $this->maxLength[$i]) {
                    $this->maxLength[$i] = strlen($field);
                }
            }
        }

        foreach ($data as $row) {
            $i = 0;
            foreach ($row as $field) {
                $field = strip_tags($field);
                if (strlen($field) > $this->maxLength[$i]) {
                    $this->maxLength[$i] = strlen($field);
                }
                $i++;
            }
        }
    }
71362
public function getMessageRecord(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_MESSAGE_RECORD_GET_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'] ? $result['recordlist'] : false;
    }
547543
public function countAll($data)
    {
        $this->getCountCommonEmail($data);
        $oDb = Factory::service('Database');
        return $oDb->count_all_results($this->sTable . ' ' . $this->sTableAlias);
    }
447302
public static function insert(array $data)
    {
        $self = static::getInstance();

        $data = static::filterColumns($data);

        if (!\count($data)) {
            throw new DbException(
                "Invalid field names of table `{$self->name}`. Please check use of `insert()` method"
            );
        }

        $table = DbProxy::quoteIdentifier($self->name);

        $sql = "INSERT INTO $table SET " . implode(',', self::prepareStatement($data));
        $result = DbProxy::query($sql, array_values($data));
        if (!$result) {
            return null;
        }

        /**
         * If a sequence name was not specified for the name parameter, PDO::lastInsertId()
         * returns a string representing the row ID of the last row that was inserted into the database.
         *
         * If a sequence name was specified for the name parameter, PDO::lastInsertId()
         * returns a string representing the last value retrieved from the specified sequence object.
         *
         * If the PDO driver does not support this capability, PDO::lastInsertId() triggers an IM001 SQLSTATE.
         */
        return DbProxy::handler()->lastInsertId($self->sequence);
    }