Esempio n. 1
0
 /**
  * Assign a template selection to the store
  *
  * @param StoreInterface $store Store
  *
  * @return Response Response
  *
  * @Route(
  *      path = "/assign/{hash}",
  *      name = "admin_template_assign",
  *      methods = {"POST"}
  * )
  *
  * @EntityAnnotation(
  *      class = {
  *          "factory" = "elcodi.wrapper.store",
  *          "method" = "get",
  *          "static" = false
  *      },
  *      name = "store"
  * )
  * @JsonResponse()
  */
 public function assignAction(StoreInterface $store, $hash)
 {
     /**
      * @var Plugin $plugin
      */
     $plugin = $this->get('elcodi.repository.plugin')->findOneBy(['hash' => $hash, 'type' => PluginTypes::TYPE_TEMPLATE]);
     $store->setTemplate($plugin->getHash());
     $this->get('elcodi.object_manager.store')->flush($store);
     return ['status' => 200, 'message' => 'ok'];
 }