Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Extending model class with behaviors
  • Hi, I'd like to be able to extend Model class without sub classing it. Is it possible to do something like acts_as_tree in rails? I've found some solutions to emulate composition in PHP, but they're all hacky, as they depend on __call method. If it is not possible, can someone recommend the solution? I was thinking about special class variable like $_acts_as, or something similar that would take an array of extension classes. Then I'd create observer that would hook into Model's life cycle events to call appropriate methods in classes that are listed in the $_acts_as variable. Is there any downside to this solution?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!