0
對不起,我可憐的英語順便說一句,這不是我母親的舌頭。日期時間與JSON格式API
所以我對syfmony 3中創建使用FOSRestBundle的API: 這一個:
public function getHoraireAction(){
$Horaire = $this->getDoctrine()->getRepository('CBMedBundle:Horaire')- >findAll();
if(!$Horaire){
throw $this->createNotFoundException();
}
return $Horaire;
}
實體Horaire.php與JMSSerializer
<?php
namespace CBMedBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\VirtualProperty;
/**
* Horaire
*
* @ORM\Table(name="horaire")
* @ORM\Entity(repositoryClass="CBMedBundle\Repository\HoraireRepository")
*
* @ExclusionPolicy("all")
*/
class Horaire
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var time
*
* @ORM\Column(name="Debut", type="time", length=10)
* @Expose
*/
private $debut;
/**
* @var time
*
* @ORM\Column(name="EntreeSalle", type="time", length=10)
* @Expose
*/
private $entreeSalle;
/**
* @var time
*
* @ORM\Column(name="HeureAnesthesie", type="time", length=10)
* @Expose
*/
private $heureAnesthesie;
/**
* @var time
*
* @ORM\Column(name="Operation", type="time", length=10)
* @Expose
*/
private $operation;
/**
* @var time
*
* @ORM\Column(name="incision", type="time", length=10)
* @Expose
*/
private $incision;
/**
* @var time
*
* @ORM\Column(name="finOpe", type="time", length=10)
* @Expose
*/
private $finOpe;
/**
* @var time
*
* @ORM\Column(name="Reveil", type="time", length=10)
* @Expose
*/
private $reveil;
/**
* @var time
*
* @ORM\Column(name="Sortie", type="time", length=10)
* @Expose
*/
private $sortie;
/**
* @ORM\OneToOne(targetEntity="CBMedBundle\Entity\Interventions", cascade= {"persist"})
* @Expose
*/
private $Interventions;
etc..
一切工作,但似乎API做不返回具有「時間」類型的字段的真實值。
Horaire.php date time datas on mysql
這是我所得到的,當我測試API(使用後男人)
如何解決這個問題吧。
謝謝