本文整理汇总了PHP中Doctrine_Table类的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Table类的具体用法?PHP Doctrine_Table怎么用?PHP Doctrine_Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Doctrine_Table类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Doctrine_Table $table, $fieldName)
{
$this->_table = $table;
$columnList = $this->_table->getColumnNames();
//Check if the identity and credential are one of the column names...
if (!in_array($fieldName, $columnList)) {
throw new Zend_Auth_Adapter_Exception("Invalid Column names are given as '{$fieldName}'");
}
$this->_fieldName = $fieldName;
}
开发者ID:kokkez,项目名称:shineisp,代码行数:10,代码来源:Secretkey.php
示例2: generateClassFromTable
public function generateClassFromTable(Doctrine_Table $table)
{
$definition = array();
$definition['columns'] = $table->getColumns();
$definition['tableName'] = $table->getTableName();
$definition['actAs'] = $table->getTemplates();
$definition['generate_once'] = true;
$generatedclass = $this->generateClass($definition);
Doctrine::loadModels(sfConfig::get('sf_lib_dir') . '/model/doctrine/opCommunityTopicPlugin/base/');
return $generatedclass;
}
开发者ID:niryuu,项目名称:opCommunityTopicPlugin-100628,代码行数:11,代码来源:opCommunityTopicPluginImagesRecordGenerator.class.php
示例3: __construct
public function __construct(Doctrine_Table $table, $identityCol, $credentialCol)
{
$this->_table = $table;
$columnList = $this->_table->getColumnNames();
//Check if the identity and credential are one of the column names...
if (!in_array($identityCol, $columnList) || !in_array($credentialCol, $columnList)) {
throw new Zend_Auth_Adapter_Exception("Invalid Column names are given as '{$identityCol}' and '{$credentialCol}'");
}
$this->_credentialCol = $credentialCol;
//Assign the column names...
$this->_identityCol = $identityCol;
}
开发者ID:kokkez,项目名称:shineisp,代码行数:12,代码来源:Doctrine.php
示例4: __construct
/**
* constructor
*
* @param array $options an array of plugin options
*/
public function __construct(array $options = array())
{
parent::__construct($options);
if (!isset($this->_options['resource'])) {
$table = new Doctrine_Table('File', Doctrine_Manager::connection());
$table->setColumn('url', 'string', 255, array('primary' => true));
}
if (empty($this->_options['fields'])) {
$this->_options['fields'] = array('url', 'content');
}
$this->initialize($table);
}
开发者ID:kirvin,项目名称:the-nerdery,代码行数:17,代码来源:File.php
示例5: __construct
/**
* constructor, creates tree with reference to table and any options
*
* @param object $table instance of Doctrine_Table
* @param array $options options
*/
public function __construct(Doctrine_Table $table, $options)
{
$this->table = $table;
$this->options = $options;
$this->_baseComponent = $table->getComponentName();
$class = $this->_baseComponent;
if ($table->getOption('inheritanceMap')) {
$subclasses = $table->getOption('subclasses');
while (in_array($class, $subclasses)) {
$class = get_parent_class($class);
}
$this->_baseComponent = $class;
}
//echo $this->_baseComponent;
}
开发者ID:densem-2013,项目名称:exikom,代码行数:21,代码来源:Tree.php
示例6: isIdentifiable
/**
* isIdentifiable
* returns whether or not a given data row is identifiable (it contains
* all primary key fields specified in the second argument)
*
* @param array $row
* @param Doctrine_Table $table
* @return boolean
*/
public function isIdentifiable(array $row, Doctrine_Table $table)
{
$primaryKeys = $table->getIdentifierColumnNames();
if (is_array($primaryKeys)) {
foreach ($primaryKeys as $id) {
if (!isset($row[$id])) {
return false;
}
}
} else {
if (!isset($row[$primaryKeys])) {
return false;
}
}
return true;
}
开发者ID:kirvin,项目名称:the-nerdery,代码行数:25,代码来源:RecordDriver.php
示例7: parseValue
public function parseValue($value, Doctrine_Table $table = null, $field = null)
{
$conn = $this->query->getConnection();
if (substr($value, 0, 1) == '(') {
// trim brackets
$trimmed = $this->_tokenizer->bracketTrim($value);
if (substr($trimmed, 0, 4) == 'FROM' || substr($trimmed, 0, 6) == 'SELECT') {
// subquery found
$q = new Doctrine_Query();
$value = '(' . $this->query->createSubquery()->parseQuery($trimmed, false)->getQuery() . ')';
} elseif (substr($trimmed, 0, 4) == 'SQL:') {
$value = '(' . substr($trimmed, 4) . ')';
} else {
// simple in expression found
$e = $this->_tokenizer->sqlExplode($trimmed, ',');
$value = array();
$index = false;
foreach ($e as $part) {
if (isset($table) && isset($field)) {
$index = $table->enumIndex($field, trim($part, "'"));
if (false !== $index && $conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) {
$index = $conn->quote($index, 'text');
}
}
if ($index !== false) {
$value[] = $index;
} else {
$value[] = $this->parseLiteralValue($part);
}
}
$value = '(' . implode(', ', $value) . ')';
}
} else {
if (substr($value, 0, 1) == ':' || $value === '?') {
// placeholder found
if (isset($table) && isset($field) && $table->getTypeOf($field) == 'enum') {
$this->query->addEnumParam($value, $table, $field);
} else {
$this->query->addEnumParam($value, null, null);
}
} else {
$enumIndex = false;
if (isset($table) && isset($field)) {
// check if value is enumerated value
$enumIndex = $table->enumIndex($field, trim($value, "'"));
if (false !== $enumIndex && $conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)) {
$enumIndex = $conn->quote($enumIndex, 'text');
}
}
if ($enumIndex !== false) {
$value = $enumIndex;
} else {
$value = $this->parseLiteralValue($value);
}
}
}
return $value;
}
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:58,代码来源:Where.php
示例8: getRecord
/**
* get product object of class depending on object properties itself
*
* @see vendor/doctrine/Doctrine/Doctrine_Table::getRecord()
*
* @return tpyProduct
*/
public function getRecord()
{
$basic_product = parent::getRecord();
if (0 == strlen($basic_product->getClassName()) or $basic_product->getClassName() == get_class($basic_product)) {
return $basic_product;
}
$class_name = $basic_product->getClassName();
$special_product = new $class_name($this, false);
$special_product->setDoctrineRecord($basic_product);
return $special_product;
}
开发者ID:quafzi,项目名称:timpanyPlugin,代码行数:18,代码来源:PlugintpyProductTable.class.php
示例9: buildIntegrityRelations
public function buildIntegrityRelations(Doctrine_Table $table, &$aliases, &$fields, &$indexes, &$components)
{
$deleteActions = Doctrine_Manager::getInstance()->getDeleteActions($table->getComponentName());
foreach ($table->getRelations() as $relation) {
$componentName = $relation->getTable()->getComponentName();
if (in_array($componentName, $components)) {
continue;
}
$components[] = $componentName;
$alias = strtolower(substr($relation->getAlias(), 0, 1));
if (!isset($indexes[$alias])) {
$indexes[$alias] = 1;
}
if (isset($deleteActions[$componentName])) {
if (isset($aliases[$alias])) {
$alias = $alias . ++$indexes[$alias];
}
$aliases[$alias] = $relation->getAlias();
if ($deleteActions[$componentName] === 'SET NULL') {
if ($relation instanceof Doctrine_Relation_ForeignKey) {
foreach ((array) $relation->getForeign() as $foreign) {
$fields .= ', ' . $alias . '.' . $foreign;
}
} elseif ($relation instanceof Doctrine_Relation_LocalKey) {
foreach ((array) $relation->getLocal() as $foreign) {
$fields .= ', ' . $alias . '.' . $foreign;
}
}
}
foreach ((array) $relation->getTable()->getIdentifier() as $id) {
$fields .= ', ' . $alias . '.' . $id;
}
if ($deleteActions[$componentName] === 'CASCADE') {
$this->buildIntegrityRelations($relation->getTable(), $aliases, $fields, $indexes, $components);
}
}
}
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:38,代码来源:IntegrityMapper.php
示例10: obtainCollectionName
/**
* Collections tag name
*
* @return string
*/
public static function obtainCollectionName(Doctrine_Table $table)
{
return self::getBaseClassName($table->getClassnameToReturn());
}
开发者ID:uniteddiversity,项目名称:policat,代码行数:9,代码来源:sfCacheTaggingToolkit.class.php
示例11: addTable
/**
* addTable
* adds a Doctrine_Table object into connection registry
*
* @param $table a Doctrine_Table object to be added into registry
* @return boolean
*/
public function addTable(Doctrine_Table $table)
{
$name = $table->getComponentName();
if (isset($this->tables[$name])) {
return false;
}
$this->tables[$name] = $table;
return true;
}
开发者ID:seven07ve,项目名称:vendorepuestos,代码行数:16,代码来源:Connection.php
示例12: getQuery
/**
* Return a query object, creating a new one if needed.
*
* @param Doctrine_Query $query
* @return Doctrine_Query
*/
public function getQuery(Doctrine_Query $query = null)
{
if (is_null($query)) {
$query = parent::createQuery('variation');
}
return $query;
}
开发者ID:pierswarmers,项目名称:rtShopPlugin,代码行数:13,代码来源:PluginrtShopVariationTable.class.php
示例13: delete
/**
* Deletes all records from this collection
*
* @return Doctrine_Collection
*/
public function delete(Doctrine_Connection $conn = null, $clearColl = true)
{
if ($conn == null) {
$conn = $this->_table->getConnection();
}
try {
$conn->beginInternalTransaction();
$conn->transaction->addCollection($this);
foreach ($this as $key => $record) {
$record->delete($conn);
}
$conn->commit();
} catch (Exception $e) {
$conn->rollback();
throw $e;
}
if ($clearColl) {
$this->clear();
}
return $this;
}
开发者ID:nationalfield,项目名称:symfony,代码行数:31,代码来源:Collection.php
示例14: _write
/**
* Write Event to database
*
* @param array $event
*/
public function _write($event)
{
$entry = $this->_table->create(array());
foreach ($this->_columnMap as $eventIndex => $tableColumn) {
$entry->{$tableColumn} = $event[$eventIndex];
}
$entry->save();
}
开发者ID:robo47,项目名称:robo47-components,代码行数:13,代码来源:DoctrineTable.php
示例15: createQuery
public function createQuery($alias = '')
{
//By default, collection is ordered by length descending. This prevents word overlap
// ex: 'my word' will match before 'word'. More "specific" Hyperwords match first
$q = parent::createQuery($alias);
$q->select('*, LENGTH(name) as length')->orderBy('length DESC');
return $q;
}
开发者ID:bshaffer,项目名称:sfHyperwordPlugin,代码行数:8,代码来源:PluginHyperwordTable.class.php
示例16: __construct
/**
*
*@throws Doctrine_Connection_Exception if there are no opened connections
*@param Doctrine_Connection $conn the connection associated with this table
*/
public function __construct(Doctrine_Connection $conn = null)
{
if ($conn === null) {
$conn = Doctrine_Manager::connection();
}
$name = str_replace('App_Table_', '', get_class($this));
parent::__construct($name, $conn, true);
}
开发者ID:ajbrown,项目名称:bitnotion,代码行数:13,代码来源:Abstract.php
示例17: indexAction
/**
* Our index action, show a lab.
*/
public function indexAction()
{
$this->view->headScript()->appendFile("/js/taffydb/taffy.js")->appendFile("/js/labs/views/task.js")->appendFile("/js/labs/models/task.js")->appendFile("/js/labs/controllers/add_task.js")->appendFile("/js/labs/controllers/task_list.js");
// Check for a code
if (!$this->_request->has("code")) {
throw new Exception(self::ERROR_NO_CODE, 404);
}
// get the passed code
$code = $this->_request->getParam("code");
$lab = $this->db->findOneByCode($code);
// check if the code is valid
if (!$lab instanceof App_Db_Lab) {
throw new Exception(self::ERROR_INVALID_CODE, 404);
}
$this->view->lab = $lab;
$this->view->headTitle($lab->name);
}
开发者ID:samuel-mccallum,项目名称:Task-Lab,代码行数:20,代码来源:LabController.php
示例18: getExportableFormat
/**
* Before returning the exportable-version of this table, unset any foreign
* keys that had the option "export => false".
*
* @param bool $parseForeignKeys
* @return array
*/
public function getExportableFormat($parseForeignKeys = true)
{
$data = parent::getExportableFormat($parseForeignKeys);
// unset any fk's that we shouldn't export
foreach ($this->no_export as $rel_alias) {
$key_name = $this->getRelation($rel_alias)->getForeignKeyName();
unset($data['options']['foreignKeys'][$key_name]);
}
return $data;
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:17,代码来源:AIR2_Table.php
示例19: _getRelations
/**
* Returns all un-ignored relations
* @return array
*/
protected function _getRelations()
{
$relations = array();
foreach ($this->_table->getRelations() as $name => $definition) {
if (in_array($definition->getLocal(), $this->_ignoreColumns) || $this->_generateManyFields == false && $definition->getType() == Doctrine_Relation::MANY) {
continue;
}
$relations[$name] = $definition;
}
return $relations;
}
开发者ID:abtris,项目名称:zfcore,代码行数:15,代码来源:DoctrineForm.php
示例20: getRelation
public function getRelation($alias, $recursive = true)
{
if ($this->hasRelation($alias)) {
return parent::getRelation($alias, $recursive);
}
foreach (ExtensionDefinitionTable::$extensionNamesWithFields as $extension) {
if (Doctrine::getTable($extension)->hasRelation($alias)) {
return Doctrine::getTable($extension)->getRelation($alias, $recursive);
}
}
return parent::getRelation($alias, $recursive);
}
开发者ID:silky,项目名称:littlesis,代码行数:12,代码来源:EntityTable.class.php
注:本文中的Doctrine_Table类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论