Skip to content

Commit

Permalink
refactor: Updated comments for grammar and punctuation in OneToMany.ts (
Browse files Browse the repository at this point in the history
#7129)

Co-authored-by: Rohan Talip <rohantalip@blend.com>
Co-authored-by: AlexMesser <dmzt08@gmail.com>
  • Loading branch information
3 people committed Feb 6, 2021
1 parent 889bdbc commit b466edd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/decorator/relations/OneToMany.ts
Expand Up @@ -2,14 +2,15 @@ import {getMetadataArgsStorage, ObjectType, RelationOptions} from "../../";
import {RelationMetadataArgs} from "../../metadata-args/RelationMetadataArgs";

/**
* One-to-many relation allows us to create a type of relation where Entity1 can have multiple instances of Entity2.
* Entity2 has only one Entity1. Entity2 is the owner of the relationship and stores Entity1's id on its own side.
* A one-to-many relation allows creating the type of relation where Entity1 can have multiple instances of Entity2,
* but Entity2 has only one Entity1. Entity2 is the owner of the relationship, and stores the id of Entity1 on its
* side of the relation.
*/
export function OneToMany<T>(typeFunctionOrTarget: string|((type?: any) => ObjectType<T>), inverseSide: string|((object: T) => any), options?: RelationOptions): PropertyDecorator {
return function (object: Object, propertyName: string) {
if (!options) options = {} as RelationOptions;

// now try to determine it its lazy relation
// Now try to determine if it is a lazy relation.
let isLazy = options && options.lazy === true ? true : false;
if (!isLazy && Reflect && (Reflect as any).getMetadata) { // automatic determination
const reflectedType = (Reflect as any).getMetadata("design:type", object, propertyName);
Expand Down

0 comments on commit b466edd

Please sign in to comment.