I'm using the JMSSerializerBundle to serialize my entity. but I have the following problem: the attribute name is "className" but in my Json object I get a "class_name".
this is my entity:
/**
* Events
*
* @ORM\Table()
* @ORM\Entity
*/
class Events
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
...
/**
* @var string
*
* @ORM\Column(name="className", type="string", length=255)
*/
private $className;
/**
* Set className
*
* @param string $className
* @return Events
*/
public function setClassName($className)
{
$this->className = $className;
return $this;
}
/**
* Get className
*
* @return string
*/
public function getClassName()
{
return $this->className;
}
...
}
this is my controller
class myController extends Controller{
public function loadAction($action){
$request=$this->get('request');
if($request->isXmlHttpRequest())
{
switch( $action ) {
case 'load':
$resultat=$this->getDoctrine()->getManager()->getRepository('ECMUserBundle:Events')
->findAll();
$serializer = $this->get('jms_serializer');
$resultat=$serializer->serialize($resultat, 'json');
echo $resultat;
exit();
break;
...
and this my Json
[{"id":90,"title":"holliday","start":"2014-03-25T01:00:00+0000","end":"2014-03-25T01:00:00+0000","class_name":"label-orange","allday":"true"}]
is this the logical behaviors?