public function update(Entity $entity)
 {
     $dbFile = $this->dao->open($this->dbName);
     $items = $dbFile->read();
     foreach ($items as $i => $currentItem) {
         if ($currentItem['id'] == $entity['id']) {
             $items[$i] = $this->dao->createItem($entity->toArray());
             $dbFile->write($items);
             return;
         }
     }
     throw new RuntimeException('Cannot find an entity with id "' . $entity['id'] . '"');
 }
Esempio n. 2
0
 public function __construct($data = array())
 {
     parent::__construct($data);
     //Generate the process key
     $this->key = sha1(mt_rand() + microtime() . '$8e&8.)9{[]|aEQ');
 }