I have a method that build a Child Object list for each parent Object.Here is my code:
class Element{
function getChilList($child){
Element parentDataObject[];
if(count($this->parentDataObject)>0)
foreach ($this->parentDataObject as $c){
$this->parentDataObject[] = $c;
$this->TryAddAsSubProject($c);
}
}
}
based on that list, i have to display all parent with their child in the View But i was confused that, on which Layer of MVC (Model/View/Controller) to put this code so the parent View Layer can easily get all Child List.And another thing is that if i need a List child of in each parent class of same type, then is it violating the property of MVC pattern? that is please suggest correct one.Thanks
This class should reside in a the business layer. Another option is putting this code in a Data Access Layer (DAL) and then call it from the business layer to get the data and do further processing if necessary. Eventually the business layer code will be called from the controller.