当前位置: 首页>>代码示例>>PHP>>正文


PHP xPDO::getFieldAliases方法代码示例

本文整理汇总了PHP中xPDO::getFieldAliases方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDO::getFieldAliases方法的具体用法?PHP xPDO::getFieldAliases怎么用?PHP xPDO::getFieldAliases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xPDO的用法示例。


在下文中一共展示了xPDO::getFieldAliases方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor
  *
  * Do not call the constructor directly; see {@link xPDO::newObject()}.
  *
  * All derivatives of xPDOObject must redeclare this method, and must call
  * the parent method explicitly before any additional logic is executed, e.g.
  *
  * <code>
  * public function __construct(xPDO & $xpdo) {
  *     parent  :: __construct($xpdo);
  *     // Any additional constructor tasks here
  * }
  * </code>
  *
  * @access public
  * @param xPDO &$xpdo A reference to a valid xPDO instance.
  * @return xPDOObject
  */
 public function __construct(xPDO &$xpdo)
 {
     $this->xpdo =& $xpdo;
     $this->container = $xpdo->config['dbname'];
     $this->_class = get_class($this);
     $pos = strrpos($this->_class, '_');
     if ($pos !== false && substr($this->_class, $pos + 1) == $xpdo->config['dbtype']) {
         $this->_class = substr($this->_class, 0, $pos);
     }
     $this->_package = $xpdo->getPackage($this->_class);
     $this->_alias = $this->_class;
     $this->_table = $xpdo->getTableName($this->_class);
     $this->_tableMeta = $xpdo->getTableMeta($this->_class);
     $this->_fields = $xpdo->getFields($this->_class);
     $this->_fieldMeta = $xpdo->getFieldMeta($this->_class);
     $this->_fieldAliases = $xpdo->getFieldAliases($this->_class);
     $this->_aggregates = $xpdo->getAggregates($this->_class);
     $this->_composites = $xpdo->getComposites($this->_class);
     if ($relatedObjs = array_merge($this->_aggregates, $this->_composites)) {
         foreach ($relatedObjs as $aAlias => $aMeta) {
             if (!array_key_exists($aAlias, $this->_relatedObjects)) {
                 if ($aMeta['cardinality'] == 'many') {
                     $this->_relatedObjects[$aAlias] = array();
                 } else {
                     $this->_relatedObjects[$aAlias] = null;
                 }
             }
         }
     }
     foreach ($this->_fieldAliases as $fieldAlias => $field) {
         $this->addFieldAlias($field, $fieldAlias);
     }
     $this->setDirty();
 }
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:53,代码来源:xpdoobject.class.php

示例2: __construct

 /**
  * Constructor
  *
  * Do not call the constructor directly; see {@link xPDO::newObject()}.
  *
  * All derivatives of xPDOObject must redeclare this method, and must call
  * the parent method explicitly before any additional logic is executed, e.g.
  *
  * <code>
  * public function __construct(xPDO & $xpdo) {
  *     parent  :: __construct($xpdo);
  *     // Any additional constructor tasks here
  * }
  * </code>
  *
  * @access public
  * @param xPDO &$xpdo A reference to a valid xPDO instance.
  * @return xPDOObject
  */
 public function __construct(xPDO &$xpdo)
 {
     $this->xpdo =& $xpdo;
     $this->container = $xpdo->config['dbname'];
     $this->_class = get_class($this);
     $pos = strrpos($this->_class, '_');
     if ($pos !== false && substr($this->_class, $pos + 1) == $xpdo->config['dbtype']) {
         $this->_class = substr($this->_class, 0, $pos);
     }
     $this->_package = $xpdo->getPackage($this->_class);
     $this->_alias = $this->_class;
     $this->_table = $xpdo->getTableName($this->_class);
     $this->_tableMeta = $xpdo->getTableMeta($this->_class);
     $this->_fields = $xpdo->getFields($this->_class);
     $this->_fieldMeta = $xpdo->getFieldMeta($this->_class);
     $this->_fieldAliases = $xpdo->getFieldAliases($this->_class);
     $this->_aggregates = $xpdo->getAggregates($this->_class);
     $this->_composites = $xpdo->getComposites($this->_class);
     $classVars = array();
     if ($relatedObjs = array_merge($this->_aggregates, $this->_composites)) {
         if ($this->getOption(xPDO::OPT_HYDRATE_RELATED_OBJECTS)) {
             $classVars = get_object_vars($this);
         }
         foreach ($relatedObjs as $aAlias => $aMeta) {
             if (!array_key_exists($aAlias, $this->_relatedObjects)) {
                 if ($aMeta['cardinality'] == 'many') {
                     $this->_relatedObjects[$aAlias] = array();
                 } else {
                     $this->_relatedObjects[$aAlias] = null;
                 }
             }
             if ($this->getOption(xPDO::OPT_HYDRATE_RELATED_OBJECTS) && !array_key_exists($aAlias, $classVars)) {
                 $this->{$aAlias} =& $this->_relatedObjects[$aAlias];
                 $classVars[$aAlias] = 1;
             }
         }
     }
     if ($this->getOption(xPDO::OPT_HYDRATE_FIELDS)) {
         if (!$this->getOption(xPDO::OPT_HYDRATE_RELATED_OBJECTS)) {
             $classVars = get_object_vars($this);
         }
         foreach ($this->_fields as $fldKey => $fldVal) {
             if (!array_key_exists($fldKey, $classVars)) {
                 $this->{$fldKey} =& $this->_fields[$fldKey];
             }
         }
     }
     foreach ($this->_fieldAliases as $fieldAlias => $field) {
         $this->addFieldAlias($field, $fieldAlias);
     }
     $this->setDirty();
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:71,代码来源:xpdoobject.class.php


注:本文中的xPDO::getFieldAliases方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。