I already learned JAVA, a few design patterns (Controllers, etc.) and OOP. I'm trying too build some PHP scripts in OOP (a blog). I want to collect some articles from the DB and store in an array. I'm doing this with a repository (like I do this is JAVA). Is this correct? Artikel.php :class Artikel {private $id;private $naam;function __construct($id, $naam) {    $this->id = $id;    $this->naam = $naam;}function getId() {    return $this->id;}function getNaam() {    return $this->naam;}function setId($id) {    $this->id = $id;}function setNaam($naam) {    $this->naam = $naam;}}ArtikelMapper.php    require_once '../Classes/Artikel.php';    class ArtikelMapper {    private $database;    function __construct($database) {        $this->database = $database;    }    function getArtikels(){        /* become a mysql query, this is just for showing */        $array = array();        $art1 = new Artikel(1, name1);        array_push($array, $art1);        $art2 = new Artikel(2, name2);        array_push($array, $art2);        return $array;    }}ArtikelRepository.phprequire_once '../Classes/Artikel.php';require_once '../Mappers/ArtikelMapper.php';class ArtikelRepository {    private $artikelMapper;    private $artikelArray;    function __construct($database) {        $this->artikelMapper = new ArtikelMapper($database);        $this->artikelArray = $this->artikelMapper->getArtikels();    }    function getArtikels(){        return $artikelArray;    }    function addArtikels($artikel){        array_push($this->artikelArray, $artikel);    }}
PHP OOP Repository overview
php;object oriented;design patterns;repository
This is pretty straight forward code and there is not really much here to provide much critique to. The biggest concern to me would be in the area of data validation. You are not currently doing anything to validate that you have appropriate parameters being passed to your methods.  You should consider adding type hinting for your parameters to better enforce that, for example, you are getting a valid database object to work with or a valid Artikel object to add to the repository.Similarly for thing like setting article id and name where you might be expecting a postivive integer or non-zero length string, you should validate this in your methods and perhaps throw InvalidArgumentException if validation fails.I question the need for setters on Artikel class if these objects would only be instantiated in the mapper process and are tied to actual database records. Should these objects actually be mutable like this? If not, I would actually consider using __get() magic method here instead of the getter you specified to allow more clear and concise  access to these properties (I.e. $article.id or $article.naam) while still making the object immutable.I would encourage you to properly indent your code in a consistent manner and always use single empty lines between class methods consistently. Also, place empty lines between your includes and the beginning of class definitions.One final small thing, and it may just be my preference, is that you might consider using protected visibility instead of private when first writing these base classes. I would generally only use private when there will be at least one inheriting class and I had a specific reason to actually restrict visibility to those inheriting classes.