Download the PHP package kappa/doctrine without Composer
On this page you can find all versions of the php package kappa/doctrine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package doctrine
Kappa\Doctrine
Collection of classes for better work with Doctrine
Requirements
- PHP 5.4 or higher
- Doctrine 2
- Nette Framework
- Kdyby\Doctrine
Installation:
The best way to install Kappa\Doctrine is using Composer
Usages
Converter::entityToArray()
Method entityToArray
requires entity object and returns Kappa\Doctrine\Converters\EntityToArrayConverter
.
setIgnoreList(array)
- set list of items which you can ignore (ignore list and white list can be combined)setWhiteList(array)
- set list of items which you can transform (ignore list and white list can be combined)addFieldResolver(column name, resolver)
- you can set closure or concrete value for fieldconvert()
- returns generated array
Example:
Converter::arrayToEntity()
Method arrayToEntity
requires two argument. First argument can be entity object or entity class name and returns
Kappa\Doctrine\Converters\ArrayToEntityConverter
.
setIgnoreList(array)
- set list of items which you can ignore (ignore list and white list can be combined)setWhiteList(array)
- set list of items which you can transform (ignore list and white list can be combined)addItemResolver(column name, resolver)
- you can set closure or concrete value for itemconvert()
- returns generated array
Example:
CrudManager
Recommended way for create instance of Kappa\Doctrine\Managers\CrudManager
is use Kappa\Managers\CrudManagerFactory
.
Method create()
requires only one argument which it can be instance of entity or full namespace name.
Created CrudManager contains three methods for basic works with entity.
create(array)
- Create a new entity and fill with dataupdate(id, array)
- Find entity byid
and fill with datadelete(id)
- Delete entity withid
FormItemsCreator
use default columns id
and title
and create array like this
You can change default columns via config
or as a third and fourth argument
Third argument is valueColumn
and last argument is identifierColumn
QueryExecutor
Time to time is needed run DQL query instead of manipulate with entity. Great way is build UPDATE (or DELETE) with QueryBuilder
.
Is very useful to create a query object for such cases. In Doctrine and Kdyby\Doctrine
you can create SELECT
query and run with $this->repository->fetch(new QueryObject)
but UPDATE
or DELETE
query is not supported. QueryExecutor
is precisely for these situations.
Example:
php