Re: binding models in behavior

2008-04-27 Thread senser

Hi, Mariano!

Thanks for the help - your suggestion fixed my behavior. I knew for
your bindable behavior in bakery but estimated it's too complex for my
purpose.

Thanks again for the help and happy baking.

On Apr 28, 5:30 am, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> Senser: go through the API doc for bindModel() and you'll see that the
> changes you do through bindModel are only available for the next find()
> operation, after which the model bindings get reset to their original state.
>
> What you need is to tell bindModel not to reset it. On your behavior, change
> this:
>
> $model->bindModel(array('hasMany'=>$lang_model));
>
> For this:
>
> $model->bindModel(array('hasMany'=>$lang_model), false);
>
> The API doc is:
>
> http://api.cakephp.org/1.2/class_model.html#6b1a38f7a8ddb61cfa8539734...
>
> -MI
>
> ---
>
> CakeFest: December, 2008 - Buenos Aires, Argentina -http://es.cakefest.org
>
> blog:http://www.MarianoIglesias.com.ar
> twitter:http://twitter.com/mgiglesias
>
> On Apr 26, 12:07 pm, senser <[EMAIL PROTECTED]> wrote:
>
> > Very strange, but if I don't execute  any query on Offer before,
> > Categories are fetched OK, but if I run any query on Offer and other
> > models (Category & Type) broke.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: binding models in behavior

2008-04-27 Thread Mariano Iglesias

Senser: go through the API doc for bindModel() and you'll see that the
changes you do through bindModel are only available for the next find()
operation, after which the model bindings get reset to their original state.

What you need is to tell bindModel not to reset it. On your behavior, change
this:

$model->bindModel(array('hasMany'=>$lang_model));

For this:

$model->bindModel(array('hasMany'=>$lang_model), false);

The API doc is:

http://api.cakephp.org/1.2/class_model.html#6b1a38f7a8ddb61cfa8539734b4d6430

-MI

---

CakeFest: December, 2008 - Buenos Aires, Argentina - http://es.cakefest.org

blog: http://www.MarianoIglesias.com.ar
twitter: http://twitter.com/mgiglesias

On Apr 26, 12:07 pm, senser <[EMAIL PROTECTED]> wrote:
> Very strange, but if I don't execute  any query on Offer before,
> Categories are fetched OK, but if I run any query on Offer and other
> models (Category & Type) broke.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: binding models in behavior

2008-04-27 Thread James K

http://bakery.cakephp.org/articles/view/bindable-behavior-control-your-model-bindings

There's already a behavior written to do just this. It's excellent.

On Apr 26, 12:07 pm, senser <[EMAIL PROTECTED]> wrote:
> H!i
>
> I'm trying to write a simple behavior for binding models but may be I
> do something wrong cause using behavior causes errors in sql queries
> generated by CakePHP.
>
> Here is detailed info (a snippet from whole application):
> One model "Offer" (primary used) which *hasMany* "Category" & "Type".
> For every one of these three models I have a three models "OfferI18n",
> "CategoryI18n" & "TypeI18n" where I want to store translated details
> for the primary models (yes, I know that there is built-in translate
> behavior but it's not suitable for my purposes).
> So I try to bind these *I18n models to "primary" models in behavior.
> Here is the code of behavior:
> 
> class LanguageBehavior extends ModelBehavior{
> function setup(&$model, $config) {
>                 $db =& ConnectionManager::getDataSource($model->useDbConfig);
>                 if (!$db->connected) {
>                         trigger_error('Datasource '.$model->useDbConfig.' for
> LanguageBehavior of model '.$model->alias.' is not connected',
> E_USER_ERROR);
>                         return false;
>                 }
>
>                 $lang_model=array($model->name.'I18n'=>array('foreignKey'=>
> $config['key']));
>                 $model->bindModel(array('hasMany'=>$lang_model));
>         }}
>
> 
>
> And there is how I'm trying to use the behavior in models:
> 
> class Offer extends AppModel{
> var $actsAs=array('Language'=>array('key'=>'offer_id'));
> .
> .
> .
>
> }
>
> class Category extends AppModel{
> var $actsAs=array('Language'=>array('key'=>'category_id'));
> .
> .
> .
>
> }
>
> class Type extends AppModel{
> var $actsAs=array('Language'=>array('key'=>'type_id'));
> .
> .
> .}
>
> 
>
> So here is the problem - in Offer controller if I try to fetch data,
> doing for example "$this->Offer->findAll()" and everything is OK
> (models are binded and data is fetched). But after receiving all
> offers I try to receive some Category (""$this->Offer->Category-
>
> >findAll()"") and I receive error like this:
>
> "Query: SELECT `Category18n`.`id`, `Category18n`.`category_id`,
> `CategoryI18n`.`locale`, `Category18n`.`content`, `CategoryI18n`. FROM
> `category_i18ns` AS `CategoryI18n` WHERE locale="bul" AND
> Category18n`. IN (1, 2, 3, 4)"
>
> As you can see - the query fails because this: "Category18n`. IN (1,
> 2, 3, 4)" the field of the table CategoryI18n is missing.
>
> Very strange, but if I don't execute  any query on Offer before,
> Categories are fetched OK, but if I run any query on Offer and other
> models (Category & Type) broke.
>
> I suppose there is something wrong in my behavior but I don't know
> what.
>
> Please help.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Register page troubles

2008-04-27 Thread Sam Sherlock
 $this->*Auth*->*userScope* = array('*User*.active' => 1);

2008/4/28 Kyle Decot <[EMAIL PROTECTED]>:

>
> Thanks for the response. I already have an active field which is set
> to 0 when the user registers. I was asking how to check this when
> doing my login.
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Register page troubles

2008-04-27 Thread Kyle Decot

Thanks for the response. I already have an active field which is set
to 0 when the user registers. I was asking how to check this when
doing my login.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Register page troubles

2008-04-27 Thread Sam Sherlock
have a field called active initially save users with active set to zero

only let users with active 1 login

when a user signs up (or when they forget password) send them a  lik to let
them activate account.

Forget password word deactivates the account and resets the password,
sending a (re)activate account

three successive failed auth attempts could also deactivate the account

2008/4/28 Kyle Decot <[EMAIL PROTECTED]>:

>
> Thanks for you quick replies guys. I do however have another question.
> I want to check if the user has activated their account before
> allowing then to login, any suggestions on how to do this?
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Register page troubles

2008-04-27 Thread Kyle Decot

Thanks for you quick replies guys. I do however have another question.
I want to check if the user has activated their account before
allowing then to login, any suggestions on how to do this?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Register page troubles

2008-04-27 Thread nate

Actually, this is the default behavior (filling in form fields) with
or without the Auth component, so you'd have to unset any POST data
you didn't want to show up regardless.  However, the fact that the
Auth component hashes an empty value when no password is provided is
something worth considering making a change to.  If you want to open
an enhancement ticket I'll think about it.

On Apr 27, 6:55 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> It's a Cake "feature", actually. Auth pre-hashes the password for you
> (which is fine) but it also fills in the password field (which is
> pointlessly dumb, IMHO [1]) if the page is reloaded. You need to unset
> $this->data['User']['password'] if the registration method did not
> succeed.
>
> Also, though, your password field should be type="password", not
> "text" (so, you shouldn't even be able to read the characters.
>
> [1], Which, yes, I know, the subject has been hashed (heh) over already enough
>
> On Sun, Apr 27, 2008 at 6:41 PM, Kyle Decot <[EMAIL PROTECTED]> wrote:
>
> >  I am making a register page for my website and am having a somewhat
> >  odd experience. If you do not enter any information and try to submit
> >  the form, the page reloads and the password field is filled with a
> >  random string as you can see here:
>
> >  http://www.theskateparkdirectory.com/register
>
> >  Does anyone know what is causing this?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Register page troubles

2008-04-27 Thread b logica

It's a Cake "feature", actually. Auth pre-hashes the password for you
(which is fine) but it also fills in the password field (which is
pointlessly dumb, IMHO [1]) if the page is reloaded. You need to unset
$this->data['User']['password'] if the registration method did not
succeed.

Also, though, your password field should be type="password", not
"text" (so, you shouldn't even be able to read the characters.

[1], Which, yes, I know, the subject has been hashed (heh) over already enough

On Sun, Apr 27, 2008 at 6:41 PM, Kyle Decot <[EMAIL PROTECTED]> wrote:
>
>  I am making a register page for my website and am having a somewhat
>  odd experience. If you do not enter any information and try to submit
>  the form, the page reloads and the password field is filled with a
>  random string as you can see here:
>
>  http://www.theskateparkdirectory.com/register
>
>  Does anyone know what is causing this?
>  >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Register page troubles

2008-04-27 Thread Kyle Decot

I am making a register page for my website and am having a somewhat
odd experience. If you do not enter any information and try to submit
the form, the page reloads and the password field is filled with a
random string as you can see here:

http://www.theskateparkdirectory.com/register

Does anyone know what is causing this?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Redirect path problem in production setup

2008-04-27 Thread b logica

I think Ensim is a Java app, yes? You could change your sites.xml
file. Look for  wrote:
>
>  Resolved.
>
>  For the record, the problem here was with the Ensim control panel used
>  by the hosting provider.  Ensim apparently reserves the word 'users',
>  'admin' and possibly others for its own pathnames.  As a result if you
>  have a model called 'users' and try to access http://www.domain/users/action,
>  Ensim intercedes and prevents the execution of the cake index.php. It
>  then returns a 404 because it does not know what to do with /action.
>  (The same thing would happen with admin routes.)
>
>  My solution was to change my paths to www.domain.com/members/action
>  and then use mod_rewrite to alter to index.php?url=users/action.
>  The .htaccess file was as follows:
>
>  RewriteBase /
>  
> Options -MultiViews
> RewriteEngine On
> RewriteRule ^members(.*)$ users$1 [NC]
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
>  
>
>  Although I still needed to change my redirect statements internal to
>  my controllers this allowed me to avoid renaming my model and
>  controller.  I am sure there are other ways to solve this with custom
>  routes or by overriding the default naming conventions.
>  >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Parameters in url

2008-04-27 Thread Crazy

Thank you, exactly what I was looking for, I was messing with those
routes before but as you might expect, I messed up :p
Works perfectly now :)

On 27 apr, 21:43, majna <[EMAIL PROTECTED]> wrote:
> Read:http://debuggable.com/posts/new-router-goodies:480f4dd6-4d40-4405-908...
> Getting fancy with passing route parameters
>
> On Apr 27, 5:05 pm, Crazy <[EMAIL PROTECTED]> wrote:
>
> > I'm new to cakephp and still trying to figure out allot of stuff:)
>
> > One of the things I'm strugeling with atm is passing parameters in the
> > url, for example my controller is:
>
> > "/series"
>
> > Now I want to give an id with it to know what to show, so like
>
> > "/series/"
>
> > I know that you can do it with "/series//", but I'd
> > like to have it "cleaner" because an "id" will always be needed.
>
> > All help is appreciated :)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Test Suite 1.2: Importing joining table problem on HABTM fixture.

2008-04-27 Thread Defranco

no ideas?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Parameters in url

2008-04-27 Thread majna

Read:
http://debuggable.com/posts/new-router-goodies:480f4dd6-4d40-4405-908d-4cd7cbdd56cb
Getting fancy with passing route parameters

On Apr 27, 5:05 pm, Crazy <[EMAIL PROTECTED]> wrote:
> I'm new to cakephp and still trying to figure out allot of stuff:)
>
> One of the things I'm strugeling with atm is passing parameters in the
> url, for example my controller is:
>
> "/series"
>
> Now I want to give an id with it to know what to show, so like
>
> "/series/"
>
> I know that you can do it with "/series//", but I'd
> like to have it "cleaner" because an "id" will always be needed.
>
> All help is appreciated :)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Twitter Component

2008-04-27 Thread strangy

I just tested status_update and direct_messages_new with my twitter
account.
I was able to send a direct message to my girlfriend without any
problem and was also able to update my status.
Check my latest status at http://twitter.com/imunitic. That last
status was added using the twitter component.

I'm now really confused  as I don't know why are you ppl having so
much problems using this component.

Maybe it will help to list what software I use.
- Ubuntu 8.04 (Hardy)
- XAMPP 1.6.6. (PHP 5.2.5, MySQL 5.0.51a)
- CakePHP nightly from 22.04.2008

and nothing else.


On Apr 27, 6:49 am, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> Specifically, I'm having the same problem as Matt when I use
> status_update to send a direct message. direct_messages_new just
> simply isn't working.
>
> On Apr 16, 10:48 am, mmayes <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I've been trying to get theTwittercomponent working under Cake 1.2
> > beta. Whenever I attempt a request that requires authentication, I get
> > the error:
>
> > Notice (1024): XML cannot be read [CORE/cake/libs/xml.php, line 748]
>
> > My username and password are set correctly, and when I access the xml
> > page and enter them into the HTTP challenge, it works. But I cannot
> > get the component to work other than with methods that do not require
> > authentication.
>
> > Anybody have any tips? The component I'm referring to it 
> > here:http://bakery.cakephp.org/articles/view/twitter-component
>
> > Cheers,
> > Matt
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: save() keeps creating new records, not updating old ones

2008-04-27 Thread Chez17

mbavio:

that was the issue, I was trying to just save the Profile model and it
would keep creating new records inthe Info database instead of
updating old ones. I'll try your solution to see if it works.

On Apr 26, 6:09 pm, mbavio <[EMAIL PROTECTED]> wrote:
> Two options:
>
> 1) Why not just use $this->Profile->Info->id = $yourID;
>
> 2) Why not just save the Profile Model, the Associatives Models should
> save with it if the data is present in the correct format.
>
> Cheers,
> mbavio
>
> On Apr 25, 5:55 pm, Chez17 <[EMAIL PROTECTED]> wrote:
>
>
>
> > So I finally figured this out. Here is the solution:
>
> > Above this call in the if statement:
>
> > $this->Profile->Info->save($this->data)
>
> > you need to enter:
>
> > $this->Profile->Info->setId( $temp['Info']['id'] );
>
> > Thanks for both your help and time.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Parameters in url

2008-04-27 Thread Crazy

I'm new to cakephp and still trying to figure out allot of stuff:)

One of the things I'm strugeling with atm is passing parameters in the
url, for example my controller is:

"/series"

Now I want to give an id with it to know what to show, so like

"/series/"

I know that you can do it with "/series//", but I'd
like to have it "cleaner" because an "id" will always be needed.

All help is appreciated :)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Components, how many is too many?

2008-04-27 Thread djiize

and that's where MVC and OOP are very useful

MVC because:
I'm pretty sure some parts of your components can be turned in Model/
Behavior/Datasource (gData, Flicker data access, ... are Model's
logic)

OOP because:
why your ServicesController loads all components when it only needs
some?
Maybe you should separate in several controllers that inherit
ServicesController (YahooServicesController,
GoogleServicesController, ...)
That way, each sub-ServicesController has its own $components list.

Dont' forget that in CakePHP, there's still PHP ;-)

On 27 avr, 10:31, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> you have the option of importing them when you need and keeping generall
> required (heavily used comps in the controllers)
>
> *App::import*('*Component*'.$name)
>
> same goes for models etc
>
> at least thats as I understand.
>
> 2008/4/27 mixersoft <[EMAIL PROTECTED]>:
>
>
>
> > I am really wrestling with this one and wanted to know if others have
> > established a best practice.
>
> > My controllers are getting to be pretty big, and different actions may
> > need different components. Also, in the name of DRY, I have a
> > 'services'  controller that performs a lot of standard utility
> > functions -- which may need differnt components depending on who
> > called it. (i.e. Flickr component for Flickr stuff, Facebook component
> > for FB, Google component for Google, etc.)
>
> > It really seems like Cake wants me to include all compoments in the
> > controller var $compoments class attribute, so they can all be easily
> > referenced as a class variable.  But I'm looking at my 'services'
> > controller, and that could very well have a lot of very large
> > components.
>
> > I've tried to use App::import('Compoment', component) to load
> > components on the fly, but when I do so I can't seem to access any
> > components which those components need to use. (see post on Component
> > Polymorphism).
>
> > What do people do? Is the extra overhead so nominal that I should just
> > include everything plus the kitchen sink? Is Cake smart enough only to
> > actually load a component when it is actually required?  Has anyone
> > else figured out how to properly load components on the fly?
>
> > TIA.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Components, how many is too many?

2008-04-27 Thread Sam Sherlock
you have the option of importing them when you need and keeping generall
required (heavily used comps in the controllers)

*App::import*('*Component*'.$name)

same goes for models etc

at least thats as I understand.

2008/4/27 mixersoft <[EMAIL PROTECTED]>:

>
> I am really wrestling with this one and wanted to know if others have
> established a best practice.
>
> My controllers are getting to be pretty big, and different actions may
> need different components. Also, in the name of DRY, I have a
> 'services'  controller that performs a lot of standard utility
> functions -- which may need differnt components depending on who
> called it. (i.e. Flickr component for Flickr stuff, Facebook component
> for FB, Google component for Google, etc.)
>
> It really seems like Cake wants me to include all compoments in the
> controller var $compoments class attribute, so they can all be easily
> referenced as a class variable.  But I'm looking at my 'services'
> controller, and that could very well have a lot of very large
> components.
>
> I've tried to use App::import('Compoment', component) to load
> components on the fly, but when I do so I can't seem to access any
> components which those components need to use. (see post on Component
> Polymorphism).
>
> What do people do? Is the extra overhead so nominal that I should just
> include everything plus the kitchen sink? Is Cake smart enough only to
> actually load a component when it is actually required?  Has anyone
> else figured out how to properly load components on the fly?
>
> TIA.
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Components, how many is too many?

2008-04-27 Thread mixersoft

I am really wrestling with this one and wanted to know if others have
established a best practice.

My controllers are getting to be pretty big, and different actions may
need different components. Also, in the name of DRY, I have a
'services'  controller that performs a lot of standard utility
functions -- which may need differnt components depending on who
called it. (i.e. Flickr component for Flickr stuff, Facebook component
for FB, Google component for Google, etc.)

It really seems like Cake wants me to include all compoments in the
controller var $compoments class attribute, so they can all be easily
referenced as a class variable.  But I'm looking at my 'services'
controller, and that could very well have a lot of very large
components.

I've tried to use App::import('Compoment', component) to load
components on the fly, but when I do so I can't seem to access any
components which those components need to use. (see post on Component
Polymorphism).

What do people do? Is the extra overhead so nominal that I should just
include everything plus the kitchen sink? Is Cake smart enough only to
actually load a component when it is actually required?  Has anyone
else figured out how to properly load components on the fly?

TIA.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---