本文整理汇总了PHP中eZPersistentObject::attribute方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPersistentObject::attribute方法的具体用法?PHP eZPersistentObject::attribute怎么用?PHP eZPersistentObject::attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZPersistentObject
的用法示例。
在下文中一共展示了eZPersistentObject::attribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attribute
function attribute($attr, $noFunction = false)
{
$eventType = $this->eventType();
if (is_object($eventType) and in_array($attr, $eventType->typeFunctionalAttributes())) {
return $eventType->attributeDecoder($this, $attr);
}
return eZPersistentObject::attribute($attr);
}
示例2: attribute
/**
* (non-PHPdoc)
* @see kernel/classes/eZPersistentObject#attribute($attr, $noFunction)
*/
function attribute($attr, $noFunction = false)
{
switch ($attr) {
case 'list_attribute_content':
return $this->getListAttributeContent();
break;
default:
return eZPersistentObject::attribute($attr);
}
}
示例3: attribute
/**
* (non-PHPdoc)
* @see kernel/classes/eZPersistentObject#attribute($attr, $noFunction)
*/
function attribute($attr, $noFunction = false)
{
switch ($attr) {
case 'to_string':
return $this->toString();
break;
default:
return eZPersistentObject::attribute($attr);
}
}
示例4: attribute
function attribute($attr, $noFunction = false)
{
$retVal = null;
switch ($attr) {
case 'related_object_1':
case 'related_object_2':
case 'related_object_3':
/* #DEPRECATED# */
$retVal = eZContentObject::fetch($this->attribute('related_object_id_' . substr($attr, -1, 1)));
break;
default:
$retVal = eZPersistentObject::attribute($attr);
break;
}
return $retVal;
}
示例5: attribute
function attribute($attribute, $noFunction = false)
{
$found = false;
switch ($attribute) {
case 'contentobjectattribute_id':
$val = $this->ContentObjectAttributeID;
$found = true;
break;
}
if ($found === false) {
$val = parent::attribute($attribute, $noFunction);
}
return $val;
}
示例6: remoteID
function remoteID()
{
$remoteID = eZPersistentObject::attribute('remote_id', true);
if (!$remoteID) {
$this->setAttribute('remote_id', eZRemoteIdUtility::generate('node'));
$this->sync(array('remote_id'));
$remoteID = eZPersistentObject::attribute('remote_id', true);
}
return $remoteID;
}
示例7: mimeTypePart
function mimeTypePart()
{
$types = explode("/", eZPersistentObject::attribute("mime_type"));
return $types[1];
}
示例8: remoteID
function remoteID()
{
$remoteID = eZPersistentObject::attribute( 'remote_id', true );
// Ensures that we provide the correct remote_id if we have one in the database
if ( $remoteID === null and $this->attribute( 'id' ) )
{
$db = eZDB::instance();
$resultArray = $db->arrayQuery( "SELECT remote_id FROM ezcontentobject WHERE id = '" . $this->attribute( 'id' ) . "'" );
if ( count( $resultArray ) == 1 )
{
$remoteID = $resultArray[0]['remote_id'];
$this->setAttribute( 'remote_id', $remoteID );
}
}
if ( !$remoteID )
{
$this->setAttribute( 'remote_id', eZRemoteIdUtility::generate( 'object' ) );
if ( $this->attribute( 'id' ) !== null )
$this->sync( array( 'remote_id' ) );
$remoteID = eZPersistentObject::attribute( 'remote_id', true );
}
return $remoteID;
}
示例9: exportClassesArray
function exportClassesArray()
{
return explode(':', eZPersistentObject::attribute('export_classes'));
}
示例10: storeObject
/**
* Stores the data in $obj to database.
*
* Note: Transaction unsafe. If you call several transaction unsafe methods
* you must enclose the calls within a db transaction; thus within db->begin
* and db->commit.
*
* @todo Change the actual access to protected instead of just marking it as such
* @access protected
* @param eZPersistentObject $obj
* @param array|null $fieldFilters If specified only certain fields will be stored.
* @return void
*/
public static function storeObject($obj, $fieldFilters = null)
{
$db = eZDB::instance();
$useFieldFilters = isset($fieldFilters) && is_array($fieldFilters) && $fieldFilters;
$def = $obj->definition();
$fields = $def["fields"];
$keys = $def["keys"];
$table = $def["name"];
$relations = isset($def["relations"]) ? $def["relations"] : null;
$insert_object = false;
$exclude_fields = array();
foreach ($keys as $key) {
$value = $obj->attribute($key);
if ($value === null) {
$insert_object = true;
$exclude_fields[] = $key;
}
}
if ($useFieldFilters) {
$insert_object = false;
}
$use_fields = array_diff(array_keys($fields), $exclude_fields);
// If we filter out some of the fields we need to intersect it with $use_fields
if (is_array($fieldFilters)) {
$use_fields = array_intersect($use_fields, $fieldFilters);
}
$doNotEscapeFields = array();
$changedValueFields = array();
$numericDataTypes = array('integer', 'float', 'double');
foreach ($use_fields as $field_name) {
$field_def = $fields[$field_name];
$value = $obj->attribute($field_name);
if ($value === null) {
if (!is_array($field_def)) {
$exclude_fields[] = $field_name;
} else {
if (array_key_exists('default', $field_def) && ($field_def['default'] !== null || $field_name == 'data_int' && array_key_exists('required', $field_def) && $field_def['required'] == false)) {
$obj->setAttribute($field_name, $field_def['default']);
} else {
//if ( in_array( $field_def['datatype'], $numericDataTypes )
$exclude_fields[] = $field_name;
}
}
}
if (strlen($value) == 0 && is_array($field_def) && in_array($field_def['datatype'], $numericDataTypes) && array_key_exists('default', $field_def) && ($field_def['default'] === null || is_numeric($field_def['default']))) {
$obj->setAttribute($field_name, $field_def['default']);
}
if ($value !== null && $field_def['datatype'] === 'string' && array_key_exists('max_length', $field_def) && $field_def['max_length'] > 0) {
$obj->setAttribute($field_name, $db->truncateString($value, $field_def['max_length'], $field_name));
}
$bindDataTypes = array('text');
if ($db->bindingType() != eZDBInterface::BINDING_NO && $db->countStringSize($value) > 2000 && is_array($field_def) && in_array($field_def['datatype'], $bindDataTypes)) {
$boundValue = $db->bindVariable($value, $field_def);
// $obj->setAttribute( $field_name, $value );
$doNotEscapeFields[] = $field_name;
$changedValueFields[$field_name] = $boundValue;
}
}
$key_conds = array();
foreach ($keys as $key) {
$value = $obj->attribute($key);
$key_conds[$key] = $value;
}
unset($value);
$important_keys = $keys;
if (is_array($relations)) {
// $important_keys = array();
foreach ($relations as $relation => $relation_data) {
if (!in_array($relation, $keys)) {
$important_keys[] = $relation;
}
}
}
if (count($important_keys) == 0 && !$useFieldFilters) {
$insert_object = true;
} else {
if (!$insert_object) {
$rows = eZPersistentObject::fetchObjectList($def, $keys, $key_conds, array(), null, false, null, null);
if (count($rows) == 0) {
/* If we only want to update some fields in a record
* and that records does not exist, then we should do nothing, only return.
*/
if ($useFieldFilters) {
return;
}
$insert_object = true;
}
//.........这里部分代码省略.........
示例11: remoteID
function remoteID()
{
$remoteID = eZPersistentObject::attribute('remote_id', true);
if (!$remoteID) {
$this->setAttribute('remote_id', md5((string) mt_rand() . (string) time()));
$this->sync(array('remote_id'));
$remoteID = eZPersistentObject::attribute('remote_id', true);
}
return $remoteID;
}
示例12: getOutputFormatArray
/**
* Returns available outputformats as array
* array( id => name )
* zb. array['0'] = 'html'
*
* @return array
*/
function getOutputFormatArray()
{
$availableOutputFormatArray = CjwNewsletterList::getAvailableOutputFormatArray();
$outputFormatArray = $this->stringToArray(eZPersistentObject::attribute('output_format_array_string'));
$newOutputFormatArrayWithNames = array();
foreach ($outputFormatArray as $outputFormatId) {
if (array_key_exists($outputFormatId, $availableOutputFormatArray)) {
$newOutputFormatArrayWithNames[$outputFormatId] = $availableOutputFormatArray[$outputFormatId];
}
}
return $newOutputFormatArrayWithNames;
}
示例13: getSiteaccessArray
/**
*
* @return array
*/
function getSiteaccessArray()
{
return $this->stringToArray(eZPersistentObject::attribute('siteaccess_array_string'));
}
示例14: attribute
function attribute($attr, $noFunction = false)
{
$retVal = null;
switch ($attr) {
case 'related_object_1':
case 'related_object_2':
case 'related_object_3':
// #DEPRECATED#
$retVal = eZContentObject::fetch($this->attribute('related_object_id_' . substr($attr, -1, 1)));
break;
case 'inbox_object':
if ($this->attribute('inbox_id')) {
$retVal = eZContentObject::fetch($this->attribute('inbox_id'));
}
break;
case 'subscription_id_list':
$list = eZNewsletterTypeSubscription::fetchList($this->attribute('id'), false, $this->attribute('status'));
if ($list) {
$retVal = array();
foreach ($list as $subItem) {
$retVal[] = $subItem->attribute('subscription_id');
}
}
break;
case 'default_subscription_list':
$subscriptionListLink = eZSubscriptionList::fetch($this->attribute('defaultsubscriptionlist_id'));
if (!$retVal) {
$subscriptionList = $this->attribute('subscription_list');
if (0 < count($subscriptionList)) {
$subscriptionListLink = $subscriptionList[0];
}
}
if ($subscriptionListLink) {
$retVal = $subscriptionListLink->attribute('subscription_object');
}
break;
default:
$retVal = eZPersistentObject::attribute($attr);
break;
}
return $retVal;
}
示例15: remoteID
function remoteID()
{
$remoteID = eZPersistentObject::attribute('remote_id', true);
if (!$remoteID && $this->Version == eZContentClass::VERSION_STATUS_DEFINED) {
$this->setAttribute('remote_id', md5((string) mt_rand() . (string) time()));
$this->sync(array('remote_id'));
$remoteID = eZPersistentObject::attribute('remote_id', true);
}
return $remoteID;
}