recursive bindModel

2011-06-20 Thread si-mon
Hi friends! I've some doubts in using bindModel, my table structure
is:

users
articles
comments

i.e.

user hasMany articles
user hasMany comments

article belongsTo user
article hasMany comments

comment belongsTo article
comment belongsTo user

Could I bind the models in the following way:


$this->User->bindModel
(
array(
'hasMany'=>array(
'Article'=>array(
'hasMany'=>array(
'Comment'=>array(
'belongsTo'=>array('User')
)
)
)
)
)
);


Otherwise, how can I fulfill this requirement?

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


Re: Generated Source of webpage using cURL or any other methods in PHP?

2010-05-31 Thread si-mon
Sorry Tiago.
Sorry Bharadwaj.

I think both of you misunderstood my requirement. Please note the word
"generated source" not "source of the webpage".
Actually, by using the method suggested by Bharadwaj, we will get the
source of a webpage, but in that we don't get the source of some
special items generated by javascript or any other scripts.

Hope you got the idea.

Thanks.


On May 31, 11:43 am, Bharadwaj Parthasarathy 
wrote:
> Try this
>
> 
>         $url = "http://www.google.com/intl/en/about.html";;
>         $tw = curl_init();
>         curl_setopt($tw, CURLOPT_URL, $url);
>         curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);
>         $search_res = curl_exec($tw);
>         curl_close($tw);
>
>         echo substr($search_res, 0, 600); // here is your source code, do  
> whatever you want with this
>
> ?>
>
> On 31-May-10, at 2:58 AM, si-mon wrote:
>
> > Hi all,
>
> > How do we get the generated source of a page using cURL? Or any other
> > method(s) for this?
> > Please...
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://groups.google.com/group/cake-php?hl=en

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


Generated Source of webpage using cURL or any other methods in PHP?

2010-05-31 Thread si-mon
Hi all,

How do we get the generated source of a page using cURL? Or any other
method(s) for this?
Please...

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: Localization for Model validation messages

2009-12-26 Thread si-mon
Thanks John. Thanks Euromark. Really helpful...

On Dec 25, 9:55 pm, John Andersen  wrote:
> I can't agree, as I prefer to have the model be concerned with model
> things (data, retrieval, saving, validation, etc.), and the view
> concerned with presenting the data and the related error messages,
> including the localization!
>
> Usually I only have one form in which data for a specific model is
> entered, so the adding a new rule and forgetting to add the
> localization in the form, does not become an issue! Also, a change is
> always planned - what to add, what to change, etc.
>
> But each of us use the technique which we are comfortable with :)
>    John
>
> On Dec 25, 4:32 pm, euromark  wrote:
>
> > i dont like the form-way
> > it is quite redundant - if you add a new rule you might forget
> > one or two views which would not be helpful
>
> > having it all together in the model is in my opinion a cleaner
> > approach :)
>
> > On 25 Dez., 12:32, John Andersen  wrote:
>
> > > Use the form helpers option for the input fields! Look 
> > > at:http://book.cakephp.org/view/198/options-error
>
> > > Thus you localize in the view - example:
>
> > > echo $form->input(
> > >    'email',
> > >    array(
> > >       'label' => __('e-mail address',true),
> > >       'error' => array('users_email_rule' => __
> > > ('users_email_rule',true) )
> > >    )
> > > ) ;
>
> > > Observe the 'error' option! Here I use it to convert the validation
> > > message into the language that the user is viewing the form.
>
> > > Enjoy,
> > >    John
>
> > > On Dec 24, 7:39 pm, si-mon  wrote:
>
> > > > Hi All,
>
> > > > Is there a way to use localization for validation messages in the
> > > > Model $validate array?
>
> > > > eg: $validate = array ( 'name' => array('rule'=>'notEmpty',
> > > > 'message'=>'Name is mandatory' ));
>
> > > > I need the message 'Name is mandatory' in five different languages.
>
> > > > In other words: How can we use functions like __('message') like
> > > > functions in model?
>
> > > > Please help me. Thanks.

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


Localization for Model validation messages

2009-12-24 Thread si-mon
Hi All,

Is there a way to use localization for validation messages in the
Model $validate array?

eg: $validate = array ( 'name' => array('rule'=>'notEmpty',
'message'=>'Name is mandatory' ));

I need the message 'Name is mandatory' in five different languages.

In other words: How can we use functions like __('message') like
functions in model?

Please help me. Thanks.

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: A Table Belongs to the Same Table

2009-07-16 Thread si-mon

Thanks Miles, thanks ecommy...

On Jul 14, 11:17 am, ecommy  wrote:
> you may want to check 
> this:http://bakery.cakephp.org/articles/view/coding-a-self-join-in-a-cake-...
>
> On Jul 14, 9:04 am, si-mon  wrote:
>
> > Hi All,
>
> > I am creating a CRM application in cake php. In it, in my user table,
> > there are three levels of users viz. Director, Manager and Executive.
>
> > I need to include a field "reports_to"
> > Eg: executive1 reports_to manager1
> >   executive2 reports_to manager1
> >   executive3 reports_to manager2
> >   executive4 reports_to manager3
> >   and so on...
>
> > This means, the users table belongsTo (or hasAndBelongsToMany) the
> > same users table.
>
> > Please help me to implement 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-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
-~--~~~~--~~--~--~---



A Table Belongs to the Same Table

2009-07-13 Thread si-mon

Hi All,

I am creating a CRM application in cake php. In it, in my user table,
there are three levels of users viz. Director, Manager and Executive.

I need to include a field "reports_to"
Eg: executive1 reports_to manager1
  executive2 reports_to manager1
  executive3 reports_to manager2
  executive4 reports_to manager3
  and so on...

This means, the users table belongsTo (or hasAndBelongsToMany) the
same users table.

Please help me to implement 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-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: BAKE do not detecting newly added tables

2009-07-09 Thread si-mon

Yes... I got it from another discussion:

http://groups.google.com/group/cake-php/browse_thread/thread/086b62c47de9d83d?pli=1

The problem was due to the cache files in /tmp/cache/models. So just
delete all files in it. The problem will get solved.

Thank you.

On Jul 9, 4:46 pm, si-mon  wrote:
> Hi all,
>
> There is a problem in Baking with my system. I will explain in detail:
>
> -- First I have created 10 tables and baked it, it worked properly.
> -- Then, I have added two more tables, and when I attempted to bake,
> the "default" database configuration has not detected the newly
> created tables. Then, while baking, I have changed the database
> configuration to "test", it detected the new two tables.
> -- Then again, I have added one more table, and when I am trying to
> bake, both the "default" and "test" configurations are not detecting
> the newly added table.
>
> Anybody can help me please...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



BAKE do not detecting newly added tables

2009-07-09 Thread si-mon

Hi all,

There is a problem in Baking with my system. I will explain in detail:

-- First I have created 10 tables and baked it, it worked properly.
-- Then, I have added two more tables, and when I attempted to bake,
the "default" database configuration has not detected the newly
created tables. Then, while baking, I have changed the database
configuration to "test", it detected the new two tables.
-- Then again, I have added one more table, and when I am trying to
bake, both the "default" and "test" configurations are not detecting
the newly added table.

Anybody can help me please...
--~--~-~--~~~---~--~~
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: SMTP - Not working

2009-07-02 Thread si-mon

At last, I have used PHPMailer class as Vendor in cake php and in it,
we can set the authentication as either TRUE or FALSE. It's working
fine... Thanks everybody...

On Jul 1, 10:36 am, si-mon  wrote:
> Yes... I found out the error..
>
> I have used another smtp mailing class, and in it, there is an option
> to set the authentication (TRUE or FALSE). If TRUE it will work fine
> and if FALSE it will show the error message "No unauthenticated
> relying permitted'.
>
> But in cake, I have used 'auth'=>true in the smtpOptions and it's not
> working.
> So, the final solution in cake php will be to find out the way to set
> TRUE to smtp authentication.
>
> Anybody to help me please?
>
> On Jun 30, 10:16 pm, aarkerio  wrote:
>
> > This looks as a MTA issue (exim4, Postfix, Sendmail, etc). Look in the
> > MTA log and try send one email using console command and mail PHP
> > function (no CakePHP).
>
> > On Jun 29, 11:56 pm, si-mon  wrote:
>
> > > Hi all...
>
> > > In my application, I need to send mails using smtp server. I have
> > > given all parameters but it is not working. Then I have tracked the
> > > errors in the email component. Then I got the following status
> > > messages:
>
> > > 503 AUTH command used when not advertised
> > > 550 bosauthsmtp16: No unauthenticated relaying permitted
>
> > > My mailing function is as follows:
>
> > > function _sendMail()
> > > {
> > > $this->Email->to = 'sijumo...@gmail.com';
> > > $this->Email->bcc = array();
> > > $this->Email->subject = 'Test Mail';
> > > $this->Email->replyTo = 'smtp username';
> > > $this->Email->from = 'smtp username';
> > > $this->Email->template = 'test';
> > > $this->Email->sendAs = 'html';
>
> > > $this->Email->smtpOptions = array(  'port'=>'25',
> > > 
> > > 'timeout'=>'30',
> > > 
> > > 'auth'=>true,
> > > 'host' => 
> > > 'smtp host',
> > > 
> > > 'username'=>'smtp username',
> > > 
> > > 'password'=>'smtp password'
> > >  );
> > >$this->Email->delivery = 'smtp';
> > >$this->Email->send();
>
> > > }
>
> > > Please help me to solve this issue...
>
> > > Thank you all...
--~--~-~--~~~---~--~~
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: SMTP - Not working

2009-06-30 Thread si-mon

Yes... I found out the error..

I have used another smtp mailing class, and in it, there is an option
to set the authentication (TRUE or FALSE). If TRUE it will work fine
and if FALSE it will show the error message "No unauthenticated
relying permitted'.

But in cake, I have used 'auth'=>true in the smtpOptions and it's not
working.
So, the final solution in cake php will be to find out the way to set
TRUE to smtp authentication.

Anybody to help me please?

On Jun 30, 10:16 pm, aarkerio  wrote:
> This looks as a MTA issue (exim4, Postfix, Sendmail, etc). Look in the
> MTA log and try send one email using console command and mail PHP
> function (no CakePHP).
>
> On Jun 29, 11:56 pm, si-mon  wrote:
>
> > Hi all...
>
> > In my application, I need to send mails using smtp server. I have
> > given all parameters but it is not working. Then I have tracked the
> > errors in the email component. Then I got the following status
> > messages:
>
> > 503 AUTH command used when not advertised
> > 550 bosauthsmtp16: No unauthenticated relaying permitted
>
> > My mailing function is as follows:
>
> > function _sendMail()
> > {
> > $this->Email->to = 'sijumo...@gmail.com';
> > $this->Email->bcc = array();
> > $this->Email->subject = 'Test Mail';
> > $this->Email->replyTo = 'smtp username';
> > $this->Email->from = 'smtp username';
> > $this->Email->template = 'test';
> > $this->Email->sendAs = 'html';
>
> > $this->Email->smtpOptions = array(  'port'=>'25',
> > 
> > 'timeout'=>'30',
> > 
> > 'auth'=>true,
> > 'host' => 
> > 'smtp host',
> > 
> > 'username'=>'smtp username',
> > 
> > 'password'=>'smtp password'
> >  );
> >$this->Email->delivery = 'smtp';
> >$this->Email->send();
>
> > }
>
> > Please help me to solve this issue...
>
> > Thank you all...
--~--~-~--~~~---~--~~
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: SMTP - Not working

2009-06-30 Thread si-mon

Hi Brian,

Thanks for your suggestion.
I have removed the username and password from the options, but the
second error message still exists:

550 bosauthsmtp16: No unauthenticated relaying permitted



On Jun 30, 2:42 pm, brian  wrote:
> Try removing the username & password from the options.
>
> On Tue, Jun 30, 2009 at 12:56 AM, si-mon wrote:
>
> > Hi all...
>
> > In my application, I need to send mails using smtp server. I have
> > given all parameters but it is not working. Then I have tracked the
> > errors in the email component. Then I got the following status
> > messages:
>
> > 503 AUTH command used when not advertised
> > 550 bosauthsmtp16: No unauthenticated relaying permitted
>
> > My mailing function is as follows:
>
> > function _sendMail()
> > {
> >$this->Email->to = 'sijumo...@gmail.com';
> >$this->Email->bcc = array();
> >$this->Email->subject = 'Test Mail';
> >$this->Email->replyTo = 'smtp username';
> >$this->Email->from = 'smtp username';
> >$this->Email->template = 'test';
> >$this->Email->sendAs = 'html';
>
> >$this->Email->smtpOptions = array(  'port'=>'25',
> >
> > 'timeout'=>'30',
> >'auth'=>true,
> >'host' => 
> > 'smtp host',
> >
> > 'username'=>'smtp username',
> >
> > 'password'=>'smtp password'
> > );
> >   $this->Email->delivery = 'smtp';
> >   $this->Email->send();
> > }
>
> > Please help me to solve this issue...
>
> > Thank you all...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



SMTP - Not working

2009-06-29 Thread si-mon

Hi all...

In my application, I need to send mails using smtp server. I have
given all parameters but it is not working. Then I have tracked the
errors in the email component. Then I got the following status
messages:

503 AUTH command used when not advertised
550 bosauthsmtp16: No unauthenticated relaying permitted

My mailing function is as follows:

function _sendMail()
{
$this->Email->to = 'sijumo...@gmail.com';
$this->Email->bcc = array();
$this->Email->subject = 'Test Mail';
$this->Email->replyTo = 'smtp username';
$this->Email->from = 'smtp username';
$this->Email->template = 'test';
$this->Email->sendAs = 'html';

$this->Email->smtpOptions = array(  'port'=>'25',
'timeout'=>'30',
'auth'=>true,
'host' => 'smtp 
host',

'username'=>'smtp username',

'password'=>'smtp password'
 );
   $this->Email->delivery = 'smtp';
   $this->Email->send();
}

Please help me to solve this issue...

Thank you all...
--~--~-~--~~~---~--~~
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: Some functions repeats two times in a single call

2009-06-23 Thread si-mon

Hi Rick,

I will explain the context in detail:

In my system, there is a voting system through email i.e. Accept or
Reject links. The link will be

http://example.com/subject/vote/request_id:1/request_group:1/user:1/option:accept
or option:reject

When I am clicking on this link, I need to update the status of the
corresponding record to 1 (voted) and to display the message 'Thank
you'. Then, if the user clicks on the same link from email again, I
need to display 'You have already voted.' But, due to repeating the
vote function two times in a single click, every time the message
displays as 'You have already voted.'

Hope this is clear.

So, what I need is, to limit the function execution only once. Then
the problem will be solved.

Thanks again,



On Jun 23, 6:14 pm, Rick  wrote:
> Perhaps if we knew what functions were repeating and in what context
> we could help.
>
> Rick
>
> On Jun 23, 7:18 am, si-mon  wrote:
>
> > Hi all,
>
> > In cakePHP, functions without having a view (.ctp file) are repeating
> > more than once in a single call. I only want to execute these
> > functions once in a single call. How can we avoid the executions after
> > first. And, please tell me what is the reason for repeating more than
> > once...
>
> > 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
-~--~~~~--~~--~--~---



Some functions repeats two times in a single call

2009-06-23 Thread si-mon

Hi all,

In cakePHP, functions without having a view (.ctp file) are repeating
more than once in a single call. I only want to execute these
functions once in a single call. How can we avoid the executions after
first. And, please tell me what is the reason for repeating more than
once...

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
-~--~~~~--~~--~--~---



Custom Query Pagination

2008-12-04 Thread si-mon

Hi all,

I have used a custom query with group by in pagination.
I got the the grouped output, but the record count is different (i.e.
I am getting the record-count as the total number of records without
grouping).

The format I have used for pagination is:

$this->paginate['Model'] =
array(
  'conditions' => 'some condition',
  'fields'=>array('user_id','type_id','country_id','COUNT(*)','SUM
(duration)','SUM(rate)'),
  'group'=>array('User.office_id','country_id'),
  'limit' => $this->paginate['limit']
);

One more thing is that, I am using the same Model for many pages.

Please give me a suggestion to fix 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: "Vendors" in root and app folders

2008-11-14 Thread si-mon

yes... thanks...

On Nov 14, 1:17 am, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > I have seen two "Vendors" folder in the cake installation:
> > One is in the -root- folder and the other is in the -app- folder.
> > Is there any difference in using these two folders?
>
> The difference is that the "vendors" folder in the app folder is for
> application-specific "vendors" whereas the other "vendors" folder is
> for global "vendors", i.e. for "vendors" you want to use in multiple
> applications.
>
> Hope that answers your question!
>
> --
> Daniel Hofstetterhttp://cakebaker.42dh.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



"Vendors" in root and app folders

2008-11-13 Thread si-mon

Hi all...
I have seen two "Vendors" folder in the cake installation:
One is in the -root- folder and the other is in the -app- folder.
Is there any difference in using these two folders?
--~--~-~--~~~---~--~~
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: Custom Validation Method in Behaviour

2008-11-07 Thread si-mon

Sorry.. I have got the correct solution:
The problem was with the parameter list of the behaviour method.
The correct format is:

function checkRelatedItem(&$model = null, $data, $foreign_key=null,
$related_model=null, $model_name=null)
{ .. }

i.e. I have added the first parameter as &$model = null.


On Nov 7, 2:32 am, si-mon <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> In my application, I have used the custom validation rule as:
>
> 'rule'=>array('checkRelatedItem','office_id','Office','Employee')
>
> and I have defined the function checkRelatedItem in a behaviour:
>
> function checkRelatedItem($data, $foreign_key=null,
> $related_model=null, $model_name=null) {
> echo $foreign_key;
> echo $related_model;
> echo $model_name;
>
> }
>
> But, the parameters of the function are not passing correctly.
>
> Please help me to solve this problem...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Custom Validation Method in Behaviour

2008-11-06 Thread si-mon

Hi all,

In my application, I have used the custom validation rule as:

'rule'=>array('checkRelatedItem','office_id','Office','Employee')

and I have defined the function checkRelatedItem in a behaviour:

function checkRelatedItem($data, $foreign_key=null,
$related_model=null, $model_name=null) {
echo $foreign_key;
echo $related_model;
echo $model_name;
}

But, the parameters of the function are not passing correctly.

Please help me to solve this problem...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Custom Validation

2008-11-06 Thread si-mon

Hello...

There is a problem in validating data in my application.
Let me explain:

I used a model "Employee" belongsTo "Office"
office_id is the foreignKey

When I'm trying to insert data from the cake-generated form, it
correctly inserts the office_id (because I set it as Select box).
But, when I'm trying to insert data directly through $this->data,

Example:  $this->data = Array('office_id' => '1055','name' =>
'abc','description'=>'some text');

it doesn't checks whether the office_id is present in the Office
model. (In my case, there is no office_id = 1055 in offices table)

Is there any method to solve this problem?
--~--~-~--~~~---~--~~
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: Multiple records in a single save()

2008-11-06 Thread si-mon

Anupom: thank you very much to redirect me to the saving-your-data
section of the book. It helped me to solve the issue.
Actually, the problem was within the array format:
There is no need to specify the "Model" in the array. i.e. the correct
array format should be:
$this->data = Array(
  Array('office_id' => '7',
'name' => '666', 'description' => '1'),
  Array('office_id' => '7',
'name' => '222', 'description' => 'bbb1'),
  Array('office_id' => '7',
'name' => '333', 'description' => 'ccc1')
     );

Thank you very much...

On Nov 6, 12:42 am, Anupom <[EMAIL PROTECTED]> wrote:
> Try saveAll().http://book.cakephp.org/view/75/Saving-Your-Data
>
>
>
> On Thu, Nov 6, 2008 at 11:32 AM, si-mon <[EMAIL PROTECTED]> wrote:
>
> > Hi...
> > Is it possible to insert multiple records in a single save().
>
> > For example:
> > I need to insert the following array in a single save():
> > $this->data = Array('Model' =>
> >  Array(
> >   Array('office_id' => '7',
> > 'name' => '666', 'description' => '1'),
> >   Array('office_id' => '7',
> > 'name' => '222', 'description' => 'bbb1'),
> >   Array('office_id' => '7',
> > 'name' => '333', 'description' => 'ccc1')
> >  )
> >   );
>
> --
> Anupom Syamhttp://syamantics.com/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Multiple records in a single save()

2008-11-05 Thread si-mon

Hi...
Is it possible to insert multiple records in a single save().

For example:
I need to insert the following array in a single save():
$this->data = Array('Model' =>
  Array(
   Array('office_id' => '7',
'name' => '666', 'description' => '1'),
   Array('office_id' => '7',
'name' => '222', 'description' => 'bbb1'),
   Array('office_id' => '7',
'name' => '333', 'description' => 'ccc1')
  )
   );
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Built-in validation rule to check for multiple fields?

2008-11-05 Thread si-mon

Hi all,

In my application, I need to insert records in the following pattern:
--- Source Country, Destination Country, Duration, Cost ---
In which, I need to check "isUnique" for the combination of "Source
Country" and "Destination Country".
But, I only know to give "isUnique" for a single field in the
$validate array of the specific model.

So, my question is:
Is there any built-in validation rule to check for multiple fields?
OR
Do I need to create a custom function to resolve this problem?

--~--~-~--~~~---~--~~
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: Using JQuery and Prototype in same application

2008-11-03 Thread si-mon

Actually, we are a group working on a single project, and each one
having expertise in different libraries. So this question...
Anyhow, thanks for the very useful information. This will help us a
lot...
-- si-mon

On Nov 3, 5:11 pm, monmonja <[EMAIL PROTECTED]> wrote:
> If your using plugins, check if the plugin has the compatibility to
> work with other library, if not remember to not use $ for  jquery
> stuff, most of the time you would be mixing them up. I would also
> suggest to just drop one of them. :)
>
> On Nov 4, 3:13 am, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
>
> > On Mon, Nov 3, 2008 at 11:48 AM, mark_story <[EMAIL PROTECTED]> wrote:
>
> > > A better question is why?
>
> > Maybe if you have an app that uses prototype but one wants to play
> > with your amazing debug kit ;)
>
> > > -Mark
>
> > > On Nov 2, 11:55 pm, si-mon <[EMAIL PROTECTED]> wrote:
> > >> Hi all,
> > >> Is there any problem in using both JQuery and Prototype in the same
> > >> application?
>
> --
> Monmonjahttp://monmonja.com/blog/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Using JQuery and Prototype in same application

2008-11-02 Thread si-mon

Hi all,
Is there any problem in using both JQuery and Prototype in the same
application?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Custom Pagination

2008-10-20 Thread si-mon

Hi,
First of all, I am a beginner in cake.
In my application, I need to include pagination, which is in the
style
<>
with AJAX.
In this, the links are properly working.
The problem is, I have to enter a specific page number in the textbox
and I need to directly go to that page.
But, it is not working.
Please let me know how this possible?
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---