[geeklog-cvs] Geeklog-2/commands BaseCommand.php,1.1.1.1,1.2 BaseCommandUser.php,1.1.1.1,1.2

tony at iowaoutdoors.org tony at iowaoutdoors.org
Mon Dec 20 17:14:55 EST 2004


Update of /var/cvs/Geeklog-2/commands
In directory www:/tmp/cvs-serv28419

Modified Files:
	BaseCommand.php BaseCommandUser.php 
Log Message:
Fixed base classes to work


Index: BaseCommandUser.php
===================================================================
RCS file: /var/cvs/Geeklog-2/commands/BaseCommandUser.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** BaseCommandUser.php	17 Dec 2004 23:35:47 -0000	1.1.1.1
--- BaseCommandUser.php	20 Dec 2004 22:14:52 -0000	1.2
***************
*** 10,15 ****
  	}
  	
! 	public function setUser($usr){
! 		$this->user = $usr;
  	}
  	
--- 10,15 ----
  	}
  	
! 	public function setUser($user){
! 		$this->user = $user;
  	}
  	

Index: BaseCommand.php
===================================================================
RCS file: /var/cvs/Geeklog-2/commands/BaseCommand.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** BaseCommand.php	17 Dec 2004 23:35:47 -0000	1.1.1.1
--- BaseCommand.php	20 Dec 2004 22:14:52 -0000	1.2
***************
*** 1,10 ****
  <?php
  
  require_once 'MVCnPHP/CommandInterface.php';
  
  abstract class Geeklog_BaseCommand implements MVCnPHP_CommandInterface {
!    protected function requestToObjects()
  	{
  		$postVars = array_keys($_REQUEST);
  		foreach ($postVars as $curVarName) {
  			if (stristr($curVarName, '->')) {
--- 1,49 ----
  <?php
  
+ /* Reminder: always indent with 4 spaces (no tabs). */
+ /**
+  * Geeklog 2
+  *
+  * License Details To Be Determined
+  *
+  */
+  
+ /**
+  * The MVCnPHP command interface
+  */
  require_once 'MVCnPHP/CommandInterface.php';
  
+ /**
+  * Base command on which all other commands are built on
+  *
+  * This class provides some basic utility methods to the children of this clas
+  *
+  * @author Tony Bibbs <tony at geeklog.net>
+  * @copyright 2004 Tony Bibbs
+  *
+  */
  abstract class Geeklog_BaseCommand implements MVCnPHP_CommandInterface {
! 	/**
! 	 * Converts data submitted via the request into domain objects
! 	 *
! 	 * This function can be quite handy as it will convert form-based data over to domain objects
! 	 * granted your form field names adhere to the strict standard of <domainobject>-><property>. 
! 	 * So, for example, if you have a form field named GL2User->username this method will create
! 	 * a GL2User object and set the username.  
! 	 *
! 	 * @author Tony Bibbs <tony at geeklog.net>
! 	 * @access protected
! 	 * @return array Collection of domain objects
! 	 * @todo This function is currently unsophisticated.  More features may be added to this to do 
! 	 * things like allow associated one domain object as a property on another domain object.  
! 	 * Until we have a need I'll simply leave this method as is
! 	 *
! 	 */
! 	protected function requestToObjects()
  	{
+ 		// Gets the field names from the request
  		$postVars = array_keys($_REQUEST);
+ 		
+ 		// Determine the nae of the objects we need to create and the setters we'll need to call
  		foreach ($postVars as $curVarName) {
  			if (stristr($curVarName, '->')) {
***************
*** 15,18 ****
--- 54,59 ----
  		$objNames = array_keys($objArray);
  		$objInstances = array();
+ 		
+ 		// Now create each object and set the appropriate properties
  		foreach ($objNames as $curObj) {
  			if (empty($objInstances[$curObj])) {
***************
*** 30,33 ****
--- 71,76 ----
  			$objInstances[$curObj] = $obj;
  		}
+ 		
+ 		// Return the object(s) that were created
  		return $objInstances;
  	}




More information about the geeklog-cvs mailing list