[SOLVED] Doctrine: Fetch results as object

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Ragnis
Forum Commoner
Posts: 31
Joined: Thu Nov 13, 2008 12:35 pm
Location: Saaremaa, Estonia, Europe, Asia, Planet Earth, The Solar System, Milky way.

[SOLVED] Doctrine: Fetch results as object

Post by Ragnis »

Code: Select all

$query = Doctrine_Query::create()
		->select('users.*')
		->from('Users users')
		->limit(1);
	$result = $query->execute();
	print_r($result->toArray());
This code returns me results as array. But is it possible to get the results as an object.
Like mysql_fetch_object does.

I'm using doctrine version 1.2

EDIT: I just had to use $result->fieldname
Post Reply