1- # Hawkbit Persistence
1+ # Hawkbit Database
22
33[ ![ Latest Version on Packagist] [ ico-version ]] [ link-packagist ]
44[ ![ Software License] [ ico-license ]] ( LICENSE.md )
55[ ![ Build Status] [ ico-travis ]] [ link-travis ]
66[ ![ Total Downloads] [ ico-downloads ]] [ link-downloads ]
77[ ![ Coverage Status] [ ico-coveralls ]] [ link-coveralls ]
88
9- Persistence layer for Hawkbit PSR-7 Micro PHP framework.
10- Features unit of work, identity map, object graph, popo's and mapper.
9+ Object orientated database handling with POPO's, unit of work, identity map and data mapper.
1110
1211## Install
1312
@@ -39,7 +38,7 @@ require __DIR__ . '/vendor/autoload.php';
3938
4039### Downloading .zip file
4140
42- This project is also available for download as a ` .zip ` file on GitHub. Visit the [ releases page] ( https://github.com/hawkbit/persistence /releases ) , select the version you want, and click the "Source code (zip)" download button.
41+ This project is also available for download as a ` .zip ` file on GitHub. Visit the [ releases page] ( https://github.com/hawkbit/database /releases ) , select the version you want, and click the "Source code (zip)" download button.
4342
4443### Requirements
4544
@@ -50,91 +49,9 @@ The following versions of PHP are supported by this version.
5049* PHP 7.0
5150* HHVM
5251
53- ## Setup
52+ ## Usage
5453
55- Create a Mapper and an entity. See
56-
57- Create a Connection and register mappers
58-
59- ``` php
60- <?php
61-
62- use Hawkbit\Database\ConnectionManager;
63- use Application\Persistence\Mappers\PostMapper;
64-
65- $connection = ConnectionManager::create([
66- 'url' => 'sqlite:///:memory:',
67- 'memory' => 'true'
68- ]);
69-
70- $connection->getMapperLocator()->register(PostMapper::class);
71- ```
72-
73- Load Mapper by mapper class or entity class
74-
75- ``` php
76- <?php
77-
78- use Application\Persistence\Mappers\PostMapper;
79- use Application\Persistence\Entities\Post;
80-
81- // load by mapper
82- $mapper = $connection->loadMapper(PostMapper::class);
83-
84- // load by entity
85- $mapper = $connection->loadMapper(Post::class);
86-
87- ```
88-
89- ## Data manipulation
90-
91- ### Create entity
92-
93- ``` php
94- <?php
95-
96- use Application\Persistence\Entities\Post;
97-
98- $entity = new Post();
99-
100- $entity->setContent('cnt');
101-
102- /** @var Post $createdEntity */
103- $mapper->create($entity);
104-
105- ```
106-
107-
108- ### Load entity
109-
110- ``` php
111- <?php
112-
113- $entity = $mapper->find(['id' => 1]);
114-
115- ```
116-
117-
118- ### Update entity
119-
120- ``` php
121- <?php
122-
123- $entity->setContent('FOO');
124- $mapper->update($entity);
125-
126- ```
127-
128- ### Delete entity
129-
130- ``` php
131- <?php
132-
133- $mapper->delete($entity);
134-
135- ```
136-
137- ## Transactions
54+ View [ Examples] ( examples ) for usage.
13855
13956## Change log
14057
@@ -157,17 +74,17 @@ If you discover any security related issues, please email <
[email protected] > instead
15774## Credits
15875
15976- [ Marco Bunge] ( https://github.com/mbunge )
160- - [ All contributors] ( https://github.com/hawkbit/persistence /graphs/contributors )
77+ - [ All contributors] ( https://github.com/hawkbit/database /graphs/contributors )
16178
16279## License
16380
16481The MIT License (MIT). Please see [ License File] ( LICENSE.md ) for more information.
16582
166- [ ico-version ] : https://img.shields.io/packagist/v/hawkbit/persistence .svg?style=flat-square
83+ [ ico-version ] : https://img.shields.io/packagist/v/hawkbit/database .svg?style=flat-square
16784[ ico-license ] : https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
168- [ ico-travis ] : https://img.shields.io/travis/HawkBitPhp/hawkbit-persistence /master.svg?style=flat-square
169- [ ico-downloads ] : https://img.shields.io/packagist/dt/hawkbit/persistence .svg?style=flat-square
170- [ ico-coveralls ] : https://img.shields.io/coveralls/HawkBitPhp/hawkbit-persistence /master.svg?style=flat-square
85+ [ ico-travis ] : https://img.shields.io/travis/HawkBitPhp/hawkbit-database /master.svg?style=flat-square
86+ [ ico-downloads ] : https://img.shields.io/packagist/dt/hawkbit/database .svg?style=flat-square
87+ [ ico-coveralls ] : https://img.shields.io/coveralls/HawkBitPhp/hawkbit-database /master.svg?style=flat-square
17188
17289[ link-packagist ] : https://packagist.org/packages/hawkbit/hawkbit
17390[ link-travis ] : https://travis-ci.org/HawkBitPhp/hawkbit
0 commit comments