Skip to content

Instantly share code, notes, and snippets.

@vasildakov-zz
Last active August 29, 2015 13:57
Show Gist options
  • Save vasildakov-zz/9786091 to your computer and use it in GitHub Desktop.
Save vasildakov-zz/9786091 to your computer and use it in GitHub Desktop.
add a conversion object to doctrine collection
<?php
class ConversionController extends Controller {
public function create()
{
$dc = new Doctrine_Collection('Conversion');
if ($dc instanceof Doctrine_Collection) {
for($i =0; $i < 10; $i++) {
$record = new Conversion();
$record->setType(ConversionTable::TYPE_CPA);
$record->setSite($siteId);
$record->setCampaign($campaignId);
$record->setDate($date);
$record->setStatus(ConversionTable::STATUS_ONHOLD);
$dc->add($record);
}
}
$options = array('campaign' => $campaignId, 'site' => $siteId, 'type' => $type, 'date' => $date);
$builder = new ConversionCollectionBuilder($dc);
$builder->build($options);
$collection = $builder->getCollection();
#$collection->save();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment