本文整理汇总了PHP中xPDO::getPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDO::getPackage方法的具体用法?PHP xPDO::getPackage怎么用?PHP xPDO::getPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xPDO
的用法示例。
在下文中一共展示了xPDO::getPackage方法的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;
}
示例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();
}
示例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();
}