示例#1
0
 public function GetAttributes($category, $entityIds = array())
 {
     if (!is_array($entityIds) && !empty($entityIds)) {
         $entityIds = array($entityIds);
     }
     $attributeList = new AttributeList();
     $attributes = $this->attributeRepository->GetByCategory($category);
     $stopwatch = new StopWatch();
     $stopwatch->Start();
     $values = $this->attributeRepository->GetEntityValues($category, $entityIds);
     foreach ($attributes as $attribute) {
         $attributeList->AddDefinition($attribute);
     }
     foreach ($values as $value) {
         $attributeList->AddValue($value);
     }
     $stopwatch->Stop();
     Log::Debug('Took %d seconds to load custom attributes for category %s', $stopwatch->GetTotalSeconds(), $category);
     return $attributeList;
 }