PHPackages                             craftyshadow/propel-equalnest-behavior - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. craftyshadow/propel-equalnest-behavior

ActiveLibrary

craftyshadow/propel-equalnest-behavior
======================================

This behavior provides a way to define relations between objects that have equal hierarchy (friendship).

1.2.0(11y ago)1531.6k7MITPHP

Since Jul 2Pushed 11y ago3 watchersCompare

[ Source](https://github.com/VanTanev/EqualNestBehavior)[ Packagist](https://packagist.org/packages/craftyshadow/propel-equalnest-behavior)[ RSS](/packages/craftyshadow-propel-equalnest-behavior/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (9)Used By (0)

EqualNestBehavior
=================

[](#equalnestbehavior)

[![Build Status](https://camo.githubusercontent.com/2d6ea807e09cdccf788a402be76f467635ec47a032e9beb96fe3457b3fb5fd31/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f56616e54616e65762f457175616c4e6573744265686176696f722e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/VanTanev/EqualNestBehavior)

The EqualNestBehavior is inspired by [Doctrine's Equal Nest Relations](http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/defining-models.html#equal-nest-relations)implementation, and provides a way to define relations between objects that have equal hierarchy - think about a person and his friends.

### Requirements

[](#requirements)

This behavior requires Propel &gt;= 1.6.0.

### Installation

[](#installation)

Get the code by cloning this repository, or by using Composer (recommended):

```
{
    "require": {
        "craftyshadow/propel-equalnest-behavior": "~1.2"
    }
}
```

Then, if you don't use Composer, or an autoloader in your application, add the following configuration to your `build.properties` or `propel.ini` file:

```
propel.behavior.equal_nest.class = vendor.craftyshadow.propel-equalnest-behavior.src.EqualNestBehavior
```

> Note: `vendor.craftyshadow.propel-equalnest-behavior.src.EqualNestBehavior` is the path to access the `EqualNestBehavior` class in "dot-path" notation.

Then declare the behavior in your `schema.xml`:

```

```

#### Setup with symfony 1.4

[](#setup-with-symfony-14)

Copy the behavior to `lib/vendor/equal_nest_behavior` and then register the behavior class by adding the following to the bottom of the `config/propel.ini`file:

```
; check that you have behaviors enabled
propel.builder.addBehaviors = true

; and add the custom behavior
propel.behavior.equal_nest.class = lib.vendor.equal_nest_behavior.EqualNestBehavior
```

Then in your `schema.yml`:

```
propel:

  person:
    id: ~
    name: { type: varchar(255) }

  friend:
    _propel_behaviors:
      symfony: { form: false, filter: false }
      equal_nest:
        parent_table: person
    # you do not need to specify any columns for the "friend" table, the behavior will add them automatically
```

### Usage

[](#usage)

Continuing with the example above, here is how you would use the `Person` object to define `Friend` relationships:

```
