[phaux commit] r127 - in trunk: Classes/Phaux-base Classes/REServe Classes/REServe-Phaux Configuration HtmlRoot

0 views
Skip to first unread message

codesite...@google.com

unread,
Oct 11, 2007, 2:11:18 PM10/11/07
to phau...@googlegroups.com
Author: WHarford
Date: Thu Oct 11 11:10:48 2007
New Revision: 127

Modified:
trunk/Classes/Phaux-base/WHSession.php
trunk/Classes/REServe-Phaux/WHREServeContactModel.php
trunk/Classes/REServe/REArray.php
trunk/Classes/REServe/REServeDriver.php
trunk/Classes/REServe/REServeMySQLDriver.php
trunk/Configuration/reservetest.ini
trunk/HtmlRoot/resource.php

Log:
Migrate arrays as well

Modified: trunk/Classes/Phaux-base/WHSession.php
==============================================================================
--- trunk/Classes/Phaux-base/WHSession.php (original)
+++ trunk/Classes/Phaux-base/WHSession.php Thu Oct 11 11:10:48 2007
@@ -134,12 +134,10 @@
}

/*
- ** If an application has 10 registered
- ** objects the back button will work
- ** 20 times
+ ** The back button will work 25 times!
*/
public function maxRegistries (){
- return 200;
+ return 25;
}
/*
**How many callbacks do you have on a page at a time?

Modified: trunk/Classes/REServe-Phaux/WHREServeContactModel.php
==============================================================================
--- trunk/Classes/REServe-Phaux/WHREServeContactModel.php (original)
+++ trunk/Classes/REServe-Phaux/WHREServeContactModel.php Thu Oct 11
11:10:48 2007
@@ -69,12 +69,22 @@
return $this;
}

+ public function friends(){
+ return $this->friends;
+ }
+
+ public function setFriends($anArray){
+ $this->friends = $anArray;
+ return $this;
+ }
+
public function tableDefinition(){
return parent::tableDefinition()->
column("name",'REString')->
column("phoneNumber",'REString')->
column("email",'REString')->
column("niceness",'REInteger')->
+ column('friends',REArray::of('REString'))->
column("dayOfMeeting",'REDate')->
column("timeOfMeeting",'RETime');
}

Modified: trunk/Classes/REServe/REArray.php
==============================================================================
--- trunk/Classes/REServe/REArray.php (original)
+++ trunk/Classes/REServe/REArray.php Thu Oct 11 11:10:48 2007
@@ -84,6 +84,9 @@
if($oldArray == NULL){
$oldArray = array();
}
+ if($newArray == NULL){
+ $newArray = array();
+ }
$toAdd = array_diff_assoc($newArray,$oldArray);
$toRemove = array_diff_assoc($oldArray,$newArray);
foreach($toRemove as $var => &$value){

Modified: trunk/Classes/REServe/REServeDriver.php
==============================================================================
--- trunk/Classes/REServe/REServeDriver.php (original)
+++ trunk/Classes/REServe/REServeDriver.php Thu Oct 11 11:10:48 2007
@@ -598,6 +598,7 @@
return 'INTEGER ';
}

+
public function updateObject($anObject){
$this->currentObject($anObject);
try{
@@ -630,7 +631,7 @@
if(count($s) == 0 ){
throw new WHException("Can not update and object that is not managed");
}
- //return FALSE;
+ $this->setCurrentObject($anObject);
foreach($anObject->tableDefinition()->columns() as $column){
foreach($s->columns() as $c){
if($column->name() == $c->name()){
@@ -638,6 +639,8 @@
continue 2;
}
}
+
+ $this->setCurrentColumn($column);
/*If we did not find this row add it*/
if($column->type()->reServeValueStoredWithObject()){
$this->executeQuery(
@@ -648,11 +651,14 @@
);

}else{
- $this->currentObject($anObject);
+ $this->setCurrentObject($anObject);
$column->type()->createTableWithDbConnection($this);
}
//Add it to the database as well
$s->addColumn($column);
+ if($column->isIndexed()){
+ $this->executeQuery($this->queryToCreateIndexForObjectOn($column,$anObject));
+ }

}

Modified: trunk/Classes/REServe/REServeMySQLDriver.php
==============================================================================
--- trunk/Classes/REServe/REServeMySQLDriver.php (original)
+++ trunk/Classes/REServe/REServeMySQLDriver.php Thu Oct 11 11:10:48 2007
@@ -138,7 +138,26 @@
}

public function collectionWithOid($model,$anOid){
- $result = $this->executeQuery($this->queryForLookupCollectionWithOid($model,$anOid));
+ /*
+ **Copy and paste hacky
+ ** we need a migrate class method
+ */
+ try{
+ $result = $this->executeQuery($this->queryForLookupCollectionWithOid($model,$anOid));
+ }catch (WHException $e){
+ try{
+ if($e->getCode() == 666){
+ $this->updateTableForObject($model->parentObject());
+ $result = $this->executeQuery($this->queryForLookupCollectionWithOid($model,$anOid));
+ }else{
+ throw $e;
+ }
+ }catch(Exception $e){
+ //Woops something else is wrong throw it
+ throw $e;
+ }
+ }
+
$collection = array();
while($array = mysql_fetch_array($result)){
$row = array();

Modified: trunk/Configuration/reservetest.ini
==============================================================================
--- trunk/Configuration/reservetest.ini (original)
+++ trunk/Configuration/reservetest.ini Thu Oct 11 11:10:48 2007
@@ -1,7 +1,7 @@
[general]
main_class="WHREServeTest"
session_class="WHREServeSession"
-use_cookie="1"
+use_cookie="0"


[REServe]

Modified: trunk/HtmlRoot/resource.php
==============================================================================
--- trunk/HtmlRoot/resource.php (original)
+++ trunk/HtmlRoot/resource.php Thu Oct 11 11:10:48 2007
@@ -30,7 +30,7 @@
foreach($resourceDirs as $dir){
if(is_file($dir.'/'.$resource)){
$offset = 3600 * 24;
- header('Expires: Thu, 15 Apr 2010 20:00:00 GMT');
+ header('Expires: '.date('r',strtotime('tomorrow')));
header('Cache-control: public');
header('Content-Length: '.filesize($dir.'/'.$resource));
$gmt_mtime = gmdate('D, d M Y H:i:s', filemtime($dir.'/'.$resource)
) . ' GMT';

Reply all
Reply to author
Forward
0 new messages