public function getData(Model $model)
 {
     return [$model->getModelName() => $model->getContent()];
 }
 /**
  * Esegue una patch del model nella base di dati
  * In base all' id fornendo la versione corretta
  *
  * @param Model $model
  * @return Boolean Il <b>boolean</b> in base alla avvenuta modifica
  * @throws GraphException
  * @internal param $ <b>Model</b> model da patchare [id e versione obbligatori]*
  * <b>Model</b> model da patchare [id e versione obbligatori]
  */
 public function patch(Model $model)
 {
     Log::debug('calling storage driver for patch');
     if ($model->getId() == null) {
         throw new GraphException('Unavailable ' . $model->getModelName() . ' id', ExceptionsCodes::BEAN_STORAGE_ID_UNAVAILABLE, 400);
     }
     if ($model->getVersion() == null) {
         throw new GraphException('Unavailable ' . $model->getModelName() . ' version', ExceptionsCodes::BEAN_STORAGE_VERSION_UNAVAILABLE, 400);
     }
     if (!$model->isValid()) {
         throw new GraphException('Error on storage, model is corrupt: ' . $model->getLastTestErrors(), ExceptionsCodes::BEAN_STORAGE_CORRUPTED_BEAN, 400);
     }
     $modelClass = get_class($model);
     $tModel = new $modelClass();
     $tModel->setContent(array('id' => $model->getId(), 'version' => $model->getVersion()));
     $readed = $this->read($tModel);
     if ($readed == null) {
         throw new GraphException($model->getModelName() . ' not found', ExceptionsCodes::BEAN_STORAGE_ID_NOT_FOUND);
     }
     if ($readed->getVersion() != $model->getVersion()) {
         throw new GraphException($model->getModelName() . ' version Mismatch, reload model for updates', ExceptionsCodes::BEAN_STORAGE_VERSION_MISMATCH, 400);
     }
     $mainCnt = $readed[0]->getContent();
     $patched = array_replace_recursive($mainCnt, $model->getContent());
     $model->setContent($patched);
     return $this->update($model);
 }