Post by Daniel » Thu Apr 19, 2007 9:52 pm

I have implemented a request wrapper for v0.7 which is currenty works like this:

$request->get('name');
$request->get('name', 'post');
$request->get('country_id', 'get');
$request->get('HTTP_HOST', 'server');

I'm wondering which is the best way. It could also be done like this:

$request->getPost('name');
$request->getGet('country_id');
$request->getServer('HTTP_HOST');

or:

$post     =& $request->get('post');
$get       =& $request->get('get');
$cookie  =& $request->get('cookie');
$files      =& $request->get('files');
$server  =& $request->get('get');


Can any one recommend which is the best method to use?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by d77 » Mon Apr 23, 2007 1:58 am

not sure which is the 'best practice' way to do this, but i like either of the first two...

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by Mark Dyer » Fri Jun 01, 2007 1:43 pm

Either of the first two, I use simliar to the 1st one but it does require more typing and greater change of something going wrong.. I would like to see the 2nd one used.. Prehaps like this

$request->getGet('country_id','value if not exist');

User avatar
New member

Posts

Joined
Thu May 31, 2007 10:07 pm

Post by azzzy » Tue Sep 18, 2007 2:49 am

Why not:
$post    = $request->post;
$get      = $request->get;
$cookie  = $request->cookie;
$files    = $request->files;
....

I think overriding the default getter method is a good idea, because you won't need to write a getter method for every possible property (and opencart is only php5 anyway).

Newbie

Posts

Joined
Wed Sep 12, 2007 6:55 pm
Who is online

Users browsing this forum: No registered users and 2 guests