2017 © Pedro Peláez
 

library phalcon

By Edward Hieatt and Rob Mee: Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.

image

generic-repository/phalcon

By Edward Hieatt and Rob Mee: Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.

  • Friday, September 18, 2015
  • by karborator
  • Repository
  • 3 Watchers
  • 7 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Phalcon-generic-repository

Generic repository for Phalcon-framework, (*1)

Move the folder named 'repository 'somewhere in your project.In my case it will be vendor. Then, at your services file:, (*2)

        /**
         * Autoload repository
         */
        include __DIR__ . "/../../vendor/repository/autoload.php";


        /**
         * Generic Repository
         */
        $dependencyInjector['repository'] = new GenericRepository($config, 'user');

At some Controller :, (*3)

/**
 * List all created pages
 *
 * @link   /page        - method GET
 * @link   /page/1      - method GET
 */
public function indexAction($id)
{
    if (!empty($id)) {
        echo $this->repository->setModel('Page')->setCriteria(array("id = '$id'"))
            ->mergeResults()
            ->findFirst()
            ->getRelated(array('articles', 'comments'))
            ->returnAs('json');
        exit;
    }
    echo $this->repository->setModel('Page')
        ->mergeResults()
        ->findAll()
        ->getRelated(array('articles', 'comments'))
        ->returnAs('json');
    exit;

}

The Versions

18/09 2015

dev-master

9999999-dev https://github.com/karborator/Phalcon-generic-repository.git

By Edward Hieatt and Rob Mee: Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.

  Sources   Download

GNUv2

The Requires

  • php >=5.3.0

 

by Nikolay Yotsov

repository pattern generic phalcon