public function testJoinTableName() { $cm1 = $this->createClassMetadata('Doctrine\\Tests\\Models\\CMS\\CmsAddress'); $cm2 = $this->createClassMetadata('Doctrine\\Tests\\Models\\CMS\\CmsAddress'); $cm1->mapManyToMany(array('fieldName' => 'user', 'targetEntity' => 'CmsUser', 'inversedBy' => 'users', 'joinTable' => array('name' => '`cmsaddress_cmsuser`'))); $cm2->mapManyToMany(array('fieldName' => 'user', 'targetEntity' => 'CmsUser', 'inversedBy' => 'users', 'joinTable' => array('name' => 'cmsaddress_cmsuser'))); $this->assertEquals('"cmsaddress_cmsuser"', $this->strategy->getJoinTableName($cm1->associationMappings['user'], $cm1, $this->platform)); $this->assertEquals('cmsaddress_cmsuser', $this->strategy->getJoinTableName($cm2->associationMappings['user'], $cm2, $this->platform)); }
/** * @group DDC-3590 * @group 1316 */ public function testGetJoinTableName() { $em = $this->_getTestEntityManager(); $metadata = $em->getClassMetadata(NonPublicSchemaUser::CLASSNAME); /* @var $platform \Doctrine\DBAL\Platforms\AbstractPlatform */ $strategy = new DefaultQuoteStrategy(); $platform = $this->getMockForAbstractClass('Doctrine\\DBAL\\Platforms\\AbstractPlatform'); $this->assertSame('readers.author_reader', $strategy->getJoinTableName($metadata->associationMappings['readers'], $metadata, $platform)); }
/** * Get list of Diamante tables to purge data from * * @return array */ protected function getTablesList() { $entitiesMetadata = array($this->entityManager->getClassMetadata(\Diamante\DeskBundle\Entity\Branch::getClassName()), $this->entityManager->getClassMetadata(\Diamante\DeskBundle\Entity\BranchEmailConfiguration::getClassName()), $this->entityManager->getClassMetadata(\Diamante\DeskBundle\Entity\Ticket::getClassName()), $this->entityManager->getClassMetadata(\Diamante\DeskBundle\Entity\Comment::getClassName()), $this->entityManager->getClassMetadata(\Diamante\DeskBundle\Entity\Attachment::getClassName()), $this->entityManager->getClassMetadata(\Diamante\DeskBundle\Entity\TicketHistory::getClassName()), $this->entityManager->getClassMetadata('\\Oro\\Bundle\\TagBundle\\Entity\\Tag'), $this->entityManager->getClassMetadata('\\Oro\\Bundle\\TagBundle\\Entity\\Tagging')); $toPurge = array(); $quoteStrategy = new DefaultQuoteStrategy(); /** @var $entity \Doctrine\ORM\Mapping\ClassMetadata */ foreach ($entitiesMetadata as $entity) { $tableName = $entity->getTableName(); $toPurge[] = $tableName; foreach ($entity->getAssociationMappings() as $assoc) { if (isset($assoc['joinTable'])) { $toPurge[] = $quoteStrategy->getJoinTableName($assoc, $entity, $this->dbPlatform); } } } return $toPurge; }