當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Doctrine_Manager類代碼示例

本文整理匯總了PHP中Doctrine_Manager的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Manager類的具體用法?PHP Doctrine_Manager怎麽用?PHP Doctrine_Manager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Doctrine_Manager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: indexDirectory

 public function indexDirectory($dir)
 {
     if (!file_exists($dir)) {
         throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir);
     }
     $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY);
     $files = array();
     foreach ($it as $file) {
         $name = $file->getPathName();
         if (strpos($name, '.svn') === false) {
             $files[] = $name;
         }
     }
     $q = new Doctrine_Query();
     $q->delete()->from('Doctrine_File f')->where('f.url LIKE ?', array($dir . '%'))->execute();
     // clear the index
     $q = new Doctrine_Query();
     $q->delete()->from('Doctrine_File_Index i')->where('i.file_id = ?')->execute();
     $conn = Doctrine_Manager::connection();
     $coll = new Doctrine_Collection('Doctrine_File');
     foreach ($files as $file) {
         $coll[]->url = $file;
     }
     $coll->save();
 }
開發者ID:JimmyVB,項目名稱:Symfony-v1.2,代碼行數:25,代碼來源:Indexer.php

示例2: configureDoctrine

 public function configureDoctrine(Doctrine_Manager $manager)
 {
     $options = array('baseClassName' => 'BaseDoctrineRecord');
     sfConfig::set('doctrine_model_builder_options', $options);
     $manager->setCollate('utf8_unicode_ci');
     $manager->setCharset('utf8');
 }
開發者ID:vcgato29,項目名稱:poff,代碼行數:7,代碼來源:ProjectConfiguration.class.php

示例3: configureDoctrineCache

 protected function configureDoctrineCache(Doctrine_Manager $manager)
 {
     if (sfConfig::get('dm_orm_cache_enabled', true) && dmAPCCache::isEnabled()) {
         $driver = new Doctrine_Cache_Apc(array('prefix' => dmProject::getNormalizedRootDir() . '/doctrine/'));
         $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $driver);
     }
 }
開發者ID:jdart,項目名稱:diem,代碼行數:7,代碼來源:dmProjectConfiguration.php

示例4: configureDoctrine

 /**
  * Configure the Doctrine engine
  **/
 public function configureDoctrine(Doctrine_Manager $manager)
 {
     $manager->setAttribute(Doctrine::ATTR_QUERY_CACHE, new Doctrine_Cache_Apc());
     $manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE, new Doctrine_Cache_Apc());
     $options = array('baseClassName' => 'DarwinModel');
     sfConfig::set('doctrine_model_builder_options', $options);
 }
開發者ID:naturalsciences,項目名稱:Darwin,代碼行數:10,代碼來源:ProjectConfiguration.class.php

示例5: configureDoctrine

 public function configureDoctrine(Doctrine_Manager $manager)
 {
     // yiid activity dispatcher
     $this->dispatcher->connect('new-yiid-activity', array('StatsFeeder', 'track'));
     $manager->setCollate('utf8_unicode_ci');
     $manager->setCharset('utf8');
 }
開發者ID:42medien,項目名稱:spreadly,代碼行數:7,代碼來源:ProjectConfiguration.class.php

示例6: configureDoctrine

 /**
  * Configure doctrine connections to use tablename prefix hs_hr_
  */
 public function configureDoctrine(Doctrine_Manager $manager)
 {
     $manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
     $manager->setAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM, true);
     //
     // If using encryption, enable dql callbacks. Needed by EncryptionListener
     //
     if (KeyHandler::keyExists()) {
         $manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
     }
     //$manager->setAttribute(Doctrine::ATTR_TBLNAME_FORMAT, 'hs_hr_%s');
 }
開發者ID:rabbitdigital,項目名稱:HRM,代碼行數:15,代碼來源:orangehrmConfiguration.class.php

示例7: testTest

 public function testTest()
 {
     Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
     $user = new Ticket_DC187_User();
     $user->username = 'jwage';
     $user->email = 'jonwage@gmail.com';
     $user->password = 'changeme';
     $user->save();
     $user->delete();
     try {
         $user = new Ticket_DC187_User();
         $user->username = 'jwage';
         $user->email = 'jonwage@gmail.com';
         $user->password = 'changeme';
         $user->save();
         $this->pass();
     } catch (Exception $e) {
         $this->fail($e->getMessage());
     }
     try {
         $user = new Ticket_DC187_User();
         $user->username = 'jwage';
         $user->email = 'jonwage@gmail.com';
         $user->password = 'changeme';
         $user->save();
         $this->fail();
     } catch (Exception $e) {
         $this->pass();
     }
     Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_NONE);
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:31,代碼來源:DC187TestCase.php

示例8: read

 /**
  *
  * @return Doctrine_Schema
  * @access public
  */
 public function read()
 {
     $dataDict = Doctrine_Manager::getInstance()->getCurrentConnection()->getDataDict();
     $schema = new Doctrine_Schema();
     /* @todo FIXME i am incomplete*/
     $db = new Doctrine_Schema_Database();
     $schema->addDatabase($db);
     $dbName = 'XXtest';
     // @todo FIXME where should we get
     $this->conn->set("name", $dbName);
     $tableNames = $dataDict->listTables();
     foreach ($tableNames as $tableName) {
         $table = new Doctrine_Schema_Table();
         $table->set("name", $tableName);
         $tableColumns = $dataDict->listTableColumns($tableName);
         foreach ($tableColumns as $tableColumn) {
             $table->addColumn($tableColumn);
         }
         $this->conn->addTable($table);
         if ($fks = $dataDict->listTableConstraints($tableName)) {
             foreach ($fks as $fk) {
                 $relation = new Doctrine_Schema_Relation();
                 $relation->setRelationBetween($fk['referencingColumn'], $fk['referencedTable'], $fk['referencedColumn']);
                 $table->setRelation($relation);
             }
         }
     }
     return $schema;
 }
開發者ID:snouhaud,項目名稱:camptocamp.org,代碼行數:34,代碼來源:Db.php

示例9: __construct

 /**
  * @param Doctrine_Table|string $table  Doctrine_Table object
  */
 public function __construct($table)
 {
     if (!$table instanceof Doctrine_Table) {
         $table = Doctrine_Manager::getInstance()->getCurrentConnection()->getTable($table);
     }
     $this->table = $table;
 }
開發者ID:snouhaud,項目名稱:camptocamp.org,代碼行數:10,代碼來源:Check.php

示例10: execute

 protected function execute($arguments = array(), $options = array())
 {
     $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
     $databaseManager = new sfDatabaseManager($configuration);
     $databaseManager->initialize($configuration);
     $db = Doctrine_Manager::connection();
     //get person entities with all-caps names
     $sql = 'SELECT e.id, e.name FROM entity e ' . 'WHERE e.name <> \'\' AND e.primary_ext = ? AND CAST(UPPER(e.name) AS BINARY) = CAST(e.name AS BINARY)';
     $stmt = $db->execute($sql, array('Person'));
     $names = $stmt->fetchAll(PDO::FETCH_ASSOC);
     foreach ($names as $ary) {
         $new = PersonTable::nameizePersonName($ary['name']);
         if ($new != $ary['name']) {
             $sql = 'UPDATE entity SET name = ? WHERE id = ?';
             $stmt = $db->execute($sql, array($new, $ary['id']));
             print "Changed Entity name " . $ary['name'] . " to " . $new . "\n";
         }
     }
     //get aliases with all-caps names
     $sql = 'SELECT a.id, a.name FROM alias a LEFT JOIN entity e ON (e.id = a.entity_id) ' . 'WHERE a.name <> \'\' AND a.is_primary = 1 AND e.primary_ext = ? AND ' . 'CAST(UPPER(a.name) AS BINARY) = CAST(a.name AS BINARY)';
     $stmt = $db->execute($sql, array('Person'));
     $names = $stmt->fetchAll(PDO::FETCH_ASSOC);
     foreach ($names as $ary) {
         $new = PersonTable::nameizePersonName($ary['name']);
         if ($new != $ary['name']) {
             $sql = 'UPDATE alias SET name = ? WHERE id = ?';
             $stmt = $db->execute($sql, array($new, $ary['id']));
             print "Changed Alias " . $ary['name'] . " to " . $new . "\n";
         }
     }
     //DONE
     LsCli::beep();
 }
開發者ID:silky,項目名稱:littlesis,代碼行數:33,代碼來源:CleanupCapsNamesTask.class.php

示例11: postUp

 public function postUp()
 {
     //Se crea la primera encuesta para el sitio
     $conn = Doctrine_Manager::getInstance()->connection();
     $query = 'INSERT INTO encuesta(id,nombre, created_at, updated_at) values(1,"Visita Oficina",now(), now())';
     $conn->execute($query);
 }
開發者ID:e-gob,項目名稱:ChileAtiende,代碼行數:7,代碼來源:27.php

示例12: pdo

 /**
  * @return PDOStatement
  */
 public static function pdo($query, array $values = array(), Doctrine_Connection $conn = null)
 {
     $conn = null === $conn ? Doctrine_Manager::getInstance()->getCurrentConnection() : $conn;
     $stmt = $conn->prepare($query)->getStatement();
     $stmt->execute($values);
     return $stmt;
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:10,代碼來源:dmDb.php

示例13: preExecute

 public function preExecute()
 {
     if (isset($_SESSION['username'])) {
         $this->redirect("http://ausw_travelagency_app.com/home/index");
     }
     $this->conn = Doctrine_Manager::getInstance()->connection();
 }
開發者ID:novesanchez,項目名稱:project-travelagency,代碼行數:7,代碼來源:actions.class.php

示例14: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     echo "\nApostrophe Database Migration Task\n  \nThis task will make any necessary database schema changes to bring your \nMySQL database up to date with the current release of Apostrophe and any additional\nApostrophe plugins that you have installed. For other databases see the source code \nor run './symfony doctrine:build-sql' to obtain the SQL commands you may need.\n  \nBACK UP YOUR DATABASE BEFORE YOU RUN THIS TASK. It works fine in our tests, \nbut why take chances with your data?\n\n";
     if (!$options['force']) {
         if (!$this->askConfirmation("Are you sure you are ready to migrate your project? [y/N]", 'QUESTION_LARGE', false)) {
             die("Operation CANCELLED. No changes made.\n");
         }
     }
     $this->migrate = new aMigrate(Doctrine_Manager::connection()->getDbh());
     // If I needed to I could look for the constraint definition like this.
     // But since we added these in the same migration I don't have to. Keep this
     // comment around as sooner or later we'll probably need to check for this
     // kind of thing
     //
     // $createTable = $data[0]['Create Table'];
     // if (!preg_match('/CONSTRAINT `a_redirect_page_id_a_page_id`/', $createTable))
     // {
     //
     // }
     if (!$this->migrate->tableExists('a_redirect')) {
         $this->migrate->sql(array("CREATE TABLE IF NOT EXISTS a_redirect (id INT AUTO_INCREMENT, page_id INT, slug VARCHAR(255) UNIQUE, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX slugindex_idx (slug), INDEX page_id_idx (page_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB;", "ALTER TABLE a_redirect ADD CONSTRAINT a_redirect_page_id_a_page_id FOREIGN KEY (page_id) REFERENCES a_page(id) ON DELETE CASCADE;"));
     }
     if (!$this->migrate->getCommandsRun()) {
         echo "Your database is already up to date.\n\n";
     } else {
         echo $this->migrate->getCommandsRun() . " SQL commands were run.\n\n";
     }
     echo "Done!\n";
 }
開發者ID:quafzi,項目名稱:timpany-prototype,代碼行數:32,代碼來源:apostropheMigrateTask.class.php

示例15: down

 public function down()
 {
     $this->removeColumn('ficha', 'metaficha_opciones');
     $conn = Doctrine_Manager::getInstance()->connection();
     $query = 'ALTER TABLE ficha ADD metaficha_categoria varchar(16)';
     $results = $conn->execute($query);
 }
開發者ID:e-gob,項目名稱:ChileAtiende,代碼行數:7,代碼來源:30.php


注:本文中的Doctrine_Manager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。