I’m creating a behavior (one template and one listener). In the template class, I’m using the addListener() method to attach the listener to the model.
// Inside the template's setTableDefinition() method
$this->addListener(new RemoraSaveListener);
Pretty standard stuff, it seems.
From within the listener, how to I access the template options that have been set using the model’s actAs() method? You know, the ones that automatically occupy the _options property of the template object.
Your template class should have a
protected $_options = array()property.Pass this property to your listener, like so:
In your listener class you should also have a
protected $_optionsproperty.Add this to your listener:
You should now be able to access the options from within your listener class (e.x from within a
preSavecall).