/**
  * Creates a scheduling in the database.
  *
  * @return Response
  */
 public function create()
 {
     $request = $this->request;
     $scheduling = new Product();
     $scheduling->assign(['end_period' => $request->get('end_period', 'string'), 'period_type_id' => $request->get('period_type_id', 'strint')]);
     return $this->response($request, $scheduling, true);
 }
 /**
  * @title("Create")
  * @description("Create a new product")
  * @response("Product object or Error object")
  * @requestExample({
  *      "title": "Title",
  *      "brand": "Brand name",
  *      "color": "green",
  *      "createdAt": "1427646703000",
  *      "updatedAt": "1427646703000"
  * })
  * @responseExample({
  *     "product": {
  *         "id": 144,
  *         "title": "Title",
  *         "brand": "Brand name",
  *         "color": "green",
  *         "createdAt": "1427646703000",
  *         "updatedAt": "1427646703000"
  *     }
  * })
  */
 public function create()
 {
     $data = $this->request->getJsonRawBody();
     $product = new Product();
     $product->assign((array) $data);
     if (!$product->save()) {
         throw new UserException(ErrorCodes::DATA_FAIL, 'Could not create product.');
     }
     return $this->respondItem($product, new ProductTransformer(), 'product');
 }