Re: using id how to get the details

2010-05-04 Thread Master Ram
Ok sir i got it

On May 5, 11:18 am, Ramkumar Ramkumar  wrote:
> hey bro use the queries with joins
>
>
>
> On Wed, May 5, 2010 at 11:42 AM, Master Ram  wrote:
> > hi.. all i am new to cakephp.
>
> > i have table called campaign: this table containing "user_id" form
> > users table. i want to get user details form user table. and i want to
> > display the result of both table campaign and users table.
>
> > how to do. this
>
> > please help me
>
> > 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Thanks & Regards,
> M.Ramkumar
>
> 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


Re: Form Tag!!!!

2010-05-04 Thread Andrei Mita
Read here how to correctly define $form->create

http://book.cakephp.org/view/183/Creating-Forms


2010/5/4 sherzo 

>
> Anyone can help me 
>
>
>
>
> sherzo wrote:
> >
> > Hi all!!!
> >
> > I have the following code in my View:
> >
> >
> >  >
> $form->create('UsersCoupon',array('id'=>'update','url'=>array('action'=>'changeStatustoUsed')));?>
> >
> >   
> >   
> >   
> > 
> >> class="ilk">KUPONLARIMADETDEGERBITIS
> > TARIHI
> >  > $this->requestAction('users_coupons/listNotUsedCoupons'); ?>
> >
>  >
> > foreach($usersCoupons as $usersCoupon):
> > ?>
> >   > $form->checkbox('cop.id.'.$usersCoupon['UsersCoupon']['id'],
> array('value'
> > => $usersCoupon['UsersCoupon']['id'])); ?>
> > input($usersCoupon['UsersCoupon']['id'],array(
> > 'type'=>'checkbox',   'label'=>false,
> > 'name'=>'cop['.$usersCoupon['UsersCoupon']['id'].']',
> > 'id'=>'cop_'.$usersCoupon['UsersCoupon']['id']));
> ?>
> >class="ilk">
> >  >   $m
> = $usersCoupon['UsersCoupon']['transaction_code'];
> >
> $count =
> > $this->requestAction('users_coupons/countUserCouponPurchasePerTime/'.$m);
> >
> > echo $count;?> > $count*$usersCoupon['Coupon']['sale_price'];?>TL > echo $usersCoupon['Coupon']['expiration_date'];?>
> >  >
> > ?>
> >
> > 
> > 
> >
> > 
> > 
> >$form->submit('kullandiklarimi-arsive-at-button.gif',
> > array('class'=>'submit'));?>
> >
> >   
> >
> > 
> >  > echo $paginator->prev('«  ', null, null, array('class' => 'disabled'));
> > echo $paginator->numbers(); ?>
> > 
> >  >
> >   echo $paginator->next('  »', null, null, array('class' =>
> 'disabled'));
> > ?>
> >  
> > Lütfen önce
> kullandığınız
> > kuponları işaretleyin.
> > 
> >
> > and as soon as I uncomment the form tag I will receive the following
> error
> > message!!!
> >
> > Fatal error: Cannot use object of type Xml as array in cakephp form
> >
> > any idea?!?!
> >
>
> --
> View this message in context:
> http://old.nabble.com/Form-Tag%21%21%21%21-tp28425388p28452273.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> 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.comFor
>  more options, visit this group at
> http://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


Cakephp database migration error

2010-05-04 Thread Vijay
Hello All,

I am using the database migration plug-in provided by CakeDC.

I followed all the instructions given by them, but when i use the
command 'cake migration help' it gives me error,

Hello user,

Welcome to CakePHP v1.2 Console
---
Current Paths:
 -working: /path/to/cake/
 -root: /path/to/cake/
 -app: /path/to/cake/app/
 -core: /path/to/cake/

Changing Paths:
your working path should be the same as your application path
to change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp

Available Shells:

 app/vendors/shells/:
 - none

 vendors/shells/:
 - none

 cake/console/libs/:
 acl
 api
 bake
 console
 extract

To run a command, type 'cake shell_name [args]'
To get help on a specific command, type 'cake shell_name help'


I am inside my application app/ folder & using the command. I am
working with ubuntu environment.

I followed the given instructions on, 
http://book.cakephp.org/view/108/The-CakePHP-Console
but it doesnt work.

Can anybody help me out of this problem.

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: using id how to get the details

2010-05-04 Thread Ramkumar Ramkumar
hey bro use the queries with joins

On Wed, May 5, 2010 at 11:42 AM, Master Ram  wrote:

> hi.. all i am new to cakephp.
>
> i have table called campaign: this table containing "user_id" form
> users table. i want to get user details form user table. and i want to
> display the result of both table campaign and users table.
>
> how to do. this
>
> please help me
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Thanks & Regards,
M.Ramkumar

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: Bakery...arrogance or plain lack of attention

2010-05-04 Thread Jayesh Wadhwani
There was no discussion. I did talk to someone about the status and
all I got was that it was not a nice article.

I am not not selling this stuff. It is just a contribution. If it
helps even one programmer it is ok. Like I said it is only a
contribution.

If you are a core member and cannot professionally answer my question
as to why my article is languishing then I suggest you quit the core.

Get real. It is an open source framework for God's sake.

Being a core member, a moderator or a reviewer, you are here to help
the community. You seem to be considering your position as some sort
of an authoritative position.

This is voluntary work. I spent time writing it with the only intent
that it may help some one. This is what I get in return.

I stand what I have said. It breeds arrogance.

This will be my last reply. I have no plans to continue in this
community. I am sure there are other communities where all and any
help is respectfully welcome.

On May 1, 6:36 am, AD7six  wrote:
> On Apr 29, 11:22 pm, jacmoe  wrote:
>
> > I was maybe a bit too harsh, but Mr. Wadhwani failed to notice that we
> > are indeed trying to fix the issues, and that this is not borne out of
> > arrogance.
> > I understand that he's pissed off, of course.
> > And that he's letting out some steam.
>
> while thebakery- and the review process - is far from perfect it's
> worth noting the following (for the unknowing bystanders):
>
> The article was titled "Simple Jquery Treeview Helper"
> It didn't do anything that existing code doesn't already let you do
> [1]
> Jayesh did discuss his article with a core member in the irc channel
> weeks before this post [2]
>
> While the article shouldn't have been deleted without a comment to the
> author (I don't remember, is the deletion of stale articles
> automatic?) it wasn't destined to be published and Jayesh didn't do
> anything about the articles shortcoming (which would be difficult
> since the main problem was surely the tiny nature of the code and that
> it repeats core - and other - existing functionality)
>
> hth
>
> AD
> [1]http://api.cakephp.org/class/html-helper#method-HtmlHelpernestedList
> (amongst other code solutions)
> [2]http://irc.cakephp.org/search/cakephp/Wadhwani_J
>
> 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


using id how to get the details

2010-05-04 Thread Master Ram
hi.. all i am new to cakephp.

i have table called campaign: this table containing "user_id" form
users table. i want to get user details form user table. and i want to
display the result of both table campaign and users table.

how to do. this

please help me

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Hi Andy,

so in conclusion, i should get into the habit of installing these cake
files as plugins.

Thank you.

I didn't try your one_query cause i tried reading it but i dont quite
understand how to use it.

Hope you dont mind.

however, you have been the most helpful to me so far in pointing me
the way.

Thank you.



On May 5, 3:58 am, AD7six  wrote:
> On May 4, 7:19 pm, Kei Simone  wrote:
>
>
>
>
>
> > Hi Andy,
>
> > i got it to work using Linkable. as well as you suggested by using
> > bindModel which is slightly more readble than joins.
>
> > though i think linkable is really darn short and it looks good.
>
> > I am sorry, i apologise that i misunderstood.
>
> > I thought both the linkable and the onequery are the same. and i
> > thought you wrote both linkable and onequery.
>
> > i got a few questions for clarification purposes. please help to
> > clarify.
>
> > 1) i initially placed the linkable directly in app/models/behaviors/
> > linkable.php
>
> > having recalled my meio_upload, i realised that the behavior file was
> > actually stored at plugins/meio_upload/models/behaviors/
> > meio_upload.php.
>
> > so i did the same for linkable and called the file using $this-
>
> > >Behaviors->attach(Linkable.Linkable);
>
> > so i should place such code in plugins ALWAYS?
>
> I'd suggest: If it's distributed as a plugin yes otherwise: no. Plugin
> models and controllers extend a different class (PluginApp(Controller|
> Model)) which might mean if you follow your rule you come unstuck at
> some point although a behavior doesn't know if it's in a plugin or not
> so in this instance you can choose.
>
>
>
> > 2) your onequery is doing the same thing as Linkable yes?
>
> Yes - more or less. I didn't know of linkable when I wrote it.
>
> as in
>
> > optimizing the query. so to use it i need only placed it in plugins/mi/
> > models/behaviors/one_query.php
>
> kind of
>
>
>
> > do i need the other mi files?
>
> I don't think so but mi is a plugin - I'd suggest getting into the
> habit of installing plugins (cd plugins && git clone git://.) -
> not individual files.
>
> If you choose to use it (attach it and just replace contain in your
> find call with oneQuery, OR attach it and tell the behavior to look
> for the param "contain") and it complains, then it does ;)
> hth,
>
> AD
>
> 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


Re: Simple assoication not working

2010-05-04 Thread Rodney Chan
Thanks Ed Propsner!

The problem is in my model file naming, I should use singular:
books.php -> book.php

I can now continue my studies on CakePHP.


On May 5, 2:03 am, Don Drake  wrote:
> I'm glad you gave the 'hint' because I was looking at that linked page and
> the problem code and had no idea what was wrong (being new enough to still
> have to look this stuff up).
>
> Here's the page that deals with the file naming 
> problem:http://book.cakephp.org/view/23/File-and-Classname-Conventions
>
> Don
>
>
>
>
>
> On Tue, May 4, 2010 at 12:45 AM, WebbedIT  wrote:
>
> > > Have another look at your naming conventions, most notably those for your
> > > models.
>
> > >http://book.cakephp.org/view/24/Model-and-Database-Conventions
>
> > Hint: Your model filenames should be singular.
>
> > When first learning CakePHP and any problems arise it's often down to
> > a deviation from the conventions so learn them inside out and stick to
> > them whenever possible.
>
> > 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> 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


Duplicate Queries 1.2.6 - 1.2.7

2010-05-04 Thread Brian Watson
I have an original app built on 1.2.6 and simply edited my webroot/index.php to 
pull the site using the 1.2.7 lib on the server. Everything works fine except I 
noticed extra queries.

Exactly 4 additional queries happen on 1.2.7 and they are the exact same 
queries to the session table.

I did a quick note of queries for various pages on 1.2.6 and then 1.2.7 and its 
the same on every page.4 Extra session queries. Anyone else seeing this?

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: Version 1.3 Routing & Vanity URLs

2010-05-04 Thread Brian Watson

Did anyone find a solution to this as I have the exact same problem.

Thanks
- Original Message - 
From: "CharlesTMunger" 

To: "CakePHP" 
Sent: Monday, May 03, 2010 2:01 AM
Subject: Version 1.3 Routing & Vanity URLs



In my 1.2x app I have vanity URLs from the base.  I.e., a user named
"munger" can have his page located at:

www.mysite.com/munger

Accomplishing this was pretty straightforward -- in my routes.php I
had this line at the end:

Router::connect('(?!admin|users|posts)(.*)', array('controller'=>'users', 
'action'=>'view'));


Then, in the view method of my users_controller, I simply did a find
based on user name. I tried upgrading to 1.3 and this doesn't work
anymore  -- I assume it has something to do with not supporting regex
anymore.

So -- any ideas on how to go about accomplishing this in 1.3?

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 


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: Sessions working in one controller and not the other

2010-05-04 Thread LordZardeck
Adding still doesn't help. I REALLY need to figure this out. its so
wierd because the sessions work when you add var $uses = array(), even
when I don't have the Session componet added! its not even in the
app_controller!

On May 4, 10:42 am, thatsgreat2345  wrote:
> Not a clue, would have to look into the core for that. But either way
> just add var $components = array('Session'); to both of them.
>
> On May 3, 7:21 pm, LordZardeck  wrote:
>
>
>
>
>
> > Ok, I found out that the problem arises when I use a model. When I set
> > the $uses varibale to an empty array, it works. What would cause this?
>
> > On May 3, 6:21 pm, thatsgreat2345  wrote:
>
> > > Include the session component
>
> > > On May 3, 3:59 pm, LordZardeck  wrote:
>
> > > > For some reason, the session handling works in one controller and not
> > > > the other. I can't figure out why. I am using CakePHP 1.2.5.
>
> > > > //
> > > > //Does work
> > > > //
>
> > > > sessions_controller.php:
>
> > > > class SessionsController extends AppController {
> > > >     var $name = "Sessions";
> > > >     var $layout = "ajax";
> > > >     var $uses = array();
>
> > > >     function create(){
> > > >         if($this->Session->read('Data') == null){
> > > >             $this->Session->write('Data', rand());
> > > >         }
> > > >         $this->set('data', $this->Session->read('Data'));
> > > >         $this->set('SessionID', $this->Session->id());
> > > >     }
>
> > > > }
>
> > > > create.ctp:
> > > > $msgJson["SessionID"] = $SessionID;
> > > > $msgJson["data"] = $data;
> > > > echo json_encode($msgJson);
> > > > //results in ({"SessionID":"sd8s8o32edmjnjt94ouse99fd2","data":19409})
> > > > every time (parenthesis not in result)
>
> > > > //
> > > > //Doesn't Work
> > > > //
>
> > > > messages_controller.php:
>
> > > > class MessagesController extends AppController {
>
> > > >     var $name = 'Messages';
> > > >     var $layout = "ajax";
>
> > > >     function listMessages() {
> > > >         if($this->Session->read('Data') == null){
> > > >             $this->Session->write('Data', rand());
> > > >         }
> > > >         $this->set('data', $this->Session->read('Data'));
> > > >         $this->set('SessionID', $this->Session->id());
> > > >         $this->set('messages', $this->Message->find("all",
> > > > array("order"=>"priority ASC")));
> > > >     }
>
> > > > }
>
> > > > list_messages.ctp:
>
> > > > $msgJson["count"] = count($messages);
> > > > $msgJson["SessionID"] = $SessionID;
> > > > $msgJson["SessionData"] = $data;
> > > > foreach($messages as $message){
> > > >     $msg[] = $message["Message"];}
>
> > > > $msgJson["items"] = $msg;
> > > > echo json_encode($msgJson);
> > > > /*
> > > > results in ({"count":3,"SessionID":"","SessionData":27384,"items":
> > > > [{"id":"4","priority":"3","subject":"Another
> > > > message","message":"adsfasdf"},
> > > > {"id":"2","priority":"3","subject":"testing again","message":"just
> > > > seeing ow "},
> > > > {"id":"7","priority":"3","subject":"asdgasdg","message":"asdfasdfasd"}]})
> > > > except the SessionData changes everytime and the SessionID never shows
> > > > up.
> > > > */
>
> > > > Any ideas what might be wrong?
>
> > > > Check out the new CakePHP Questions 
> > > > sitehttp://cakeqs.organdhelpotherswith 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 sitehttp://cakeqs.organdhelpothers 
> > > 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-Hidequoted text -
>
> > > - Show quoted text -
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 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 gro

Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread AD7six


On May 4, 7:19 pm, Kei Simone  wrote:
> Hi Andy,
>
> i got it to work using Linkable. as well as you suggested by using
> bindModel which is slightly more readble than joins.
>
> though i think linkable is really darn short and it looks good.
>
> I am sorry, i apologise that i misunderstood.
>
> I thought both the linkable and the onequery are the same. and i
> thought you wrote both linkable and onequery.
>
> i got a few questions for clarification purposes. please help to
> clarify.
>
> 1) i initially placed the linkable directly in app/models/behaviors/
> linkable.php
>
> having recalled my meio_upload, i realised that the behavior file was
> actually stored at plugins/meio_upload/models/behaviors/
> meio_upload.php.
>
> so i did the same for linkable and called the file using $this-
>
> >Behaviors->attach(Linkable.Linkable);
>
> so i should place such code in plugins ALWAYS?

I'd suggest: If it's distributed as a plugin yes otherwise: no. Plugin
models and controllers extend a different class (PluginApp(Controller|
Model)) which might mean if you follow your rule you come unstuck at
some point although a behavior doesn't know if it's in a plugin or not
so in this instance you can choose.

>
> 2) your onequery is doing the same thing as Linkable yes?
Yes - more or less. I didn't know of linkable when I wrote it.

as in
> optimizing the query. so to use it i need only placed it in plugins/mi/
> models/behaviors/one_query.php

kind of
>
> do i need the other mi files?

I don't think so but mi is a plugin - I'd suggest getting into the
habit of installing plugins (cd plugins && git clone git://.) -
not individual files.

If you choose to use it (attach it and just replace contain in your
find call with oneQuery, OR attach it and tell the behavior to look
for the param "contain") and it complains, then it does ;)
hth,

AD

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: Form Tag!!!!

2010-05-04 Thread sherzo

Anyone can help me 




sherzo wrote:
> 
> Hi all!!!
> 
> I have the following code in my View:
> 
> 
>  $form->create('UsersCoupon',array('id'=>'update','url'=>array('action'=>'changeStatustoUsed')));?>
> 
>   
>   
>   
> 
>class="ilk">KUPONLARIMADETDEGERBITIS
> TARIHI
>  $this->requestAction('users_coupons/listNotUsedCoupons'); ?>
>  
> foreach($usersCoupons as $usersCoupon): 
> ?>
>   $form->checkbox('cop.id.'.$usersCoupon['UsersCoupon']['id'], array('value'
> => $usersCoupon['UsersCoupon']['id'])); ?>
> input($usersCoupon['UsersCoupon']['id'],array(
> 'type'=>'checkbox',   'label'=>false,
> 'name'=>'cop['.$usersCoupon['UsersCoupon']['id'].']', 
> 'id'=>'cop_'.$usersCoupon['UsersCoupon']['id'])); ?>  
>  
>class="ilk">
>$m = 
> $usersCoupon['UsersCoupon']['transaction_code'];
>   
> $count =
> $this->requestAction('users_coupons/countUserCouponPurchasePerTime/'.$m);
>   
> echo $count;?> $count*$usersCoupon['Coupon']['sale_price'];?>TL echo $usersCoupon['Coupon']['expiration_date'];?>
>  
> ?>
> 
> 
> 
>   
> 
> 
>$form->submit('kullandiklarimi-arsive-at-button.gif',
> array('class'=>'submit'));?> 
> 
>   
>   
> 
>  echo $paginator->prev('«  ', null, null, array('class' => 'disabled'));
> echo $paginator->numbers(); ?>
> 
>
>   echo $paginator->next('  »', null, null, array('class' => 'disabled'));
> ?> 
>  
> Lütfen önce kullandığınız
> kuponları işaretleyin.
> 
> 
> and as soon as I uncomment the form tag I will receive the following error
> message!!! 
> 
> Fatal error: Cannot use object of type Xml as array in cakephp form
> 
> any idea?!?!
> 

-- 
View this message in context: 
http://old.nabble.com/Form-Tag%21%21%21%21-tp28425388p28452273.html
Sent from the CakePHP mailing list archive at Nabble.com.

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: v1.3 App::Objects not finding controllers in app/controllers/subfolders

2010-05-04 Thread Sam Sherlock
@matthew

have a loook at the following

Mark Story's acl extras plugin

Thatcode's permissiable plugin

- S


On 4 May 2010 19:59, Matthew  wrote:

> Wow a lot of conflict in here. I am pretty new with Cake, I had a test
> site up with 1.2 and have recently moved to 1.3 for PHP 5.3 support.
> The biggest roadblock for me is permissions management. I am trying to
> write a permissions editor that lists all controllers and their
> methods so I can simply bind a group to a method.
>
> Placing controllers in subfolders has always worked fine aside from
> this. I guess I will just move them into the controllers root.
>
> On May 2, 3:59 pm, Miles J  wrote:
> > Hence why I said just use plugins, cause the conventions are
> > automatic.
> >
> > On May 2, 1:56 am, AD7six  wrote:
> >
> >
> >
> > > On May 1, 10:32 pm, Jamie  wrote:
> >
> > > > On May 1, 1:21 pm, AD7six  wrote:
> >
> > > > > On May 1, 10:19 pm, Jamie  wrote:
> >
> > > > > > On May 1, 1:17 pm, AD7six  wrote:
> >
> > > > > > > On May 1, 10:13 pm, Jamie  wrote:
> >
> > > > > > > > On May 1, 12:46 pm, AD7six  wrote:
> >
> > > > > > > > > On May 1, 9:36 pm, Jamie  wrote:
> >
> > > > > > > > > > I read the whole thread. I'm not sure how that changes my
> post.
> >
> > > > > > > > > > I was just explaining to the original poster why
> subfolders didn't
> > > > > > > > > > automatically work
> >
> > > > > > > > > I would suggest you try and don't assume.
> >
> > > > > > > > > > , why there's no easy way to make them work, and why
> > > > > > > > > > they work in other frameworks/code designs. Please
> explain to me the
> > > > > > > > > > problem you have with my post and maybe we can do
> something
> > > > > > > > > > constructive.
> >
> > > > > > > > > > Seriously, what is with you throwing out these sarcastic
> comments
> > > > > > > > > > lately? I can pick out more than a few examples over the
> past little
> > > > > > > > > > while. Between you and Miles this group is getting a bit
> hostile.
> >
> > > > > > > > > I'm not being sarcastic - I'm giving you the opportunity to
> correct
> > > > > > > > > your mistake. If you /still/ can't see it - try exactly
> what you've
> > > > > > > > > said doesn't work before replying.
> >
> > > > > > > > Fine. Thanks for the opportunity. Glad you're looking out for
> me. I
> > > > > > > > made this file:
> >
> > > > > > > > controllers/test/users.php
> >
> > > > > > > I see. so you feel that by demonstrating your own example which
> has
> > > > > > > nothing to do with this thread and is based on a different
> framework
> > > > > > > (since you don't follow a single convention) that somehow makes
> your
> > > > > > > reply right?
> >
> > > > > > You told me to try what I said wouldn't work. And I did. Then I
> shared
> > > > > > the results.
> >
> > > > > > I sense that this isn't going anywhere. Thanks for hijacking my
> > > > > > response...
> >
> > > > > Jamie you're taking this out of context and personal and I doubt
> > > > > anyone else in this thread is really interested in your example.
> >
> > > > > This is what I expected you to do
> >
> > > > > mv controllers/anything_controller.php
> controllers/any/subfolder/you/
> > > > > like
> >
> > > > > firefoxhttp://mysite/anything
> >
> > > > > and marvel at the wonder of a page that isn't a 404.
> >
> > > > > GN
> >
> > > > Maybe the original poster is used to following PEAR conventions. Who
> > > > knows? Why not give the benefit of the doubt? More importantly, why
> > > > not let others respond to the original poster without interjection? I
> > > > was just trying to offer a possible explanation in case he was indeed
> > > > expecting Cake to respect the PEAR naming style. I'm not sure why
> that
> > > > bothered you.
> >
> > > Let's start again shall we.
> >
> > > My name is Andy, I've used Cake since 2005 and I build applications
> > > using Cake. I sporadically commit to cake among other supporting
> > > activities and used to be very active on this group - but now restrict
> > > my infrequent activities to:
> > > * checking for interesting new topics
> > > * correcting/preventing the spread of mis-information
> >
> > > My replies to you and miles fall under the second category. You
> > > **can** put controllers in subfolders. Both of you based your answers
> > > (in one level or another) on assumptions. I encourage you/anyone to
> > > try + look at the docs + check the test/write a test case before
> > > proclaiming how something works or why something's not possible.
> >
> > > Whenever I reply you can be sure one or all of the following is true:
> > > * I wrote it
> > > * I patched it
> > > * I wrote a test case for it
> > > * I've used it
> > > * I've not used it but 10s ago I tried it
> >
> > > I don't know the reason Matthew was not able to see his controllers
> > > but that's most likely irrelevant as it seems putting controllers in
> > > subfolders was not the objective - just a consequence of misreading
> > > something.
> >
> > > I don't understand 

Re: v1.3 App::Objects not finding controllers in app/controllers/subfolders

2010-05-04 Thread Matthew
Wow a lot of conflict in here. I am pretty new with Cake, I had a test
site up with 1.2 and have recently moved to 1.3 for PHP 5.3 support.
The biggest roadblock for me is permissions management. I am trying to
write a permissions editor that lists all controllers and their
methods so I can simply bind a group to a method.

Placing controllers in subfolders has always worked fine aside from
this. I guess I will just move them into the controllers root.

On May 2, 3:59 pm, Miles J  wrote:
> Hence why I said just use plugins, cause the conventions are
> automatic.
>
> On May 2, 1:56 am, AD7six  wrote:
>
>
>
> > On May 1, 10:32 pm, Jamie  wrote:
>
> > > On May 1, 1:21 pm, AD7six  wrote:
>
> > > > On May 1, 10:19 pm, Jamie  wrote:
>
> > > > > On May 1, 1:17 pm, AD7six  wrote:
>
> > > > > > On May 1, 10:13 pm, Jamie  wrote:
>
> > > > > > > On May 1, 12:46 pm, AD7six  wrote:
>
> > > > > > > > On May 1, 9:36 pm, Jamie  wrote:
>
> > > > > > > > > I read the whole thread. I'm not sure how that changes my 
> > > > > > > > > post.
>
> > > > > > > > > I was just explaining to the original poster why subfolders 
> > > > > > > > > didn't
> > > > > > > > > automatically work
>
> > > > > > > > I would suggest you try and don't assume.
>
> > > > > > > > > , why there's no easy way to make them work, and why
> > > > > > > > > they work in other frameworks/code designs. Please explain to 
> > > > > > > > > me the
> > > > > > > > > problem you have with my post and maybe we can do something
> > > > > > > > > constructive.
>
> > > > > > > > > Seriously, what is with you throwing out these sarcastic 
> > > > > > > > > comments
> > > > > > > > > lately? I can pick out more than a few examples over the past 
> > > > > > > > > little
> > > > > > > > > while. Between you and Miles this group is getting a bit 
> > > > > > > > > hostile.
>
> > > > > > > > I'm not being sarcastic - I'm giving you the opportunity to 
> > > > > > > > correct
> > > > > > > > your mistake. If you /still/ can't see it - try exactly what 
> > > > > > > > you've
> > > > > > > > said doesn't work before replying.
>
> > > > > > > Fine. Thanks for the opportunity. Glad you're looking out for me. 
> > > > > > > I
> > > > > > > made this file:
>
> > > > > > > controllers/test/users.php
>
> > > > > > I see. so you feel that by demonstrating your own example which has
> > > > > > nothing to do with this thread and is based on a different framework
> > > > > > (since you don't follow a single convention) that somehow makes your
> > > > > > reply right?
>
> > > > > You told me to try what I said wouldn't work. And I did. Then I shared
> > > > > the results.
>
> > > > > I sense that this isn't going anywhere. Thanks for hijacking my
> > > > > response...
>
> > > > Jamie you're taking this out of context and personal and I doubt
> > > > anyone else in this thread is really interested in your example.
>
> > > > This is what I expected you to do
>
> > > > mv controllers/anything_controller.php controllers/any/subfolder/you/
> > > > like
>
> > > > firefoxhttp://mysite/anything
>
> > > > and marvel at the wonder of a page that isn't a 404.
>
> > > > GN
>
> > > Maybe the original poster is used to following PEAR conventions. Who
> > > knows? Why not give the benefit of the doubt? More importantly, why
> > > not let others respond to the original poster without interjection? I
> > > was just trying to offer a possible explanation in case he was indeed
> > > expecting Cake to respect the PEAR naming style. I'm not sure why that
> > > bothered you.
>
> > Let's start again shall we.
>
> > My name is Andy, I've used Cake since 2005 and I build applications
> > using Cake. I sporadically commit to cake among other supporting
> > activities and used to be very active on this group - but now restrict
> > my infrequent activities to:
> > * checking for interesting new topics
> > * correcting/preventing the spread of mis-information
>
> > My replies to you and miles fall under the second category. You
> > **can** put controllers in subfolders. Both of you based your answers
> > (in one level or another) on assumptions. I encourage you/anyone to
> > try + look at the docs + check the test/write a test case before
> > proclaiming how something works or why something's not possible.
>
> > Whenever I reply you can be sure one or all of the following is true:
> > * I wrote it
> > * I patched it
> > * I wrote a test case for it
> > * I've used it
> > * I've not used it but 10s ago I tried it
>
> > I don't know the reason Matthew was not able to see his controllers
> > but that's most likely irrelevant as it seems putting controllers in
> > subfolders was not the objective - just a consequence of misreading
> > something.
>
> > I don't understand why you are attempting to redirect my replies/this
> > thread to be about ZEND/PEAR naming conventions when they are not
> > relevant (Matthews examples do not follow these conventions), or
> > taking my replies to you as some kind of personal atta

Re: How create a observeField with the new JSHelper?

2010-05-04 Thread cguyer
I finally came up with a solution. I don't know if this is the best
solution but it looks like it will work. Will comment back in a day or
two if i remember =)

$js->get('#FacilityFacilityName')->event('keyup', $js-
>request(array('controller'=>'users','action'=>'update_facility'),array('update'=>'#facilitylist','dataExpression'=>true,'data'=>
$js->serializeForm(array('isForm' => false, 'inline' => true)) )));

On May 4, 11:05 am, cguyer  wrote:
> how do i pass the data of the input box to the function? not even sure
> $js->request is what i should use for this. Ideas is that as a person
> types in a textbox, it does a search and updates a results div. help
> =D
>
> //form element
> echo $form->input('Facility.facility_name',array('size'=>'40','label'=>'Name 
> or
>
> Address'));
>
> //Old Ajax Helper
> echo $ajax-
>
> >observeField('FacilityFacilityName',array('update'=>'facilitylist','url'=>'update_facility','frequency'=>'1'));
>
> //New Ajax Helper
> $js->get('#FacilityFacilityName');
> $js->event('keyup', $js->request('/users/
> update_facility',array('update'=>'#facilitylist','data'=>???)));
>
> On May 3, 2:18 pm, cguyer  wrote:
>
>
>
> > i'm also trying to figure out this myself, hacking through the new
> > help and learning jquery. any help would also be appreciated.
>
> > On Apr 30, 2:38 pm, Celso  wrote:
>
> > > Hi ! I want using the new JSHelper with Jquery, i need create a
> > > observeField to fill a combo with another combo that changed
>
> > > Thanks!
> > > Celso
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > 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 sitehttp://cakeqs.organdhelp 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 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


Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Hi Andy,

i got it to work using Linkable. as well as you suggested by using
bindModel which is slightly more readble than joins.

though i think linkable is really darn short and it looks good.

I am sorry, i apologise that i misunderstood.

I thought both the linkable and the onequery are the same. and i
thought you wrote both linkable and onequery.

i got a few questions for clarification purposes. please help to
clarify.

1) i initially placed the linkable directly in app/models/behaviors/
linkable.php

having recalled my meio_upload, i realised that the behavior file was
actually stored at plugins/meio_upload/models/behaviors/
meio_upload.php.

so i did the same for linkable and called the file using $this-
>Behaviors->attach(Linkable.Linkable);

so i should place such code in plugins ALWAYS?

2) your onequery is doing the same thing as Linkable yes? as in
optimizing the query. so to use it i need only placed it in plugins/mi/
models/behaviors/one_query.php

do i need the other mi files?

3) i am preparing a simple notes on the differences of using Linkable,
Containable and the standard recursive-find. hopefully by then i can
ask you to fill in the gaps in my knowledge.

Thank you.

On May 4, 11:12 pm, AD7six  wrote:
> On May 4, 4:24 pm, Kei Simone  wrote:
>
> > Hi AD7six,
>
> > i apologise if i have asked a question that can be easily answered if
> > i looked a little more closely.
>
> I think you have a misunderstanding of what a plugin  is (see the
> book) and are mixing the usage of two different behaviors together -
> see the test case OR just use linkable and follow the docs /for that/.
>
> http://bin.cakephp.org/view/19424286(I haven't changed your incorrect
> code because there's an error on every line)
>
> AD
>
> 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


Re: Error during baking of model - Fatal error: Call to undefined method File::getAssociated()

2010-05-04 Thread mark_story
Sounds like you are trying to bake a model named File.  CakePHP uses
File as the class name for file interactions.  You might have to
choose a different classname.

-Mark

On May 3, 10:57 pm, logart  wrote:
> Hello,
>
> I am trying to do a bake for the first time, and I am getting an error
> when baking one of my models.
>
> Here is what I am seeing
>
> Wrote `/usr/local/zend/apache2/htdocs/odm_20_bake/tests/fixtures/
> category_fixture.php`
> Bake is detecting possible fixtures..
>
> Warning: dirname() expects parameter 1 to be string, array given in /
> usr/local/cake/libs/file.php on line 100
>
> Warning: is_dir() expects parameter 1 to be string, array given in /
> usr/local/cake/libs/file.php on line 101
>
> Warning: basename() expects parameter 1 to be string, array given in /
> usr/local/cake/libs/file.php on line 102
>
> Notice: Undefined property: File::$table in /usr/local/cake/libs/model/
> model.php on line 660
>
> Fatal error: Call to undefined method File::getAssociated() in /usr/
> local/cake/console/libs/tasks/test.php on line 311
>
> Any ideas?
>
> 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


Re: "At least one related record" condition

2010-05-04 Thread Zaky Katalan-Ezra
In client side with javascript when submit button is clicked

On Tue, May 4, 2010 at 6:43 PM, John Andersen wrote:

> Can you explain why an Order must have at least one item in your
> application?
>
> I would disagree, but that is because I assume that I can make an
> Order with the one Item, and then delete the Item and choose another.
> So in my opinion the Order can be without any Items.
>
> Another point is that when the Order is to be submitted for
> processing, then the Order must at least have one Item.
>
> Can you comment on this? Enjoy,
>   John
>
> On May 4, 5:35 pm, Ernesto  wrote:
> > Hello.
> >
> > is there any simple way to implement the "At least one related record"
> > conditions to Cake model's associations?
> >
> > for example:
> >
> > i have an Order model hasMany Items.
> >
> > an order cannot be empty. it must contain at least one item (i.e.
> > related record)
> >
> > 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.comFor
> >  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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Regards,
Zaky Katalan-Ezra
QA Administrator
www.IGeneriX.com
Sites.IGeneriX.com
054-7762312

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: "At least one related record" condition

2010-05-04 Thread Brenda
In your beforeSave for order, you can check that at least one item
exists.

Brenda

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: "At least one related record" condition

2010-05-04 Thread John Andersen
Can you explain why an Order must have at least one item in your
application?

I would disagree, but that is because I assume that I can make an
Order with the one Item, and then delete the Item and choose another.
So in my opinion the Order can be without any Items.

Another point is that when the Order is to be submitted for
processing, then the Order must at least have one Item.

Can you comment on this? Enjoy,
   John

On May 4, 5:35 pm, Ernesto  wrote:
> Hello.
>
> is there any simple way to implement the "At least one related record"
> conditions to Cake model's associations?
>
> for example:
>
> i have an Order model hasMany Items.
>
> an order cannot be empty. it must contain at least one item (i.e.
> related record)
>
> 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


Re: Sessions working in one controller and not the other

2010-05-04 Thread thatsgreat2345
Not a clue, would have to look into the core for that. But either way
just add var $components = array('Session'); to both of them.

On May 3, 7:21 pm, LordZardeck  wrote:
> Ok, I found out that the problem arises when I use a model. When I set
> the $uses varibale to an empty array, it works. What would cause this?
>
> On May 3, 6:21 pm, thatsgreat2345  wrote:
>
>
>
> > Include the session component
>
> > On May 3, 3:59 pm, LordZardeck  wrote:
>
> > > For some reason, the session handling works in one controller and not
> > > the other. I can't figure out why. I am using CakePHP 1.2.5.
>
> > > //
> > > //Does work
> > > //
>
> > > sessions_controller.php:
>
> > > class SessionsController extends AppController {
> > >     var $name = "Sessions";
> > >     var $layout = "ajax";
> > >     var $uses = array();
>
> > >     function create(){
> > >         if($this->Session->read('Data') == null){
> > >             $this->Session->write('Data', rand());
> > >         }
> > >         $this->set('data', $this->Session->read('Data'));
> > >         $this->set('SessionID', $this->Session->id());
> > >     }
>
> > > }
>
> > > create.ctp:
> > > $msgJson["SessionID"] = $SessionID;
> > > $msgJson["data"] = $data;
> > > echo json_encode($msgJson);
> > > //results in ({"SessionID":"sd8s8o32edmjnjt94ouse99fd2","data":19409})
> > > every time (parenthesis not in result)
>
> > > //
> > > //Doesn't Work
> > > //
>
> > > messages_controller.php:
>
> > > class MessagesController extends AppController {
>
> > >     var $name = 'Messages';
> > >     var $layout = "ajax";
>
> > >     function listMessages() {
> > >         if($this->Session->read('Data') == null){
> > >             $this->Session->write('Data', rand());
> > >         }
> > >         $this->set('data', $this->Session->read('Data'));
> > >         $this->set('SessionID', $this->Session->id());
> > >         $this->set('messages', $this->Message->find("all",
> > > array("order"=>"priority ASC")));
> > >     }
>
> > > }
>
> > > list_messages.ctp:
>
> > > $msgJson["count"] = count($messages);
> > > $msgJson["SessionID"] = $SessionID;
> > > $msgJson["SessionData"] = $data;
> > > foreach($messages as $message){
> > >     $msg[] = $message["Message"];}
>
> > > $msgJson["items"] = $msg;
> > > echo json_encode($msgJson);
> > > /*
> > > results in ({"count":3,"SessionID":"","SessionData":27384,"items":
> > > [{"id":"4","priority":"3","subject":"Another
> > > message","message":"adsfasdf"},
> > > {"id":"2","priority":"3","subject":"testing again","message":"just
> > > seeing ow "},
> > > {"id":"7","priority":"3","subject":"asdgasdg","message":"asdfasdfasd"}]})
> > > except the SessionData changes everytime and the SessionID never shows
> > > up.
> > > */
>
> > > Any ideas what might be wrong?
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > 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 sitehttp://cakeqs.organdhelp 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-Hide quoted text -
>
> > - Show quoted text -
>
> 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


Structure of data returned by $this->Model->find

2010-05-04 Thread Roland B
Hi,

is there a way to change the structure of data returned by a model's
find call? Or should I use a different call? IMHO, the default seems
to be inconsistent in the way it handles associations:

Given this model:
//---
class Querycategory extends AppModel
{
   var $recursive = 10;
   var $hasMany = array(
  'Querycategory' => array('order' => 'name ASC'),
  'Querygroup'=> array('order' => 'name ASC'));
}
//---

A call to $this->Querycategory->find('all') yields something like
this:

Array
(
[0] => Array
(
[Querycategory] => Array
(
[id] => 70
[querycategory_id] => 34
[0] => Array
(
[id] => 71
[querycategory_id] => 70
[Querygroup] => Array
(
[0] => Array
(
[id] => 43
[querycategory_id] => 71
)
)
)
)
[Querygroup] => Array
(
)
)
)

A Querygroup belonging to the Root-Querycategory is at the same level
as the root node and it is called Querygroup.
A Querygroup belonging to a child category is inside that child node
and it is called Querygroup.
A Querycategory belonging to any other category is inside its parent
and unnamed, unless there is also a Querygroup at the same level: then
it is called 'Querycategory'

I would prefer:
Querygroup is always contained in it's "parent", always being called
'Querygroup'.
Querycategory is always contained in its "parent", always being called
'Querycategory'.

Is there a "standard way" to achieve this?

Using cake-1.2.


Thank you very much in advance,

Roland

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


Problem with Fck Editor File manager

2010-05-04 Thread Pithva Bhargav
I have got the following error in fckeditor (filemanager) integrated in one
of my sites developed in cakephp. At localhost (offline), everything works
fine, but on my site when it si online, i get the following error:


Forbidden

You don't have permission to access
/hmsexpress/admin/js/editor/filemanager/browser/default/browser.html on this
server.

Additionally, a 404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.
Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8i DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at
www.starletexports.com Port 80


Please help me to solve this problem and also give or suggest me the steps
for the same.

Regards,

Bhargav

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


Error during baking of model - Fatal error: Call to undefined method File::getAssociated()

2010-05-04 Thread logart
Hello,

I am trying to do a bake for the first time, and I am getting an error
when baking one of my models.

Here is what I am seeing


Wrote `/usr/local/zend/apache2/htdocs/odm_20_bake/tests/fixtures/
category_fixture.php`
Bake is detecting possible fixtures..

Warning: dirname() expects parameter 1 to be string, array given in /
usr/local/cake/libs/file.php on line 100

Warning: is_dir() expects parameter 1 to be string, array given in /
usr/local/cake/libs/file.php on line 101

Warning: basename() expects parameter 1 to be string, array given in /
usr/local/cake/libs/file.php on line 102

Notice: Undefined property: File::$table in /usr/local/cake/libs/model/
model.php on line 660

Fatal error: Call to undefined method File::getAssociated() in /usr/
local/cake/console/libs/tasks/test.php on line 311


Any 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


What to do when HABTM becomes complicated?

2010-05-04 Thread fly2279
I have a schema similar to the example in the book:
http://book.cakephp.org/view/1034/Saving-Related-Model-Data-HABTM
where Child HABTM Club through a Membership table. I'm using Child
hasMany Membership, Club hasMany Membership, and Membership belongsTo
Child and Club because I'm saving additional data in the Membership
table.

What is the best way to delete the current memberships and save all
new ones when editing a Child or Club? I really like the way cake
deletes all the existing join table rows and creates new ones when you
use this like a HABTM and 'unique' is set to true.

Should I use a behavior (is there one out there?) or manually delete
the existing rows in a beforeSave? What happens if the existing join
table rows get deleted but for whatever reason the new ones don't get
saved then? If you end up using a transaction to save then you have to
clutter up a controller to begin and commit the transaction. I don't
think that's the best but I'd like any ideas or best practices anybody
can give.

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread AD7six


On May 4, 4:24 pm, Kei Simone  wrote:
> Hi AD7six,
>
> i apologise if i have asked a question that can be easily answered if
> i looked a little more closely.

I think you have a misunderstanding of what a plugin  is (see the
book) and are mixing the usage of two different behaviors together -
see the test case OR just use linkable and follow the docs /for that/.

http://bin.cakephp.org/view/19424286 (I haven't changed your incorrect
code because there's an error on every line)

AD

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: How create a observeField with the new JSHelper?

2010-05-04 Thread cguyer
how do i pass the data of the input box to the function? not even sure
$js->request is what i should use for this. Ideas is that as a person
types in a textbox, it does a search and updates a results div. help
=D


//form element
echo $form-
>input('Facility.facility_name',array('size'=>'40','label'=>'Name or
Address'));


//Old Ajax Helper
echo $ajax-
>observeField('FacilityFacilityName',array('update'=>'facilitylist','url'=>'update_facility','frequency'=>'1'));

//New Ajax Helper
$js->get('#FacilityFacilityName');
$js->event('keyup', $js->request('/users/
update_facility',array('update'=>'#facilitylist','data'=>???)));

On May 3, 2:18 pm, cguyer  wrote:
> i'm also trying to figure out this myself, hacking through the new
> help and learning jquery. any help would also be appreciated.
>
> On Apr 30, 2:38 pm, Celso  wrote:
>
> > Hi ! I want using the new JSHelper with Jquery, i need create a
> > observeField to fill a combo with another combo that changed
>
> > Thanks!
> > Celso
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 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


Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Perhaps i made a mistake in trying out jon's query. it does NOT get me
what i want. not even close.

I tend to agree with AD7six that Containable is not suitable for my
situation.

Thank you though. :)

On May 4, 10:18 pm, Andrei Mita  wrote:
> OK, something is really wrong here. In my e-mail account there are just a
> couple of emails whereas in the group there are dozens.
>
> That explains a lot.
>
> The second query, the one suggested by Jon, was very close to get you what
> you wanted.
>
>
>
>
>
> On Tue, May 4, 2010 at 4:35 PM, Kei Simone  wrote:
> > Hi Andrei,
>
> > thanks for your reply.
>
> > Here is my reply.
>
> > 1) i agree with you when "teaching" or "helping out" you learn faster.
> > i have some personal experience of that myself. I am sure you mean no
> > malice and was also trying to be helpful.
>
> > 2) unfortunately i think what you suggested was exactly what i tried
> > out ALREADY here.
> >http://groups.google.com/group/cake-php/msg/fc2a2b9779c5b182
>
> > 3) you must have wrote that message in a jiffy, because you have
> > ignored the fact that Domain is NOT directly connected to Merchant. i
> > am not going to paste the links. You can find all the schema i wrote
> > so far above.
>
> > 4) I really appreciated your input, i think it is infinitely better
> > than having no one look at my problem at all.
>
> > 5) Have a nice day.
>
> > On May 4, 9:16 pm, Andrei Mita  wrote:
> > > Being a newbie to cakephp myself, I found out that by trying to help out
> > > other people I get to learn it better and faster. I did pay attention
> > but,
> > > as I told you, I'm not having a good time right now and most probably
> > that's
> > > why I didn't get you problem the first time.
>
> > > Feelings aside :), here is how I do things when it comes to complex-ish
> > > queries. First, I try the recursive = 2 and a debug  on the var to see
> > > exactly how much data I'm getting and how much do I need to take out.
> > That's
> > > why I was bugging you with that. When you have the debugged array in from
> > of
> > > you it's very easy to write the containable query.
>
> > > First, attach Containable on the fly in the view action:
> > > $this->Merchant->attach('Containable');
>
> > > Then the query:
>
> > > $merchant = $this->Merchant->find('first', array(
> > >                                             'contain' => array(
> > >                                                             'User' =>
> > > array('conditions' => array('User.email' => $email)),
> > >                                                             'Domain' =>
> > > array('conditions' => array('Domain.primary' => $primary)),
> > >                                                             'Shop'
> > >                                                          ),
> > >                                             'conditions' =>
> > > array('Merchant.owner' => $owner)
> > >                                            )
> > >                                   );
>
> > > I've wrote this blindfolded and I have no idea if it will work, but i
> > think
> > > it's a good start. I'll test case it myself if it's necessary.
>
> > > On Tue, May 4, 2010 at 3:48 PM, Kei Simone  wrote:
> > > > Hi Andrei,
>
> > > > my first kneejerk feeling is that you are not paying attention to my
> > > > previous reply with the schema attached.
>
> > > > but i am going to ignore that feeling and assume that probably it was
> > > > my communication that was bad.
>
> > > > 1) let me rephrase the schema again.
>
> > > > User
> > > >  -id
> > > >  -email
> > > >  -password
> > > >  -name
>
> > > > Merchant
> > > >  -id
> > > >  -user_id
> > > >  -shop_id
> > > >  -owner
>
> > > > Shop
> > > >  -id
> > > >  -name
> > > >  -description
>
> > > > Domain
> > > >  -id
> > > >  -domain
> > > >  -primary
>
> > > > Once again, the associations are that:
> > > >  User hasOne Merchant
> > > >  Shop hasMany Merchant
> > > >  Shop hasMany Domain
>
> > > > I am looking to grab data from Merchant model.
>
> > > > The conditions are
>
> > > > Domain.primary =1
> > > > User.email = a...@a.com
> > > > Merchant.owner = 1
>
> > > > I want to grab the FIRST data row that matches the conditions.
>
> > > > the datarow must have data from all 4 models.
>
> > > > 2)
>
> > > > No i have not tried the find all with recursive 2
>
> > > > there are 3 reasons:
>
> > > > 1) my joins is already working. my purpose in starting this thread is
> > > > to see if
>
> > > > a) i can do it in containable because i am forseeing a lot of similar
> > > > (complex find) situations cropping up down the line and if Containable
> > > > behavior is core then there must be a good reason to use it over
> > > > joins.
>
> > > > b) i REALLY REALLY want to get better at cakephp hence understanding
> > > > and studying Containable a core behavior is essential
>
> > > > since my joins is already working i have less inclination to try out
> > > > the find all with recursive 2.
>
> > > > 2) my merchants and shops and us

"At least one related record" condition

2010-05-04 Thread Ernesto
Hello.

is there any simple way to implement the "At least one related record"
conditions to Cake model's associations?

for example:

i have an Order model hasMany Items.

an order cannot be empty. it must contain at least one item (i.e.
related record)

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Hi AD7six,

i apologise if i have asked a question that can be easily answered if
i looked a little more closely.

but i am having some problems.

Here it is:

i tried this

$this->Behaviors->attach('OneQuery');
$this->User->Behaviors->attach('OneQuery');
$this->Shop->Behaviors->attach('OneQuery');
$this->Shop->Domain->Behaviors->attach('OneQuery');

debug('test');
return $this->find('first', array(
// linkable behavior in OneQuery
'link'=>array(
'User',
'Shop'=>'Domain',
),
// conditions for the main model

'conditions'=>array('Merchant.owner'=>1,
'User.group_id'=>MERCHANTS,
'User.email' => 'a...@a.com',
'Shop.web_address' => 
'http://abc.myspree2shop.com',),

));

i got this in my query:

SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
`Merchant`.`user_id` FROM `merchants` AS `Merchant` WHERE
`Merchant`.`owner` = 1 AND `User`.`group_id` = 3 AND `User`.`email` =
'a...@a.com' AND `Shop`.`web_address` = 'http://abc.myspree2shop.com'

And this error message
1054: Unknown column 'User.group_id' in 'where clause'

So i tried to change it to look like one of your examples in your
blogpost.

$this->Behaviors->attach('OneQuery');
$this->User->Behaviors->attach('OneQuery');
$this->Shop->Behaviors->attach('OneQuery');
$this->Shop->Domain->Behaviors->attach('OneQuery');

debug('test');
return $this->find('all', array(
// linkable behavior in OneQuery
'link'=>array(
'User',
'Shop'=>'Domain',
),


));

i get this instead

SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
`Merchant`.`user_id` FROM `merchants` AS `Merchant` WHERE 1 = 1

and the data set ONLY containing Merchant data

Array
(
[0] => Array
(
[Merchant] => Array
(
[id] => 1
[owner] => 1
[shop_id] => 1
[user_id] => 1
)

)

[1] => Array
(
[Merchant] => Array
(
[id] => 2
[owner] => 1
[shop_id] => 2
[user_id] => 2
)

)

)

 i suspect i must have done something wrong. Please advise.

 Appreciate it greatly.




On May 4, 8:44 pm, AD7six  wrote:
> On May 4, 2:13 pm, sphereweb  wrote:
>
> > I would like to see your example that gets the data from 4-5 tables :)
>
> There's only 1 test case in it but you can see usage 
> here:http://github.com/AD7six/mi/blob/master/tests/cases/behaviors/one_que...
>
> Although the single test case is calling oneQuery explicitly - you
> normally use the behavior in exactly the same as containable
> (including you can configure onequery to look for the param name
> "contain") but the result is - one query.
>
> hth,
>
> AD
>
> 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


Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Andrei Mita
OK, something is really wrong here. In my e-mail account there are just a
couple of emails whereas in the group there are dozens.

That explains a lot.

The second query, the one suggested by Jon, was very close to get you what
you wanted.

On Tue, May 4, 2010 at 4:35 PM, Kei Simone  wrote:

> Hi Andrei,
>
> thanks for your reply.
>
> Here is my reply.
>
> 1) i agree with you when "teaching" or "helping out" you learn faster.
> i have some personal experience of that myself. I am sure you mean no
> malice and was also trying to be helpful.
>
> 2) unfortunately i think what you suggested was exactly what i tried
> out ALREADY here.
> http://groups.google.com/group/cake-php/msg/fc2a2b9779c5b182
>
> 3) you must have wrote that message in a jiffy, because you have
> ignored the fact that Domain is NOT directly connected to Merchant. i
> am not going to paste the links. You can find all the schema i wrote
> so far above.
>
> 4) I really appreciated your input, i think it is infinitely better
> than having no one look at my problem at all.
>
> 5) Have a nice day.
>
> On May 4, 9:16 pm, Andrei Mita  wrote:
> > Being a newbie to cakephp myself, I found out that by trying to help out
> > other people I get to learn it better and faster. I did pay attention
> but,
> > as I told you, I'm not having a good time right now and most probably
> that's
> > why I didn't get you problem the first time.
> >
> > Feelings aside :), here is how I do things when it comes to complex-ish
> > queries. First, I try the recursive = 2 and a debug  on the var to see
> > exactly how much data I'm getting and how much do I need to take out.
> That's
> > why I was bugging you with that. When you have the debugged array in from
> of
> > you it's very easy to write the containable query.
> >
> > First, attach Containable on the fly in the view action:
> > $this->Merchant->attach('Containable');
> >
> > Then the query:
> >
> > $merchant = $this->Merchant->find('first', array(
> > 'contain' => array(
> > 'User' =>
> > array('conditions' => array('User.email' => $email)),
> > 'Domain' =>
> > array('conditions' => array('Domain.primary' => $primary)),
> > 'Shop'
> >  ),
> > 'conditions' =>
> > array('Merchant.owner' => $owner)
> >)
> >   );
> >
> > I've wrote this blindfolded and I have no idea if it will work, but i
> think
> > it's a good start. I'll test case it myself if it's necessary.
> >
> >
> >
> >
> >
> > On Tue, May 4, 2010 at 3:48 PM, Kei Simone  wrote:
> > > Hi Andrei,
> >
> > > my first kneejerk feeling is that you are not paying attention to my
> > > previous reply with the schema attached.
> >
> > > but i am going to ignore that feeling and assume that probably it was
> > > my communication that was bad.
> >
> > > 1) let me rephrase the schema again.
> >
> > > User
> > >  -id
> > >  -email
> > >  -password
> > >  -name
> >
> > > Merchant
> > >  -id
> > >  -user_id
> > >  -shop_id
> > >  -owner
> >
> > > Shop
> > >  -id
> > >  -name
> > >  -description
> >
> > > Domain
> > >  -id
> > >  -domain
> > >  -primary
> >
> > > Once again, the associations are that:
> > >  User hasOne Merchant
> > >  Shop hasMany Merchant
> > >  Shop hasMany Domain
> >
> > > I am looking to grab data from Merchant model.
> >
> > > The conditions are
> >
> > > Domain.primary =1
> > > User.email = a...@a.com
> > > Merchant.owner = 1
> >
> > > I want to grab the FIRST data row that matches the conditions.
> >
> > > the datarow must have data from all 4 models.
> >
> > > 2)
> >
> > > No i have not tried the find all with recursive 2
> >
> > > there are 3 reasons:
> >
> > > 1) my joins is already working. my purpose in starting this thread is
> > > to see if
> >
> > > a) i can do it in containable because i am forseeing a lot of similar
> > > (complex find) situations cropping up down the line and if Containable
> > > behavior is core then there must be a good reason to use it over
> > > joins.
> >
> > > b) i REALLY REALLY want to get better at cakephp hence understanding
> > > and studying Containable a core behavior is essential
> >
> > > since my joins is already working i have less inclination to try out
> > > the find all with recursive 2.
> >
> > > 2) my merchants and shops and users model have 4 to 6 Other models
> > > tied to them EACH.
> >
> > > Recursive 2 would be mean retrieving a lot of data. I am assuming this
> > > from the docs i read in book.cakephp.org esp the articles on
> > > Containable. in fact this is the very reason why Containable was
> > > promoted to solve this very same issue.
> >
> > > Unless of course i misinterpret your meaning. then i sh

Re: Simple assoication not working

2010-05-04 Thread Don Drake
I'm glad you gave the 'hint' because I was looking at that linked page and
the problem code and had no idea what was wrong (being new enough to still
have to look this stuff up).

Here's the page that deals with the file naming problem:
http://book.cakephp.org/view/23/File-and-Classname-Conventions

Don

On Tue, May 4, 2010 at 12:45 AM, WebbedIT  wrote:

>
> > Have another look at your naming conventions, most notably those for your
> > models.
> >
> > http://book.cakephp.org/view/24/Model-and-Database-Conventions
>
> Hint: Your model filenames should be singular.
>
> When first learning CakePHP and any problems arise it's often down to
> a deviation from the conventions so learn them inside out and stick to
> them whenever possible.
>
> 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.comFor
>  more options, visit this group at
> http://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


Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Hi Andrei,

thanks for your reply.

Here is my reply.

1) i agree with you when "teaching" or "helping out" you learn faster.
i have some personal experience of that myself. I am sure you mean no
malice and was also trying to be helpful.

2) unfortunately i think what you suggested was exactly what i tried
out ALREADY here. http://groups.google.com/group/cake-php/msg/fc2a2b9779c5b182

3) you must have wrote that message in a jiffy, because you have
ignored the fact that Domain is NOT directly connected to Merchant. i
am not going to paste the links. You can find all the schema i wrote
so far above.

4) I really appreciated your input, i think it is infinitely better
than having no one look at my problem at all.

5) Have a nice day.

On May 4, 9:16 pm, Andrei Mita  wrote:
> Being a newbie to cakephp myself, I found out that by trying to help out
> other people I get to learn it better and faster. I did pay attention but,
> as I told you, I'm not having a good time right now and most probably that's
> why I didn't get you problem the first time.
>
> Feelings aside :), here is how I do things when it comes to complex-ish
> queries. First, I try the recursive = 2 and a debug  on the var to see
> exactly how much data I'm getting and how much do I need to take out. That's
> why I was bugging you with that. When you have the debugged array in from of
> you it's very easy to write the containable query.
>
> First, attach Containable on the fly in the view action:
> $this->Merchant->attach('Containable');
>
> Then the query:
>
> $merchant = $this->Merchant->find('first', array(
>                                             'contain' => array(
>                                                             'User' =>
> array('conditions' => array('User.email' => $email)),
>                                                             'Domain' =>
> array('conditions' => array('Domain.primary' => $primary)),
>                                                             'Shop'
>                                                          ),
>                                             'conditions' =>
> array('Merchant.owner' => $owner)
>                                            )
>                                   );
>
> I've wrote this blindfolded and I have no idea if it will work, but i think
> it's a good start. I'll test case it myself if it's necessary.
>
>
>
>
>
> On Tue, May 4, 2010 at 3:48 PM, Kei Simone  wrote:
> > Hi Andrei,
>
> > my first kneejerk feeling is that you are not paying attention to my
> > previous reply with the schema attached.
>
> > but i am going to ignore that feeling and assume that probably it was
> > my communication that was bad.
>
> > 1) let me rephrase the schema again.
>
> > User
> >  -id
> >  -email
> >  -password
> >  -name
>
> > Merchant
> >  -id
> >  -user_id
> >  -shop_id
> >  -owner
>
> > Shop
> >  -id
> >  -name
> >  -description
>
> > Domain
> >  -id
> >  -domain
> >  -primary
>
> > Once again, the associations are that:
> >  User hasOne Merchant
> >  Shop hasMany Merchant
> >  Shop hasMany Domain
>
> > I am looking to grab data from Merchant model.
>
> > The conditions are
>
> > Domain.primary =1
> > User.email = a...@a.com
> > Merchant.owner = 1
>
> > I want to grab the FIRST data row that matches the conditions.
>
> > the datarow must have data from all 4 models.
>
> > 2)
>
> > No i have not tried the find all with recursive 2
>
> > there are 3 reasons:
>
> > 1) my joins is already working. my purpose in starting this thread is
> > to see if
>
> > a) i can do it in containable because i am forseeing a lot of similar
> > (complex find) situations cropping up down the line and if Containable
> > behavior is core then there must be a good reason to use it over
> > joins.
>
> > b) i REALLY REALLY want to get better at cakephp hence understanding
> > and studying Containable a core behavior is essential
>
> > since my joins is already working i have less inclination to try out
> > the find all with recursive 2.
>
> > 2) my merchants and shops and users model have 4 to 6 Other models
> > tied to them EACH.
>
> > Recursive 2 would be mean retrieving a lot of data. I am assuming this
> > from the docs i read in book.cakephp.org esp the articles on
> > Containable. in fact this is the very reason why Containable was
> > promoted to solve this very same issue.
>
> > Unless of course i misinterpret your meaning. then i shall try it out.
> > but only if you give me exact details.
>
> > I am a 1 month old in terms of cake usage despite reading the docs
> > extensively i may still need quite a bit of hand holding.
>
> > 3) i want to find the first datarow that matches the condition not
> > ALL. minor point of course i could easily change it to find first with
> > recursive 2 but then reason 2 would still stand.
>
> > I am truly sorry if what i said is rude or offends you. At work and at
> > home, i have been labelled as harsh and insensitive.
>
> > At times i wonder if i am autistic.
>
> 

Mail component

2010-05-04 Thread Ajain09

Hi All,

I am new to CakePHP and currently preparing a matrix of all the features
provided by cakePHP. I have one question regarding email component.
Do we have any plugin for email component which can be integrated with
cakephp. Basically i m looking for a plugin which can be used to provide
functionality such as preview, place holders in mail body or managing
authentication etc.

I also want to know, whether this anyways is possible to implement with cake
or not

Any help or comments will be very helpful.

cheers. 
-- 
View this message in context: 
http://old.nabble.com/Mail-component-tp28447488p28447488.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


difficulty with report component

2010-05-04 Thread butterlamb
Hello,

I'm having difficulty implementing the report component that was
posted in the bakery some time ago:
http://bakery.cakephp.org/articles/view/report-creator-component

Since I'm using Cake 1.2.6, I modified it as suggested further down in
the comments, but I'm getting the below fatal error when I try to run
the reports:

Fatal error: Class '' not found in [path/to/component/class] on line
78

The line in question is:

$this-> model = new $value;

I'm wondering if anyone has had any luck using this in 1.2, and if so,
do you have any suggestions on how to fix this?

Best,
butterlamb

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Andrei Mita
Being a newbie to cakephp myself, I found out that by trying to help out
other people I get to learn it better and faster. I did pay attention but,
as I told you, I'm not having a good time right now and most probably that's
why I didn't get you problem the first time.

Feelings aside :), here is how I do things when it comes to complex-ish
queries. First, I try the recursive = 2 and a debug  on the var to see
exactly how much data I'm getting and how much do I need to take out. That's
why I was bugging you with that. When you have the debugged array in from of
you it's very easy to write the containable query.

First, attach Containable on the fly in the view action:
$this->Merchant->attach('Containable');

Then the query:

$merchant = $this->Merchant->find('first', array(
'contain' => array(
'User' =>
array('conditions' => array('User.email' => $email)),
'Domain' =>
array('conditions' => array('Domain.primary' => $primary)),
'Shop'
 ),
'conditions' =>
array('Merchant.owner' => $owner)
   )
  );

I've wrote this blindfolded and I have no idea if it will work, but i think
it's a good start. I'll test case it myself if it's necessary.


On Tue, May 4, 2010 at 3:48 PM, Kei Simone  wrote:

> Hi Andrei,
>
> my first kneejerk feeling is that you are not paying attention to my
> previous reply with the schema attached.
>
> but i am going to ignore that feeling and assume that probably it was
> my communication that was bad.
>
> 1) let me rephrase the schema again.
>
> User
>  -id
>  -email
>  -password
>  -name
>
> Merchant
>  -id
>  -user_id
>  -shop_id
>  -owner
>
> Shop
>  -id
>  -name
>  -description
>
> Domain
>  -id
>  -domain
>  -primary
>
> Once again, the associations are that:
>  User hasOne Merchant
>  Shop hasMany Merchant
>  Shop hasMany Domain
>
> I am looking to grab data from Merchant model.
>
> The conditions are
>
> Domain.primary =1
> User.email = a...@a.com
> Merchant.owner = 1
>
> I want to grab the FIRST data row that matches the conditions.
>
> the datarow must have data from all 4 models.
>
> 2)
>
> No i have not tried the find all with recursive 2
>
> there are 3 reasons:
>
> 1) my joins is already working. my purpose in starting this thread is
> to see if
>
> a) i can do it in containable because i am forseeing a lot of similar
> (complex find) situations cropping up down the line and if Containable
> behavior is core then there must be a good reason to use it over
> joins.
>
> b) i REALLY REALLY want to get better at cakephp hence understanding
> and studying Containable a core behavior is essential
>
> since my joins is already working i have less inclination to try out
> the find all with recursive 2.
>
> 2) my merchants and shops and users model have 4 to 6 Other models
> tied to them EACH.
>
> Recursive 2 would be mean retrieving a lot of data. I am assuming this
> from the docs i read in book.cakephp.org esp the articles on
> Containable. in fact this is the very reason why Containable was
> promoted to solve this very same issue.
>
> Unless of course i misinterpret your meaning. then i shall try it out.
> but only if you give me exact details.
>
> I am a 1 month old in terms of cake usage despite reading the docs
> extensively i may still need quite a bit of hand holding.
>
> 3) i want to find the first datarow that matches the condition not
> ALL. minor point of course i could easily change it to find first with
> recursive 2 but then reason 2 would still stand.
>
>
> I am truly sorry if what i said is rude or offends you. At work and at
> home, i have been labelled as harsh and insensitive.
>
> At times i wonder if i am autistic.
>
> But this (obsessive) search to understand how the heck to get complex
> search right and get a true understanding of cake is driving me to go
> full out to seek answers so please forgive me should you be offended.
>
> Thank you.
>
> On May 4, 7:49 pm, Andrei Mita  wrote:
> > I'm having a hard time understanding your problem, probably it's just me,
> > I'm not having a good time at work.
> >
> >
>

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Hi Jeremy,

thank you for answering.

I agree with you that it would be silly of me to keep emphasizing to
do the find from merchant. i would readily accept a solution that does
it elegantly even if the find starts from another model.

For instance, i tried out Jon's example code and subsequently put up
the resultant sql query and results. you can see the ultra long post.

My gut feeling tells me that I do not see any significant difference
even if i start from User model.

But of course i would be more convinced if

a) you point out the exact reason why starting from User would prove
to be different this time.

OR

b) like jon, you put up some example code for me to try out.

at the very least my guess is that either Merchant or Shop would be
the best to start from since the associations look like this

User <-> Merchant <-> Shop <-> Domain

Thank you for taking time to answer though. I appreciate all input.


On May 4, 7:15 pm, Jeremy Burns  wrote:
> The find does not have to be done from the Merchant model. If the models are 
> related if sometimes makes sense to hop across to another model to start the 
> find from there (I often do this). If it makes more sense to start it from, 
> say, the User model, then you can do $this->Merchant->User->find() and 
> contain the Merchant, Shop and Domain models.
>
> Jeremy Burns
> jeremybu...@me.com
> On 4 May 2010, at 12:06, Kei Simone wrote:
>
>
>
> > i have the following for my cake 1.3:
>
> > User hasOne Merchant (so Merchant belongsTo User)
> > Shop hasMany Merchant (so Merchant belongsTo Shop as well.)
> > Shop hasMany Domain (so Domain belongsTo Shop.)
>
> > i need to use Merchant model to do a find of all 4 related data.
>
> > i need to find the first datarow that matches conditions for Merchant,
> > User and Domain.
>
> > Merchant.owner = 1
> > User.email = a...@a.com
> > Domain.domain =http://abc.example.com
> > Domain.primary = 1
>
> > the datarow must contain data from all 4 models.
>
> > the find must be done inside the Merchant model. as in $this->find...
>
> > Love to hear more from you about Containable. Really interested to see
> > how powerful Containable is.
>
> > On May 3, 3:33 pm, Andrei Mita  wrote:
> >> Simone,
>
> >> Containable is extremely powerful. I am just amazed how little time it 
> >> takes
> >> me to write complex queries.
>
> >> Give me the structure of the tables and an example of what do you want to
> >> retrieve from them and I might be able to help you around.
>
> >> On Mon, May 3, 2010 at 8:02 AM, Kei Simone  wrote:
> >>> Hi i did this
>
> >>> $this->Behaviors->attach('Containable');
> >>>                $this->User->Behaviors->attach('Containable');
> >>>                $this->Shop->Behaviors->attach('Containable');
> >>>                $this->Shop->Domain->Behaviors->attach('Containable');
>
> >>>                $this->recursive = -1;
> >>>                $this->User->recursive = -1;
> >>>                $this->Shop->recursive = -1;
> >>>                $this->Shop->Domain->recursive = -1;
>
> >>>                return $this->find('first', array(
> >>>                         // conditions for the main model
> >>>                         'conditions'=>array('Merchant.owner'=>1),
> >>>                         // contain
> >>>                        'contain'=>array(
> >>>                                'User'=>array(
> >>>                                        // conditions for the user model
>
> >>>  'conditions'=>array('User.group_id'=>MERCHANTS,
> >>>                                                            'User.email' =>
> >>> 'a...@a.com',),
>
> >>>                                ),
> >>>                                'Shop'=>array(
>
> >>>  'conditions'=>array('Shop.web_address' => 'http://
> >>> abc.myspree2shop.com',),
> >>>                                              'Domain'),
> >>>                        )
> >>>                ));
>
> >>> i got this in the sql query log
>
> >>> SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
> >>> `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> >>> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> >>> `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
> >>> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> >>> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> >>> `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `shops`
> >>> AS `Shop` ON (`Merchant`.`shop_id` = `Shop`.`id` AND
> >>> `Shop`.`web_address` = 'http://abc.myspree2shop.com') LEFT JOIN
> >>> `users` AS `User` ON (`Merchant`.`user_id` = `User`.`id` AND
> >>> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com') WHERE
> >>> `Merchant`.`owner` = 1 LIMIT 1
>
> >>> SELECT `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> >>> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> >>> `Shop`.`status` FROM `shops` AS `Shop` WHERE `Shop`.`id` = 1 AND
> >>> `Shop`.`web_address` = 'http://abc.myspree2

Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Hi Andrei,

my first kneejerk feeling is that you are not paying attention to my
previous reply with the schema attached.

but i am going to ignore that feeling and assume that probably it was
my communication that was bad.

1) let me rephrase the schema again.

User
  -id
  -email
  -password
  -name

Merchant
  -id
  -user_id
  -shop_id
  -owner

Shop
  -id
  -name
  -description

Domain
  -id
  -domain
  -primary

Once again, the associations are that:
  User hasOne Merchant
  Shop hasMany Merchant
  Shop hasMany Domain

I am looking to grab data from Merchant model.

The conditions are

Domain.primary =1
User.email = a...@a.com
Merchant.owner = 1

I want to grab the FIRST data row that matches the conditions.

the datarow must have data from all 4 models.

2)

No i have not tried the find all with recursive 2

there are 3 reasons:

1) my joins is already working. my purpose in starting this thread is
to see if

a) i can do it in containable because i am forseeing a lot of similar
(complex find) situations cropping up down the line and if Containable
behavior is core then there must be a good reason to use it over
joins.

b) i REALLY REALLY want to get better at cakephp hence understanding
and studying Containable a core behavior is essential

since my joins is already working i have less inclination to try out
the find all with recursive 2.

2) my merchants and shops and users model have 4 to 6 Other models
tied to them EACH.

Recursive 2 would be mean retrieving a lot of data. I am assuming this
from the docs i read in book.cakephp.org esp the articles on
Containable. in fact this is the very reason why Containable was
promoted to solve this very same issue.

Unless of course i misinterpret your meaning. then i shall try it out.
but only if you give me exact details.

I am a 1 month old in terms of cake usage despite reading the docs
extensively i may still need quite a bit of hand holding.

3) i want to find the first datarow that matches the condition not
ALL. minor point of course i could easily change it to find first with
recursive 2 but then reason 2 would still stand.


I am truly sorry if what i said is rude or offends you. At work and at
home, i have been labelled as harsh and insensitive.

At times i wonder if i am autistic.

But this (obsessive) search to understand how the heck to get complex
search right and get a true understanding of cake is driving me to go
full out to seek answers so please forgive me should you be offended.

Thank you.

On May 4, 7:49 pm, Andrei Mita  wrote:
> I'm having a hard time understanding your problem, probably it's just me,
> I'm not having a good time at work.
>
> So, if you have 4 tables all linked together (it doesn't matter if Shop
> links to User through Merchant), than my guess is that Containable would be
> the quickest way to get the data you want from all 4 tables.
>
> As I said in a previous e-mail. Do you know what you get if you do a
> find('all') with $recursive = 2? How much of that information you don't
> need.
>
> I can help you in two ways: either you give me the table structures and an
> example of what you want OR i can post a containable query from one of my
> projects that gets data from 4-5 different tables, as an example.
>
>
>
>
>
> On Tue, May 4, 2010 at 2:06 PM, Kei Simone  wrote:
> > i have the following for my cake 1.3:
>
> > User hasOne Merchant (so Merchant belongsTo User)
> > Shop hasMany Merchant (so Merchant belongsTo Shop as well.)
> > Shop hasMany Domain (so Domain belongsTo Shop.)
>
> > i need to use Merchant model to do a find of all 4 related data.
>
> > i need to find the first datarow that matches conditions for Merchant,
> > User and Domain.
>
> > Merchant.owner = 1
> > User.email = a...@a.com
> > Domain.domain =http://abc.example.com
> > Domain.primary = 1
>
> > the datarow must contain data from all 4 models.
>
> > the find must be done inside the Merchant model. as in $this->find...
>
> > Love to hear more from you about Containable. Really interested to see
> > how powerful Containable is.
>
> 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


Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Andrei Mita
Was that a sarcastic question?

On Tue, May 4, 2010 at 3:13 PM, sphereweb  wrote:

> I would like to see your example that gets the data from 4-5 tables :)
>
> On May 4, 7:49 am, Andrei Mita  wrote:
> > I'm having a hard time understanding your problem, probably it's just me,
> > I'm not having a good time at work.
> >
> > So, if you have 4 tables all linked together (it doesn't matter if Shop
> > links to User through Merchant), than my guess is that Containable would
> be
> > the quickest way to get the data you want from all 4 tables.
> >
> > As I said in a previous e-mail. Do you know what you get if you do a
> > find('all') with $recursive = 2? How much of that information you don't
> > need.
> >
> > I can help you in two ways: either you give me the table structures and
> an
> > example of what you want OR i can post a containable query from one of my
> > projects that gets data from 4-5 different tables, as an example.
> >
> >
>

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread AD7six


On May 4, 2:13 pm, sphereweb  wrote:
> I would like to see your example that gets the data from 4-5 tables :)

There's only 1 test case in it but you can see usage here:
http://github.com/AD7six/mi/blob/master/tests/cases/behaviors/one_query.test.php

Although the single test case is calling oneQuery explicitly - you
normally use the behavior in exactly the same as containable
(including you can configure onequery to look for the param name
"contain") but the result is - one query.

hth,

AD

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread sphereweb
I would like to see your example that gets the data from 4-5 tables :)

On May 4, 7:49 am, Andrei Mita  wrote:
> I'm having a hard time understanding your problem, probably it's just me,
> I'm not having a good time at work.
>
> So, if you have 4 tables all linked together (it doesn't matter if Shop
> links to User through Merchant), than my guess is that Containable would be
> the quickest way to get the data you want from all 4 tables.
>
> As I said in a previous e-mail. Do you know what you get if you do a
> find('all') with $recursive = 2? How much of that information you don't
> need.
>
> I can help you in two ways: either you give me the table structures and an
> example of what you want OR i can post a containable query from one of my
> projects that gets data from 4-5 different tables, as an example.
>
>
>
> On Tue, May 4, 2010 at 2:06 PM, Kei Simone  wrote:
> > i have the following for my cake 1.3:
>
> > User hasOne Merchant (so Merchant belongsTo User)
> > Shop hasMany Merchant (so Merchant belongsTo Shop as well.)
> > Shop hasMany Domain (so Domain belongsTo Shop.)
>
> > i need to use Merchant model to do a find of all 4 related data.
>
> > i need to find the first datarow that matches conditions for Merchant,
> > User and Domain.
>
> > Merchant.owner = 1
> > User.email = a...@a.com
> > Domain.domain =http://abc.example.com
> > Domain.primary = 1
>
> > the datarow must contain data from all 4 models.
>
> > the find must be done inside the Merchant model. as in $this->find...
>
> > Love to hear more from you about Containable. Really interested to see
> > how powerful Containable is.
>
> 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


Re: Pagination Sort

2010-05-04 Thread sijo jose
Well thanks for the prompt reply

I have this model Structure -

Model 1 - Union

var $belongsTo = array(
'Address' => array(
'className' => 'Address',
'foreignKey' => 'address_id',
'conditions' => '',
'fields' => '',
'order' => ''
) );


Model 2 - Address

var $belongsTo = array(
'District' => array(
'className' => 'District',
'foreignKey' => 'district_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

Model 3  District.
 with fields name and code both varchar.

Now when I paginate UNION  like this

$this->paginate = array(
'order' => array('Address.street' => 'ASC'),
);


it works fine.

What I need is the next level that is District which is related to Address,
but not to UNION

On Tue, May 4, 2010 at 1:39 PM, Andrei Mita  wrote:

> Check out the 2 links below:
> http://book.cakephp.org/view/164/Pagination
> http://book.cakephp.org/view/858/Using-Containable-with-pagination
>
>
>
> On Tue, May 4, 2010 at 11:07 AM, Andrei Mita wrote:
>
>> I believe paginate documentation in the book has a similar example.
>>
>>
>>
>> On Tue, May 4, 2010 at 9:48 AM, sijo jose  wrote:
>>
>>> Hi guys,
>>>
>>> I have this model Structure -
>>>
>>> Model 1 - Union
>>>
>>> var $belongsTo = array(
>>> 'Address' => array(
>>>  'className' => 'Address',
>>> 'foreignKey' => 'address_id',
>>>  'conditions' => '',
>>> 'fields' => '',
>>>  'order' => ''
>>> ) );
>>>
>>>
>>> Model 2 - Address
>>>
>>> var $belongsTo = array(
>>> 'District' => array(
>>> 'className' => 'District',
>>>  'foreignKey' => 'district_id',
>>> 'conditions' => '',
>>>  'fields' => '',
>>> 'order' => ''
>>> )
>>>  );
>>>
>>> Model 3  District.
>>>  with fields name and code both varchar.
>>>
>>>
>>> Now I would like to paginate the Unions which should be ordered in ASC by
>>> Union.Address.District.name ASC
>>>
>>> Is that possible and if so how should i write the paginate.
>>>
>>> Urgent help need. I am stuck here.
>>>
>>>
>>>
>>>
>>>
>>> Regards,
>>> --
>>> Sijo Jose Chakramakkil
>>>
>>> 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.comFor
>>>  more options, visit this group at
>>> http://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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Sijo Jose Chakramakkil

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Andrei Mita
I'm having a hard time understanding your problem, probably it's just me,
I'm not having a good time at work.

So, if you have 4 tables all linked together (it doesn't matter if Shop
links to User through Merchant), than my guess is that Containable would be
the quickest way to get the data you want from all 4 tables.

As I said in a previous e-mail. Do you know what you get if you do a
find('all') with $recursive = 2? How much of that information you don't
need.

I can help you in two ways: either you give me the table structures and an
example of what you want OR i can post a containable query from one of my
projects that gets data from 4-5 different tables, as an example.



On Tue, May 4, 2010 at 2:06 PM, Kei Simone  wrote:

> i have the following for my cake 1.3:
>
> User hasOne Merchant (so Merchant belongsTo User)
> Shop hasMany Merchant (so Merchant belongsTo Shop as well.)
> Shop hasMany Domain (so Domain belongsTo Shop.)
>
> i need to use Merchant model to do a find of all 4 related data.
>
> i need to find the first datarow that matches conditions for Merchant,
> User and Domain.
>
> Merchant.owner = 1
> User.email = a...@a.com
> Domain.domain = http://abc.example.com
> Domain.primary = 1
>
>
> the datarow must contain data from all 4 models.
>
> the find must be done inside the Merchant model. as in $this->find...
>
> Love to hear more from you about Containable. Really interested to see
> how powerful Containable is.
>
>
>

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Jeremy Burns
The find does not have to be done from the Merchant model. If the models are 
related if sometimes makes sense to hop across to another model to start the 
find from there (I often do this). If it makes more sense to start it from, 
say, the User model, then you can do $this->Merchant->User->find() and contain 
the Merchant, Shop and Domain models.

Jeremy Burns
jeremybu...@me.com
On 4 May 2010, at 12:06, Kei Simone wrote:

> i have the following for my cake 1.3:
> 
> User hasOne Merchant (so Merchant belongsTo User)
> Shop hasMany Merchant (so Merchant belongsTo Shop as well.)
> Shop hasMany Domain (so Domain belongsTo Shop.)
> 
> i need to use Merchant model to do a find of all 4 related data.
> 
> i need to find the first datarow that matches conditions for Merchant,
> User and Domain.
> 
> Merchant.owner = 1
> User.email = a...@a.com
> Domain.domain = http://abc.example.com
> Domain.primary = 1
> 
> 
> the datarow must contain data from all 4 models.
> 
> the find must be done inside the Merchant model. as in $this->find...
> 
> Love to hear more from you about Containable. Really interested to see
> how powerful Containable is.
> 
> 
> On May 3, 3:33 pm, Andrei Mita  wrote:
>> Simone,
>> 
>> Containable is extremely powerful. I am just amazed how little time it takes
>> me to write complex queries.
>> 
>> Give me the structure of the tables and an example of what do you want to
>> retrieve from them and I might be able to help you around.
>> 
>> 
>> 
>> On Mon, May 3, 2010 at 8:02 AM, Kei Simone  wrote:
>>> Hi i did this
>> 
>>> $this->Behaviors->attach('Containable');
>>>$this->User->Behaviors->attach('Containable');
>>>$this->Shop->Behaviors->attach('Containable');
>>>$this->Shop->Domain->Behaviors->attach('Containable');
>> 
>>>$this->recursive = -1;
>>>$this->User->recursive = -1;
>>>$this->Shop->recursive = -1;
>>>$this->Shop->Domain->recursive = -1;
>> 
>>>return $this->find('first', array(
>>> // conditions for the main model
>>> 'conditions'=>array('Merchant.owner'=>1),
>>> // contain
>>>'contain'=>array(
>>>'User'=>array(
>>>// conditions for the user model
>> 
>>>  'conditions'=>array('User.group_id'=>MERCHANTS,
>>>'User.email' =>
>>> 'a...@a.com',),
>> 
>>>),
>>>'Shop'=>array(
>> 
>>>  'conditions'=>array('Shop.web_address' => 'http://
>>> abc.myspree2shop.com',),
>>>  'Domain'),
>>>)
>>>));
>> 
>>> i got this in the sql query log
>> 
>>> SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
>>> `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
>>> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
>>> `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
>>> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
>>> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
>>> `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `shops`
>>> AS `Shop` ON (`Merchant`.`shop_id` = `Shop`.`id` AND
>>> `Shop`.`web_address` = 'http://abc.myspree2shop.com') LEFT JOIN
>>> `users` AS `User` ON (`Merchant`.`user_id` = `User`.`id` AND
>>> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com') WHERE
>>> `Merchant`.`owner` = 1 LIMIT 1
>> 
>>> SELECT `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
>>> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
>>> `Shop`.`status` FROM `shops` AS `Shop` WHERE `Shop`.`id` = 1 AND
>>> `Shop`.`web_address` = 'http://abc.myspree2shop.com'
>> 
>>> SELECT `User`.`id`, `User`.`email`, `User`.`password`,
>>> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
>>> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
>>> `User`.`modified_on` FROM `users` AS `User` WHERE `User`.`id` = 1 AND
>>> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com'
>> 
>>> i got this result
>> 
>>> Array
>>> (
>>>[Merchant] => Array
>>>(
>>>[id] => 1
>>>[owner] => 1
>>>[shop_id] => 1
>>>[user_id] => 1
>>>)
>> 
>>>[Shop] => Array
>>>(
>>>[id] =>
>>>[theme_id] =>
>>>[name] =>
>>>[web_address] =>
>>>[created_on] =>
>>>[modified_on] =>
>>>[status] =>
>>>)
>> 
>>>[User] => Array
>>>(
>>>[id] =>
>>>[email] =>
>>>[password] =>
>>>[group_id] =>
>>>[full_name] =>
>>>[name_to_call] =>
>>>[last_login_on] =>
>>>[status] =>
>>

Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Sorry for the continuous replies.

Just realised that my scenario was not complete enough.

User hasOne Merchant (so Merchant belongsTo User and user_id inside
merchants table)
Shop hasMany Merchant (so Merchant belongsTo Shop and shop_id inside
merchants table)
Shop hasMany Domain (so Domain belongsTo Shop and shop_id inside
domains table)

i need to use Merchant model to do a find of all 4 related data.

i need to find the first datarow that matches conditions for Merchant,
User and Domain.

Merchant.owner = 1
User.email = a...@a.com
Domain.domain = http://abc.example.com
Domain.primary = 1


the datarow must contain data from all 4 models.


On May 4, 4:31 pm, AD7six  wrote:
> On May 4, 9:45 am, Kei Simone  wrote:
>
> > Your statement on the right join i do not quite understand.
>
> > Which find statement are you explaining on?
>
> > Thank you for being enthusiastic to clear my doubts.
>
> Kei - you don't need to reply to each question individually - you can
> reply to many messages in the same reply ;)
>
> bindModel - if you bind a belongsTo or hasOne - is a join. so there is
> no advantage except it's a lot easier to say:
>
> $this->bindModel(array('hasOne' => array('OtherModel' => array(...));
> return $this->find(...);
> than
> return $this->find($type, $arraywithjoins);
>
> but it depends how explicit you want to be.
>
> Regarding "Your statement on right joins"
>
> These are not equivalent:
>
> return $this->find('all', array(
>                   'contain'=>array(
>                                          'Shop' => array('Domain'  =>
> array('conditions' => $someconditions)),
>                                         ),
>         ));
>
> return $this->find('all', array(
>                   'contain'=>array(
>                                          'Shop' => array('Domain')),
>                                         ),
>                  'conditions' => $someconditions
>         ));
>
> Let's say
>  $this is users and you've got 10k.
>  $someconditions = array('Domain.id' => 42)
>  you're expecting one result - the user linked via shop to the domain
> 42.
>
> The first query will return you 10k rows, and the domain data will be
> empty/missing for 9,999 rows - because cake builds the data using
> multiple queries and the first query has no conditions.
>
> The second query will return you 1 row - if you explicitly used joins
> or used one of the behaviors I mentioned that means you get what you
> asked for.
>
> If you're still in doubt - try it.
>
> hth,
>
> AD
>
> $this->
>
>
>
>
>
>
>
> > On May 3, 3:55 pm, AD7six  wrote:
>
> > > On May 2, 1:45 pm, Jon Bennett  wrote:
>
> > > > > i need to use Merchant model to do a find of all 4 related data.
> > > > > notice that Domain is the only one NOT directly related to Merchant.
>
> > > > > i tried this in a method inside Merchant model:
>
> > > > > $this->Behaviors->attach('Containable');
> > > > > $this->User->Behaviors->attach('Containable');
> > > > > $this->Shop->Behaviors->attach('Containable');
> > > > > $this->Shop->Domain->Behaviors->attach('Containable');
>
> > > > > $this->recursive = -1;
> > > > > $this->User->recursive = -1;
> > > > > $this->Shop->recursive = -1;
> > > > > $this->Shop->Domain->recursive = -1;
>
> > > > > return $this->find('first',
> > > > >                array(
> > > > >                  'contain'=>array(
> > > > >                                         'User',
> > > > >                                         'Shop' => array('Domain' ),
>
> > > > >                                        ),
> > > > >                'conditions' => $conditions
> > > > >        ));
>
> > > > >http://book.cakephp.org/view/1323/Containablehaserrorsinterms of
> > > > > telling you where to place the conditions. my way is correct as of 1.3
> > > > > Cakephp
>
> > > > return $this->find('first', array(
> > > >         // conditions for the main model
> > > >         'conditions'=>array(),
> > > >         // contain
> > > >         'contain'=>array(
> > > >                 'User'=>array(
> > > >                         // conditions for the user model
> > > >                         'conditions'=>array('User.status'=>1),
> > > >                         'Other', 'Models', 'From', 'User'
> > > >                 ),
> > > >                 'Shop'=>array('Domain'),
> > > >         )
> > > > ));
>
> > > Using conditions like that is the equivalent of a right join - you're
> > > still going to get every single "main model" row - and just get an
> > > empty array for any row which links to a user with a status that isn't
> > > 1.
>
> > > hth,
>
> > > AD
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > 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 o

Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
i have the following for my cake 1.3:

User hasOne Merchant (so Merchant belongsTo User)
Shop hasMany Merchant (so Merchant belongsTo Shop as well.)
Shop hasMany Domain (so Domain belongsTo Shop.)

i need to use Merchant model to do a find of all 4 related data.

i need to find the first datarow that matches conditions for Merchant,
User and Domain.

Merchant.owner = 1
User.email = a...@a.com
Domain.domain = http://abc.example.com
Domain.primary = 1


the datarow must contain data from all 4 models.

the find must be done inside the Merchant model. as in $this->find...

Love to hear more from you about Containable. Really interested to see
how powerful Containable is.


On May 3, 3:33 pm, Andrei Mita  wrote:
> Simone,
>
> Containable is extremely powerful. I am just amazed how little time it takes
> me to write complex queries.
>
> Give me the structure of the tables and an example of what do you want to
> retrieve from them and I might be able to help you around.
>
>
>
> On Mon, May 3, 2010 at 8:02 AM, Kei Simone  wrote:
> > Hi i did this
>
> > $this->Behaviors->attach('Containable');
> >                $this->User->Behaviors->attach('Containable');
> >                $this->Shop->Behaviors->attach('Containable');
> >                $this->Shop->Domain->Behaviors->attach('Containable');
>
> >                $this->recursive = -1;
> >                $this->User->recursive = -1;
> >                $this->Shop->recursive = -1;
> >                $this->Shop->Domain->recursive = -1;
>
> >                return $this->find('first', array(
> >                         // conditions for the main model
> >                         'conditions'=>array('Merchant.owner'=>1),
> >                         // contain
> >                        'contain'=>array(
> >                                'User'=>array(
> >                                        // conditions for the user model
>
> >  'conditions'=>array('User.group_id'=>MERCHANTS,
> >                                                            'User.email' =>
> > 'a...@a.com',),
>
> >                                ),
> >                                'Shop'=>array(
>
> >  'conditions'=>array('Shop.web_address' => 'http://
> > abc.myspree2shop.com',),
> >                                              'Domain'),
> >                        )
> >                ));
>
> > i got this in the sql query log
>
> > SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
> > `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> > `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> > `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
> > `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> > `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> > `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `shops`
> > AS `Shop` ON (`Merchant`.`shop_id` = `Shop`.`id` AND
> > `Shop`.`web_address` = 'http://abc.myspree2shop.com') LEFT JOIN
> > `users` AS `User` ON (`Merchant`.`user_id` = `User`.`id` AND
> > `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com') WHERE
> > `Merchant`.`owner` = 1 LIMIT 1
>
> > SELECT `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> > `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> > `Shop`.`status` FROM `shops` AS `Shop` WHERE `Shop`.`id` = 1 AND
> > `Shop`.`web_address` = 'http://abc.myspree2shop.com'
>
> > SELECT `User`.`id`, `User`.`email`, `User`.`password`,
> > `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> > `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> > `User`.`modified_on` FROM `users` AS `User` WHERE `User`.`id` = 1 AND
> > `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com'
>
> > i got this result
>
> > Array
> > (
> >    [Merchant] => Array
> >        (
> >            [id] => 1
> >            [owner] => 1
> >            [shop_id] => 1
> >            [user_id] => 1
> >        )
>
> >    [Shop] => Array
> >        (
> >            [id] =>
> >            [theme_id] =>
> >            [name] =>
> >            [web_address] =>
> >            [created_on] =>
> >            [modified_on] =>
> >            [status] =>
> >        )
>
> >    [User] => Array
> >        (
> >            [id] =>
> >            [email] =>
> >            [password] =>
> >            [group_id] =>
> >            [full_name] =>
> >            [name_to_call] =>
> >            [last_login_on] =>
> >            [status] =>
> >            [created_on] =>
> >            [modified_on] =>
> >        )
>
> > )
>
> > When i changed your recommendation to
>
> >                            return $this->find('first',
> >                                        array(
> >                                          'contain'=>array(
> >                                                           'User',
> >                                                           'Shop' =>
> > array('Domain'
> >                                                            

Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Hi Andy,

1) it is precisely i have tried it see my ultra long post with all the
sql queries and result sets that i know containable is not for me.

i am still looking to see if your linkable behavior is what i need.

however, i am quite noob, so i dont know how to use your one_query
even though i have copied it and pasted it in my behavior folder.

I am a 1 month cake user so please be gentle.

Is there a more complete guide to show me how to use it? ideally would
be if you can provide an example using my scenario above.

if it is better than the joins i am doing, then i am definitely going
to use it greatly because i foresee i am going to use a lot of complex
searches.

my schema once again is

User hasOne Merchant (so Merchant belongsTo User with user_id inside
merchants table)
Shop hasMany Merchant (so Merchant belongsTo Shop with shop_id inside
merchants table)
Shop hasMany Domain (so Domain belongsTo Shop with shop_id inside
domains table)

i am trying to get the first datarow that meets conditions for User,
Domain and the datarow must draw data from all 4 models.

Really looking to hear more from you. Your one_query or linkable
behavior sounds like a lot better than the run of the mill answers i
get from the irc channel.

2) though i have some concerns about the maintainence of your
behavior. looks like you do not have many watchers or people raising
issues.

NO offence.

It is just that i have tried out a few plugins thinking that they
would speed up my work. end up i wasted more time getting them to
work.

the only plugin i am using now is MeioUpload it has promised to a
certain extent is the MeioUpload and the owner is actively answering
issues which is many and that there are plenty of watchers. In fact i
reported 3 issues with suggestions to fix 2 of those 3 issues. the
fixes are adopted by MeioUpload owner hence i am quite happy to
continue to use it. So i am now biased towards code that has owner
actively answering issues and many active users.

Once again, i have nothing against your code. i highly appreciate your
suggestion. and i definitely would want to learn more and definitely
use it if i find it superior to using joins.

Already i can see that it looks more promising than Containable based
on the blogpost link you sent.

So do give me a heads up in terms of using it especially since the
blogpost contains information about using Linkable where as your code
is called one_query.

On May 4, 4:31 pm, AD7six  wrote:
> On May 4, 9:45 am, Kei Simone  wrote:
>
> > Your statement on the right join i do not quite understand.
>
> > Which find statement are you explaining on?
>
> > Thank you for being enthusiastic to clear my doubts.
>
> Kei - you don't need to reply to each question individually - you can
> reply to many messages in the same reply ;)
>
> bindModel - if you bind a belongsTo or hasOne - is a join. so there is
> no advantage except it's a lot easier to say:
>
> $this->bindModel(array('hasOne' => array('OtherModel' => array(...));
> return $this->find(...);
> than
> return $this->find($type, $arraywithjoins);
>
> but it depends how explicit you want to be.
>
> Regarding "Your statement on right joins"
>
> These are not equivalent:
>
> return $this->find('all', array(
>                   'contain'=>array(
>                                          'Shop' => array('Domain'  =>
> array('conditions' => $someconditions)),
>                                         ),
>         ));
>
> return $this->find('all', array(
>                   'contain'=>array(
>                                          'Shop' => array('Domain')),
>                                         ),
>                  'conditions' => $someconditions
>         ));
>
> Let's say
>  $this is users and you've got 10k.
>  $someconditions = array('Domain.id' => 42)
>  you're expecting one result - the user linked via shop to the domain
> 42.
>
> The first query will return you 10k rows, and the domain data will be
> empty/missing for 9,999 rows - because cake builds the data using
> multiple queries and the first query has no conditions.
>
> The second query will return you 1 row - if you explicitly used joins
> or used one of the behaviors I mentioned that means you get what you
> asked for.
>
> If you're still in doubt - try it.
>
> hth,
>
> AD
>
> $this->
>
>
>
>
>
>
>
> > On May 3, 3:55 pm, AD7six  wrote:
>
> > > On May 2, 1:45 pm, Jon Bennett  wrote:
>
> > > > > i need to use Merchant model to do a find of all 4 related data.
> > > > > notice that Domain is the only one NOT directly related to Merchant.
>
> > > > > i tried this in a method inside Merchant model:
>
> > > > > $this->Behaviors->attach('Containable');
> > > > > $this->User->Behaviors->attach('Containable');
> > > > > $this->Shop->Behaviors->attach('Containable');
> > > > > $this->Shop->Domain->Behaviors->attach('Containable');
>
> > > > > $this->recursive = -1;
> > > > > $this->User->recursive = -1;
> > > > > $this->Shop->recursive = -1;
> > > > > $this->Shop-

Re: jquery and cakephp

2010-05-04 Thread Vijay Kumbhar
Please check the path of the image.
If it is applying from js or css, please change the path.

e.g. var image = '../img/image_name';

If this doesn't help then i need to see the code. :)


On Sat, Apr 24, 2010 at 11:11 AM, priya dhakane wrote:

> hello,
> i am new in cakephp. I want tooltip on image. but my css file not get
> apply so no tooltip image get display but only text. plz suggest me
> solution for that.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Thanks & Regards,
Vijayk.

"You Bring the Dreams, We'll Bring the Means"

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


cannot acces plugin with 1.3 installation

2010-05-04 Thread davido
Hi!

I´ve succesfully upgraded to 1.3. On my local xampp everthiny is
working fine. On the webserver I´m using the following error appears
when I try to call a plugins url.

 The layout file  can not be found or does not exist.

It seems weird that the url where the layout file seems to be located
is in  /app/views/plugins/about/layouts/Pages.ctp.

Why does cake search the layout for my plugin in the app/views folder?

Is ther any idea?

david

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread AD7six


On May 4, 9:45 am, Kei Simone  wrote:
> Your statement on the right join i do not quite understand.
>
> Which find statement are you explaining on?
>
> Thank you for being enthusiastic to clear my doubts.

Kei - you don't need to reply to each question individually - you can
reply to many messages in the same reply ;)

bindModel - if you bind a belongsTo or hasOne - is a join. so there is
no advantage except it's a lot easier to say:

$this->bindModel(array('hasOne' => array('OtherModel' => array(...));
return $this->find(...);
than
return $this->find($type, $arraywithjoins);

but it depends how explicit you want to be.

Regarding "Your statement on right joins"

These are not equivalent:


return $this->find('all', array(
  'contain'=>array(
 'Shop' => array('Domain'  =>
array('conditions' => $someconditions)),
),
));


return $this->find('all', array(
  'contain'=>array(
 'Shop' => array('Domain')),
),
 'conditions' => $someconditions
));

Let's say
 $this is users and you've got 10k.
 $someconditions = array('Domain.id' => 42)
 you're expecting one result - the user linked via shop to the domain
42.


The first query will return you 10k rows, and the domain data will be
empty/missing for 9,999 rows - because cake builds the data using
multiple queries and the first query has no conditions.

The second query will return you 1 row - if you explicitly used joins
or used one of the behaviors I mentioned that means you get what you
asked for.

If you're still in doubt - try it.

hth,

AD




$this->
>
> On May 3, 3:55 pm, AD7six  wrote:
>
>
>
>
>
> > On May 2, 1:45 pm, Jon Bennett  wrote:
>
> > > > i need to use Merchant model to do a find of all 4 related data.
> > > > notice that Domain is the only one NOT directly related to Merchant.
>
> > > > i tried this in a method inside Merchant model:
>
> > > > $this->Behaviors->attach('Containable');
> > > > $this->User->Behaviors->attach('Containable');
> > > > $this->Shop->Behaviors->attach('Containable');
> > > > $this->Shop->Domain->Behaviors->attach('Containable');
>
> > > > $this->recursive = -1;
> > > > $this->User->recursive = -1;
> > > > $this->Shop->recursive = -1;
> > > > $this->Shop->Domain->recursive = -1;
>
> > > > return $this->find('first',
> > > >                array(
> > > >                  'contain'=>array(
> > > >                                         'User',
> > > >                                         'Shop' => array('Domain' ),
>
> > > >                                        ),
> > > >                'conditions' => $conditions
> > > >        ));
>
> > > >http://book.cakephp.org/view/1323/Containablehaserrorsin terms of
> > > > telling you where to place the conditions. my way is correct as of 1.3
> > > > Cakephp
>
> > > return $this->find('first', array(
> > >         // conditions for the main model
> > >         'conditions'=>array(),
> > >         // contain
> > >         'contain'=>array(
> > >                 'User'=>array(
> > >                         // conditions for the user model
> > >                         'conditions'=>array('User.status'=>1),
> > >                         'Other', 'Models', 'From', 'User'
> > >                 ),
> > >                 'Shop'=>array('Domain'),
> > >         )
> > > ));
>
> > Using conditions like that is the equivalent of a right join - you're
> > still going to get every single "main model" row - and just get an
> > empty array for any row which links to a user with a status that isn't
> > 1.
>
> > hth,
>
> > AD
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 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...@googlegroup

Re: How to get the data form the different table.

2010-05-04 Thread WebbedIT
Read the manual, it's all there for you and no-one from the community
is going to take the time to cover information that is readily
available in the manual.

http://book.cakephp.org/view/22/CakePHP-Conventions
http://book.cakephp.org/view/66/Models

Read the manual 1 or 2 times, then do the tutorials within it.  Then
try your own project and when facing particular issues come to the
community for help with them.

Paul

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: need help

2010-05-04 Thread WebbedIT
None of your models or fields conform to standards and as such you are
expecting members of the community who may help you to first learn
your non-standard conventions before they can make sense of your ORM/
Schema etc.  I'm pretty certain this point has been raised to your
previously by Jeremy Burns, and you ignored him then.

It is your non standard naming of models and tables that will cause
most of your issues so it is in your own interests to conform to the
standards and when you are doing so you will find help is a lot more
forthcoming from the community

http://book.cakephp.org/view/22/CakePHP-Conventions

Example: your model Model tblmusicprofiles
  Table: tbl_music_profiles
  Filename: tbl_music_profile
  Model Object: TblMusicProfile

HTH

Paul.

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: Pagination Sort

2010-05-04 Thread Andrei Mita
Check out the 2 links below:
http://book.cakephp.org/view/164/Pagination
http://book.cakephp.org/view/858/Using-Containable-with-pagination


On Tue, May 4, 2010 at 11:07 AM, Andrei Mita  wrote:

> I believe paginate documentation in the book has a similar example.
>
>
>
> On Tue, May 4, 2010 at 9:48 AM, sijo jose  wrote:
>
>> Hi guys,
>>
>> I have this model Structure -
>>
>> Model 1 - Union
>>
>> var $belongsTo = array(
>> 'Address' => array(
>>  'className' => 'Address',
>> 'foreignKey' => 'address_id',
>>  'conditions' => '',
>> 'fields' => '',
>>  'order' => ''
>> ) );
>>
>>
>> Model 2 - Address
>>
>> var $belongsTo = array(
>> 'District' => array(
>> 'className' => 'District',
>>  'foreignKey' => 'district_id',
>> 'conditions' => '',
>>  'fields' => '',
>> 'order' => ''
>> )
>>  );
>>
>> Model 3  District.
>>  with fields name and code both varchar.
>>
>>
>> Now I would like to paginate the Unions which should be ordered in ASC by
>> Union.Address.District.name ASC
>>
>> Is that possible and if so how should i write the paginate.
>>
>> Urgent help need. I am stuck here.
>>
>>
>>
>>
>>
>> Regards,
>> --
>> Sijo Jose Chakramakkil
>>
>> 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.comFor
>>  more options, visit this group at
>> http://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


Re: Pagination Sort

2010-05-04 Thread Andrei Mita
I believe paginate documentation in the book has a similar example.


On Tue, May 4, 2010 at 9:48 AM, sijo jose  wrote:

> Hi guys,
>
> I have this model Structure -
>
> Model 1 - Union
>
> var $belongsTo = array(
> 'Address' => array(
>  'className' => 'Address',
> 'foreignKey' => 'address_id',
>  'conditions' => '',
> 'fields' => '',
>  'order' => ''
> ) );
>
>
> Model 2 - Address
>
> var $belongsTo = array(
> 'District' => array(
> 'className' => 'District',
>  'foreignKey' => 'district_id',
> 'conditions' => '',
>  'fields' => '',
> 'order' => ''
> )
>  );
>
> Model 3  District.
>  with fields name and code both varchar.
>
>
> Now I would like to paginate the Unions which should be ordered in ASC by
> Union.Address.District.name ASC
>
> Is that possible and if so how should i write the paginate.
>
> Urgent help need. I am stuck here.
>
>
>
>
>
> Regards,
> --
> Sijo Jose Chakramakkil
>
> 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.comFor
>  more options, visit this group at
> http://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


Re: Selected option in select

2010-05-04 Thread Andrei Mita
Thanks Ed. I'm using something similar right now.


On Mon, May 3, 2010 at 8:56 PM, Ed Propsner  wrote:

> @Andrei
>
> Not sure if it will help but I've been using $form->input myself and
> haven't had any real issues.
>
> echo $form->input('User.gender', array(
>   'label' => 'Gender:',
>  'empty' => '-',
>  'selected' => 'M',
>  'options' => array(
>'M' => 'Male',
> 'F' => 'Female'
> )
>  )
>);
>
> - Ed
>
> On Mon, May 3, 2010 at 6:01 AM, Andrei Mita  wrote:
>
>> I've tried what you suggested and I doesn't work. I believe it's because
>> the list of options is static and defined in the view. In some other view,
>> where the select is populated from the DB, it works and I don't even need to
>> specify the Model :)
>>
>> Thanks a lot
>>
>>
>> On Sun, May 2, 2010 at 10:21 AM, WebbedIT  wrote:
>>
>>> Glad u got it working :o)
>>>
>>> If you change the file name to Profile.group, you should be able to
>>> remove the 'selected' =>$this->data['Profile']['group'] attribute.
>>>
>>> P.S. to show the input without a label using form->input you just
>>> supply label=>false.  I personally much prefer using the same method
>>> as much as possible and form->input very rarely lets me down.
>>>
>>> HTH
>>>
>>> Paul
>>>
>>> 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.comFor
>>>  more options, visit this group at
>>> http://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.comFor
>>  more options, visit this group at
>> http://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.comFor
>  more options, visit this group at
> http://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


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-04 Thread WebbedIT
@Matt: When starting with CakePHP the main rule you should ALWAYS
follow is stick to the conventions.  You have deviated from the
tutorial by changing urls from the conventional format (explained
within the tutorial on http://book.cakephp.org/view/336/Creating-Post-Views)
of

/controller/action/param1/param2

to

/controller/action/paramName1:paramValue1/paramName2:paramValue2

and in doing so have caused yourself this issue.

When learning a new framework it is tempting to try and stick to some
of your own previous conventions, but I promise you with CakePHP it is
much better to conform to the frameworks conventions as it saves you
s much time :)

HTH

Paul

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


Ajax - Select - On change

2010-05-04 Thread Martin
hellou,

i got little problem.
I have simple form, for example :

form->create('form');

$options[0] = //options for array
$selected[0] = //selected thing
$form->select('profiles',$options,$selected);

and some ajax button :
$ajax->submit('Choose', array( 'update' => 'content'));

just simple, after click on button, ajax request was send, proces and
something displayed  ...

but, i want to change it, to do it right after i change atribute in my
select, mean - when i choose something in select, form will be
submitet throug ajax and something will done (just like after click on
ajax button)

is there any way hot to use ajax onchange ???

thx a lot

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Your statement on the right join i do not quite understand.

Which find statement are you explaining on?

Thank you for being enthusiastic to clear my doubts.


On May 3, 3:55 pm, AD7six  wrote:
> On May 2, 1:45 pm, Jon Bennett  wrote:
>
>
>
>
>
> > > i need to use Merchant model to do a find of all 4 related data.
> > > notice that Domain is the only one NOT directly related to Merchant.
>
> > > i tried this in a method inside Merchant model:
>
> > > $this->Behaviors->attach('Containable');
> > > $this->User->Behaviors->attach('Containable');
> > > $this->Shop->Behaviors->attach('Containable');
> > > $this->Shop->Domain->Behaviors->attach('Containable');
>
> > > $this->recursive = -1;
> > > $this->User->recursive = -1;
> > > $this->Shop->recursive = -1;
> > > $this->Shop->Domain->recursive = -1;
>
> > > return $this->find('first',
> > >                array(
> > >                  'contain'=>array(
> > >                                         'User',
> > >                                         'Shop' => array('Domain' ),
>
> > >                                        ),
> > >                'conditions' => $conditions
> > >        ));
>
> > >http://book.cakephp.org/view/1323/Containablehaserrors in terms of
> > > telling you where to place the conditions. my way is correct as of 1.3
> > > Cakephp
>
> > return $this->find('first', array(
> >         // conditions for the main model
> >         'conditions'=>array(),
> >         // contain
> >         'contain'=>array(
> >                 'User'=>array(
> >                         // conditions for the user model
> >                         'conditions'=>array('User.status'=>1),
> >                         'Other', 'Models', 'From', 'User'
> >                 ),
> >                 'Shop'=>array('Domain'),
> >         )
> > ));
>
> Using conditions like that is the equivalent of a right join - you're
> still going to get every single "main model" row - and just get an
> empty array for any row which links to a user with a status that isn't
> 1.
>
> hth,
>
> AD
>
> 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


Re: Simple assoication not working

2010-05-04 Thread WebbedIT

> Have another look at your naming conventions, most notably those for your
> models.
>
> http://book.cakephp.org/view/24/Model-and-Database-Conventions

Hint: Your model filenames should be singular.

When first learning CakePHP and any problems arise it's often down to
a deviation from the conventions so learn them inside out and stick to
them whenever possible.

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: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
I dont like recursive because i suspect that it will return all the
related model data of a certain level.

i only want very specific model data. or rather data from specific
models.


On May 3, 3:35 pm, Andrei Mita  wrote:
> Or here is another idea. Make a find('all') query with $recursive = 2 and
> see how much information is there that you don't need.
>
>
>
> On Mon, May 3, 2010 at 10:33 AM, Andrei Mita  wrote:
> > Simone,
>
> > Containable is extremely powerful. I am just amazed how little time it
> > takes me to write complex queries.
>
> > Give me the structure of the tables and an example of what do you want to
> > retrieve from them and I might be able to help you around.
>
> > On Mon, May 3, 2010 at 8:02 AM, Kei Simone  wrote:
>
> >> Hi i did this
>
> >> $this->Behaviors->attach('Containable');
> >>                $this->User->Behaviors->attach('Containable');
> >>                $this->Shop->Behaviors->attach('Containable');
> >>                $this->Shop->Domain->Behaviors->attach('Containable');
>
> >>                $this->recursive = -1;
> >>                $this->User->recursive = -1;
> >>                $this->Shop->recursive = -1;
> >>                $this->Shop->Domain->recursive = -1;
>
> >>                return $this->find('first', array(
> >>                         // conditions for the main model
> >>                         'conditions'=>array('Merchant.owner'=>1),
> >>                         // contain
> >>                        'contain'=>array(
> >>                                'User'=>array(
> >>                                        // conditions for the user model
>
> >>  'conditions'=>array('User.group_id'=>MERCHANTS,
> >>                                                            'User.email' =>
> >> 'a...@a.com',),
>
> >>                                ),
> >>                                'Shop'=>array(
>
> >>  'conditions'=>array('Shop.web_address' => 'http://
> >> abc.myspree2shop.com',),
> >>                                              'Domain'),
> >>                        )
> >>                ));
>
> >> i got this in the sql query log
>
> >> SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
> >> `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> >> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> >> `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
> >> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> >> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> >> `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `shops`
> >> AS `Shop` ON (`Merchant`.`shop_id` = `Shop`.`id` AND
> >> `Shop`.`web_address` = 'http://abc.myspree2shop.com') LEFT JOIN
> >> `users` AS `User` ON (`Merchant`.`user_id` = `User`.`id` AND
> >> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com') WHERE
> >> `Merchant`.`owner` = 1 LIMIT 1
>
> >> SELECT `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> >> `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> >> `Shop`.`status` FROM `shops` AS `Shop` WHERE `Shop`.`id` = 1 AND
> >> `Shop`.`web_address` = 'http://abc.myspree2shop.com'
>
> >> SELECT `User`.`id`, `User`.`email`, `User`.`password`,
> >> `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> >> `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> >> `User`.`modified_on` FROM `users` AS `User` WHERE `User`.`id` = 1 AND
> >> `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com'
>
> >> i got this result
>
> >> Array
> >> (
> >>    [Merchant] => Array
> >>        (
> >>            [id] => 1
> >>            [owner] => 1
> >>            [shop_id] => 1
> >>            [user_id] => 1
> >>        )
>
> >>    [Shop] => Array
> >>        (
> >>            [id] =>
> >>            [theme_id] =>
> >>            [name] =>
> >>            [web_address] =>
> >>            [created_on] =>
> >>            [modified_on] =>
> >>            [status] =>
> >>        )
>
> >>    [User] => Array
> >>        (
> >>            [id] =>
> >>            [email] =>
> >>            [password] =>
> >>            [group_id] =>
> >>            [full_name] =>
> >>            [name_to_call] =>
> >>            [last_login_on] =>
> >>            [status] =>
> >>            [created_on] =>
> >>            [modified_on] =>
> >>        )
>
> >> )
>
> >> When i changed your recommendation to
>
> >>                            return $this->find('first',
> >>                                        array(
> >>                                          'contain'=>array(
> >>                                                           'User',
> >>                                                           'Shop' =>
> >> array('Domain'
> >>                                                                        ),
>
> >>                                                           ),
> >>                                           'conditions' =>
> >> array('User.group_id'=>MERCHANTS,
> >>           

Re: The docs for Containable does not work for complex search. Complex search is 2 models away. For cake 1.3

2010-05-04 Thread Kei Simone
Is the bindModel any better than the joins?

http://book.cakephp.org/view/1047/Joining-tables

the joins are working for me. however of course the reason why i am
asking so many quesitons is to increase my working knowledge of Cake
for what works and what does not.

thank you.

On May 3, 3:52 pm, AD7six  wrote:
> On May 3, 7:02 am, Kei Simone  wrote:
>
>
>
>
>
> > Hi i did this
>
> > $this->Behaviors->attach('Containable');
> >                 $this->User->Behaviors->attach('Containable');
> >                 $this->Shop->Behaviors->attach('Containable');
> >                 $this->Shop->Domain->Behaviors->attach('Containable');
>
> >                 $this->recursive = -1;
> >                 $this->User->recursive = -1;
> >                 $this->Shop->recursive = -1;
> >                 $this->Shop->Domain->recursive = -1;
>
> >                 return $this->find('first', array(
> >                         // conditions for the main model
> >                         'conditions'=>array('Merchant.owner'=>1),
> >                         // contain
> >                         'contain'=>array(
> >                                 'User'=>array(
> >                                         // conditions for the user model
> >                                         
> > 'conditions'=>array('User.group_id'=>MERCHANTS,
> >                                                             'User.email' => 
> > 'a...@a.com',),
>
> >                                 ),
> >                                 'Shop'=>array(
> >                                         
> > 'conditions'=>array('Shop.web_address' => 'http://
> > abc.myspree2shop.com',),
> >                                               'Domain'),
> >                         )
> >                 ));
>
> > i got this in the sql query log
>
> > SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
> > `Merchant`.`user_id`, `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> > `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> > `Shop`.`status`, `User`.`id`, `User`.`email`, `User`.`password`,
> > `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> > `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> > `User`.`modified_on` FROM `merchants` AS `Merchant` LEFT JOIN `shops`
> > AS `Shop` ON (`Merchant`.`shop_id` = `Shop`.`id` AND
> > `Shop`.`web_address` = 'http://abc.myspree2shop.com') LEFT JOIN
> > `users` AS `User` ON (`Merchant`.`user_id` = `User`.`id` AND
> > `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com') WHERE
> > `Merchant`.`owner` = 1 LIMIT 1
>
> > SELECT `Shop`.`id`, `Shop`.`theme_id`, `Shop`.`name`,
> > `Shop`.`web_address`, `Shop`.`created_on`, `Shop`.`modified_on`,
> > `Shop`.`status` FROM `shops` AS `Shop` WHERE `Shop`.`id` = 1 AND
> > `Shop`.`web_address` = 'http://abc.myspree2shop.com'
>
> > SELECT `User`.`id`, `User`.`email`, `User`.`password`,
> > `User`.`group_id`, `User`.`full_name`, `User`.`name_to_call`,
> > `User`.`last_login_on`, `User`.`status`, `User`.`created_on`,
> > `User`.`modified_on` FROM `users` AS `User` WHERE `User`.`id` = 1 AND
> > `User`.`group_id` = 3 AND `User`.`email` = 'a...@a.com'
>
> > i got this result
>
> > Array
> > (
> >     [Merchant] => Array
> >         (
> >             [id] => 1
> >             [owner] => 1
> >             [shop_id] => 1
> >             [user_id] => 1
> >         )
>
> >     [Shop] => Array
> >         (
> >             [id] =>
> >             [theme_id] =>
> >             [name] =>
> >             [web_address] =>
> >             [created_on] =>
> >             [modified_on] =>
> >             [status] =>
> >         )
>
> >     [User] => Array
> >         (
> >             [id] =>
> >             [email] =>
> >             [password] =>
> >             [group_id] =>
> >             [full_name] =>
> >             [name_to_call] =>
> >             [last_login_on] =>
> >             [status] =>
> >             [created_on] =>
> >             [modified_on] =>
> >         )
>
> > )
>
> > When i changed your recommendation to
>
> >                             return $this->find('first',
> >                                         array(
> >                                           'contain'=>array(
> >                                                            'User',
> >                                                            'Shop' => 
> > array('Domain'
> >                                                                         ),
>
> >                                                            ),
> >                                           'conditions' => 
> > array('User.group_id'=>MERCHANTS,
> >                                                             'User.email' => 
> > 'a...@a.com',
>
> > 'Shop.web_address' => 'http://abc.myspree2shop.com',
> >                                                            )
> >                                           )
> >                                 );
>
> > all i did was to move all the condit