@param string $entity

@return EntityStructure
507221
private function getMeta($entity)
    {
        $parts  = explode('\\', $entity);
        $entity = array_pop($parts);

        if ($entity[0] == '@') {
            // Indirect entity definition; skip
            return null;
        }

        if (!isset($this->entityDefinitions[$entity])) {
            // Unknown entity definition; skip
            return null;
        }

        return $this->entityDefinitions[$entity];
    }
31066
public function toArray($entity)
    {
        $firstTime = !$this->entitiesGraph ? true : false;

        if (!in_array(get_class($this), $this->entitiesGraph)) {
            $this->entitiesGraph[] = get_class($this);
        }

        $toArray  = [];
        $newArray = [];

        $refl = new \ReflectionClass($entity);
        foreach ($refl->getProperties() as $property) {
            $property->setAccessible(true);

            $value = $property->getValue($entity);

            if (array_key_exists($property->getName(), $this->propertiesToArrayCallbacks)) {
                $value = call_user_func_array($this->propertiesToArrayCallbacks[$property->getName()], [$value]);
            }

            if (!is_null($value)) {
                $toArray[$property->getName()] = $value;
            }
        }

        foreach ($toArray as $propertyName => $propertyValue) {

            // Simple mappings
            if (
                in_array($propertyName, $this->columnsToProperties) &&
                !array_key_exists($propertyName, $this->propertiesToMappers)
            ) {
                $columnName = array_search($propertyName, $this->columnsToProperties);

                $result = $this->createArrayFromColumnName($columnName, $propertyValue);
                $newArray = array_merge_recursive($newArray, $result);
                continue;
            }

            // Via Classes
            if (array_key_exists($propertyName, $this->propertiesToClasses) && is_object($propertyValue)) {
                $subMapper = $this->propertiesToClasses[$propertyName];
                $subMapper->setEntitiesGraph($this->entitiesGraph);
                $value    = $subMapper->toArray($propertyValue);
                $newArray = array_merge_recursive($newArray, $value);
                continue;
            }

            // via Mappers
            if (array_key_exists($propertyName, $this->propertiesToMappers)) {
                $className = $this->propertiesToMappers[$propertyName];

                if (in_array($className, $this->entitiesGraph)) {
                    continue;
                }

                /** @var DoplioDataMapper $subMapper */
                $subMapper = $this->resolver->resolve($className);
                $subMapper->setEntitiesGraph($this->entitiesGraph);

                if ($subMapper->toArrayResultCallback) {
                    $method        = $subMapper->toArrayResultCallback;
                    $propertyValue = $method($propertyValue);

                    foreach ($propertyValue as $offset => $item) {
                        $value = $subMapper->toArray(
                            $item
                        );
                        $newArray[array_search($propertyName, $this->columnsToProperties)][$offset] = $value;
                    }
                } else {
                    $value = $subMapper->toArray(
                        $propertyValue
                    );
                    $newArray[array_search($propertyName, $this->columnsToProperties)] = $value;
                }

                $this->entitiesGraph = array_merge($this->entitiesGraph, $subMapper->entitiesGraph);
            }
        }

        if ($this->fromClassname) {
            $method = $this->fromClassname;
            $data = $method(get_class($entity));
            $newArray = array_merge_recursive($newArray, $data);
        }


        if ($firstTime) {
            $this->entitiesGraph = [];
        }
        return $newArray;
    }
1154030
protected function BuildRequestData($entity)
    {
        if (is_a($entity, 'MangoPay\UboDeclaration')) {
            $declaredUboIds = [];
            foreach ($entity->DeclaredUBOs as $declaredUBO) {
                if (is_string($declaredUBO)) {
                    array_push($declaredUboIds, $declaredUBO);
                } else {
                    array_push($declaredUboIds, $declaredUBO->UserId);
                }
            }
            $entity->DeclaredUBOs = $declaredUboIds;
        }
        $entityProperties = get_object_vars($entity);
        $blackList = $entity->GetReadOnlyProperties();
        $requestData = array();
        foreach ($entityProperties as $propertyName => $propertyValue) {
            if (in_array($propertyName, $blackList)) {
                continue;
            }

            if ($this->CanReadSubRequestData($entity, $propertyName)) {
                $subRequestData = $this->BuildRequestData($propertyValue);
                foreach ($subRequestData as $key => $value) {
                    $requestData[$key] = $value;
                }
            } else {
                if (isset($propertyValue)) {
                    $requestData[$propertyName] = $propertyValue;
                }
            }
        }

        if (count($requestData) == 0) {
            return new \stdClass();
        }

        return $requestData;
    }
1372583
protected function generateBody(Entity $entity)
    {
        $descriptor = $entity->getDescriptor();
        $fields     = $descriptor->getFieldList() ?: [];
        $extLines   = $this->generateExtensionsSerializedSize($entity);

        $body[] = '$calculator = $context->getSizeCalculator();';
        $body[] = '$size       = 0;';
        $body[] = null;

        foreach ($fields as $field) {
            $lines = $this->generateFieldCondition($entity, $field);
            $body  = array_merge($body, $lines, [null]);
        }

        $body   = array_merge($body, $extLines);
        $body[] = null;
        $body[] = 'return $size;';

        return $body;
    }
467947
public function serialize($entity)
    {
        return array($this->getName().'.'.$this->_parent_key => $entity->get($this->_parent_key));
    }
331148
public function getSortableGroupsFieldByEntity($entity)
    {
        if (is_object($entity)) {
            $entity = ClassUtils::getClass($entity);
        }

        $groups = [];
        if (isset($this->sortableGroups['entities'][$entity])) {
            $groups = $this->sortableGroups['entities'][$entity];
        }

        return $groups;
    }
1049834
public function findByEntityInstance($entity)
    {
        $businessEntity = null;
        $class = new \ReflectionClass($entity);
        while (!$businessEntity && $class && $class->name !== null) {
            $businessEntity = $this->findByEntityClassname($class->name);
            $class = $class->getParentClass();
        }

        return $businessEntity;
    }
1115507
public function getSection($entity)
    {
        if (!$this->hasSection($entity)) {
            throw new ConfigurationException(sprintf('Section for entity "%s" does not exist.', $entity));
        }

        return $this->sectionByEntities[$entity];
    }
1088521
public function mapToAbstractEntity($entity)
    {
        $entityStack = new \SplStack();

        $this->mapXMLElementToEntity($this->xml, $entity, $entityStack);
    }
1218255
public function serialize($entity)
    {
        if (!is_null($entity) && is_scalar($entity)) {
            throw new AnException($this->getName().' be an instnaceof '.$this->getParent());
        }

        $data = array();

        $data[(string) $this->_child_column] = $entity ? $entity->get($this->_parent_key) : null;

        if ($this->_polymorphic) {
            if ($entity instanceof AnMixinAbstract) {
                $entity = $entity->getMixer();
            }

            $data[(string) $this->_type_column] = $entity ? (string) $entity->getEntityDescription()->getInheritanceColumnValue()->getIdentifier() : null;
        }

        return $data;
    }
108150
public function mergeEntity($entity) {
		ArgUtils::assertTrue(is_object($entity));
		
		$objHash = spl_object_hash($entity);
		if (isset($this->mergedEntity[$objHash])) {
			return $this->mergedEntity[$objHash];
		}
		
		$em = $this->actionQueue->getEntityManager();
		$persistenceContext = $em->getPersistenceContext();
		
		if ($entity instanceof EntityProxy 
				&& !$persistenceContext->getEntityProxyManager()->isProxyInitialized($entity)) {
			return $this->mergedEntity[$objHash] = $entity;
		}
		
		$entityInfo = $em->getPersistenceContext()->getEntityInfo(
				$entity, $em->getEntityModelManager());
		
		$this->mergedEntity[$objHash] = $mergedEntity = $this->createMergedEntity($entityInfo, $entity);
		
		$this->mergeProperties($entityInfo->getEntityModel(), $entity, $mergedEntity);
		
		return $mergedEntity;
	}
1324713
public function path($entity) {
		extract($this->_config);

		$data = [];
		while ($entity->data($parent) !== null) {
			$data[] = $entity;
			$entity = $this->_getById($entity->$parent);
		}
		$data[] = $entity;
		$data = array_reverse($data);
		$model = $entity->model();
		return $model::create($data, [
			'exists' => true,
			'class' => 'set'
		]);
	}
630801
private function getEntityEncryptedReflectionProperties($entity)
    {
        return DoctrineHelper::getPropertiesByAnnotation($this->getClassName($entity), Encrypted::class, $this->getReader());
    }
924539
public function getRepository($entity)
    {
        $annotation = $this->getClassAnnotation($entity, self::DOCUMENT_CLASS);

        if ($annotation instanceof Document) {
            return $annotation->repository;
        }

        return '';
    }
92069
private static function makeObject($entity)
    {
        $methodsGet = get_class_methods($entity);
        $methodsGet = array_filter($methodsGet, function($value) {
            return (bool) preg_match('/^get.*$/', $value);
        });
        $std = new \stdClass();
        foreach ($methodsGet as $attribute) {
            $name = str_replace('get', '', $attribute);
            $name = lcfirst($name);
            $std->$name = $entity->$attribute();
        }
        return $std;
    }
1259787
public function getOriginal($entity)
    {
        $entities = $this->flatten();
        foreach ($entities as $existing) {
            if (
                $existing->getName() == $entity->getName() &&
                $existing->getGrouping() == $entity->getGrouping() &&
                $existing->getFieldname() == $entity->getFieldname() &&
                (!$existing->getBlock() || $existing->getBlock() == $entity->getBlock())
            ) {
                return $existing;
            }
        }

        return $entity;
    }
922807
public function all($entity)
    {
        $reflectionClass = new \ReflectionClass($entity);
        $properties = $reflectionClass->getProperties();

        $class = new \ReflectionClass($entity);

        while ($parent = $class->getParentClass()) {
            $parentProperties = $parent->getProperties();
            $properties = array_merge($parentProperties, $properties);
            $class = $parent;
        }

        $return = array();
        foreach ($properties as $reflectionProperty) {
            $propertyAnnotation = $this->reader->getPropertyAnnotation($reflectionProperty, $this->annotationClass);
            if (!is_null($propertyAnnotation) && $propertyAnnotation->listable) {
                $return[] = array(
                    'property' => $reflectionProperty->name,
                    'type' => $propertyAnnotation->type
                );
            }
        }

        return $return;
    }