Skip to content

Instantly share code, notes, and snippets.

Avatar
shipping!

Alessandro Nadalin odino

shipping!
View GitHub Profile
View gist:480352
class QreddContentForm extends BaseQreddContentForm
{
public function configure()
{
$content_type = $this->object->getTemplate();
foreach($content_type->getAdditionalFields() as $field)
{
View gist:480354
click('Save', array('qredd_content' => array(
'content_type_id' => 1,
'title' => 'Content sample',
'aggregator_id' => '0',
'is_active' => true,
)))->
with('request')->begin()->
isParameter('module', 'content')->
isParameter('action', 'create')->
View gist:480384
// FIXME: workaround for lime! Lime sucks so much
// proper code $content_type = $this->object->getTemplate()
if ($this->object->isNew())
{
$content_type = new QreddCckTemplateFlat;
}
else
{
$content_type = Doctrine::getTable('QreddCckTemplateFlat')->find($this->object->content_type_id);
}
View gist:480386
// FIXME: workaround for lime! Lime sucks so much
// proper code $content_type = $this->object->getTemplate()
if (!$this->object->isNew())
{
$this->object->setTemplate(Doctrine::getTable('QreddCckTemplateFlat')->find($this->object->content_type_id));
}
$content_type = $this->object->getTemplate();
foreach($content_type->getAdditionalFields() as $field)
View gist:500423
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: mysql:host=localhost;dbname=db
username: nsd
password: nsdtodb
test:
doctrine:
View LOLCODE
HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
UP VAR!!1
IZ VAR BIGGER THAN 10? KTHX
VISIBLE VAR
IM OUTTA YR LOOP
KTHXBYE
View gist:549183
test:
doctrine:
class: sfDoctrineDatabase
param:
dsn: 'mysql:host=localhost; dbname=***_test'
username: ***
password: ***
staging:
doctrine:
View gist:549195
###### CONTROLLER
$this->form = new myForm(array(), array('user' => $this->getUser()));
###### FORM
public function configure()
{
parent::configure();
View gist:549438
public function getImage()
{
$asset = Doctrine::gettable('Asset')->find($this->thumbnail_id);
if ($asset)
{
return $asset->getId();
}
return false;
View gist:549473
public function getAsset()
{
return $this->getDataProperty('Asset', 1, 'file');
}
######### In una parent
public function getDataproperty($model, $id, $property)
{
$object = Doctrine::getTable($model)->find($id);