Skip to content

Instantly share code, notes, and snippets.

View oaltman's full-sized avatar

Ondřej Altman oaltman

  • Emplifi
  • Pilsen, Czech Republic
View GitHub Profile
public function getUnpublished()
{
$qb = $this->createQueryBuilder();
$query = $qb->select(array('thumbnail','show'))
->from('\App\Thumbnail\Thumbnail','thumbnail')
->from('\App\Cropper\Image','image')
->from('\App\Entity\Content\Show', 'show')
->where('show.image = image')
->andWhere('thumbnail.image = image')
->getQuery();
array $result (
array(
article => ArticleEntity,
thumbnail => ThumbnailEntity
),
array(
article => ArticleEntity,
thumbnail => ThumbnailEntity
),
array(
abstract class ContentDao extends EntityDao
{
protected $imageType;
public function __construct($imageType)
{
$this->imageType = $imageType;
}
public function getImageType()
$query = $qb->select(array('draft' => 'draft','thumbnail' => 'thumbnail'))
->from('App\Thumbnail\Thumbnail', 'thumbnail')
->from('App\Cropper\Image', 'image')
->from('App\Article\Draft', 'draft')
->where('thumbnail.image = image')
->andWhere('draft.image = image')
->getQuery();
return $query->execute();
@oaltman
oaltman / gist:6522553
Created September 11, 2013 11:54
Entita + přidávání do kolekce + duplicitní záznamy
foreach($images as $image)
{
if(!$this->show->hasImage($image)) $this->show->addImage($image);
}
class BaseEntity extends IdentifiedEntity {
public function __construct($data = NULL)
{
parent::__construct();
if($data)
$this->setData($data);
}
public function setData($data)
<?php
/**
* User: henry, Date: 7/31/13,Time: 12:11 AM
*/
namespace App;
use Nette\Application\UI\Form;
class ArticleForm extends Form
function .() {
set +o monitor
PORT=8888
ADDRESS='localhost'
BROWSER="chromium-browser"
[[ -n "$1" ]] && PORT=$1
[[ -n "$2" ]] && ADDRESS=$2
[[ -n "$3" ]] && BROWSER=$3
CURRENT=`pwd`
[[ ! -f "index.php" ]] && cd www
@oaltman
oaltman / gist:6104190
Created July 29, 2013 13:09
Fix na deprecated
$form->addTextarea("text", NULL)
->setAttribute('rows', 20)
->setAttribute('cols',60)
->getControlPrototype()->class("texyla");
public function testFormattingDatesBasedOnConfig()
{
$stub = $this->getMock('Henry\Config',array('get'));
$stub->expects($this->any())
->method('get')
->will($this->returnValue('c'));
$formatter = new DateFormatter($stub);
$this->assertEquals('c',$stub->get('param'));