I'm working on a project today and i've been working for a while now and i don't see what i do wrong here. Can someone give me the right example.
Thnx a lot!
Connector:
class Repository
{
private $connector;
public function __construct(Config $connector)
{
$this->connector = $connector;
}
public function events()
{
$query = 'SELECT * FROM digi_gz_parties';
$dbh_query = $this->connector->getDatabase()->prepare($query);
$dbh_query->execute();
$dbh_querys = $dbh_query->fetchAll();
return $dbh_querys;
}
}
Getter:
class REST
{
public function getEvents()
{
require 'logic/Repository.php';
$event = new Repository();
$events = $event->events();
return $events;
}
}
Error: Argument 1 passed to Repository::__construct() must be an instance of Config.
I know i need to give a paramater to the repository but i don't want it, i want only to call the repository without give some paramter.
Thanks a lot!