private static function addReferences($oDocument, &$aResult)
 {
     if ($oDocument->isInternallyManaged()) {
         $aResult['References'] = array();
         foreach (ReferencePeer::getReferences($oDocument) as $oReference) {
             $aResult['References'][] = $oReference->toArray();
         }
     }
 }
 public function adminSave($aChosenOptions)
 {
     ArrayUtil::trimStringsInArray($aChosenOptions);
     $sValue = $aChosenOptions['external'];
     if (!$aChosenOptions['external']) {
         $sValue = $aChosenOptions['internal'];
         //TODO: remove outdated references (and when changing page types)
         ReferencePeer::addReference($this->oPage, PageQuery::create()->findPk($sValue));
     }
     $this->oPage->updatePageProperty('redirect-location', $sValue);
 }
 public function getSaveData($mData)
 {
     ReferencePeer::removeReferences($this->oLanguageObject);
     if (isset($mData['document_id'])) {
         foreach ($mData['document_id'] as $iDocumentId) {
             if ($iDocumentId) {
                 ReferencePeer::addReference($this->oLanguageObject, array($iDocumentId, 'Document'));
             }
         }
     }
     return $this->dataFromPost($mData);
 }
 public function widgetSave($mData)
 {
     $this->oLanguageObject->setData(serialize($mData));
     $bResult = $this->oLanguageObject->save();
     if ($bResult) {
         if (isset($mData['link_categories'])) {
             ReferencePeer::removeReferences($this->oLanguageObject);
             foreach ($mData['link_categories'] as $iCategoryId) {
                 ReferencePeer::addReference($this->oLanguageObject, array($iCategoryId, 'LinkCategory'));
             }
         }
     }
     return $bResult;
 }
 public function getPageData()
 {
     $oPage = PageQuery::create()->findPk($this->iPageId);
     $aResult = $oPage->toArray(BasePeer::TYPE_PHPNAME, false);
     // addition related page fields
     $aResult['PageLink'] = LinkUtil::absoluteLink(LinkUtil::link($oPage->getFullPathArray(), 'FrontendManager', array(), AdminManager::getContentLanguage()), null, 'auto');
     $aResult['PageHref'] = LinkUtil::absoluteLink(LinkUtil::link($oPage->getFullPathArray(), 'FrontendManager', array(), AdminManager::getContentLanguage()), null, 'default', true);
     // page properties are displayed if added to template
     try {
         $mAvailableProperties = $this->getAvailablePageProperties($oPage);
         if (count($mAvailableProperties) > 0) {
             $aResult['page_properties'] = $mAvailableProperties;
         }
     } catch (Exception $e) {
         ErrorHandler::handleException($e, true);
     }
     // page references are displayed if exist
     $mReferences = AdminModule::getReferences(ReferencePeer::getReferences($oPage));
     $aResult['CountReferences'] = count($mReferences);
     if ($mReferences !== null) {
         $aResult['page_references'] = $mReferences;
     }
     return $aResult;
 }
 /**
  * @return A list of References (not Objects) which this Newsletter references
  */
 public function getReferenced()
 {
     return ReferencePeer::getReferencesFromObject($this);
 }
 public static function doDelete($values, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(PagePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         // rename for clarity
         $criteria = clone $values;
     } elseif ($values instanceof LanguageObject) {
         // it's a model object
         // create criteria based on pk values
         $criteria = $values->buildPkeyCriteria();
     } else {
         // it's a primary key, or an array of pks
         $criteria = new Criteria(self::DATABASE_NAME);
         $criteria->add(PagePeer::ID, (array) $values, Criteria::IN);
     }
     foreach (LanguageObjectPeer::doSelect(clone $criteria, $con) as $object) {
         ReferencePeer::removeReferences($object);
     }
     return self::doDeleteBeforeReferencing($criteria, $con);
 }
示例#8
0
 /**
  * @return A list of References (not Objects) which reference this Page
  */
 public function getReferees()
 {
     return ReferencePeer::getReferences($this);
 }
示例#9
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @return Reference[]
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(ReferencePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ReferencePeer::DATABASE_NAME);
         $criteria->add(ReferencePeer::ID, $pks, Criteria::IN);
         $objs = ReferencePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
示例#10
0
 /**
  * Method to invalidate the instance pool of all tables related to users
  * by a foreign key with ON DELETE CASCADE
  */
 public static function clearRelatedInstancePool()
 {
     // Invalidate objects in UserGroupPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     UserGroupPeer::clearInstancePool();
     // Invalidate objects in UserRolePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     UserRolePeer::clearInstancePool();
     // Invalidate objects in PagePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     PagePeer::clearInstancePool();
     // Invalidate objects in PagePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     PagePeer::clearInstancePool();
     // Invalidate objects in PagePropertyPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     PagePropertyPeer::clearInstancePool();
     // Invalidate objects in PagePropertyPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     PagePropertyPeer::clearInstancePool();
     // Invalidate objects in PageStringPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     PageStringPeer::clearInstancePool();
     // Invalidate objects in PageStringPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     PageStringPeer::clearInstancePool();
     // Invalidate objects in ContentObjectPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     ContentObjectPeer::clearInstancePool();
     // Invalidate objects in ContentObjectPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     ContentObjectPeer::clearInstancePool();
     // Invalidate objects in LanguageObjectPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LanguageObjectPeer::clearInstancePool();
     // Invalidate objects in LanguageObjectPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LanguageObjectPeer::clearInstancePool();
     // Invalidate objects in LanguageObjectHistoryPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LanguageObjectHistoryPeer::clearInstancePool();
     // Invalidate objects in LanguageObjectHistoryPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LanguageObjectHistoryPeer::clearInstancePool();
     // Invalidate objects in LanguagePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LanguagePeer::clearInstancePool();
     // Invalidate objects in LanguagePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LanguagePeer::clearInstancePool();
     // Invalidate objects in TranslationPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     TranslationPeer::clearInstancePool();
     // Invalidate objects in TranslationPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     TranslationPeer::clearInstancePool();
     // Invalidate objects in UserGroupPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     UserGroupPeer::clearInstancePool();
     // Invalidate objects in UserGroupPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     UserGroupPeer::clearInstancePool();
     // Invalidate objects in GroupPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     GroupPeer::clearInstancePool();
     // Invalidate objects in GroupPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     GroupPeer::clearInstancePool();
     // Invalidate objects in GroupRolePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     GroupRolePeer::clearInstancePool();
     // Invalidate objects in GroupRolePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     GroupRolePeer::clearInstancePool();
     // Invalidate objects in RolePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     RolePeer::clearInstancePool();
     // Invalidate objects in RolePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     RolePeer::clearInstancePool();
     // Invalidate objects in UserRolePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     UserRolePeer::clearInstancePool();
     // Invalidate objects in UserRolePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     UserRolePeer::clearInstancePool();
     // Invalidate objects in RightPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     RightPeer::clearInstancePool();
     // Invalidate objects in RightPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     RightPeer::clearInstancePool();
     // Invalidate objects in DocumentPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentPeer::clearInstancePool();
     // Invalidate objects in DocumentPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentPeer::clearInstancePool();
     // Invalidate objects in DocumentDataPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentDataPeer::clearInstancePool();
     // Invalidate objects in DocumentDataPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentDataPeer::clearInstancePool();
     // Invalidate objects in DocumentTypePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentTypePeer::clearInstancePool();
     // Invalidate objects in DocumentTypePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentTypePeer::clearInstancePool();
     // Invalidate objects in DocumentCategoryPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentCategoryPeer::clearInstancePool();
     // Invalidate objects in DocumentCategoryPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentCategoryPeer::clearInstancePool();
     // Invalidate objects in TagPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     TagPeer::clearInstancePool();
     // Invalidate objects in TagPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     TagPeer::clearInstancePool();
     // Invalidate objects in TagInstancePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     TagInstancePeer::clearInstancePool();
     // Invalidate objects in TagInstancePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     TagInstancePeer::clearInstancePool();
     // Invalidate objects in LinkPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LinkPeer::clearInstancePool();
     // Invalidate objects in LinkPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LinkPeer::clearInstancePool();
     // Invalidate objects in LinkCategoryPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LinkCategoryPeer::clearInstancePool();
     // Invalidate objects in LinkCategoryPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     LinkCategoryPeer::clearInstancePool();
     // Invalidate objects in ReferencePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     ReferencePeer::clearInstancePool();
     // Invalidate objects in ReferencePeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     ReferencePeer::clearInstancePool();
 }
示例#11
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return                 Reference A model object, or null if the key is not found
  * @throws PropelException
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `id`, `from_id`, `from_model_name`, `to_id`, `to_model_name`, `created_at`, `updated_at`, `created_by`, `updated_by` FROM `indirect_references` WHERE `id` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new Reference();
         $obj->hydrate($row);
         ReferencePeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
 public function getSaveData($mData)
 {
     if ($this->oLanguageObject instanceof LanguageObject) {
         ReferencePeer::removeReferences($this->oLanguageObject);
         if (isset($mData['document_categories'])) {
             foreach ($mData['document_categories'] as $iCategoryId) {
                 ReferencePeer::addReference($this->oLanguageObject, array($iCategoryId, 'DocumentCategory'));
             }
         }
     }
     return parent::getSaveData($mData);
 }
示例#13
0
 public static function saveUnsavedReferences($oFromObjectFilter = null)
 {
     $aUnsavedReferences = self::$aUnsavedReferences;
     self::$aUnsavedReferences = array();
     foreach ($aUnsavedReferences as $aUnsavedReference) {
         if ($oFromObjectFilter !== null) {
             $bIsEqual = method_exists($oFromObjectFilter, 'equals') ? $oFromObjectFilter->equals($aUnsavedReference[0]) : $oFromObjectFilter === $aUnsavedReference[0];
             if (!$bIsEqual) {
                 continue;
             }
         }
         $aUnsavedReference[0]->setNew(false);
         self::addReference($aUnsavedReference[0], $aUnsavedReference[1]);
     }
     return count(self::$aUnsavedReferences);
 }
示例#14
0
 private function addTrackReference($iToId, $sToClass)
 {
     if ($this->mTrackReferences === null) {
         return;
     }
     ReferencePeer::addReference($this->mTrackReferences, array($iToId, $sToClass));
 }
示例#15
0
 public function mayOperate($sOperation, $oUser = false)
 {
     $oUser = ReferencePeer::getRightsUser($oUser);
     $bIsAllowed = false;
     if ($oUser && ($this->isNew() || $this->getCreatedBy() === $oUser->getId()) && ReferencePeer::mayOperateOnOwn($oUser, $this, $sOperation)) {
         $bIsAllowed = true;
     } else {
         if (ReferencePeer::mayOperateOn($oUser, $this, $sOperation)) {
             $bIsAllowed = true;
         }
     }
     FilterModule::getFilters()->handleReferenceOperationCheck($sOperation, $this, $oUser, array(&$bIsAllowed));
     return $bIsAllowed;
 }