Download the PHP package asgard/orm without Composer
On this page you can find all versions of the php package asgard/orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package orm
ORM
The ORM package gives you the possibility to store, fetch, search entities and define their relations to each other. It works with the Asgard Entity package.
Installation
If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries.
composer require asgard/orm 0.*
Entity Relations
To define relations between entities, please read ORM Relations.
<?php
namespace Blog\Entities\Post;
class Post extends \Asgard\Entity\Entity {
public static function definition(\Asgard\Entity\Definition $definition) {
$definition->properties = [
'title',
'content',
'tags' => [
'type' => 'entity',
'entity' => 'Blog\Entities\Tag',
'many' => true
],
];
$definition->behaviors = [
new \Asgard\Orm\ORMBehavior
];
}
}
Persistence
To persist and fetch entities, there are two options:
Data Mapper
$dataMapper->save($entity);
ORMBehavior (ActiveRecord pattern)
$entity->save();
ORM
The ORM class helps you construct queries to manipulate your stored entities. See the documentation.
$entities = $orm->where('position > ?', 5)->orderBy('title ASC')->get();
Commands
List of commands that come with the ORM package.
Contributing
Please submit all issues and pull requests to the asgardphp/asgard repository.
License
The Asgard framework is open-sourced software licensed under the MIT license
All versions of orm with dependencies
asgard/db Version ~0.3.0
doctrine/dbal Version ^2.0
asgard/common Version ~0.3.0
asgard/entity Version ~0.3.0
asgard/migration Version ~0.3.0
asgard/validation Version ~0.3.0