PHPackages                             yiiext/activerecord-relation-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. [Database &amp; ORM](/categories/database)
4. /
5. yiiext/activerecord-relation-behavior

ActiveYii-extension[Database &amp; ORM](/categories/database)

yiiext/activerecord-relation-behavior
=====================================

Inspired by and put together the awesomeness of many yii extensions that aim to improve saving of related records. Comes with 100% test coverage and well structured and clean code so it can savely be used in enterprise production enviroment.

1.1.3(11y ago)9336.5k↓50%29[16 issues](https://github.com/yiiext/activerecord-relation-behavior/issues)[1 PRs](https://github.com/yiiext/activerecord-relation-behavior/pulls)BSD-3-ClausePHPPHP &gt;=5.1.0

Since Jun 13Pushed 9y ago20 watchersCompare

[ Source](https://github.com/yiiext/activerecord-relation-behavior)[ Packagist](https://packagist.org/packages/yiiext/activerecord-relation-behavior)[ Docs](https://github.com/yiiext/activerecord-relation-behavior)[ RSS](/packages/yiiext-activerecord-relation-behavior/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (5)Used By (0)

ActiveRecord Relation Behavior [![Build Status](https://camo.githubusercontent.com/8c556f2ac516e8a5190e60e246b368656c6aaa972c86f24fa3c3a1f81406d056/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f7969696578742f6163746976657265636f72642d72656c6174696f6e2d6265686176696f722e706e67)](http://travis-ci.org/yiiext/activerecord-relation-behavior)
==============================================================================================================================================================================================================================================================================================================================================================

[](#activerecord-relation-behavior-)

This extension is inspired by all the yii extensions that aim to improve saving of related records. It allows you to assign related records especially for MANY\_MANY relations more easily. It puts together the awesomeness of all the extensions mentionend below (see headline "Feature comparison"). It comes with 100% test coverage and well structured and clean code so it can savely be used in enterprise production enviroment.

Requirements
------------

[](#requirements)

- Yii 1.1.6 or above
- As Yii Framework this behavior is compatible with all PHP versions above 5.1.0. I try to be at least as backwards compatible as Yii is, which is PHP 5.1.0, if there are any problems with php versions, please [report it](https://github.com/yiiext/activerecord-relation-behavior/issues)!
- Behavior will only work for ActiveRecord classes that have primary key defined. Make sure to override [primaryKey()](http://www.yiiframework.com/doc/api/1.1/CActiveRecord#primaryKey%28%29-detail) method when your table does not define a primary key.
- *You need php 5.3.x or higher to run the unit tests.*

How to install
--------------

[](#how-to-install)

1. Get the source in one of the following ways:
    - [Download](https://github.com/yiiext/activerecord-relation-behavior/tags) the latest version and place the files under `extensions/yiiext/behaviors/activerecord-relation/` under your application root directory.
    - Add this repository as a git submodule to your repository by calling `git submodule add https://github.com/yiiext/activerecord-relation-behavior.git extensions/yiiext/behaviors/activerecord-relation`
2. Add it to the models you want to use it with, by adding it to the `behaviors()` method.

```
