[FX.php List] Another Request for FX.php (version 4.0) feedback

Chris Hansen chris at iViking.org
Sat Jun 4 13:04:42 MDT 2005


Johan,

Good call!  I don't know that it would make sense to supply constants 
for every function (where applicable), but I think it certainly makes 
sense in this case.  Of course, the tricky part is using constants that 
are easy to remember for people.  I would like to (1) avoid 
abbreviations, and (2) start each constant name with 'FX_' -- to avoid 
possible conflicts with other constants.  How do the following sound 
for each parameter:

Data_Return__
FX_RETURN_DATA = true
FX_RETURN_NULL = false

Inner_Array__
FX_PORTALS = true
FX_FIELDS = false

Return_Types_
FX_OBJECT = 'object'
FX_FULL = 'full'
FX_BASIC = 'basic'

Please note that I'm not stuck on any of these constants' names.  The 
inner array particularly is hard to name since it can be looked at 
multiple ways: inner or outer (depending on point of view), repeating 
fields or portals versus normal fields, etc.  What is easy to remember?

Also, for clarification, very basic examples of both the current and 
new search styles (using defaults) follow:

_CURRENT___
$myQuery = new FX($FileMakerIP, $FileMakerPort, 'FMPro7');
$myQuery->SetDBData('MyDatabase', 'MyWebLayout');
$myQuery->AddDBParam('CustomerID', $_POST['ID'], 'eq');
$myData = $myQuery->FMFind();
...
foreach ($myData['data'] as $key => $value) {
     echo("$value['FirstName'][0] $value['LastName'][0]");
}

_NEW______
$myQuery = new FX($FileMakerIP, $FileMakerPort, 'FMPro7');
$myQuery->SetDBData('MyDatabase', 'MyWebLayout');
$myQuery->AddDBParam('CustomerID', $_POST['ID'], 'eq');
$myData = $myQuery->DoFXAction(FX_FIND);
...
foreach ($myData as $key => $value) { // the 'data' index is not needed 
with the object return type
     echo("$value['FirstName'] $value['LastName']"); // no trailing [0] 
here =)
}

Thoughts?  Thanks again for the feedback!

--Chris Hansen
   creator of FX.php
   "The best way from FileMaker to the Web."
   www.iViking.org

On Jun 4, 2005, at 12:11 PM, Johan Visser wrote:

> Chris,
>
> Although I do not understand the $useInnerArray parameter yet, here is 
> some
> feedback.
>
> The action constants make the call very clear now, can't you do the 
> same for
> the other parameters in the function call.
> I find the true/false mean nothing at first glance, unless you look up 
> the
> documentation.
>
> So
> $currentData = DoFXAction(FX_FIND, true, false);
> can become:
> $currentData = DoFXAction(FX_FIND, RET_DATA, USE_OUTER);
>
> this makes the call in all its variations even easier to read.
>
> Keep up the good work,
>
> Johan Visser
> BPA Services, NL
>
>
>
>
>
> -----Oorspronkelijk bericht-----
> Van: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org]Namens Chris Hansen
> Verzonden: zaterdag 4 juni 2005 19:40
> Aan: FX.php Discussion List
> Onderwerp: [FX.php List] Another Request for FX.php (version 4.0)
> feedback
>
>
> Greetings List!
>
> I hope everyone will give this message a read, regardless of FX.php
> experience level.  I really value your feedback!  If you'd like to
> comment, but would prefer not to post to the list, feel free to respond
> to me directly.
>
> I've received a contribution from a fellow named Chuck Chang to add
> https support for connecting to FM7SA.  (This is a great new feature of
> FM7, so kudos to Chuck for his contribution.)  Very nice!  That said,
> he also suggested that perhaps the FX declaration is not the place to
> specify the return format (i.e. whether or not to add that last layer
> of the array) and I think I agree with him.  Here's what I propose:
>
> * In the new version I've added this function:
>
> function DoFXAction($currentAction, $returnDataSet = true,
> $useInnerArray=false, $returnType = 'object')
>
> * This is used in conjunction with come new constants, like this:
>
> $currentData = DoFXAction(FX_FIND, true, false);
>
> * You'll note that now there's no need to remember multiple action
> functions.  Each action constant should be logical to remember:
> FX_OPEN, FX_CLOSE, FX_DELETE, FX_DUPLICATE, FX_EDIT, etc.  No
> abbreviations.  Easy?
>
> * $useInnerArray can default to false, since this is a new function.
>
> * This does mean that support for removal of this last level wouldn't
> be present in the old functions, but old code wouldn't use this anyway.
>
> * You might also note that new value -- object -- for $returnType.
> Basically, after the last discussion about removing the top level of
> the array (while mowing the lawn =), I realized "hey! this is an
> object.  People can pull error data, etc. by using class variables!"
> So, for the new function, the default return type will be 'object'
> which will return just the data.  I'll add new class variables for the
> other elements of the top level array.  True there will be some minor
> variable semi-duplication, but some functions need to work with the
> existing class variables, whereas the new ones will ONLY be set just
> before data return.
>
> * With the new function, an error object will ALWAYS be returned on an
> error, even for FileMaker errors.
>
> * The original action functions are STILL THERE for those who want the
> easiest way to access complex FileMaker data.
>
> * Support for the new object return type will be added to the original
> action functions.
>
> I realize that's a lot to sort through, but I really would like lots of
> feedback on this.  My hope is that these additions/changes will do
> three things:
>
> 1) simplify coding (one function to remember, with logical action
> constants)
>
> 2) simplify data handling (by stripping away extra, often unnecessary,
> data in the return when desired)
>
> 3) add power (by doing the above and ALWAYS returning an error for any
> error)
>
> I really appreciate any feedback, and thanks for reading through this
> monster message.
>
> Best,
>
> --Chris Hansen
>    creator of FX.php
>    "The best way from FileMaker to the Web."
>    www.iViking.org
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>



More information about the FX.php_List mailing list