Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Best Practices for Sending Messages to Mediators from Views  (Read 4978 times)
mikebritton
Full Member
***
Posts: 42


View Profile Email
« 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.
Logged
mikebritton
Full Member
***
Posts: 42


View Profile Email
« Reply #1 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;
   }
}
}

?>


Logged
Pages: [1]
Print