PHP code example of gnugat / pomm-foundation-bundle

1. Go to this page and download the library: Download gnugat/pomm-foundation-bundle 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/ */

    

gnugat / pomm-foundation-bundle example snippets




return [
    // Your other bundles...

    \Gnugat\PommFoundationBundle\GnugatPommFoundationBundle::class => ['all' => true],
];



use PommProject\Foundation\QueryManager\QueryManagerInterface;

class MyService
{
    private const NO_RESULTS = [];

    private $queryManager;

    public function __construct(QueryManagerInterface $queryManager)
    {
        $this->queryManager = $queryManager;
    }

    public function myMethod(int $id, bool $isDeleted): array
    {
        $results = iterator_to_array($this->queryManager->query(
            'SELECT * FROM my_table WHERE id = $* AND is_deleted = $*',
            [
                $id,
                $isDeleted,
            ]
        ));
        if (self::NO_RESULTS === $results) {
            throw new \Exception("Nothing found in my_table for ID \"$id\"");
        }

        return $results;
    }
}