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


PHP fORM類代碼示例

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


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

示例1: testClassToDatabaseMapping

 public function testClassToDatabaseMapping()
 {
     $this->assertEquals('default', fORM::getDatabaseName('User'));
     $this->assertEquals('default', fORM::getDatabaseName('PhotoGallery'));
     fORM::mapClassToDatabase('User', 'second_db');
     $this->assertEquals('second_db', fORM::getDatabaseName('User'));
 }
開發者ID:nurulimamnotes,項目名稱:flourish-old,代碼行數:7,代碼來源:fORMTest.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     if (defined('SKIPPING')) {
         return;
     }
     $db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
     if (DB_TYPE == 'sqlite') {
         $db->execute(file_get_contents(DB_SETUP_FILE));
         $db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
     }
     $db->execute(file_get_contents(DB_POPULATE_FILE));
     $db->execute(file_get_contents(DB_EXTENDED_POPULATE_FILE));
     self::$db = $db;
     self::$schema = new fSchema($db);
     fORMDatabase::attach(self::$db);
     fORMSchema::attach(self::$schema);
     fORMOrdering::configureOrderingColumn('TopAlbum', 'position');
     fORMOrdering::configureOrderingColumn('FavoriteAlbum', 'position');
     fORMOrdering::configureOrderingColumn('YearFavoriteAlbum', 'position');
     if (defined('MAP_TABLES')) {
         fORM::mapClassToTable('User', 'user');
         fORM::mapClassToTable('Group', 'group');
         fORM::mapClassToTable('Artist', 'popular_artists');
         fORM::mapClassToTable('Album', 'records');
     }
 }
開發者ID:nurulimamnotes,項目名稱:flourish-old,代碼行數:26,代碼來源:fORMOrderingTest.php

示例3: findByParams

 /**
  * @param array $where
  * @return WpTesting_Model_AbstractTerm
  * @throws fNotFoundException
  */
 protected function findByParams(array $where = array())
 {
     $taxonomyTable = fORM::tablize('WpTesting_Model_Taxonomy');
     try {
         return fRecordSet::build($this->modelName, array($taxonomyTable . '.taxonomy=' => $this->getTaxonomy()) + $where)->getRecord(0);
     } catch (fNoRemainingException $e) {
         throw new fNotFoundException($this->modelName . ' not found by conditions: ' . var_export($where, true));
     }
 }
開發者ID:pmanterys,項目名稱:wp-mw-newsletter,代碼行數:14,代碼來源:AbstractTerm.php

示例4: setUp

 public function setUp()
 {
     if (defined('SKIPPING')) {
         $this->markTestSkipped();
     }
     fORMDatabase::attach($this->sharedFixture['db']);
     fORMDatabase::attach($this->sharedFixture['db2'], 'db2');
     fORMSchema::attach($this->sharedFixture['schema']);
     fORMSchema::attach($this->sharedFixture['schema2'], 'db2');
     fORM::mapClassToTable('Db2User', 'users');
     fORM::mapClassToDatabase('Db2User', 'db2');
     fORM::mapClassToTable('Db2Group', 'groups');
     fORM::mapClassToDatabase('Db2Group', 'db2');
 }
開發者ID:philip,項目名稱:flourish,代碼行數:14,代碼來源:fActiveRecordWithMultipleDatabasesTest.php

示例5: setUp

 public function setUp()
 {
     if (defined('SKIPPING')) {
         $this->markTestSkipped();
     }
     fORMDatabase::attach(self::$db);
     fORMDatabase::attach(self::$db2, 'db2');
     fORMSchema::attach(self::$schema);
     fORMSchema::attach(self::$schema2, 'db2');
     fORM::mapClassToTable('Db2User', 'users');
     fORM::mapClassToDatabase('Db2User', 'db2');
     fORM::mapClassToTable('Db2Group', 'groups');
     fORM::mapClassToDatabase('Db2Group', 'db2');
 }
開發者ID:netcarver,項目名稱:flourish,代碼行數:14,代碼來源:fActiveRecordWithMultipleDatabasesTest.php

示例6: setUp

 protected function setUp()
 {
     if (defined('SKIPPING')) {
         return;
     }
     $db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
     $db->execute(file_get_contents(DB_SETUP_FILE));
     $db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
     $db->execute(fix_schema(file_get_contents(DB_ALTERNATE_SCHEMA_SETUP_FILE)));
     $db->clearCache();
     fORMDatabase::attach($db);
     $this->sharedFixture = $db;
     fORM::mapClassToTable('Flourish2User', fix_schema('flourish2.users'));
     fORM::mapClassToTable('Flourish2Group', fix_schema('flourish2.groups'));
     fORM::mapClassToTable('Flourish2Artist', fix_schema('flourish2.artists'));
     fORM::mapClassToTable('Flourish2Album', fix_schema('flourish2.albums'));
 }
開發者ID:philip,項目名稱:flourish,代碼行數:17,代碼來源:fRecordSetWithMultipleSchemasTest.php

示例7: setUp

 protected function setUp()
 {
     if (defined('SKIPPING')) {
         return;
     }
     $db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
     $db->execute(file_get_contents(DB_SETUP_FILE));
     $db2 = new fDatabase(DB_TYPE, DB_2, DB_2_USERNAME, DB_2_PASSWORD, DB_2_HOST, DB_2_PORT);
     $db2->execute(file_get_contents(DB_2_SETUP_FILE));
     $this->sharedFixture = array($db, $db2);
     fORMDatabase::attach($db);
     fORMDatabase::attach($db2, 'db2');
     fORM::mapClassToTable('Db2User', 'users');
     fORM::mapClassToDatabase('Db2User', 'db2');
     fORM::mapClassToTable('Db2Group', 'groups');
     fORM::mapClassToDatabase('Db2Group', 'db2');
 }
開發者ID:philip,項目名稱:flourish,代碼行數:17,代碼來源:fRecordSetWithMultipleDatabasesTest.php

示例8: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     if (defined('SKIPPING')) {
         return;
     }
     $db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
     $db->execute(file_get_contents(DB_SETUP_FILE));
     $db2 = new fDatabase(DB_TYPE, DB_2, DB_2_USERNAME, DB_2_PASSWORD, DB_2_HOST, DB_2_PORT);
     $db2->execute(file_get_contents(DB_2_SETUP_FILE));
     self::$db = $db;
     self::$db2 = $db2;
     fORMDatabase::attach($db);
     fORMDatabase::attach($db2, 'db2');
     fORM::mapClassToTable('Db2User', 'users');
     fORM::mapClassToDatabase('Db2User', 'db2');
     fORM::mapClassToTable('Db2Group', 'groups');
     fORM::mapClassToDatabase('Db2Group', 'db2');
 }
開發者ID:netcarver,項目名稱:flourish,代碼行數:18,代碼來源:fRecordSetWithMultipleDatabasesTest.php

示例9: setUp

 public function setUp()
 {
     if (defined('SKIPPING')) {
         $this->markTestSkipped();
     }
     $db = $this->sharedFixture['db'];
     $db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
     $db->clearCache();
     fORMDatabase::attach($db);
     fORMSchema::attach($this->sharedFixture['schema']);
     fORMOrdering::configureOrderingColumn('TopAlbum', 'position');
     fORMOrdering::configureOrderingColumn('FavoriteAlbum', 'position');
     fORMOrdering::configureOrderingColumn('YearFavoriteAlbum', 'position');
     if (defined('MAP_TABLES')) {
         fORM::mapClassToTable('User', 'user');
         fORM::mapClassToTable('Group', 'group');
         fORM::mapClassToTable('Artist', 'popular_artists');
         fORM::mapClassToTable('Album', 'records');
     }
 }
開發者ID:philip,項目名稱:flourish,代碼行數:20,代碼來源:fORMOrderingTest.php

示例10: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     if (defined('SKIPPING')) {
         return;
     }
     $db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
     if (DB_TYPE == 'sqlite') {
         $db->execute(file_get_contents(DB_SETUP_FILE));
         $db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
         $db->execute(fix_schema(file_get_contents(DB_ALTERNATE_SCHEMA_SETUP_FILE)));
     }
     $db->execute(file_get_contents(DB_POPULATE_FILE));
     $db->execute(file_get_contents(DB_EXTENDED_POPULATE_FILE));
     $db->execute(fix_schema(file_get_contents(DB_ALTERNATE_SCHEMA_POPULATE_FILE)));
     $db->clearCache();
     fORMDatabase::attach($db);
     self::$db = $db;
     fORM::mapClassToTable('Flourish2User', fix_schema('flourish2.users'));
     fORM::mapClassToTable('Flourish2Group', fix_schema('flourish2.groups'));
     fORM::mapClassToTable('Flourish2Artist', fix_schema('flourish2.artists'));
     fORM::mapClassToTable('Flourish2Album', fix_schema('flourish2.albums'));
 }
開發者ID:nurulimamnotes,項目名稱:flourish-old,代碼行數:22,代碼來源:fRecordSetWithMultipleSchemasTest.php

示例11: testBuildFromSQLNonLimitedCount

 public function testBuildFromSQLNonLimitedCount()
 {
     $set = fRecordSet::buildFromSQL('User', sprintf("SELECT %s.* FROM %s LIMIT 2", fORM::tablize('User'), fORM::tablize('User')), sprintf("SELECT count(*) FROM %s", fORM::tablize('User')));
     $this->assertEquals(array(1, 2), $set->getPrimaryKeys());
     $this->assertEquals(4, $set->count(TRUE));
 }
開發者ID:nurulimamnotes,項目名稱:flourish-old,代碼行數:6,代碼來源:fRecordSetTest.php

示例12: validateManyToMany

 /**
  * Validates many-to-many related records
  *
  * @param  string $class          The class to validate the related records for
  * @param  string $related_class  The name of the class for this record set
  * @param  string $route          The route between the table and related table
  * @param  array  $related_info   The related info to validate
  * @return array  An array of validation messages
  */
 private static function validateManyToMany($class, $related_class, $route, $related_info)
 {
     $related_record_name = self::getRelatedRecordName($class, $related_class, $route);
     $record_number = 1;
     $messages = array();
     $related_records = $related_info['record_set'] ? $related_info['record_set'] : $related_info['primary_keys'];
     foreach ($related_records as $record) {
         if (is_object($record) && !$record->exists() || !$record) {
             $messages[fORM::tablize($related_class)] = self::compose('%1$sPlease select a %2$s', fValidationException::formatField(self::compose('%1$s #%2$s', $related_record_name, $record_number)), $related_record_name);
         }
         $record_number++;
     }
     return $messages;
 }
開發者ID:alandsidel,項目名稱:flourish-classes,代碼行數:23,代碼來源:fORMRelated.php

示例13: validateTimezoneColumns

 /**
  * Validates all timestamp/timezone columns
  *
  * @internal
  *
  * @param  fActiveRecord $object                The fActiveRecord instance
  * @param  array         &$values               The current values
  * @param  array         &$old_values           The old values
  * @param  array         &$related_records      Any records related to this record
  * @param  array         &$cache                The cache array for the record
  * @param  array         &$validation_messages  An array of ordered validation messages
  * @return void
  */
 public static function validateTimezoneColumns($object, &$values, &$old_values, &$related_records, &$cache, &$validation_messages)
 {
     $class = get_class($object);
     if (empty(self::$timezone_columns[$class])) {
         return;
     }
     foreach (self::$timezone_columns[$class] as $timezone_column => $timestamp_column) {
         if ($values[$timestamp_column] instanceof fTimestamp || $values[$timestamp_column] === NULL) {
             continue;
         }
         if (!fTimestamp::isValidTimezone($values[$timezone_column])) {
             $validation_messages[$timezone_column] = self::compose('%sThe timezone specified is invalid', fValidationException::formatField(fORM::getColumnName($class, $timezone_column)));
         } else {
             $validation_messages[$timestamp_column] = self::compose('%sPlease enter a date/time', fValidationException::formatField(fORM::getColumnName($class, $timestamp_column)));
         }
     }
 }
開發者ID:alandsidel,項目名稱:flourish-classes,代碼行數:30,代碼來源:fORMDate.php

示例14: extendRecordSetInfo

 /**
  * Overlays user data over info from the record set
  *
  * @param array        $data   The user data
  * @param string|array $class  The class or classes present in the record set
  * @return array  The merged data
  */
 private static function extendRecordSetInfo($data, $class)
 {
     if (is_array($class)) {
         $record_name = array_map(array('fORM', 'getRecordName'), $class);
     } else {
         $record_name = fORM::getRecordName($class);
     }
     return array_merge(array('class' => $class, 'record_name' => $record_name), $data);
 }
開發者ID:alandsidel,項目名稱:flourish-classes,代碼行數:16,代碼來源:fPagination.php

示例15: tossIfEmpty

 /**
  * Throws an fEmptySetException if the record set is empty
  * 
  * @throws fEmptySetException  When there are no record in the set
  * 
  * @param  string $message  The message to use for the exception if there are no records in this set
  * @return fRecordSet  The record set object, to allow for method chaining
  */
 public function tossIfEmpty($message = NULL)
 {
     if ($this->records) {
         return $this;
     }
     if ($message === NULL) {
         if (is_array($this->class)) {
             $names = array_map(array('fORM', 'getRecordName'), $this->class);
             $names = array_map(array('fGrammar', 'pluralize'), $names);
             $name = join(', ', $names);
         } else {
             $name = fGrammar::pluralize(fORM::getRecordName($this->class));
         }
         $message = self::compose('No %s could be found', $name);
     }
     throw new fEmptySetException($message);
 }
開發者ID:JhunCabas,項目名稱:material-management,代碼行數:25,代碼來源:fRecordSet.php


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