title | metadata | taxonomy | |||
---|---|---|---|---|---|
4.0.x to 4.1.x |
|
|
UserFrosting 4.1 brings improved organization of the codebase, factoring out the Sprinkle management system from the core
Sprinkle itself. The Bakery makes it easier than ever to get UserFrosting up and running, as well as handling other command-line tasks from a unified interface.
We've also switched to an event-driven application lifecycle that uses Symfony's event dispatcher to allow each Sprinkle to hook into critical points in the UserFrosting lifecycle.
New tools for setting up UF, checking requirements, installing, and asset management. They're great!
The main lifecycle logic (Sprinkle loading) has been moved out of the core
Sprinkle and into app/system
. Sprinkles can hook into the main UF application lifecycle via their bootstrap class. Available methods so far:
- onAppInitialize
- onAddGlobalMiddleware
- onSprinklesInitialized
- onSprinklesAddResources
- onSprinklesRegisterServices
With a new WhoopsRenderer for attractive, informative debugging pages!
Sprunjes can now generate enumerations of unique values for a specific field. Very useful in generating lists of options, for example, in tablesorter selection menus.
See Cache for more info.
composer.json
moved to top-level directorysprinkles.json
moved toapp/
directorybundle.config.json
renamed toasset-bundles.json
core
sprinkle must be explicitly listed insprinkles.json
- Major reorganization of templates. The base page template is now one of
pages/abstract/base.html.twig
,pages/abstract/default.html.twig
, orpages/abstract/dashboard.html.twig
. Modals, forms, and tables have been moved out ofcomponents/
. Navigation components now have their own top-levelnavigation/
directory. - Request schema have been moved from
schema/
toschema/requests/
. This is more semantic and allows us to use this directory for other types of schema files as well. - New CLI tools for installing. Removed
migrations/install.php
. - Models moved from
src/Model
tosrc/Database/Models
- Migrations moved from
migrations/
tosrc/Database/Migrations
, and must extend the baseMigration
class to implementup
anddown
methods. - Sprinkle bootstrap classes completely redesigned. They are now basically implementations of Symfony's
EventSubscriberInterface
, allowing the class to hook into the UF application lifecycle. - Service providers are now automatically loaded, but they MUST be named
src/ServicesProvider/ServicesProvider.php
. - Default assets have been reorganized.
assets/local
has been renamedassets/userfrosting
, and subdirectories in this directory have been rearranged as well.
- Refactor groups and user routes. See Issue #721. The
admin/
part of all routes in theadmin
sprinkle was removed. - Middleware should be loaded in Sprinkle bootstrap classes in
onAddGlobalMiddleware
, instead ofindex.php
. - Exception handlers moved from
src/Handler
tosrc/Error/Handler
. - Interface for
ExceptionHandler
has changed. There is no longerajaxHandler
andstandardHandler
- everything is handled viahandle
now. Decisions about request type (ajax, standard) and error display mode (settings.displayErrorDetails, site.debug.ajax) are now delegated to the handlers. Error rendering is delegated tosrc/Error/Renderer
classes. - The member variables in
HttpException
have been renamed.http_error_code => httpErrorCode
, anddefault_message => defaultMessage
. If you have any custom child exceptions that extendHttpException
, you'll need to update these variable names to work properly with theHttpExceptionHandler
. src/Facades/Facade
moved tosystem/Facade
.- All loggers log to a common
userfrosting.log
now ufTable
now uses the pagination widget instead of the plugin, which changes the naming of their options if you happened to override any of the defaults.- Renamed the following CSS classes:
js-download-table
->js-uf-table-download
uf-table-info-messages
->uf-table-info
(styling) andjs-uf-table-info
(functional)tablesorter-pager
->tablesorter-pager
(styling) andjs-uf-table-pager
(functional)menu-table-column-selector-*
->uf-table-cs-*
(styling) andjs-uf-table-cs-*
(functional)table-search
->uf-table-search
(styling)
ufForm
now sets adataType
in the call to.ajax
- we've customized it to handle malformed JSON responses, but it could still cause problems for some people- Refactored the cache config values.
src/Model/UFModel
deprecated; usesrc/Database/Models/Model
nowifCond
Handlebars helper deprecated; useifx
instead
Upgrading UserFrosting to 4.1.x
is as simple as getting the new files and updating dependencies, migrations and assets! If you first installed UserFrosting using git, a simple git pull
or git pull upstream master
. Once you have the new files, simply use composer and Bakery to get up to date with everything else:
$ composer update
$ php bakery bake
First, you'll need to update your template structure to reflect the new template organization:
layouts/basic.html.twig => pages/abstract/base.html.twig
layouts/default.html.twig => pages/abstract/default.html.twig
layouts/error.html.twig => pages/abstract/error.html.twig
layouts/dashboard.html.twig => pages/abstract/dashboard.html.twig
layouts/modal.html.twig => modals/modal.html.twig
components/forms/* => forms/*
components/tables/* => tables/*
components/default/* => navigation/*
components/dashboard/* => navigation/*
components/user-card.html.twig => navigation/user-card.html.twig
components/breadcrumb.html.twig => navigation/breadcrumb.html.twig
components/alerts.html.twig => pages/partials/alerts.html.twig
components/analytics.html.twig => pages/partials/analytics.html.twig
components/config.js.twig => pages/partials/config.js.twig
components/csrf.html.twig => forms/csrf.html.twig
components/favicons.html.twig => pages/partials/favicons.html.twig
components/footer.html.twig => pages/partials/footer.html.twig
components/legal.html.twig => pages/partials/legal.html.twig
components/page.js.twig => pages/partials/page.js.twig
components/privacy.html.twig => pages/partials/privacy.html.twig
You will need to change references to the new locations of the templates that have moved - in particular, in extends
and include
tags within the templates themselves, as well as references within controllers (in calls to render
).
- Rename your Sprinkle's
bundle.config.json
toasset-bundles.json
. - Rename your service provider class (if you have one) to
src/ServicesProvider/ServicesProvider.php
. This will let UserFrosting load it automatically. - Change your Sprinkle's bootstrapper class (if you have one) - for example,
src/Site.php
. This should now extendUserFrosting\System\Sprinkle\Sprinkle
. Get rid of theinit
method. Instead, you should create methods to hook into the UserFrosting lifecycle, if necessary. Otherwise, you can leave this class empty, or delete it entirely. - Move your models from
src/Model
tosrc/Database/Models
, and change them to extend the baseUserFrosting\Sprinkle\Core\Database\Models\Model
class. Keep in mind that when you move your classes to a different directory, you need to change theirnamespace
as well to comply with PSR-4 autoloading rules. - For each database table you create in your
migrations/*
file, create a new class insrc/Database/Migrations
instead. This should extend the baseUserFrosting\System\Bakery\Migration
class to implementup
anddown
methods. See Migrations for more information. - If you reference any default UserFrosting assets in your templates or asset bundles, you will need to update their paths (see Major Changes above).
- Move your request schema from
schema/
toschema/requests/
, and update the paths in your controllers. - Check the "minor breaking changes" section above, to see if there are any other changes that might affect your Sprinkle.
The database schema have not changed from UF 4.0 - there is no need to upgrade your database.
See the Changelog for the complete list of changes included in this release.