PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: mikebritton on August 20, 2009, 01:45:15



Title: Best Practices for Sending Messages to Mediators from Views
Post by: mikebritton on August 20, 2009, 01:45:15
In the the AS3 port, my views have event constants defined and I handle them in my Mediators, which then send Notifications.

In the PHP port, I have a Manager class that looks for $_GET or $_POST and uses the Facade to send Notifications.  I'd rather communicate back to my views' Mediators without going through the facade.

Just wondering what you all are doing.


Title: Re: Best Practices for Sending Messages to Mediators from Views
Post by: mikebritton on August 21, 2009, 12:06:57
Here's what I intend to do.

In index.php:

:
$protoManager = new PrototyperManager();

if (sizeof($_POST)>0) {
    $protoManager->sendPost($_POST);
}

In the same package as ApplicationFacade.php:

:
<?php
/**
 * PrototyperManager
 * PureMVC CRUD for Flex Prototyper System
 *
 * @author Mike Britton :: mike@mikebritton.com
 * 
 * Created on Aug 20, 2009
 */

require_once $_SESSION['relpath'].'/ApplicationFacade.php';

/**
 * PrototyperManager base class.  The index starts an
 * instance of the object to start the application
 * view calling the <code>startView()</code> method.
 */
class PrototyperManager
{
public function __construct()
{
   //
}

/**
 * Starts the PureMVC framework passing in variables
 * from the index.php
 */
public function startView$filename$pageName )
{
$facade ApplicationFacade::getInstance();
$facade->startUp$filename$pageName );
}

public function sendPost($formPost)
{
   switch($formPost["type"]) {
       case "login":
           
       break;
   }
}
}

?>