Defines the entity mapper

@param MapperDefinition $map

@return void
547337
protected function define(MapperDefinition $map)
    {
        $map->type(Faq::class);
        $map->toTable('faqs');

        $map->idToPrimaryKey('id');

        $map->property(Faq::QUESTION)->to('question')->asVarchar(255);
        
        $map->embedded(Faq::ANSWER)
            ->using(new HtmlMapper('answer'));
        
        $map->property(Faq::ORDER_TO_DISPLAY)->to('order_to_display')->asInt();
        
        $map->embedded(Faq::UPDATED_AT)
            ->using(new DateTimeMapper('updated_at'));
        
        $map->embedded(Faq::CREATED_AT)
            ->using(new DateTimeMapper('created_at'));

        $map->hook()->saveOrderIndexTo('order_to_display');
    }
472480
public function set($key, $value)
    {
        if (! $value instanceof EntityMapperInterface) {
            throw new InvalidArgumentException(
                'Trying to add a non EntityMapper to MappersMap.'
            );
        }
        return parent::set($key, $value);
    }
194592
protected function createIdentifierCollectionRelationship($object, RelationshipDefinition $definition, MappingContext $context): IdentifierCollectionRelationship
    {
        $relationship = new IdentifierCollectionRelationship();
        $collection   = $object->{$definition->getGetter()}();
        $dataLimit    = $definition->getDataLimit();

        if ($dataLimit > 0) {
            $collection = new \LimitIterator($collection, 0, $dataLimit);
        }

        $mapper = $context->getMapper();

        foreach ($collection as $relatedObject)
        {
            $resource = $mapper->toResourceIdentifier($relatedObject);

            $relationship->addIdentifier($resource);
        }

        return $relationship;
    }
1062588
protected function mapFinalSelfRelation(IEntityMapper $mapper) : MemberMapping
    {
        return $this->mapFinalRelationToMapping(
            [],
            [],
            new ToOneRelation(
                self::SELF_RELATION_ID,
                new ToOneRelationObjectReference($mapper),
                $mapper->getDefinition()->getTable()->getPrimaryKeyColumnName(),
                new NonIdentifyingRelationMode()
            )
        );
    }
954944
public function setupMappingDefinition(MappingDefinition $md) {
		$md->getMappingResult()->setLabel($this->getPropertyName(), (string) $this->labelLstr);
	}
186634
protected function _validateAndCompleteManyToManyMapping(array $mapping)
    {
        $mapping = $this->_validateAndCompleteAssociationMapping($mapping);
        if ($mapping['isOwningSide']) {
            // owning side MUST have a join table
            if ( ! isset($mapping['joinTable']['name'])) {
                $mapping['joinTable']['name'] = $this->namingStrategy->joinTableName($mapping['sourceEntity'], $mapping['targetEntity'], $mapping['fieldName']);
            }

            $selfReferencingEntityWithoutJoinColumns = $mapping['sourceEntity'] == $mapping['targetEntity']
                && (! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));

            if ( ! isset($mapping['joinTable']['joinColumns'])) {
                $mapping['joinTable']['joinColumns'] = array(array(
                        'name' => $this->namingStrategy->joinKeyColumnName($mapping['sourceEntity'], $selfReferencingEntityWithoutJoinColumns ? 'source' : null),
                        'referencedColumnName' => $this->namingStrategy->referenceColumnName(),
                        'onDelete' => 'CASCADE'));
            }
            if ( ! isset($mapping['joinTable']['inverseJoinColumns'])) {
                $mapping['joinTable']['inverseJoinColumns'] = array(array(
                        'name' => $this->namingStrategy->joinKeyColumnName($mapping['targetEntity'], $selfReferencingEntityWithoutJoinColumns ? 'target' : null),
                        'referencedColumnName' => $this->namingStrategy->referenceColumnName(),
                        'onDelete' => 'CASCADE'));
            }

            $mapping['joinTableColumns'] = array();

            foreach ($mapping['joinTable']['joinColumns'] as &$joinColumn) {
                if (empty($joinColumn['name'])) {
                    $joinColumn['name'] = $this->namingStrategy->joinKeyColumnName($mapping['sourceEntity'], $joinColumn['referencedColumnName']);
                }

                if (empty($joinColumn['referencedColumnName'])) {
                    $joinColumn['referencedColumnName'] = $this->namingStrategy->referenceColumnName();
                }

                if ($joinColumn['name'][0] === '`') {
                    $joinColumn['name']   = trim($joinColumn['name'], '`');
                    $joinColumn['quoted'] = true;
                }

                if ($joinColumn['referencedColumnName'][0] === '`') {
                    $joinColumn['referencedColumnName'] = trim($joinColumn['referencedColumnName'], '`');
                    $joinColumn['quoted']               = true;
                }

                if (isset($joinColumn['onDelete']) && strtolower($joinColumn['onDelete']) == 'cascade') {
                    $mapping['isOnDeleteCascade'] = true;
                }

                $mapping['relationToSourceKeyColumns'][$joinColumn['name']] = $joinColumn['referencedColumnName'];
                $mapping['joinTableColumns'][] = $joinColumn['name'];
            }

            foreach ($mapping['joinTable']['inverseJoinColumns'] as &$inverseJoinColumn) {
                if (empty($inverseJoinColumn['name'])) {
                    $inverseJoinColumn['name'] = $this->namingStrategy->joinKeyColumnName($mapping['targetEntity'], $inverseJoinColumn['referencedColumnName']);
                }

                if (empty($inverseJoinColumn['referencedColumnName'])) {
                    $inverseJoinColumn['referencedColumnName'] = $this->namingStrategy->referenceColumnName();
                }

                if ($inverseJoinColumn['name'][0] === '`') {
                    $inverseJoinColumn['name']   = trim($inverseJoinColumn['name'], '`');
                    $inverseJoinColumn['quoted'] = true;
                }

                if ($inverseJoinColumn['referencedColumnName'][0] === '`') {
                    $inverseJoinColumn['referencedColumnName']  = trim($inverseJoinColumn['referencedColumnName'], '`');
                    $inverseJoinColumn['quoted']                = true;
                }

                if (isset($inverseJoinColumn['onDelete']) && strtolower($inverseJoinColumn['onDelete']) == 'cascade') {
                    $mapping['isOnDeleteCascade'] = true;
                }

                $mapping['relationToTargetKeyColumns'][$inverseJoinColumn['name']] = $inverseJoinColumn['referencedColumnName'];
                $mapping['joinTableColumns'][] = $inverseJoinColumn['name'];
            }
        }

        $mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;

        if (isset($mapping['orderBy'])) {
            if ( ! is_array($mapping['orderBy'])) {
                throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
            }
        }

        return $mapping;
    }
346447
public function setupMappingDefinition(\n2n\web\dispatch\map\bind\MappingDefinition $md) {
		$this->decorated->setupMappingDefinition($md);
	}
694624
protected function define(MapperDefinition $map)
    {
        $map->type(ContactEnquiry::class);
        $map->toTable('contact_enquiries');

        $map->idToPrimaryKey('id');

        $map->embedded(ContactEnquiry::EMAIL)->using(new EmailAddressMapper('email'));
        $map->property(ContactEnquiry::NAME)->to('name')->asVarchar(255);
        $map->property(ContactEnquiry::SUBJECT)->to('subject')->asVarchar(255);
        $map->property(ContactEnquiry::MESSAGE)->to('message')->asVarchar(8000);
        $map->embedded(ContactEnquiry::CREATED_AT)->using(new DateTimeMapper('created_at'));
    }
1171009
protected function define(MapperDefinition $map)
    {
        $map->type($this->enumClassName);

        $valueProperty = $map->property('value');

        if ($this->valueMap) {
            $valueProperty = $valueProperty
                ->mappedVia(
                    function ($phpValue) {
                        return $this->valueMap[$phpValue];
                    },
                    function ($dbValue) {
                        return $this->flippedValueMap[$dbValue];
                    }
                );
        }

        if ($this->nullable) {
            $valueProperty = $valueProperty->ignoreNullabilityTypeMismatch();
        }

        $valueProperty = $valueProperty->to($this->columnName);

        if ($this->nullable) {
            $valueProperty = $valueProperty->nullable();
        }

        if ($this->columnType) {
            $valueProperty->asType($this->columnType);
        } else {
            $valueProperty->asEnum($this->options);
        }
    }
703226
public function reset(Map $map)
    {
        $title = $this->gameDataStorage->getTitle();
        $mode = $this->gameDataStorage->getGameModeCode();
        $script = strtolower($this->gameDataStorage->getGameInfos()->scriptName);

        $this->enableDisablePlugins($title, $mode, $script, $map);
    }
159734
public function usingCustom(callable $mapperDefinitionCallback)
    {
        $this->defineRelation(function (IObjectMapper $parentMapper) use ($mapperDefinitionCallback) {
            return new CustomValueObjectMapper($this->orm, $parentMapper, $mapperDefinitionCallback);
        });
    }
786116
protected function registerSoftDelete(Mapper $mapper)
    {
        $entityMap = $mapper->getEntityMap();

        // Add Scopes
        $mapper->addGlobalScope(new SoftDeletingScope());

        // Register 'deleting' events
        $mapper->registerEvent('deleting', function ($event) use ($entityMap) {
            $entity = $event->entity;
            $wrappedEntity = $this->getMappable($entity);

            $deletedAtField = $entityMap->getQualifiedDeletedAtColumn();

            if (!is_null($wrappedEntity->getEntityAttribute($deletedAtField))) {
                return true;
            }

            $time = new Carbon();

            $wrappedEntity->setEntityAttribute($deletedAtField, $time);

            $plainObject = $wrappedEntity->getObject();
            $this->manager->mapper(get_class($plainObject))->store($plainObject);

            return false;
        });

        // Register RestoreCommand
        $mapper->addCustomCommand(Restore::class);
    }
1365805
protected function buildMapper($entity, $entityMap)
    {
        // If an EntityMap hasn't been manually registered by the user
        // register it at runtime.
        if (!$this->isRegisteredEntity($entity)) {
            $this->register($entity, $entityMap);
        }

        $entityMap = $this->entityClasses[$entity];

        $factory = new MapperFactory($this->drivers, $this->eventDispatcher, $this);

        $mapper = $factory->make($entity, $entityMap);

        $this->mappers[$entity] = $mapper;

        // At this point we can safely call the boot() method on the entityMap as
        // the mapper is now instantiated & registered within the manager.

        if (!$entityMap->isBooted()) {
            $entityMap->boot();
        }

        // If a cache is defined, use it to store the entityMap
        if ($this->cache !== null && !$this->cache->has($entityMap->getClass()) && !$this->isAnonymous($entityMap)) {
            $this->cache->set($entityMap->getClass(), serialize($entityMap), 1440);
        }

        return $mapper;
    }
991760
public function mapManyToMany(array $mapping)
    {
        $mapping['type'] = self::MANY_TO_MANY;
        $mapping = $this->_validateAndCompleteManyToManyMapping($mapping);
        $this->_storeAssociationMapping($mapping);
    }
161439
protected function define(MapperDefinition $map)
    {
        $map->type(ObjectMetadataKeyValuePair::class);

        $map->property(ObjectMetadataKeyValuePair::KEY)->to('key')->unique()->asVarchar(500);

        $map->property(ObjectMetadataKeyValuePair::VALUE)
            ->mappedVia(function ($value) {
                return json_encode($value);
            }, function (string $json) {
                return @json_decode($json, true);
            })
            ->to('value')
            ->asMediumText();
    }
1015013
public function encodeMap(Map $map, Encoder $encoder)
    {
        $output = $encoder->getOutput();
        $hash   = spl_object_hash($map);

        if (!isset($this->initialized[$hash])) {
            $output->prepend(
                sprintf(
                    '%s = L.map(%s);',
                    $encoder->encodeReference($map),
                    $encoder->encodeArguments(array($map->getElementId(), $map->getOptions()))
                )
            );

            $this->initialized[$hash] = true;
        } else {
            foreach ($map->getControls() as $control) {
                $encoder->encodeReference($control);
            }

            foreach ($map->getLayers() as $layer) {
                $encoder->encodeReference($layer);
            }

            $output->append($this->encodeMethodCalls($map->getMethodCalls(), $encoder));
        }
    }
921332
protected function defineEntity(ClassDefinition $class)
    {
        $class->property($this->namespace)->asString();

        $class->property($this->name)->asString();
        
        $class->property($this->orderIndex)->asInt();

        $class->property($this->htmlContentAreas)->asType(HtmlContentArea::collectionType());

        $class->property($this->imageContentAreas)->asType(ImageContentArea::collectionType());

        $class->property($this->textContentAreas)->asType(TextContentArea::collectionType());

        $class->property($this->fileContentAreas)->asType(FileContentArea::collectionType());

        $class->property($this->metadata)->asType(ContentMetadata::collectionType());

        $class->property($this->nestedArrayContentGroups)->asType(ContentGroup::collectionType());

        $class->property($this->updatedAt)->asObject(DateTime::class);
    }