/** * Builds the SearchCriteria Data Object * * @return SearchCriteria */ public function create() { //Initialize with empty array if not set if (empty($this->_data[SearchCriteria::FILTER_GROUPS])) { $this->_set(SearchCriteria::FILTER_GROUPS, []); } return parent::create(); }
/** * {@inheritdoc} */ protected function _setDataValues(array $data) { if (isset($data[FilterGroup::FILTERS])) { $filters = []; foreach ($data[FilterGroup::FILTERS] as $filter) { $filters[] = $this->_filterBuilder->populateWithArray($filter)->create(); } $data[FilterGroup::FILTERS] = $filters; } return parent::_setDataValues($data); }
/** * {@inheritdoc} */ protected function _setDataValues(array $data) { if (array_key_exists(SearchResults::KEY_SEARCH_CRITERIA, $data)) { $data[SearchResults::KEY_SEARCH_CRITERIA] = $this->searchCriteriaBuilder->populateWithArray($data[SearchResults::KEY_SEARCH_CRITERIA])->create(); } if (array_key_exists(SearchResults::KEY_ITEMS, $data)) { $items = []; foreach ($data[SearchResults::KEY_ITEMS] as $itemArray) { $items[] = $this->itemObjectBuilder->populateWithArray($itemArray)->create(); } $data[SearchResults::KEY_ITEMS] = $items; } return parent::_setDataValues($data); }
/** * {@inheritdoc} */ protected function _setDataValues(array $data) { if (array_key_exists(AttributeMetadata::OPTIONS, $data)) { $options = array(); if (is_array($data[AttributeMetadata::OPTIONS])) { foreach ($data[AttributeMetadata::OPTIONS] as $key => $option) { $options[$key] = $this->_optionBuilder->populateWithArray($option)->create(); } } $validationRules = array(); if (is_array($data[AttributeMetadata::VALIDATION_RULES])) { foreach ($data[AttributeMetadata::VALIDATION_RULES] as $key => $value) { $validationRules[$key] = $this->_validationRuleBuilder->populateWithArray($value)->create(); } } $data[AttributeMetadata::OPTIONS] = $options; $data[AttributeMetadata::VALIDATION_RULES] = $validationRules; } return parent::_setDataValues($data); }
/** * {@inheritdoc} */ protected function _setDataValues(array $data) { if (array_key_exists(QuoteDetails::KEY_BILLING_ADDRESS, $data)) { $data[QuoteDetails::KEY_BILLING_ADDRESS] = $this->addressBuilder->populateWithArray($data[QuoteDetails::KEY_BILLING_ADDRESS])->create(); } if (array_key_exists(QuoteDetails::KEY_SHIPPING_ADDRESS, $data)) { $data[QuoteDetails::KEY_SHIPPING_ADDRESS] = $this->addressBuilder->populateWithArray($data[QuoteDetails::KEY_SHIPPING_ADDRESS])->create(); } if (array_key_exists(QuoteDetails::KEY_ITEMS, $data)) { $items = []; foreach ($data[QuoteDetails::KEY_ITEMS] as $itemArray) { $items[] = $this->itemBuilder->populateWithArray($itemArray)->create(); } $data[QuoteDetails::KEY_ITEMS] = $items; } return parent::_setDataValues($data); }
/** * Builds the entity. * * @return \Magento\Customer\Service\V1\Data\CustomerDetails */ public function create() { if (!isset($this->_data[CustomerDetails::KEY_CUSTOMER])) { $this->_data[CustomerDetails::KEY_CUSTOMER] = $this->_customerBuilder->create(); } if (!isset($this->_data[CustomerDetails::KEY_ADDRESSES])) { $this->_data[CustomerDetails::KEY_ADDRESSES] = null; } return parent::create(); }
/** * Initialize dependencies. * * @param ObjectFactory $objectFactory * @param TaxRateBuilder $taxRateBuilder */ public function __construct(ObjectFactory $objectFactory, TaxRateBuilder $taxRateBuilder) { parent::__construct($objectFactory); $this->taxRateBuilder = $taxRateBuilder; }
/** * {@inheritdoc} */ public function _setDataValues(array $data) { if (isset($data[TaxDetails::KEY_APPLIED_TAXES])) { $appliedTaxDataObjects = []; $appliedTaxes = $data[TaxDetails::KEY_APPLIED_TAXES]; foreach ($appliedTaxes as $appliedTax) { $appliedTaxDataObjects[] = $this->appliedTaxBuilder->populateWithArray($appliedTax)->create(); } $data[TaxDetails::KEY_APPLIED_TAXES] = $appliedTaxDataObjects; } if (isset($data[TaxDetails::KEY_ITEMS])) { $taxDetailItemDataObjects = []; $taxDetailItems = $data[TaxDetails::KEY_ITEMS]; foreach ($taxDetailItems as $taxDetailItem) { $taxDetailItemDataObjects[] = $this->taxDetailsItemBuilder->populateWithArray($taxDetailItem)->create(); } $data[TaxDetails::KEY_ITEMS] = $taxDetailItemDataObjects; } return parent::_setDataValues($data); }
/** * Test constructor and getters * * @dataProvider constructorAndGettersDataProvider */ public function testConstructorAndGetters($method, $key, $expectedValue) { $this->builderMock->expects($this->once())->method('getData')->will($this->returnValue([$key => $expectedValue])); $attributeMetadata = new AttributeMetadata($this->builderMock); $this->assertEquals($expectedValue, $attributeMetadata->{$method}()); }
/** * {@inheritdoc} */ protected function _setDataValues(array $data) { if (array_key_exists(AppliedTax::KEY_RATES, $data)) { $rates = []; foreach ($data[AppliedTax::KEY_RATES] as $rateArray) { $rates[] = $this->appliedTaxRateBuilder->populateWithArray($rateArray)->create(); } $data[AppliedTax::KEY_RATES] = $rates; } return parent::_setDataValues($data); }
/** * @param \Magento\Framework\Service\Data\ObjectFactory $objectFactory * @param AttributeValueBuilder $valueBuilder */ public function __construct(\Magento\Framework\Service\Data\ObjectFactory $objectFactory, AttributeValueBuilder $valueBuilder) { $this->_valueBuilder = $valueBuilder; parent::__construct($objectFactory); }
/** * {@inheritdoc} */ protected function _setDataValues(array $data) { if (array_key_exists(TaxRate::KEY_ZIP_RANGE, $data)) { $data[TaxRate::KEY_ZIP_RANGE] = $this->zipRangeBuilder->populateWithArray($data[TaxRate::KEY_ZIP_RANGE])->create(); } if (array_key_exists(TaxRate::KEY_TITLES, $data)) { $titles = array(); foreach ($data[TaxRate::KEY_TITLES] as $titleData) { $titles[] = $this->taxRateTitleBuilder->populateWithArray($titleData)->create(); } $data[TaxRate::KEY_TITLES] = $titles; } return parent::_setDataValues($data); }
/** * {@inheritdoc} */ protected function _setDataValues(array $data) { $appliedTaxDataObjects = []; if (isset($data[Item::KEY_APPLIED_TAXES])) { $appliedTaxes = $data[Item::KEY_APPLIED_TAXES]; foreach ($appliedTaxes as $appliedTax) { $appliedTaxDataObjects[] = $this->appliedTaxBuilder->populateWithArray($appliedTax)->create(); } } $data[Item::KEY_APPLIED_TAXES] = $appliedTaxDataObjects; return parent::_setDataValues($data); }