Giter Site home page Giter Site logo

secondarymodelforatk's Introduction

secondarymodelforatk

codecov

This repository is an extension for 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                 model_id
1    [email protected]       Your\Namespace\Person       4           <- This email belongs to person with Id 4
2    [email protected]    Your\Namespace\Person       4           <- This one too
3    [email protected]    Your\Namespace\Company      2           <- This one belongs to the company with id 2

This package helps you set up this with only a few lines of code. Check tests\testmodels to see demo code for the example above.

Installation

The easiest way to use this repository is to add it to your composer.json in the require section:

{
  "require": {
    "philippgrashoff/secondarymodelforatk": "4.0.*"
  }
}

Versioning

The version numbers of this repository correspond with the atk4\data versions. So 4.0.x is compatible with atk4\data 4.0.x and so on.

secondarymodelforatk's People

Contributors

philippgrashoff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.