asjustas/doctrine-traits

Trait to help work with doctrine

v0.1.0 2017-03-04 15:08 UTC

This package is auto-updated.

Last update: 2024-10-29 05:10:31 UTC


README

Latest Stable Version Latest Unstable Version

Traits to help now write same code again.

Installation

Install via composer:

composer require asjustas/doctrine-traits

Traits

AddRepositoryTrait

Trait add add method to doctrine repository.

class UserRepository extends EntityRepository
{
    use AddRepositoryTrait;
}

persist and flush object:

$userRepository->add($object);

only persist object:

$userRepository->add($object, false);

AddManyRepositoryTrait

Trait add addMany method to doctrine repository.

class UserRepository extends EntityRepository
{
    use AddManyRepositoryTrait;
}

persist and flush objects array:

$userRepository->addMany($objects);

only persist objects array:

$userRepository->addMany($object, false);

RemoveRepositoryTrait

Trait add remove method to doctrine repository.

class UserRepository extends EntityRepository
{
    use RemoveRepositoryTrait;
}

remove and flush object:

$userRepository->remove($object);

only remove object:

$userRepository->remove($object, false);

RemoveManyRepositoryTrait

Trait add addMany method to doctrine repository.

class UserRepository extends EntityRepository
{
    use RemoveManyRepositoryTrait;
}

remove and flush objects array:

$userRepository->removeMany($objects);

only remove objects array:

$userRepository->removeMany($object, false);