Skip to content

Conversation

@Chemaclass
Copy link
Member

Summary

This PR adds two new container configuration methods to GacelaConfig: addProtected() for registering protected services and addAlias() for creating service aliases.

Changes

  • Added GacelaConfig::addProtected() to register protected services (closures stored as-is without invocation)
  • Added GacelaConfig::addAlias() to create service aliases for backward compatibility or alternative naming

Motivation

This PR exposes more of the underlying container's capabilities through GacelaConfig:

  • Protected services: Store callable configurations that shouldn't be auto-executed by the container, useful for lazy
    initialization and storing factory functions
  • Service aliases: Provide multiple names for the same service, enabling backward compatibility when renaming services or offering convenient short names

@Chemaclass Chemaclass self-assigned this Nov 10, 2025
@Chemaclass Chemaclass added the enhancement New feature or request label Nov 10, 2025
@Chemaclass Chemaclass marked this pull request as draft November 10, 2025 20:34
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

public function merge(SetupGacela $other): SetupGacela
{
$this->overrideResetInMemoryCache($other);
$this->overrideFileCacheSettings($other);
$this->mergeExternalServices($other);
$this->mergeProjectNamespaces($other);
$this->mergeConfigKeyValues($other);
$this->mergeEventDispatcher($other);
$this->mergeServicesToExtend($other);
$this->mergePlugins($other);
$this->mergeGacelaConfigsToExtend($other);

P1 Badge Merge protected services and aliases when combining setups

The SetupMerger::merge() implementation only copies cache flags, bindings, namespaces, config values, listeners, services-to-extend, plugins and configs-to-extend. The new GacelaConfig::addProtected() and addAlias() APIs populate $protectedServices and $aliases on SetupGacela, but those collections are never merged here. When the bootstrap setup is merged with the project setup (e.g. in GacelaConfigUsingGacelaPhpFileFactory::createGacelaFileConfig()), any protected services or aliases defined in gacela.php are silently discarded, so Container::withConfig() never registers them unless the application bootstraps purely from a callback. Consider merging these arrays in SetupMerger (similar to mergeServicesToExtend()) to ensure the new configuration options survive setup merging.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Chemaclass Chemaclass marked this pull request as ready for review November 10, 2025 20:56
@Chemaclass Chemaclass merged commit 544d0e8 into main Nov 10, 2025
27 of 28 checks passed
@Chemaclass Chemaclass deleted the feat/gacela-config-improvemets-2 branch November 10, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants