2017 © Pedro Peláez
 

framework orm

ORM, schema scaffolding, transactional, relations, late relations

image

spiral/orm

ORM, schema scaffolding, transactional, relations, late relations

  • Wednesday, March 21, 2018
  • by wolfy-j
  • Repository
  • 6 Watchers
  • 9 Stars
  • 1,867 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 0 Forks
  • 5 Open issues
  • 30 Versions
  • 7 % Grown

The README.md

Spiral ORM

Latest Stable Version License Build Status Scrutinizer Code Quality Coverage Status, (*1)

ORM engine with automatic database scaffolding, strict schemas, code discovery, modular database partitions and various relation loaders. Hackable!, (*2)

Full Documentation | CHANGELOG, (*3)

Documentation

Examples

class Post extends RecordEntity
{
    use TimestampsTrait;

    //Database partitions, isolation and aliasing
    const DATABASE = 'blog';

    const SCHEMA = [
        'id'     => 'bigPrimary',
        'title'  => 'string(64)',
        'status' => 'enum(published,draft)',
        'body'   => 'text',

        //Simple relation definitions
        'comments' => [self::HAS_MANY => Comment::class],

        //Not very simple relation definitions
        'collaborators' => [
            self::MANY_TO_MANY  => User::class,
            self::PIVOT_TABLE   => 'post_collaborators_map',
            self::PIVOT_COLUMNS => [
                'time_assigned' => 'datetime',
                'type'          => 'string, nullable',
            ],
            User::INVERSE       => 'collaborated_posts'
        ],

        //Pre-compiled relations
        'author'   => [
            self::BELONGS_TO   => AuthorInterface::class,
            self::LATE_BINDING => true
        ],

        //Hybrid databases
        'metadata' => [
            Document::ONE => Mongo\Metadata::class
        ]
    ];
}
$posts = $postSource->find()->distinct()
    ->with('comments', ['where' => ['{@}.approved' => true]]) //Automatic joins
    ->with('author')->where('author_name', 'LIKE', $authorName) //Fluent
    ->load('comments.author') //Cascade eager-loading (joins or external query)
    ->paginate(10) //Quick pagination using active request
    ->getIterator();

foreach ($posts as $post) {
    echo $post->author->getName();
}
$post = new Post();
$post->publish_at = 'tomorrow 8am';
$post->author = new User(['name' => 'Antony']);

$post->tags->link(new Tag(['name' => 'tag A']));
$post->tags->link($tags->findOne(['name' => 'tag B']));

$transaction = new Transaction();
$transaction->store($post);
$transaction->run();

//--or--: Active record (optional)
$post->save();

//--or--: request specific transaction
$this->transaction->store($post);

The Versions

21/03 2018

dev-develop

dev-develop

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

21/03 2018

v1.0.10

1.0.10.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

14/03 2018

dev-master

9999999-dev

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

14/03 2018

dev-hotfix/exclude_columns_for_withrelation

dev-hotfix/exclude_columns_for_withrelation

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

02/03 2018

v1.0.9

1.0.9.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

02/03 2018

dev-feature/named-indexes

dev-feature/named-indexes

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

23/11 2017

v1.0.8

1.0.8.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

23/11 2017

v1.0.7

1.0.7.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

23/11 2017

v1.0.6

1.0.6.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

23/11 2017

dev-hotfix/nullable_has_one

dev-hotfix/nullable_has_one

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

29/09 2017

v1.0.5

1.0.5.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

29/09 2017

dev-vvval-patch-1

dev-vvval-patch-1

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

20/09 2017

v1.0.3

1.0.3.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

20/09 2017

v1.0.4

1.0.4.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

27/07 2017

v1.0.2

1.0.2.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

27/07 2017

dev-join-method-forced

dev-join-method-forced

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

25/04 2017

v1.0.1

1.0.1.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

25/04 2017

dev-save-tree-sequences

dev-save-tree-sequences

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

05/04 2017

v1.0.0

1.0.0.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

28/03 2017

v0.9.9

0.9.9.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

16/03 2017

v0.9.8

0.9.8.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

16/03 2017

dev-fix-paginator

dev-fix-paginator

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

15/03 2017

v0.9.7

0.9.7.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

13/03 2017

dev-docs

dev-docs

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

12/02 2017

v0.9.6

0.9.6.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

09/02 2017

v0.9.5

0.9.5.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

07/02 2017

v0.9.4

0.9.4.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

07/02 2017

v0.9.3

0.9.3.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

06/02 2017

v0.9.2

0.9.2.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J

03/02 2017

v0.9.1

0.9.1.0

ORM, schema scaffolding, transactional, relations, late relations

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Titov / Wolfy-J