Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 03 2017 20:53
    tejainece opened #101
  • Jun 03 2017 20:52
    tejainece closed #100
  • Jun 03 2017 20:41
    tejainece synchronize #100
  • Jun 03 2017 20:15
    tejainece opened #100
  • Jun 03 2017 19:46

    tejainece on master

    Merge pull request #25 from Jag… Jaguar 0.5.x primary changes Big step towards 0.5.0 and 1 more (compare)

  • Jun 03 2017 19:46
    tejainece closed #99
  • Jun 03 2017 18:18
    tejainece opened #99
  • Mar 09 2017 18:38
    tejainece closed #98
  • Mar 09 2017 18:38
    tejainece commented #98
  • Mar 04 2017 08:39
    tejainece opened #98
  • Mar 03 2017 15:43
    tejainece closed #95
  • Mar 03 2017 15:43
    tejainece commented #95
  • Feb 28 2017 17:00
    lejard-h assigned #97
  • Feb 28 2017 17:00
    lejard-h assigned #96
  • Feb 28 2017 17:00
    lejard-h opened #97
  • Feb 28 2017 17:00
    lejard-h opened #96
  • Feb 28 2017 16:58
    lejard-h closed #90
  • Feb 28 2017 16:58
    lejard-h commented #90
  • Feb 27 2017 21:39

    Kleak on master

    Version bump Merge pull request #24 from Jag… Added glob route matching witho… and 2 more (compare)

  • Feb 27 2017 21:39
    Kleak closed #92
Ravi Teja Gudapati
@tejainece
class CodiciIVA extends BaseModel {
  @PrimaryKey()
  String codice = "";
  String descrizione = "";
  num percentuale = 0;
  int noImponibile = 0;

  @HasOne(ArticoliBean)
  Articoli articoli;
}


class Articoli extends BaseModel {
  @PrimaryKey()
  String codice = "";
  @BelongsTo(CodiciIVABean, refCol: 'codice')
  String codiceIVA;
}
@GenBean()
class CodiciIVABean extends Bean<CodiciIVA> with _CodiciIVABean {
  CodiciIVABean(Adapter adapter)
      : addressBean = ArticoliBean(adapter),
        super(adapter);

  final ArticoliBean addressBean;

  String get tableName => 'CodiciIVA';
}

@GenBean()
class Articoli Bean extends Bean<Articoli> with _Articoli Bean {
  CodiciIVABean _codiciIVABean;
 CodiciIVABean get codiciIVABean => _codiciIVABean ??= CodiciIVABean(adapter);

  Articoli Bean(Adapter adapter) : super(adapter);

  String get tableName => 'Articoli';
}
Massimo Caroccia
@carmas123
ok I try it
Exception: Foreign key in foreign model not found!
Ravi Teja Gudapati
@tejainece
Try @BelongsTo(CodiciIVABean, refCol: 'codice')
refCol defaults to id. In your case, the reference column is codice in the other table
Did it work?
Massimo Caroccia
@carmas123
ok now the generation work fin
fine
only one problem now
to access to CodiciIVA.percentuale from Articoli class?
Sorry only a question
when I work with Jaguar orm I need to handle the Bean class or model class
for example
if I have a list of product
Ravi Teja Gudapati
@tejainece
all the database stuff you use bean
Massimo Caroccia
@carmas123
ok but when I need to fetch a list of items
the bean return the model class
Ravi Teja Gudapati
@tejainece
final codiciIVA = await articoliBean.findByUser(articoli.id);
codiciIVA.percentuale;
yes
the bean talks to database
I will implement a way to preload parent from child
in your case, with current jaguar, i would do
articoli.codiciIVA = await articoliBean.findByUser(articoli.id);
articoli.codiciIVA.percentuale;
Massimo Caroccia
@carmas123
oh yes this is really good
but not really functional
Ravi Teja Gudapati
@tejainece
yes i agree
What do you mean functional?
Massimo Caroccia
@carmas123
because I need call an await method to read the values
Ravi Teja Gudapati
@tejainece
ok
Massimo Caroccia
@carmas123
the parent values are not available when the model class is created
Ravi Teja Gudapati
@tejainece
I will implement preloading parents for child model
Massimo Caroccia
@carmas123
this is a really good new :)
Kevin Segaud
@Kleak
asyncMap can help you to transform it no ?
Ravi Teja Gudapati
@tejainece
yes
Massimo Caroccia
@carmas123
news
Ravi Teja Gudapati
@tejainece
yes one could do with async map and then for lists and ones
Massimo Caroccia
@carmas123
yes this is true the best way in my opinion is to have in child class the reference with parent class that lazy load the parent class
Ravi Teja Gudapati
@tejainece
@carmas123 PRs are welcome. i will implement this. It will take some time
basically you will be able to do
Kevin Segaud
@Kleak
  Observable.fromFuture(getArticoli).asyncMap((articoli) async {
    articoli.codiciIVA = await articoliBean.findByUser(articoli.id);
    return articoli;
  }).listen((value) => print(value));
Ravi Teja Gudapati
@tejainece
or something like that
Massimo Caroccia
@carmas123
yes
Ravi Teja Gudapati
@tejainece
class CodiciIVA extends BaseModel {
  @PrimaryKey()
  String codice = "";
  String descrizione = "";
  num percentuale = 0;
  int noImponibile = 0;

  @HasOne(ArticoliBean)
  Articoli articoli;
}


class Articoli extends BaseModel {
  @PrimaryKey()
  String codice = "";
  @BelongsTo(CodiciIVABean, refCol: 'codice')
  String codiceIVAId;

  @Parent()
  CodiciIVA codiciIVA;
}
Massimo Caroccia
@carmas123
kevin you solution is good .... but when we work with an ORM we must have the best way to solve the problem and not an adaptive solution . ;)
Ravi Teja Gudapati
@tejainece
Thanks for the inputs @carmas123.
Massimo Caroccia
@carmas123
however for now I can use your solution
you are welcome
Revi...
sorry I don't know how the annotation generation work in dart...but the real best way is this: