I was wandering about this while working on projects with PHP, Doctrine and Symfony2, and so I will use Doctrine as an example of an ORM, but the question goes for almost all languages which support encapsulation.
I always thought that if you have a private field, it cannot be changed without a setter function, hence we make getters and setters.
So how does Doctrine create the objects and fill them with the data from the database when you have private fields without setters?
Reflection: http://php.net/manual/en/book.reflection.php
You might also want to take a look at the PropertyAccess component which the forms component uses to access data properties.