Ejemplo n.º 1
0
 * @version    $Id$
 */
define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/..'));
define('SF_APP', 'frontend');
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG', 1);
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
// initialize database manager
$databaseManager = new sfDatabaseManager();
$databaseManager->initialize();
// batch process here
//get the vocabularies
$foo = new VocabularyPeer();
$selectCriteria = new Criteria(VocabularyPeer::DATABASE_NAME);
$rs = $foo->doSelect($selectCriteria);
$vocabCount = $foo->doCount($selectCriteria);
$vocabCounter = 0;
//foreach vocabulary
/** @var Vocabulary $vocavulary **/
foreach ($rs as $vocabulary) {
    $vocabCounter++;
    //get the vocabulary registrar
    $userCriteria = new Criteria();
    $userCriteria->add(VocabularyHasUserPeer::IS_REGISTRAR_FOR, true);
    $users = $vocabulary->getVocabularyHasUsersJoinUser($userCriteria);
    if (count($users)) {
        /**  @var VocabularyHasUser $user  */
        $user = $users[0]->getUser();
        $userId = $user->getId();
    }
    //created_user_id <== "use id of vocabulary registrar"
Ejemplo n.º 2
0
 /**
  * Returns the number of related Vocabularys.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      Connection $con
  * @throws     PropelException
  */
 public function countVocabularys($criteria = null, $distinct = false, $con = null)
 {
     // include the Peer class
     include_once 'lib/model/om/BaseVocabularyPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(VocabularyPeer::AGENT_ID, $this->getId());
     return VocabularyPeer::doCount($criteria, $distinct, $con);
 }
Ejemplo n.º 3
0
 /**
  * Returns the number of related VocabularysRelatedByChildUpdatedUserId.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      Connection $con
  * @throws     PropelException
  */
 public function countVocabularysRelatedByChildUpdatedUserId($criteria = null, $distinct = false, $con = null)
 {
     // include the Peer class
     include_once 'lib/model/om/BaseVocabularyPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(VocabularyPeer::CHILD_UPDATED_USER_ID, $this->getId());
     return VocabularyPeer::doCount($criteria, $distinct, $con);
 }