GithubHelp home page GithubHelp logo

Comments (4)

lucatume avatar lucatume commented on August 16, 2024

Hi @netdust,

thanks for taking the time to open an issue.

Could you provide a minimal example to reproduce the issue?

from di52.

netdust avatar netdust commented on August 16, 2024
<?php

use lucatume\DI52\Container;

$container = new Container();

// Decorators are built left to right, outer decorators are listed first.
 $container->bindDecorators(PostEndpoint::class, [
		    LoggingEndpoint::class,
                    CachingEndpoint::class,
		    BaseEndpoint::class
	    ],
           ['add_actions']
 );

$container->get(PostEndpoint::class);

This should call the add_action method on LoggingEndpoint first, then from there all the way to BaseEndPoint. But instead it calls the method directly on BaseEndpoint, skipping the decorators.

from di52.

lucatume avatar lucatume commented on August 16, 2024

Thanks for providing an example.

Since we're talking about the decorator pattern here, the add_actions after-build method should be called on the outer decorator only; i.e. the LoggingEndpoint one.
It should be, then, up to the LoggingEndpoint to call CachingEndpoint::add_actions that should, in turn, call the BaseEndpoint::add_actions method.

I will look into this with this frame of mind: the add_actions method should be called after the PostEndpoint is built, whatever is the outer decorator.

from di52.

netdust avatar netdust commented on August 16, 2024

πŸ‘Œthx!

from di52.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.