Defines the entity mapper

@param MapperDefinition $map

@return void
331594
protected function define(MapperDefinition $map)
    {
        $map->type(AnalyticsDriverConfig::class);
        $map->toTable('analytics');

        $map->idToPrimaryKey('id');

        $map->property(AnalyticsDriverConfig::DRIVER_NAME)->to('driver')->asVarchar(255);
        $map->property(AnalyticsDriverConfig::OPTIONS)
            ->mappedVia(function (FormObject $options) : string {
                $values            = $this->transformFilesToArrays($options->unprocess($options->getInitialValues()));
                $values['__class'] = get_class($options);

                return json_encode($values);
            }, function (string $json) : FormObject {
                $values = $this->restoreFilesFromStrings(json_decode($json, true));

                return $values['__class']::build(array_diff_key($values, ['__class' => true]));
            })
            ->to('options')
            ->asText();
    }
605405
public function persist(PersistenceContext $context, ParentChildrenMap $map)
    {
        if ($map->hasAnyParentsWithPrimaryKeys()) {
            $this->mode->syncInvalidatedRelationsQuery(
                $context,
                $this->childrenTable,
                $this->foreignKeyToParent,
                $this->getInvalidatedRelationExpr($map)
            );
        }

        $this->insertRelated($context, $map);
    }
344157
private function setDefaults(Map $map)
    {
        foreach ($this->getParsedData() as $name => $value) {
            if (in_array($name, $this->defaults)) {
                $map->$name($value);
            }
        }
    }
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()
            )
        );
    }
495736
protected function define(MapperDefinition $map)
    {
        $map->type(DateTime::class);

        $map->property(DateTime::DATE_TIME)->to($this->columnName)->asDateTime();
    }
958714
protected function define(MapperDefinition $map)
    {
        $map->type(BlogArticle::class);

        $map->toTable('articles');

        $map->idToPrimaryKey('id');

        $map->column($map->getOrm()->getNamespace() . 'author_id')->asUnsignedInt();
        $map->relation(BlogArticle::AUTHOR)
            ->to(BlogAuthor::class)
            ->manyToOne()
            ->withBidirectionalRelation(BlogAuthor::ARTICLES)
            ->withRelatedIdAs($map->getOrm()->getNamespace() . 'author_id');

        $map->column($map->getOrm()->getNamespace() . 'category_id')->nullable()->asUnsignedInt();
        $map->relation(BlogArticle::CATEGORY)
            ->to(BlogCategory::class)
            ->manyToOne()
            ->withBidirectionalRelation(BlogCategory::ARTICLES)
            ->withRelatedIdAs($map->getOrm()->getNamespace() . 'category_id');

        $map->relation(BlogArticle::COMMENTS)
            ->to(BlogArticleComment::class)
            ->toMany()
            ->identifying()
            ->withBidirectionalRelation(BlogArticleComment::ARTICLE)
            ->orderByDesc('posted_at')
            ->withParentIdAs($map->getOrm()->getNamespace() . 'article_id');

        $map->property(BlogArticle::TITLE)->to('title')->asVarchar(255);

        $map->property(BlogArticle::SUB_TITLE)->to('sub_title')->asVarchar(255);

        $map->property(BlogArticle::SLUG)->to('slug')->unique()->asVarchar(255);

        $map->property(BlogArticle::EXTRACT)->to('extract')->asText();

        $map->embedded(BlogArticle::FEATURED_IMAGE)
            ->withIssetColumn('featured_image')
            ->using(new ImageMapper('featured_image', 'featured_image_file_name', $this->blogConfiguration->getFeaturedImagePath()));

        $map->embedded(BlogArticle::DATE)->using(new DateMapper('date'));

        $map->embedded(BlogArticle::ARTICLE_CONTENT)->withIssetColumn('article_content')->using(HtmlMapper::withLongText('article_content'));

        $map->property(BlogArticle::ALLOW_SHARING)->to('allow_sharing')->asBool();

        $map->property(BlogArticle::ALLOW_COMMENTING)->to('allow_commenting')->asBool();

        $map->property(BlogArticle::PUBLISHED)->to('published')->asBool();

        $map->embedded(BlogArticle::CREATED_AT)->using(new DateTimeMapper('created_at'));

        $map->embedded(BlogArticle::UPDATED_AT)->using(new DateTimeMapper('updated_at'));

        MetadataMapper::mapMetadataToJsonColumn($map, 'metadata');
    }
568412
public function setDiscriminatorMap(array $map)
    {
        foreach ($map as $value => $className) {
            $this->discriminatorMap[$value] = $className;
            if ($this->name == $className) {
                $this->discriminatorValue = $value;
            } else {
                if (!class_exists($className)) {
                    throw MappingException::invalidClassInDiscriminatorMap($className, $this->name);
                }
                if (is_subclass_of($className, $this->name)) {
                    $this->subClassNames[] = $className;
                }
            }
        }
    }
1315225
private function registerLocator(
        ContainerBuilder $container,
        EntityMapping $entityMapping
    ) {
        /**
         * Locator.
         */
        $locatorId = 'simple_doctrine_mapping.locator.' . $entityMapping->getUniqueIdentifier();
        $locator = new Definition('Mmoreram\SimpleDoctrineMapping\Locator\SimpleDoctrineMappingLocator');
        $locator->setPublic(false);
        $locator->setArguments([
            $entityMapping->getEntityNamespace(),
            [$entityMapping->getEntityMappingFilePath()],
        ]);
        $locator->setConfigurator([
            new Reference('simple_doctrine_mapping.locator_configurator'),
            'configure',
        ]);
        $container->setDefinition($locatorId, $locator);
    }
398735
public function mapper($entity, $entityMap = null)
    {
        if ($entity instanceof Wrapper) {
            throw new MappingException('Tried to instantiate mapper on wrapped Entity');
        }

        $entity = $this->resolveEntityClass($entity);

        $entity = $this->getInverseMorphMap($entity);

        // Return existing mapper instance if exists.
        if (array_key_exists($entity, $this->mappers)) {
            return $this->mappers[$entity];
        } else {
            return $this->buildMapper($entity, $entityMap);
        }
    }
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);
    }
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'));
    }
13276
protected function define(MapperDefinition $map)
    {
        $map->type(BlogArticleComment::class);

        $map->toTable('article_comments');

        $map->idToPrimaryKey('id');

        $map->column($map->getOrm()->getNamespace() . 'article_id')->asUnsignedInt();
        $map->relation(BlogArticleComment::ARTICLE)
            ->to(BlogArticle::class)
            ->manyToOne()
            ->withBidirectionalRelation(BlogArticle::COMMENTS)
            ->withRelatedIdAs($map->getOrm()->getNamespace() . 'article_id');

        $map->property(BlogArticleComment::AUTHOR_NAME)->to('author_name')->asVarchar(255);

        $map->embedded(BlogArticleComment::AUTHOR_EMAIL)
            ->using(new EmailAddressMapper('author_email'));

        $map->property(BlogArticleComment::CONTENT)->to('content')->asText();

        $map->embedded(BlogArticleComment::POSTED_AT)
            ->using(new DateTimeMapper('posted_at'));

        MetadataMapper::mapMetadataToJsonColumn($map, 'metadata');
    }
1075909
public function reset(PluginManager $pluginManager, Map $map)
    {
        $title = $this->gameDataStorage->getTitle();
        $mode = $this->gameDataStorage->getGameModeCode();
        $script = strtolower($this->gameDataStorage->getGameInfos()->scriptName);
        $this->enabledProviderListeners = [];

        foreach ($this->providersByCompatibility as $provider => $data) {

            $providerId = $this->getCompatibleProviderId($provider, $title, $mode, $script, $map);

            if ($providerId) {
                $providerService = $this->container->get($providerId);
                if ($pluginManager->isPluginEnabled($providerId)) {

                    foreach ($this->providerListeners[$providerId] as $listener) {
                        $this->enabledProviderListeners[$listener->getEventName()][] = [
                            $providerService,
                            $listener->getMethod(),
                        ];
                    }
                }
            }
        }
    }
936682
protected function defineEntity(ClassDefinition $class)
    {
        $class->property($this->driverName)->asString();

        $class->property($this->options)->asObject(FormObject::class);
    }
157978
public function persist(PersistenceContext $context, ParentChildMap $map)
    {
        /** @var Row[] $parentRows */
        $parentRows = [];
        /** @var object[] $children */
        $children = [];

        foreach ($map->getItems() as $key => $item) {
            $parentRow = $item->getParent();

            $hasChild = (bool)$item->getChild();
            if ($hasChild) {
                $parentRows[$key] = $parentRow;
                $children[$key]   = $item->getChild();
            }

            if ($this->objectIssetColumnName && !$this->isWithinValueObject) {
                $parentRow->setColumn($this->objectIssetColumnName, $hasChild);
            }
        }

        $this->disableLazyLoadingForRelations(function () use ($context, $children, $parentRows) {
            $this->mapper->persistAllToRows($context, $children, $parentRows);
        });
    }
913659
protected function defineEntity(ClassDefinition $class)
    {
        $class->property($this->name)->asString();

        $class->property($this->slug)->asString();

        $class->property($this->articles)->asType(BlogArticle::collectionType());

        $class->property($this->published)->asBool();

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

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

        $this->defineMetadata($class);
    }
95869
protected function define(MapperDefinition $map)
    {
        $map->type(Date::class);

        $map->property(Date::DATE_TIME)->to($this->columnName)->asDate();
    }