PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: kilgore on May 26, 2008, 11:00:33



Title: Search accross multiple models MVC compliant
Post by: kilgore on May 26, 2008, 11:00:33
Hello,

I'm new to Flex, AS3 and PureMVC but not to MVC architecture.

I try to use an autocomplete field to do a search accross multiple models (2 for the moment but could be much more soon) and I don't know how to build that respecting the pureMVC best practises.

What do you think about that :
  • fill a SearchVO from a command with data from my different models (let's say Contact and Address)
  • dispatch a notification so my search panel mediator update the dataprovider of the autocomplete with data from the proxy
  • dispatch a notification when user hit the enter button in the notification field and run a command which try to find what the user search
  • dispatch a notification depending on the result of the change (CONTACT_FOUND, ADDRESS_FOUND, NOTHING_FOUND) so Mediator can update accordingly

Regards


Title: Re: Search accross multiple models MVC compliant
Post by: puremvc on May 26, 2008, 05:25:21
Sounds about right.

-=Cliff>


Title: Re: Search accross multiple models MVC compliant
Post by: kilgore on May 27, 2008, 02:16:19
It won't be better to use a SearchProxy rather than a SearchCommand and to fill the Vo from the proxy with data from other Proxy (ContactProxy and AddressProxy) ?


Title: Re: Search accross multiple models MVC compliant
Post by: puremvc on May 27, 2008, 05:39:06
Sure, that'll work just fine. It could go in a SearchProxy or a SearchCommand.

Actually, though I don't like Commands that much, this is probably more appropriate in a Command. Since the combined data on the VO is not really a domain object but a value object with pieces of data from other domain objects, the assembly of that data to support the view should be done by a Command.

-=Cliff>