/** * Public method, usually called by scheduler. * * @return boolean TRUE on success */ public function execute() { $this->initialize(); $banners = $this->bannerRepository->findAll(); foreach ($banners as $banner) { if ($banner->getEmail() and $this->sendReport($banner)) { $this->setStatisticsForNewMonth($banner); } } $this->persistenceManager->persistAll(); return TRUE; }
/** * @param array $importArray * @return void */ public function import(array $importArray) { // Sort import array to import the default language first foreach ($importArray as $importItem) { $category = $this->hydrateCategory($importItem); if (!empty($importItem['title_lang_ol'])) { $this->postPersistQueue[$importItem['import_id']] = array('category' => $category, 'importItem' => $importItem, 'action' => self::ACTION_CREATE_L10N_CHILDREN_CATEGORY, 'titleLanguageOverlay' => $importItem['title_lang_ol']); } if ($importItem['parentcategory']) { $this->postPersistQueue[$importItem['import_id']] = array('category' => $category, 'action' => self::ACTION_SET_PARENT_CATEGORY, 'parentCategoryOriginUid' => $importItem['parentcategory']); } } $this->persistenceManager->persistAll(); foreach ($this->postPersistQueue as $queueItem) { switch ($queueItem['action']) { case self::ACTION_SET_PARENT_CATEGORY: $this->setParentCategory($queueItem); break; case self::ACTION_CREATE_L10N_CHILDREN_CATEGORY: $this->createL10nChildrenCategory($queueItem); break; default: // do nothing break; } } $this->persistenceManager->persistAll(); }
public function syncAll() { $syncConfigs = $this->syncConfigurationRepository->findAll(); foreach ($syncConfigs as $syncConfig) { /** @var $syncConfig Tx_DlDropboxsync_Domain_Model_SyncConfiguration */ if ($syncConfig->getSyncType() == 'in') { $syncRun = $this->objectManager->get('Tx_DlDropboxsync_Domain_Dropbox_SyncRun_SyncIn'); /** @var $syncRun Tx_DlDropboxsync_Domain_Dropbox_SyncRun_SyncIn */ } else { $syncRun = $this->objectManager->get('Tx_DlDropboxsync_Domain_Dropbox_SyncRun_SyncOut'); /** @var $syncRun Tx_DlDropboxsync_Domain_Dropbox_SyncRun_SyncOut */ } $runInfo = $syncRun->setSyncConfiguration($syncConfig)->startSync(); $syncConfig->setLastSyncInfo(serialize($runInfo)); $this->syncConfigurationRepository->update($syncConfig); $this->persistenceManager->persistAll(); } }
/** * Import * * @param array $importData * @param array $importItemOverwrite * @param array $settings * @return void */ public function import(array $importData, array $importItemOverwrite = array(), $settings = array()) { $this->settings = $settings; foreach ($importData as $importItem) { // Store language overlay in post persit queue if ($importItem['sys_language_uid']) { $this->postPersistQueue[$importItem['import_id']] = array('action' => self::ACTION_IMPORT_L10N_OVERLAY, 'category' => NULL, 'importItem' => $importItem); continue; } $news = $this->initializeNewsRecord($importItem); $this->hydrateNewsRecord($news, $importItem, $importItemOverwrite); } $this->persistenceManager->persistAll(); foreach ($this->postPersistQueue as $queueItem) { if ($queueItem['action'] == self::ACTION_IMPORT_L10N_OVERLAY) { $this->importL10nOverlay($queueItem, $importItemOverwrite); } } $this->persistenceManager->persistAll(); }
/** * Executes the number of matching objects for the query * * @return integer The number of matching objects * @api */ public function count() { return $this->persistenceManager->getObjectCountByQuery($this); }
/** * Resets global singletons for the next plugin * * @return void */ protected function resetSingletons() { $this->persistenceManager->persistAll(); $this->reflectionService->shutdown(); }