Example #1
0
 protected function _delete(VO $vo)
 {
     if ($vo->getId()) {
         $id = (int) $vo->getId();
         if (array_key_exists($id, $this->objects)) {
             unset($this->objects[$id]);
         }
     }
     return true;
 }
Example #2
0
 protected function _delete(VO $vo)
 {
     if (!$this->memcached) {
         return true;
     }
     return $this->memcached->delete($this->getMemcachedCompleteKey($vo->getId()));
 }
Example #3
0
 protected function getDefaultMappings(\Berthe\VO $vo)
 {
     $properties = array_keys($vo->__toArray());
     $mappings = array_combine($properties, $properties);
     $transientFields = $this->transientFields;
     return array_filter($mappings, function ($value) use($transientFields) {
         return !($value == 'id' || $value == 'version' || in_array($value, $transientFields));
     });
 }
Example #4
0
 /**
  * @param VO $vo
  * @return boolean success
  */
 public final function save(VO $vo)
 {
     $ret = null;
     if ($vo->getId()) {
         $ret = $this->_update($vo);
     } else {
         $ret = $this->_insert($vo);
     }
     if ($ret !== false) {
         $ret = true;
     }
     return $ret;
 }