Beispiel #1
0
 public function save(WSL_Model_File_File $file)
 {
     // Persistência de Informações
     $data = array('hash' => $file->getHash(), 'filename' => $file->getFileName(), 'container' => $file->getContainer(), 'category' => $file->getCategory(), 'reference' => $file->getReference(), 'order' => $file->getOrder());
     // Contabilizar Hashes
     $counter = $this->_count($data['hash']);
     // Identificador Informado?
     if ($file->getConfig()->hasParam('id')) {
         // Atualizar
         $this->getAdapter()->update('wsl_files', $data, array('id' => $file->getConfig()->getParam('id')));
     } else {
         // Inclusão
         $id = $this->getAdapter()->insert('wsl_files', $data);
         // Salvar Identificador
         $file->getConfig()->setParam('id', $id);
     }
     // Adicionar Elemento?
     return $counter == 0;
 }