PHP code example of inovia-team / matters-repository

1. Go to this page and download the library: Download inovia-team/matters-repository library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

inovia-team / matters-repository example snippets



    class TableRepository extends \Matters\Repository {

        public function findAllByName(string $name)
        {
            $select = $this->select();
            $select->where
                ->equalTo([
                    'name'       => $name,
                ]);

            $select->order(['created_at' => 'DESC']);

            return $this->fetchListEntities($select);
        }
    }


    $hydratingResultSet = new \Zend\Db\ResultSet\HydratingResultSet(
        new Hydrator(),
        new Model()
    );

    $tableGateway = new \Zend\Db\TableGateway\TableGateway(
        'table_name',
        new \Zend\Db\Adapter\Adapter($config),
        null,
        $hydratingResultSet
    );

    $tableRepository = new TableRepository($tableGateway);
    $entities = $tableRepository->findAllByName('Bob');    

./vendor/bin/phpunit tests