當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。