PHPackages                             lambelcebur/doctrine-orm-resources - 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. [Database &amp; ORM](/categories/database)
4. /
5. lambelcebur/doctrine-orm-resources

ActiveLibrary[Database &amp; ORM](/categories/database)

lambelcebur/doctrine-orm-resources
==================================

DoctrineORM Resources to Lam

06PHP

Since Jan 10Pushed 6y agoCompare

[ Source](https://github.com/Belcebur/lambelcebur-doctrine-orm-resources)[ Packagist](https://packagist.org/packages/lambelcebur/doctrine-orm-resources)[ RSS](/packages/lambelcebur-doctrine-orm-resources/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

lambelcebur-doctrine-orm-resources
==================================

[](#lambelcebur-doctrine-orm-resources)

DoctrineORMResources

Integrate different modules and provide new resources for DoctrineORM &amp; Lam:

- [doctrine/doctrine-module](https://packagist.org/packages/doctrine/doctrine-module)
- [doctrine/doctrine-orm-module](https://packagist.org/packages/doctrine/doctrine-orm-module)
- [creof/doctrine2-spatial](https://packagist.org/packages/creof/doctrine2-spatial)
- [beberlei/doctrineextensions](https://packagist.org/packages/beberlei/doctrineextensions)
- [gedmo/doctrine-extensions](https://packagist.org/packages/gedmo/doctrine-extensions)

See
---

[](#see)

-

Installation
------------

[](#installation)

Installation of this module uses composer. For composer documentation, please refer to [getcomposer.org](http://getcomposer.org/).

```
composer require lambelcebur/doctrine-orm-resources
```

Then add `LamBelcebur\DoctrineORMResources` to your `config/application.config.php`

Entity Traits
-------------

[](#entity-traits)

- `Lam\DoctrineORMResources\EntityTrait\Coordinates`
    - Latitude and Longitude fields
- `Lam\DoctrineORMResources\EntityTrait\GedmoEntityTranslatable`
    - Gedmo locale field
- `Lam\DoctrineORMResources\EntityTrait\Timestamp`
    - modified\_at and created\_at fields with Gedmo Timestampable

Extend your repository with`\LamBelcebur\DoctrineORMResources\Repository\BaseEntityRepository`
----------------------------------------------------------------------------------------------

[](#extend-your-repository-withlambelceburdoctrineormresourcesrepositorybaseentityrepository)

Extends `Doctrine\ORM\EntityRepository` with access to use `Laminas\Http\PhpEnvironment\Request`,`Laminas\Mvc\I18n\Router\TranslatorAwareTreeRouteStack`,`Laminas\Router\RouteMatch` and `Laminas\Router\RouteStackInterface` and use the new method findByQb

```
return [
'doctrine' => [
    'configuration' => [
        'orm_default' => [
            'class_metadata_factory_name' => ClassMetadataFactory::class,
            'repository_factory' => BaseRepository::class,
        ]
    ]
];
```

### Event Post Construct Repository

[](#event-post-construct-repository)

- If you need to do something after the \_\_construct of the repository then you need to extend your repository of class `LamBelcebur\DoctrineORMResources\Repository\BaseEntityRepository` and implement `LamBelcebur\DoctrineORMResources\Repository\PostConstructInterface`.

### How to integrate GedmoSortableListener with your repository

[](#how-to-integrate-gedmosortablelistener-with-your-repository)

- Enable Sortable Listener in your config

```
return [
    'doctrine' => [
        'eventmanager' => [
            'orm_default' => [
                'subscribers' => [
                    TranslatableListener::class,
                    TimestampableListener::class,
                    SortableListener::class,
                ],
            ],
        ],
    ],
];
```

- Implement `PostConstructInterface` event use `LamBelcebur\DoctrineORMResources\RepositoryTrait\SortableListenerAdapterTrait` in your repository

```
/**
 * CustomRepo
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class CustomRepo extends BaseEntityRepository implements PostConstructInterface
{
    use \LamBelcebur\DoctrineORMResources\RepositoryTrait\SortableListenerAdapterTrait;

    public function postConstruct(): void
    {
        $this->initListenerConfig();
    }
}
```

### New method getEntityAlias()

[](#new-method-getentityalias)

```
    // Entity --> Application\Entity\Admin1
   echo $admin1Repo->getEntityAlias(); // --> "a"
```

### New method getQueryWithGedmoTranslation()

[](#new-method-getquerywithgedmotranslation)

This method apply Gedmo Walkers and Hints to query, get defaultLocale from param or find "locale" on routeMatch params Definition

```
   public function getQueryWithGedmoTranslation(QueryBuilder $qb, string $locale = null, string $defaultLocale = null): Query
```

### New method findByQb()

[](#new-method-findbyqb)

Definition

```
   public function findByQb(array $criteria, array $orderBy = [], int $limit = null, int $offset = null, string $alias = null): QueryBuilder;
```

Examples

```
$admin1sQb = $admin1Repo->findByQb(['country' => $country], ['name' => 'ASC']);
$criteria =
    [
        'orX' => [
            [
                'operator' => 'like',
                'value' => '%espa%',
                'field' => 'name',
            ],
            [
                'operator' => 'like',
                'value' => '%espa%',
                'field' => 'slugName',
            ],
            'andX' => [
                [
                    'operator' => 'eq',
                    'value' => '%espa%',
                    'field' => 'name',
                ],
                [
                    'operator' => 'isNull',
                    'field' => 'slugName',
                ],
            ],
        ],
        [
            'operator' => 'like',
            'value' => '%cosas%',
            'field' => 'slug',
        ],
    ];
   $admin1sQb = $admin1Repo->findByQb($criteria);
```

Validators
==========

[](#validators)

- `NoObjectExist` allow use multiple fields in validator
- `UniqueObject` allow use multiple fields in validator

Gedmo Performance Translatable
==============================

[](#gedmo-performance-translatable)

#### Walkers

[](#walkers)

Extends `GedmoTranslationWalker` to only do necessary query joins

#### Custom class\_metadata\_factory\_name `LamBelcebur\DoctrineORMResources\ORM\Mapping\ClassMetadata`

[](#custom-class_metadata_factory_name-lambelceburdoctrineormresourcesormmappingclassmetadata)

- [doctrine-extensions/DoctrineExtensions#1432](https://github.com/doctrine-extensions/DoctrineExtensions/pull/1432)

```
return [
    __NAMESPACE__ => [
        'gedmo' => [
            'custom_translation_classes' => [
                // 'YourNameSpace\CustomEntityTranslation1',
                // 'YourNameSpace\CustomEntityTranslation2',
                // 'YourNameSpace\CustomEntityTranslation3',
            ]
        ]
    ],
    'doctrine' => [
        'configuration' => [
            'orm_default' => [
                'class_metadata_factory_name' => ClassMetadataFactory::class,
            ]
        ]
    ]
];
```

Configuration by default
------------------------

[](#configuration-by-default)

[See module.config.php](./config/module.config.php)

```
namespace LamBelcebur\DoctrineORMResources;

return [
    __NAMESPACE__ => [
        'gedmo' => [
            'custom_translation_classes' => [
                // 'YourNameSpace\CustomEntityTranslation'
            ]
        ]
    ],
    'service_manager' => [
        'factories' => [
            BaseRepository::class => BaseRepositoryFactory::class,
        ],
    ],
    'doctrine' => [
        'eventmanager' => [
            'orm_default' => [
                'subscribers' => [
                    TranslatableListener::class,
                    TimestampableListener::class,
                    //SortableListener::class,
                ],
            ],
        ],
        'driver' => [
            'translatable_orm_metadata_driver' => [
                'class' => AnnotationORMDriver::class,
                'cache' => 'array',
                'paths' => [
                    getcwd() . '/vendor/gedmo/doctrine-extensions/src/Translatable/Entity',
                ],
            ],
            'orm_default' => [
                'drivers' => [
                    'Gedmo\Translatable\Entity' => 'translatable_orm_metadata_driver',
                ],
            ],
        ],
        'configuration' => [
            'orm_default' => [
                'class_metadata_factory_name' => ClassMetadataFactory::class,
                'repository_factory' => BaseRepository::class,
                'types' => [
                    'point' => PointType::class,
                    'carbondate' => CarbonDateType::class,
                    'carbontime' => CarbonTimeType::class,
                    'linestring' => LineStringType::class,
                    'polygon' => PolygonType::class,
                    'multipolygon' => MultiPolygonType::class,
                ],
                'datetime_functions' => [
                    'date' => Date::class,
                    'date_format' => DateFormat::class,
                    'dateadd' => DateAdd::class,
                    'datediff' => DateDiff::class,
                    'day' => Day::class,
                    'dayname' => DayName::class,
                    'last_day' => LastDay::class,
                    'minute' => Minute::class,
                    'second' => Second::class,
                    'strtodate' => StrToDate::class,
                    'time' => Time::class,
                    'timestampadd' => TimestampAdd::class,
                    'timestampdiff' => TimestampDiff::class,
                    'week' => Week::class,
                    'weekday' => WeekDay::class,
                    'year' => Year::class,
                ],
                'numeric_functions' => [
                    'acos' => Acos::class,
                    'asin' => Asin::class,
                    'atan2' => Atan2::class,
                    'atan' => Atan::class,
                    'cos' => Cos::class,
                    'cot' => Cot::class,
                    'hour' => Hour::class,
                    'pi' => Pi::class,
                    'power' => Power::class,
                    'quarter' => Quarter::class,
                    'rand' => Rand::class,
                    'round' => Round::class,
                    'sin' => Sin::class,
                    'std' => Std::class,
                    'tan' => Tan::class,
                    'st_contains' => STContains::class,
                    'contains' => Contains::class,
                    'st_area' => Area::class,
                    STDistanceSphere::FUNCTION_NAME => STDistanceSphere::class,
                    'ST_Distance' => STDistance::class,
                    'GeomFromText' => GeomFromText::class,
                    'st_intersects' => STIntersects::class,
                    'st_buffer' => STBuffer::class,
                    'Point' => Point::class,
                    'GLength' => GLength::class,
                    'LineString' => LineString::class,
                    'LineStringFromWKB' => LineStringFromWKB::class,
                ],
                'string_functions' => [
                    'binary' => Binary::class,
                    'char_length' => CharLength::class,
                    'concat_ws' => ConcatWs::class,
                    'countif' => CountIf::class,
                    'crc32' => Crc32::class,
                    'degrees' => Degrees::class,
                    'field' => Field::class,
                    'find_in_set' => FindInSet::class,
                    'group_concat' => GroupConcat::class,
                    'ifelse' => IfElse::class,
                    'ifnull' => IfNull::class,
                    'match_against' => MatchAgainst::class,
                    'md5' => Md5::class,
                    'month' => Month::class,
                    'monthname' => MonthName::class,
                    'nullif' => NullIf::class,
                    'radians' => Radians::class,
                    'regexp' => Regexp::class,
                    'replace' => Replace::class,
                    'sha1' => Sha1::class,
                    'sha2' => Sha2::class,
                    'soundex' => Soundex::class,
                    'uuid_short' => UuidShort::class,
                ],
            ],
        ],
    ],
];

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/27a4aba5946d62e4e0d320437ffced1e3628dfc22172dbf20bf832950d0360dc?d=identicon)[Belcebur](/maintainers/Belcebur)

### Embed Badge

![Health badge](/badges/lambelcebur-doctrine-orm-resources/health.svg)

```
[![Health](https://phpackages.com/badges/lambelcebur-doctrine-orm-resources/health.svg)](https://phpackages.com/packages/lambelcebur-doctrine-orm-resources)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M543](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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