PHPackages                             kapitchi/entity - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kapitchi/entity

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kapitchi/entity
===============

Generic entity API and entity revision control.

0.1.x-dev(11y ago)33214PHPPHP &gt;=5.3.3

Since Aug 1Pushed 11y ago3 watchersCompare

[ Source](https://github.com/kapitchi/KapitchiEntity)[ Packagist](https://packagist.org/packages/kapitchi/entity)[ Docs](http://kapitchi.com)[ RSS](/packages/kapitchi-entity/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (4)

Zend Framework 2 - Kapitchi Entity module
=========================================

[](#zend-framework-2---kapitchi-entity-module)

**Version:** 0.1-dev
**Website:**
**Demo:**
**Copyright:** [(c) 2012-2013 Kapitchi Open Source Team](http://kapitchi.com/open-source-team)

**README.md status:** INCOMPLETE

License
=======

[](#license)

[![LGPLv3](https://camo.githubusercontent.com/5d748f418ddd55edbdb4d4ea7ec28b4dabb5332cb45818384de7bc5536408fa2/687474703a2f2f7777772e676e752e6f72672f67726170686963732f6c67706c76332d38387833312e706e67)](https://camo.githubusercontent.com/5d748f418ddd55edbdb4d4ea7ec28b4dabb5332cb45818384de7bc5536408fa2/687474703a2f2f7777772e676e752e6f72672f67726170686963732f6c67706c76332d38387833312e706e67)
[The GNU Lesser General Public License, version 3.0](LICENSE.txt)

Introduction
============

[](#introduction)

Set of common classes/interfaces to provide generic entity API and event triggering - services, mappers, controllers and helpers to work and manage entities. Entity is defined as POPO implementing one method getId() and having empty constructor.

Installation
============

[](#installation)

TODO

Basic Usage
===========

[](#basic-usage)

Find entity/entities
--------------------

[](#find-entityentities)

Find by entity ID

```
    $entity = $service->find(1); //returns entity object or null if not found
    //OR
    $entity = $service->get(1); //throws exception if not found

```

Get entity paginator by multiple criteria

```
    $paginator = $service->getPaginator(array(
        'displayName' => 'kapitchi'
    ), array(
        'created' => 'ASC' //order by created ascending
    ));

    $entities = $paginator->getCurrentItems();

```

Persist entity
--------------

[](#persist-entity)

Persist entity object. Note that new entity is inserted when getId() is not 'empty' value otherwise a mapper performs update

```
    $entity = $service->createEntityFromArray(array( //creates entity from array
        'displayName' => 'kapitchi'
    ));
    $persistEvent = $service->persist($entity);
    //$entity->getId() is populated now

```

Persist entity from array

```
    $persistEvent = $service->persist(array(
        'displayName' => 'kapitchi'
    ));

```

Remove entity
-------------

[](#remove-entity)

```
$service->remove($entity);

```

Events
======

[](#events)

Example presumes using MyModule\\Service\\MyEntity service class name.

$service-&gt;persist($entity)
-----------------------------

[](#service-persistentity)

Event: MyModule\\Service\\MyEntity:persist Params:

- entity - entity object
- data - when entity is persisted from array
- origEntity - when persisting/updating an existing entity we load from mapper original entity first

TODO

Service manager configuration
=============================

[](#service-manager-configuration)

Entity service with Zend\\Db mapper
-----------------------------------

[](#entity-service-with-zenddb-mapper)

```
    'MyModule\Service\MyEntity' => function ($sm) {
        $s = new Service\MyEntity(
            $sm->get('MyModule\Mapper\MyEntity'),
            $sm->get('MyModule\Entity\MyEntity'),
            $sm->get('MyModule\Entity\MyEntityHydrator')
        );
        return $s;
    },
    'MyModule\Mapper\MyEntityDbAdapter' => function ($sm) {
        return new \KapitchiEntity\Mapper\MyEntityDbAdapter(
            $sm->get('Zend\Db\Adapter\Adapter'),
            new EntityDbAdapterMapperOptions(array(
                'tableName' => 'identity_auth_credential',
                'primaryKey' => 'id',
                'hydrator' => $sm->get('MyModule\Entity\MyEntityHydrator'),
                'entityPrototype' => $sm->get('MyModule\Entity\MyEntity'),
            ))
        );
    },
    'MyModule\Entity\MyEntityHydrator' => function ($sm) {
        //needed here because hydrator tranforms camelcase to underscore
        return new \Zend\Stdlib\Hydrator\ClassMethods(false);
    },

```

Entity service with Doctrine mapper
-----------------------------------

[](#entity-service-with-doctrine-mapper)

TODO

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4200d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/400247f20bf85825992e22a411eb25be7c6fb2fdd66ef613b9d41abdfbb58c4d?d=identicon)[kapitchi](/maintainers/kapitchi)

---

Top Contributors

[![matuszeman](https://avatars.githubusercontent.com/u/1564337?v=4)](https://github.com/matuszeman "matuszeman (61 commits)")[![andrejkukucka](https://avatars.githubusercontent.com/u/2411800?v=4)](https://github.com/andrejkukucka "andrejkukucka (13 commits)")

---

Tags

entityzf2kapitchi

### Embed Badge

![Health badge](/badges/kapitchi-entity/health.svg)

```
[![Health](https://phpackages.com/badges/kapitchi-entity/health.svg)](https://phpackages.com/packages/kapitchi-entity)
```

###  Alternatives

[zf-commons/zfc-base

A set of genetic (abstract) classes which are commonly used across multiple modules.

1441.1M25](/packages/zf-commons-zfc-base)[shapecode/hidden-entity-type-bundle

Hidden field for Symfony entities

28428.6k1](/packages/shapecode-hidden-entity-type-bundle)[dkcwd/dkcwd-zf2-munee

Zend Framework 2 module leveraging 'munee' an asset optimisation library developed by Cody Lundquist. You can find munee at http://github.com/meenie/munee

102.1k](/packages/dkcwd-dkcwd-zf2-munee)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
