public function Currency::__construct in Currency 8.3
Same name in this branch
- 8.3 src/Entity/Currency.php \Drupal\currency\Entity\Currency::__construct()
- 8.3 src/Plugin/views/filter/Currency.php \Drupal\currency\Plugin\views\filter\Currency::__construct()
- 8.3 src/Plugin/views/field/Currency.php \Drupal\currency\Plugin\views\field\Currency::__construct()
Constructs an Entity object.
Parameters
array $values: An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.
string $entity_type: The type of the entity to create.
Overrides ConfigEntityBase::__construct
File
- src/
Entity/ Currency.php, line 138
Class
- Currency
- Defines a currency entity class.
Namespace
Drupal\currency\EntityCode
public function __construct(array $values, $entity_type) {
if (isset($values['usages'])) {
$usages_data = $values['usages'];
$values['usages'] = [];
foreach ($usages_data as $usage_data) {
$usage = new Usage();
$usage
->setStart($usage_data['start'])
->setEnd($usage_data['end'])
->setCountryCode($usage_data['countryCode']);
$values['usages'][] = $usage;
}
}
parent::__construct($values, $entity_type);
}