requestActoin() is meant to be used in views but as said it will initialize 
a whole request which is not as slow as CakePHP 1.3 but nevertheless
shared controller logic should be packaged in some way. :)

This could be done with a Component or in AppController.
For example if you have a function that utilizes the CakeEmail class to 
send emails I would prefer putting it in AppController as this is a common 
task.
But if you have some computing logic that you will use in only a couple (or 
more) Controllers you should package it in a Component.

This is generic logic packaging and there are best practices when you want 
to be fully MVC.
This example is a bit unrelated but the other day someone over on 
StackOverflow was arguing that it is best to put some global variables 
in `app/webroot/index.php`. Well we should use bootstrap under `Config` for 
this, shouldn't we? :)

@Bharat Maheshwari I can't agree that in order to solve a problem one 
should use the fastest option as this would, in most cases, 
be not as efficient as other options. I can agree that sometimes business 
constraints will efect this dramatically, but in the long run it 
is best to do stuff efficiently. In this specfic example the difference 
between using requestAction() and packaging a Component or a AppController
method is like 30 mins. Cake is mostly objects and performace should always 
be a part of the coding pracise, this for me at least.

Cheers to all,
Borislav.

On Tuesday, 17 July 2012 09:27:16 UTC+3, sneha kulkarni wrote:
>
> how i can call one function of one controller into another controller.plz 
> help
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to