-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
  • 57,247
  • 24
  • 95
  • 149

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
  • 165,920
  • 50
  • 255
  • 304
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,066
  • 6
  • 34
  • 52