rocket/utilities

Utilities that don't go in any category

dev-master / 1.0.x-dev 2016-01-02 17:59 UTC

README

This is a subtree split of RocketPropelledTortoise CMS - Core. Don't send pull requests here

Work In Progress, do not use in production

This repository contains all classes for RocketPropelledTortoise CMS that are not directly tied to a specific component.

ParentChildTree

Transform a flat representation of a tree to a nested array

From

 array(
    ['id' => 1, 'text' => 'parent'],
    ['id' => 2, 'text' => 'child', 'parent_id' => 1]
 );

To

array(
    ['id' => 0, 'childs' => array(
        ['id' => 1, 'text' => 'parent', 'childs' => array(
            ['id' => 2, 'text' => 'child', 'parent_id' => 1]
        )],
    )
);
``