/**
  * Setting model definition 
  *
  * @param array $definition 
  * @param string $connection 
  * @return afResponse
  * @author Sergey Startsev
  */
 public function setModelDefinition($model_name, $definition, $connection = 'propel')
 {
     $response = afResponseHelper::create();
     if (!is_array($definition)) {
         return $response->success(false)->message('Definition contains wrong structure');
     }
     $schema_file = $this->getSchemaFile();
     $table_name = $this->getTableNameByModel($model_name);
     $definition_model_name = array_key_exists('_attributes', $definition) && array_key_exists('phpName', $definition['_attributes']) ? $definition['_attributes']['phpName'] : $model_name;
     if (!array_key_exists($model_name, $this->propelSchemaArray[$schema_file]['classes'])) {
         return $response->success(false)->message("Model '{$model_name}' doesn't exists");
     }
     if (!array_key_exists($table_name, $this->originalSchemaArray[$schema_file][$connection])) {
         return $response->success(false)->message("Table '{$table_name}' doesn't exists");
     }
     if (($test_table_name = $this->getTableNameByModel($definition_model_name)) && $test_table_name != $table_name) {
         return $response->success(false)->message("Model '{$definition_model_name}' from definition already exists in schema and not belongs current table");
     }
     $this->originalSchemaArray[$schema_file][$connection][$table_name] = $definition;
     $this->saveSchema();
     afStudioModelCommandHelper::deploy();
     afStudioConsole::getInstance()->execute('sf afs:fix-perms');
     return $response->success(true);
 }
 /**
  * Update schemas command
  *
  * @return afResponse
  * @author Sergey Startsev
  */
 protected function processUpdateSchemas()
 {
     return afResponseHelper::create()->success(true)->console(afStudioModelCommandHelper::updateSchemas());
 }