Migration guide from the Chiba 1 version to the Chiba 2 version

Upgrade your Novius OS and its applications

See Updates page if you didn’t already do it.

Migrate your developments

Breaking changes

Model: columns of dataset are now encoded

If a column of dataset contains HTML, you must add a key isSafeHtml for not encode it.

<?php
return array(
    'data_mapping' => array(
        // ...
        'column_with_html' => array(
            'title' => 'Column with HTML',
            'column' => 'col_html',
            'isSafeHtml' => true,
        ),
        // ...
    ),
);

CRUD: success callback is called after save

In CRUD, when updating an item, success callback function is called after save (not before), like when inserting. If you use success in your developments, check that your code is compatible with a call after save.

Attachment: ->url() and ->urlResized() return absolute URLs

Now, ->url() and ->urlResized() methods return absolutes URLs. You have two choices for update your developments:

  • check that you don’t concatenate base_url before where you use those methods.

  • Add a parameter equals to false at call-time.

    <?php
    
    $attachement->url(false);
    

See also

Attachment

Comments: they now are contextable

Migration tries to guess the context of existing comments, but if you’ve implemented comments on a non contextable model, migration won’t be able to do it. In this case, you habe to set the context manually (comm_context column of nos_comment table) if you want to see those comments in new administration interface.

Blog/News: the default size of thumbnails have change and they are clickable

  • The default size of thumbnails have change from 200 to 120 pixels on list, remains 200 on item.
  • Thumbnails are clickable.

If you want to revert to the previous configuration:

  • Extend the related configuration file noviusos_blog::config or noviusos_news::config

  • Edit configuration like that:

    <?php
    
        return array(
            'thumbnail' => array(
                'front' => array(
                    'list' => array(
                        'link_to_item' => false,
                        'max_width' => 200.
                    ),
                    'item' => array(
                        'link_to_fullsize' => false,
                    ),
                ),
            ),
        );
    

URL Enhancer: mandatory getUrlEnhanced() method

All URL enhancers must implement a getUrlEnhanced() method.

Deprecated

Those updates are not mandatory but desirable to be able to migrate without trouble when next version is released.

Enhancer: get_url_model($item, $params) becomes getURLEnhanced($params)

Deprecated code:

<?php

public static function get_url_model($item, $params = array())
{
    $model = get_class($item);

    switch ($model) {
        case 'A\Class':
            return $item->virtual_name).'.html';
            break;
    }

    return false;
}

Replace with:

<?php

public static function getURLEnhanced($params = array())
{
    $item = \Arr::get($params, 'item', false);
    if ($item) {
        $model = get_class($item);

        switch ($model) {
            case 'A\Class':
                return $item->virtual_name).'.html';
                break;
        }
    }

    return false;
}

Media: Changes in Model_Media API

All snake_case methods are deprecated:

  • delete_from_disk becomes deleteFromDisk
  • delete_public_cache becomes deleteCache
  • get_path becomes _getVirtualPath
  • get_private_path becomes path
  • get_img_tag becomes htmlImg
  • get_img_tag_resized becomes htmlImgResized
  • is_image becomes isImage
  • get_public_path becomes url
  • get_public_path_resized becomes urlResized

See also

Methods

Media: Changes in Model_Folder API

  • delete_from_disk becomes deleteFromDisk
  • delete_public_cache becomes deleteCache

See also

Methods

Event user_login

The user_login event is deprecated, use admin.loginSuccess instead.

Migration Chiba 2 to Chiba 2.1

New in version Chiba: 2.1

Deprecated

Those updates are not mandatory but desirable to be able to migrate without trouble when next version is released.

Renderer_Selector->set_renderer_options()

The set_renderer_options() method is deprecated, use setRendererOptions() instead.

Renderer_Media->parse_options()

The parse_options() method is deprecated, use parseOptions() instead.

Slideshow : front-office views and configuration

  • The configuration file noviusos_slideshow::slideshow has been refactored for a better separation between slideshow’s formats. Voir API documentation of Slideshow.
  • The configuration file noviusos_slideshow::flexslider is deprecated, use noviusos_slideshow::formats/flexslider instead.
  • The view noviusos_slideshow::slideshow_js is deprecated, use noviusos_slideshow::flexslider/javascript instead instead.
  • The view noviusos_slideshow::slideshow is deprecated, use noviusos_slideshow::flexslider/slideshow instead instead.

The Chiba 2.1 version of Slideshow application has to make some migrations in the DB. See Run the migration.

Read the Docs v: elche
Versions
latest
elche
dubrovka
chiba.2
chiba.1
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.