1
0
mirror of synced 2025-01-10 11:07:10 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Cache.City.php

54 lines
1.4 KiB
PHP
Raw Normal View History

2013-02-14 02:42:13 +04:00
<?php
use Doctrine\ORM\Mapping\ClassMetadataInfo;
$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE);
$metadata->setPrimaryTable(array('name' => 'cache_city'));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_IDENTITY);
$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT);
$metadata->enableCache(array(
'usage' => ClassMetadataInfo::CACHE_USAGE_READ_ONLY
));
$metadata->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'id' => true,
));
$metadata->mapField(array(
'fieldName' => 'name',
'type' => 'string',
));
$metadata->mapOneToOne(array(
'fieldName' => 'state',
'targetEntity' => 'Doctrine\\Tests\\Models\\Cache\\State',
'inversedBy' => 'cities',
'joinColumns' =>
array(array(
'name' => 'state_id',
'referencedColumnName' => 'id',
))
));
$metadata->enableAssociationCache('state', array(
'usage' => ClassMetadataInfo::CACHE_USAGE_READ_ONLY
));
$metadata->mapManyToMany(array(
'fieldName' => 'travels',
'targetEntity' => 'Doctrine\\Tests\\Models\\Cache\\Travel',
'mappedBy' => 'visitedCities',
));
$metadata->mapOneToMany(array(
'fieldName' => 'attractions',
'targetEntity' => 'Doctrine\\Tests\\Models\\Cache\\Attraction',
'mappedBy' => 'city',
'orderBy' => array('name' => 'ASC',),
));
$metadata->enableAssociationCache('attractions', array(
'usage' => ClassMetadataInfo::CACHE_USAGE_READ_ONLY
));