AnsweredAssumed Answered

Override Visibility Strategy while initializing Sugar Bean

Question asked by hats on Aug 17, 2017
Latest reply on Aug 21, 2017 by hats

Hello Folks,

 

I wanted to override visibility strategy defined in module bean class definition while initializing that bean.

For eg: I have a module called Test and I have defined following visibility in bean class.

class Test extends SugarBean

{

    public function __construct()

    {

         $this->addVisibilityStrategy("OwnerVisibility");

         parent::__construct();

    }

}

 

Now, while initializing bean, I wanted to override this strategy in some scenarios.

$testBean = BeanFactory::newBean("Test");

$testBean->addVisibilityStrategy("OwnerOrAdminVisibility");

 

But the above line is not working. I am not sure how to override the visibility already defined in bean definition.

Any help or idea would be greatly appreciated.

 

Regards.

Hats

Outcomes