public function duplicate(Gathering $gathering) { $db = Loader::db(); $gasID = $this->getGatheringDataSourceID(); // unset the items we don't want in our serialized object $this->dataSource = null; unset($this->gaID); unset($this->gcsID); unset($this->gasID); $gcdObject = serialize($this); $db->Execute('insert into GatheringConfiguredDataSources (gasID, gaID, gcdObject) values (?, ?, ?)', array($gasID, $gathering->getGatheringID(), $gcdObject)); }
public function __construct(Gathering $ag) { $this->setQuery('select gaiID from GatheringItems'); $this->filter('gaID', $ag->getGatheringID()); $this->filter('gaiIsDeleted', 0); }
public function duplicate(Gathering $gathering) { $db = Database::connection(); $gaID = $gathering->getGatheringID(); $db->Execute('insert into GatheringItems (gaID, gasID, gaiDateTimeCreated, gaiPublicDateTime, gaiTitle, gaiKey, gaiSlotWidth, gaiSlotHeight, gaiBatchTimestamp, gaiBatchDisplayOrder) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($gaID, $this->getGatheringDataSourceID(), $this->gaiDateTimeCreated, $this->gaiPublicDateTime, $this->gaiTitle, $this->gaiKey, $this->gaiSlotWidth, $this->gaiSlotHeight, $this->gaiBatchTimestamp, $this->gaiBatchDisplayOrder)); $this->loadGatheringItemTemplates(); $gaiID = $db->Insert_ID(); foreach ($this->templates as $gatTypeID => $gatID) { $db->Execute('insert into GatheringItemSelectedTemplates (gaiID, gatTypeID, gatID) values (?, ?, ?)', array($gaiID, $gatTypeID, $gatID)); } $item = GatheringItem::getByID($gaiID); $assignments = GatheringItemFeatureAssignment::getList($this); foreach ($assignments as $as) { $item->copyFeatureAssignment($as); } return $item; }