Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change base class attribute visibility #82

Closed
bruno-rodrigues opened this issue Sep 8, 2016 · 2 comments
Closed

Change base class attribute visibility #82

bruno-rodrigues opened this issue Sep 8, 2016 · 2 comments

Comments

@bruno-rodrigues
Copy link

Is there any particular reason for the private Base classes' attributes?

I am trying to overwrite createItemBase from Aimeos\MShop\Customer\Manager\Base to create an extended version of Customer's Item class.

protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() )
    {
        if( !isset( $this->addressManager ) ) {
            $this->addressManager = $this->getSubManager( 'address' );
        }

        $helper = $this->getPasswordHelper();
        $address = $this->addressManager->createItem();

        return new \Aimeos\MShop\Customer\Item\Standard( $address, $values, $listItems, $refItems, $this->salt, $helper );
    }

To create a new Item I'll need to access $this->salt, which is private.

Can we just change the visibility to protected? This way I would not need to "recalculate" the salt value in my extended class.

@aimeos
Copy link
Owner

aimeos commented Sep 8, 2016

"salt" is unused and deprecated. It will be removed in the next months. You can simply pass "null" in your class.

We don't use protected variables in Aimeos for better encapsulation and to avoid them being part of the interface, so they cannot be changed any more without breaking the class interfaces. There are only a few places where we thought we need them to be protected, but we regret that decisions sooner or later.

@aimeos
Copy link
Owner

aimeos commented Dec 15, 2016

The "salt" parameter has been removed now. Will be part of the 2017.01 release

@aimeos aimeos closed this as completed Dec 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants