This topic contains 0 replies, has 1 voice, and was last updated by thomasEpsi 9 years, 8 months ago.
- Topic
Hello everyone ,
I don’t understand why the annotation do nothing on my GET REST API. I have the JMS Serializer in vendor with all the class.. but when i call my webservice, there are all my properties which appears.. Whereas i did an @ExlusionPolicy(“all”) and just @Expose on the ID property..
This is my Entity Product :
<?php
namespace GroupeGC\Bundle\ProductBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Jms\Serializer\Annotation as JMS;/**
* Product
*
* @ORM\Table(name=”gc_product”)
* @ORM\Entity
* @JMS\ExclusionPolicy(“all”)
*
*/
class Product
{
/**
* @var integer
*
* @ORM\Column(name=”id”, type=”integer”)
* @ORM\Id
* @ORM\GeneratedValue(strategy=”IDENTITY”)
* @JMS\Type(“integer”)
* @JMS\Expose
*/
private $id;/**
* @var string
*
* @ORM\Column(name=”code”, type=”string”, length=255, nullable=false)
*/
private $code;/**
* @var string
*
* @ORM\Column(name=”label”, type=”string”, length=255, nullable=true)
*
*/
private $label;/**
* @var float
* @ORM\Column(name=”volume”, type=”float”)
*
*/
private $volume;/**
* @var float
* @ORM\Column(name=”weight”, type=”float”)
*/
private $weight;
/**
* Get id
*
* @return integer
*/
public function getId()
{return $this->id;
}/**
* Set code
*
* @param string $code
* @return Product
*/
public function setCode($code)
{
$this->code = $code;return $this;
}/**
* Get code
*
* @return string
*/
public function getCode()
{
return $this->code;
}/**
* Set label
*
* @param string $label
* @return Product
*/
public function setLabel($label)
{
$this->label = $label;return $this;
}/**
* Get label
*
* @return string
*/
public function getLabel()
{
return $this->label;
}public function getVolume() {
return $this->volume;
}public function setVolume($volume) {
$this->volume = $volume;
return $this;
}public function getWeight() {
return $this->weight;
}public function setWeight($weight) {
$this->weight = $weight;
return $this;
}But we can see that , normaly, i just should have the id propertie which should appear in my JSON , whereas i have all propertie.. and i don’t understand.
I did clear:cache each time before testing…
Try with @JMS\AccessType(“public_method”) and it’s the same result ..
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.