Skip to content

Latest commit

 

History

History
629 lines (414 loc) · 26.4 KB

BackwardsCompatibilityBreak.wiki

File metadata and controls

629 lines (414 loc) · 26.4 KB

Table of Contents

Backwards Compatibility Breaks

On this page you will find a list of all breaks in backwards compatibility. Once Flourish becomes stable this will only happen with major version releases. During the alpha phase they are bound to happen on a regular basis, whereas during beta they should be rare.

If you work with any protected methods or `@internal` public methods, be sure to check out the internal backwards compatiblity breaks page.

Beta Phase

`fTemplating::create()` was removed and a new method fTemplating::attach() was created to provide similar functionality.

`fCore::detectOpcodeCache()` was renamed to fLoader::hasOpcodeCache()

fFile::output() now automatically closes any open output buffering and discards the contents.

The email subject of error/exception emails sent by fCore has changed.

fRecordSet::sort() and fRecordSet::sortByCallback() now return a new record set instead of sorting the record set in place - this helps prevent side effects.

fActiveRecord::reflect() now returns an associative array instead of a string.

fSchema::getTables(), fSchema::getColumnInfo(), fSchema::getDatabases(), fSchema::getKeys() and fSchema::getRelationships() now return database, schema, table and column names in lowercase. This may change the behavior of, or break ORM classes for SQLite, MySQL, PostgreSQL or MSSQL databases containing mixed-case identifiers, although such mixed-cased identifiers have never been officially supported. Please test ORM functionality when upgrading to this revision.

Callbacks registered to the `extracted` hook via fDatabase::registerHookCallback() no longer receive the `$strings` parameter, instead all strings are added into the `$values` parameter.

Updated fCore::expose() to not wrap the value in an HTML tag when PHP is being run via the CLI.

fRequest::getBestAcceptType() and fRequest::getBestAcceptLanguage() now return either `NULL`, `FALSE` or a string instead of `NULL` or a string. See documentation for details of return values.

The `$contents` parameter of fEmail::addAttachment() is now first instead of third.

fORMFile::configureImageUploadColumn() no longer accepts the optional `$image_type` as the fourth parameter, instead fORMFile::addFImageMethodCall() must be called with `saveChanges` as the `$method` and the image type as the first parameter.

fRequest::get() now strips out low bytes characters if no `$cast_to`, or if a `string` or `array` `$cast_to` is specified. Using the new `binary` `$cast_to` will leave all bytes intact.

fActiveRecord column `set` methods now treat strings of all whitespace the same as empty strings and convert them to `NULL`.

Changed the parameter order in fImage::crop() from `$crop_from_x`, `$crop_from_y`, `$new_width`, `$new_height` to `$new_width`, `$new_height`, `$crop_from_x`, `$crop_from_y`.

Changed the array structure for child record in validation messages. Instead of all main record and child record messages being in a single array with keys in the form of `child_table[0]::column`, there is now a `child_table[0]` key that points to an array containing a `name` key and an `errors` key. The value for `name` is the name of the child record, e.g. `Child Record #1`. The value for `errors` is an array of validation messages with the keys being the column names and the values being the validation messages. Thus:

would now be represented as:

Methods registered to the `pre::validate()` and `post::validate()` hooks will need to handle this new array structure. Code that calls `->validate(TRUE)` on an fActiveRecord object will need to handle this new array structure. fORMValidation::addStringReplacement(), fORMValidation::addRegexReplacement() and fORMValidation::setMessageOrder() will now only affect the specified class specified and will not affect messages from child records.

Restructured individual record access, the iterator interface and callback parameters for fRecordSet.

Removed the method `fRecordSet::fetchRecord()` - functionality can be replicated via the new method fRecordSet::getRecord().

Manual iteration via `fRecordSet::current()`, `fRecordSet::key()`, `fRecordSet::next()`, `fRecordSet::rewind()` and `fRecordSet::valid()` (the Iterator interface) was removed and should be replaced by retrieving an ArrayIterator from the new method fRecordSet::getIterator(). Manual iteration can be performed on the ArrayIterator object.

The `$pointer` parameter was replaced with `$method_name` for callbacks registered via fORM::registerRecordSetMethod().

Changed fTemplating::delete() to return the value(s) of the element(s) deleted instead of the fTemplating instance.

fSession::add(), fSession::delete(), fSession::get(), fSession::set(), fTemplating::add(), fTemplating::delete(), fTemplating::get() and fTemplating::set() all now interpret `[`]` as array syntax and thus these can not be used in key or element names.

`fTemplating::remove()` was renamed to fTemplating::filter().

Removed `fDatabase::enableSlowQueryWarnings()`, added ability to replicate via fDatabase::registerHookCallback().

Removed support for the `odbc` and `pdo_odbc` extensions from fDatabase, fResult, fStatement and fUnbufferedResult. With this change, Flourish no longer supports any kind of ODBC connections.

`fActiveRecord::populate{RelatedRecords}()` changed from requiring the database table name as the input prefix to the `underscore_notation` version of the class name. This will only affect related records where the class was mapped using fORM::mapClassToTable().

Renamed `fUpload::setMaxFilesize()` to fUpload::setMaxSize() to be consistent with fFile::getSize().

fUpload no longer accepts uploaded files that start with a `.` unless fUpload::allowDotFiles() is called.

fActiveRecord::validate() now uses column names as array keys if messages are returned, the `$validation_messages` parameter for the `pre::validate()` and `post::validate()` hooks now requires array keys be column names and fValidation::validate() now uses field names as array keys if messages are returned.

fUpload::validate() no longer returns a `$_FILES` array.

fValidation::addRequiredFields() no longer accepts one-or-more rules, instead use fValidation::addOneOrMoreRule(). fValidation::addRequiredFields() no longer accepts conditional rules, instead use fValidation::addConditionalRule().

fDirectory::scan() and fDirectory::scanRecursive() to strip the current directory's path before matching the `$filter`

Renamed `fFile::getFilename()` to fFile::getName(), `fFile::getFilesize()` to fFile::getSize(), `fFile::getDirectory()` to fFile::getParent() and `fDirectory::getFilesize()` to fDirectory::getSize()

Added the `$force_cascade` parameter to fActiveRecord::delete() and fActiveRecord::store(). This change require any classes that override those methods be updated to include at least one parameter.

`fORM::addCustomClassTableMapping()` was renamed to fORM::mapClassToTable()

Removed the `$prefix` parameter from the methods fSession::delete(), fSession::get() and fSession::set()

Removed support for date function translation in fDatabase/fSQLTranslation

Renamed `fRecordSet::buildFromRecords()` to fRecordSet::buildFromArray()

Before this revision `one-to-one` relationships were not properly detected, so some `one-to-many` functionality such as `fActiveRecord::populate{RelatedRecords}()`, `fActiveRecord::build{RelatedRecords}()` and `fActiveRecord::associate{RelatedRecords}()` was working on these `one-to-one` relationships when it should not have.

`one-to-one` relationships support `fActiveRecord::create{RelatedRecord}()`, `fActiveRecord::populate{RelatedRecord}()` and `fActiveRecord::associate{RelatedRecord}()` instead.

Renamed `fORMValidation::addConditionalValidationRule()` to fORMValidation::addConditionalRule(), `fORMValidation::addManyToManyValidationRule()` to fORMValidation::addManyToManyRule(), `fORMValidation::addOneOrMoreValidationRule()` to fORMValidation::addOneOrMoreRule(), `fORMValidation::addOneToManyValidationRule()` to fORMValidation::addOneToManyRule(), `fORMValidation::addOnlyOneValidationRule()` to fORMValidation::addOnlyOneRule(), `fORMValidation::addValidValuesValidationRule()` to fORMValidation::addValidValuesRule()

Removed `fRecordSet::flagAssociate()` and `fRecordSet::isFlaggedForAssociation()`, the `$associate` parameter is no longer passed to callbacks registered via fORM::registerRecordSetMethod()

The first parameter of fSession::clear() was removed, fSession::delete() should now be used instead

Moved `fCRUD::printOption()` to fHTML::printOption(), `fCRUD::showChecked()` to fHTML::showChecked(), `fCRUD::removeListItems()` and `fCRUD::reorderListItems()` to fException::splitMessage(), `fCRUD::generateRequestToken()` to fRequest::generateCSRFToken(), and `fCRUD::validateRequestToken()` to fRequest::validateCSRFToken()

Removed `fORMSchema::enableSmartCaching()`, fORM::enableSchemaCaching() now provides equivalent functionality. `fSchema::setCacheFile()` changed to fSchema::enableCaching() and now requires an fCache object. `fSchema::flushInfo()` was renamed to fSchema::clearCache().

Changed the second parameter of fFile::output() from `$ignore_output_buffer` to `$filename`

Removed `fDate::getSecondsDifference()`, `fTime::getSecondsDifference()`, `fTimestamp::getSecondsDifference()` and `fTimestamp::getSeconds()`

`fCore::getOS()` and `fCore::getPHPVersion()` were removed and replaced with fCore::checkOS() and fCore::checkVersion()

Renamed `fORM::addCustomTableClassMapping()` to fORM::addCustomClassTableMapping() and swapped the parameters

Changed fCryptography::symmetricKeyEncrypt() to not encrypt the IV since we are using HMAC on it


Alpha Phase

Most users will not have code from the Flourish alpha

`fCore::stringlike()` was removed

`fCore::trigger()` was removed

!fPrintableException was renamed to fException

`fCore::toss()` was removed and all exceptions are now normally thrown with `throw new ExceptionName()`. `fCore::registerTossCallback()` was renamed to `fPrintableException::registerCallback()`, `fGrammar::compose()` was renamed to fText::compose() and `fGrammar::registerComposeCallback()` was renamed to fText::registerComposeCallback().

fActiveRecord hooks and method calls now have a `&$cache` parameter after the `&$related_records` parameter, but before any other parameters. Any method registered to a hook will need to have the method signature updated.

Swapped the order of the last two parameters of fORMRelated::setOrderBys() so that `$route` (which is really just `NULL` most of the time) was last and optional

Changed the existing file upload field name from `__flourish_existing_column_name` to `existing-column_name` and changed the delete file upload field name from `__flourish_delete_column_name` to `delete-column_name`

`fNoResultsException` was renamed to fNoRowsException, `fResult::tossIfNoResults()` was renamed to fRequest::tossIfNoRows(), `fUnbufferedResult::tossIfNoResults()` was renamed to fUnbufferedResult::tossIfNoRows(), `fResult::getAffectedRows()` was renamed to fResult::countAffectedRows() and `fResult::getReturnedRows()` was renamed to fRequest::countReturnedRows()

`fActiveRecord::has()` was renamed to fActiveRecord::hasOld() and `fActiveRecord::retrieve()` was renamed to fActiveRecord::retrieveOld()

`replace::` hooks are no longer allowed in fORM::registerHookCallback(), instead use fORM::registerActiveRecordMethod(). `fRecordSet::registerMethodCallback()` has been renamed to fORM::registerRecordSetMethod().

Renamed `fORMDatabase::getInstance()` to fORMDatabase::retrieve() and renamed `fORMSchema::getInstance()` to fORMSchema::retrieve()

`fUTF8::detect()` went from being public to private

`fResult::getPointer()` was removed, same functionality is available from fResult::key()

`fResult::areRemainingRows()` was removed, same functionality is available from fResult::valid()

`fUpload::upload()` was renamed to fUpload::move()

Changed fUpload from a static class to an instance class

Removed `fPrintableException::prepareMessage()`

Removed `fTimestamp::combine()`

Changed the replacement token in fRequest::overrideAction() from `%%action%%` to `%action%`

Changed the separator between the table name and column name for related form inputs from . back to :: because PHP converts . to _ - this reverts changes in r264

`fRecordSet::build{RelatedRecords}()` was renamed to `fRecordSet::prebuild{RelatedRecords}()` and `fRecordSet::count{RelatedRecords}()` was renamed to `fRecordSet::precount{RelatedRecords}()`

Removed `fRecordSet::countWithoutLimit()` and added the `$ignore_limit` parameter to fRecordSet::count()

Changed the separator between the table name and column name for related form inputs from `::` to `.` - `users::user_id[]` will now be `users.user_id[]`

Removed `fRecordSet::buildFromPrimaryKeys()`, changed fORMRelated::associateRecords() to only accept an fRecordSet instead of an fRecordSet or an array of primary keys

Renamed `fORM::createActiveRecordClass()` to fORM::defineActiveRecordClass()

Renamed `fFilesystem::createUniqueName()` to fFilesystem::makeUniqueName()

Renamed `fTimestamp::createFormat()` to fTimestamp::defineFormat()

Removed `fORMDatabase::escapeByType()`, added support for shorthand table.column names to fORMDatabase::escapeBySchema() to provide replacement functionality

The fourth parameter of fRecordSet::build() is now the page number instead of the offset. The page number is subtracted by one and multiplied by the limit to get the correct offset.

Removed `fGrammar::registerHumanizeCallback()`

`fGrammar::replaceHumanize()` was renamed to fGrammar::registerHumanizeCallback(), `fGrammar::replaceJoinArray()` was renamed to fGrammar::registerJoinArrayCallback(). `fGrammar::addAllCapitalsWord()` was removed and fGrammar::addHumanizeRule() was added with similar functionality.

`fDate::setDate()`, `fDate::setISODate()`, `fTime::setTime()`, `fTimestamp::setDate()`, `fTimestamp::setISODate()`, `fTimestamp::setTime()`, `fTimestamp::setTimezone()`, `fTimestamp::getTimezone()` were removed. The fDate, fTime and fTimestamp classes all became value objects (immutable) and fDate::adjust(), fTime::adjust() and fTimestamp::adjust() all now return new objects. Each class also gained a method called `modify()` which returns a new object based on the current object, replacing the various set methods.

Changed fCRUD::removeListItems() so its parameters were consistent with fCRUD::reorderListItems()

`fXML::prepare()` was renamed to fXML::encode()

`fRecordSet::flagForAssociation()` was renamed to fRecordSet::flagAssociate()

`fRecordSet::registerCallback()` was renamed to fRecordSet::registerMethodCallback()

`fORM::getClassName()` was renamed to fORM::getClass() and `fRecordSet::getClassName()` was renamed to fRecordSet::getClass()

`fHTML::checkForBlockLevelHTML()` was renamed to fHTML::containsBlockLevelHTML() and `fHTML::createLinks()` was renamed to fHTML::makeLinks()

`fCryptography::generateRandomString()` was renamed to fCryptography::randomString()

`fCRUD::createSortableColumn()` was renamed to fCRUD::printSortableColumn()

Removed ~fFinancialTransaction and ~fShippingRates. Both were unlike the rest of Flourish in that they were tied to the APIs of other services and neither was very comprehensive in terms of the number of services supported.

Removed `fORMDatabase::initialize()`, you must now construct an fDatabase instance and pass it to fORMDatabase::attach()

`fORMDatabase::prepareBySchema()` was renamed to fORMDatabase::escapeBySchema() and `fORMDatabase::prepareByType()` was renamed to fORMDatabase::escapeByType()

fDatabase::escape() replaces `fDatabase::escapeBlob()`, `fDatabase::escapeBoolean()`, `fDatabase::escapeDate()`, `fDatabase::escapeFloat()`, `fDatabase::escapeInteger()`, `fDatabase::escapeString()`, `fDatabase::escapeTime()` and `fDatabase::escapeTimestamp()`. fDatabase::unescape() replaces `fDatabase::unescapeBlob()`, `fDatabase::unescapeBoolean()`, `fDatabase::unescapeDate()`, `fDatabase::unescapeFloat()`, `fDatabase::unescapeInteger()`, `fDatabase::unescapeString()`, `fDatabase::unescapeTime()` and `fDatabase::unescapeTimestamp()`.

The second and third parameters of fMessaging::create() were swapped to be consistent with the other fMessaging methods

`fORMColumn::configureDateCreatedColumn()` was moved to fORMDate::configureDateCreatedColumn() and `fORMColumn::configureDateUpdatedColumn()` was moved to fORMDate::configureDateUpdatedColumn()

`fORMColumn::configureMoneyColumn()` was moved to fORMMoney::configureMoneyColumn()

`fMoney::multiply()` renamed to fMoney::mul() and `fMoney::subtract()` renamed to fMoney::sub() to be consistent with fNumber

`fORMRelated::constructRecord()` renamed to fORMRelated::createRecord(), `fORMRelated::constructRecordSet()` renamed to fORMRelated::buildRecords()

Renamed `fRecordSet::create()` to fRecordSet::build(), removed `fRecordSet::createEmpty()`, renamed `fRecordSet::createFromObjects()` to fRecordSet::buildFromRecords() and added a new first parameter, renamed `fRecordSet::createFromPrimaryKeys()` to fRecordSet::buildFromPrimaryKeys(), renamed `fRecordSet::createFromSQL()` to fRecordSet::buildFromSQL().

fValidation no longer has the methods `fValidation::setEmailFields()`, `fValidation::setEmailHeaderFields()` or `fValidation::setRequiredFields()`. The various `fValidation::add*()` methods should be used instead.

The method fImage::getInfo() went from being `public` to `protected`.

`fRecordSet::preload{RelatedRecords}()` became `fRecordSet::build{RelatedRecords}()`.

The `$debug` parameter was removed from all calls to fActiveRecord hook callbacks.

Removed `fRecordSet::preload{RelatedRecords}()`.

`fInflection` was renamed to fGrammar.

fMessaging::show() now behaves differently than it did before.