Saturday, December 26, 2009

Re: Getting incremental number from the counter

Your problem can be solved in many ways, so for me/us to better be
able to help you, I have the following questions:

1) What are the requirements for the application?
a) Is the application to be available for a long time?
b) Can the application expire?
c) What information does the application contain?

Assuming that the application must be available for a long time
(statistics, etc.) and that the application can expire (the
application was granted but the user never confirmed the grant), I
suggest you to store the application in a database table and to use
the tables primary key as the unique application number.

That is just for a start! Looking forward to hearing more about your
requirements :)
Enjoy,
John

On Dec 26, 3:08 pm, aveev <nashrullah_a...@yahoo.com> wrote:
> I'm newbie to cakephp..
> I have this scenario.
> User fills in a form. Upon finishing filling the form, his/her application
> will be given an app number. This app number comes from a counter.
> So I need to make a static method that returns this app number. What I don't
> know is where I should put this method at best ??
> Should I wrap it in a component (making static method in a component), model
> (making static method in a model) or what ?
> Let's say If I put it in the component, here's what I've come up with :
> class Counter extends Object {
>         static $num = 0;
>
>         static function get_num() {
>             $num = $num + 1;
>             return $num;
>         }
>     }
>
> So in controller I can call this static method like this:
> class SomeController extends AppController {
>   App::import('Component', 'Counter');
>  some_function() {
>       $app_num = Counter::get_num();}
> }
>
> Is it the right way to solve my problem ??
> Any help would be appreciated.
> Thanks
>
> I use cakephp 1.2
> --
> View this message in context:http://old.nabble.com/Getting-incremental-number-from-the-counter-tp2...
> Sent from the CakePHP mailing list archive at Nabble.com.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: