SaveField ignores the input field name :-(

2007-12-07 Thread bingo

hi,
yesterday I download the latest version of CakePHP (1.2.0.5875 pre-
beta) and since then my code is broken. The problem is with the
SaveField. I am using othAuth authentication and has this piece of
code to update last_visit field

if(isset($this->user_table_last_visit)){
  $UserModel->id = $row[$this->user_model]['id'];
  $res = $UserModel->saveField($this->user_table_last_visit,
date('Y-m-d H:i:s'));
}

but the SQL code that is generated is as shown below...

UPDATE `users` SET `group_id` = '0',`active` = 0,`lat` = '0',`lng` =
'0',`articles` = '0',`keywords` = '0',`authors` = '0',`thumbnail` =
'users/thumbnail/profile.gif',`icon` = 'users/icon/
profile.gif',`username` = 'ragrawal',`passwd` =
'as234kklj1324asdfjk3423',`last_visit` = '2007-12-07 23:17:51' WHERE
`id` IN (2)

it seems CakePHP is updating other field values with the default
values that are set in database.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model Association 'limit' not working

2007-12-07 Thread sanderken

People looking for the answer to " defining limit row in oracle " :

in the model , use the
'conditions' => ' WHERE ROWNUM <= 3 '
option.

Limit is the implementation in mySQL.
Hope this helps someone...

On 8 dec, 01:53, sanderken <[EMAIL PROTECTED]> wrote:
> Maybe I should mention I'm using oracle for DBMS.
>
> On 7 dec, 21:54, sanderken <[EMAIL PROTECTED]> wrote:
>
> > Hey,
>
> > I defined a "user" (named Gebruiker in my native language ) model
> > where when I call a $this->find() , needs to retrieve only a limited
> > amount of related information.
>
> > When I add the 'limit' => '10' to the association info, it doesn't
> > work. For example: I call
> >$gebruiker = $this->find(
> > array("Gebruiker.id" => $gebruikerid)
> > );
> >  in the model and it retrieves 11 'kommentaars'.
>
> > Does anyone know why this happens? I searched the internet for model
> > information, and even the example 
> > onhttp://manual.cakephp.org/chapter/modelsshowthe same way of doing
> > this. But it works in their example and not in my situation ;)
>
> > Does anyone know how to solve this problem?
>
> > Thanks,
>
> > Here's the code:
>
> > class Gebruiker extends AppModel
> > {
> > var $name = 'Gebruiker';
>
> > var $hasMany = array(
> > 'Blog' => array(
> > 'className' => 'Blog',
> > 'order' => 'Blog.created DESC',
> > 'limit' => '10',
> > 'foreignKey' => 'gebruiker_id',
>
> > ),
> > 'Kommentaar' => array(
> > 'className' => 'Kommentaar',
> > 'order' => 'Kommentaar.created DESC',
> > 'limit' => '5',
> > 'foreignKey' => 'gebruiker_id'
> > ),
> > 'Message_sent' => array(
> > 'className' => 'Message',
> > 'order'=> 'Message_sent.created DESC',
> > 'limit'=> '10',
> > 'foreignKey'=> 'sender_id',
> > ),
> > 'Message_received' => array(
> > 'className' => 'Message',
> > 'order'=>
> > 'Message_received.created DESC',
> > 'limit'   => '10',
> > 'foreignKey'=> 'receiver_id',
> > )
> > );
> >  
>
> > }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Anyone up for a 1.2 query construction challenge?

2007-12-07 Thread kiger

@grigri
I suck as sql but I gave it my best and I found a sql statement do
accomplish the counting!

SELECT Place.id, CONCAT(Place.name, ' (', COUNT(*), ')') AS name,
Place.state
FROM Hobby
JOIN Person ON Hobby.id = Person.hobby_id
JOIN Place ON Person.place_id = Place.id
WHERE Hobby.name LIKE '%fishing%' GROUP BY(Person.place_id) ORDER BY
NULL
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model Association 'limit' not working

2007-12-07 Thread sanderken

Maybe I should mention I'm using oracle for DBMS.

On 7 dec, 21:54, sanderken <[EMAIL PROTECTED]> wrote:
> Hey,
>
> I defined a "user" (named Gebruiker in my native language ) model
> where when I call a $this->find() , needs to retrieve only a limited
> amount of related information.
>
> When I add the 'limit' => '10' to the association info, it doesn't
> work. For example: I call
>$gebruiker = $this->find(
> array("Gebruiker.id" => $gebruikerid)
> );
>  in the model and it retrieves 11 'kommentaars'.
>
> Does anyone know why this happens? I searched the internet for model
> information, and even the example 
> onhttp://manual.cakephp.org/chapter/modelsshow the same way of doing
> this. But it works in their example and not in my situation ;)
>
> Does anyone know how to solve this problem?
>
> Thanks,
>
> Here's the code:
>
> class Gebruiker extends AppModel
> {
> var $name = 'Gebruiker';
>
> var $hasMany = array(
> 'Blog' => array(
> 'className' => 'Blog',
> 'order' => 'Blog.created DESC',
> 'limit' => '10',
> 'foreignKey' => 'gebruiker_id',
>
> ),
> 'Kommentaar' => array(
> 'className' => 'Kommentaar',
> 'order' => 'Kommentaar.created DESC',
> 'limit' => '5',
> 'foreignKey' => 'gebruiker_id'
> ),
> 'Message_sent' => array(
> 'className' => 'Message',
> 'order'=> 'Message_sent.created DESC',
> 'limit'=> '10',
> 'foreignKey'=> 'sender_id',
> ),
> 'Message_received' => array(
> 'className' => 'Message',
> 'order'=>
> 'Message_received.created DESC',
> 'limit'   => '10',
> 'foreignKey'=> 'receiver_id',
> )
> );
>  
>
> }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dbdesigner :: hasAndBelongsToMany ER example

2007-12-07 Thread powtac


Hi zonium,
a general question: in't it required to set up both "directions"? This
is something I never understood!
Simon

On 7 Dez., 22:18, zonium <[EMAIL PROTECTED]> wrote:
> I think your diagram is correct academically.
>
> For implementation using cake, I  usually just need to specify one of
> the 2 associations:
>
> User HasAndBelongsToMany Projects
> or
> Projects HasAndBelongsToMany Users
>
> Because any one of these already represents the linkage between the 2
> model (User and Project)
>
> On Dec 7, 11:03 am, Josoroma <[EMAIL PROTECTED]> wrote:
>
> > You must to copy and paste the url in the 
> > browser:http://www.sukialogic.com/cakephp/screen_capture/dbdesigner_habtm.png
>
> > Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dbdesigner :: hasAndBelongsToMany ER example

2007-12-07 Thread zonium

I think your diagram is correct academically.

For implementation using cake, I  usually just need to specify one of
the 2 associations:

User HasAndBelongsToMany Projects
or
Projects HasAndBelongsToMany Users

Because any one of these already represents the linkage between the 2
model (User and Project)


On Dec 7, 11:03 am, Josoroma <[EMAIL PROTECTED]> wrote:
> You must to copy and paste the url in the 
> browser:http://www.sukialogic.com/cakephp/screen_capture/dbdesigner_habtm.png
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Model Association 'limit' not working

2007-12-07 Thread sanderken

Hey,

I defined a "user" (named Gebruiker in my native language ) model
where when I call a $this->find() , needs to retrieve only a limited
amount of related information.

When I add the 'limit' => '10' to the association info, it doesn't
work. For example: I call
   $gebruiker = $this->find(
array("Gebruiker.id" => $gebruikerid)
);
 in the model and it retrieves 11 'kommentaars'.

Does anyone know why this happens? I searched the internet for model
information, and even the example on
http://manual.cakephp.org/chapter/models show the same way of doing
this. But it works in their example and not in my situation ;)

Does anyone know how to solve this problem?

Thanks,

Here's the code:

class Gebruiker extends AppModel
{
var $name = 'Gebruiker';

var $hasMany = array(
'Blog' => array(
'className' => 'Blog',
'order' => 'Blog.created DESC',
'limit' => '10',
'foreignKey' => 'gebruiker_id',


),
'Kommentaar' => array(
'className' => 'Kommentaar',
'order' => 'Kommentaar.created DESC',
'limit' => '5',
'foreignKey' => 'gebruiker_id'
),
'Message_sent' => array(
'className' => 'Message',
'order'=> 'Message_sent.created DESC',
'limit'=> '10',
'foreignKey'=> 'sender_id',
),
'Message_received' => array(
'className' => 'Message',
'order'=>
'Message_received.created DESC',
'limit'   => '10',
'foreignKey'=> 'receiver_id',
)
);
 
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



findby for cake 1.2

2007-12-07 Thread oracle411

I thought I read somewhere that their is a new way that cakePHP does
findby..

This is how I did it the old way.

$this->controller->Signup->findByConfirmCode($confirmCode)

Is their a better way to do it with 1.2?

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CLOB in cakephp 1.2

2007-12-07 Thread sanderken

Hello Lauwens,

What a coincidance, yes :)

I'm still trying to bind the >4000 string from php to the CLOB field.
I manage to READ the data ( I manually put into the database ) with no
problem, I just can't push the data back into the database.
I read about the ticket, the solution lies there indeed, but I have no
idea how to do it.

Does someone know how to "save" a model with a clob inside?

Thanks in advance

On 7 dec, 16:55, Lauwens <[EMAIL PROTECTED]> wrote:
> I am trying to do the exact same thing (what a coincidance)
>
> I only found a ticket with a patch about this
> here:https://trac.cakephp.org/ticket/2294
>
> But that doesn't seem to do the trick...
>
> Maybe we can get in contact with cedsav  for our problem ?
>
> On 5 dec, 01:28, sanderken <[EMAIL PROTECTED]> wrote:
>
> > Hello everybody.
>
> > After a long quest on the internet and through the cakephp API, I
> > can't find a solution to my problem .
>
> > Here goes:
> > Cakephp is working great with my oracle database. Now I want to store
> > messages > 4000 chars (VARCHAR2). So I want to go with aCLOB.
>
> > When I fill the data straight in the database with some 20k
> > characters , all happens as wanted: model reads theCLOBand prints
> > it. No problem.
>
> > Now the REAL problem: I can't get the data BACK into the database !
>
> > This is the error: Warning (2): ociexecute() [function.ociexecute]:
> > ORA-01704: string literal too long [CORE/cake/libs/model/datasources/
> > dbo/dbo_oracle.php, line 291]
>
> > Help would be greatly appreciated !

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Creating an index page

2007-12-07 Thread [EMAIL PROTECTED]

I'm starting to toy with CakePHP and while I've gone over the
tutorials I could find I can't seem to locate this information. I want
to be able to hit my site http://www.mydomain.com/directory and am
trying to get it to hit an index page, so effectively index.php as if
I was creating scripts in my normal method.

Perhaps I am going about it the wrong way for CakePHP but I am unsure
of how to handle this.

So I want the user to hit my site and check for a session. I found
some good tutorials on sessions so I'm sure that will go fine but this
index file I'm having problems with. I made an index controller and
index model but there is no index table so I'm receiving an error.

If there is no session I want them to be prompted to login or
register...am I going about this the wrong way with the framework?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Adding new routes from a controller. (Cake 1.2)

2007-12-07 Thread Chris Hawes

Ok, I've cracked it, I have put the code in the applications app/
config/routes.php file. The code is as follows:

$Configure =& Configure::getInstance();
$Folder =& new Folder();

$Folder->cd($Configure->pluginPaths[0]);
$plugins = $Folder->ls();

foreach ($plugins[0] as $plugin) {
$File =& new File($Configure->pluginPaths[0] . $plugin . DS .
'config' . DS . $plugin . '_routes.php');

if ($File->exists()) {
include_once($File->pwd());
}
}

Ta,

Chris.


On Dec 7, 6:42 pm, Chris Hawes <[EMAIL PROTECTED]> wrote:
> Hello,
>
> The application I am currently developing will make the use of
> plugins.
>
> Currently in the app/app_controller.php beforeFilter (which is
> probably the wrong place) I get a list of plugins. I then check to see
> if a config file exists for the plugin, and execute the file.
>
> I would also like to allow the plugin to define routes (could be
> dangerous I know).
>
> Should I include a custom file in bootstrap.php and from there load in
> the various plugins routes?  Can I use the nice File and Folder
> classes from a file loaded with bootstrap.php?
>
> The long and short of it is, how do I define more routes in a
> controller? Is there a better way of doing this?
>
> Sorry if this isn't clear, or if I'm horribly breaking the MVC way.
>
> Many Thanks,
>
> Chris.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Adding new routes from a controller. (Cake 1.2)

2007-12-07 Thread Chris Hawes

Hello,

The application I am currently developing will make the use of
plugins.

Currently in the app/app_controller.php beforeFilter (which is
probably the wrong place) I get a list of plugins. I then check to see
if a config file exists for the plugin, and execute the file.

I would also like to allow the plugin to define routes (could be
dangerous I know).

Should I include a custom file in bootstrap.php and from there load in
the various plugins routes?  Can I use the nice File and Folder
classes from a file loaded with bootstrap.php?

The long and short of it is, how do I define more routes in a
controller? Is there a better way of doing this?

Sorry if this isn't clear, or if I'm horribly breaking the MVC way.

Many Thanks,

Chris.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dbdesigner :: hasAndBelongsToMany ER example

2007-12-07 Thread Josoroma

You must to copy and paste the url in the browser:
http://www.sukialogic.com/cakephp/screen_capture/dbdesigner_habtm.png

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dbdesigner :: hasAndBelongsToMany ER example

2007-12-07 Thread José Pablo Orozco Marín

Ok!

I think that i found the answer:
http://it.swantafe.wa.edu.au/index.php?option=com_content&task=view&id=105&Itemid=49

Im doing this ER right?
Screen capture of HABTM using DbDesigner:
http://www.sukialogic.com/cakephp/screen_capture/dbdesigner_habtm.png


Any comment is welcome.
Thanks.

-- 
 
-

José Pablo Orozco Marín
[EMAIL PROTECTED]

Tel. +506 820-7280

Por favor, visite mi pasión:
http://www.SukiaLogic.com/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Username availabilty check

2007-12-07 Thread Jason Burgess

I've had pretty good luck doing it this way.  Below are the important
snippets of code.  I've left off the actual checking code since that is very
specific to my application.  You can see it in action here:
http://www.area50four.com/signup

>From the Signup page:


input("User/username", array('onChange' =>
'validateUsername(this.value)')); ?>


function validateUsername(username)
{
new Ajax.Updater('validationHolder', '/users/checkUsername/' +
username, { evalScripts : true });
}



The entire check_username.thtml:


alert('Your username contains invalid characters.  It can only
contain alphanumeric characters and the underscore. It cannot contain
spaces.  For example: A-Z, 0-9 and _');
$('UserUsername').focus();



alert('The username you have entered has already been taken.  Please
choose another.');
$('UserUsername').focus();




-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Anoop
Sent: Friday, December 07, 2007 8:42 AM
To: Cake PHP
Subject: Username availabilty check


Hi All ,

Can anyone provide me a username availability check script using ajax
helper of cake php.. I am facing the problem that in ajax->link I am
not able to get the username , the user just placed into the form.

link('check',"Check",array( 'url'=>"/registration/
checkUserExists/", 'update'=>"user_exist"));?>

How can I include the username the user entered recently to the url??

Please help..Very urgent

Thanks in advance
Anoop


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Latest additions to 1.2

2007-12-07 Thread Aaron Shafovaloff

I figured everything out. I'm an idiot :-)

On Dec 7, 10:24 am, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> Using latest SVN I get:
>
> Fatal error: Call to undefined method ClassRegistry::init()
>
> On Dec 7, 6:00 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > ClassRegistry::init('plugin.modelname'); should work.
>
> > On Dec 6, 10:49 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
>
> > > Ahhh specifically it works when you manually do animport, but you
> > > can't yet use dot notation with "uses" at the top of your controller.
>
> > > On Nov 17, 9:17 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > > > Several people voiced opinions about plugins and in an effort to make
> > > > them more flexible we added the functionality to access models across
> > > > plugins and the main application in the current 1.2 branch. Use the
> > > > dot notation "Plugin.Model" to access models in thepluginand "Model"
> > > > to access the models of the main app.
>
> > > > To allow us this flexibility we changed how classes are loaded and
> > > > instances created. From the initial tests, these  changes provide some
> > > > nice performance gains while reducing the amount of code needed in
> > > > your application. Keep in mind that with greater flexibility, comes
> > > > greater responsibility to maintain your applications architecture.
>
> > > > ClassRegistry::init(); will return an instance of the class from the
> > > > registry or create and add it to the registry if it does not exist.
> > > > This is particularly useful for models and is used in the current core
> > > > code to create the model instances.
>
> > > > App::import(); will load and cache the location of a file found
> > > > anywhere in the cake install. This is used in place of the load*
> > > > functions previously found in basics.php. You can see in the current
> > > > code that the functions use this class method now.
>
> > > > The api for these methods are currently in alpha state, but will be
> > > > stabilized for beta. You can check out the doc comments for more info.
> > > > The online API,http://api.cakephp.orgwillbeupdatedshortly.
>
> > > > Bake on.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Using PHP 5 Functionality In Your App

2007-12-07 Thread Jason Burgess

For the sites we're doing, we've switched to using PHP5.  Since the software
isn't going to be released we weren't worried about anyone trying to run it
using PHP4.

About 6 or 8 months ago, when we started adding support for users to see
times in their local time zone, I started looking for solutions.  The only
one I found that wasn't hugely complicated or flaky at best was the new date
functions in PHP 5.1.  The next day, I upgraded our web servers to PHP5.

I think we're one or two other features that are new in PHP5 but I can't
recall what they are off the top of my head.

Jason Burgess

-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Sliv
Sent: Thursday, December 06, 2007 12:22 PM
To: Cake PHP
Subject: Using PHP 5 Functionality In Your App

I was wondering if developers out there who are writing CakePHP apps
in a PHP 5 environment are using PHP 5 functionality in their app(s)
or are choosing to stick with functionality available in 4 or 5?

Since Cake is compatible with both versions, developed apps may want
to be compatible with both as well for portability.  However, perhaps
there are (dis)advantages to using new functionality and I wondered if
folks would share their experiences...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL on different database

2007-12-07 Thread AD7six



On Dec 7, 6:38 pm, shifaz <[EMAIL PROTECTED]> wrote:
> Thanks Samuel for the quick response and i would use this method if I
> have no other options, I would really like to know how this can be
> done the other way round.

I wonder what that does:
https://trac.cakephp.org/browser/branches/1.2.x.x/app/config/core.php#L163
and it's the same principle (although a little harder to find) in 1.1
https://trac.cakephp.org/browser/branches/1.1.x.x/cake/libs/controller/components/dbacl/db_acl.php#L29ACL_DATABASE

hth,

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Dbdesigner :: hasAndBelongsToMany ER example

2007-12-07 Thread Josoroma

Hi!

Im stuck trying to undersatnd how to represent hasAndBelongsToMany
using DbDesginer.

--

hasOne
1:1

belongsTo
1:1

hasMany
1:n

HasAndBelongsToMany
¿ ?

--

For example:

User HasAndBelongsToMany Projects
Projects HasAndBelongsToMany Users

users
  id
  name
  username
  password

projects
  id
  name
  description

users_projects
  id
  user_id
  project_id


Which is the right way to represent the relationships using
Dbdesigner?


Any help is welcome. Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Latest additions to 1.2

2007-12-07 Thread Aaron Shafovaloff

I went back to trying loadModel and it's weird, on two different
machines I have the same SVN updates of cake and my app. I've triple-
checked this.

But on one machine I get:

Warning (512): loadModel is deprecated see App::import('Model',
'ModelName'); [CORE\cake\basics.php, line 1036]

And on the other machine it works fine.

On Dec 7, 10:24 am, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> Using latest SVN I get:
>
> Fatal error: Call to undefined method ClassRegistry::init()
>
> On Dec 7, 6:00 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > ClassRegistry::init('plugin.modelname'); should work.
>
> > On Dec 6, 10:49 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
>
> > > Ahhh specifically it works when you manually do animport, but you
> > > can't yet use dot notation with "uses" at the top of your controller.
>
> > > On Nov 17, 9:17 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > > > Several people voiced opinions about plugins and in an effort to make
> > > > them more flexible we added the functionality to access models across
> > > > plugins and the main application in the current 1.2 branch. Use the
> > > > dot notation "Plugin.Model" to access models in thepluginand "Model"
> > > > to access the models of the main app.
>
> > > > To allow us this flexibility we changed how classes are loaded and
> > > > instances created. From the initial tests, these  changes provide some
> > > > nice performance gains while reducing the amount of code needed in
> > > > your application. Keep in mind that with greater flexibility, comes
> > > > greater responsibility to maintain your applications architecture.
>
> > > > ClassRegistry::init(); will return an instance of the class from the
> > > > registry or create and add it to the registry if it does not exist.
> > > > This is particularly useful for models and is used in the current core
> > > > code to create the model instances.
>
> > > > App::import(); will load and cache the location of a file found
> > > > anywhere in the cake install. This is used in place of the load*
> > > > functions previously found in basics.php. You can see in the current
> > > > code that the functions use this class method now.
>
> > > > The api for these methods are currently in alpha state, but will be
> > > > stabilized for beta. You can check out the doc comments for more info.
> > > > The online API,http://api.cakephp.orgwillbeupdatedshortly.
>
> > > > Bake on.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL on different database

2007-12-07 Thread shifaz

Thanks Samuel for the quick response and i would use this method if I
have no other options, I would really like to know how this can be
done the other way round.

On Dec 7, 10:02 pm, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> you could have all your code go the $useDbConfig route  and let ACL
> stuff use the default
>
> On Dec 7, 2007 9:50 AM, shifaz <[EMAIL PROTECTED]> wrote:
>
>
>
> > I want to use the ACL feature on cake and would like how i can
> > configure cake to use the acl table on a different database (which i
> > can have read/write access). The default database connection on cake
> > config uses a read-only database, I wont be able to create any
> > additional tables on it.
>
> > I'm aware that i can access other databases by defining the
> > "$useDbConfig" variable on models. but I'm clueless on how this can be
> > done with ACLs
>
> > Can someone help me on this?
>
> --
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot
>
> http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using PHP 5 Functionality In Your App

2007-12-07 Thread Sliv

@Walker:  I guess I was thinking more along the lines of new
functionality that some developers may want to take advantage of and
are willing to give up backwards compatibility in their app to do it.
By "share their experiences", I guess I was looking for feedback on
examples of such functionality from devs with far more PHP 5
familiarity than me so that I could add weight to a personal design
decision to try and code my cakephp app(s) for "portability" or for
taking advantage of new functionality

On Dec 6, 1:39 pm, Walker Hamilton <[EMAIL PROTECTED]> wrote:
> It depends, if we want to make the app portable, we stick with the php
> 4 compatibility.
>
> It we're building a custom app that will only end up in one place or
> used by a single entity, we stick to the version that is in use within
> that environment.
>
> To me, the question you ask does not need to be.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Latest additions to 1.2

2007-12-07 Thread Aaron Shafovaloff

Using latest SVN I get:

Fatal error: Call to undefined method ClassRegistry::init()

On Dec 7, 6:00 am, francky06l <[EMAIL PROTECTED]> wrote:
> ClassRegistry::init('plugin.modelname'); should work.
>
> On Dec 6, 10:49 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
>
> > Ahhh specifically it works when you manually do animport, but you
> > can't yet use dot notation with "uses" at the top of your controller.
>
> > On Nov 17, 9:17 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > > Several people voiced opinions about plugins and in an effort to make
> > > them more flexible we added the functionality to access models across
> > > plugins and the main application in the current 1.2 branch. Use the
> > > dot notation "Plugin.Model" to access models in thepluginand "Model"
> > > to access the models of the main app.
>
> > > To allow us this flexibility we changed how classes are loaded and
> > > instances created. From the initial tests, these  changes provide some
> > > nice performance gains while reducing the amount of code needed in
> > > your application. Keep in mind that with greater flexibility, comes
> > > greater responsibility to maintain your applications architecture.
>
> > > ClassRegistry::init(); will return an instance of the class from the
> > > registry or create and add it to the registry if it does not exist.
> > > This is particularly useful for models and is used in the current core
> > > code to create the model instances.
>
> > > App::import(); will load and cache the location of a file found
> > > anywhere in the cake install. This is used in place of the load*
> > > functions previously found in basics.php. You can see in the current
> > > code that the functions use this class method now.
>
> > > The api for these methods are currently in alpha state, but will be
> > > stabilized for beta. You can check out the doc comments for more info.
> > > The online API,http://api.cakephp.orgwillbeupdated shortly.
>
> > > Bake on.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL on different database

2007-12-07 Thread Samuel DeVore

you could have all your code go the $useDbConfig route  and let ACL
stuff use the default


On Dec 7, 2007 9:50 AM, shifaz <[EMAIL PROTECTED]> wrote:
>
> I want to use the ACL feature on cake and would like how i can
> configure cake to use the acl table on a different database (which i
> can have read/write access). The default database connection on cake
> config uses a read-only database, I wont be able to create any
> additional tables on it.
>
> I'm aware that i can access other databases by defining the
> "$useDbConfig" variable on models. but I'm clueless on how this can be
> done with ACLs
>
> Can someone help me on this?
>
> >
>



-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



ACL on different database

2007-12-07 Thread shifaz

I want to use the ACL feature on cake and would like how i can
configure cake to use the acl table on a different database (which i
can have read/write access). The default database connection on cake
config uses a read-only database, I wont be able to create any
additional tables on it.

I'm aware that i can access other databases by defining the
"$useDbConfig" variable on models. but I'm clueless on how this can be
done with ACLs

Can someone help me on this?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: User Defined Fields

2007-12-07 Thread Serge Rodovnichenko

You need an additional table with user fileds: id, user_id, fieldname,
fieldvalue. User hasMany UserDefinedFields.

On Dec 7, 4:17 pm, JTTACJ1 <[EMAIL PROTECTED]> wrote:
> What is the best strategy for allowing application users to define
> database fields on the fly?
>
> For example in a customer database you would have customer name,
> address and address.  One company might want to include some grouping
> fields so they add a User Defined Field called CustomerType.  This
> field should then be available in views for editing and reporting on
> data.
>
> Any standard approaches to this that don't require the user to
> manipulate the database and source code directly?
>
> Jaes
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Anybody Having a UserName Check script using Ajax

2007-12-07 Thread As

Hi
I am new to cakephp.I need to check whether a user is already avalable
in database using Ajax.Is there any one did the username check script
in cakephp using ajax and prototype library? If not help me providing
the basic idea.

Thanks

Janet

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Nested Categories Problem

2007-12-07 Thread Serge Rodovnichenko

TreeBehaviour uses a Nested Sets pattern, unlike conventional parent-
child pattern, used in your schema. More about various patterns of SQL-
trees: http://www.dbazine.com/oracle/or-articles/tropashko4

You need a 3 fields to use with TreeBehaviour: 'parent', 'lft', 'rgt'.
Remember, that Nested Sets isn't a good idea in cases of frequent
INSERTs :-(

On Dec 7, 7:02 pm, Sean <[EMAIL PROTECTED]> wrote:
> I have two tables, categories and products
> Here it is the structure and data 
> :http://img507.imageshack.us/img507/1892/17632651tq5.gif
> Please check it out.
>
> 1. I want to get all products which categories.id is 1 (food) and
> products from all 1's childs, i do not know how to do that.
> So it will show :
> - burger king
> - burger mcdonnald
> - hotdog wendy's
>
> 2. If i do $this->Product->find(array('Product.id'=>6)); (seagate
> 160Gb barracuda)
> How do i get the tree of its category?
> The category_id is 7.
> I want to show like this :
> electronic > computer accessories > harddisk
>
> please help me with this things, i hope you understand what i mean.
> thanks so much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



need xhtml and css designer with Cake experience

2007-12-07 Thread [EMAIL PROTECTED]

Hey Cake Users and Developers,

I co-own a web development company in the Chicagoland area and we are
strictly a CakePHP shop.  We are in severe need of a talented designer
with solid xhtml/css skills and preferably some Cake experience.

We are trying many placed to find someone, but having trouble finding
"true" talent in this area.

So, I'm writing this message to see if anyone had a contact that is
maybe looking for some contract work or takes on freelance design work
that is good.

Requirements

1) xhtml

2) css

3) DIV based style driven design

4) Cross browser awareness and clean/proper approaches to remedy or
avoid issues.

5) Photoshop and Illustrator skills a plus.

Thanks guys.

Lee Forkenbrock
Partner / Project Manager
Loadsys Consulting Inc.
http://www.loadsys.com
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CLOB in cakephp 1.2

2007-12-07 Thread Lauwens

I am trying to do the exact same thing (what a coincidance)

I only found a ticket with a patch about this
here: https://trac.cakephp.org/ticket/2294

But that doesn't seem to do the trick...


Maybe we can get in contact with cedsav  for our problem ?

On 5 dec, 01:28, sanderken <[EMAIL PROTECTED]> wrote:
> Hello everybody.
>
> After a long quest on the internet and through the cakephp API, I
> can't find a solution to my problem .
>
> Here goes:
> Cakephp is working great with my oracle database. Now I want to store
> messages > 4000 chars (VARCHAR2). So I want to go with aCLOB.
>
> When I fill the data straight in the database with some 20k
> characters , all happens as wanted: model reads theCLOBand prints
> it. No problem.
>
> Now the REAL problem: I can't get the data BACK into the database !
>
> This is the error: Warning (2): ociexecute() [function.ociexecute]:
> ORA-01704: string literal too long [CORE/cake/libs/model/datasources/
> dbo/dbo_oracle.php, line 291]
>
> Help would be greatly appreciated !

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to "INNER Join" in Model ?

2007-12-07 Thread Baz
Didn't work for me.

On Dec 7, 2007 8:47 AM, foxmask <[EMAIL PROTECTED]> wrote:

>
> Nice !
>
>
> On Dec 6, 10:48 pm, nate <[EMAIL PROTECTED]> wrote:
> >  > class ForumPerm extends AppModel {
> > var $name = 'ForumPerm';
> > var $primaryKey = 'group_id,forum_id';
> > //The Associations below have been created with all possible
> > keys,
> > those that are not needed can be removed
> > var $belongsTo = array(
> > 'Group' => array('type' => 'INNER'),
> > 'Forum' => array('type' => 'INNER')
> > );
> >
> > }
> >
> > On Dec 6, 12:28 pm, Baz <[EMAIL PROTECTED]> wrote:
> >
> > > I'm sorry, I'm a bit lost.
> >
> > > Could you explain this a lil more?
> >
> > > On Dec 6, 2007 10:15 AM, nate <[EMAIL PROTECTED]> wrote:
> >
> > > > On 1.2 you can set the 'type' key in the association, which defaults
> > > > to "LEFT".
> >
> > > > On Dec 6, 7:39 am, foxmask <[EMAIL PROTECTED]> wrote:
> > > > > Hi  Baz
> > > > > We suggested me to do this :
> >
> > > > > in the topics controller :
> > > > > function lastTopics(){
> > > > > $sql =
> > > > > "SELECT Topic.id, Topic.subject FROM topics AS Topic INNER JOIN
> forums
> > > > > AS Forum ON
> > > > > Forum.id = Topic.forum_id LEFT JOIN forum_perms AS ForumPerm ON
> > > > > (ForumPerm.forum_id=Forum.id AND
> > > > > ForumPerm.group_id='xxx') WHERE (ForumPerm.read_forum IS NULL OR
> > > > > ForumPerm.read_forum=1)
> > > > > AND Topic.moved_to IS NULL  ORDER BY Topic.last_post DESC LIMIT 10
> ";
> > > > > $resultset = $this->Topic->query($sql);
> > > > > return $resultset;
> >
> > > > > }
> >
> > > > > and in my element :
> > > > > $pt_active_topics = $this->requestAction('topics/lastTopics/');
> >
> > > > > On Dec 5, 9:59 pm, Baz L <[EMAIL PROTECTED]> wrote:
> >
> > > > > > I ran into a need for this today.
> >
> > > > > > In the interest of time, I just trim the array I get back after
> the
> > > > > > fact, however...is there someway to do this?
> > > > > > --
> > > > > > Baz L
> > > > > > Web Development 2.0http://WebDevelopment2.com/
> >
> > > > > > On Dec 1, 1:30 pm, foxmask <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > gooed evening
> > > > > > > any idea aboutinner join?
> >
> > > > > > > On Nov 29, 12:39 pm, foxmask <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > Hi i'd like to know what i need to do and in what model, to
> be
> > > > able to
> > > > > > > > use this SQL query
> >
> > > > > > > > SELECT t.id, t.subject FROM topics AS tINNER JOINforums AS f
> ON
> > > > > > > > f.id=t.forum_id LEFT JOIN forum_perms AS fp ON (
> fp.forum_id=f.idAND
> > > > > > > > fp.group_id='xxx') WHERE (fp.read_forum IS NULL OR
> fp.read_forum=1
> > > > )
> > > > > > > > AND t.moved_to IS NULL  ORDER BY t.last_post DESC LIMIT 10
> >
> > > > > > > > actually this SQL Query :
> > > > > > > > SELECT `Post`.`id`, `Post`.`poster`, `Post`.`poster_id`,
> > > > > > > > `Post`.`poster_ip`, `Post`.`poster_email`, `Post`.`message`,
> > > > > > > > `Post`.`hide_smilies`, `Post`.`posted`, `Post`.`edited`,
> > > > > > > > `Post`.`edited_by`, `Post`.`topic_id`, `Topic`.`id`,
> > > > `Topic`.`poster`,
> > > > > > > > `Topic`.`subject`, `Topic`.`posted`, `Topic`.`last_post`,
> > > > > > > > `Topic`.`last_post_id`, `Topic`.`last_poster`,
> > > > `Topic`.`num_views`,
> > > > > > > > `Topic`.`num_replies`, `Topic`.`closed`, `Topic`.`sticky`,
> > > > > > > > `Topic`.`moved_to`, `Topic`.`forum_id` FROM `posts` AS
> `Post` LEFT
> > > > > > > > JOIN `topics` AS `Topic` ON (`Post`.`topic_id` =
> `Topic`.`id`)
> > > > WHERE 1
> > > > > > > > = 1 ORDER BY `last_post` desc LIMIT 10
> >
> > > > > > > > is produce when i do in my element :
> >
> > > > > > > > $pt_active_topics =
> > > > $this->requestAction('posts/index/sort:last_post/
> > > > > > > > direction:desc/limit:10');
> >
> > > > > > > > here are my models :
> >
> > > > > > > >  > > > > > > > class Post extends AppModel {
> >
> > > > > > > > var $name = 'Post';
> >
> > > > > > > > //The Associations below have been created with all
> > > > possible keys,
> > > > > > > > those that are not needed can be removed
> > > > > > > > var $belongsTo = array(
> > > > > > > > 'Topic' => array('className' =>
> 'Topic',
> >
> > > > 'foreignKey' => 'topic_id',
> >
> > > > 'conditions' => '',
> >
> > > > 'fields' => '',
> >
> > > > 'order' => '',
> >
> > > > 'counterCache' => ''),
> > > > > > > > );
> >
> > > > > > > > }
> >
> > > > > > > >  > > > > > > > class Topic extends AppModel {
> >
> > > > > > > > var $name = 'Topic';
> >
> > > > > > > > //The Associations below have been created with all
> > > > possible keys,
> > > > > > > > those that are not needed can be removed
> > > > > > > > var $belongsTo = array(
> > > > > > > > 'Forum' => array('className' =>
> 'Forum',
> >
> > > > 'foreignKey' => 'forum_id',
> >
> > > > 'conditions' => '',
> >
> > > > 'fields' => '',
> >
> > > > 'or

Re: Anyone up for a 1.2 query construction challenge?

2007-12-07 Thread grigri

I've only just noticed that there is indeed a group parameter for
Set::combine(). So you could quite easily do

$people = $this->Person->find(
  'all',
  array(
'conditions' =>array('Hobby.name' => $keywords),
'recursive' => 0
  )
);

$placesList = Set::combine($people, '{n}.Place.id', '{n}.Place.name',
'{n}.Place.state');

Still, no counts without post-processing though.

On Dec 7, 2:49 pm, djiize <[EMAIL PROTECTED]> wrote:
> there is an argument for generateList that group your result by state:
> $places_list= $this->Hobby->Place->generateList(null, 'name ASC',
> null, null, null, '{n}.Place.state');
>
> and with a little post-processing, you'll have counts:
> foreach ($places_list as $state => $places) {
>   foreach ($places as $place_id => $place) {
> $count = $this->Hobby->Person->findCount(array('place_id' =>
> $place_id));
> $places_list[$state][$place_id] = $places_list[$state]
> [$place_id] . ' (' . $count . ')';
>   }}
>
> $this->set('places', $places_list);
>
> and in you view:
> input('Place.id', array('options' => $places,
> 'empty' => 'Choose a place')) ?>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Anyone up for a 1.2 query construction challenge?

2007-12-07 Thread djiize

there is an argument for generateList that group your result by state:
$places_list= $this->Hobby->Place->generateList(null, 'name ASC',
null, null, null, '{n}.Place.state');

and with a little post-processing, you'll have counts:
foreach ($places_list as $state => $places) {
  foreach ($places as $place_id => $place) {
$count = $this->Hobby->Person->findCount(array('place_id' =>
$place_id));
$places_list[$state][$place_id] = $places_list[$state]
[$place_id] . ' (' . $count . ')';
  }
}
$this->set('places', $places_list);

and in you view:
input('Place.id', array('options' => $places,
'empty' => 'Choose a place')) ?>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to "INNER Join" in Model ?

2007-12-07 Thread foxmask

Nice !


On Dec 6, 10:48 pm, nate <[EMAIL PROTECTED]> wrote:
>  class ForumPerm extends AppModel {
> var $name = 'ForumPerm';
> var $primaryKey = 'group_id,forum_id';
> //The Associations below have been created with all possible
> keys,
> those that are not needed can be removed
> var $belongsTo = array(
> 'Group' => array('type' => 'INNER'),
> 'Forum' => array('type' => 'INNER')
> );
>
> }
>
> On Dec 6, 12:28 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > I'm sorry, I'm a bit lost.
>
> > Could you explain this a lil more?
>
> > On Dec 6, 2007 10:15 AM, nate <[EMAIL PROTECTED]> wrote:
>
> > > On 1.2 you can set the 'type' key in the association, which defaults
> > > to "LEFT".
>
> > > On Dec 6, 7:39 am, foxmask <[EMAIL PROTECTED]> wrote:
> > > > Hi  Baz
> > > > We suggested me to do this :
>
> > > > in the topics controller :
> > > > function lastTopics(){
> > > > $sql =
> > > > "SELECT Topic.id, Topic.subject FROM topics AS Topic INNER JOIN forums
> > > > AS Forum ON
> > > > Forum.id = Topic.forum_id LEFT JOIN forum_perms AS ForumPerm ON
> > > > (ForumPerm.forum_id=Forum.id AND
> > > > ForumPerm.group_id='xxx') WHERE (ForumPerm.read_forum IS NULL OR
> > > > ForumPerm.read_forum=1)
> > > > AND Topic.moved_to IS NULL  ORDER BY Topic.last_post DESC LIMIT 10 ";
> > > > $resultset = $this->Topic->query($sql);
> > > > return $resultset;
>
> > > > }
>
> > > > and in my element :
> > > > $pt_active_topics = $this->requestAction('topics/lastTopics/');
>
> > > > On Dec 5, 9:59 pm, Baz L <[EMAIL PROTECTED]> wrote:
>
> > > > > I ran into a need for this today.
>
> > > > > In the interest of time, I just trim the array I get back after the
> > > > > fact, however...is there someway to do this?
> > > > > --
> > > > > Baz L
> > > > > Web Development 2.0http://WebDevelopment2.com/
>
> > > > > On Dec 1, 1:30 pm, foxmask <[EMAIL PROTECTED]> wrote:
>
> > > > > > gooed evening
> > > > > > any idea aboutinner join?
>
> > > > > > On Nov 29, 12:39 pm, foxmask <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hi i'd like to know what i need to do and in what model, to be
> > > able to
> > > > > > > use this SQL query
>
> > > > > > > SELECT t.id, t.subject FROM topics AS tINNER JOINforums AS f ON
> > > > > > > f.id=t.forum_id LEFT JOIN forum_perms AS fp ON 
> > > > > > > (fp.forum_id=f.idAND
> > > > > > > fp.group_id='xxx') WHERE (fp.read_forum IS NULL OR fp.read_forum=1
> > > )
> > > > > > > AND t.moved_to IS NULL  ORDER BY t.last_post DESC LIMIT 10
>
> > > > > > > actually this SQL Query :
> > > > > > > SELECT `Post`.`id`, `Post`.`poster`, `Post`.`poster_id`,
> > > > > > > `Post`.`poster_ip`, `Post`.`poster_email`, `Post`.`message`,
> > > > > > > `Post`.`hide_smilies`, `Post`.`posted`, `Post`.`edited`,
> > > > > > > `Post`.`edited_by`, `Post`.`topic_id`, `Topic`.`id`,
> > > `Topic`.`poster`,
> > > > > > > `Topic`.`subject`, `Topic`.`posted`, `Topic`.`last_post`,
> > > > > > > `Topic`.`last_post_id`, `Topic`.`last_poster`,
> > > `Topic`.`num_views`,
> > > > > > > `Topic`.`num_replies`, `Topic`.`closed`, `Topic`.`sticky`,
> > > > > > > `Topic`.`moved_to`, `Topic`.`forum_id` FROM `posts` AS `Post` LEFT
> > > > > > > JOIN `topics` AS `Topic` ON (`Post`.`topic_id` = `Topic`.`id`)
> > > WHERE 1
> > > > > > > = 1 ORDER BY `last_post` desc LIMIT 10
>
> > > > > > > is produce when i do in my element :
>
> > > > > > > $pt_active_topics =
> > > $this->requestAction('posts/index/sort:last_post/
> > > > > > > direction:desc/limit:10');
>
> > > > > > > here are my models :
>
> > > > > > >  > > > > > > class Post extends AppModel {
>
> > > > > > > var $name = 'Post';
>
> > > > > > > //The Associations below have been created with all
> > > possible keys,
> > > > > > > those that are not needed can be removed
> > > > > > > var $belongsTo = array(
> > > > > > > 'Topic' => array('className' => 'Topic',
>
> > > 'foreignKey' => 'topic_id',
>
> > > 'conditions' => '',
>
> > > 'fields' => '',
>
> > > 'order' => '',
>
> > > 'counterCache' => ''),
> > > > > > > );
>
> > > > > > > }
>
> > > > > > >  > > > > > > class Topic extends AppModel {
>
> > > > > > > var $name = 'Topic';
>
> > > > > > > //The Associations below have been created with all
> > > possible keys,
> > > > > > > those that are not needed can be removed
> > > > > > > var $belongsTo = array(
> > > > > > > 'Forum' => array('className' => 'Forum',
>
> > > 'foreignKey' => 'forum_id',
>
> > > 'conditions' => '',
>
> > > 'fields' => '',
>
> > > 'order' => '',
>
> > > 'counterCache' => ''),
> > > > > > > );
>
> > > > > > > var $hasMany = array(
> > > > > > > 'Post' => array('className' => 'Post',
>
> > > 'foreignKey' => 'topic_id',
>
> > > 'conditions' => '',
>
> > > 'fields' => '',
>
> > > 'order' => '',
>
> > > 'dependent' => ''),
> > > > > > > );
>
> > > > > > > }
>

Username availabilty check

2007-12-07 Thread Anoop

Hi All ,

Can anyone provide me a username availability check script using ajax
helper of cake php.. I am facing the problem that in ajax->link I am
not able to get the username , the user just placed into the form.

link('check',"Check",array( 'url'=>"/registration/
checkUserExists/", 'update'=>"user_exist"));?>

How can I include the username the user entered recently to the url??

Please help..Very urgent

Thanks in advance
Anoop
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Anyone up for a 1.2 query construction challenge?

2007-12-07 Thread kiger

Thanks for the tips. I guess I'll just use what you wrote until I run
into performance issues.

There is a method in form helper I believe which groups based on a
specific path, but it doesn't count up a total for you or anything
intricate like that. Oh well.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



User Defined Fields

2007-12-07 Thread JTTACJ1

What is the best strategy for allowing application users to define
database fields on the fly?

For example in a customer database you would have customer name,
address and address.  One company might want to include some grouping
fields so they add a User Defined Field called CustomerType.  This
field should then be available in views for editing and reporting on
data.

Any standard approaches to this that don't require the user to
manipulate the database and source code directly?

Jaes

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using PHP 5 Functionality In Your App

2007-12-07 Thread Mech7

Personally i don't care for php4 anmyore.. most hosting offer now php5
anyway.. also i think this year support will be dropped for it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Latest additions to 1.2

2007-12-07 Thread francky06l

ClassRegistry::init('plugin.modelname'); should work.

On Dec 6, 10:49 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> Ahhh specifically it works when you manually do an import, but you
> can't yet use dot notation with "uses" at the top of your controller.
>
> On Nov 17, 9:17 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > Several people voiced opinions about plugins and in an effort to make
> > them more flexible we added the functionality to access models across
> > plugins and the main application in the current 1.2 branch. Use the
> > dot notation "Plugin.Model" to access models in thepluginand "Model"
> > to access the models of the main app.
>
> > To allow us this flexibility we changed how classes are loaded and
> > instances created. From the initial tests, these  changes provide some
> > nice performance gains while reducing the amount of code needed in
> > your application. Keep in mind that with greater flexibility, comes
> > greater responsibility to maintain your applications architecture.
>
> > ClassRegistry::init(); will return an instance of the class from the
> > registry or create and add it to the registry if it does not exist.
> > This is particularly useful for models and is used in the current core
> > code to create the model instances.
>
> > App::import(); will load and cache the location of a file found
> > anywhere in the cake install. This is used in place of the load*
> > functions previously found in basics.php. You can see in the current
> > code that the functions use this class method now.
>
> > The api for these methods are currently in alpha state, but will be
> > stabilized for beta. You can check out the doc comments for more info.
> > The online API,http://api.cakephp.orgwillbe updated shortly.
>
> > Bake on.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Anyone up for a 1.2 query construction challenge?

2007-12-07 Thread grigri

Well, whatever you do, Cake won't "categorize" your results by state
for you, so you'll end up having the post-processing loop anyway.
(Unless there is some functionality for this hidden away somewhere -
it would come in handy).

Efficiency is only worth worrying about when it becomes an issue,
imho. If you honestly expect your results to be too large to process,
then by all means cook up some more complex SQL. But if you're not
expecting hundreds of thousands of rows to be returned, it's really
not worth the effort.

More important, when it comes to optimization, is properly structuring
your database (creating the right indexes on the right key
combinations, but only adding the ones you need. Hint: use EXPLAIN
SELECT), and managing caching.

If you think having a "large" chunk of code in the controller method
looks untidy, you could move it to the specific model, or even to a
behavior if it's going to be reused in other models. Shame there isn't
a Set::groupBy() method.

On Dec 7, 12:34 pm, kiger <[EMAIL PROTECTED]> wrote:
> @AD7six
> Sorry I was unable to eloquate myself clearer. What I wanted to do was
> kind of hard to explain.
>
> @grigri
> Thanks for wrapping your head around this. Your second guess was
> correct, in that I already have the keywords inputted. I have yet to
> learn AJAX.
>
> Your solution is spot on to what I have now, though you wrote it
> cleaner than me. In your last sentence you nailed home what I'm trying
> to do now. I am not that good with actual mySQL statements and would
> love to be able to wrap all this into one or two mySQL statements. I
> figure the more I can get into mySQL the more the load on the server
> will decrease. Any ideas on how I could do that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Anyone up for a 1.2 query construction challenge?

2007-12-07 Thread kiger

@AD7six
Sorry I was unable to eloquate myself clearer. What I wanted to do was
kind of hard to explain.

@grigri
Thanks for wrapping your head around this. Your second guess was
correct, in that I already have the keywords inputted. I have yet to
learn AJAX.

Your solution is spot on to what I have now, though you wrote it
cleaner than me. In your last sentence you nailed home what I'm trying
to do now. I am not that good with actual mySQL statements and would
love to be able to wrap all this into one or two mySQL statements. I
figure the more I can get into mySQL the more the load on the server
will decrease. Any ideas on how I could do that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax - Render and findAll

2007-12-07 Thread DanielV

Hello,

I have a application that displays 3 group of objects. Using Ajax I've
made every object draggable, and each of the 3 groups a droppable
element using ajax->drag and ajax->dropRemote respectively.
I've made it so when the user drags an object and drops it in a group
it calls an action 'ajaxUpdate'. This action updates the group's
objects, updates the database then calls $this->Group->findAllbyId
renders update.thtml. That
This action does the following:
1 - Updates the group's objects
2 - Updates the database
3 - Assigns '$this->Group->findAllById' to a variable named $group.
4 - renders update.thtml.

Update.thtml uses the variable $group to display the new group
members, since the ajax call dropRemote is updating  that groups 
id.

Everything works fine, the group gets updated, etc. The problem is the
$group variable always ends up with the old information, like if
"$this->Group->findAllbyId"  SQL statements get executed before '$this-
>Group->save()' statements even tho the are in the correct order. Im
not using caching and turning DEBUG to show SQL statements it seems it
actually does it in that incorrect order.

Im fairly new to cakephp and ajax so I would appreciate your help. If
I'm lacking details or clarity please tell me so.

Thank you!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Anyone up for a 1.2 query construction challenge?

2007-12-07 Thread grigri

I'm confused at what you mean in the dropdown - are both the
"keywords" textfield and "places" dropdown on the same form?

In that case, you can't get the number of people to display on each
option, because that information would be dependant on the keywords.
The only way to do that would be through AJAX, to dynamically update
the select box when the keywords field changes - is that what you're
trying to do?

Assuming you're not, and the keywords have already been input, and you
want to display the selectbox to narrow the results (on a subsequent
page):

// Assumes $keywords is a simple array like array('skating', 'ice');

// Get the people, joined on hobby and place
$people = $this->Person->find('all', array('conditions' =>
array('Hobby.name' => $keywords), 'recursive' => 0));

$placesList = array();
$placesPeopleCount = array();
foreach ($people as $row) {
  // For clarity
  $state = $row['Place']['state'];
  $placeId = $row['Place']['id'];

  if (!isset($placesList[$state][$placeId])) {
// First entry into this option
$placesList[$state][$placeId] = $row['Place']['name'];
$placesPeopleCount[$placeId] = 1;
  }
  else {
// Subsequent entry, just increment count
$placesPeopleCount[$placeId]++;
  }
}
// Now append the count onto the end of the option
foreach ($placesList as $state => $entries) {
  foreach ($entries as $id => $name) {
$entries[$id] = sprintf('%s [%s]', $name,
$placesPeopleCount[$id]);
  }
  $placesList[$state] = $entries;
}
$this->set(compact('placesList'));

// -- in the view

echo $form->select('Search.places', $placesList, null,
array('showParents' => true));

Of course, it might be more efficient to query the places/hobby
directly, using COUNT() and GROUP BY, but this will work quite well.
You could also restrict the fields returned by the findAll call,
because you don't need most of them.

On Dec 7, 8:17 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Dec 7, 2:53 am, kiger <[EMAIL PROTECTED]> wrote:
>
> > EDIT: I figured out a better way to describe step 3c)...
>
> > For each 'Place.name' I count up the number of people having a
> > 'Hobby.name' matching the selected keywords. I display this total in
> > parenthesis after the name of the place (e.g., Winter Ice Rink (2))
>
> I drifted off, as I'm sure many will after reading "so here is what I
> got" and not seeing anything clear. What sql do you want to achive?
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Obtain all elements of multiple select

2007-12-07 Thread Serge Rodovnichenko

Try to set/reset a 'selected' attribute of OPTION when moving options
between two lists.

On Dec 6, 9:19 pm, dandreta <[EMAIL PROTECTED]> wrote:
> I have an HABTM relation  between ModelA and ModelB.
> In the add view of A, I have created two lists, one with all B
> elements of the database and other one empty . I pass elements of the
> first list to the second one with javascript and the second list will
> contain the B elements that will be related to the A element which I
> am creating. The problem is that in order that the controller obtains
> the B elements of the second list I must select with the mouse. Then
> it saves the relations ok.
> But, anyone knows how I can achieve that the elements of the second
> list do not have to be selected or that always they are selected
> without having to do it with the mouse?
>
> Any suggestion or help?
> I hope you can help me.
> Thanks and regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using PHP 5 Functionality In Your App

2007-12-07 Thread Marcin Domanski aka kabturek

http://www.gophp5.org/
:)

On Dec 6, 7:22 pm, Sliv <[EMAIL PROTECTED]> wrote:
> I was wondering if developers out there who are writing CakePHP apps
> in a PHP 5 environment are using PHP 5 functionality in their app(s)
> or are choosing to stick with functionality available in 4 or 5?
>
> Since Cake is compatible with both versions, developed apps may want
> to be compatible with both as well for portability.  However, perhaps
> there are (dis)advantages to using new functionality and I wondered if
> folks would share their experiences...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting a list of available models

2007-12-07 Thread AD7six



On Dec 7, 6:39 am, 7elephants <[EMAIL PROTECTED]> wrote:
> Does anybody know if there is a already available method for getting
> the list of available models within a component and/or controller?
>
> Thank you in advance.

Check the api, depends on your version of cake

$models = loadModels();
$models = Configure::listObjects('Model');

hth,

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Anyone up for a 1.2 query construction challenge?

2007-12-07 Thread AD7six



On Dec 7, 2:53 am, kiger <[EMAIL PROTECTED]> wrote:
> EDIT: I figured out a better way to describe step 3c)...
>
> For each 'Place.name' I count up the number of people having a
> 'Hobby.name' matching the selected keywords. I display this total in
> parenthesis after the name of the place (e.g., Winter Ice Rink (2))

I drifted off, as I'm sure many will after reading "so here is what I
got" and not seeing anything clear. What sql do you want to achive?

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Flash message not displaying across controllers

2007-12-07 Thread AD7six



On Dec 7, 2:46 am, skoggins <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a Flash message that doesn't seem to be displaying across
> controllers.  It is called in the beforeFilter of my accounts
> controller:
>
> function __validateLoginStatus()
> {
> //no exceptions for this controller
> if($this->Session->check('CurrentUser') == false)
> {
> $this->redirect('users/index');
> $this->Session->setFlash('The URL you\'ve 
> followed requires you
> login.');
> }
>
> }
>
> The same function is in my Users controller (maybe there is a better
> way?) and when attempting to go to a protected page in the Users
> controller the Flash message displays but not when attempting to go to
> a protected page in the Accounts controller.  Any ideas?

Why is your setFlash statement after the redirect?

Hint: If your setFlash statement is executed (which it will be) what
else is going to be executed after you send the user somewhere else?

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---