public function findGoodsByTitleAjaxAction(Request $request, Application $app)
 {
     $title = $request->query->get('title');
     $goods = new Goods();
     $goods->setTitle($title);
     $result = $app['repository.goods']->findAllByTitle($goods);
     if ($result) {
         $data = array('result' => 1, 'data' => $result);
     } else {
         $data = array('result' => 0);
     }
     return JsonResponse::create($data);
 }
 protected function buildGoods($goodsData)
 {
     $goods = new Goods();
     $goods->setId($goodsData['id']);
     $goods->setTitle($goodsData['title']);
     $goods->setLink($goodsData['link']);
     $goods->setStatus($goodsData['status']);
     $goods->setIntro($goodsData['intro']);
     $goods->setGoodsClassId($goodsData['goodsClassId']);
     $goods->setCreatedTime($goodsData['createdTime']);
     $goods->setPassword($goodsData['password']);
     return $goods;
 }