29 lines
597 B
PHP
29 lines
597 B
PHP
<?php
|
|
/*
|
|
* Edit this file to customise your model table
|
|
*
|
|
* auto-generated by the sfDoctrine plugin
|
|
*/
|
|
class BlogPostTable extends Doctrine_Table
|
|
{
|
|
public function retrieveLatest($num)
|
|
{
|
|
$query = new Doctrine_Query();
|
|
$query->from('BlogPost p');
|
|
$query->limit($num);
|
|
$query->orderby('p.created_at DESC');
|
|
|
|
return $query->execute();
|
|
}
|
|
|
|
public function retrieveBySlug($slug)
|
|
{
|
|
$query = new Doctrine_Query();
|
|
$query->from('BlogPost p');
|
|
$query->where('p.slug = ?', $slug);
|
|
$query->limit(1);
|
|
|
|
return $query->execute()->getFirst();
|
|
}
|
|
}
|