Download the PHP package activecollab/databaseobject without Composer
On this page you can find all versions of the php package activecollab/databaseobject. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package databaseobject
DatabaseObject Library
DatabaseObject library is a set of classes that make work with database just a bit easier. Here are the key concepts:
- Types - entities that map to a single table,
- Entities - type instances that map to a single row of a type table,
- Entity Manager - instances that provide access to custom type specific manipulation methods,
- 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),
- Pool - manage registered types and make multi-type interaction possible,
- Producers - customise the way pool produces new instances,
- Validators - validate object properties before saving them to the database.
CRUD
If you wish to work with entire tables, use CRUD methods provided by ConnectionInterface:
ConnectionInterface::insert()- insert one or more rowsConnectionInterface::update()- update a set of rows that match the given conditions, if anyConnectionInterface::delete()- drop a set of rows taht match the given conditions, if any
When you need to work with individual instances, PoolInterface provides following handy methods:
PoolInterface::produce()- create a new record based on the given parameters,PoolInterface::modify()- change the given object with a set of parameters,PoolInterface::scrap()- trash or permanently delete the given object.
Scrap
Recently we added ScrapInterface. This interface should be implemented by models which support object trashing, instead of instant deletion. When PoolInterface::scrap() method is called, objects that implement ScrapInterface will be scrapped (marked as deleted or trashed, depending on a particular implementation), instead of being permanently deleted.
Finder
To set conditions, use where method:
This method can be called multiple times, and all conditions will be joined in one block with AND operator:
Finder can join a table, either by table name:
or by related type:
Note that in the second case, WriterGroup type needs to be registered in the pool.
DI Container
Pool implements ActiveCollab\ContainerAccess\ContainerAccessInterface, so you can set any container that implements Interop\Container\ContainerInterface interface, and that container will be passed on and made available in finders, producers and objects:
Generated Fields
Generated fields are fields that exist in tables, but they are not controlled or managed by the entity class itself. Instead, values of these models are set elsewhere:
- They are specifief as generated columns in table's definition,
- Trigger set the values,
- Values are set by external systems or processes.
Library provides access to values of these fields, via accessors methods, but these values can't be set using setter methods:
Value casting can be set during entity configuration:
Entity class also refreshes the values of these fields on object save so fresh values are instantly available in case they are recalculated in the background (by a trigger or generated field expression).
To Do
- Caching,
- Add support for PHP enums
Remove deprecatedObjectInterfaceandObjectclass.
All versions of databaseobject with dependencies
activecollab/databaseconnection Version ^3.0||^4.0
activecollab/etag Version ^1.0
activecollab/object Version ^1.0
doctrine/inflector Version ^1.0
psr/log Version ^1.0.0