当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityGenerator::setEmbeddablesImmutable方法代码示例

本文整理汇总了PHP中Doctrine\ORM\Tools\EntityGenerator::setEmbeddablesImmutable方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityGenerator::setEmbeddablesImmutable方法的具体用法?PHP EntityGenerator::setEmbeddablesImmutable怎么用?PHP EntityGenerator::setEmbeddablesImmutable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\Tools\EntityGenerator的用法示例。


在下文中一共展示了EntityGenerator::setEmbeddablesImmutable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGeneratedImmutableEmbeddablesClass

 /**
  * @group DDC-3304
  */
 public function testGeneratedImmutableEmbeddablesClass()
 {
     $this->_generator->setEmbeddablesImmutable(true);
     $embeddedMetadata = $this->generateTestEmbeddableFixture();
     $metadata = $this->generateIsbnEmbeddableFixture(array('test' => $embeddedMetadata));
     $this->loadEntityClass($embeddedMetadata);
     $this->loadEntityClass($metadata);
     $this->assertTrue(class_exists($metadata->name), "Class does not exist.");
     $this->assertTrue(method_exists($metadata->name, '__construct'), "EntityGeneratorIsbn::__construct missing.");
     $this->assertTrue(method_exists($metadata->name, 'getPrefix'), "EntityGeneratorIsbn::getPrefix() missing.");
     $this->assertFalse(method_exists($metadata->name, 'setPrefix'), "EntityGeneratorIsbn::setPrefix() present.");
     $this->assertTrue(method_exists($metadata->name, 'getGroupNumber'), "EntityGeneratorIsbn::getGroupNumber() missing.");
     $this->assertFalse(method_exists($metadata->name, 'setGroupNumber'), "EntityGeneratorIsbn::setGroupNumber() present.");
     $this->assertTrue(method_exists($metadata->name, 'getPublisherNumber'), "EntityGeneratorIsbn::getPublisherNumber() missing.");
     $this->assertFalse(method_exists($metadata->name, 'setPublisherNumber'), "EntityGeneratorIsbn::setPublisherNumber() present.");
     $this->assertTrue(method_exists($metadata->name, 'getTitleNumber'), "EntityGeneratorIsbn::getTitleNumber() missing.");
     $this->assertFalse(method_exists($metadata->name, 'setTitleNumber'), "EntityGeneratorIsbn::setTitleNumber() present.");
     $this->assertTrue(method_exists($metadata->name, 'getCheckDigit'), "EntityGeneratorIsbn::getCheckDigit() missing.");
     $this->assertFalse(method_exists($metadata->name, 'setCheckDigit'), "EntityGeneratorIsbn::setCheckDigit() present.");
     $this->assertTrue(method_exists($metadata->name, 'getTest'), "EntityGeneratorIsbn::getTest() missing.");
     $this->assertFalse(method_exists($metadata->name, 'setTest'), "EntityGeneratorIsbn::setTest() present.");
     $test = new $embeddedMetadata->name(1, new \DateTime());
     $isbn = new $metadata->name($test, 978, 3, 12, 732320, 83);
     $reflMethod = new \ReflectionMethod($isbn, '__construct');
     $reflParameters = $reflMethod->getParameters();
     $this->assertCount(6, $reflParameters);
     $this->assertSame($embeddedMetadata->name, $reflParameters[0]->getClass()->name);
     $this->assertSame('test', $reflParameters[0]->getName());
     $this->assertFalse($reflParameters[0]->isOptional());
     $this->assertSame('prefix', $reflParameters[1]->getName());
     $this->assertFalse($reflParameters[1]->isOptional());
     $this->assertSame('groupNumber', $reflParameters[2]->getName());
     $this->assertFalse($reflParameters[2]->isOptional());
     $this->assertSame('publisherNumber', $reflParameters[3]->getName());
     $this->assertFalse($reflParameters[3]->isOptional());
     $this->assertSame('titleNumber', $reflParameters[4]->getName());
     $this->assertFalse($reflParameters[4]->isOptional());
     $this->assertSame('checkDigit', $reflParameters[5]->getName());
     $this->assertFalse($reflParameters[5]->isOptional());
     $reflMethod = new \ReflectionMethod($test, '__construct');
     $reflParameters = $reflMethod->getParameters();
     $this->assertCount(4, $reflParameters);
     $this->assertSame('field1', $reflParameters[0]->getName());
     $this->assertFalse($reflParameters[0]->isOptional());
     $this->assertSame('DateTime', $reflParameters[1]->getClass()->name);
     $this->assertSame('field3', $reflParameters[1]->getName());
     $this->assertFalse($reflParameters[1]->isOptional());
     $this->assertSame('field2', $reflParameters[2]->getName());
     $this->assertTrue($reflParameters[2]->isOptional());
     $this->assertSame('DateTime', $reflParameters[3]->getClass()->name);
     $this->assertSame('field4', $reflParameters[3]->getName());
     $this->assertTrue($reflParameters[3]->isOptional());
 }
开发者ID:selimcr,项目名称:servigases,代码行数:56,代码来源:EntityGeneratorTest.php


注:本文中的Doctrine\ORM\Tools\EntityGenerator::setEmbeddablesImmutable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。