<commit_before>NDBF - Layer for Nette\Database
===============================

NDBF is a thin layer above Nette\Database which offers interface based on repository manager/repositories model.
Please introduce yourself to Nette\Database syntax first, because it is essential to understand NDBF.

Install
-------

NDBF is [available through Packagist](http://packagist.org/packages/slamecka/ndbf) (the main repository of [Composer](http://getcomposer.org)).

	"require": {
		"nette/nette": "2.*",
		"slamecka/ndbf": "*"
	}

Or you can of course download it from GitHub.

Use
---
In config.neon create database connection/service using class Nette\Database\Connection. Then in bootstrap.php add following callback:

    $configurator->onCompile[] = function ($cf, $compiler) { $compiler->addExtension('ndbf', new Ndbf\CompilerExtension); };

Put this method into your BasePresenter:

    public function getRepositories()
    {
        return $this->context->getByType('Ndbf\RepositoryManager');
    }

And you can use it in your presenters:

    // In renderDefault() or similar:
    $products = $this->repositories->Product;

    // Use simplified methods select(), table(), fetchPairs(), count()
    $products->select()->where('color', 'red')->order('price');

    // Saves new $product
    $product = array('name' => 'FooBar');
    $products->save($product, 'id'); // $product recieves newly assigned id after save

    // Updates product
    $product->save($product, 'id'); // $product has id assigned from the previous save

	// You don't have to pass primary key ('id') to _save_ if you set up NDBF properly - see the wiki

    // Removes product with id 15
    $products->remove(array('id' => 15));


For guide on own repositories and further information see [the wiki](/OndrejSlamecka/ndbf/wiki).


Disclaimer
----------
This is not a part of Nette Framework!! Use at your own risk.

Released under the New BSD license.
<commit_msg>Readme changed (documentation moved onto github wiki)<commit_after>NDBF - Layer for Nette\Database
===============================

NDBF is a thin layer above Nette\Database which offers interface based on repository manager/repositories model.
Please introduce yourself to Nette\Database syntax first, because it is essential to understand NDBF.

Installation and use
--------------------

See [the wiki](/OndrejSlamecka/ndbf/wiki).


Disclaimer
----------
This is not a part of Nette Framework!! Use at your own risk.

Released under the New BSD license.

{'fraction_non_alphanumeric': 0.14543269230769232, 'fraction_numerical': 0.002003205128205128, 'mean_word_length': 3.7835249042145596, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2513109', 'n_tokens_mistral': 727, 'n_tokens_neox': 676, 'n_words': 262}