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


PHP xPDO::getFields方法代码示例

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


在下文中一共展示了xPDO::getFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>
  * protected function __construct(& $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->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->_aggregates = $xpdo->getAggregates($this->_class);
     $this->_composites = $xpdo->getComposites($this->_class);
     $this->_options[xPDO::OPT_CALLBACK_ON_REMOVE] = isset($xpdo->config[xPDO::OPT_CALLBACK_ON_REMOVE]) && !empty($xpdo->config[xPDO::OPT_CALLBACK_ON_REMOVE]) ? $xpdo->config[xPDO::OPT_CALLBACK_ON_REMOVE] : null;
     $this->_options[xPDO::OPT_CALLBACK_ON_SAVE] = isset($xpdo->config[xPDO::OPT_CALLBACK_ON_SAVE]) && !empty($xpdo->config[xPDO::OPT_CALLBACK_ON_SAVE]) ? $xpdo->config[xPDO::OPT_CALLBACK_ON_SAVE] : null;
     $this->_options[xPDO::OPT_HYDRATE_RELATED_OBJECTS] = isset($xpdo->config[xPDO::OPT_HYDRATE_RELATED_OBJECTS]) && $xpdo->config[xPDO::OPT_HYDRATE_RELATED_OBJECTS];
     $this->_options[xPDO::OPT_HYDRATE_ADHOC_FIELDS] = isset($xpdo->config[xPDO::OPT_HYDRATE_ADHOC_FIELDS]) && $xpdo->config[xPDO::OPT_HYDRATE_ADHOC_FIELDS];
     $this->_options[xPDO::OPT_HYDRATE_FIELDS] = isset($xpdo->config[xPDO::OPT_HYDRATE_FIELDS]) && $xpdo->config[xPDO::OPT_HYDRATE_FIELDS];
     $this->_options[xPDO::OPT_ON_SET_STRIPSLASHES] = isset($xpdo->config[xPDO::OPT_ON_SET_STRIPSLASHES]) && $xpdo->config[xPDO::OPT_ON_SET_STRIPSLASHES];
     $this->_options[xPDO::OPT_VALIDATE_ON_SAVE] = isset($xpdo->config[xPDO::OPT_VALIDATE_ON_SAVE]) && $xpdo->config[xPDO::OPT_VALIDATE_ON_SAVE];
     $this->_options[xPDO::OPT_VALIDATOR_CLASS] = isset($xpdo->config[xPDO::OPT_VALIDATOR_CLASS]) ? $xpdo->config[xPDO::OPT_VALIDATOR_CLASS] : '';
     $classVars = array();
     if ($relatedObjs = array_merge($this->_aggregates, $this->_composites)) {
         if ($this->_options[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->_options[xPDO::OPT_HYDRATE_RELATED_OBJECTS] && !array_key_exists($aAlias, $classVars)) {
                 $this->{$aAlias} =& $this->_relatedObjects[$aAlias];
                 $classVars[$aAlias] = 1;
             }
         }
     }
     if ($this->_options[xPDO::OPT_HYDRATE_FIELDS]) {
         if (!$this->_options[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];
             }
         }
     }
     $this->setDirty();
     $this->xpdo =& $xpdo;
 }
开发者ID:Kleist,项目名称:xPDO,代码行数:75,代码来源: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);
     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

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