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:376506browse

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

Major Update


##Improved the parsing mechanism of fetchSql

Introduced a separate

Fetch The class handles the fetchSql method separately to ensure that the return type of the Query class query method is not affected by fetchSql.

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/all The query method is unified into the find/select method;

  • Cancel the

    fetchPdo method and return the PDO object uniformly using the pdo query method;

  • Abandoned

    resultset_typeConfiguration uniformly uses the fetchCollection method;

  • Cancel the

    readMaster method and uniformly uses the master method;

  • Model

    save method 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

fetchArray method, 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

DateTime class 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

dateTimeFormat format.

The model adds schema attribute

The model adds

schema attribute 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 using optimize: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

    #Query class (can be replaced by the pdo method); the

  • Query

    class get/all/getOrFail/allOrFail method;

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

    where parameter; the readMaster method of the

  • Query class and model class , this method cannot be used normally under swoole (manually call the master method 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 the setInc

    and
  • setDec
  • methods

    of the model class

  • Improve the acquisition of model field information

  • Cancel the model and the readMaster method of the Db class

  • Improve parameter binding type retrieval

  • Query class addedfetchArray method supports model query return array type

  • Automatic writing of time fields is changed to use the DateTime class, which supports microsecond data

  • Improved validation class extended validation Do not check whether require

  • Improve queryCURDmethod

  • Correction model output

  • ImprovementupdateMethod

  • CorrectioninsertGetIdMethod

  • CorrectiongetFieldTypeMethod

  • Improvementthink schema Directive

  • 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 used find/selectMethodCancelfetchPdo

    Method
  • Fix the limit

    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 programmingNext article:How to learn programming