BeforeInsert callback.
@param Array $args The new data is in $args[1]
@return Void
771816
public function beforeInsert(&$args) {
        $model = &$args[0];
        $data  = &$args[1];
        $this->validate($data, $model);
    }
326314
public function beforeInsert(array &$args) {
        $data = &$args[1];
        if (!$output = $this->_fillFields($data)) {
            throw new Garp_Model_Behavior_Exception(self::EXCEPTION_NO_API_DATA);
        }
        $data = $output + $data;
    }
973462
public function afterInsert(&$args) {
        $model = $args[0];
        $data = $args[1];
        $this->afterSave($model, $data);
    }
732920
public function dump(...$args)
    {
        $values = $this->handleValues($args);

        $data = (new VarCloner())->cloneVar($values);

        if ($this->connection->write($data) === false) {
            dump($values);
        }
    }
189843
private function insertData($callback = null): void
    {
        $this->expression->evaluateExpressions(
            $this->configEntities[$this->entity]['pre_actions']
        );

        for ($rowNum = 1; $rowNum <= $this->limit; $rowNum++) {
            // Call the right method according to the mode
            $this->{$this->insertMode[$this->mode]}($rowNum);

            if (!is_null($callback)) {
                $callback($rowNum);
            }
        }

        // Run a final method if defined
        if ($this->mode === 'batch') {
            $this->loadDataInBatch('insert');
        }

        $this->expression->evaluateExpressions(
            $this->configEntities[$this->entity]['post_actions']
        );
    }
1358186
public function afterUpdate(&$args) {
        $model        = &$args[0];
        $affectedRows = &$args[1];
        $data         = &$args[2];
        $where        = &$args[3];

        $pks = $this->_getPrimaryKeysOfAffectedRows($model, $where);
        $this->_afterSave($model, $pks);
    }
1153465
public function beforeInsert(array &$args) {
        $data  = &$args[1];

        $auth = Garp_Auth::getInstance();
        if ($auth->isLoggedIn()) {
            $userData = $auth->getUserData();
            $data[self::_AUTHOR_COLUMN] = $userData['id'];
        }
    }
1244854
public function init($args)
    {
        if (empty($args)) {
            return;
        }

        // Special case
        if (is_bool($args) && $args) {
            $args = $this->available;
        }

        // Iterate on all
        foreach ($args as $plugin => $settings) {
            $plugin = strtolower($plugin);

            if (!array_key_exists($plugin, $this->available)) {
                continue;
            }

            $plugin = str_replace('_', '-', $plugin);

            $function = Helpers::toFunctionFormat($plugin);
            $function = 'plugin'.ucfirst($function);
            $this->$function($settings);
        }
    }
703071
public function addError(...$args) {
        $args = func_get_args();
        if(func_num_args()>2){
            foreach ($args as $error) {
                array_push($this->errors, $error);
            }
        } else {
            if(func_get_args()==1) {
                $this->errors[] = $args[0];
            } else {
                $this->errors[$args[0]] = $args[1];
            }
        }
    }
193365
public function update( array $args ) {

		/** @var array $EZSQL_ERROR */
		global $EZSQL_ERROR;
		if ( empty( $EZSQL_ERROR ) ) {
			return new NullLog();
		}

		$errors  = $EZSQL_ERROR;
		$last    = end( $errors );
		$context = [ 'last_query' => $last[ 'query' ], 'errors' => $errors, ];

		return new Error( $last[ 'error_str' ], Channels::DB, $context );
	}
1230702
public function beforeInsert(array &$args) {
        $data = &$args[1];
        if (empty($data[$this->_fields['createdField']])) {
            $data[$this->_fields['createdField']]  = date(self::DATE_FORMAT);
        }
        if (empty($data[$this->_fields['modifiedField']])) {
            $data[$this->_fields['modifiedField']] = date(self::DATE_FORMAT);
        }
    }
815042
protected function setArgument($arg)
    {
        if ($this->checkDiscription($arg)) {
            $this->advanceArg($arg);
        } else {
            $this->simpleArg($arg);
        }
    }
755990
protected function init_args($args)
    {
        parent::init_args($args);

        $this->env = $this->get_env_for_write_or_fail();
        $api = new Salts();

        try {
            $this->salts = $api->collect();
        } catch (Exception $e) {
            WP_CLI::error($e->getMessage());
        }
    }
490121
public function beforeFetch(&$args) {
        $model = &$args[0];
        $select = &$args[1];

        $isCms = $model->isCmsContext();
        if (!$isCms && !$this->_forceI18nOutput) {
            return;
        }
        $this->_modifySearchQuery($select, $model);
        $this->bindWithI18nModel($model);
    }
1252264
public function onFlush(OnFlushEventArgs $args): void
    {
        $uow = $args->getEntityManager()->getUnitOfWork();
        $collection = $this->getAllCollections($uow);
        $invalidates = [];

        // check all scheduled insertions
        foreach ($collection as $object) {
            $invalidate = $this->invalidateCache($uow, $object);

            if (\is_string($invalidate)) {
                $invalidates[] = $invalidate;
            }
        }

        $this->flushCache(array_unique($invalidates));
    }
1292882
public function preUpdate(PreUpdateEventArgs $args)
    {
        $entity = $args->getObject();

        /** @var object $entity */
        if (true === in_array(EditableEntityTrait::class, class_uses($entity))) {
            $entity->setUpdated(new DateTime());
        }
    }
60809
public function insert($arguments = [])
    {
        $ar = null;
        $ar = self::cyrus();
        /*
         | Trigger Before create events if
         | defined by user into model class
         |
         */
        $this->triggerEvent('beforeCreate');

        // Build Sql Query and prepare it
        $sql = $this->getInsertQuery(strtoupper(__FUNCTION__), $ar, $arguments);

        try {
            $statement = $this->resolveConnection()->prepare($sql);
            static::$queries[] = $statement->queryString;

            // we will bind all parameters into the statement using execute method
            if ($return = $statement->execute($arguments)) {
                $ar->{$ar->getKeyName()} = (int) $this->resolveConnection()->lastInsertId();
                /*
                 | Trigger after create events if
                 | defined by user into model class
                 |
                 */
                $this->triggerEvent('afterCreate');

                return $return;
            }
        } catch (PDOException  $exception) {
            throw new \RuntimeException($exception->getMessage());
        }
    }