PhpBURN vs Doctrine – Setting, Retreiving, Finding and More

Posted by on Jul 15, 2010 in Blog | 0 comments

Now we are going to show the differences between PhpBURN vs Doctrine when we are trying to work with it, search, find, get, set things into the database.

First let’s see PhpBURN in action:

/*
	PhpBURN
*/
$user = new User();
$user->username = 'john';
$user->password = 'password';
$user->save();

$user->username = 'john';
$user->find();

echo $user->username; // prints 'john'

echo $user->find(); // echo '2''

while($user->fetch()) {
	echo $user->username;
}
/*
	DOCTRINE
*/
$user = new User();
$user->username = 'john';
$user->setPassword('password');
$user->save();

$userTable = Doctrine_Core::getTable('User');
$user = $userTable->findOneByUsername('john');

echo $user->username; // prints 'john'

$users = $userTable->retrieveAll();

echo $users->count(); // echo '2''
foreach ($users as $user)
{
  echo $user->username;
}

Leave a Reply

You must be logged in to post a comment.