microservices-playground/api-comments

View on GitHub
app/config/services.yml

Summary

Maintainability
Test Coverage
parameters:
  avatar.default_avatar: "/assets/img/default_avatar.png"
  avatar.upload_path: "/uploads/avatars"

services:
  comments.listener.exception:
    class: Foodlove\AppBundle\Service\ExceptionHandler\ExceptionListener
    tags:
      - { name: kernel.event_listener, event: kernel.exception }
  comments.listener.timestampable:
    class: Gedmo\Timestampable\TimestampableListener
    tags:
      - { name: doctrine.event_subscriber, connection: default }

  comments.controller.list:
    class: Foodlove\AppBundle\Controller\Comments\ListController
    arguments:
      - "@comments.response.factory.dto"
      - "@comments.repository.comment"
      - "@comments.mapper.entity_to_dto.comment"
  comments.controller.create:
    class: Foodlove\AppBundle\Controller\Comments\CreateController
    arguments:
      - "@comments.dto.factory.comment"
      - "@comments.validator.handler.create_comment"
      - "@comments.crud_operations.comment.create"
      - "@comments.response.factory.dto"
  comments.controller.remove:
    class: Foodlove\AppBundle\Controller\Comments\RemoveController
    arguments:
      - "@comments.crud_operations.comment.delete"
      - "@comments.response.factory.no_content"

  comments.dto.factory.comment:
    class: Foodlove\AppBundle\Service\DtoFactory\CommentDtoFactory
    arguments:
      - "@serializer"

  comments.crud_operations.comment.create:
    class: Foodlove\AppBundle\Service\CrudOperations\Comment\CreateCommentHandler
    arguments:
      - "@comments.mapper.dto_to_entity.comment"
      - "@comments.repository.comment"
      - "@comments.event_dispatcher.rabbit_mq"
      - "@comments.mapper.entity_to_dto.comment"
  comments.crud_operations.comment.delete:
    class: Foodlove\AppBundle\Service\CrudOperations\Comment\DeleteCommentHandler
    arguments:
      - "@comments.repository.comment"

  comments.repository.comment:
    class: Foodlove\AppBundle\Repository\CommentRepository
    factory: ["@doctrine.orm.default_entity_manager", getRepository]
    arguments:
      - Foodlove\AppBundle\Entity\Comment
  comments.repository.mention:
    class: Foodlove\AppBundle\Repository\MentionRepository
    factory: ["@doctrine.orm.default_entity_manager", getRepository]
    arguments:
      - Foodlove\AppBundle\Entity\Mention
  comments.repository.author:
    class: Foodlove\AppBundle\Repository\AuthorRepository
    factory: ["@doctrine.orm.default_entity_manager", getRepository]
    arguments:
      - Foodlove\AppBundle\Entity\Author

  comments.mapper.entity_to_dto.comment:
    class: Foodlove\AppBundle\Mapper\EntityToDto\CommentMapper
    arguments:
      - "@comments.upload_path_resolver.avatar"

  comments.mapper.dto_to_entity.comment:
    class: Foodlove\AppBundle\Mapper\DtoToEntity\CommentMapper
    arguments:
      - "@comments.repository.author"
      - "@comments.mentions.resolver"

  comments.configuration_fetcher.local:
    class: Foodlove\AppBundle\Service\ConfigurationFetcher\LocalConfigurationFetcher
    calls:
      - [setParameterBag, ["@=service('service_container').getParameterBag()"]]

  comments.upload_path_resolver.avatar:
    class: Foodlove\AppBundle\Service\UploadPathResolver\Avatar\AvatarUploadPathResolver
    arguments:
      - "@comments.configuration_fetcher.local"

  comments.response.factory.dto:
    class: Foodlove\AppBundle\Service\ResponseFactory\DtoResponseFactory
    arguments:
      - "@serializer"
  comments.response.factory.no_content:
    class: Foodlove\AppBundle\Service\ResponseFactory\NoContentResponseFactory

  comments.serializer.yaml_config_loader:
    class: Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader
    arguments:
      - "%kernel.root_dir%/config/serializer.yml"
  comments.serializer.class_metadata_factory:
    class: Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
    arguments:
      - "@comments.serializer.yaml_config_loader"
  comments.serializer.object_normalizer:
    class: Symfony\Component\Serializer\Normalizer\ObjectNormalizer
    arguments:
      - "@comments.serializer.class_metadata_factory"
      - "@serializer.name_converter.camel_case_to_snake_case"
    tags:
      - { name: serializer.normalizer }

  comments.validator:
    class: Symfony\Component\Validator\Validator\ValidatorInterface
    factory: ["@comments.validator.builder", getValidator]
  comments.validator.builder:
    parent: validator.builder
    calls:
      - [addYamlMapping, ["%kernel.root_dir%/config/validation.yml"]]
  comments.validator.handler.create_comment:
    class: Foodlove\AppBundle\Service\Validator\Handler\CreateCommentHandler
    arguments:
      - "@comments.validator"

  comments.mentions.resolver:
    class: Foodlove\AppBundle\Service\MentionsHandler\MentionsResolver\TextToEntitiesMentionsResolver
    arguments:
      - "@comments.mentions.parser.at_character"
      - "@comments.mentions.fetcher.local_database"
      - "@comments.mentions.mapper.confirmed_mentions_dto_to_mentions_entity"
  comments.mentions.parser.at_character:
    class: Foodlove\AppBundle\Service\MentionsHandler\MentionsParser\AtCharacterMentionsParser
  comments.mentions.fetcher.local_database:
    class: Foodlove\AppBundle\Service\MentionsHandler\MentionsFetcher\LocalDatabaseMentionsFetcher
    arguments:
      - "@comments.repository.mention"
  comments.mentions.mapper.confirmed_mentions_dto_to_mentions_entity:
    class: Foodlove\AppBundle\Service\MentionsHandler\MentionsMapper\ConfirmedMentionsDtoToMentionsEntityMapper
    arguments:
      - "@comments.repository.mention"

  comments.event_dispatcher.rabbit_mq:
    class: Foodlove\AppBundle\Service\EventsHandler\EventDispatcher\RabbitMqSystemWideEventDispatcher
    arguments:
      - "@old_sound_rabbit_mq.activities_producer"