Right, first the way you call Set::*** is static invocation, so if you
want your class to work this way make sure you don't use member
variables or $this inside your methods.

To make the class available on every request, put a require_once()
inside your app/config/bootstrap.php file. You could quite easily make
it a vendor class and use vendor() inside bootstrap.php - but that
would seem a bit wierd since that folder is for "third-party code"
while your class clearly has a dependency on cakephp code - the Object
class for one. Not 100% sure about this - it would be nice to have an
app-level "libs" folder but I think the cake devs decided against this
because it would be abused by people not bothering with MVC - all
helpers/components/behaviors/whatever would just be "libs".

Of course, if only your models need the class it would make more sense
to put the require_once() in the app_model.php code, just above the
AppModel class declaration. Still, the whole vendor() vs
require_once() problem remains the same.

Also, since you are essentially extending the cake code, it would be
neat to stick to cake conventions and stay PHP4-compatible (avoid the
"public" declaration) - but hey, that's just nitpicking!

Hope this helps
grigri

On Oct 15, 12:42 pm, bingo <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have some generic data processing that most of the models need. So I
> wrote a class that extends Object.   However, I didn't understand to
> make available throughout my application. This is how my class is
> define
>
> Class ExtendedSetOperations extends Object{
>     public getCount($data, $path)
>         ....
>    }
>
> }
>
> What I am trying to is call this class from my model in the same way
> as I call Set::extract
>
> I considered the object of Using vendor library but I don't want to
> get that route as then I have to load it everything a model needs
> these functions.
>
> Regards,
> Ritesh


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to