2017 © Pedro PelĂĄez
 

library doctrine-behaviors

Doctrine2 behavior traits

image

knplabs/doctrine-behaviors

Doctrine2 behavior traits

  • Tuesday, May 8, 2018
  • by Knplabs
  • Repository
  • 54 Watchers
  • 554 Stars
  • 1,413,212 Installations
  • PHP
  • 65 Dependents
  • 5 Suggesters
  • 145 Forks
  • 106 Open issues
  • 17 Versions
  • 8 % Grown

The README.md

Doctrine Behaviors

Downloads, (*1)

This PHP library is a collection of traits and interfaces that add behaviors to Doctrine entities and repositories., (*2)

It currently handles:, (*3)

Install

composer require knplabs/doctrine-behaviors

Usage

All you have to do is to define a Doctrine entity:, (*4)

  • implemented interface
  • add a trait

For some behaviors like tree, you can use repository traits:, (*5)

<?php

declare(strict_types=1);

namespace App\Repository;

use Doctrine\ORM\EntityRepository;
use Knp\DoctrineBehaviors\ORM\Tree\TreeTrait;

final class CategoryRepository extends EntityRepository
{
    use TreeTrait;
}

VoilĂ !, (*6)

You now have a working Category that behaves like., (*7)

PHPStan

A PHPStan extension is available and provides the following features: - Provides correct return type for TranslatableInterface::getTranslations() and TranslatableInterface::getNewTranslations() - Provides correct return type for TranslatableInterface::translate() - Provides correct return type for TranslationInterface::getTranslatable(), (*8)

Include phpstan-extension.neon in your project's PHPStan config:, (*9)

# phpstan.neon
includes:
    - vendor/knplabs/doctrine-behaviors/phpstan-extension.neon

3 Steps to Contribute

  • 1 feature per pull-request
  • New feature needs tests
  • Tests and static analysis must pass:, (*10)

    vendor/bin/phpunit
    composer fix-cs
    composer phpstan
    

Upgrade 1.x to 2

There have been many changes between 1 and 2, but don't worry. This package uses Rector, that handles upgrade for you., (*11)

composer require rector/rector --dev

Create rector.php config:, (*12)

vendor/bin/rector init

Add Doctrine Behaviors upgrade set to rector.php:, (*13)

use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\Doctrine\Set\DoctrineSetList;

return static function (ContainerConfigurator $containerConfigurator): void {
    $containerConfigurator->import(DoctrineSetList::DOCTRINE_BEHAVIORS_20);
};

Run Rector:, (*14)

vendor/bin/rector process src

The Versions

08/05 2018

dev-master

9999999-dev http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

27/09 2017

1.5.0

1.5.0.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

27/09 2017

dev-add-extraparameters-to-tree

dev-add-extraparameters-to-tree http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

19/09 2017

1.4.1

1.4.1.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

30/09 2016

1.4.0

1.4.0.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

09/03 2016

1.3.2

1.3.2.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

09/03 2016

1.3.1

1.3.1.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

18/12 2015

1.3.0

1.3.0.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

11/09 2015

1.2.0

1.2.0.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

14/07 2015

1.1.1

1.1.1.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

11/05 2015

v1.1.0

1.1.0.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

06/02 2015

v1.0.3

1.0.3.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

25/09 2014

dev-fix/bc-layer

dev-fix/bc-layer http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

17/09 2014

v1.0.2

1.0.2.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

22/01 2014

v1.0.1

1.0.1.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

17/06 2013

v1.0.0

1.0.0.0 http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable

05/12 2012

dev-odm

dev-odm http://knplabs.com

Doctrine2 behavior traits

  Sources   Download

MIT

The Requires

 

The Development Requires

filterable doctrine2 translatable tree behaviors timestampable blameable softdeletable