APP design issues - extends problems

Hi to all. This is my problem i hope someone will help :slight_smile:

I have class A that extends class B. Class B is ORM for database i can’t change it, i can’t touch it in anyway. when i construct class A it gives me object for specific table. I want all my classes that extends class B to have preInsert() kind of a method that will do preInsert or preSave things.

let’s say this way

$objA = new A();
$objA->record_a = 45;
$objA->Save();

Class a will intercept Save execute my defined preSave() method (‘for all classes’) and then call parent::Save()

I can’t do multiple extends and this is issue because i don’t want to make this changes into any class that i will create.

Pls if someone knows how to resolve this issue. Grazie :slight_smile:

One way is to put a class in between this two classes that will extend ORM and add new methods…