Code snippets for symfony 1.x

Navigation

Refine Tags

Snippets tagged "record"

Fetch a Random Record with Doctrine

To fetch a random user:

$userCount = Doctrine::getTable('User')->count();
$user = Doctrine::getTable('User')
  ->createQuery()
  ->limit(1)
  ->offset(rand(0, $userCount - 1))
  ->fetchOne();
 
by ericfreese on 2009-11-16, tagged doctrine  random  record 
(7 comments)

Restrict access to records

I've been looking for the right way to restrict access to records, and here's the approach I came up with:

Big thanks goes to everyone else participating in symfony, and specially to Charley Tiggs at the mailing list, who helped me getting started with restricting access to records.

by Erik Itland on 2007-12-03, tagged access  control  record