Created
September 20, 2013 08:42
-
-
Save oaltman/6634851 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class ContentDao extends EntityDao | |
{ | |
protected $imageType; | |
public function __construct($imageType) | |
{ | |
$this->imageType = $imageType; | |
} | |
public function getImageType() | |
{ | |
$qb = $this->createQueryBuilder(); | |
$query = $qb->select('type') | |
->from('\App\Cropper\ImageType','type') | |
->where('type.name = :name') | |
->getQuery() | |
->setParameter('name',$this->imageType); | |
return $query->getOneOrNullResult(); | |
} | |
public function getPossibleImages() | |
{ | |
$qb = $this->createQueryBuilder(); | |
$query = $qb->select('thumbnail') | |
->from('\App\Thumbnail\Thumbnail','thumbnail') | |
->from('\App\Cropper\Image','image') | |
->from('\App\Cropper\ImageType','type') | |
->where('image.imageType = type') | |
->andWhere('thumbnail.image = image') | |
->andWhere('type.name = :name') | |
->getQuery() | |
->setParameter('name', $this->imageType); | |
return $query->execute(); | |
} | |
public function getUnpublished() | |
{ | |
return $this->findBy(array('published' => false),array()); | |
} | |
public function getPublished() | |
{ | |
return $this->findBy(array('published' => true),array()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShowDao extends ContentDao | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment