@param string $name
@param string $class

@return DenormalizationFieldMappingBuilderInterface
491974
public static function createEmbedMany(string $name, string $class): DenormalizationFieldMappingBuilderInterface
    {
        $self = new self($name);
        $self->fieldDenormalizer = new EmbedManyFieldDenormalizer($class, new PropertyAccessor($name));

        return $self;
    }
1317348
public function setRepositoryClass($name, $class)
  {
    if (!class_exists($class) || !in_array('SQRT\DB\Repository', class_parents($class))) {
      Exception::ThrowError(Exception::NOT_REPOSITORY, $class);
    }

    $this->repositories[strtolower($name)] = $class;

    return $this;
  }
925024
public function registerFormatter($name, $class)
    {
        $name = strtolower(is_array($name) ? implode('-', $name) : $name);
        if (array_key_exists($name, static::$formatters)) {
            throw new \RuntimeException(sprintf('Formatter %s already registered.', $class));
        }
        static::$formatters[$name] = $class;

        return $this;
    }
1211439
public function addCustomField($name, $class)
    {
        if ($this->rebuilding && $this->formHelper->hasCustomField($name)) {
            return $this;
        }

        $this->formHelper->addCustomField($name, $class);
    }
442286
protected function findMapInNamespace($class, $namespace)
    {
        $parts = explode('\\', $class);

        $baseClass = $parts[count($parts) - 1];

        $expectedClass = $namespace.$baseClass.'Map';

        if (class_exists($expectedClass)) {
            return new $expectedClass();
        }

        return false;
    }
543179
public function createResource($class, $name)
    {
        $entity = new $class();

        if ($entity instanceof AbstractResource) {
            $entity->setName($name);

            return $entity;
        }

        throw new WrongClassException(
            "{$class} doesn't extend Claroline\\CoreBundle\\Entity\\Resource\\AbstractResource."
        );
    }
163988
public function getObjectMapping(string $class): NormalizationObjectMappingInterface
    {
        $reflectionClass = new \ReflectionClass($class);

        if (in_array('Doctrine\Common\Persistence\Proxy', $reflectionClass->getInterfaceNames(), true)) {
            $class = $reflectionClass->getParentClass()->name;
        }

        if (isset($this->objectMappings[$class])) {
            return $this->objectMappings[$class];
        }

        throw SerializerLogicException::createMissingMapping($class);
    }
1284677
public static function load($name, $class=null) {
		$descriptorPath = ENTITY_DESCRIPTOR_CONFIG_PATH.$name;
		$cache = new FSCache(self::DESCRIPTORCLASS, $name, filemtime(YAML::getFilePath($descriptorPath)));
		
		// Comment when editing class and entity field types
		$descriptor	= null;
		try {
			if( !defined('ENTITY_ALWAYS_RELOAD')
					&& $cache->get($descriptor)
					&& isset($descriptor->version)
					&& $descriptor->version==self::VERSION ) {
				return $descriptor;
			}
		} catch( Exception $e ) {
			// If file is corrupted (version mismatch ?)
			$cache->reset();
		}
		// Unable to get from cache, building new one
		
		$conf = YAML::build($descriptorPath, true);
		if( empty($conf->fields) ) {
			throw new \Exception('Descriptor file for "'.$name.'" is corrupted, empty or not found, there is no field.');
		}
		// Build descriptor
		//    Parse Config file
		//      Fields
		$fields	= array();
		if( !empty($conf->parent) ) {
			if( !is_array($conf->parent) ) {
				$conf->parent = array($conf->parent);
			}
			foreach( $conf->parent as $p ) {
				$p	= static::load($p);
				if( !empty($p) ) {
					$fields	= array_merge($fields, $p->getFields());
				}
			}
		}
		$IDField = $class ? $class::getIDField() : self::IDFIELD;
		$fields[$IDField] = FieldDescriptor::buildIDField($IDField);
		foreach( $conf->fields as $fieldName => $fieldInfos ) {
			$fields[$fieldName]	= FieldDescriptor::parseType($fieldName, $fieldInfos);
		}

		//      Indexes
		$indexes = array();
		if( !empty($conf->indexes) ) {
			foreach( $conf->indexes as $index ) {
				$iType		= static::parseType(null, $index);
				$indexes[]	= (object) array('name'=>$iType->default, 'type'=>strtoupper($iType->type), 'fields'=>$iType->args);
			}
		}
		//    Save cache output
		$descriptor	= new EntityDescriptor($name, $fields, $indexes, $class);
		if( !empty($conf->flags) ) {
			if( in_array(self::FLAG_ABSTRACT, $conf->flags) ) {
				$descriptor->setAbstract(true);
			}
		}
// 		debug('Entity load('.$name.')', $fields);
		$cache->set($descriptor);
		return $descriptor;
	}
923543
public function run($name, $class)
    {
        if(in_array(HasChildren::class, class_uses_recursive($class, 'tree'))){
            $data = $class::tree()->get();
        }else{
            $data = $class::all();
        }

        $class_name = class_basename($class);

        return view('admin::widgets.menu_setting', compact('data', 'name', 'class_name', 'class'));
    }
455054
public static function createDateTime(string $name, string $format = 'c'): NormalizationFieldMappingBuilderInterface
    {
        $self = new self($name);
        $self->fieldNormalizer = new DateTimeFieldNormalizer(new PropertyAccessor($name), $format);

        return $self;
    }
67656
public static function createReferenceMany(
        string $name,
        callable $repository
    ): DenormalizationFieldMappingBuilderInterface {
        $self = new self($name);
        $self->fieldDenormalizer = new ReferenceManyFieldDenormalizer($repository, new PropertyAccessor($name));

        return $self;
    }
1278281
public function denormalize($data, $class, $format = null, array $context = [])
    {
        /** @var \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $denormalized */
        $denormalized = parent::denormalize($data, $class, $format, $context);

        $this->fixTimeZoneOnDenormalization($data, $denormalized, $denormalized->getRatePlan()->getPackage()->getOrganization()->getTimezone());

        return $denormalized;
    }
1339548
public function denormalize($data, $class, $format = null, array $context = [])
    {
        // Avoid issues with proxies if we populated the object
        if (isset($data['@id']) && !isset($context['object_to_populate'])) {
            if (isset($context['api_allow_update']) && true !== $context['api_allow_update']) {
                throw new InvalidArgumentException('Update is not allowed for this operation.');
            }

            $context['object_to_populate'] = $this->iriConverter->getItemFromIri(
                $data['@id'],
                $context + ['fetch_data' => true]
            );
        }

        return parent::denormalize($data, $class, $format, $context);
    }
708711
public function map($name, $class = null)
    {
        if (is_array($name)) {
            foreach ($name as $name => $class) {
                $this->map($name, $class);
            }

            return $this;
        }

        $this->builder->addDiscriminatorMapClass($name, $class);

        return $this;
    }
481212
public function getField($name)
    {
        if ($this->has($name)) {
            return $this->fields[$name];
        }

        throw new \InvalidArgumentException(
            'Field with name ['. $name .'] does not exist in class '.get_class($this)
        );
    }
961053
protected function denormalizeCollection($collection, $class, $name, $format = null, array $context = array())
    {
        /** @var ClassMetadata $meta */
        $meta = $context['entityMeta'];

        $targetEntity = $meta->associationMappings[$name]['targetEntity'];

        $result = array();
        foreach ($collection as $key => $element) {
            $class = $class ?: $targetEntity;

            $result[$key] = $this->denormalizeAssociation($element, $class, $name, $format, $context);
        }

        return $result;
    }
619752
private function createMap(string $class, $object)
    {
        $rule = $this->rules[$class];
        $reflectionObject = new \ReflectionObject($object);
        $result = [];

        foreach ($rule->getMap() as $property => $key) {
            $reflectionProperty = $reflectionObject->getProperty($property);
            $reflectionProperty->setAccessible(true);

            $serializer = $rule->getSerializer($property);

            $result[$key] = is_callable($serializer)
                ? $serializer($reflectionProperty->getValue($object))
                : $reflectionProperty->getValue($object);
        }

        return $result;
    }