/** * @param AbstractEnumValue $object * * {@inheritdoc} */ public function normalize($object, $format = null, array $context = []) { if (!$object instanceof AbstractEnumValue) { return null; } if (!empty($context['mode']) && $context['mode'] === 'short') { return ['id' => $object->getId()]; } return ['id' => $object->getId(), 'name' => $object->getName(), 'priority' => (int) $object->getPriority(), 'is_default' => (bool) $object->isDefault()]; }
/** * @param string $html * @param string $name * @param Account $parent * @param AccountGroup $group * @param AbstractEnumValue $internalRating */ protected function assertViewPage($html, $name, Account $parent, AccountGroup $group, AbstractEnumValue $internalRating) { $this->assertContains($name, $html); $this->assertContains($parent->getName(), $html); $this->assertContains($group->getName(), $html); $this->assertContains($internalRating->getName(), $html); }
/** * @param AbstractEnumValue $value * @param array $option * * @return bool */ protected function setEnumValueProperties(AbstractEnumValue $value, array $option) { $hasChanges = false; if ($value->getName() != $option['label']) { $value->setName($option['label']); $hasChanges = true; } if ($value->getPriority() != $option['priority']) { $value->setPriority($option['priority']); $hasChanges = true; } if ($value->isDefault() != $option['is_default']) { $value->setDefault($option['is_default']); $hasChanges = true; } return $hasChanges; }