2017 © Pedro Peláez
 

library doctrine-extensions-tree

Implementation of Tree from DoctrineExtensions to Nette.

image

zenify/doctrine-extensions-tree

Implementation of Tree from DoctrineExtensions to Nette.

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 12 Versions
  • 6 % Grown

The README.md

DoctrineExtensions - Tree

Build Status Quality Score Code Coverage Downloads Latest stable, (*1)

Implementation of Tree from DoctrineExtensions to Nette., (*2)

Install

composer require zenify/doctrine-extensions-tree

Register extension:, (*3)

# app/config/config.neon
extensions:
    - Zenify\DoctrineExtensionsTree\DI\TreeExtension

Usage

For entity implementation, follow manual, (*4)

Very simple entity could look like this:, (*5)

namespace App\Entities;

use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;


/**
 * @ORM\Entity(repositoryClass="App\Model\CategoryTree")
 * @Gedmo\Tree(type="materializedPath")
 */
class Category
{

    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue
     */
    public $id;

    /**
     * @Gedmo\TreePathSource
     * @ORM\Column(type="string")
     * @var string
     */
    private $name;

    /**
     * @Gedmo\TreeParent
     * @ORM\ManyToOne(targetEntity="Category", cascade={"persist"})
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=TRUE)
     * @var Category
     */
    private $parent;

    /**
     * @Gedmo\TreePath(separator="|")
     * @ORM\Column(type="string", nullable=TRUE)
     * @var string
     */
    private $path;


    /**
     * @param string $name
     * @param Category $parent
     */
    public function __construct($name, Category $parent = NULL)
    {
        $this->name = $name;
        $this->parent = $parent;
    }


    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }


    /**
     * @return Category
     */
    public function getParent()
    {
        return $this->parent;
    }


    /**
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }

}

And it's repository:, (*6)

namespace App\Model;

use Gedmo\Tree\Entity\Repository\MaterializedPathRepository;


class CategoryTree extends MaterializedPathRepository
{

}

Testing

composer check-cs # see "scripts" section of composer.json for more details 
vendor/bin/phpunit

Contributing

Rules are simple:, (*7)

  • new feature needs tests
  • all tests must pass
  • 1 feature per PR

We would be happy to merge your feature then!, (*8)

The Versions

29/12 2016
10/02 2016

v1.0.4

1.0.4.0

Implementation of Tree from DoctrineExtensions to Nette.

  Sources   Download

MIT

The Requires

 

The Development Requires

08/02 2016

v1.0.3

1.0.3.0

Implementation of Tree from DoctrineExtensions to Nette.

  Sources   Download

MIT

The Requires

 

The Development Requires

03/11 2015

v1.0.2

1.0.2.0

Implementation of Tree from DoctrineExtensions to Nette.

  Sources   Download

MIT

The Requires

 

The Development Requires

12/03 2015

v1.0.1

1.0.1.0

Implementation of Tree from DoctrineExtensions to Nette.

  Sources   Download

MIT

The Requires

 

The Development Requires