Download the PHP package shopware/dbal-nested-set without Composer
On this page you can find all versions of the php package shopware/dbal-nested-set. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shopware/dbal-nested-set
More information about shopware/dbal-nested-set
Files in shopware/dbal-nested-set
Package dbal-nested-set
Short Description A Doctrine DBAL nested set implementation
License MIT
Informations about the package dbal-nested-set
Doctrine DBAL Nested Set
Used in B2B Suite for Shopware 5
A multi root nested set implementation for DBAL users.
Description
This library provides you write, read and inspection classes for nested sets with multiple root nodes per table. Solely relying on the Doctrine DBAL.
Contrary to other solutions this library has clear boundaries and leaves the software design up to you.
- No tree abstraction - just nested sets
- No entities - just method calls with plain parameters
Installation
Use composer to install the library
Usage
You always need a configuration that sets up the basic column names of your implementation:
Then you can use the NestedSetFactory
to create the different classes of the library.
Create a tree
You may want to create a normalized schema for nested set tables, this can be accomplished through the NestedSetTableFactory
. It will create the base DDL for a tree with indexes. So if you want to add a simple tree with a name column and an autoincrement id it will look like this:
Of course this is optional and may be accomplished through any schema configuration tool.
Modify the tree
The library provides a NestedSetWriter
class that contains all insert, move and update operations. All operations should be reminiscent of Doctrine\DBAL\Connection::insert()
and Doctrine\DBAL\Connection::update()
and just require plain data.
As an example you can use this to create a tree
And then use the writer to move nodes around
Inspect nodes
You may want to retrieve information about different nodes. This can be done through the NestedSetTableNodeInspector
.
Inspect the tree
The NestedSetQueryFactory
helps retrieve a set of nodes from the tree. Since the library has no concept of entities it will only prepare query builders for you ready to add selects, joins and other conditions.
Local development
If you want to develop locally you may have to configure the database access through a little shell script: