本文整理汇总了PHP中Attribute::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Attribute::find方法的具体用法?PHP Attribute::find怎么用?PHP Attribute::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attribute
的用法示例。
在下文中一共展示了Attribute::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetByName
public static function GetByName($attributeName)
{
return Attribute::find(array('name' => $attributeName));
}
示例2: actionUpdate
public function actionUpdate($id)
{
//CVarDumper::dump($_POST, 10, true);
//die;
$model = $this->loadModel($id);
if (isset($_POST['deleteVariationID'])) {
Variation::model()->deleteAll('variation_id=' . $_POST['deleteVariationID']);
VariationDescription::model()->deleteAll('variation_id=' . $_POST['deleteVariationID']);
Variation2attribute::model()->deleteAll('variation_id=' . $_POST['deleteVariationID']);
Variation2value::model()->deleteAll('variation_id=' . $_POST['deleteVariationID']);
Product2variation::model()->deleteAll('variation_id=' . $_POST['deleteVariationID']);
echo 'success';
exit;
}
$lang_model = new LanguageModel;
$ProdDescModel = new ProductDescription;
$Category2product = $this->loadCatToProdModel('product_id=' . $id);
$assignedToCategory = $Category2product['category_id'];
$CadDescModel = new CategoryDescription;
$Product2variation = new Product2variation;
$Variation = new Variation;
$VariationDescription = new VariationDescription;
$Variation2attribute = new Variation2attribute;
$AttributeModel = new Attribute;
$AttributeDescModel = new AttributeDescription;
$Attribute2value = new Attribute2value;
$ValueModel = new Value;
$ValueDescription = new ValueDescription;
$aCategories = Category::model()->generateTreeList();
$aLangNames = array();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$allLangs = $lang_model->findAll('1', array('order' => 'id ASC'));
// Filter colors
$allFilterColors = FilterColors::model()->findAll(
array(
'condition' => 'status = :status',
'params' => array(':status' => 1),
'order'=>'sort_order',
)
);
// Delivery Time
$allDeliveryTimes = DeliveryTime::model()->findAll(
array(
'condition' => 'status = :status',
'params' => array(':status' => 1),
'order'=>'sort_order',
)
);
//Existing Variations
$aExistingVariations = array();
$aProd2Var = $Product2variation->findAll('product_id=' . $id);
foreach ($aProd2Var as $prod_to_var) {
$aVar = $Variation->find('variation_id=' . $prod_to_var['variation_id']);
$aExistingVariations[$prod_to_var['variation_id']]['image'] = $aVar['variation_image'];
$aExistingVariations[$prod_to_var['variation_id']]['filter_color_id'] = $aVar['filter_color_id'];
$aVarDescrs = $VariationDescription->findAll('variation_id=' . $prod_to_var['variation_id']);
foreach ($aVarDescrs as $var_descr) {
$aExistingVariations[$prod_to_var['variation_id']]['lang_var_names'][$var_descr['language_id']] = $var_descr['variation_name'];
$aExistingVariations[$prod_to_var['variation_id']]['description'][$var_descr['language_id']] = $var_descr['variation_description'];
}
$Variation2value = new Variation2value;
$aVar2Val = $Variation2value->findAll('variation_id=' . $prod_to_var['variation_id']);
foreach ($aVar2Val as $var_to_val) {
$aExistingVariations[$prod_to_var['variation_id']]['set_values'][] = $var_to_val['value_id'];
}
$aVars2Attrs = $Variation2attribute->findAll('variation_id=' . $prod_to_var['variation_id']);
//attributes
foreach ($aVars2Attrs as $var_to_attr) {
$aAttr = $AttributeModel->find('attribute_id=' . $var_to_attr['attribute_id']);
$aAttrDescrs = $AttributeDescModel->find('attribute_id=\'' . $aAttr['attribute_id'] . '\' AND language_id=' . $this->language_id);
$aExistingVariations[$prod_to_var['variation_id']]['attributes'][$aAttr['attribute_id']]['attribute_name'] = $aAttrDescrs['attribute_name'];
//values
$aAttr2Vals = $Attribute2value->findAll('attribute_id=' . (int)$aAttr['attribute_id']);
foreach ($aAttr2Vals as $attr_to_val) {
$aValDescrs = $ValueDescription->find('value_id=' . $attr_to_val['value_id'] . ' AND language_id=' . $this->language_id);
$aExistingVariations[$prod_to_var['variation_id']]['attributes'][$aAttr['attribute_id']]['values'][$aValDescrs['value_id']] = $aValDescrs['value_name'];
}
}
}
$allLangsJS = array();
foreach ($allLangs as $language) {
$allLangsJS[$language['id']] = $language['code'];
//.........这里部分代码省略.........