mercredi 28 juin 2017

hashow to persist query result between objects in php

in my case , i have query result came from database :

the result is a array,

i want to pass result in multiple object and get result .

i try to use mediator pattern but it wont work in my case , because i need to get result from first object and pass theme to second and so on .

code:

$mediator->add('test',[$obj1,'methodobj1']);
$mediator->add('test',[$obj2,'methodobj2']);
$mediator->run('test','resultCameFromDataBase(array)');

is there any advice ? should i use mediator ?

i know out there has many tools like doctrine2 , but in my case i cant use theme .

Aucun commentaire:

Enregistrer un commentaire