PHPackages                             petrgrishin/yii-one-side-relation - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. petrgrishin/yii-one-side-relation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

petrgrishin/yii-one-side-relation
=================================

One side relation behavior

1.0.0(11y ago)013MITPHPPHP &gt;=5.3.0

Since May 26Pushed 11y ago1 watchersCompare

[ Source](https://github.com/petrgrishin/yii-one-side-relation)[ Packagist](https://packagist.org/packages/petrgrishin/yii-one-side-relation)[ RSS](/packages/petrgrishin-yii-one-side-relation/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

yii-one-side-relation
=====================

[](#yii-one-side-relation)

[![Travis CI](https://camo.githubusercontent.com/fa0f3221470b9f0396f7fcaccbb6a2e7f6028e306db1b11af1ecb8504868ca11/68747470733a2f2f7472617669732d63692e6f72672f706574726772697368696e2f7969692d6f6e652d736964652d72656c6174696f6e2e706e67 "Travis CI")](https://travis-ci.org/petrgrishin/yii-one-side-relation)[![Coverage Status](https://camo.githubusercontent.com/c693398f0bfe787cd001b21e8dd8ba4dfbff99e72369816cf73bf0c47e8ba68b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f706574726772697368696e2f7969692d6f6e652d736964652d72656c6174696f6e2f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/petrgrishin/yii-one-side-relation?branch=master)

One side relation behavior

Installation
------------

[](#installation)

Add a dependency to your project's composer.json:

```
{
    "require": {
        "petrgrishin/yii-one-side-relation": "~1.0"
    }
}
```

Usage examples
--------------

[](#usage-examples)

#### Attach behavior to you model

[](#attach-behavior-to-you-model)

Model have text attribute `data` for storage relational data

```
use \CActiveRecord as ActiveRecord;
use \PetrGrishin\OneSideRelation\OneSideRelation;

class Model extends ActiveRecord {
    public function behaviors() {
        return array(
            'testRelation' => array(
                'class' => OneSideRelation::className(),
                'fieldNameStorage' => 'data',
                'relationModel' => RelationModel::className(),
            )
        );
    }

}
```

#### Usage behavior

[](#usage-behavior)

```
$model = Model::find(1)->one();
$relatedRecords = $model->testRelation->getRelated();
$model->testRelation->addRelated(new RelationModel());
$model->save();
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4369d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fcef45dd6d44dfcbfeb841a627bbc886b2f9d41f90d8826fb46cd4aca19264d5?d=identicon)[petrgrishin](/maintainers/petrgrishin)

---

Top Contributors

[![petrgrishin](https://avatars.githubusercontent.com/u/580229?v=4)](https://github.com/petrgrishin "petrgrishin (23 commits)")

### Embed Badge

![Health badge](/badges/petrgrishin-yii-one-side-relation/health.svg)

```
[![Health](https://phpackages.com/badges/petrgrishin-yii-one-side-relation/health.svg)](https://phpackages.com/packages/petrgrishin-yii-one-side-relation)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
