| @@ 24-65 (lines=42) @@ | ||
| 21 | * | |
| 22 | * @author Beñat Espiña <[email protected]> | |
| 23 | */ | |
| 24 | class OverwriteFileCommandBuilder extends CommandBuilder | |
| 25 | { | |
| 26 | /** | |
| 27 |      * {@inheritdoc} | |
| 28 | */ | |
| 29 | public function register($file) | |
| 30 |     { | |
| 31 | $this->container->setDefinition( | |
| 32 | $this->definitionName($file), | |
| 33 | (new Definition( | |
| 34 | OverwriteFileHandler::class, [ | |
| 35 | $this->container->getDefinition( | |
| 36 | 'bengor.file.infrastructure.domain.model.' . $file . '_filesystem' | |
| 37 | ), | |
| 38 | $this->container->getDefinition( | |
| 39 | 'bengor.file.infrastructure.persistence.' . $file . '_repository' | |
| 40 | ), | |
| 41 | ] | |
| 42 | ))->addTag( | |
| 43 | 'bengor_file_' . $file . '_command_bus_handler', [ | |
| 44 | 'handles' => OverwriteFileCommand::class, | |
| 45 | ] | |
| 46 | ) | |
| 47 | ); | |
| 48 | } | |
| 49 | ||
| 50 | /** | |
| 51 |      * {@inheritdoc} | |
| 52 | */ | |
| 53 | protected function definitionName($file) | |
| 54 |     { | |
| 55 | return 'bengor.file.application.command.overwrite_' . $file; | |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 |      * {@inheritdoc} | |
| 60 | */ | |
| 61 | protected function aliasDefinitionName($file) | |
| 62 |     { | |
| 63 | return 'bengor_file.' . $file . '.overwrite'; | |
| 64 | } | |
| 65 | } | |
| 66 | ||
| @@ 24-65 (lines=42) @@ | ||
| 21 | * | |
| 22 | * @author Beñat Espiña <[email protected]> | |
| 23 | */ | |
| 24 | class RemoveFileCommandBuilder extends CommandBuilder | |
| 25 | { | |
| 26 | /** | |
| 27 |      * {@inheritdoc} | |
| 28 | */ | |
| 29 | public function register($file) | |
| 30 |     { | |
| 31 | $this->container->setDefinition( | |
| 32 | $this->definitionName($file), | |
| 33 | (new Definition( | |
| 34 | RemoveFileHandler::class, [ | |
| 35 | $this->container->getDefinition( | |
| 36 | 'bengor.file.infrastructure.domain.model.' . $file . '_filesystem' | |
| 37 | ), | |
| 38 | $this->container->getDefinition( | |
| 39 | 'bengor.file.infrastructure.persistence.' . $file . '_repository' | |
| 40 | ), | |
| 41 | ] | |
| 42 | ))->addTag( | |
| 43 | 'bengor_file_' . $file . '_command_bus_handler', [ | |
| 44 | 'handles' => RemoveFileCommand::class, | |
| 45 | ] | |
| 46 | ) | |
| 47 | ); | |
| 48 | } | |
| 49 | ||
| 50 | /** | |
| 51 |      * {@inheritdoc} | |
| 52 | */ | |
| 53 | protected function definitionName($file) | |
| 54 |     { | |
| 55 | return 'bengor.file.application.command.remove_' . $file; | |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 |      * {@inheritdoc} | |
| 60 | */ | |
| 61 | protected function aliasDefinitionName($file) | |
| 62 |     { | |
| 63 | return 'bengor_file.' . $file . '.remove'; | |
| 64 | } | |
| 65 | } | |
| 66 | ||
| @@ 24-65 (lines=42) @@ | ||
| 21 | * | |
| 22 | * @author Beñat Espiña <[email protected]> | |
| 23 | */ | |
| 24 | class RenameFileCommandBuilder extends CommandBuilder | |
| 25 | { | |
| 26 | /** | |
| 27 |      * {@inheritdoc} | |
| 28 | */ | |
| 29 | public function register($file) | |
| 30 |     { | |
| 31 | $this->container->setDefinition( | |
| 32 | $this->definitionName($file), | |
| 33 | (new Definition( | |
| 34 | RenameFileHandler::class, [ | |
| 35 | $this->container->getDefinition( | |
| 36 | 'bengor.file.infrastructure.domain.model.' . $file . '_filesystem' | |
| 37 | ), | |
| 38 | $this->container->getDefinition( | |
| 39 | 'bengor.file.infrastructure.persistence.' . $file . '_repository' | |
| 40 | ), | |
| 41 | ] | |
| 42 | ))->addTag( | |
| 43 | 'bengor_file_' . $file . '_command_bus_handler', [ | |
| 44 | 'handles' => RenameFileCommand::class, | |
| 45 | ] | |
| 46 | ) | |
| 47 | ); | |
| 48 | } | |
| 49 | ||
| 50 | /** | |
| 51 |      * {@inheritdoc} | |
| 52 | */ | |
| 53 | protected function definitionName($file) | |
| 54 |     { | |
| 55 | return 'bengor.file.application.command.rename_' . $file; | |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 |      * {@inheritdoc} | |
| 60 | */ | |
| 61 | protected function aliasDefinitionName($file) | |
| 62 |     { | |
| 63 | return 'bengor_file.' . $file . '.rename'; | |
| 64 | } | |
| 65 | } | |
| 66 | ||
| @@ 23-63 (lines=41) @@ | ||
| 20 | * | |
| 21 | * @author Beñat Espiña <[email protected]> | |
| 22 | */ | |
| 23 | class FileOfNameQueryBuilder extends QueryBuilder | |
| 24 | { | |
| 25 | /** | |
| 26 |      * {@inheritdoc} | |
| 27 | */ | |
| 28 | public function register($file) | |
| 29 |     { | |
| 30 | $this->container->setDefinition( | |
| 31 | $this->definitionName($file), | |
| 32 | new Definition( | |
| 33 | FileOfNameHandler::class, [ | |
| 34 | $this->container->getDefinition( | |
| 35 | 'bengor.file.infrastructure.persistence.' . $file . '_repository' | |
| 36 | ), | |
| 37 | $this->container->getDefinition( | |
| 38 | 'bengor.file.infrastructure.persistence.' . $file . '_specification_factory' | |
| 39 | ), | |
| 40 | $this->container->getDefinition( | |
| 41 | 'bengor.file.application.data_transformer.' . $file . '_dto' | |
| 42 | ), | |
| 43 | ] | |
| 44 | ) | |
| 45 | ); | |
| 46 | } | |
| 47 | ||
| 48 | /** | |
| 49 |      * {@inheritdoc} | |
| 50 | */ | |
| 51 | protected function definitionName($file) | |
| 52 |     { | |
| 53 | return 'bengor.file.application.query.' . $file . '_of_name'; | |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 |      * {@inheritdoc} | |
| 58 | */ | |
| 59 | protected function aliasDefinitionName($file) | |
| 60 |     { | |
| 61 | return 'bengor_file.' . $file . '.by_name_query'; | |
| 62 | } | |
| 63 | } | |
| 64 | ||
| @@ 23-63 (lines=41) @@ | ||
| 20 | * | |
| 21 | * @author Beñat Espiña <[email protected]> | |
| 22 | */ | |
| 23 | class FilterFilesQueryBuilder extends QueryBuilder | |
| 24 | { | |
| 25 | /** | |
| 26 |      * {@inheritdoc} | |
| 27 | */ | |
| 28 | public function register($file) | |
| 29 |     { | |
| 30 | $this->container->setDefinition( | |
| 31 | $this->definitionName($file), | |
| 32 | new Definition( | |
| 33 | FilterFilesHandler::class, [ | |
| 34 | $this->container->getDefinition( | |
| 35 | 'bengor.file.infrastructure.persistence.' . $file . '_repository' | |
| 36 | ), | |
| 37 | $this->container->getDefinition( | |
| 38 | 'bengor.file.infrastructure.persistence.' . $file . '_specification_factory' | |
| 39 | ), | |
| 40 | $this->container->getDefinition( | |
| 41 | 'bengor.file.application.data_transformer.' . $file . '_dto' | |
| 42 | ), | |
| 43 | ] | |
| 44 | ) | |
| 45 | ); | |
| 46 | } | |
| 47 | ||
| 48 | /** | |
| 49 |      * {@inheritdoc} | |
| 50 | */ | |
| 51 | protected function definitionName($file) | |
| 52 |     { | |
| 53 | return 'bengor.file.application.query.filter_' . $file . 's'; | |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 |      * {@inheritdoc} | |
| 58 | */ | |
| 59 | protected function aliasDefinitionName($file) | |
| 60 |     { | |
| 61 | return 'bengor_file.filter_' . $file . 's_query'; | |
| 62 | } | |
| 63 | } | |
| 64 | ||
| @@ 21-61 (lines=41) @@ | ||
| 18 | /** | |
| 19 | * @author Beñat Espiña <[email protected]> | |
| 20 | */ | |
| 21 | class ListFilesOfIdsQueryBuilder extends QueryBuilder | |
| 22 | { | |
| 23 | /** | |
| 24 |      * {@inheritdoc} | |
| 25 | */ | |
| 26 | public function register($file) | |
| 27 |     { | |
| 28 | $this->container->setDefinition( | |
| 29 | $this->definitionName($file), | |
| 30 | new Definition( | |
| 31 | ListFilesOfIdsHandler::class, [ | |
| 32 | $this->container->getDefinition( | |
| 33 | 'bengor.file.infrastructure.persistence.' . $file . '_repository' | |
| 34 | ), | |
| 35 | $this->container->getDefinition( | |
| 36 | 'bengor.file.infrastructure.persistence.' . $file . '_specification_factory' | |
| 37 | ), | |
| 38 | $this->container->getDefinition( | |
| 39 | 'bengor.file.application.data_transformer.' . $file . '_dto' | |
| 40 | ), | |
| 41 | ] | |
| 42 | ) | |
| 43 | ); | |
| 44 | } | |
| 45 | ||
| 46 | /** | |
| 47 |      * {@inheritdoc} | |
| 48 | */ | |
| 49 | protected function definitionName($file) | |
| 50 |     { | |
| 51 | return 'bengor.file.application.query.list_' . $file . 's_of_ids'; | |
| 52 | } | |
| 53 | ||
| 54 | /** | |
| 55 |      * {@inheritdoc} | |
| 56 | */ | |
| 57 | protected function aliasDefinitionName($file) | |
| 58 |     { | |
| 59 | return 'bengor_file.filter_' . $file . 's_of_ids_query'; | |
| 60 | } | |
| 61 | } | |
| 62 | ||