PHPackages                             philippgrashoff/secondarymodelforatk - 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. philippgrashoff/secondarymodelforatk

ActiveLibrary

philippgrashoff/secondarymodelforatk
====================================

6.0.2(8mo ago)01.7k↓31%6PHPPHP 8.\*CI failing

Since Mar 13Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/PhilippGrashoff/secondarymodelforatk)[ Packagist](https://packagist.org/packages/philippgrashoff/secondarymodelforatk)[ RSS](/packages/philippgrashoff-secondarymodelforatk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (20)Used By (6)

secondarymodelforatk
====================

[](#secondarymodelforatk)

[![codecov](https://camo.githubusercontent.com/6f16550925064ba75d38cf6d382aab3a93e56dce870517a2bc1b48594caf18b1/68747470733a2f2f636f6465636f762e696f2f67682f5068696c69707047726173686f66662f7365636f6e646172796d6f64656c666f7261746b2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/PhilippGrashoff/secondarymodelforatk)

This repository is an extension for [atk4/data](https://github.com/atk4/data). The use case is as follows: You have a Model which can't exist sensibly on its own, e.g. an email address. Without the link to the person/company/somethingelse it belongs to, its pretty useless.

This library helps you if you have e.g. emails which can belong to several "parent" models, like Person Model and Company model, and each Person and each Company can have several emails.

If you want to store all these emails in the same table, you need to save which Model class and which Model Id each email belongs to. Example data of "email" table:

```
id   value                model_class                 entity_id
1    some@email.com       Your\Namespace\Person       4
