ORM relations

I’m trying to create custom ORM. But i’m having problems with relations among table objects.
I have table articles that belongs to article category table and user table.

I want to create something like this :

$article = new Articles(4);
$article->category->getTitle();
$article->user->getTitle();

My trouble is parsing SQL, and populating object directly from one query. So if i put everything in one query like this bellow how can i extract data and populate object.

SELECT a., c., u.* FROM articles as a
JOIN category as c ON (c.category_id = a.category_id)
JOIN user as u, ON (u.user_id = a.user_id)