2017 © Pedro Peláez
 

library hierarchy

Tree data hierarchy

image

michalhisim/hierarchy

Tree data hierarchy

  • Tuesday, March 24, 2015
  • by michalhisim
  • Repository
  • 2 Watchers
  • 2 Stars
  • 277 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Nette Hierarchy

Usage

Nette forum model, (*1)

``` php use \Nette\Diagnostics\Debugger, \Nette\Database\Connection;, (*2)

class ForumModel extends Nette\Object {, (*3)

/** @var \Nette\Database\Connection */
private $database;    

public function __construct(Connection $db) {
    $this->database = $db;
}

/**
 * Load forums from database.
 * @return Hierarchy 
 */
public function getForums() {

    $forums = $this->database->query('SELECT *
                                      FROM forums
                                      ORDER BY root_id'); // No need to be ordered but it's faster


    /*$forums = $this->database->query('SELECT f.*,
                                            t.changed,
                                            COUNT(t.id) AS topics
                                     FROM forums f
                                     LEFT JOIN (SELECT * 
                                                FROM topics
                                                ORDER BY changed DESC) t ON t.forum_id=f.id
                                     GROUP BY f.id
                                     ORDER BY root_id, f.order'); */

    return new Tree\Hierarchy($forums, 'ForumNode');
}

}, (*4)

```, (*5)

The Versions

24/03 2015

dev-master

9999999-dev

Tree data hierarchy

  Sources   Download

MIT

The Requires

 

18/01 2014

1.0.0.x-dev

1.0.0.9999999-dev

Tree data hierarchy

  Sources   Download

MIT

The Requires

 

09/06 2013

0.1.0

0.1.0.0

Tree data hierarchy

  Sources   Download

MIT

The Requires