File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ This project demonstrates how that would work.
1919### Limitations to TypeORM when using production builds
2020Since Ionic make a lot of optimizations when building for productions, the following limitations occur
21211 . Entities have to be marked with the table name (eg ` @Entity('table_name') ` )
22+ 2 . ` getRepository() ` has to be called with the name of the entity instead of the class (eg ` getRepository('post') as Repository<Post> ` )
22232 . Date fields aren't supported
2324``` ts
2425@Column ()
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { getRepository } from 'typeorm';
55import { Author } from '../../entities/author' ;
66import { Category } from '../../entities/category' ;
77import { Post } from '../../entities/post' ;
8+ import { Repository } from 'typeorm/repository/Repository' ;
89
910@Component ( {
1011 selector : 'page-home' ,
@@ -36,7 +37,7 @@ export class HomePage {
3637 post . categories = [ category1 , category2 ] ;
3738 post . author = author ;
3839
39- const postRepository = getRepository ( Post ) ;
40+ const postRepository = getRepository ( 'post' ) as Repository < Post > ;
4041 await postRepository . save ( post ) ;
4142
4243 console . log ( "Post has been saved" ) ;
You can’t perform that action at this time.
0 commit comments