Skip to content

Make all methods protected, not private #72

Description

@manticorp

Hi there,

I've been using your deployer for a while now and its fantastic - but it would be great to make all of the methods in the DefaultDeployer protected instead of private - that way we can easily override them if we need to.

For example, I was having trouble with the doResetOpCache function.

Inserting a 1 second sleep between writing the file and wgetting the file has solved this problem, but I cannot override the class method!

Thanks!

Activity

  1. daFish commented on Jul 24, 2018

    @daFish
    Contributor

    You can implement your own deployer class by extending EasyCorp\Bundle\EasyDeployBundle\Deployer\AbstractDeployer. This way you have complete control over each method you need to customize.

  2. manticorp commented on Jul 24, 2018

    @manticorp
    Author

    While that's true, if I only want to change one method from the DefaultDeployer, then why rewrite the whole class?

    What's the reason for wanting to keep the methods private?

    The DefaultDeployer has a load of useful methods and it would be great to keep them.

  3. daFish commented on Jul 25, 2018

    @daFish
    Contributor

    The reason is the "open-closed-principle" which states that classes should be open for extension but closed for modification.

    To make this happen more extension points are needed. Unless they are provided, you have limited options:

    • implement your own deployer class
    • fork this repo, modify it to your use, and you it
      Opting for the latter would also mean more maintenance at your side.
  4. maxkain commented on May 30, 2022

    @maxkain

    The reason is the "open-closed-principle" which states that classes should be open for extension but closed for modification.

    To make this happen more extension points are needed. Unless they are provided, you have limited options:

    * implement your own deployer class
    
    * fork this repo, modify it to your use, and you it
      Opting for the latter would also mean more maintenance at your side.
    

    The extension point is protected method. The original class is not modifying. The principle is not violated.
    Anyway, the application developer may decide how to do it by himself and the private method limits him. The bundle should give developer possibilities, but it should not dictate him how to write his code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions