Home>Article> ThinkPHP5.2 releases Beta2 version - unifying and streamlining a large number of usages

ThinkPHP5.2 releases Beta2 version - unifying and streamlining a large number of usages

藏色散人
藏色散人 forward
2018-11-26 16:57:37 6401browse

After 20 days of improvement and testing, the secondBetatest version of ThinkPHP5.2 has been released. This time, the processing mechanism of thefetchSqlmethod is mainly improved, and many query usages are unified and simplified.

Major Update


##Improved the parsing mechanism of fetchSql

Introduced a separate

FetchThe class handles thefetchSqlmethod separately to ensure that the return type of theQueryclass query method is not affected byfetchSql.

Unify and simplify query usage

This test version unifies and streamlines many query usages, so that you will not have another query It solves the problem of multiple usages of functions and facilitates the formulation of team norms.

  • get/allThe query method is unified into thefind/selectmethod;

  • Cancel the

    fetchPdomethod and return thePDOobject uniformly using thepdoquery method;

  • Abandoned

    resultset_typeConfiguration uniformly uses thefetchCollectionmethod;

  • Cancel the

    readMastermethod and uniformly uses themastermethod;

  • Model

    savemethod does not support incoming conditions, unified query and update method calls;

  • Cancel

    db/modelAssistant function, unified use of class calls;

AddedfetchArrayMethod

If model query is used, you can now call the

fetchArraymethod, and the query result will be Array data is always returned. Facilitates the data transfer of some statistical charts.

Use the DateTime class for time field writing instead

Use the

DateTimeclass for automatic operation of time fields, supporting micro Second-level time records provide higher-precision system time records.

You only need to set the decimal precision of the time field in the data table to automatically record. If you need to output microsecond precision data, set the

dateTimeFormatformat.

The model adds schema attribute

The model adds

schemaattribute support, which is used to define the fields and types of the corresponding data table information, and supports the use of PHP variable type definitions. After defining this attribute, you can improve query performance and automatically identify the parameter binding type of the field without usingoptimize:schema.

The type attribute of the model is only used to set data table fields for automatic type conversion.

Support application of public function files

In multi-application mode, support loading of application public function files.

Automatic recognition of multiple entry files

#If the application name is not specified in the application entry file, the current entry file can be automatically identified when the entry file is accessed Application Name. By default, the file name of the current application entry will be used as the application name.

Some methods are no longer supported

The following usages are no longer supported due to practicality or simplification considerations:

## The
    fetchPdo
  • method of the

    #Queryclass (can be replaced by the pdo method); the

  • Query

    classget/all/getOrFail/allOrFailmethod;

  • ## of the model class The #save
  • method no longer supports the

    whereparameter; thereadMastermethod of the

  • Queryclass and model class , this method cannot be used normally underswoole(manually call themastermethod if necessary);setInc# of the

  • model class ## and
  • setDec

    methods;database’s

    resultset_type
  • setting
  • (call if necessary

    fetchCollection
  • method);

db
    Helper function (use
  • Db

    class static method instead);

  • Update Log

##Improve

join
method
    table
  • Parameter parsing

    Abandonedsave

    method
  • where
  • Parameters

    Cancel thesetInc

    and
  • setDec
  • methods

    of the model class

  • Improve the acquisition of model field information

  • Cancel the model and thereadMastermethod of theDbclass

  • Improve parameter binding type retrieval

  • Queryclass addedfetchArraymethod supports model query return array type

  • Automatic writing of time fields is changed to use theDateTimeclass, which supports microsecond data

  • Improved validation class extended validation Do not check whetherrequire

  • Improve queryCURDmethod

  • Correction model output

  • ImprovementupdateMethod

  • CorrectioninsertGetIdMethod

  • CorrectiongetFieldTypeMethod

  • ImprovementthinkschemaDirective

  • Improve cache and log path acquisition

  • DeletedbAssistant function Correct several assistant functions

  • BuilderClassselectMethod adds a second parameter

  • Cancelresultset_typeSet

  • Correction of dynamic query methodfetchsqlProcessing

  • Improve automatic identification of multi-application entry files

  • ##Correction

    serverReturn type of method

  • Multiple application mode allows loading of public function files

  • Correct routing class

    getBindMethod

  • ##Improvement
  • session

    Configuration parameters

    ##Correction of resource routing
  • Improvement
  • console
  • Class

    Correction
  • make
  • Command

    Improvement Controller
  • assign
  • Method

    Correction
  • Cookie
  • Class

    ##Correction

    request
  • Class
  • Correction

    console
  • Debug driver
  • Cancel the

    get
  • /# of the
  • Query

    class ##allMethods are uniformly usedfind/selectMethodCancelfetchPdo

    Method
  • Fix thelimit

    parameter of
  • insertall
  • ##Improve errors in strict mode

  • Improvement
  • fetchSql

    Method added

    Fetch
  • Object
Statement:
This article is reproduced at:ThinkPHP官方博客. If there is any infringement, please contact admin@php.cn delete
Previous article:How to learn programming Next article:How to learn programming