I have the following trait:
trait ARCacheableTrait
{
public function instantiate() {
// this will need to call some ActiveRecord methods using parent::
}
}
It's purpose is to override the instantiate
method of ActiveRecord
classes. What is the proper way to ensure that it's applied only over such classes? I'd want to throw an exception if someone tries to add it to classes that are not or do not extend ActiveRecord
or even better, ensure type safety by throwing a compile time error...