Fornax-Platform
Forum

scaffold and services in the model

View: New views
3 Messages — Rating Filter:   Alert me  

scaffold and services in the model

by Sascha Broich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

when I use scaffold for an entity I'm not able to use the entity's repository in a service written in the model.
There is always a workflow error "Couldn't resolve reference to EntityRepository" during validation.
So the scaffold parameter is useless because I have to create the repository and its methods in my model anyway.

Is there a way to use the scaffold parameter and create a service in the model?


Regards,
Sascha Broich
--
TSA - Teleport Sachsen-Anhalt Service GmbH
Delitzscher Straße 70, 06112 Halle
Tel: +49 39203 8 2524 - Fax:
Mobil:   - E-Mail: Sascha.Broich@...

Firmensitz: Steinfeldstraße 5, D-39179 Barleben
Geschäftsführer: Marco Langhof
Amtsgericht: Stendal HRB 6388
http://www.tsa.de




------------------------------------------------------------------------------
_______________________________________________
Fornax-developer mailing list
Fornax-developer@...
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Re: scaffold and services in the model

by Patrik Nordwall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That is true. Scaffold is mostly for prototyping or simple scenarios.

If you need to inject the repository you need to define an empty repository.

    Service SomeService {
    inject @MyEntityRepository
   
    @MyEntity doSomething;
    }
   
    Entity MyEntity {
    scaffold
    String name
   
    Repository MyEntityRepository {
    }
    }

When delegating from service to repository you need to define at least the operation you are delegating to.

    Service SomeService {
    saveMyEntity => @MyEntityRepository.save;
    }
   
    Entity MyEntity {
    scaffold
    String name
   
    Repository MyEntityRepository {
    save;
    }
    }

And you can use scaffold but add your own additional operations.

    Service MyEntityService {
    doSomethingElse => @MyEntityRepository.somethingElse;
    }
   
    Entity MyEntity {
    scaffold
    String name
   
    Repository MyEntityRepository {
    @MyEntity somethingElse(String foo);
    }
    }


I'm not sure if this helps. Please explain your scenario more if you need further clarification.

/Patrik

Sascha Broich wrote:
Hello,

when I use scaffold for an entity I'm not able to use the entity's repository in a service written in the model.
There is always a workflow error "Couldn't resolve reference to EntityRepository" during validation.
So the scaffold parameter is useless because I have to create the repository and its methods in my model anyway.

Is there a way to use the scaffold parameter and create a service in the model?


Regards,
Sascha Broich
--
TSA - Teleport Sachsen-Anhalt Service GmbH
Delitzscher Straße 70, 06112 Halle
Tel: +49 39203 8 2524 - Fax:
Mobil:   - E-Mail: Sascha.Broich@tsa.de

Firmensitz: Steinfeldstraße 5, D-39179 Barleben
Geschäftsführer: Marco Langhof
Amtsgericht: Stendal HRB 6388
http://www.tsa.de




------------------------------------------------------------------------------
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Re: scaffold and services in the model

by Sascha Broich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Von: Patrik Nordwall [mailto:patrik.nordwall@...]
> That is true. Scaffold is mostly for prototyping or simple scenarios.

This could be said more explicit in the documentation.

> If you need to inject the repository you need to define an empty repository.
> When delegating from service to repository you need to define at least the
> operation you are delegating to.

That is, what renders scaffold useless when it comes to a not-every-entity-has-its-own-service situation.


Regards,
Sascha Broich
--
TSA - Teleport Sachsen-Anhalt Service GmbH
Delitzscher Straße 70, 06112 Halle
Tel: +49 39203 8 2524 - Fax:
Mobil:   - E-Mail: Sascha.Broich@...

Firmensitz: Steinfeldstraße 5, D-39179 Barleben
Geschäftsführer: Marco Langhof
Amtsgericht: Stendal HRB 6388
http://www.tsa.de
------------------------------------------------------------------------------
_______________________________________________
Fornax-developer mailing list
Fornax-developer@...
https://lists.sourceforge.net/lists/listinfo/fornax-developer