-2

I am using my own light weight MVC framework. I have a main model with two child classes, members_model and validation model.

Members_Model extends Model
Validation_Model extends Model

In the members_model I need to validate some data. How do I call a validation method from Members Model? Thanks for any help, I have searched and have no solution.

EDIT: TO make it more simple, I need Child A to play with Child B's toy.

tereško
  • 58,060
  • 25
  • 98
  • 150

2 Answers2

3

You'll need to instantiate a validation model and use its methods. But I think your design is flawed. See the question: How should a Model be constructed in MVC?

Community
  • 1
  • 1
Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
0

If I understood correctly you need to access a parent method http://php.net/manual/en/keyword.parent.php

then child A must instanciate a child B and access it`s method or make a static method in B so you do not need to instanciate B

ka_lin
  • 9,329
  • 6
  • 35
  • 56