本文整理匯總了PHP中Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder::createOneToMany方法的典型用法代碼示例。如果您正苦於以下問題:PHP ClassMetadataBuilder::createOneToMany方法的具體用法?PHP ClassMetadataBuilder::createOneToMany怎麽用?PHP ClassMetadataBuilder::createOneToMany使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder
的用法示例。
在下文中一共展示了ClassMetadataBuilder::createOneToMany方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('roles')->setCustomRepositoryClass('Mautic\\UserBundle\\Entity\\RoleRepository');
$builder->addIdColumns();
$builder->createField('isAdmin', 'boolean')->columnName('is_admin')->build();
$builder->createOneToMany('permissions', 'Permission')->orphanRemoval()->mappedBy('role')->cascadePersist()->cascadeRemove()->fetchExtraLazy()->build();
$builder->createField('rawPermissions', 'array')->columnName('readable_permissions')->build();
$builder->createOneToMany('users', 'User')->mappedBy('role')->fetchExtraLazy()->build();
}
示例2: addVariantMetadata
/**
* @param ClassMetadata $builder
* @param $entityClass
*/
protected static function addVariantMetadata(ClassMetadataBuilder $builder, $entityClass)
{
$builder->createManyToOne('variantParent', $entityClass)->inversedBy('variantChildren')->addJoinColumn('variant_parent_id', 'id', true, false, 'CASCADE')->build();
$builder->createOneToMany('variantChildren', $entityClass)->setIndexBy('id')->setOrderBy(['isPublished' => 'DESC'])->mappedBy('variantParent')->build();
$builder->createField('variantSettings', 'array')->columnName('variant_settings')->nullable()->build();
$builder->createField('variantStartDate', 'datetime')->columnName('variant_start_date')->nullable()->build();
}
示例3: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('webhooks')->setCustomRepositoryClass('Mautic\\WebhookBundle\\Entity\\WebhookRepository');
// id columns
$builder->addIdColumns();
// categories
$builder->addCategory();
// 1:M for events
$builder->createOneToMany('events', 'Event')->orphanRemoval()->setIndexBy('event_type')->mappedBy('webhook')->cascadePersist()->build();
// 1:M for queues
$builder->createOneToMany('queues', 'WebhookQueue')->mappedBy('webhook')->fetchExtraLazy()->cascadePersist()->build();
// 1:M for logs
$builder->createOneToMany('logs', 'Log')->setOrderBy(['dateAdded' => 'DESC'])->fetchExtraLazy()->mappedBy('webhook')->cascadePersist()->build();
// status code
$builder->createField('webhookUrl', 'string')->columnName('webhook_url')->length(255)->build();
}
示例4: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('lead_lists')->setCustomRepositoryClass('Mautic\\LeadBundle\\Entity\\LeadListRepository');
$builder->addIdColumns();
$builder->addField('alias', 'string');
$builder->addField('filters', 'array');
$builder->createField('isGlobal', 'boolean')->columnName('is_global')->build();
$builder->createOneToMany('leads', 'ListLead')->setIndexBy('id')->mappedBy('list')->fetchExtraLazy()->build();
}
示例5: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('stages')->setCustomRepositoryClass('Mautic\\StageBundle\\Entity\\StageRepository');
$builder->addIdColumns();
$builder->createField('weight', 'integer')->build();
$builder->addPublishDates();
$builder->createOneToMany('log', 'LeadStageLog')->mappedBy('stage')->cascadePersist()->cascadeRemove()->fetchExtraLazy()->build();
$builder->addCategory();
}
示例6: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('oauth1_consumers')->setCustomRepositoryClass('Mautic\\ApiBundle\\Entity\\oAuth1\\ConsumerRepository')->addLifecycleEvent('createConsumerKeys', 'prePersist')->addIndex(array('consumer_key'), 'consumer_search');
$builder->addIdColumns('name', false);
$builder->createField('consumerKey', 'string')->columnName('consumer_key')->build();
$builder->createField('consumerSecret', 'string')->columnName('consumer_secret')->build();
$builder->addField('callback', 'string');
$builder->createOneToMany('accessTokens', 'AccessToken')->setIndexBy('id')->mappedBy('consumer')->fetchExtraLazy()->build();
}
示例7: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('page_redirects')->setCustomRepositoryClass('Mautic\\PageBundle\\Entity\\RedirectRepository');
$builder->addId();
$builder->createField('redirectId', 'string')->columnName('redirect_id')->length(25)->build();
$builder->addField('url', 'text');
$builder->addField('hits', 'integer');
$builder->createField('uniqueHits', 'integer')->columnName('unique_hits')->build();
$builder->createOneToMany('trackables', 'Trackable')->mappedBy('redirect')->fetchExtraLazy()->build();
}
示例8: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('plugins')->setCustomRepositoryClass('Mautic\\PluginBundle\\Entity\\PluginRepository')->addUniqueConstraint(['bundle'], 'unique_bundle');
$builder->addIdColumns();
$builder->createField('isMissing', 'boolean')->columnName('is_missing')->build();
$builder->createField('bundle', 'string')->length(50)->build();
$builder->createField('version', 'string')->nullable()->build();
$builder->createField('author', 'string')->nullable()->build();
$builder->createOneToMany('integrations', 'Integration')->setIndexBy('id')->mappedBy('plugin')->fetchExtraLazy()->build();
}
示例9: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('point_trigger_events')->setCustomRepositoryClass('Mautic\\PointBundle\\Entity\\TriggerEventRepository')->addIndex(['type'], 'trigger_type_search');
$builder->addIdColumns();
$builder->createField('type', 'string')->length(50)->build();
$builder->createField('order', 'integer')->columnName('action_order')->build();
$builder->addField('properties', 'array');
$builder->createManyToOne('trigger', 'Trigger')->inversedBy('events')->addJoinColumn('trigger_id', 'id', false, false, 'CASCADE')->build();
$builder->createOneToMany('log', 'LeadTriggerLog')->mappedBy('event')->cascadePersist()->cascadeRemove()->fetchExtraLazy()->build();
}
示例10: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('webhook_events')->setCustomRepositoryClass('Mautic\\WebhookBundle\\Entity\\EventRepository');
// id columns
$builder->addId();
// M:1 for webhook
$builder->createManyToOne('webhook', 'Webhook')->inversedBy('events')->addJoinColumn('webhook_id', 'id', false, false, 'CASCADE')->build();
// 1:M for queues
$builder->createOneToMany('queues', 'WebhookQueue')->mappedBy('event')->build();
// event type field
$builder->createField('event_type', 'string')->columnName('event_type')->length(50)->build();
}
示例11: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('push_notifications')->setCustomRepositoryClass('Mautic\\NotificationBundle\\Entity\\NotificationRepository');
$builder->addIdColumns();
$builder->createField('language', 'string')->columnName('lang')->build();
$builder->createField('url', 'text')->nullable()->build();
$builder->createField('heading', 'text')->build();
$builder->createField('message', 'text')->build();
$builder->createField('notificationType', 'text')->columnName('notification_type')->nullable()->build();
$builder->addPublishDates();
$builder->createField('readCount', 'integer')->columnName('read_count')->build();
$builder->createField('sentCount', 'integer')->columnName('sent_count')->build();
$builder->addCategory();
$builder->createManyToMany('lists', 'Mautic\\LeadBundle\\Entity\\LeadList')->setJoinTable('push_notification_list_xref')->setIndexBy('id')->addInverseJoinColumn('leadlist_id', 'id', false, false, 'CASCADE')->addJoinColumn('notification_id', 'id', false, false, 'CASCADE')->fetchExtraLazy()->build();
$builder->createOneToMany('stats', 'Stat')->setIndexBy('id')->mappedBy('notification')->cascadePersist()->fetchExtraLazy()->build();
}
示例12: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('campaigns')->setCustomRepositoryClass('Mautic\\CampaignBundle\\Entity\\CampaignRepository');
$builder->addIdColumns();
$builder->addPublishDates();
$builder->addCategory();
$builder->createOneToMany('events', 'Event')->setIndexBy('id')->setOrderBy(['order' => 'ASC'])->mappedBy('campaign')->cascadeAll()->fetchExtraLazy()->build();
$builder->createOneToMany('leads', 'Lead')->setIndexBy('id')->mappedBy('campaign')->fetchExtraLazy()->build();
$builder->createManyToMany('lists', 'Mautic\\LeadBundle\\Entity\\LeadList')->setJoinTable('campaign_leadlist_xref')->setIndexBy('id')->addInverseJoinColumn('leadlist_id', 'id', false, false, 'CASCADE')->addJoinColumn('campaign_id', 'id', true, false, 'CASCADE')->build();
$builder->createManyToMany('forms', 'Mautic\\FormBundle\\Entity\\Form')->setJoinTable('campaign_form_xref')->setIndexBy('id')->addInverseJoinColumn('form_id', 'id', false, false, 'CASCADE')->addJoinColumn('campaign_id', 'id', true, false, 'CASCADE')->build();
$builder->createField('canvasSettings', 'array')->columnName('canvas_settings')->nullable()->build();
}
示例13: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('point_triggers')->setCustomRepositoryClass('Mautic\\PointBundle\\Entity\\TriggerRepository');
$builder->addIdColumns();
$builder->addPublishDates();
$builder->addField('points', 'integer');
$builder->createField('color', 'string')->length(7)->build();
$builder->createField('triggerExistingLeads', 'boolean')->columnName('trigger_existing_leads')->build();
$builder->addCategory();
$builder->createOneToMany('events', 'TriggerEvent')->setIndexBy('id')->setOrderBy(array('order' => 'ASC'))->mappedBy('trigger')->cascadeAll()->fetchExtraLazy()->build();
}
示例14: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('points')->setCustomRepositoryClass('Mautic\\PointBundle\\Entity\\PointRepository')->addIndex(array('type'), 'point_type_search');
$builder->addIdColumns();
$builder->createField('type', 'string')->length(50)->build();
$builder->addPublishDates();
$builder->addField('delta', 'integer');
$builder->addField('properties', 'array');
$builder->createOneToMany('log', 'LeadPointLog')->mappedBy('point')->cascadePersist()->cascadeRemove()->fetchExtraLazy()->build();
$builder->addCategory();
}
示例15: loadMetadata
/**
* @param ORM\ClassMetadata $metadata
*/
public static function loadMetadata(ORM\ClassMetadata $metadata)
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('leads')->setCustomRepositoryClass('Mautic\\LeadBundle\\Entity\\LeadRepository')->addLifecycleEvent('checkDateIdentified', 'preUpdate')->addLifecycleEvent('checkDateIdentified', 'prePersist')->addLifecycleEvent('checkAttributionDate', 'preUpdate')->addLifecycleEvent('checkAttributionDate', 'prePersist')->addIndex(['date_added'], 'lead_date_added');
$builder->createField('id', 'integer')->isPrimaryKey()->generatedValue()->build();
$builder->createManyToOne('owner', 'Mautic\\UserBundle\\Entity\\User')->addJoinColumn('owner_id', 'id', true, false, 'SET NULL')->build();
$builder->createField('points', 'integer')->build();
$builder->createOneToMany('pointsChangeLog', 'PointsChangeLog')->orphanRemoval()->setOrderBy(['dateAdded' => 'DESC'])->mappedBy('lead')->cascadeAll()->fetchExtraLazy()->build();
$builder->createOneToMany('companyChangeLog', 'CompanyChangeLog')->orphanRemoval()->setOrderBy(['dateAdded' => 'DESC'])->mappedBy('lead')->cascadeAll()->fetchExtraLazy()->build();
$builder->createOneToMany('doNotContact', 'Mautic\\LeadBundle\\Entity\\DoNotContact')->orphanRemoval()->mappedBy('lead')->cascadePersist()->fetchExtraLazy()->build();
$builder->createManyToMany('ipAddresses', 'Mautic\\CoreBundle\\Entity\\IpAddress')->setJoinTable('lead_ips_xref')->addInverseJoinColumn('ip_id', 'id', false)->addJoinColumn('lead_id', 'id', false, false, 'CASCADE')->setIndexBy('ipAddress')->cascadeMerge()->cascadePersist()->cascadeDetach()->build();
$builder->createOneToMany('pushIds', 'Mautic\\NotificationBundle\\Entity\\PushID')->orphanRemoval()->mappedBy('lead')->cascadeAll()->fetchExtraLazy()->build();
$builder->createField('lastActive', 'datetime')->columnName('last_active')->nullable()->build();
$builder->createField('internal', 'array')->nullable()->build();
$builder->createField('socialCache', 'array')->columnName('social_cache')->nullable()->build();
$builder->createField('dateIdentified', 'datetime')->columnName('date_identified')->nullable()->build();
$builder->createOneToMany('notes', 'LeadNote')->orphanRemoval()->setOrderBy(['dateAdded' => 'DESC'])->mappedBy('lead')->fetchExtraLazy()->build();
$builder->createField('preferredProfileImage', 'string')->columnName('preferred_profile_image')->nullable()->build();
$builder->createManyToMany('tags', 'Mautic\\LeadBundle\\Entity\\Tag')->setJoinTable('lead_tags_xref')->addInverseJoinColumn('tag_id', 'id', false)->addJoinColumn('lead_id', 'id', false, false, 'CASCADE')->setOrderBy(['tag' => 'ASC'])->setIndexBy('tag')->fetchLazy()->cascadeMerge()->cascadePersist()->cascadeDetach()->build();
$builder->createManyToOne('stage', 'Mautic\\StageBundle\\Entity\\Stage')->cascadePersist()->cascadeMerge()->addJoinColumn('stage_id', 'id', true, false, 'SET NULL')->build();
$builder->createOneToMany('stageChangeLog', 'StagesChangeLog')->orphanRemoval()->setOrderBy(['dateAdded' => 'DESC'])->mappedBy('lead')->cascadeAll()->fetchExtraLazy()->build();
$builder->createOneToMany('utmtags', 'Mautic\\LeadBundle\\Entity\\UtmTag')->orphanRemoval()->mappedBy('lead')->cascadeAll()->fetchExtraLazy()->build();
$builder->createOneToMany('frequencyRules', 'Mautic\\LeadBundle\\Entity\\FrequencyRule')->orphanRemoval()->setIndexBy('channel')->setOrderBy(['dateAdded' => 'DESC'])->mappedBy('lead')->cascadeAll()->fetchExtraLazy()->build();
}