Cherrycake
ExamplesGithub
version 2.x alpha
version 2.x alpha
  • Introduction
  • Status
  • Changelog
  • Migration
  • Architecture
    • Basics
    • Modules
    • Classes
    • Lifecycle
      • Deep lifecycle
    • Performance
    • Security
    • Patterns
      • Files structure
    • Items
    • Server requirements
  • Guide
    • Getting started
      • Skeleton start
      • Docker start
    • Modules guide
    • Classes guide
    • Actions guide
      • Complex actions
      • Variable path components
      • Accept GET or POST parameters
      • Getting the URL of an action
      • Cached actions
      • Brute force attacks
    • Patterns guide
      • Passing variables to a pattern
      • Nested patterns
      • Cached patterns
    • Cache guide
      • Time To Live
      • Using cache
      • Lists
      • Queues
      • Pools
    • Database guide
      • Basic queries
      • Prepared queries
      • Cached queries
      • Cache key naming
      • Removing queries from cache
    • Items guide
      • Item cache
      • Item lists
      • Items custom filters
      • Items custom ordering
      • Mixing filters and ordering
      • Items with relationships
      • Items cache
    • HtmlDocument guide
    • Css and Javascript guide
      • Modules injecting CSS and JavaScript
    • Session guide
    • Login guide
      • Creating a complete login workflow
    • Locale guide
      • Multilingual texts
      • Domain based site localization
    • Log guide
      • Loading Log events from the database
    • Stats guide
      • Stats events with additional dimensions
      • Loading Stats events from the database
    • Janitor guide
      • Janitor tasks configuration files
    • Command line interface
    • Debugging
  • Reference
    • Core modules
      • Actions
        • Actions methods
      • Browser
      • Cache
        • Cache methods
      • Css
        • Css methods
      • Database
      • Email
      • Errors
      • HtmlDocument
        • HtmlDocument methods
      • ItemAdmin
      • Janitor
        • Janitor methods
      • Javascript
        • Javascript methods
      • Locale
        • Locale methods
      • Log
        • Log methods
      • Login
        • Login methods
      • Output
        • Output methods
      • Patterns
        • Patterns methods
      • Security
        • Security methods
      • Session
        • Session methods
      • Stats
        • Stats methods
      • SystemLog
      • TableAdmin
      • Translation
      • Validate
    • Core classes
      • Action
        • Action methods
        • Action properties
      • AjaxResponseJson
      • BasicObject
        • BasicObject methods
      • CacheProvider
        • CacheProvider methods
      • Color
      • DatabaseProvider
        • DatabaseProvider methods
      • DatabaseResult
        • DatabaseResult methods
        • DatabaseResult properties
      • DatabaseRow
      • Engine
        • Engine methods
        • Engine properties
      • Gradient
      • Item
        • Item methods
        • Item properties
      • Items
        • Items methods
        • Items properties
      • Image
      • JanitorTask
        • JanitorTask methods
        • JanitorTask properties
      • LogEvent
        • LogEvent methods
        • LogEvent Properties
      • LogEvents
        • LogEvents methods
      • Module
        • Module methods
        • Module properties
      • Response
      • Request
        • Request methods
      • RequestParameter
        • RequestParameter methods
      • RequestPathComponent
        • RequestPathComponent methods
      • Result
      • StatsEvent
        • StatsEvent properties
      • StatsEvents
        • StatsEvents methods
      • SystemLogEvent
        • SystemLogEvent methods
        • SystemLogEvent properties
      • SystemLogEvents
        • SystemLogEvents methods
  • Code conventions
  • License
  • Extras
Powered by GitBook
On this page
  • Migrating from 1.x to 2.x
  • Migrating from 0.x to 1.x

Was this helpful?

Migration

Instructions on how to migrate your existing Cherrycake application from earlier versions of the Cherrycake engine.

PreviousChangelogNextBasics

Last updated 3 years ago

Was this helpful?

Migrating from 1.x to 2.x

  • If you were using the module to get multi-lingual texts in your App, take a look at the new module.

  • Almost all the important methods are now called using named arguments, which allows for an easier and cleaner way of passing parameters to methods. The best way of migrating your app is to take a look at the updated documentation for each module and class you're using to see how parameters are now passed.

Migrating from 0.x to 1.x

  • Update your composer.json file to require Cherrycake version 1.x instead of version 0.x:

      composer update
  • Create the src directory in your project and move your modules there. Remember modules still have their own subdirectory under src. You can remove the now empty Modules directory.

  • Move all your classes to the src directory. Remember classes do not have their own subdirectory, so they reside on the root of src. You can remove the now empty Classes directory.

  • Rename all your modules and class files so they end with .php instead of .class.php. For example: MyModule.php instead of MyModule.class.php.

  • Assign all your modules to their own namespace by modifying or adding a namespace directive at the top of the file. For example, if your module is called MyModule, you should add this at the top of src/MyModule/MyModule.php:

      namespace \CherrycakeApp\MyModule;
  • Remember also to correctly namespace the class your modules extend from. For example, instead of your module being declared like this:

      class MyModule extends Module {

    declare it like this instead:

      class MyModule extends \Cherrycake\Module {
  • Assign all your classes the right namespace. If they're classes related to a module, move them to the related module's directory and add the matching namespace. For example, if your class is called ClassForMyModule and is related to a module called MyModule, move it to src/MyModuleand add this at the top of src/MyModule/ClassForMyModule.php:

      namespace \CherrycakeApp\MyModule;
  • You'll need to change how you reference Cherrycake's core modules and classes throughout your code. For example, the following code:

      $e->Actions->mapAction(
          "homePage",
          new \Cherrycake\Action([
              "moduleType" => ACTION_MODULE_TYPE_APP,
              "moduleName" => "Home",
              "methodName" => "homePage",
              "request" => new \Cherrycake\Request([
                  "pathComponents" => false,
                  "parameters" => false
              ])
          ])
      );

    Should be changed to this:

      $e->Actions->mapAction(
          "homePage",
          new \Cherrycake\Actions\Action([
              "moduleType" => \Cherrycake\ACTION_MODULE_TYPE_APP,
              "moduleName" => "Home",
              "methodName" => "homePage",
              "request" => new \Cherrycake\Actions\Request([
                  "pathComponents" => false,
                  "parameters" => false
              ])
          ])
      );
  • Autoloading of classes is now handled via composer, so you need to add this to your composer.json file:

      "autoload": {
          "psr-4": {
              "CherrycakeApp\\": "src/"
          }
      }
  • Update composer's autoload by running the command:

      composer dump-autoload
  • See the documentation at and the examples at to see examples using this new namespacing.

Locale
Translation
cherrycake.io
documentation-examples.cherrycake.io/