本文整理汇总了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;
}