7
I have 2 objects with different values, but when I save it saved as a single object.
Example of how I’m using:
class Objeto {
private $Nome;
public function setNome($Nome){
$this->Nome = $Nome;
}
public function getNome(){
return $this->Nome;
}
}
$objet2 = $obj1 = new Objeto();
$obj1->setNome("Pedro");
$objet2->setNome("Marcos");
salvar($obj1);
salvar($objet2);
It saves as the registration id $obj1 but with $objet2 data.
What does that line mean ?
$objet2 = $obj1 = new Objeto();
.– Diego Souza
I believe the problem lies on this line:
$objet2 = $obj1 = new Objeto();
. You are creating an instance for two objects. I may be wrong...– Franchesco