Actually from the documentation it seems fk are supported starting sqlite 3 but it seems it is not the version used by doctrine... Le 18 déc. 2013 00:33, "Benjamin Eberlei" <[email protected]> a écrit :
> Sqlite doesnt have foreign keys. I think we emulate them using triggers > starting with Doctrine DBAL 2.4, but I am not sure anymore > > > On Tue, Dec 17, 2013 at 9:28 PM, Shadowalker <[email protected]>wrote: > >> Hi again, >> >> here's the configuration I have for my classes : >> >> class Collaborator { >> >> /** >> * >> * @var integer $_id >> * >> * @ORM\Column(name="id", type="integer") >> * @ORM\Id >> * @ORM\GeneratedValue(strategy="AUTO") >> */ >> private $_id; >> >> [...] >> } >> >> >> class Task { >> >> [...] >> /** >> * >> * @var Collaborator $_reporter >> * >> * >> @ORM\ManyToOne(targetEntity="Beamware\BeamwareEMS\ProjectManagerWsBundle\Dao\Model\Collaborator", >> cascade={"merge"}, fetch="EAGER") >> * @ORM\JoinColumn(name="reporter_id", referencedColumnName="id") >> */ >> private $_reporter; >> >> /** >> * >> * @var Collaborator $_assignee >> * >> * >> @ORM\ManyToOne(targetEntity="Beamware\BeamwareEMS\ProjectManagerWsBundle\Dao\Model\Collaborator", >> cascade={"merge"}, fetch="EAGER") >> * @ORM\JoinColumn(name="assignee_id", referencedColumnName="id") >> */ >> private $_assignee; >> >> [...] >> } >> >> >> The tables are correctly configured but I didn't include the related code. >> >> Now here's the delete function : >> >> $collaboratorDM = >> $this->_collaboratorRepository->getCollaborator($identifier); >> try { >> >> $this->_em->remove($collaboratorDM); >> $this->_em->flush(); >> } catch (\Exception $e) { >> >> $this->_logger->critical(__METHOD__.' :: DB Layer error >> while deleting Collaborator identified by '.$identifier.'.'); >> } >> } >> } >> >> (Note : I removed all non relevant code parts) >> >> Hope this will help understand what's going on. >> >> Thanks. >> >> Le lundi 9 décembre 2013 21:00:01 UTC+1, Shadowalker a écrit : >> >>> Hi, >>> >>> I'm trying to run some tests which involve deleting a user linked to >>> other entities from my sqlite memory based test database. >>> >>> And shockingly I can delete it as if it was not linked to anything. >>> >>> How come ? How can I prevent this behaviour (while staying on a slite >>> memory db) so that should I make a mistake in my tests, said tests would >>> fail ? >>> >>> Thanks. >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "doctrine-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/doctrine-user. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "doctrine-user" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/doctrine-user/ZD5QfCu1Dhg/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/groups/opt_out.
