Bravo3\Orm\Services\Io\Reader::getEntityClassName PHP Метод

getEntityClassName() публичный статический Метод

Get the true class name of the entity, resolving any proxy wrappers
public static getEntityClassName ( object | string $entity ) : string
$entity object | string
Результат string
    public static function getEntityClassName($entity)
    {
        if ($entity instanceof OrmProxyInterface) {
            return get_parent_class($entity);
        } elseif (is_object($entity)) {
            return get_class($entity);
        } elseif (is_string($entity)) {
            return $entity;
        } else {
            return null;
        }
    }

Usage Example

Пример #1
0
 /**
  * Get the metadata for an entity, including column information
  *
  * @param string|object $entity Entity or class name of the entity
  * @return Entity
  */
 public function getEntityMetadata($entity)
 {
     $class_name = Reader::getEntityClassName($entity);
     if (!isset($this->metadata_cache[$class_name])) {
         $parser = new AnnotationMetadataParser($class_name);
         $this->metadata_cache[$class_name] = $parser->getEntityMetadata();
     }
     return $this->metadata_cache[$class_name];
 }
All Usage Examples Of Bravo3\Orm\Services\Io\Reader::getEntityClassName