| 71 | } |
| 72 | |
| 73 | static notDiscoveredEntity(data: any, meta?: EntityMetadata, action = 'persist'): ValidationError { |
| 74 | /* v8 ignore next */ |
| 75 | const type = meta?.className ?? /\[object (\w+)]/.exec(Object.prototype.toString.call(data))![1].toLowerCase(); |
| 76 | let err = `Trying to ${action} not discovered entity of type ${type}.`; |
| 77 | |
| 78 | if (meta) { |
| 79 | err += ` Entity with this name was discovered, but not the prototype you are passing to the ORM. If using EntitySchema, be sure to point to the implementation via \`class\`.`; |
| 80 | } |
| 81 | |
| 82 | return new ValidationError(err); |
| 83 | } |
| 84 | |
| 85 | static invalidPropertyName(entityName: EntityName, invalid: string): ValidationError { |
| 86 | return new ValidationError(`Entity '${Utils.className(entityName)}' does not have property '${invalid}'`); |