Hi I have the following class
namespace MP\User\RegistrationBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Persistence\PersistentObject;
use MP\Services\SiteAdapterBundle\Util\String;
/**
* @ORM\Table(name="customer")
* @ORM\Entity(repositoryClass="MP\User\RegistrationBundle\Repositories\CustomerRepository")
* @ORM\HasLifecycleCallbacks
*/
class Customer extends PersistentObject
{
/**
* @var string $id
* @ORM\Id
* @ORM\Column(name="icustomer_id", type="integer")
*/
protected $id;
/**
* @var string $addresses
* @ORM\OneToMany(targetEntity="MP\User\RegistrationBundle\Entity\Address", mappedBy="customer", cascade={"remove"})
*/
protected $addresses;
With the following relationship
/**
* MP\User\RegistrationBundle\Entity
*/
namespace MP\User\RegistrationBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Persistence\PersistentObject;
/**
* @ORM\Table(name="custdeladd")
* @ORM\Entity(repositoryClass="MP\User\RegistrationBundle\Repositories\AddressRepository")
*/
class Address extends PersistentObject
{
/**
* @var integer $suffix
* @ORM\Column(name="isuffix", type="integer")
* @ORM\Id
*/
protected $suffix;
/**
* @var object $customer
* @ORM\ManyToOne(targetEntity="MP\User\RegistrationBundle\Entity\Customer", inversedBy="addresses", cascade={"persist"})
* @ORM\JoinColumn(name="icustomer_id", referencedColumnName="icustomer_id")
*/
protected $customer;
}
Does anybody know why when the customer gets deleted the addresses aren't? Many thanks