public function getBackupDirSize()
 {
     $aResult = array();
     $aResult['integer'] = $this->iFileSizeOfSiteDir;
     $aResult['formatted'] = DocumentPeer::getDocumentSize($this->iFileSizeOfSiteDir);
     return $aResult;
 }
 private function gc()
 {
     LanguageObjectPeer::clearInstancePool();
     DocumentPeer::clearInstancePool();
     SearchIndexPeer::clearInstancePool();
     SearchIndexWordPeer::clearInstancePool();
     gc_collect_cycles();
 }
 public function postUp($manager)
 {
     // add the post-migration code here
     require_once $_SERVER['PWD'] . '/base/lib/inc.php';
     $oConnection = Propel::getConnection(DocumentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     Propel::disableInstancePooling();
     $stmt = DocumentPeer::doSelectStmt(DocumentQuery::create()->clearSelectColumns()->addSelectColumn('documents.id')->addSelectColumn('documents.hash'));
     foreach ($stmt->fetchAll(PDO::FETCH_NUM) as $row) {
         $iId = $row[0];
         $sHash = $row[1];
         $oConnection->exec('INSERT IGNORE INTO `document_data` (`hash`, `data`, `created_at`, `updated_at`, `created_by`, `updated_by`) VALUES ("' . $sHash . '", (SELECT `data` FROM `documents` WHERE `id` = ' . $iId . '), (SELECT `created_at` FROM `documents` WHERE `id` = ' . $iId . '), (SELECT `updated_at` FROM `documents` WHERE `id` = ' . $iId . '), (SELECT `created_by` FROM `documents` WHERE `id` = ' . $iId . '), (SELECT `updated_by` FROM `documents` WHERE `id` = ' . $iId . '))');
     }
     $stmt->closeCursor();
 }
 public function documentData()
 {
     $aResult = array();
     $oDocument = DocumentQuery::create()->findPk($this->iDocumentId);
     $aResult = $oDocument->toArray(BasePeer::TYPE_PHPNAME, false);
     $sDimensions = '';
     if ($sValue = $oDocument->getDimensionsIfImage()) {
         $sDimensions = ' (' . $sValue . ')';
     }
     $aResult['FileInfo'] = $oDocument->getExtension() . '/' . DocumentPeer::getDocumentSize($oDocument->getDataSize(), 'auto_iso') . $sDimensions;
     $aResult['CreatedInfo'] = Util::formatCreatedInfo($oDocument);
     $aResult['UpdatedInfo'] = Util::formatUpdatedInfo($oDocument);
     $aResult['ContentCreatedAt'] = $oDocument->getContentCreatedAt('d.m.Y');
     // self::addReferences($oDocument, $aResult);
     return $aResult;
 }
 /**
  * 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                 Document A model object, or null if the key is not found
  * @throws PropelException
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `id`, `name`, `original_name`, `description`, `content_created_at`, `license`, `author`, `language_id`, `owner_id`, `document_type_id`, `document_category_id`, `is_private`, `is_protected`, `sort`, `hash`, `created_at`, `updated_at`, `created_by`, `updated_by` FROM `documents` 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 Document();
         $obj->hydrate($row);
         DocumentPeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Exemple #6
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();
 }
Exemple #7
0
 public function getFileSize($sFilesizeFormat = 'auto_iso')
 {
     return DocumentPeer::getDocumentSize($this->getDataSize(), $sFilesizeFormat);
 }
 /**
  * Selects a collection of DocumentationPart objects pre-filled with all related objects except UserRelatedByUpdatedBy.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return array           Array of DocumentationPart objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptUserRelatedByUpdatedBy(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     // $criteria->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(DocumentationPartPeer::DATABASE_NAME);
     }
     DocumentationPartPeer::addSelectColumns($criteria);
     $startcol2 = DocumentationPartPeer::NUM_HYDRATE_COLUMNS;
     LanguagePeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + LanguagePeer::NUM_HYDRATE_COLUMNS;
     DocumentationPeer::addSelectColumns($criteria);
     $startcol4 = $startcol3 + DocumentationPeer::NUM_HYDRATE_COLUMNS;
     DocumentPeer::addSelectColumns($criteria);
     $startcol5 = $startcol4 + DocumentPeer::NUM_HYDRATE_COLUMNS;
     $criteria->addJoin(DocumentationPartPeer::LANGUAGE_ID, LanguagePeer::ID, $join_behavior);
     $criteria->addJoin(DocumentationPartPeer::DOCUMENTATION_ID, DocumentationPeer::ID, $join_behavior);
     $criteria->addJoin(DocumentationPartPeer::IMAGE_ID, DocumentPeer::ID, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = DocumentationPartPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = DocumentationPartPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://www.propelorm.org/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = DocumentationPartPeer::getOMClass();
             $obj1 = new $cls();
             $obj1->hydrate($row);
             DocumentationPartPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Language rows
         $key2 = LanguagePeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = LanguagePeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = LanguagePeer::getOMClass();
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 LanguagePeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (DocumentationPart) to the collection in $obj2 (Language)
             $obj2->addDocumentationPart($obj1);
         }
         // if joined row is not null
         // Add objects for joined Documentation rows
         $key3 = DocumentationPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = DocumentationPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $cls = DocumentationPeer::getOMClass();
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 DocumentationPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (DocumentationPart) to the collection in $obj3 (Documentation)
             $obj3->addDocumentationPart($obj1);
         }
         // if joined row is not null
         // Add objects for joined Document rows
         $key4 = DocumentPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = DocumentPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $cls = DocumentPeer::getOMClass();
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 DocumentPeer::addInstanceToPool($obj4, $key4);
             }
             // if $obj4 already loaded
             // Add the $obj1 (DocumentationPart) to the collection in $obj4 (Document)
             $obj4->addDocumentationPart($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 /**
  * Find object by primary key
  * Use instance pooling to avoid a database query if the object exists
  * <code>
  * $obj  = $c->findPk(12, $con);
  * </code>
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con an optional connection object
  *
  * @return    Document|array|mixed the result, formatted by the current formatter
  */
 public function findPk($key, $con = null)
 {
     if (null !== ($obj = DocumentPeer::getInstanceFromPool((string) $key)) && $this->getFormatter()->isObjectFormatter()) {
         // the object is alredy in the instance pool
         return $obj;
     } else {
         // the object has not been requested yet, or the formatter is not an object formatter
         $criteria = $this->isKeepQuery() ? clone $this : $this;
         $stmt = $criteria->filterByPrimaryKey($key)->getSelectStatement($con);
         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
     }
 }
Exemple #10
0
 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 Document) {
         // 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);
     }
     $oHashCriteria = clone $criteria;
     $aHashes = array();
     $stmt = DocumentPeer::doSelectStmt($oHashCriteria->clearSelectColumns()->addSelectColumn(DocumentPeer::HASH));
     while (($row = $stmt->fetch(PDO::FETCH_NUM)) !== false) {
         $sHash = $row[0];
         if (!isset($aHashes[$sHash])) {
             $aHashes[$sHash] = 0;
         }
         $aHashes[$sHash]++;
     }
     foreach ($aHashes as $sHash => $iCount) {
         // Should delete the data object if all documents with this hash are to be deleted
         if (DocumentQuery::create()->filterByHash($sHash)->count() === $iCount) {
             $oDocumentData = DocumentDataQuery::create()->findPk($sHash);
             if ($oDocumentData) {
                 $oDocumentData->delete();
             }
         }
     }
     $stmt->closeCursor();
     return parent::doDelete($criteria, $con);
 }
Exemple #11
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = DocumentPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setDocumentModel($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setDocumentAuthor($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCreatedAt($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setUpdatedAt($arr[$keys[4]]);
     }
 }
Exemple #12
0
 public static function getDocumentInstance($id)
 {
     if (self::isCached($id)) {
         return self::getCachedObj($id);
     } else {
         try {
             $genericDocument = DocumentPeer::retrieveByPk($id);
             if (!$genericDocument) {
                 return null;
             }
             $model = $genericDocument->getDocumentModel();
             //echo "NOT CACHED ".$model;
             $classPeer = $model . 'Peer';
             $c = new Criteria();
             $c->add(constant($classPeer . '::ID'), $id);
             $document = call_user_func(array($classPeer, 'doSelectOne'), $c);
             return $document;
         } catch (Exception $e) {
             throw $e;
         }
     }
 }
 public function deleteDocument($iDocumentId)
 {
     $oDocument = DocumentPeer::retrieveByPK($iDocumentId);
     if ($oDocument && JournalEntryImageQuery::create()->filterByDocument($oDocument)->filterByJournalEntryId($this->iJournalEntryId)->findOne()) {
         return $oDocument->delete();
     }
 }
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = DocumentTypePeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related Document objects
         $criteria = new Criteria(DocumentPeer::DATABASE_NAME);
         $criteria->add(DocumentPeer::DOCUMENT_TYPE_ID, $obj->getId());
         $affectedRows += DocumentPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @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(DocumentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(DocumentPeer::DATABASE_NAME);
         $criteria->add(DocumentPeer::ID, $pks, Criteria::IN);
         $objs = DocumentPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemple #16
0
 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 Document) {
         // 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 (DocumentPeer::doSelect(clone $criteria, $con) as $object) {
         TagPeer::deleteTagsForObject($object);
     }
     return self::doDeleteBeforeTaggable($criteria, $con);
 }
 /**
  * Method to invalidate the instance pool of all tables related to document_categories
  * by a foreign key with ON DELETE CASCADE
  */
 public static function clearRelatedInstancePool()
 {
     // Invalidate objects in DocumentPeer instance pool,
     // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
     DocumentPeer::clearInstancePool();
 }
Exemple #18
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = DocumentPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPath($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setComment($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setTitle($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setFiletype($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setSize($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setReadonly($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setSessionId($arr[$keys[7]]);
     }
 }
Exemple #19
0
 public function mayOperate($sOperation, $oUser = false)
 {
     $oUser = DocumentPeer::getRightsUser($oUser);
     $bIsAllowed = false;
     if ($oUser && ($this->isNew() || $this->getCreatedBy() === $oUser->getId()) && DocumentPeer::mayOperateOnOwn($oUser, $this, $sOperation)) {
         $bIsAllowed = true;
     } else {
         if (DocumentPeer::mayOperateOn($oUser, $this, $sOperation)) {
             $bIsAllowed = true;
         }
     }
     FilterModule::getFilters()->handleDocumentOperationCheck($sOperation, $this, $oUser, array(&$bIsAllowed));
     return $bIsAllowed;
 }