HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/fvr.creativefellows.nl/src/Domain/Repository.php
<?php

namespace App\Domain;

use PDO;

/**
 * Repository.
 */
abstract class Repository
{
	
    /**
     * @var PDO The database connection
     */
    private $connection;

    /**
     * Constructor.
     *
     * @param PDO $connection The database connection
     */
    public function __construct(PDO $connection)
    {
        $this->connection = $connection;
		$this->connection->setAttribute( PDO::ATTR_EMULATE_PREPARES, false );
    }
			
	
    /**
     * Insert user row.
     *
     * @param string $sql The Query
     * @param array $parameters The parameters to bind
	 *
     * @return array The array with data
     */
	public function execute(string $sql, array $parameters = []): array
	{
	
		$sth = $this->connection->prepare($sql);			
		$sth->execute($parameters);
		 
		$row = $sth->fetch(); 
        return $row ? : [];
	}
	
	
    /**
     * Execute multiple row sql with given parameters
     *
     * @param string $sql The Query
     * @param array $parameters The parameters to bind
	 *
     * @return array The array with data
     */
	public function executeAll(string $sql, array $parameters = []): array
	{
	
		$sth = $this->connection->prepare($sql);			
		$sth->execute($parameters);
		 
		$row = $sth->fetchAll(); 
        return $row ? : [];
	}
	
	

}