本文整理汇总了PHP中Doctrine\ORM\Mapping\ClassMetadataInfo::mapField方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadataInfo::mapField方法的具体用法?PHP ClassMetadataInfo::mapField怎么用?PHP ClassMetadataInfo::mapField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\ClassMetadataInfo
的用法示例。
在下文中一共展示了ClassMetadataInfo::mapField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
static public function setUpBeforeClass()
{
$metadata = new ClassMetadataInfo('Propel\\Tests\\Builder\\ORM\\Book');
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string', 'columnName' => 'foo_name', 'length' => 25, 'nullable' => true, 'columnDefinition' => 'Hello world'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'integer', 'default' => 23, 'precision' => 2, 'scale' => 2, 'unique' => 'unique_status'));
$metadata->mapOneToOne(array(
'fieldName' => 'author',
'targetEntity' => 'Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor',
'mappedBy' => 'book',
'joinColumns' => array(
array('name' => 'author_id', 'referencedColumnName' => 'id')
),
));
$metadata->mapManyToMany(array(
'fieldName' => 'comments',
'targetEntity' => 'Doctrine\Tests\ORM\Tools\EntityGeneratorComment',
'joinTable' => array(
'name' => 'book_comment',
'joinColumns' => array(array('name' => 'book_id', 'referencedColumnName' => 'id')),
'inverseJoinColumns' => array(array('name' => 'comment_id', 'referencedColumnName' => 'id')),
),
));
$builder = new BaseActiveRecord($metadata);
eval('?>' . $builder->getCode());
}
示例2: execute
/**
* @throws \InvalidArgumentException When the bundle doesn't end with Bundle (Example: "Bundle\MySampleBundle")
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
$entity = str_replace('/', '\\', $input->getArgument('entity'));
$fullEntityClassName = $bundle->getNamespace() . '\\Entity\\' . $entity;
$mappingType = $input->getOption('mapping-type');
$class = new ClassMetadataInfo($fullEntityClassName);
$class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
// Map the specified fields
$fields = $input->getOption('fields');
if ($fields) {
$e = explode(' ', $fields);
foreach ($e as $value) {
$e = explode(':', $value);
$name = $e[0];
if (strlen($name)) {
$type = isset($e[1]) ? $e[1] : 'string';
preg_match_all('/(.*)\\((.*)\\)/', $type, $matches);
$type = isset($matches[1][0]) ? $matches[1][0] : $type;
$length = isset($matches[2][0]) ? $matches[2][0] : null;
$class->mapField(array('fieldName' => $name, 'type' => $type, 'length' => $length));
}
}
}
// Setup a new exporter for the mapping type specified
$cme = new ClassMetadataExporter();
$exporter = $cme->getExporter($mappingType);
$entityPath = $bundle->getPath() . '/Entity/' . str_replace('\\', '/', $entity) . '.php';
if (file_exists($entityPath)) {
throw new \RuntimeException(sprintf("Entity %s already exists.", $class->name));
}
if ('annotation' === $mappingType) {
$exporter->setEntityGenerator($this->getEntityGenerator());
$entityCode = $exporter->exportClassMetadata($class);
$mappingPath = $mappingCode = false;
} else {
$mappingType = 'yaml' == $mappingType ? 'yml' : $mappingType;
$mappingPath = $bundle->getPath() . '/Resources/config/doctrine/' . str_replace('\\', '.', $fullEntityClassName) . '.orm.' . $mappingType;
$mappingCode = $exporter->exportClassMetadata($class);
$entityGenerator = $this->getEntityGenerator();
$entityCode = $entityGenerator->generateEntityClass($class);
if (file_exists($mappingPath)) {
throw new \RuntimeException(sprintf("Cannot generate entity when mapping <info>%s</info> already exists", $mappingPath));
}
}
$output->writeln(sprintf('Generating entity for "<info>%s</info>"', $bundle->getName()));
$output->writeln(sprintf(' > entity <comment>%s</comment> into <info>%s</info>', $fullEntityClassName, $entityPath));
if (!is_dir($dir = dirname($entityPath))) {
mkdir($dir, 0777, true);
}
file_put_contents($entityPath, $entityCode);
if ($mappingPath) {
$output->writeln(sprintf(' > mapping into <info>%s</info>', $mappingPath));
if (!is_dir($dir = dirname($mappingPath))) {
mkdir($dir, 0777, true);
}
file_put_contents($mappingPath, $mappingCode);
}
}
示例3: loadMetadata
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
{
$metadata->mapField(array('id' => true, 'fieldName' => 'id', 'type' => 'integer', 'columnName' => 'id'));
$metadata->mapField(array('fieldName' => 'value', 'type' => 'float'));
$metadata->isMappedSuperclass = true;
$metadata->setCustomRepositoryClass("Doctrine\\Tests\\Models\\DDC869\\DDC869PaymentRepository");
$metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_AUTO);
}
示例4: loadMetadata
/**
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
*/
public static function loadMetadata(ORM\ClassMetadataInfo $metadata)
{
$metadata->setTableName('user_status');
$metadata->setIdGeneratorType(ORM\ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setCustomRepositoryClass('Orm\\Repository\\UserStatusRepository');
$metadata->mapField(array('id' => true, 'fieldName' => 'userid', 'type' => 'string', 'length' => 255));
$metadata->mapField(array('id' => true, 'fieldName' => 'authbackend', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'lastlogin', 'type' => 'datetime'));
}
示例5: loadMetadata
/**
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
*/
public static function loadMetadata(ORM\ClassMetadataInfo $metadata)
{
$metadata->setTableName('user_opt_in');
$metadata->setIdGeneratorType(ORM\ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setCustomRepositoryClass('Orm\\Repository\\OptInRepository');
$metadata->mapField(array('id' => true, 'fieldName' => 'userid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('id' => true, 'unique' => true, 'fieldName' => 'code', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'timestamp', 'type' => 'datetime'));
$metadata->mapField(array('fieldName' => 'mode', 'type' => 'string', 'length' => 100));
}
示例6: execute
/**
* @throws \InvalidArgumentException When the bundle doesn't end with Bundle (Example: "Bundle\MySampleBundle")
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!preg_match('/Bundle$/', $bundle = $input->getArgument('bundle'))) {
throw new \InvalidArgumentException('The bundle name must end with Bundle. Example: "Bundle\\MySampleBundle".');
}
$dirs = $this->container->get('kernel')->getBundleDirs();
$tmp = str_replace('\\', '/', $bundle);
$namespace = str_replace('/', '\\', dirname($tmp));
$bundle = basename($tmp);
if (!isset($dirs[$namespace])) {
throw new \InvalidArgumentException(sprintf('Unable to initialize the bundle entity (%s not defined).', $namespace));
}
$entity = $input->getArgument('entity');
$entityNamespace = $namespace . '\\' . $bundle . '\\Entity';
$fullEntityClassName = $entityNamespace . '\\' . $entity;
$tmp = str_replace('\\', '/', $fullEntityClassName);
$tmp = str_replace('/', '\\', dirname($tmp));
$className = basename($tmp);
$mappingType = $input->getOption('mapping-type');
$mappingType = $mappingType ? $mappingType : 'xml';
$class = new ClassMetadataInfo($fullEntityClassName);
$class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
// Map the specified fields
$fields = $input->getOption('fields');
if ($fields) {
$e = explode(' ', $fields);
foreach ($e as $value) {
$e = explode(':', $value);
$name = $e[0];
$type = isset($e[1]) ? $e[1] : 'string';
preg_match_all('/(.*)\\((.*)\\)/', $type, $matches);
$type = isset($matches[1][0]) ? $matches[1][0] : $type;
$length = isset($matches[2][0]) ? $matches[2][0] : null;
$class->mapField(array('fieldName' => $name, 'type' => $type, 'length' => $length));
}
}
// Setup a new exporter for the mapping type specified
$cme = new ClassMetadataExporter();
$exporter = $cme->getExporter($mappingType);
if ('annotation' === $mappingType) {
$path = $dirs[$namespace] . '/' . $bundle . '/Entity/' . str_replace($entityNamespace . '\\', null, $fullEntityClassName) . '.php';
$exporter->setEntityGenerator($this->getEntityGenerator());
} else {
$mappingType = 'yaml' == $mappingType ? 'yml' : $mappingType;
$path = $dirs[$namespace] . '/' . $bundle . '/Resources/config/doctrine/metadata/orm/' . str_replace('\\', '.', $fullEntityClassName) . '.dcm.' . $mappingType;
}
$code = $exporter->exportClassMetadata($class);
if (!is_dir($dir = dirname($path))) {
mkdir($dir, 0777, true);
}
$output->writeln(sprintf('Generating entity for "<info>%s</info>"', $bundle));
$output->writeln(sprintf(' > generating <comment>%s</comment>', $fullEntityClassName));
file_put_contents($path, $code);
}
示例7: loadMetadata
/**
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
*/
public static function loadMetadata(ORM\ClassMetadataInfo $metadata)
{
$metadata->setTableName('album');
$metadata->setIdGeneratorType(ORM\ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setCustomRepositoryClass('Orm\\Repository\\AlbumRepository');
$metadata->addLifecycleCallback('setLastupdateToNow', 'prePersist');
$metadata->addLifecycleCallback('setLastupdateToNow', 'preUpdate');
$metadata->mapField(array('id' => true, 'fieldName' => 'id', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('id' => true, 'fieldName' => 'websiteid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string', 'length' => 255));
$metadata->mapField(array('fieldName' => 'lastupdate', 'type' => 'bigint', 'default' => 0));
}
示例8: create
/**
* Creates an entity.
*
* @static
*/
public static function create($name, $path, array $fields, $annotationPrefix = 'ORM\\')
{
self::$annotationPrefix = $annotationPrefix;
self::$name = $name;
self::$path = $path;
self::$fields = $fields;
$class = new ClassMetadataInfo(self::$name);
$class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
foreach (self::$fields as $field) {
$class->mapField($field);
}
file_put_contents(self::$path, self::getEntityGenerator()->generateEntityClass($class));
}
示例9: generate
public function generate(BundleInterface $bundle, $entity, $format, array $fields, $withRepository)
{
// configure the bundle (needed if the bundle does not contain any Entities yet)
$config = $this->registry->getManager(null)->getConfiguration();
$config->setEntityNamespaces(array_merge(array($bundle->getName() => $bundle->getNamespace() . '\\Entity'), $config->getEntityNamespaces()));
$entityClass = $this->registry->getAliasNamespace($bundle->getName()) . '\\' . $entity;
$entityPath = $bundle->getPath() . '/Entity/' . str_replace('\\', '/', $entity) . '.php';
if (file_exists($entityPath)) {
throw new \RuntimeException(sprintf('Entity "%s" already exists.', $entityClass));
}
$class = new ClassMetadataInfo($entityClass);
$namingArray = Helper\NamingHelper::getNamingArray($bundle);
$class->table['name'] = $namingArray['vendor'] . '__' . $namingArray['bundle'] . '__' . strtolower($entity);
if ($withRepository) {
$class->customRepositoryClassName = $entityClass . 'Repository';
}
$class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
foreach ($fields as $field) {
$class->mapField($field);
}
$entityGenerator = $this->getEntityGenerator();
if ('annotation' === $format) {
$entityGenerator->setGenerateAnnotations(true);
$entityCode = $entityGenerator->generateEntityClass($class);
$mappingPath = $mappingCode = false;
} else {
$cme = new ClassMetadataExporter();
$exporter = $cme->getExporter('yml' == $format ? 'yaml' : $format);
$mappingPath = $bundle->getPath() . '/Resources/config/doctrine/' . str_replace('\\', '.', $entity) . '.orm.' . $format;
if (file_exists($mappingPath)) {
throw new \RuntimeException(sprintf('Cannot generate entity when mapping "%s" already exists.', $mappingPath));
}
$mappingCode = $exporter->exportClassMetadata($class);
$entityGenerator->setGenerateAnnotations(false);
$entityCode = $entityGenerator->generateEntityClass($class);
}
$this->filesystem->mkdir(dirname($entityPath));
file_put_contents($entityPath, $entityCode);
if ($mappingPath) {
$this->filesystem->mkdir(dirname($mappingPath));
file_put_contents($mappingPath, $mappingCode);
}
if ($withRepository) {
$path = $bundle->getPath() . str_repeat('/..', substr_count(get_class($bundle), '\\'));
$this->getRepositoryGenerator()->writeEntityRepositoryClass($class->customRepositoryClassName, $path);
}
}
示例10: loadMetadata
/**
* @param Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
*/
public static function loadMetadata(ORM\ClassMetadataInfo $metadata)
{
$metadata->setTableName('ticket');
$metadata->setIdGeneratorType(ORM\ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setCustomRepositoryClass('Orm\\Repository\\TicketRepository');
$metadata->mapField(array('id' => true, 'fieldName' => 'id', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'timestamp', 'type' => 'integer', 'length' => 11));
$metadata->mapField(array('fieldName' => 'websiteid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'isredirect', 'type' => 'boolean'));
$metadata->mapField(array('fieldName' => 'isget', 'type' => 'boolean'));
$metadata->mapField(array('fieldName' => 'requestconfig', 'type' => 'text'));
$metadata->mapField(array('fieldName' => 'ticketlifetime', 'type' => 'integer'));
$metadata->mapField(array('fieldName' => 'remainingcalls', 'type' => 'integer'));
$metadata->mapField(array('fieldName' => 'sessionlifetime', 'type' => 'integer', 'nullable' => true));
$metadata->mapField(array('fieldName' => 'credentials', 'type' => 'text', 'nullable' => true));
}
示例11: addField
/**
* Adds Field.
*
* @param string $name
* @param string $type
* @param array $mapping
*
* @return ClassMetadataBuilder
*/
public function addField($name, $type, array $mapping = array())
{
$mapping['fieldName'] = $name;
$mapping['type'] = $type;
$this->cm->mapField($mapping);
return $this;
}
示例12: generate
/**
* @param BundleInterface $bundle The bundle
* @param string $entity The entity name
* @param string $format The format
* @param array $fields The fields
* @param boolean $withRepository With repository
* @param string $prefix A prefix
*
* @throws \RuntimeException
*/
public function generate(BundleInterface $bundle, $entity, $format, array $fields, $withRepository, $prefix)
{
// configure the bundle (needed if the bundle does not contain any Entities yet)
$config = $this->registry->getManager(null)->getConfiguration();
$config->setEntityNamespaces(array_merge(array($bundle->getName() => $bundle->getNamespace() . '\\Entity'), $config->getEntityNamespaces()));
$entityClass = $this->registry->getAliasNamespace($bundle->getName()) . '\\' . $entity;
$entityPath = $bundle->getPath() . '/Entity/' . str_replace('\\', '/', $entity) . '.php';
if (file_exists($entityPath)) {
throw new \RuntimeException(sprintf('Entity "%s" already exists.', $entityClass));
}
$class = new ClassMetadataInfo($entityClass);
if ($withRepository) {
$entityClass = preg_replace('/\\\\Entity\\\\/', '\\Repository\\', $entityClass, 1);
$class->customRepositoryClassName = $entityClass . 'Repository';
}
foreach ($fields as $field) {
$class->mapField($field);
}
$class->setPrimaryTable(array('name' => $prefix . $this->getTableNameFromEntityName($entity)));
$entityGenerator = $this->getEntityGenerator();
$entityCode = $entityGenerator->generateEntityClass($class);
$mappingPath = $mappingCode = false;
$this->filesystem->mkdir(dirname($entityPath));
file_put_contents($entityPath, $entityCode);
if ($mappingPath) {
$this->filesystem->mkdir(dirname($mappingPath));
file_put_contents($mappingPath, $mappingCode);
}
if ($withRepository) {
$path = $bundle->getPath() . str_repeat('/..', substr_count(get_class($bundle), '\\'));
$this->getRepositoryGenerator()->writeEntityRepositoryClass($class->customRepositoryClassName, $path);
}
$this->addGeneratedEntityClassLoader($entityClass, $entityPath);
}
示例13: generate
/**
* @param BundleInterface $bundle
* @param string $entity
* @param string $format
* @param array $fields
*
* @return EntityGeneratorResult
*
* @throws \Doctrine\ORM\Tools\Export\ExportException
*/
public function generate(BundleInterface $bundle, $entity, $format, array $fields)
{
// configure the bundle (needed if the bundle does not contain any Entities yet)
$config = $this->registry->getManager(null)->getConfiguration();
$config->setEntityNamespaces(array_merge(array($bundle->getName() => $bundle->getNamespace() . '\\Entity'), $config->getEntityNamespaces()));
$entityClass = $this->registry->getAliasNamespace($bundle->getName()) . '\\' . $entity;
$entityPath = $bundle->getPath() . '/Entity/' . str_replace('\\', '/', $entity) . '.php';
if (file_exists($entityPath)) {
throw new \RuntimeException(sprintf('Entity "%s" already exists.', $entityClass));
}
$class = new ClassMetadataInfo($entityClass);
$class->customRepositoryClassName = str_replace('\\Entity\\', '\\Repository\\', $entityClass) . 'Repository';
$class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
foreach ($fields as $field) {
$class->mapField($field);
}
$entityGenerator = $this->getEntityGenerator();
if ('annotation' === $format) {
$entityGenerator->setGenerateAnnotations(true);
$class->setPrimaryTable(array('name' => Inflector::tableize($entity)));
$entityCode = $entityGenerator->generateEntityClass($class);
$mappingPath = $mappingCode = false;
} else {
$cme = new ClassMetadataExporter();
$exporter = $cme->getExporter('yml' == $format ? 'yaml' : $format);
$mappingPath = $bundle->getPath() . '/Resources/config/doctrine/' . str_replace('\\', '.', $entity) . '.orm.' . $format;
if (file_exists($mappingPath)) {
throw new \RuntimeException(sprintf('Cannot generate entity when mapping "%s" already exists.', $mappingPath));
}
$mappingCode = $exporter->exportClassMetadata($class);
$entityGenerator->setGenerateAnnotations(false);
$entityCode = $entityGenerator->generateEntityClass($class);
}
$entityCode = str_replace(array("@var integer\n", "@var boolean\n", "@param integer\n", "@param boolean\n", "@return integer\n", "@return boolean\n"), array("@var int\n", "@var bool\n", "@param int\n", "@param bool\n", "@return int\n", "@return bool\n"), $entityCode);
$this->filesystem->mkdir(dirname($entityPath));
file_put_contents($entityPath, $entityCode);
if ($mappingPath) {
$this->filesystem->mkdir(dirname($mappingPath));
file_put_contents($mappingPath, $mappingCode);
}
$path = $bundle->getPath() . str_repeat('/..', substr_count(get_class($bundle), '\\'));
$this->getRepositoryGenerator()->writeEntityRepositoryClass($class->customRepositoryClassName, $path);
$repositoryPath = $path . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class->customRepositoryClassName) . '.php';
return new EntityGeneratorResult($entityPath, $repositoryPath, $mappingPath);
}
示例14: testWriteEntityClass
public function testWriteEntityClass()
{
$metadata = new ClassMetadataInfo('EntityGeneratorBook');
$metadata->primaryTable['name'] = 'book';
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'default' => 'published'));
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->mapOneToOne(array('fieldName' => 'author', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\EntityGeneratorAuthor', 'mappedBy' => 'book'));
$joinColumns = array(array('name' => 'author_id', 'referencedColumnName' => 'id'));
$metadata->mapManyToMany(array('fieldName' => 'comments', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\EntityGeneratorComment', 'joinTable' => array('name' => 'book_comment', 'joinColumns' => array(array('name' => 'book_id', 'referencedColumnName' => 'id')), 'inverseJoinColumns' => array(array('name' => 'comment_id', 'referencedColumnName' => 'id')))));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$this->_generator->writeEntityClass($metadata, __DIR__);
$path = __DIR__ . '/EntityGeneratorBook.php';
$this->assertTrue(file_exists($path));
require_once $path;
return $metadata;
}
示例15: generateBookEntityFixture
public function generateBookEntityFixture()
{
$metadata = new ClassMetadataInfo($this->_namespace . '\\EntityGeneratorBook');
$metadata->namespace = $this->_namespace;
$metadata->customRepositoryClassName = $this->_namespace . '\\EntityGeneratorBookRepository';
$metadata->table['name'] = 'book';
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'default' => 'published'));
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->mapOneToOne(array('fieldName' => 'author', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\EntityGeneratorAuthor', 'mappedBy' => 'book'));
$joinColumns = array(array('name' => 'author_id', 'referencedColumnName' => 'id'));
$metadata->mapManyToMany(array('fieldName' => 'comments', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\EntityGeneratorComment', 'joinTable' => array('name' => 'book_comment', 'joinColumns' => array(array('name' => 'book_id', 'referencedColumnName' => 'id')), 'inverseJoinColumns' => array(array('name' => 'comment_id', 'referencedColumnName' => 'id')))));
$metadata->addLifecycleCallback('loading', 'postLoad');
$metadata->addLifecycleCallback('willBeRemoved', 'preRemove');
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$this->_generator->writeEntityClass($metadata, $this->_tmpDir);
return $metadata;
}