<commit_before>CodiVerum Yii2 Extension for hierarchy data
========================================
Extension contains abstract classes making it easy to implement tree-structured data in Yii2 Framework.
I've found other solutions implementing tree structured data but I wasn't satisfy by them so 
I created my own way (I haven't found that kind of solution).
It allows for adding nodes, removing nodes, moving nodes (with or without subtree), 
getting ancestors, descendants, siblings etc. (see TreeNodeInterface)
I hope you'll find it useful and easy.

This is my first open-source work so I'll be glad to hear any suggestions.
I'm sure this little library may be improved.

The basic design puts the data into two tables:

1. node:
```
id INT PRIMARY KEY auto_increment,
id_parent_node INT DEFAULT NULL,
node_level INT NOT NULL
```

2. node_ancestor:
```
id_node INT NOT NULL,
id_ancestor_node INT NOT NULL,
```

Proper foreign keys are also set.
Note that names may be easily customized (see migration section below)

Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist codiverum/yii2-abstracttree "*"
```

or add

```
"codiverum/yii2-abstracttree": "*"
```

to the require section of your `composer.json` file.


Usage
-----

Using this extension you can easily make:
- customized migration 
- ActiveRecord classes 
- node interface (TreeNodeInterface)

#### Migration ####
To make migration, you should create new migration:

```
yii migrate/create migration_name
```

Your migration should extend `codiverum\abstracttree\migrations\AbstractTreeBaseMigration` class, for example:

~~~php
use codiverum\abstracttree\migrations\AbstractTreeBaseMigration;
use yii\db\Schema;

class m150505_194334_category_tree extends AbstractTreeBaseMigration {
<commit_msg>correct readme<commit_after>CodiVerum Yii2 Extension for hierarchy data
========================================
Extension contains abstract classes making it easy to implement tree-structured data in Yii2 Framework.
I've found other solutions implementing tree structured data but I wasn't satisfy by them so 
I created my own way (I haven't found that kind of solution).
It allows for adding nodes, removing nodes, moving nodes (with or without subtree), 
getting ancestors, descendants, siblings etc. (see TreeNodeInterface)
I hope you'll find it useful and easy.

This is my first open-source work so I'll be glad to hear any suggestions.
I'm sure this little library may be improved.

The basic design puts the data into two tables:

1. node:
```
id INT PRIMARY KEY auto_increment,
id_parent_node INT DEFAULT NULL,
node_level INT NOT NULL
```

2. node_ancestor:
```
id_node INT NOT NULL,
id_ancestor_node INT NOT NULL,
```

Proper foreign keys are also set.
Note that names may be easily customized (see migration section below)

Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist codiverum/yii2-abstracttree "dev-master"
```

or add

```
"codiverum/yii2-abstracttree": "dev-master"
```

to the require section of your `composer.json` file.


Usage
-----

Using this extension you can easily make:
- customized migration 
- ActiveRecord classes 
- node interface (TreeNodeInterface)

#### Migration ####
To make migration, you should create new migration:

```
yii migrate/create migration_name
```

Your migration should extend `codiverum\abstracttree\migrations\AbstractTreeBaseMigration` class, for example:

~~~php
use codiverum\abstracttree\migrations\AbstractTreeBaseMigration;
use yii\db\Schema;

class m150505_194334_category_tree extends AbstractTreeBaseMigration {

{'fraction_non_alphanumeric': 0.10186400630086637, 'fraction_numerical': 0.009451299553688633, 'mean_word_length': 4.87962962962963, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4450562', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1038, 'n_words': 445}