Skip to content

Instantly share code, notes, and snippets.

View odino's full-sized avatar
shipping!

Alessandro Nadalin odino

shipping!
View GitHub Profile
class QreddContentForm extends BaseQreddContentForm
{
public function configure()
{
$content_type = $this->object->getTemplate();
foreach($content_type->getAdditionalFields() as $field)
{
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')->
// 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);
}
// 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)
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: mysql:host=localhost;dbname=db
username: nsd
password: nsdtodb
test:
doctrine:
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
test:
doctrine:
class: sfDoctrineDatabase
param:
dsn: 'mysql:host=localhost; dbname=***_test'
username: ***
password: ***
staging:
doctrine:
###### CONTROLLER
$this->form = new myForm(array(), array('user' => $this->getUser()));
###### FORM
public function configure()
{
parent::configure();
public function getImage()
{
$asset = Doctrine::gettable('Asset')->find($this->thumbnail_id);
if ($asset)
{
return $asset->getId();
}
return false;
public function getAsset()
{
return $this->getDataProperty('Asset', 1, 'file');
}
######### In una parent
public function getDataproperty($model, $id, $property)
{
$object = Doctrine::getTable($model)->find($id);