Просмотр исходного кода

merged tree branch into master, and created tree behavior

gediminasm 14 лет назад
Родитель
Сommit
baf3c26de4

+ 22 - 0
README.markdown

@@ -5,6 +5,8 @@ offer new functionality or tools to use Doctrine 2 more efficently.
 
 You can test these extensions on [my blog](http://gediminasm.org/test/ "Test doctrine behavior extensions").
 
+All tutorials for basic usage examples are on [my blog](http://gediminasm.org "Tutorials for extensions") also.
+
 ## Including DoctrineExtensions
 
 To include the DoctrineExtensions should fire up an autoloader, for example:
@@ -315,4 +317,24 @@ To save **Article** and generate slug simply use:
     echo $article->getSlug();
     // prints: the-title-my-code
     
+## Tree - NestedSet
+
+### Recent Updates
+
+- Tree repository has all handy functions required for tree behavior
+- No need for manager to control your tree nodes
+
+**Tree** behavior implements the NestedSet functionality through Doctrine 2
+event listener. Which makes usability as easy as it gets. Plus it supports
+concurrent entity updates and inserts in one flush and nesting with other
+behaviors. Example **Tree** can be nested with **Translatable** and **Sluggable**
+extensions.
+
+To attach the **TreeListener** to your event system do:
+
+    $evm = new Doctrine\Common\EventManager();
+    $evm->addEventSubscriber(new DoctrineExtensions\Tree\TreeListener());
+    // now this event manager should be passed to entity manager constructor
+    
+Your entities should implement **Node** interface.
     

+ 0 - 101
tests/DoctrineExtensions/Tree/temp/TreeFixtureBehavioralCategoryProxy.php

@@ -1,101 +0,0 @@
-<?php
-
-namespace DoctrineExtensions\Tree\Proxies;
-
-/**
- * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
- */
-class TreeFixtureBehavioralCategoryProxy extends \Tree\Fixture\BehavioralCategory implements \Doctrine\ORM\Proxy\Proxy
-{
-    private $_entityPersister;
-    private $_identifier;
-    public $__isInitialized__ = false;
-    public function __construct($entityPersister, $identifier)
-    {
-        $this->_entityPersister = $entityPersister;
-        $this->_identifier = $identifier;
-    }
-    private function _load()
-    {
-        if (!$this->__isInitialized__ && $this->_entityPersister) {
-            $this->__isInitialized__ = true;
-            if ($this->_entityPersister->load($this->_identifier, $this) === null) {
-                throw new \Doctrine\ORM\EntityNotFoundException();
-            }
-            unset($this->_entityPersister, $this->_identifier);
-        }
-    }
-
-    
-    public function getId()
-    {
-        $this->_load();
-        return parent::getId();
-    }
-
-    public function getSlug()
-    {
-        $this->_load();
-        return parent::getSlug();
-    }
-
-    public function setTitle($title)
-    {
-        $this->_load();
-        return parent::setTitle($title);
-    }
-
-    public function getTitle()
-    {
-        $this->_load();
-        return parent::getTitle();
-    }
-
-    public function setParent(\Tree\Fixture\BehavioralCategory $parent)
-    {
-        $this->_load();
-        return parent::setParent($parent);
-    }
-
-    public function getParent()
-    {
-        $this->_load();
-        return parent::getParent();
-    }
-
-    public function getTreeConfiguration()
-    {
-        $this->_load();
-        return parent::getTreeConfiguration();
-    }
-
-    public function getSluggableConfiguration()
-    {
-        $this->_load();
-        return parent::getSluggableConfiguration();
-    }
-
-    public function getTranslatableFields()
-    {
-        $this->_load();
-        return parent::getTranslatableFields();
-    }
-
-    public function getTranslatableLocale()
-    {
-        $this->_load();
-        return parent::getTranslatableLocale();
-    }
-
-    public function getTranslationEntity()
-    {
-        $this->_load();
-        return parent::getTranslationEntity();
-    }
-
-
-    public function __sleep()
-    {
-        return array('__isInitialized__', 'id', 'title', 'lft', 'rgt', 'parent', 'children', 'slug');
-    }
-}

+ 0 - 71
tests/DoctrineExtensions/Tree/temp/TreeFixtureCategoryProxy.php

@@ -1,71 +0,0 @@
-<?php
-
-namespace DoctrineExtensions\Tree\Proxies;
-
-/**
- * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
- */
-class TreeFixtureCategoryProxy extends \Tree\Fixture\Category implements \Doctrine\ORM\Proxy\Proxy
-{
-    private $_entityPersister;
-    private $_identifier;
-    public $__isInitialized__ = false;
-    public function __construct($entityPersister, $identifier)
-    {
-        $this->_entityPersister = $entityPersister;
-        $this->_identifier = $identifier;
-    }
-    private function _load()
-    {
-        if (!$this->__isInitialized__ && $this->_entityPersister) {
-            $this->__isInitialized__ = true;
-            if ($this->_entityPersister->load($this->_identifier, $this) === null) {
-                throw new \Doctrine\ORM\EntityNotFoundException();
-            }
-            unset($this->_entityPersister, $this->_identifier);
-        }
-    }
-
-    
-    public function getId()
-    {
-        $this->_load();
-        return parent::getId();
-    }
-
-    public function setTitle($title)
-    {
-        $this->_load();
-        return parent::setTitle($title);
-    }
-
-    public function getTitle()
-    {
-        $this->_load();
-        return parent::getTitle();
-    }
-
-    public function setParent(\Tree\Fixture\Category $parent)
-    {
-        $this->_load();
-        return parent::setParent($parent);
-    }
-
-    public function getParent()
-    {
-        $this->_load();
-        return parent::getParent();
-    }
-
-    public function getTreeConfiguration()
-    {
-        $this->_load();
-        return parent::getTreeConfiguration();
-    }
-
-
-    public function __sleep()
-    {
-        return array('__isInitialized__', 'id', 'title', 'lft', 'rgt', 'parent', 'children', 'comments');
-    }
-}

+ 3 - 0
tests/phpunit.dist.xml

@@ -7,6 +7,9 @@
         <testsuite name="Sluggable Extension">
             <directory suffix=".php">./DoctrineExtensions/Sluggable/</directory>
         </testsuite>
+        <testsuite name="Tree Extension">
+            <directory suffix=".php">./DoctrineExtensions/Tree/</directory>
+        </testsuite>
     </testsuites>
     <php>
         <const name="DOCTRINE_LIBRARY_PATH" value="/path/to/library/where/Doctrine/located"/>