Download the PHP package awoyotoyin/zfe-base without Composer
On this page you can find all versions of the php package awoyotoyin/zfe-base. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download awoyotoyin/zfe-base
More information about awoyotoyin/zfe-base
Files in awoyotoyin/zfe-base
Package zfe-base
Short Description Base Library for Zend Expressive/Doctrine ORM
License MIT
Homepage https://www.github.com/awoyotoyin/zfe-base
Informations about the package zfe-base
Doctrine ORM DB Abstraction
Installation
Register the module
Zend Expressive
Usage
Entity Class
Your Entity class should extend Zfe\Common\Entity\AbstractEntity
.
The Zfe\Common\Entity\AbstractEntity
class defines the Id, CreatedAt and UpdatedAt attributes for your entity.
If you are extending from this class, your Entity class must define the lifecycle callbacks as it is required for both the CreatedAt and UpdatedAt attributes.
The Zfe\Common\Entity\AbstractEntity
class also exposes a exchangeArray
method that takes an array as it's only argument and set your entity members from the array members.
Provider Class
The Provider performs all database related operations hence, this class would mostly contain queries to your Entity.
All you have to do is define your Entity class and Zfe\Common\Provider\AbstractProvider
does all the heavy lifting
Available methods
Service Class
System Events
This library ships with the Zend\EventManager\EventManager
.
By default, there are 4 built in events that are triggered before and after the following operations:
To fire off entity specific event, your provider class must set the value of the $entity_event_prefix
property. See PostProvider
definition above.
In which case, the following events are now available to us as well:
To register your own custom event listener, create a .config.php
file with contents similar to own below:
There is a sample events.config.php.dist
file included in the config
folder.
The App\Observer\PostObserver
defined above could contain the below code. Replace with your logic
All versions of zfe-base with dependencies
dasprid/container-interop-doctrine Version ^1.1
zendframework/zend-log Version ^2.9