Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php DateTime序列化返回不正确的分钟SYMFONY 3_Php_Json_Datetime_Serialization_Symfony - Fatal编程技术网

Php DateTime序列化返回不正确的分钟SYMFONY 3

Php DateTime序列化返回不正确的分钟SYMFONY 3,php,json,datetime,serialization,symfony,Php,Json,Datetime,Serialization,Symfony,我有个问题(对不起,我的英语又不好了) 因此,我用JSON上的Symfony 3创建了一个API,它正在工作,但是日期时间数据没有正确返回 我的意思是,只有小时正确返回,但分钟不正确 这是我的实体Horaire.php <?php namespace CBMedBundle\Entity; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation\ExclusionPolicy; use JMS\Serializer\

我有个问题(对不起,我的英语又不好了)

因此,我用JSON上的Symfony 3创建了一个API,它正在工作,但是日期时间数据没有正确返回

我的意思是,只有小时正确返回,但分钟不正确

这是我的实体Horaire.php

<?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;
use JMS\Serializer\Annotation\Type;

/**
* 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)
 * @Type("DateTime<'h-m-s'>")
  * @Expose
 */
private $debut;

/**
 * @var time
 *
 * @ORM\Column(name="EntreeSalle", type="time", length=10)
 * @Type("DateTime<'h-m-s'>")
  * @Expose
 */
private $entreeSalle;

/**
 * @var time
 *
 * @ORM\Column(name="HeureAnesthesie", type="time", length=10)
 * @Type("DateTime<'h-m-s'>")
  * @Expose
 */
private $heureAnesthesie;

/**
 * @var time
 *
 * @ORM\Column(name="Operation", type="time", length=10)
 * @Type("DateTime<'h-m-s'>")
  * @Expose
 */
private $operation;

/**
 * @var time
 *
 * @ORM\Column(name="incision", type="time", length=10)
 * @Type("DateTime<'h-m-s'>")
  * @Expose
 */
private $incision;

/**
 * @var time
 *
 * @ORM\Column(name="finOpe", type="time", length=10)
 * @Type("DateTime<'h-m-s'>")
  * @Expose
 */
private $finOpe;

/**
 * @var time
 *
 * @ORM\Column(name="Reveil", type="time", length=10)
 * @Type("DateTime<'h-m-s'>")
  * @Expose
 */
private $reveil;

/**
 * @var time
 *
 * @ORM\Column(name="Sortie", type="time", length=10)
 * @Type("DateTime<'h-m-s'>")
  * @Expose
 */
private $sortie;

 /**
 * @ORM\OneToOne(targetEntity="CBMedBundle\Entity\Interventions", cascade=   {"persist"})
* @Expose
*/
private $Interventions;
//
etc....

请尝试此注释:

@Type("DateTime<'H:i:s'>")
@Type(“日期时间”)

请看那是什么节目。这是基于PHP日期时间格式。

格式不应该是小时分秒吗???你把年月日放在哪里,不懂法语…哦,真的很抱歉,是分钟,不是monthi编辑的我的帖子,但它仍然有问题谢谢,它有效!很高兴再次见到你,阿尔文·邦克先生!