Giter VIP home page Giter VIP logo

orm's Introduction

Brick

Incubator for PHP components under development.

Build Status Coverage Status License

Once a component reaches sufficient maturity, it will be moved to its own repository and composer package, and enter a beta phase. For this reason, this repository will never contain releases.

The incubator can be included in your project using Composer. Just define the following requirement in your composer.json file:

{
    "require": {
        "brick/brick": "dev-master"
    }
}

Feel free to use the incubator for your own use/research, but please note that the API can, and will, change at any time. Components can also disappear at any time.

orm's People

Contributors

benmorel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

orm's Issues

Support for serialized data

We now have support for JSON columns, but it would be interesting to support storing a property into a string column as a serialized string as well.

JSON is good for a lot of use cases, but it cannot unserialize to custom classes.

WHERE IN () for discriminator values

When finding an entity that has child classes, we need to perform a WHERE IN() with the discriminator value of the entity class AND those of all its subclasses.

Currently, only the dicriminator value for the class itself is requested.

please add some docs

Apart from the title,

Thanks for this!! I was wondering why aren't more people making this happen, using PHP 7.4 typed properties is an absolutely fantastic idea!!

Would it be as easy as writing models like?

 class Person{
    integer $id;
    string $name;
    Country $country;
  }

it would be nice if all tables were autogenerated (like spring-boot and grails etc),

and the usage would be as easy as:

 $p = new Person("John", Country.findByName("Australia"));
 $p.save();  // or PersonRepo.save($p)
 PersonRepo.get(1)
 Person.get(1) //even better

other variations:

CountryRepo.findByIdAndName(3, "Australia");
CountryRepo.findByNameLike("Aus%");
CountryRepo.findAllByNameIn(["Korea", "Japan", "Australia"])

GORM(Hibernate based) is one of the best ORMs from the Java/Groovy world, would be nice if can copy those features:
http://gorm.grails.org/latest/hibernate/manual/index.html

Would be interesting to see how it integrates with laravel (I'd rather use PDO than use Eloquent )

Make 'id' property the identity property & autoincrement by default

If setIdentityProperty() has not been called after addEntity() during configuration, and the entity has an id property that's an int or a string, consider it an auto-increment identity field by default.

This will prevent overly verbose configuration files as most entities have such an ID.

Support for storing whole entities as JSON documents

Several databases now have first-class support for JSON, allowing to store whole entities as JSON documents, like in a NoSQL database.

We do have support for individual JSON columns, but it would be interesting to add support to store a whole entity (all properties) as a single JSON column.

The table would look like:

id   INT PRIMARY KEY
data JSON

It should be possible to mix entities mapped in a typical object-to-relational way, and entities mapped to JSON, in the same application, with support from this library.

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.