Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Repository - implement deleteOne Apr 13, 2016
tests Persister\DBAL - implement very simple update method Jan 25, 2016
.gitignore Init composer Nov 23, 2015
.scrutinizer.yml
.travis.yml TravisCI - run phpcs and tests Nov 23, 2015
LICENSE Added LICENSE file Nov 23, 2015
README.md [README] Write docs Dec 29, 2015
composer.json [Composer] Doctrine Cache 1.6.0 released! Jan 4, 2016
phpmd.xml.dist Use own config for ScrutinizerCI Nov 23, 2015
phpunit.xml.dist Added phpunit.xml.*.dist(s) Nov 23, 2015
phpunit.xml.pgsql.dist Added phpunit.xml.*.dist(s) Nov 23, 2015

README.md

Lynx

Build Status Scrutinizer Code Quality Code Coverage

An awesome Mapper on top of Doctrine 2 components

How to work?

First you need to setup EntityManager ($em) :

$configuration = new Configuration();
$configuration->setResultCacheImpl($di->getCache());
$configuration->setMetadataDriverImpl(
    new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(
        new AnnotationReader(),
        realpath(APP_ROOT_PATH . '/src/BlaBla/User/Model/')
    )
);
$configuration->setMetadataCacheImpl(
    new \Doctrine\Common\Cache\ApcCache()
);

$em = new \Lynx\EntityManager(
    $di->getDb(),
    $configuration
);

Working with repository

You can get a Repository for Model by using method getRepository from EntityManager:

$repository = $em->getRepository(User::class);

For example, you can get one row by using:

$repository = $em->getRepository(User::class);
/** User|null $user */
$user = $repository->findOne(1);

You can count all rows from table:

$repository = $em->getRepository(User::class);
$count = $repository->count();

Testing

PostgresSQL

sudo docker run --name lynx-test -p 5432:5432 -e POSTGRES_PASSWORD= -d postgres
psql -p 5432 -h 127.0.0.1 -U postgres -c 'create database lynx_test;'
psql -p 5432 -h 127.0.0.1 -U postgres -d lynx_test -f tests/schemas/pqsql/lynx_test.sql

LICENSE

MIT

You can’t perform that action at this time.