示例#1
0
 public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
 {
     $mappings = $targetEntity->getAssociationMappings();
     if (!array_key_exists('journal', $mappings) || $mappings['journal']['targetEntity'] !== 'Ojs\\JournalBundle\\Entity\\Journal') {
         return '';
     }
     $selectedJournal = $this->journalService->getSelectedJournal();
     if (!$selectedJournal) {
         return '';
     }
     $journalJoinColumn = $mappings['journal']['joinColumns'][0]['name'];
     $addCondSql = $targetTableAlias . '.' . $journalJoinColumn . ' = ' . $selectedJournal->getId();
     return $addCondSql;
 }
示例#2
0
文件: JournalFilter.php 项目: ojs/ojs
 public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
 {
     $mappings = $targetEntity->getAssociationMappings();
     if (!array_key_exists('journal', $mappings) || $mappings['journal']['targetEntity'] !== 'Ojs\\JournalBundle\\Entity\\Journal') {
         return '';
     }
     //return if journal filter disabled globally for current entity
     if (isset($GLOBALS[$targetEntity->getName() . '#journalFilter']) && $GLOBALS[$targetEntity->getName() . '#journalFilter'] == false) {
         return '';
     }
     try {
         $selectedJournal = $this->journalService->getSelectedJournal();
     } catch (\Exception $e) {
         return '';
     }
     if (!$selectedJournal) {
         return '';
     }
     $journalJoinColumn = $mappings['journal']['joinColumns'][0]['name'];
     $addCondSql = $targetTableAlias . '.' . $journalJoinColumn . ' = ' . $selectedJournal->getId();
     return $addCondSql;
 }