src/Models/D7Model.php
protected static function internalCreate($fields)
    {
        $model = new static(null, $fields);

        if ($model->onBeforeSave() === false || $model->onBeforeCreate() === false) {
            return false;
        }

        $resultObject = static::instantiateAdapter()->add($model->fields);
        $result = $resultObject->isSuccess();
        if ($result) {
            $model->setId($resultObject->getId());
        }

        $model->setEventErrorsOnFail($resultObject);
        $model->onAfterCreate($result);
        $model->onAfterSave($result);
        $model->throwExceptionOnFail($resultObject);

        return $model;
    }
protected static function internalCreate($fields)
    {
        $model = new static(null, $fields);

        if ($model->onBeforeSave() === false || $model->onBeforeCreate() === false) {
            return false;
        }

        $resultObject = static::instantiateAdapter()->add($model->fields);
        $result = $resultObject->isSuccess();
        if ($result) {
            $model->setId($resultObject->getId());
        }

        $model->setEventErrorsOnFail($resultObject);
        $model->onAfterCreate($result);
        $model->onAfterSave($result);
        $model->throwExceptionOnFail($resultObject);

        return $model;
    }
protected static function internalCreate ( $ fields ) { $ model = new static ( null , $ fields ) ; if ( $ model -> onBeforeSave ( ) === false || $ model -> onBeforeCreate ( ) === false ) { return false ; } $ resultObject = static :: instantiateAdapter ( ) -> add ( $ model -> fields ) ; $ result = $ resultObject -> isSuccess ( ) ; if ( $ result ) { $ model -> setId ( $ resultObject -> getId ( ) ) ; } $ model -> setEventErrorsOnFail ( $ resultObject ) ; $ model -> onAfterCreate ( $ result ) ; $ model -> onAfterSave ( $ result ) ; $ model -> throwExceptionOnFail ( $ resultObject ) ; return $ model ; }
Internal part of create to avoid problems with static and inheritance

@param $fields

@throws ExceptionFromBitrix

@return static|bool
Internal part of create to avoid problems with static and inheritance