Skip to content

Commit 7aba1d8

Browse files
authored
Merge pull request #1 from activecollab/manager
Rename Objects to Entities, deprecate old Object class and ObjectInterface, and add concept of Entity Manager
2 parents 8ffe09f + c0aa337 commit 7aba1d8

20 files changed

+1324
-1157
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@
55
DatabaseObject library is a set of classes that make work with database just a bit easier. Here are the key concepts:
66

77
1. Types - entities that map to a single table,
8-
2. Objects - type instances that map to a single row of a type table,
9-
3. Collections - a group of objects that meets the given criteria. This group is perfect for HTTP responses because collections support data tagging and tag validation (ETag and HTTP 304),
10-
4. Pool - manage registered types and make multi-type interaction possible,
11-
6. Producers - customise the way pool produces new instances,
12-
7. Validators - validate object properties before saving them to the database.
8+
1. Entities - type instances that map to a single row of a type table,
9+
1. Entity Manager - instances that provide access to custom type specific manipulation methods,
10+
1. Collections - a group of objects that meets the given criteria. This group is perfect for HTTP responses because collections support data tagging and tag validation (ETag and HTTP 304),
11+
1. Pool - manage registered types and make multi-type interaction possible,
12+
1. Producers - customise the way pool produces new instances,
13+
1. Validators - validate object properties before saving them to the database.
1314

1415
## CRUD
1516

1617
If you wish to work with entire tables, use CRUD methods provided by `ConnectionInterface`:
1718

1819
1. `ConnectionInterface::insert()` - insert one or more rows
19-
2. `ConnectionInterface::update()` - update a set of rows that match the given conditions, if any
20-
3. `ConnectionInterface::delete()` - drop a set of rows taht match the given conditions, if any
20+
1. `ConnectionInterface::update()` - update a set of rows that match the given conditions, if any
21+
1. `ConnectionInterface::delete()` - drop a set of rows taht match the given conditions, if any
2122

2223
When you need to work with individual instances, `PoolInterface` provides following handy methods:
2324

2425
1. `PoolInterface::produce()` - create a new record based on the given parameters,
25-
2. `PoolInterface::modify()` - change the given object with a set of parameters,
26-
3. `PoolInterface::scrap()` - trash or permanently delete the given object.
26+
1. `PoolInterface::modify()` - change the given object with a set of parameters,
27+
1. `PoolInterface::scrap()` - trash or permanently delete the given object.
2728

2829
## Scrap
2930

src/Collection/Type.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use ActiveCollab\DatabaseConnection\Result\ResultInterface;
1212
use ActiveCollab\DatabaseObject\Collection;
13-
use ActiveCollab\DatabaseObject\ObjectInterface;
13+
use ActiveCollab\DatabaseObject\Entity\EntityInterface;
1414
use Doctrine\Common\Inflector\Inflector;
1515
use InvalidArgumentException;
1616
use LogicException;
@@ -159,7 +159,7 @@ public function getTimestampHash($timestamp_field)
159159
/**
160160
* Run the query and return DB result.
161161
*
162-
* @return ResultInterface|ObjectInterface[]
162+
* @return ResultInterface|EntityInterface[]
163163
*/
164164
public function execute()
165165
{

src/CollectionInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace ActiveCollab\DatabaseObject;
1010

1111
use ActiveCollab\DatabaseConnection\Result\ResultInterface;
12+
use ActiveCollab\DatabaseObject\Entity\EntityInterface;
1213
use ActiveCollab\Etag\EtagInterface;
1314
use JsonSerializable;
1415

@@ -35,7 +36,7 @@ public function &setApplicationIdentifier($value);
3536
/**
3637
* Run the query and return DB result.
3738
*
38-
* @return ResultInterface|ObjectInterface[]
39+
* @return ResultInterface|EntityInterface[]
3940
*/
4041
public function execute();
4142

0 commit comments

Comments
 (0)