Get Default calendar color.

@param \Cake\Datasource\EntityInterface|null $entity of the current calendar
@return string $color containing hexadecimal color notation.
513742
public function getColor(?EntityInterface $entity = null): string
    {
        $color = Configure::read('Calendar.Configs.color');

        if ($entity instanceof EntityInterface && !empty($entity->get('color'))) {
            $color = $entity->get('color');
        }

        if (!$color) {
            $color = '#337ab7';
        }

        return $color;
    }
1054515
public function getEmitterFor($entity)
    {
        $emitter = $this->emitters->containsKey($entity)
            ? $this->emitters->get($entity)
            : $this->createEmitter($entity);
        return $emitter;
    }
1254755
public function generateBody(Entity $entity)
    {
        $body       = [];
        $descriptor = $entity->getDescriptor();
        $fields     = $descriptor->getFieldList() ?: [];

        foreach ($fields as $field) {
            if ( ! $field->hasDefaultValue()) {
                continue;
            }

            $name  = $field->getName();
            $value = $this->getDefaultFieldValue($field);

            $body[] = sprintf('$this->%s = %s;', $name, $value);
        }

        $body[] = null;
        $body[] = 'parent::__construct($stream, $configuration);';

        return $body;
    }
462685
protected function validValue(Entity $entity)
    {
        foreach ($entity->getFields() as $field => $detail) {
            $value = $entity[$field];

            // Convert value type
            if ($value instanceof \DateTimeInterface) {
                $value = $value->format($this->db->getDateFormat());
            }

            if ($value instanceof JsonSerializer) {
                $value = json_encode($value);
            }

            if (\is_object($value) && \is_callable([$value, '__toString'])) {
                $value = (string) $value;
            }

            // Start prepare default value
            if (is_array($value) || is_object($value)) {
                $value = null;
            }

            if ($value === null) {
                // This field is null and the db column is not nullable, use db default value.
                if (strtolower($detail->Null) === 'no') {
                    $entity[$field] = $detail->Default;
                }
            } else {
                // Convert to correct type.
                $dataType = DataType::getInstance($this->db->getName());

                $type = explode(' ', $detail->Type)[0];
                $type = explode('(', $type)[0];

                settype($value, $dataType::getPhpType($type));

                $entity[$field] = $value;
            }
        }

        return $entity;
    }
137459
private function getEntityIdentifierValue($entity)
    {
        $entityMetaData = $this->entityManager->getEntityMetadataRegister()->getEntityMetadata($entity);

        return $entityMetaData ? $entityMetaData->getIdentifierValue() : null;
    }
377106
public int getColorByLayer( DwgObject entity ) {
        int colorByLayer = 0;
        int layer = entity.getLayerHandle();
        for( int j = 0; j < layerTable.size(); j++ ) {
            Vector layerTableRecord = (Vector) layerTable.get(j);
            int lHandle = ((Integer) layerTableRecord.get(0)).intValue();
            if (lHandle == layer) {
                colorByLayer = ((Integer) layerTableRecord.get(2)).intValue();
            }
        }
        return colorByLayer;
    }
1039695
public static function getEntity(\Twizo\Api\AbstractEntity $entity)
    {
        $result = '';
        $values = self::getEntityValues($entity);

        $result .= str_repeat('-', strlen(get_class($entity)) + 4) . PHP_EOL;
        $result .= '| ' . get_class($entity) . ' |' . PHP_EOL;
        $result .= str_repeat('-', strlen(get_class($entity)) + 4) . PHP_EOL;

        foreach ($values as $method => $value) {
            $result .= substr($method, 3) . ' : ' . var_export($value, true) . PHP_EOL;
        }

        return $result;
    }
722926
protected function getDefaultOperations(EntityInterface $entity) {
    $operations = [];
    if ($entity->access('update') && $entity->hasLinkTemplate('edit-form')) {
      $operations['edit'] = [
        'title' => $this->t('Edit'),
        'weight' => 10,
        'url' => $entity->urlInfo('edit-form'),
      ];
    }
    if ($entity->access('delete') && $entity->hasLinkTemplate('delete-form')) {
      $operations['delete'] = [
        'title' => $this->t('Delete'),
        'weight' => 100,
        'url' => $entity->urlInfo('delete-form'),
      ];
    }

    return $operations;
  }
799198
private function getOriginalEntityData($entity)
    {
        $class = $this->em->getClassMetadata(\get_class($entity));
        $data = $this->uow->getOriginalEntityData($entity);
        if ($class->isVersioned) {
            $versionField = $class->versionField;
            $data[$versionField] = $class->reflFields[$versionField]->getValue($entity);
        }

        return $data;
    }
447124
public function getId(&$entity)
    {
        $structure = $this->getEntityStructure($entity);

        if (isset($entity->{$structure->primaryColumn->propertyName})) {
            return $entity->{$structure->primaryColumn->propertyName};
        }
        return null; // @codeCoverageIgnore
    }
682431
protected function _getTitle($entity)
    {
        $title = $entity->page_title;
        if ((bool)$entity->display_page_title_suffix) {
            $title .= WasabiCms::titleSuffix();
        }
        return $title;
    }
523286
public function transform($entity) {
    if ($entity === NULL) {
      return NULL;
    }

    $getter = 'get'.ucfirst($this->identifierName);

    return array(
      '__class' => $this->entityClass, // just for verbose
      $this->identifierName => $entity->$getter()
    );
  }
163178
protected function _getEntityName($entity = '') {
        /** @var $class \Gcs\Framework\Core\Orm\Entity\Entity */

        $entity = ucfirst(preg_replace_callback("/(?:^|_)([a-z])/", function ($matches) {
            return strtoupper($matches[1]);
        }, $entity));

        $className = '\Orm\Entity\\' . ucfirst($entity);

        if (class_exists($className)) {
            return $entity;
        }
        else {
            throw new MissingEntityException('The Entity ' . $entity . ' does not exist');
        }
    }
216641
public function getAdminForEntity($entity): Admin
    {
        $default = null;
        foreach ($this->adminRegistry->getAdmins() as $admin) {
            if (is_a($entity, $admin->getEntity())) {
                if ($entity instanceof DataInterface) {
                    $default = $default ?: $admin;
                    /** @var array $families */
                    $families = $admin->getOption('families', []);
                    foreach ($families as $family => $config) {
                        if ($entity->getFamilyCode() === $family) {
                            return $admin;
                        }
                    }
                } else {
                    return $admin;
                }
            }
        }

        if ($default) {
            // Or throw exception anyway ?
            return $default;
        }
        $class = \get_class($entity);
        throw new \UnexpectedValueException("No admin matching for entity {$class}");
    }
973503
public function getSingleIdentifierValue($entity)
    {
        $class     = $this->em->getClassMetadata(get_class($entity));
        $persister = $this->getEntityPersister($class->getClassName());

        if ($class->isIdentifierComposite()) {
            throw ORMInvalidArgumentException::invalidCompositeIdentifier();
        }

        $values = $this->isInIdentityMap($entity)
            ? $this->getEntityIdentifier($entity)
            : $persister->getIdentifier($entity);

        return $values[$class->identifier[0]] ?? null;
    }
183064
public function getEventNamePrefix($entity)
    {
        if (is_object($entity)) {
            $eventPrefix = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', get_class($entity)).'.');
        } else {
            $eventPrefix = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', $entity).'.');
        }
        if ($entity instanceof \Doctrine\ORM\Proxy\Proxy) {
            $prefix = str_replace(NAMESPACE_SEPARATOR, '.', $this->application->getEntityManager()->getConfiguration()->getProxyNamespace());
            $prefix .= '.'.$entity::MARKER.'.';

            $eventPrefix = str_replace(strtolower($prefix), '', $eventPrefix);
        }

        $eventPrefix = str_replace(array('backbee.', 'classcontent.'), array('', ''), $eventPrefix);

        return $eventPrefix;
    }
427174
private function getFieldValue($entity, \ReflectionProperty $reflectionProperty)
    {
        $value = null;
        if ($reflectionProperty) {
            $reflectionProperty->setAccessible(true);
            $value = $reflectionProperty->getValue($entity);
        }

        return $value;
    }