Calling overridden method from within overriding method in OO PHP

Posted by paddymcc on Stack Overflow See other posts from Stack Overflow or by paddymcc
Published on 2010-04-09T10:47:54Z Indexed on 2010/04/10 14:23 UTC
Read the original article Hit count: 247

Filed under:
|
|
|

Working in a symfony model, I want to override a function and call the overridden function from within the overriding one, along the lines of

class MyClass extends BaseMyClass {

  function setMyProperty($p) {
    parent::setMyProperty($p);
    //do some other stuff
  }

}

This is resulting in a segmentation fault. I don't want to alter the parent class - it's been generated by symfony, and may feasibly be overwritten in the future if the model is rebuilt. This seems like something that should be straightforward, but I'm struggling to find the solution. Thanks for any advice

© Stack Overflow or respective owner

Related posts about php

Related posts about oop