Removing "On behalf of" from the Email From field Cakephp 1.3

2011-12-21 Thread hunny
Hi All,

I am using the email component of cakephp 1.3 to send emails.
In the From Field, I am using the following code.

$this->Email->from = 'my_default_n...@sitename.com'

However, when the user recieves the email it reads as
"sta...@servername.com on behalf of my_default_n...@sitename.com"

What I would like to do is to remove the text coming before and
including "on behalf of". Is this something that can be managed by
using the Email Component. Do I need to ask the hosting company to
make some changes on server. Shall I consider using the SMTP Server.

Waiting for the suggestions.

Thanks in advance.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validating HABTM

2011-06-14 Thread hunny
Write the Validation Rule in Language Model instead of User Model

On Jun 14, 9:56 pm, Shaz  wrote:
> I have User HABTM Language, and i want to ensure during a User add /
> edit they choose a minimum of one language, upto a maximum of 3. In
> the user model, for $validate I've tried:
>
> 'Language' => array(
>                         'multiple' => array(
>                                 'rule' => array('multiple', array('min' => 1, 
> 'max' => 3)),
>                                 'message' => 'Please select a tleast 1 
> langiage upto a maximum of
> 3'
>                     ),
>                 ),
>
> And in the add/edit form i have $this->Form->input('Language'); which
> doesn't actually validate.
>
> It does work if I use language_id instead of Language (both in the
> form on the add/edit pages and in the model $validate) - but then it
> doesn't save any data in the join table.
>
> Any advice on getting the above to validate, or save habtm when using
> "_id".

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Basic Authentication not working

2011-04-21 Thread hunny
Hi All,

The issues is solved, PHP was running as CGI.

Thanks.

On Apr 21, 1:26 pm, hunny  wrote:
> Hi,
>
> I used this very basic example from the manual to 
> implementhttp://book.cakephp.org/view/1309/Basic-HTTP-Authentication. It 
> worked
> fine on my test server, but when I moved the code to my production
> server, it has stopped working.
>
> It keeps prompting me for the username and password. I have debug and
> found out that variables PHP_AUTH_USER and PHP_AUTH_PW are not being
> populated.
>
> Is there anything I need to do enable Authentication on Server or
> something like that.
>
> Thanks in Advance.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Dynamic table with cakephp

2011-04-21 Thread hunny
Create a model file (lets call it Dynamic)


In your Controller, you can use $this->Dynamic->useTable =
'YOUR_TABLE_NAME';



Thanks.








On Apr 21, 1:23 pm, Jeremy Burns | Class Outfit
 wrote:
> Please show some more of your code - we're in the dark a bit about what you 
> are trying to do.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 21 Apr 2011, at 09:21, gannher wrote:
>
>
>
>
>
>
>
>
>
> > On 20 avr, 18:30, cricket  wrote:
> >> On Wed, Apr 20, 2011 at 11:33 AM, gannher  wrote:
> >>> Hello
>
> >>> My application must create table. It will be done with procedure/
> >>> function in mysql. So cakephp doesn't need to send query "create
> >>> table...".
>
> >>> How can I use this table with cakephp ? Must I create file model and
> >>> how ? I would like use function find, paginate, etc with this table.
>
> >> $this->YourModelName->setSource('your_table_name');
>
> > Hello
>
> > With this solution i have :
>
> > Missing Database Table
>
> > Error: Database table debug for model Undefine was not found.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Basic Authentication not working

2011-04-21 Thread hunny
Hi,

I used this very basic example from the manual to implement
http://book.cakephp.org/view/1309/Basic-HTTP-Authentication. It worked
fine on my test server, but when I moved the code to my production
server, it has stopped working.

It keeps prompting me for the username and password. I have debug and
found out that variables PHP_AUTH_USER and PHP_AUTH_PW are not being
populated.

Is there anything I need to do enable Authentication on Server or
something like that.

Thanks in Advance.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cake Paginator Displaying Wrong page number

2011-04-01 Thread hunny
This is because the search Term is not available to the controller
function when you go to 2nd page and it just displays all the results.
Set the debug mode to 2 and check the queries generated on both the
pages. This will help you analyse the issue.

Try the following line of code in views
$this->Paginator->options(array('url' => $this->passedArgs));

Check following for more details: 
http://book.cakephp.org/view/1233/Pagination-in-Views

Thanks,
Hunny.

On Apr 1, 2:13 am, Spetz83  wrote:
> Hi all,
>
> I am having an issue with the cake paginator. When a user comes to my
> site and does a search I am using the paginator for the search
> results. My code looks like this:
>
> function search() {
>
>         $term= '';
>         if(!empty($this->data)) {
>             $term = $this->data['Search']['search_input'];
>         }
>
>         //$this->Product->recursive = 0;
>         $search = array('Product.name LIKE'=>"%$term%",
> 'Product.description LIKE'=>"%$term%",'Provider.name LIKE'=>"%$term%",
> 'Provider.description LIKE'=>"%$term%");
>         $this->paginate = array('conditions'=>array('provider_id !
> ='=>0, 'Product.published'=>true, 'Product.disabled'=>null,
> 'Provider.published'=>true, 'Provider.active'=>true,
> 'Provider.suspend'=>false, 'OR'=>$search), 'limit'=>25);
>         $products = $this->paginate('Product');
>         $title_for_layout = 'Search Results';
>         $this->set(compact('products', 'title_for_layout'));
>
>     }
>
> This method does return values, and the paginator does it's job.
> However, when the view displays the paginated results for the first
> time it says something like "Displaying page 1 of 7".  When I click on
> page 2, the counter jumps to saying "Displaying page 1 of 10".  My
> View code for the counter is below:
>
> 
>                          echo $this->Paginator->counter(array(
>             'format' => __('Page %page% of %pages%, showing %current%
> records out of %count% total, starting on record %start%, ending on
> %end%', true)
>             ));
>             ?>
>         
>         
>             Paginator->first('<< '.__('first',
> true), array(), null, array('class'=>'disabled')); ?>
>             Paginator->prev('< ' . __('previous',
> true), array(), null, array('class'=>'disabled'));?>|
>             Paginator->numbers();?>|
>             Paginator->next(__('next', true) . ' >',
> array(), null, array('class' => 'disabled'));?>
>             Paginator->last(__('last', true).' >>',
> array(), null, array('class'=>'disabled')); ?>
>         
>
> I am using the paginator in other places of my site and I have not had
> this issue. Only with this specific view.
>
> Anyone else ever run into this?
>
> Thanks
>
> Tom

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: languages subdomain or directory

2011-03-30 Thread hunny
Following might help:

http://stackoverflow.com/questions/1794412/adding-a-prefix-to-every-url-in-cakephp

On Mar 30, 4:11 am, Carlos Eduardo Sotelo Pinto
 wrote:
> I understand an dI like your point of view using directory languages for
> seo, the question the will be
>
> What could it be the best way for make this address?, I think it could be
> done editing the url helper for make the links, and a function on app
> controller for get the params or use a router, what do you think
>
> thanks
>
> On Tue, Mar 29, 2011 at 6:04 PM, Ryan Schmidt 
> wrote:
>
>
>
>
>
>
>
>
>
>
>
> > On Mar 29, 2011, at 17:52, Carlos Eduardo Sotelo Pinto wrote:
>
> > > I has a cms that support differents languages, the question is how to use
> > this languages on a subdomain like
>
> > > eng.mysite.com
> > > esp.mysite.com
>
> > > or a directory
>
> > > mysite.com/eng
> > > mysite.com/esp
>
> > > i have read some articles like the make a language switch that use the
> > url helper for make a link on this way
>
> > > mysite.com/eng/node/slug
>
> > > and stores the language on session variable, but what about usinga prm
> > directory as a language or a domain.
>
> > > I hope some have do this kind of app or an article
>
> > I don't know what a "prm directory" is. But I recommend placing the
> > language code as the first thing in the path of the URL. (e.g.
> >www.example.com/eng/...) This is what some large companies like Apple have
> > already decided to do, and I assume they know what they're doing. I don't
> > recommend using language subdomains for several reasons. Each resource on
> > your site should be available from a single canonical URL. But if you serve
> > images, css or other static resources from those domains, then they are
> > available from multiple URLs. You could (and perhaps should) serve static
> > resources from a separate hostname (or hostnames) used only for static
> > resources. You also complicate issues if you ever want to use SSL -- normal
> > SSL certificates are for a single hostname only. You can get a wildcard SSL
> > certificate, but there might be older browsers that don't support it, and
> > they're more expensive. You also have the cookie issue. If you want to
> > bounce between language domains and preserve cookies (i.e. preserve the
> > session), you have to set them on the root of the domain, which has
> > performance implications for your static requests. You could purchase a
> > second domain name for static requests, but that's also an added expense.
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Carlos Eduardo Sotelo Pinto
>     PHP Senior Web Developer
>     Cell (preferred): (Mov)+51, 959980794 :: (Claro)+51, 952707662
>    http://www.csotelo.org
>     Skype: csotelop
>     Yahoo: csotelop
>     MSN: carlos.sotelo.pi...@gmail.com
>     GTalk: carlos.sotelo.pi...@gmail.com
> GPG FP:697E FAB8 8E83 1D60 BBFB 2264 9E3D 5761 F855 4F6B
> GNULinux RU #379182 || GNULinux RM #277661

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: languages subdomain or directory

2011-03-30 Thread hunny
Maybe this would guide you in the right direction

http://stackoverflow.com/questions/1794412/adding-a-prefix-to-every-url-in-cakephp

Thanks.

On Mar 30, 4:11 am, Carlos Eduardo Sotelo Pinto
 wrote:
> I understand an dI like your point of view using directory languages for
> seo, the question the will be
>
> What could it be the best way for make this address?, I think it could be
> done editing the url helper for make the links, and a function on app
> controller for get the params or use a router, what do you think
>
> thanks
>
> On Tue, Mar 29, 2011 at 6:04 PM, Ryan Schmidt 
> wrote:
>
>
>
>
>
>
>
>
>
>
>
> > On Mar 29, 2011, at 17:52, Carlos Eduardo Sotelo Pinto wrote:
>
> > > I has a cms that support differents languages, the question is how to use
> > this languages on a subdomain like
>
> > > eng.mysite.com
> > > esp.mysite.com
>
> > > or a directory
>
> > > mysite.com/eng
> > > mysite.com/esp
>
> > > i have read some articles like the make a language switch that use the
> > url helper for make a link on this way
>
> > > mysite.com/eng/node/slug
>
> > > and stores the language on session variable, but what about usinga prm
> > directory as a language or a domain.
>
> > > I hope some have do this kind of app or an article
>
> > I don't know what a "prm directory" is. But I recommend placing the
> > language code as the first thing in the path of the URL. (e.g.
> >www.example.com/eng/...) This is what some large companies like Apple have
> > already decided to do, and I assume they know what they're doing. I don't
> > recommend using language subdomains for several reasons. Each resource on
> > your site should be available from a single canonical URL. But if you serve
> > images, css or other static resources from those domains, then they are
> > available from multiple URLs. You could (and perhaps should) serve static
> > resources from a separate hostname (or hostnames) used only for static
> > resources. You also complicate issues if you ever want to use SSL -- normal
> > SSL certificates are for a single hostname only. You can get a wildcard SSL
> > certificate, but there might be older browsers that don't support it, and
> > they're more expensive. You also have the cookie issue. If you want to
> > bounce between language domains and preserve cookies (i.e. preserve the
> > session), you have to set them on the root of the domain, which has
> > performance implications for your static requests. You could purchase a
> > second domain name for static requests, but that's also an added expense.
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Carlos Eduardo Sotelo Pinto
>     PHP Senior Web Developer
>     Cell (preferred): (Mov)+51, 959980794 :: (Claro)+51, 952707662
>    http://www.csotelo.org
>     Skype: csotelop
>     Yahoo: csotelop
>     MSN: carlos.sotelo.pi...@gmail.com
>     GTalk: carlos.sotelo.pi...@gmail.com
> GPG FP:697E FAB8 8E83 1D60 BBFB 2264 9E3D 5761 F855 4F6B
> GNULinux RU #379182 || GNULinux RM #277661

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: paginate conditions hasMany question

2011-03-29 Thread hunny

Try following

$this->Member->bindModel(array('hasOne' => array('Payment')),
false);
$this->Member->unbindModel(array('hasMany' =>
array('Payment')), false);

$this->paginate['Member']['contain'] = array('Payment') //
make sure Member Model actAs Containable

    $results = $this->paginate('Member', array('Payment.status' =>
'1'));

Thanks,
hunny.


On Mar 29, 4:11 pm, heohni 
wrote:
> Hi,
>
> I struggle...
>
> I have the following statement:
> $list = $this->paginate('Member');
> Which returns an array (in short) like this:
>
> Array
> (
>     [0] => Array
>         (
>             [Member] => Array
>                 (
>                     [id] => 5
>                 )
>
>             [Payment] => Array
>                 (
>                     [0] => Array
>                         (
>                             [id] => 2520
>                             [member_id] => 5
>
> The debug mode shows me that there are 2 mysql statements performed.
> One to get the members and one to get the payments.
>
> The model is that members hasMany paymennts.
> And payment belongTo a member.
>
> I dont get it now, how I can set conditions regarding the payment
> select?
> For example I just want to select members where the payment status =
> 1.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Prefixing site url with username

2011-03-26 Thread hunny
Hi,

I want to prefix my site url, say www.example.com, with the username,
say user1, so that the url looks like www.user1.example.com.
Any ideas on how to achieve this.

Also wondering if I will need to change HTML Helper so that all the
links are prefixed with username.

Thanx in Advance,
Hunny.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: session not saved in app controller

2011-03-14 Thread hunny
Not sure about the afterFilter function. Are you sure this is being
invoked automatically?
Otherwise you can probably right the same logic in beforeRender
Function.

On Mar 14, 6:51 am, cake-learner  wrote:
> I set up my app object in both beforeFilter and afterFilter callback
> functions
>
> class AppController extends Controller{
>
>    var $myAppObj;
>    var $components = array("Site" , "Notification", "Auth", "Mailer",
> "Session");
>
>    function beforeFilter(){
>         $this -> myAppObj = unserailize( $this -> Session ->
> read( 'AO' ) );
>    }
>    function afterFilter(){
>        $this -> Session -> write( 'AO', $this -> myAppObj );
>    }
>
> }
>
> however the session 'AO' is not saved when i go to other pages.
> Do you guys know how I am doing wrong?

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: COUNT between two Models

2010-07-26 Thread hunny
Check this link http://book.cakephp.org/view/1033/counterCache-Cache-your-count

On Jul 26, 8:07 am, saavedrajj  wrote:
> Hi everybody, I have 2 models: Restaurant and Zone
>
> app/models/restaurant.php
>  class Restaurante extends AppModel {
>
>         var $name = 'Restaurant';
>
>         var $belongsTo = array(
>                 'Zone' => array(
>                         'className' => 'Zone',
>                         'foreignKey' => 'zone_id'
>                 )
>
>         );
>
> }
>
> ?>
>
> app/models/zone.php
>  class Zone extends AppModel {
>         var $name = 'Zone';
>
>         var $hasMany = array(
>                 'Restaurant' => array(
>                         'className' => 'Restaurant',
>                         'foreignKey' => 'zone_id'
>                 )
>         );
>
> }
>
> ?>
>
> And I need to execute this query:
>
> SELECT restaurants.zone_id, zones.title, COUNT(restaurants.zone_id) AS
> zonecounter
> FROM restaurants, zones
> WHERE restaurants.sector_id = zones.id
> GROUP BY restaurants.sector_id
> ORDER BY zones.nombre ASC
>
> So, T wrote the next function at my Restaurant controller
>
> app/controllers/restaurant_controller.php
>  class RestaurantsController extends AppController {
>
> var $name = 'Restaurants';
> var $uses = array('Restaurants', 'Zones');
>
> function index() {
>         $this->set('zones', $this->Zone->Restaurant->find('all',
>             array(
>                 'fields' => array('Restaurant.zone_id',  'Zone.title',
> 'COUNT(Restaurant.zone_id) AS zonecounter'),
>                 'conditions' => array('Restaurant.city_id' => 4),
>                 'order' => array('Zone.title ASC'),
>                 'group' => array('Restaurant.zone_id')
>                 )
>
>             )
>         );}
>
> ?>
>
> *PS: At 'conditions' I need a value for Restaurant.city_id, because
> I'm using this function for more cities.
>
> Then, in my index view, to show the results that I have
>
> app/views/restaurants/index.ctp
>
> 
> Zones
> 
> 
> link($zone['Zone']['title'], '#');?>
> 
> 
> 
>
> It shows me something like
>
> Ex:
> Zones
> - Zone 1
> - Zone 2
> - zone 3
> - Zone 4
>
> Shows me only the zones where are restaurants. Cool.
>
> But also I need to show the value of "zonecounter" in order to
> display  how many restaurants are in every zone:
>
> Ex:
> Zones
> - Zone 1 (22)
> - Zone 2 (31)
> - zone 3 (16)
> - Zone 4 (24)
>
> Some ideas?

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Problem related to Pagination and Binding

2009-11-11 Thread hunny
Hi Guys,

I have found out where the problem is. The pagination function makes 2
calls.

1. First one for Page Count
2. Second one for Actual Records.

My Page Count query is working fine. But 2nd Query is not working
fine. This is because after the first call model relationships are
reset. As mentioned in the manual, passing the second argument as
false to the following function will work:

$this->Sales->contain(array, false);

But I am not sure how to pass this argument in Pagination. Can anyone
point me in the right direction.

Thanks in Advance.

On Nov 11, 1:58 pm, hunny  wrote:
> Hi Guys,
>
> I have made some breakthrough using Containable in this.
>
> $this->paginate['Sales'] = array('contain' => 'Withdrawn',
> 'conditions' => array('Sales.property_id = Withdrawn.property_id') );
>
> It works fine upto here but in the following statement again it
> doesn't recognizes Withdrawn.property_id
>
> $this->paginate('Sales', array('Sales.property_id =
> Withdrawn.property_id'));
>
> On Nov 10, 3:18 pm, hunny  wrote:
>
> > I have a Table named as sales. I have to join it with itself and
> > achieve the following query.
>
> >          $query = "SELECT `Sales`.`id` FROM `sales` AS `Sales` LEFT
> > JOIN `sales` AS `Withdrawn`
> >          ON (`Sales`.`property_id` = `Withdrawn`.`property_id`)
> >          WHERE `Sales`.`date` = '2009-10-27' AND `Withdrawn`.`id` IS
> > NULL" ;
>
> > In order to achive this I wrote the following code in the controller:
>
> >         $this->Sales->bindModel(array(
> >             'hasOne' => array(
> >                 'Withdrawn' => array(
> >                     'className' => 'Sale',
> >                     'foreignKey' => false,
> >                     'type' => 'LEFT',
> >                     'conditions' => array('Sales.property_id =
> > Withdrawn.property_id')
> >              ;
>
> > $this->Sales->find('all', array('fields' => 'Sales.id', 'conditions'
> > => array(array('Sales.property_id = Withdrawn.property_id')
>
> > This works absolutely fine. But I need to make use of the Paginator.
> > But when I give the following statement after Binding the Sales Table
> > with its alias Withdrawn Table:
> > $this->paginate('Sales', array('Sales.property_id =
> > Withdrawn.property_id'));
>
> > I get the error that Withdrawn.property_id is not recognized. Any
> > ideas on how to achive this?
>
> > Thanks in Advance.
>
>

--

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




Re: Problem related to Pagination and Binding

2009-11-11 Thread hunny
Hi Guys,

I have made some breakthrough using Containable in this.

$this->paginate['Sales'] = array('contain' => 'Withdrawn',
'conditions' => array('Sales.property_id = Withdrawn.property_id') );

It works fine upto here but in the following statement again it
doesn't recognizes Withdrawn.property_id

$this->paginate('Sales', array('Sales.property_id =
Withdrawn.property_id'));


On Nov 10, 3:18 pm, hunny  wrote:
> I have a Table named as sales. I have to join it with itself and
> achieve the following query.
>
>          $query = "SELECT `Sales`.`id` FROM `sales` AS `Sales` LEFT
> JOIN `sales` AS `Withdrawn`
>          ON (`Sales`.`property_id` = `Withdrawn`.`property_id`)
>          WHERE `Sales`.`date` = '2009-10-27' AND `Withdrawn`.`id` IS
> NULL" ;
>
> In order to achive this I wrote the following code in the controller:
>
>         $this->Sales->bindModel(array(
>             'hasOne' => array(
>                 'Withdrawn' => array(
>                     'className' => 'Sale',
>                     'foreignKey' => false,
>                     'type' => 'LEFT',
>                     'conditions' => array('Sales.property_id =
> Withdrawn.property_id')
>              ;
>
> $this->Sales->find('all', array('fields' => 'Sales.id', 'conditions'
> => array(array('Sales.property_id = Withdrawn.property_id')
>
> This works absolutely fine. But I need to make use of the Paginator.
> But when I give the following statement after Binding the Sales Table
> with its alias Withdrawn Table:
> $this->paginate('Sales', array('Sales.property_id =
> Withdrawn.property_id'));
>
> I get the error that Withdrawn.property_id is not recognized. Any
> ideas on how to achive this?
>
> Thanks in Advance.

--

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




Problem related to Pagination and Binding

2009-11-10 Thread hunny

I have a Table named as sales. I have to join it with itself and
achieve the following query.

 $query = "SELECT `Sales`.`id` FROM `sales` AS `Sales` LEFT
JOIN `sales` AS `Withdrawn`
 ON (`Sales`.`property_id` = `Withdrawn`.`property_id`)
 WHERE `Sales`.`date` = '2009-10-27' AND `Withdrawn`.`id` IS
NULL" ;

In order to achive this I wrote the following code in the controller:

$this->Sales->bindModel(array(
'hasOne' => array(
'Withdrawn' => array(
'className' => 'Sale',
'foreignKey' => false,
'type' => 'LEFT',
'conditions' => array('Sales.property_id =
Withdrawn.property_id')
 ;

$this->Sales->find('all', array('fields' => 'Sales.id', 'conditions'
=> array(array('Sales.property_id = Withdrawn.property_id')

This works absolutely fine. But I need to make use of the Paginator.
But when I give the following statement after Binding the Sales Table
with its alias Withdrawn Table:
$this->paginate('Sales', array('Sales.property_id =
Withdrawn.property_id'));

I get the error that Withdrawn.property_id is not recognized. Any
ideas on how to achive this?

Thanks in Advance.

--

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




time out while uploading to database

2009-11-09 Thread hunny

Hi Guys,

While uploading database with records from a very large file, I am
getting the following timeout error:

Maximum execution time of 30 seconds exceeded in cake/libs/model/
model.php on line 776.

Could anyone please guide me on where to set this time out variable?

Thanks in Advance,
Hunny.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Self Join query

2009-09-29 Thread hunny

Thanks Bert,

It works perfectly fine. This is exactly what I was looking for.
While going through the manual, I had completely left the Behaviors
Section. I think its high time that I go through it.


On Sep 28, 4:53 pm, Bert Van den Brande  wrote:
> I typed this code out of the top of my head, but it might be worth a try :
>
>         $this->User->Behaviors->attach('Containable');
>         $this->User->bindModel(array(
>             'hasOne' => array( // Model linking type is 'hasOne', this
> forces Cake to make joins
>                 'UserB' => array( // User other name than 'User' to avoid
> data arrays being mixed up in the result
>                     'className' => 'User',
>                     'foreignKey' => false, // Force conditions in query as
> defined below
>                     'type' => 'LEFT',
>                     'conditions' => array('User.company_id =
> UserB.company_id'))
>         )));
>         $result = $this->User->find('all', array('conditions' =>
> array('User.id' => 2)));
>
> Friendly greetings,
> Bert
>
> On Mon, Sep 28, 2009 at 1:43 PM, Bert Van den Brande wrote:
>
> > I would use the Containable behavior here, combined with a custom binding
> > that you attach on the fly.
>
> > Have no idea however how exactly to expres a self-join binding ... try and
> > play around with it :)
>
> > On Mon, Sep 28, 2009 at 12:04 PM, hunny wrote:
>
> >> On Sep 28, 2:19 pm, Aivaras  wrote:
> >> > Hey, take a look at this:
> >>http://voveris.eu/2009/09/05/left-join-with-cakephp/Iam sure you find
> >> this
> >> > handy.
>
> >> > On Mon, Sep 28, 2009 at 12:04, hunny 
> >> wrote:
>
> >> > > Hi All,
>
> >> > > I am new to cakephp. I would like to execute the following SELF Join
> >> > > query.
>
> >> > > SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
> >> > > ON A.id = 2 where A.company_id = B.company_id
>
> >> > > Could some one guide or refer some tutorials, on how to achieve this
> >> > > in cake php.
>
> >> > > Thanks in advance
>
> >> Hi All,
>
> >> Bad me, I think should have explained my problem properly.
>
> >> Lets say following are the contents of my users table:
>
> >> id | name | company id
>
> >> 1 | abc | 123
> >> 2 | def | 123
> >> 3 | ghi | 124
> >> 4 | jkl | 123
>
> >> Now what I want is to retrieve, for a member (say 'abc') all the
> >> people who are working in the same company.
>
> >> Even though company_id is a foreign key, I am not interested in the
> >> data of that table. What you suggested above is how to get the data
> >> from the company table.
>
> >> The simple sql query if I want all the members working in same company
> >> as id = 2 would be:
>
> >> SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
> >> ON A.id = 2 where A.company_id = B.company_id
>
> >> Since this includes JOIN with the table itself, I am not sure how to
> >> achieve using Association Type.
>
>
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Self Join query

2009-09-28 Thread hunny



On Sep 28, 2:19 pm, Aivaras  wrote:
> Hey, take a look at 
> this:http://voveris.eu/2009/09/05/left-join-with-cakephp/I am sure you find 
> this
> handy.
>
> On Mon, Sep 28, 2009 at 12:04, hunny  wrote:
>
> > Hi All,
>
> > I am new to cakephp. I would like to execute the following SELF Join
> > query.
>
> > SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
> > ON A.id = 2 where A.company_id = B.company_id
>
> > Could some one guide or refer some tutorials, on how to achieve this
> > in cake php.
>
> > Thanks in advance
>
>

Hi All,

Bad me, I think should have explained my problem properly.

Lets say following are the contents of my users table:

id | name | company id

1 | abc | 123
2 | def | 123
3 | ghi | 124
4 | jkl | 123

Now what I want is to retrieve, for a member (say 'abc') all the
people who are working in the same company.

Even though company_id is a foreign key, I am not interested in the
data of that table. What you suggested above is how to get the data
from the company table.

The simple sql query if I want all the members working in same company
as id = 2 would be:

SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
ON A.id = 2 where A.company_id = B.company_id

Since this includes JOIN with the table itself, I am not sure how to
achieve using Association Type.

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Doubt in cake php

2009-09-28 Thread hunny



On Sep 25, 10:27 am, John Andersen  wrote:
> Look into the controllers method "requestAction", which allows you to
> retrieve the list of clubs in a view!
> Enjoy,
>    John
>
> On Sep 24, 11:59 am, hunny  wrote:
>
> > Hi Guys,
>
> > I am new to cakephp. I am having the following issue:
>
> > I am displaying list of checkbox containing clubs to a login user. The
> > list of clubs I am passing through the models via controllers in the
> > traditional way.
>
> > Now the logged in user should see his list of clubs automatically
> > ticked. This list is present in another database.
>
> > One solution is to get the list of user clubs in the controller itself
> > and pass it to the view.
>
> > But is there any alternative way, where I can access the user clubs in
> > the view itself without loading in the controller.
>
> > Basically i am looking for something similar like View Helpers in
> > Zend. We can access the model data in views using view Helpers. Is
> > there something similar in cakephp.
>
> > P.S: I have asked this question to a few people who knew cake php and
> > their first reaction is that you shouldn't access model data in views
> > as it is against MVC. But let me assure you we can access model data
> > in view as long as it is read only. At least that is what we are used
> > to follow in Zend Framework. :)
>
>
Hi All,

Thanks for your help. I was just reluctant to put the code in the
controller because it makes your controller fat.

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Self Join query

2009-09-28 Thread hunny

Hi All,

I am new to cakephp. I would like to execute the following SELF Join
query.

SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
ON A.id = 2 where A.company_id = B.company_id

Could some one guide or refer some tutorials, on how to achieve this
in cake php.

Thanks in advance

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Doubt in cake php

2009-09-24 Thread hunny

Hi Guys,

I am new to cakephp. I am having the following issue:

I am displaying list of checkbox containing clubs to a login user. The
list of clubs I am passing through the models via controllers in the
traditional way.

Now the logged in user should see his list of clubs automatically
ticked. This list is present in another database.

One solution is to get the list of user clubs in the controller itself
and pass it to the view.

But is there any alternative way, where I can access the user clubs in
the view itself without loading in the controller.

Basically i am looking for something similar like View Helpers in
Zend. We can access the model data in views using view Helpers. Is
there something similar in cakephp.

P.S: I have asked this question to a few people who knew cake php and
their first reaction is that you shouldn't access model data in views
as it is against MVC. But let me assure you we can access model data
in view as long as it is read only. At least that is what we are used
to follow in Zend Framework. :)

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---