Google Groups

Re: [doctrine-user] getReference on Single Table Inheritance misbehaving


Victor Moura Jun 19, 2012 12:46 PM
Posted in group: doctrine-user
Marco,

I think i don't know how to achieve the same database structure that I have in my application generating it from doctrine.

I have something like this:

CREATE TABLE IF NOT EXISTS `status` (
  `id` int(11) unsigned NOT NULL,
  `type` varchar(200) NOT NULL,
  `description` varchar(200) NOT NULL,
  `abbrev` char(10) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`,`type`),
  UNIQUE KEY `unique_abbrev_type` (`type`,`abbrev`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

I can't imagine how to make the DiscriminatorColumn work like a PrimaryKey for doctrine.
As I use a database already created is there an way for this to work? If so, how should I proceed?

I don't generate those tables with doctrine..

On 19 June 2012 10:38, Marco Pivetta <ocra...@gmail.com> wrote:
Something like https://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php may fit your use case :) The structure of the test is something you can re-use.

To run it, simply write your (MyTicketId)Test and paste it into `tests/Doctrine/Tests/ORM/Functional/Ticket/` and if it fails then you already helped a lot :)


Marco Pivetta

http://twitter.com/Ocramius     

http://marco-pivetta.com    



On 19 June 2012 15:34, Victor Simonetti Moura <con...@victormoura.com> wrote:
Is there an guide to write a test case for Doctrine?


On 19 June 2012 10:30, Marco Pivetta <ocra...@gmail.com> wrote:
Sorry for answering this late.
Could you eventually convert this into a functional test case that runs against Doctrine's test suite and open an issue on http://www.doctrine-project.org/jira/ ?

Marco Pivetta

http://twitter.com/Ocramius     

http://marco-pivetta.com    



On 15 June 2012 19:36, Victor Simonetti Moura <con...@victormoura.com> wrote:
Hi Guys,

I'm trying to update an Entity with some reference data.
But the problem is that when I do the getReference I get a NULL value after another getReference (they must have the same ID);

The Entity is a SingleTable and both share the same parent.

My test case:

$em = $this->_service->getEntityManager();
$proxy1 = $em->getReference('\Autogen\Doctrine\Entity\EAV\ItemStatus', 1);
\Utils::dump($proxy1); // return reference
$proxy2 = $em->getReference('\Autogen\Doctrine\Entity\EAV\OrderStatus', 1);
\Utils::dump($proxy2); // return null

 And my primary key in this case is composed by <id> + <type> cause I *must* keep compatibility from legacy systems.

Is there a way for this to work in this scenario?

I found that the line 389 of EntityManager class that return the wrong NULL.

Thanks in advance,
Victor

--
You received this message because you are subscribed to the Google Groups "doctrine-user" group.
To post to this group, send email to doctri...@googlegroups.com.
To unsubscribe from this group, send email to doctrine-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/doctrine-user?hl=en.

--
You received this message because you are subscribed to the Google Groups "doctrine-user" group.
To post to this group, send email to doctri...@googlegroups.com.
To unsubscribe from this group, send email to doctrine-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/doctrine-user?hl=en.



--
Atenciosamente,
Victor Simonetti Moura

+55 (31) 9343-9962+55 (98) 8848-2111
---------------------------------------------------------------------------------------------------------------------
Desenvolvedor Web - victormoura.com

--
You received this message because you are subscribed to the Google Groups "doctrine-user" group.
To post to this group, send email to doctri...@googlegroups.com.
To unsubscribe from this group, send email to doctrine-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/doctrine-user?hl=en.

--
You received this message because you are subscribed to the Google Groups "doctrine-user" group.
To post to this group, send email to doctri...@googlegroups.com.
To unsubscribe from this group, send email to doctrine-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/doctrine-user?hl=en.



--
Atenciosamente,
Victor Simonetti Moura

+55 (31) 9343-9962 | +55 (98) 8848-2111
---------------------------------------------------------------------------------------------------------------------
Desenvolvedor Web - victormoura.com