Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
December 18, 2017, 04:02:48 AM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: Best Practices for Sending Messages to Mediators from Views  (Read 4581 times)
mikebritton
Full Member
***
Posts: 42


View Profile Email
« on: August 20, 2009, 01:45:15 PM »

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 PM »

Here's what I intend to do.

In index.php:

Code:
$protoManager = new PrototyperManager();

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

In the same package as ApplicationFacade.php:

Code:
<?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
Jump to: