2017 © Pedro Peláez
 

library lodm

Laravel ODM module using Spiral ODM component.

image

wolfy-j/lodm

Laravel ODM module using Spiral ODM component.

  • Wednesday, August 2, 2017
  • by wolfy-j
  • Repository
  • 5 Watchers
  • 23 Stars
  • 1,250 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 12 Versions
  • 1 % Grown

The README.md

ODM with inheritance and OOP composition for Laravel 5+

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

Full Documentation | CHANGELOG, (*2)

LODM module is intended to bring the Spiral ODM component functionality into your Laravel applications. This component provides the ability to manage your MongoDB data in an OOP way using your models compositions and aggregations., (*3)

Installation

Package installation can be performed using the simple composer command $ composer require wolfy-j/lodm., (*4)

To include ODM functionality in your application, you have to register the service provider Spiral\LODM\Laravel\ODMServiceProvider and CLI command Spiral\LODM\Commands\SchemaUpdate in the app.php configure and ConsoleKernel accordingly., (*5)

The module provides two configuration files which describe the class location directories (by default whole application), the set of connected MongoDB databases (ODM does not use any of Laravel's database functionality) and options that can simplify document creation., (*6)

Documentation

Examples

class User extends Document
{
  const SCHEMA = [
    '_id'            => \MongoId::class,
    'name'           => 'string',
    'email'          => 'string',
    'balance'        => 'float',
    'timeRegistered' => \MongoDate::class,
    'tags'           => ['string'],
    'profile'        => Profile::class,

    //Aggregations
    'posts'          => [
        self::MANY => Post::class,
        ['userId' => 'self::_id']
    ]
  ];
}
protected function indexAction()
{
    $u = new User();
    $u->name = 'Anton';
    $u->email = 'test@email.com';
    $u->balance = 99;
    $u->save();

    dump($u);
}
protected function indexAction(string $id, UsersRepository $users)
{
    $user = $users->findByPK($id);
    if (empty($user)) {
        throw new NotFoundException('No such user');
    }

    dump($user);
}
$user = User::findOne();
$user->profile->biography = 'some bio';
$user->profile->facebookUID = 2345678;

$user->sessions->solidState(false);
$user->sessions->push(new Session([
    'timeCreated' => new \MongoDate(),
    'accessToken' => 'newrandom'
]));

Issues

Please do not open issue tickets in this github project unless they are related to the integration process. Use Primary Respository for ODM related issues., (*7)

The Versions

02/08 2017

dev-master

9999999-dev

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

02/08 2017

v0.9.6

0.9.6.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

02/08 2017

v0.9.5

0.9.5.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

28/07 2017

v0.9.4

0.9.4.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

28/07 2017

v0.9.3

0.9.3.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

27/07 2017

v0.9.2

0.9.2.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

27/07 2017

v0.9.1

0.9.1.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

26/07 2017

v0.9.0

0.9.0.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

28/04 2017

v0.6.3

0.6.3.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

19/01 2017

v0.6.2

0.6.2.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

07/03 2016

v0.6.1

0.6.1.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J

15/12 2015

v0.6.0

0.6.0.0

Laravel ODM module using Spiral ODM component.

  Sources   Download

The Requires

 

by Anton Titov / Wolfy-J