I´m using an object, and writing in a array inside other object. The problem is, when i have more than 1 call to object input without renew, even using an array inside the object who is inheriting the object, it just maintein the last value i insert inside it.
Code: Select all
private input = array();
public function setInput($input) {
$this->input[] = $input;
}
Code: Select all
$input = new input();
$form->setInput($input->getArraySelect('cliente', $clientes, $cliente, $erro['cliente']));
$form->setInput($input->getArraySelect('evento', $eventos, $evento, $erro['evento']));evento
evento
I need the output like this.
cliente
evento
I already know how it works ok, if i use the code below, but i do not want to create hundreds of times the object input.
Code: Select all
$input = new input();
$form->setInput($input->getArraySelect('cliente', $clientes, $cliente, $erro['cliente']));
$input = new input();
$form->setInput($input->getArraySelect('evento', $eventos, $evento, $erro['evento']));
Code: Select all
class object () {
//this function might receive a new object
function setObject($object) {
if (is_object($input) && $this != $input) {
$this = $input;
}
}
Code: Select all
$form->setInput(new input()->getArraySelect('cliente', $clientes, $cliente, $erro['cliente']));
$form->setInput(new input()->getArraySelect('evento', $eventos, $evento, $erro['evento']));
If anyone of you guys have a good recomendation of php opp lecture, i would be glad 2
Thanx 4 ur attention.