Skip to content

Latest commit

 

History

History
97 lines (56 loc) · 2.96 KB

UPGRADE.md

File metadata and controls

97 lines (56 loc) · 2.96 KB

UPGRADE TO 4.0.x

  1. data inflating will only happen when using accessor method.

    $book->is_published; // will return the raw value from database. $book->isPublished() // will return Boolean value (true or false)

  2. boolean columns will generate isXXX accessors.

    "published" => "isPublished()" "is_published" => "isPublished()"

  3. BaseModel::load now returns record object instead of returning a Result object:

    $foundBook = Book::load(321);

  4. Replace create with createAndLoad:

    $author = new Author; $author = $author->createAndLoad(array( 'name' => 'Z' , 'email' => 'z@z' , 'identity' => 'z' ));

  5. Fix create and find logics:

  • BaseModel::create now returns Result object directly and don't reload created data to the object itself.
  • BaseModel::load now returns the found record instead of load the data to the object itself.
  1. BaseModel::deflate method is removed.

  2. BaseModel::deflateData method is removed.

  3. BaseModel::getSchema method is now static.

  4. Remove arguments from beforeDelete and afterDelete (the user may get the data from the data object directly)

  5. createOrUpdate is now renamed to updateOrCreate.

  6. BaseModel::load is now static method.

  7. Trigger methods like beforeCreate, beforeUpdate, afterUpdate are moved to BaseRepo.

  8. lockWrite => BaseRepo::writeLock, lockRead => BaseRepo::readLock

  9. Renamed BaseRepo::load to BaseRepo::loadWith.

  10. load is now a generic method for both primary key and conditions in array.

  11. Added BaseRepo::loadByKeys for load with keys.

  12. BaseModel::loadByPrimaryKey and BaseRepo::loadByPrimaryKey are added.

  13. BaseModel::find is removed.

  14. BaseCollection::loadQuery method is now deprecated.

ConfigLoader

  1. LazyRecord\ConfigLoader is now renamed to Maghead\Runtime\Config\FileConfigLoader

  2. FileConfigLoader::load -> ConfigLoader::loadFile as a static method and return Config object.

  3. Simplify data_source config by assumming the default node is "master".

     databases:
       master:
         dsn: ...
    
  • Added columnClassAlias to DeclareSchema, so that we can define uuid column by using:

    $this->column('uuid', 'uuid');

  • Added DeclareSchema::enableHiddenPrimaryKey option for schemas that don't need primary key column.

  • Added BaseRepo::move(BaseRepo $target) method for moving records.

  • Renamed 'schema.loader' to 'schema.finders'

  • Renamed 'getExternalSchemaLoader' to 'loadSchemaFinders'

UPGRADE TO 2.0

  • setData(), getData() were renamed to setStashedData(), getStashedData()
  • column::notNull changed to notNull()
  • Renamed Relationship::order() to Relationship::orderBy()

WIP

  • Rebuild Magsql\Universal\SelectQuery from Relationship with the filter and where.
  • Add a test case for relationship with custom where conditions, filter and order by and group by.

// vim:sw=2:ts=2:sts=2: