Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $types = [
- 'authors' => [
- iType::PROP_IDENTIFY_FIELD => 'id',
- iManager::PROP_RELATION_NAMES => [
- 'posts' => [
- iRelation::PROP_RELATIONSHIP => 'HasMany',
- iRelation::PROP_NATIVE_FIELD => 'id',
- iRelation::PROP_FOREIGN_FIELD => 'authorId',
- ],
- ],
- ],
- 'posts' => [
- iType::PROP_IDENTIFY_FIELD => 'id',
- iType::PROP_INDEX_FIELDS => [
- 'authorId',
- ],
- iManager::PROP_RELATION_NAMES => [
- 'meta' => [
- iRelation::PROP_RELATIONSHIP => 'HasOne',
- iRelation::PROP_FOREIGN_TYPE => 'metas',
- iRelation::PROP_NATIVE_FIELD => 'id',
- iRelation::PROP_FOREIGN_FIELD => 'postId',
- ],
- 'comments' => [
- iRelation::PROP_RELATIONSHIP => 'HasMany',
- iRelation::PROP_NATIVE_FIELD => 'id',
- iRelation::PROP_FOREIGN_FIELD => 'postId'
- ],
- 'author' => [
- iRelation::PROP_RELATIONSHIP => 'BelongsTo',
- iRelation::PROP_FOREIGN_TYPE => 'authors',
- iRelation::PROP_NATIVE_FIELD => 'authorId',
- iRelation::PROP_FOREIGN_FIELD => 'id',
- ],
- 'tags' => [
- iRelation::PROP_RELATIONSHIP => 'HasManyThrough',
- iRelation::PROP_THROUGH_TYPE => 'posts_tags',
- iRelation::PROP_NATIVE_FIELD => 'id',
- iRelation::PROP_THROUGH_NATIVE_FIELD => 'postId',
- iRelation::PROP_THROUGH_FOREIGN_FIELD => 'tagId',
- iRelation::PROP_FOREIGN_FIELD => 'id'
- ],
- ],
- ],
- 'metas' => [
- iType::PROP_IDENTIFY_FIELD => 'id',
- iType::PROP_INDEX_FIELDS => [
- 'postId',
- ],
- iManager::PROP_RELATION_NAMES => [
- 'post' => [
- iRelation::PROP_RELATIONSHIP => 'BelongsTo',
- iRelation::PROP_FOREIGN_TYPE => 'posts',
- iRelation::PROP_NATIVE_FIELD => 'postId',
- iRelation::PROP_FOREIGN_FIELD => 'id',
- ],
- ],
- ],
- 'comments' => [
- iType::PROP_IDENTIFY_FIELD => 'id',
- iType::PROP_INDEX_FIELDS => [
- 'postId',
- ],
- iManager::PROP_RELATION_NAMES => [
- 'post' => [
- iRelation::PROP_RELATIONSHIP => 'BelongsTo',
- iRelation::PROP_FOREIGN_TYPE => 'posts',
- iRelation::PROP_NATIVE_FIELD => 'postId',
- iRelation::PROP_FOREIGN_FIELD => 'id',
- ],
- 'author' => [
- iRelation::PROP_RELATIONSHIP => 'BelongsTo',
- iRelation::PROP_FOREIGN_TYPE => 'authors',
- iRelation::PROP_NATIVE_FIELD => 'authorId',
- iRelation::PROP_FOREIGN_FIELD => 'id',
- ],
- ],
- ],
- 'posts_tags' => [
- iType::PROP_IDENTIFY_FIELD => 'id',
- iType::PROP_INDEX_FIELDS => [
- 'postId',
- 'tagId',
- ],
- iManager::PROP_RELATION_NAMES => [
- 'post' => [
- iRelation::PROP_RELATIONSHIP => 'BelongsTo',
- iRelation::PROP_FOREIGN_TYPE => 'posts',
- iRelation::PROP_NATIVE_FIELD => 'postId',
- iRelation::PROP_FOREIGN_FIELD => 'id',
- ],
- 'tag' => [
- iRelation::PROP_RELATIONSHIP => 'BelongsTo',
- iRelation::PROP_FOREIGN_TYPE => 'tags',
- iRelation::PROP_NATIVE_FIELD => 'tagId',
- iRelation::PROP_FOREIGN_FIELD => 'id',
- ],
- ]
- ],
- 'tags' => [
- iType::PROP_IDENTIFY_FIELD => 'id',
- iManager::PROP_RELATION_NAMES => [
- 'posts' => [
- iRelation::PROP_RELATIONSHIP => 'HasManyThrough',
- iRelation::PROP_NATIVE_FIELD => 'id',
- iRelation::PROP_THROUGH_TYPE => 'posts_tags',
- iRelation::PROP_THROUGH_NATIVE_FIELD => 'tagId',
- iRelation::PROP_THROUGH_FOREIGN_FIELD => 'postId',
- iRelation::PROP_FOREIGN_FIELD => 'id'
- ],
- ],
- ],
- ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement