Bug #26957
Hooks in object getters become useless when all properties are protected
| Status: | New | Start date: | 2011-05-21 | |
|---|---|---|---|---|
| Priority: | Must have | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | Bug | Spent time: | - | |
| Target version: | 0.13.x | |||
| Votes: | 1 (View) |
Description
Hey there,
just updated to the latest SVN version and noticed that many properties are not set to protected. While this is nice in general, it prevents hooks from working. For example the "postpricenet" and "postpricegross" hooks in class.tx_commerce_article_price.php are now pretty useless, because you can't alter the price values anymore (f.e. to apply disconts). You even can't read the current price values from within the hooks because the only public method are the getters, which themselfes are triggering the hooks and you'll end up in a endless recursion.
So either refactor the hook implementations to allow for return values that'll override the current values, or set the according properties to public again. Thanks.
History
Updated by Franz Koch almost 2 years ago
Franz Koch wrote:
that many properties are not set to protected
Should read: "that many properties are NOW set to protected"
Updated by Tom Ruether almost 2 years ago
- File 26957.patch added
New getter for usage in Hooks.
Example:
public function postpricenet(tx_commerce_article_price &$pObj) {
$newPrice = $pObj->getPriceNetFromDatabase() + 1000;
$pObj->setPriceNet($newPrice);
}
Updated by Christian Kuhn almost 2 years ago
- Target version set to 0.13.x
Updated by Christoph Gross over 1 year ago
Same problem in class.tx_commerce_basic_basket.php. Causes paypal2commerce to crash on payment see http://forge.typo3.org/issues/32926