本文整理汇总了PHP中Doctrine\ORM\Mapping\ClassMetadataInfo::setCustomRepositoryClass方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadataInfo::setCustomRepositoryClass方法的具体用法?PHP ClassMetadataInfo::setCustomRepositoryClass怎么用?PHP ClassMetadataInfo::setCustomRepositoryClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\ClassMetadataInfo
的用法示例。
在下文中一共展示了ClassMetadataInfo::setCustomRepositoryClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadMetadata
/**
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
*/
public static function loadMetadata(ORM\ClassMetadataInfo $metadata)
{
$metadata->setTableName('page');
$metadata->setIdGeneratorType(ORM\ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setCustomRepositoryClass('Orm\\Repository\\PageRepository');
$metadata->addLifecycleCallback('setTemplatecontentChecksumOnUpdate', 'prePersist');
$metadata->addLifecycleCallback('setTemplatecontentChecksumOnUpdate', 'preUpdate');
$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' => 'templateid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'mediaid', 'type' => 'string', 'length' => 255, 'nullable' => true));
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string', 'length' => 255));
$metadata->mapField(array('fieldName' => 'description', 'type' => 'text'));
$metadata->mapField(array('fieldName' => 'date', 'type' => 'bigint', 'length' => 20));
$metadata->mapField(array('fieldName' => 'innavigation', 'type' => 'smallint', 'length' => 1));
$metadata->mapField(array('fieldName' => 'navigationtitle', 'type' => 'string', 'length' => 255));
$metadata->mapField(array('fieldName' => 'content', 'type' => 'text'));
$metadata->mapField(array('fieldName' => 'templatecontent', 'type' => 'text'));
$metadata->mapField(array('fieldName' => 'templatecontentchecksum', 'type' => 'string', 'length' => 255));
$metadata->mapField(array('fieldName' => 'globalcontent', 'type' => 'text', 'nullable' => true));
$metadata->mapField(array('fieldName' => 'pagetype', 'type' => 'string', 'length' => 255, 'nullable' => true));
$metadata->mapField(array('fieldName' => 'pageattributes', 'type' => 'text', 'nullable' => true));
$metadata->mapField(array('fieldName' => 'lastupdate', 'type' => 'bigint', 'default' => 0));
}
示例2: loadMetadataForClass
/**
* {@inheritdoc}
*/
public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
{
if (null === $this->mappingData) {
$this->loadMappingData();
}
$shortName = $this->getShortName($className);
if (!isset($this->mappingData[$shortName])) {
throw new MappingException(sprintf('No mapping found for class "%s".', $className));
}
$mapping = array_merge(array('type' => 'entity', 'table' => $this->tableize($shortName), 'readOnly' => false, 'repositoryClass' => null), $this->mappingData[$shortName]);
switch ($mapping['type']) {
case 'entity':
$metadata->setCustomRepositoryClass($mapping['repositoryClass']);
if ($mapping['readOnly']) {
$metadata->markReadOnly();
}
break;
case 'mappedSuperclass':
$metadata->isMappedSuperclass = true;
break;
default:
throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
}
$metadata->setTableName($mapping['table']);
// map fields
foreach ($mapping['fields'] as $field => $fieldMapping) {
$this->mapField($field, $fieldMapping, $metadata);
}
if (0 === count($metadata->getIdentifier())) {
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
}
}
示例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: loadMetadataForClass
/**
* {@inheritdoc}
*/
public function loadMetadataForClass($className, \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
{
$element = $this->getElement($className, true);
// Customizing for Cloudrexx: YamlEntity extension
if ($element['type'] == 'YamlEntity') {
$metadata->setCustomRepositoryClass(isset($element['repositoryClass']) ? $element['repositoryClass'] : null);
$metadata->isMappedSuperclass = true;
}
parent::loadMetadataForClass($className, $metadata);
}
示例6: 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));
}
示例7: setCustomRepositoryClasses
private function setCustomRepositoryClasses(ClassMetadataInfo $metadata)
{
foreach ($this->classes as $class) {
if (array_key_exists('model', $class) && $class['model'] === $metadata->getName()) {
$metadata->isMappedSuperclass = false;
if (array_key_exists('repository', $class)) {
$metadata->setCustomRepositoryClass($class['repository']);
}
}
}
}
示例8: process
private function process(ClassMetadataInfo $metadata)
{
foreach ($this->classes as $application => $classes) {
foreach ($classes as $class) {
if (isset($class['model']) && $class['model'] === $metadata->getName()) {
$metadata->isMappedSuperclass = false;
if (isset($class['repository'])) {
$metadata->setCustomRepositoryClass($class['repository']);
}
} else {
if (isset($class['translation']['model']) && $class['translation']['model'] === $metadata->getName()) {
$metadata->isMappedSuperclass = false;
if (isset($class['translation']['repository'])) {
$metadata->setCustomRepositoryClass($class['translation']['repository']);
}
}
}
}
}
}
示例9: 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));
}
示例10: process
private function process(ClassMetadataInfo $metadata, $configuration)
{
foreach ($this->classes as $entity) {
if (isset($entity['model']) && $entity['model'] === $metadata->getName()) {
$metadata->isMappedSuperclass = false;
// $this->mergeFieldMappings($metadata, $configuration);
if (isset($entity['repository'])) {
$metadata->setCustomRepositoryClass($entity['repository']);
}
}
}
}
示例11: convertToEntityIfNeeded
/**
* @param ClassMetadataInfo $metadata
*/
private function convertToEntityIfNeeded(ClassMetadataInfo $metadata)
{
foreach ($this->resourceRegistry->getAll() as $alias => $resourceMetadata) {
if ($metadata->getName() !== $resourceMetadata->getClass('model')) {
continue;
}
if ($resourceMetadata->hasClass('repository')) {
$metadata->setCustomRepositoryClass($resourceMetadata->getClass('repository'));
}
$metadata->isMappedSuperclass = false;
}
}
示例12: loadMetadata
/**
* @param Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
*/
public static function loadMetadata(ORM\ClassMetadataInfo $metadata)
{
$metadata->setTableName('locks');
$metadata->setIdGeneratorType(ORM\ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setCustomRepositoryClass('Orm\\Repository\\LockRepository');
$metadata->mapField(array('fieldName' => 'userid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'runid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('id' => true, 'fieldName' => 'itemid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('id' => true, 'fieldName' => 'websiteid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('id' => true, 'fieldName' => 'type', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'starttime', 'type' => 'string', 'length' => 20));
$metadata->mapField(array('fieldName' => 'lastactivity', 'type' => 'string', 'length' => 20));
}
示例13: loadMetadata
/**
* @param Doctrine\ORM\Mapping\ClassMetadataInfo $metadata
*/
public static function loadMetadata(ORM\ClassMetadataInfo $metadata)
{
$metadata->setTableName('action_log');
$metadata->setIdGeneratorType(ORM\ClassMetadataInfo::GENERATOR_TYPE_IDENTITY);
$metadata->setCustomRepositoryClass('Orm\\Repository\\ActionLogRepository');
$metadata->mapField(array('id' => true, 'fieldName' => 'logid', 'type' => 'integer', 'generatedValue' => true));
$metadata->mapField(array('fieldName' => 'websiteid', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'id', 'type' => 'string', 'length' => 100));
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string', 'length' => 255));
$metadata->mapField(array('fieldName' => 'timestamp', 'type' => 'string', 'length' => 20));
$metadata->mapField(array('fieldName' => 'userlogin', 'type' => 'string', 'length' => 255));
$metadata->mapField(array('fieldName' => 'action', 'type' => 'string', 'length' => 255));
$metadata->mapField(array('fieldName' => 'additionalinfo', 'type' => 'text', 'nullable' => true));
}
示例14: toEntity
/**
* Transform a mapped superclass into entity if needed.
*
* @param ClassMetadataInfo $metadata
*/
private function toEntity(ClassMetadataInfo $metadata)
{
foreach ($this->classes as $name => $class) {
if (!is_array($class) || $class['class'] != $metadata->getName()) {
continue;
}
if (isset($class['class'])) {
$metadata->isMappedSuperclass = false;
}
if (isset($class['repository_class'])) {
$metadata->setCustomRepositoryClass($class['repository_class']);
}
}
}
示例15: loadMetadata
/**
* @param \Doctrine\ORM\Mapping\ClassMetadata $metadata
*/
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
{
$metadata->setTableName('user_group');
$metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_NONE);
$metadata->setCustomRepositoryClass('Orm\\Repository\\GroupRepository');
$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' => 'rights', 'type' => 'text', 'nullable' => true));
$metadata->mapField(array('fieldName' => 'users', 'type' => 'text'));
$metadata->mapField(array('fieldName' => 'lastupdate', 'type' => 'bigint', 'default' => 0));
}