Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Last active December 13, 2015 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/a99f4746a2a2ea525902 to your computer and use it in GitHub Desktop.
Save doctrinebot/a99f4746a2a2ea525902 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-57 - https://github.com/doctrine/doctrine2/issues/5076
-- phpMyAdmin SQL Dump
-- version 3.2.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 22, 2009 at 09:41 AM
-- Server version: 5.1.31
-- PHP Version: 5.2.6-3ubuntu4.2
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `kateglox`
--
-- --------------------------------------------------------
--
-- Table structure for table `definition`
--
CREATE TABLE IF NOT EXISTS `definition` (
`definition_id` int(11) NOT NULL AUTO_INCREMENT,
`definition_lemma_id` int(11) NOT NULL,
`definition_lexical_id` int(11) NOT NULL,
`definition_text` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`definition_id`),
KEY `definition_lemma_id` (`definition_lemma_id`),
KEY `definition_lexical_id` (`definition_lexical_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=99091 ;
-- --------------------------------------------------------
--
-- Table structure for table `definition_discipline`
--
CREATE TABLE IF NOT EXISTS `definition_discipline` (
`definition_id` int(11) NOT NULL,
`discipline_id` int(11) NOT NULL,
PRIMARY KEY (`definition_id`),
KEY `discipline_id` (`discipline_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `definition_source`
--
CREATE TABLE IF NOT EXISTS `definition_source` (
`definition_id` int(11) NOT NULL,
`source_id` int(11) NOT NULL,
PRIMARY KEY (`definition_id`,`source_id`),
KEY `source_id` (`source_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `discipline`
--
CREATE TABLE IF NOT EXISTS `discipline` (
`discipline_id` int(11) NOT NULL AUTO_INCREMENT,
`discipline_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`discipline_abbreviation` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`discipline_id`),
UNIQUE KEY `discipline_name` (`discipline_name`),
UNIQUE KEY `discipline_abbreviation` (`discipline_abbreviation`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=56 ;
-- --------------------------------------------------------
--
-- Table structure for table `etymology`
--
CREATE TABLE IF NOT EXISTS `etymology` (
`etymology_definition_id` int(11) NOT NULL,
`etymology_locale_id` int(11) NOT NULL,
`etymology_text` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`etymology_definition_id`),
KEY `etymology_locale_id` (`etymology_locale_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `glossary`
--
CREATE TABLE IF NOT EXISTS `glossary` (
`glossary_id` int(11) NOT NULL AUTO_INCREMENT,
`glossary_lemma_id` int(11) NOT NULL,
`glossary_locale_id` int(11) NOT NULL,
`glossary_discipline_id` int(11) NOT NULL,
`glossary_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`glossary_id`),
KEY `glossary_lemma_id` (`glossary_lemma_id`),
KEY `glossary_locale_id` (`glossary_locale_id`),
KEY `glossary_discipline_id` (`glossary_discipline_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=167126 ;
-- --------------------------------------------------------
--
-- Table structure for table `glossary_source`
--
CREATE TABLE IF NOT EXISTS `glossary_source` (
`glossary_id` int(11) NOT NULL,
`source_id` int(11) NOT NULL,
PRIMARY KEY (`glossary_id`,`source_id`),
KEY `source_id` (`source_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `lemma`
--
CREATE TABLE IF NOT EXISTS `lemma` (
`lemma_id` int(11) NOT NULL AUTO_INCREMENT,
`lemma_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`lemma_id`),
UNIQUE KEY `lemma_name` (`lemma_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=239742 ;
-- --------------------------------------------------------
--
-- Table structure for table `lemma_type`
--
CREATE TABLE IF NOT EXISTS `lemma_type` (
`lemma_id` int(11) NOT NULL,
`type_id` int(11) NOT NULL,
PRIMARY KEY (`lemma_id`,`type_id`),
KEY `type_id` (`type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `lexical`
--
CREATE TABLE IF NOT EXISTS `lexical` (
`lexical_id` int(11) NOT NULL AUTO_INCREMENT,
`lexical_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`lexical_abbreviation` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`lexical_id`),
UNIQUE KEY `lexical_name` (`lexical_name`),
UNIQUE KEY `lexical_abbreviation` (`lexical_abbreviation`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=8 ;
-- --------------------------------------------------------
--
-- Table structure for table `locale`
--
CREATE TABLE IF NOT EXISTS `locale` (
`locale_id` int(11) NOT NULL AUTO_INCREMENT,
`locale_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`locale_abbreviation` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`locale_id`),
UNIQUE KEY `locale_name` (`locale_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
-- --------------------------------------------------------
--
-- Table structure for table `pronounciation`
--
CREATE TABLE IF NOT EXISTS `pronounciation` (
`pronounciation_definition_id` int(11) NOT NULL,
`pronounciation_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`pronounciation_definition_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `relation`
--
CREATE TABLE IF NOT EXISTS `relation` (
`relation_parent_id` int(11) NOT NULL,
`relation_child_id` int(11) NOT NULL,
`relation_type_id` int(11) NOT NULL,
PRIMARY KEY (`relation_parent_id`,`relation_child_id`),
KEY `relation_type_id` (`relation_type_id`),
KEY `relation_child_id` (`relation_child_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `relation_type`
--
CREATE TABLE IF NOT EXISTS `relation_type` (
`relation_type_id` int(11) NOT NULL AUTO_INCREMENT,
`relation_type_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`relation_type_abbreviation` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`relation_type_id`),
UNIQUE KEY `relation_type_name` (`relation_type_name`),
UNIQUE KEY `relation_type_abbreviation` (`relation_type_abbreviation`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=8 ;
-- --------------------------------------------------------
--
-- Table structure for table `source`
--
CREATE TABLE IF NOT EXISTS `source` (
`source_id` int(11) NOT NULL AUTO_INCREMENT,
`source_type_id` int(11) NOT NULL,
`source_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`source_label` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`source_id`),
UNIQUE KEY `source_url` (`source_url`),
KEY `source_type_id` (`source_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=28994 ;
-- --------------------------------------------------------
--
-- Table structure for table `source_type`
--
CREATE TABLE IF NOT EXISTS `source_type` (
`source_type_id` int(11) NOT NULL AUTO_INCREMENT,
`source_type_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`source_type_abbreviation` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`source_type_id`),
UNIQUE KEY `source_type_name` (`source_type_name`),
UNIQUE KEY `source_type_abbreviation` (`source_type_abbreviation`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6 ;
-- --------------------------------------------------------
--
-- Table structure for table `syllabel`
--
CREATE TABLE IF NOT EXISTS `syllabel` (
`syllabel_lemma_id` int(11) NOT NULL,
`syllabel_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`syllabel_lemma_id`),
UNIQUE KEY `syllabel_name` (`syllabel_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `type`
--
CREATE TABLE IF NOT EXISTS `type` (
`type_id` int(11) NOT NULL AUTO_INCREMENT,
`type_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`type_abbreviation` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`type_id`),
UNIQUE KEY `type_name` (`type_name`),
UNIQUE KEY `type_abbreviation` (`type_abbreviation`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_last_login` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_username` (`user_username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `definition`
--
ALTER TABLE `definition`
ADD CONSTRAINT `definition_ibfk_1` FOREIGN KEY (`definition_lemma_id`) REFERENCES `lemma` (`lemma_id`),
ADD CONSTRAINT `definition_ibfk_2` FOREIGN KEY (`definition_lexical_id`) REFERENCES `lexical` (`lexical_id`);
--
-- Constraints for table `definition_discipline`
--
ALTER TABLE `definition_discipline`
ADD CONSTRAINT `definition_discipline_ibfk_1` FOREIGN KEY (`definition_id`) REFERENCES `definition` (`definition_id`),
ADD CONSTRAINT `definition_discipline_ibfk_2` FOREIGN KEY (`discipline_id`) REFERENCES `discipline` (`discipline_id`);
--
-- Constraints for table `definition_source`
--
ALTER TABLE `definition_source`
ADD CONSTRAINT `definition_source_ibfk_1` FOREIGN KEY (`definition_id`) REFERENCES `definition` (`definition_id`),
ADD CONSTRAINT `definition_source_ibfk_2` FOREIGN KEY (`source_id`) REFERENCES `source` (`source_id`);
--
-- Constraints for table `etymology`
--
ALTER TABLE `etymology`
ADD CONSTRAINT `etymology_ibfk_1` FOREIGN KEY (`etymology_locale_id`) REFERENCES `locale` (`locale_id`),
ADD CONSTRAINT `etymology_ibfk_2` FOREIGN KEY (`etymology_definition_id`) REFERENCES `definition` (`definition_id`);
--
-- Constraints for table `glossary`
--
ALTER TABLE `glossary`
ADD CONSTRAINT `glossary_ibfk_1` FOREIGN KEY (`glossary_lemma_id`) REFERENCES `lemma` (`lemma_id`),
ADD CONSTRAINT `glossary_ibfk_2` FOREIGN KEY (`glossary_locale_id`) REFERENCES `locale` (`locale_id`),
ADD CONSTRAINT `glossary_ibfk_3` FOREIGN KEY (`glossary_discipline_id`) REFERENCES `discipline` (`discipline_id`);
--
-- Constraints for table `glossary_source`
--
ALTER TABLE `glossary_source`
ADD CONSTRAINT `glossary_source_ibfk_1` FOREIGN KEY (`glossary_id`) REFERENCES `glossary` (`glossary_id`),
ADD CONSTRAINT `glossary_source_ibfk_2` FOREIGN KEY (`source_id`) REFERENCES `source` (`source_id`);
--
-- Constraints for table `lemma_type`
--
ALTER TABLE `lemma_type`
ADD CONSTRAINT `lemma_type_ibfk_1` FOREIGN KEY (`lemma_id`) REFERENCES `lemma` (`lemma_id`),
ADD CONSTRAINT `lemma_type_ibfk_2` FOREIGN KEY (`type_id`) REFERENCES `type` (`type_id`);
--
-- Constraints for table `pronounciation`
--
ALTER TABLE `pronounciation`
ADD CONSTRAINT `pronounciation_ibfk_1` FOREIGN KEY (`pronounciation_definition_id`) REFERENCES `definition` (`definition_id`);
--
-- Constraints for table `relation`
--
ALTER TABLE `relation`
ADD CONSTRAINT `relation_ibfk_1` FOREIGN KEY (`relation_parent_id`) REFERENCES `lemma` (`lemma_id`),
ADD CONSTRAINT `relation_ibfk_2` FOREIGN KEY (`relation_child_id`) REFERENCES `lemma` (`lemma_id`),
ADD CONSTRAINT `relation_ibfk_3` FOREIGN KEY (`relation_type_id`) REFERENCES `relation_type` (`relation_type_id`);
--
-- Constraints for table `source`
--
ALTER TABLE `source`
ADD CONSTRAINT `source_ibfk_1` FOREIGN KEY (`source_type_id`) REFERENCES `source_type` (`source_type_id`);
--
-- Constraints for table `syllabel`
--
ALTER TABLE `syllabel`
ADD CONSTRAINT `syllabel_ibfk_1` FOREIGN KEY (`syllabel_lemma_id`) REFERENCES `lemma` (`lemma_id`);
Index: .buildpath
===================================================================
--- .buildpath (revision 0)
+++ .buildpath (revision 0)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+ <buildpathentry kind="src" path=""/>
+ <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+</buildpath>
Index: lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
===================================================================
--- lib/Doctrine/ORM/Persisters/StandardEntityPersister.php (revision 6556)
+++ lib/Doctrine/ORM/Persisters/StandardEntityPersister.php (working copy)
@@ -583,9 +583,10 @@
protected function _getSelectManyToManyEntityCollectionSql($manyToMany, array &$criteria)
{
$columnList = '';
+ $primaryTable = $this->_class->primaryTable;
foreach ($this->_class->fieldNames as $field) {
if ($columnList != '') $columnList .= ', ';
- $columnList .= $this->_class->getQuotedColumnName($field, $this->_platform);
+ $columnList .= $primaryTable['name'].".".$this->_class->getQuotedColumnName($field, $this->_platform);
}
foreach ($this->_class->associationMappings as $assoc) {
Index: lib/Doctrine/ORM/Mapping/ManyToManyMapping.php
===================================================================
--- lib/Doctrine/ORM/Mapping/ManyToManyMapping.php (revision 6556)
+++ lib/Doctrine/ORM/Mapping/ManyToManyMapping.php (working copy)
@@ -175,7 +175,7 @@
foreach ($owningAssoc->targetToRelationKeyColumns as $sourceKeyColumn => $relationKeyColumn) {
// getting id
if (isset($sourceClass->reflFields[$sourceKeyColumn])) {
- $joinTableConditions[$relationKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity);
+ $joinTableConditions[$relationKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$relationKeyColumn]]->getValue($sourceEntity);
} else {
$joinTableConditions[$relationKeyColumn] = $joinColumnValues[$sourceKeyColumn];
}
Index: .project
===================================================================
--- .project (revision 0)
+++ .project (revision 0)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>doctrine</name>
+ <comment></comment>
+ <projects>
+ <project>momoku</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.dltk.core.scriptbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.php.core.PHPNature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
Index: AdvancedAssociationTest.php
===================================================================
--- AdvancedAssociationTest.php (Revision 6571)
+++ AdvancedAssociationTest.php (Arbeitskopie)
@@ -16,10 +16,12 @@
protected function setUp() {
parent::setUp();
try {
- $this->_schemaTool->createSchema(array(
- $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Phrase'),
+ $this->_schemaTool->createSchema(array(
+ $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Phrase'),
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\PhraseType'),
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Definition'),
+ $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Lemma'),
+ $this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Type')
));
} catch (\Exception $e) {
// Swallow all exceptions. We do not test the schema tool here.
@@ -40,11 +42,20 @@
$def1->setDefinition('def1');
$def2 = new Definition;
$def2->setDefinition('def2');
-
+
$phrase->setType($type);
$phrase->addDefinition($def1);
$phrase->addDefinition($def2);
+ $lemma = new Lemma;
+ $lemma->setLemma('abu');
+
+ $type = new Type();
+ $type->setType('nonsense');
+ $type->setAbbreviation('non');
+
+ $lemma->addType($type);
+
$this->_em->persist($phrase);
$this->_em->persist($type);
@@ -95,11 +106,237 @@
$this->assertTrue($definitions[0] instanceof Definition);
$this->assertEquals(2, $definitions->count());
+ // test5 ManyToMany
+ $query = $this->_em->createQuery("SELECT l FROM Doctrine\Tests\ORM\Functional\Lemma l");
+ $res = $query->getResult();
+ $types = $res[0]->getTypes();
+
+ $this->assertTrue($types[0] instanceof Type);
+
}
}
/**
* @Entity
+ * @Table(name="lemma")
+ */
+class Lemma {
+
+ const CLASS_NAME = __CLASS__;
+
+ /**
+ * @var int
+ * @Id
+ * @Column(type="integer", name="lemma_id")
+ * @GeneratedValue(strategy="AUTO")
+ */
+ private $id;
+
+ /**
+ *
+ * @var string
+ * @Column(type="string", name="lemma_name", unique=true, length=255)
+ */
+ private $lemma;
+
+ /**
+ * @var kateglo\application\utilities\collections\ArrayCollection
+ * @ManyToMany(targetEntity="Type", mappedBy="lemmas", cascade={"persist"})
+ */
+ private $types;
+
+ public function __construct() {
+ $this->types = new \Doctrine\Common\Collections\ArrayCollection();
+ }
+
+
+ /**
+ *
+ * @return int
+ */
+ public function getId(){
+ return $this->id;
+ }
+
+ /**
+ *
+ * @param string $lemma
+ * @return void
+ */
+ public function setLemma($lemma){
+ $this->lemma = $lemma;
+ }
+
+ /**
+ *
+ * @return string
+ */
+ public function getLemma(){
+ return $this->lemma;
+ }
+
+ /**
+ *
+ * @param kateglo\application\models\Type $type
+ * @return void
+ */
+ public function addType(Type $type){
+ if (!$this->types->contains($type)) {
+ $this->types[] = $type;
+ $type->addLemma($this);
+ }
+ }
+
+ /**
+ *
+ * @param kateglo\application\models\Type $type
+ * @return void
+ */
+ public function removeType(Type $type)
+ {
+ $removed = $this->sources->removeElement($type);
+ if ($removed !== null) {
+ $removed->removeLemma($this);
+ }
+ }
+
+ /**
+ *
+ * @return kateglo\application\helpers\collections\ArrayCollection
+ */
+ public function getTypes()
+ {
+ return $this->types;
+ }
+}
+
+/**
+ * @Entity
+ * @Table(name="type")
+ */
+class Type {
+
+ const CLASS_NAME = __CLASS__;
+
+ /**
+ *
+ * @var int
+ * @Id
+ * @Column(type="integer", name="type_id")
+ * @GeneratedValue(strategy="AUTO")
+ */
+ private $id;
+
+ /**
+ *
+ * @var string
+ * @Column(type="string", name="type_name", unique=true)
+ */
+ private $type;
+
+ /**
+ *
+ * @var string
+ * @Column(type="string", name="type_abbreviation", unique=true)
+ */
+ private $abbreviation;
+
+ /**
+ * @var kateglo\application\helpers\collections\ArrayCollection
+ * @ManyToMany(targetEntity="Lemma")
+ * @JoinTable(name="lemma_type",
+ * joinColumns={@JoinColumn(name="type_id", referencedColumnName="type_id")},
+ * inverseJoinColumns={@JoinColumn(name="lemma_id", referencedColumnName="lemma_id")}
+ * )
+ */
+ private $lemmas;
+
+ public function __construct(){
+ $this->lemmas = new \Doctrine\Common\Collections\ArrayCollection();
+ }
+
+ /**
+ *
+ * @return int
+ */
+ public function getId(){
+ return $this->id;
+ }
+
+ /**
+ *
+ * @param string $type
+ * @return void
+ */
+ public function setType($type){
+ $this->type = $type;
+ }
+
+ /**
+ *
+ * @return string
+ */
+ public function getType(){
+ return $this->type;
+ }
+
+ /**
+ *
+ * @param string $abbreviation
+ * @return void
+ */
+ public function setAbbreviation($abbreviation){
+ $this->abbreviation = $abbreviation;
+ }
+
+ /**
+ *
+ * @return string
+ */
+ public function getAbbreviation(){
+ return $this->abbreviation;
+ }
+
+ /**
+ *
+ * @param kateglo\application\models\Lemma $lemma
+ * @return void
+ */
+ public function addLemma(Lemma $lemma)
+ {
+ if (!$this->lemmas->contains($lemma)) {
+ $this->lemmas[] = $lemma;
+ $lemma->addType($this);
+ }
+ }
+
+ /**
+ *
+ * @param kateglo\application\models\Lemma $lemma
+ * @return void
+ */
+ public function removeLEmma(Lemma $lemma)
+ {
+ $removed = $this->lemmas->removeElement($lemma);
+ if ($removed !== null) {
+ $removed->removeType($this);
+ }
+ }
+
+ /**
+ *
+ * @return kateglo\application\helpers\collections\ArrayCollection
+ */
+ public function getCategories()
+ {
+ return $this->categories;
+ }
+
+}
+
+
+/**
+ * @Entity
* @Table(name="phrase")
*/
class Phrase {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment