本文整理匯總了PHP中Property::setAttributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Property::setAttributes方法的具體用法?PHP Property::setAttributes怎麽用?PHP Property::setAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Property
的用法示例。
在下文中一共展示了Property::setAttributes方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepareObjectAttributes
public function prepareObjectAttributes($record)
{
$property = array();
foreach ($record->metas as $meta) {
//
// NEED TO REFACTORED
//
$prop_attr['key_name'] = $meta->meta->key_name;
$prop_attr['value'] = $meta->meta_value;
$prop_attr['descr'] = $meta->meta->descr;
$prop_attr['id'] = $meta->id;
//
// ====
$prop = new Property();
$prop->setAttributes($prop_attr);
$property[] = $prop->getAttributes();
}
$objects = array();
foreach ($record->objects as $object) {
$objects[] = array('name' => $object->name, 'text_value' => $object->text_value, 'descr' => $object->descr, 'id' => $object->id);
}
$attr = $record->getAttributes();
$attr['type'] = $record->type->name;
$attr['property'] = $property;
$attr['objects'] = $objects;
return $attr;
}
示例2: setAttributes
public function setAttributes($attr)
{
parent::setAttributes($attr);
$props = $attr['property'];
if (isset($props) && is_array($props)) {
foreach ($props as $propertyAttr) {
$property = new Property();
$property->setAttributes($propertyAttr);
$this->property[] = $property;
}
}
}
示例3: setAttributes
public function setAttributes($attr)
{
parent::setAttributes($attr);
if (isset($attr['property']) && is_array($attr['property'])) {
$props = $attr['property'];
foreach ($props as $propertyAttr) {
$property = new Property();
$property->setAttributes($propertyAttr);
$this->property[] = $property;
}
}
if (isset($attr['objects']) && is_array($attr['objects'])) {
$objects = $attr['objects'];
foreach ($objects as $objectAttr) {
$obj = new Object();
$obj->setAttributes($objectAttr);
$this->objects[] = $obj;
}
}
}
示例4: createDataObject
public function createDataObject($object)
{
$property = new Property();
$property->setAttributes($object);
return $property;
}