For my service layer I would love to have just a $service->persist($object) where I do not bother whether this is persisted with an insert or update. I could accomplish this with an "INSERT <values> ON DUPLICATE KEY UPDATE" sql statement.
I searched through the docs, but couldn't find anything related to this. I can use raw sql, but I prefer the TableGateway pattern (especially when I can use a HydratingResultSet and ClassMethods hydrator). My service interface would then look very simple:
interface Service
{
public function find($id);
public function findAll();
public function findBy(Criteria $criteria);
public function persist($object);
public function remove($object);
}
I could split persist($object) into an insert() and update(), but I just wonder whether this is possible or not?
--
Jurian Sluiman