2017 © Pedro Peláez
 

library doctrine-data

Bring SpringData features into PHP

image

evilband7/doctrine-data

Bring SpringData features into PHP

  • Thursday, December 8, 2016
  • by evilband7
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

DoctrineData

Extends doctrine repository feature with pagination support. (Inspired from SpringData project.), (*1)

Feature

  • Create your own Repository class without implementation (Interface Only)
  • Also support custom implementation.
  • Support Pagination with strong type pagination stubs (DoctrineData\Pagination\*)
  • Make Doctrine2 Repository more stronger.
  • Didn't support Doctrine2 Magic Method by default (You need to define that method in an Interface. Because we focus on maintenance. how should people know which magic method currently used on a project.)

Status

  • Under development.
  • Will be available soon.
  • Feel free to fork and submit pull request. xD

Basic Repository Interface

 interface EmployeeRepository extends DoctrineDataRepositoryInterface
 {
    /** @Query("select e from Employee e where e.name = ?1") */
    public function findByDepartmentId(int $departmentId, PageableInterface $pageable);
 }

 /* @var $repository EmployeeRepository */
 /* @var $page PageInterface */

 $pageRequest = new PageRequest(1,10);
 $repository = $em->getRepository(Employee::class);     
 $page = $repository->findByDepartmentId(1, $pageRequest);

 foreach($page as $emp){
    echo 'Name: ' . $emp->getName() ;
 }

The Versions