I have an Entity with an attribute defined as following:
/**
* @var integer
*
* @ORM\Column(name="weight", type="integer")
*/
private $weight;
I was trying to solve a bug and used var_dump() to have some clue of what was happening...
The response was:
string '20' (length=2)
I don't understand why $weight is returning as string... shouldn't it be an integer?
int 20
Or should I handle it in my business logic?
Edit (how I called var_dump()):
I have a class named "Calculator" that iterates $items and use the $weight attribute. Is something like this:
Controller:
$calculator->calculate($category->getItems());
Calculator:
foreach($items as $item) {
//logic...
var_dump($item->getWeight());
}
Edit (database column schema):
Here is the field in database:
weight int(11)