I have a one-to-many relationship `Cart-SendingMethod`. I would like to set a default `SendingMethod` for new `Carts`. So I have tried this: 

```
<?php
/**
* @ORM\ManyToOne(targetEntity="MetodoEnvio", inversedBy="metodoEnvios")
* @ORM\JoinColumn(name="metodo_envio_id", referencedColumnName="id")
**/
private $metodoEnvio = 1;

```

but doesn't work... I get: 

```
Impossible to access an attribute ("id") on a integer variable ("1") when I call Cart.SendingMethod.id from a view file

```

So how to set a default `SendingMethod` for new `Products`?

I could do it in the controller, but I would like to know if it is possible from the entity `Product`.

Note: I didn't know exactly if this is a symfony or doctrine question.