Closed fprochazka closed 12 years ago
I was looking at the code of nette-addons and it isn't used anywhere. Do you really think this is a good idea? The generated query contains all the data twice, so I think something like this would be better:
public function createOrUpdate($uniqueKeys, $values)
{
if ($row = $this->findOneBy($uniqueKeys)) {
$row->update($values);
return $this->findOneBy($uniqueKeys);
} else {
return $this->create($uniqueKeys + $values);
}
}
It's quite handy sometimes ;) Anyways, It's just a suggestion, you can close this if you think you don't need it.
I implemented a combination of both solutions in d23bc23.
You may wanna add this method.