Re: table relations

2006-09-25 Thread nate

> Can you expand on why CakePHP will never support composite primary keys?

Because singular primary keys are simple, and composite keys introduce
needless complexity into the data model.  Anyone who thinks
auto-incrementing primary keys are a bad idea is welcome to examine the
US Social Security program, which utilizes quite possibly the
best-known auto-incrementing primary key system in history, and
pre-dates relational model theory by over thirty years.


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



over write default autocomplete function

2006-09-25 Thread bingo

Hi,

I want to show full name (First_name Last_name) in the autocomplete
div. The first name and last name are stored in two different fields of
a table. I am trying to figure out how to over write default
autocomplete function, and, thereby able to join the two fields before
displaying it to the user. Also, please let me know where the function
should go i.e model or controller.

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



Re: the same to me

2006-09-25 Thread John Zimmerman
On 9/25/06, winson <[EMAIL PROTECTED]> wrote:
i have the same trouble,can anyone help meYou might try jumping on IRC if you need help right away.http://irc.cakephp.org/

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


Re: some troubles in wiki`s tutorials:beginners_only--step_8--"some security using othauth"

2006-09-25 Thread John Zimmerman
On 9/25/06, winson <[EMAIL PROTECTED]> wrote:
hello everyone. i have some troubles in wiki`stutorials:beginners_only--step_8--"some security using othauth". ifollow the tutorials and othauth`s readme,but it do not work. Maybe mymother tongue is not english so that i have miss some important details
from the english`s tutorials. so ,can anyone sent your complete codesto me which using othauth? i think it is useful for me to know what mymissing. Thanks a lot.Everyone will use the authentication system a little differently.  The examples snippets for othAuth should give a pretty good start on implementing it in your application.
The easiest way to figure out what is going wrong would probably be to paste your code here...http://cakephp.org/pastes/addThen post back with a link.
Also describe the specific things that are not working.

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


the same to me

2006-09-25 Thread winson

i have the same trouble,can anyone help 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
-~--~~~~--~~--~--~---



some troubles in wiki`s tutorials:beginners_only--step_8--"some security using othauth"

2006-09-25 Thread winson

hello everyone. i have some troubles in wiki`s
tutorials:beginners_only--step_8--"some security using othauth". i
follow the tutorials and othauth`s readme,but it do not work. Maybe my
mother tongue is not english so that i have miss some important details
from the english`s tutorials. so ,can anyone sent your complete codes
to me which using othauth? i think it is useful for me to know what my
missing. Thanks a lot.


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



Re: Admin, could you please add a subject prefix for this group?

2006-09-25 Thread John Zimmerman
On 9/25/06, Kjell Bublitz <[EMAIL PROTECTED]> wrote:
HeyaI just enabled the "mail on new message" for this group. The subjects not always tell if it's about cake, so i feel a little spammed. Could you please add something like  [cake-php] to all subjects ie. group-prefix? I never owned a group on google but i know that it is possible. All my other groups have it on too. Makes following threads alot more comfortable. 
I would prefer that the subject line stay clean as it is right now.  Extra information in the subject is distracting.If you are using gmail you can use the filter/label/archive system to keep the messages out of your inbox and just click on the label.  If you are using some other email client (
i.e. Thunderbird) you can setup filters for this group to filter the messages out of the inbox and into a separate folder.

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


Re: HasMany and recursive FindAll

2006-09-25 Thread Marcus Derencius

Hi,

Try querying this way:
---
$results = $this->Company->Sector->findAll("Sector.sector_name =
'Biomass'",
null, 'order by Company.company_name', null, null, 1);
---

I hope it helps,

Marcus Derencius
http://www.taoweb.com.br


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



dump.thtml

2006-09-25 Thread johnpfisk

I want to override dump.thtml, so I copied the original from
cake/libs/view/templates/elements
to
app/views/elements
but it doesn't seem to pick my copy up.

Is this the right thing to do, or am I way off line?


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



Re: HasMany and recursive FindAll

2006-09-25 Thread Marcus Derencius

Hi,

Try querying this way:
---
$results = $this->Company->Sector->findAll("Sector.sector_name =
'Biomass'",
null, 'order by Company.company_name', null, null, 1);
---

I hope it helps,

Marcus Derencius
http://www.taoweb.com.br


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



Re: HasMany and recursive FindAll

2006-09-25 Thread Marcus Derencius

Hi,

Try querying this way:
---
$results = $this->Company->Sector->findAll("Sector.sector_name =
'Biomass'",
null, 'order by Company.company_name', null, null, 1);
---

I hope it helps,

Marcus Derencius
http://www.taoweb.com.br


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



Re: HasMany and recursive FindAll

2006-09-25 Thread Marcus Derencius

Hi,

Try querying this way:
---
$results = $this->Company->Sector->findAll("Sector.sector_name =
'Biomass'",
null, 'order by Company.company_name', null, null, 1);
---

I hope it helps,

Marcus Derencius
http://www.taoweb.com.br


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



Re: table relations

2006-09-25 Thread Kjell Bublitz
Humm.. well.. i can set INDEX to any column (which speeds that one up).I think a autoincrement unique id is just slowing things down here.We always query multiple rows based on duplicate entries.In other words: We dont ask for "id" 1 to 20 in the joinTable, we ask for "post_id" number 5 (which may have many unique "comment_id".)
In a HABTM within the post-model i would put INDEX on post_id. On the other end (comments) it is a belongsTo-situation anyways.What you think?2006/9/25, nate <
[EMAIL PROTECTED]>:It's always best to have.  It makes for faster indexing, and CakePHP
does not currently, nor will it ever, support composite primary keys.

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


Re: Admin, could you please add a subject prefix for this group?

2006-09-25 Thread Mikee Freedom

hey dood,

a quick fix in the mean time, i set up a filter to apply a label to
all emails that are sent to [EMAIL PROTECTED] pretty much
replicating the functionality you just mentioned with whatever label i
wanted.

just a thought.

cheers,
freedom

On 26/09/06, Kjell Bublitz <[EMAIL PROTECTED]> wrote:
> Heya
>
> I just enabled the "mail on new message" for this group. The subjects not
> always tell if it's about cake, so i feel a little spammed. Could you please
> add something like  [cake-php] to all subjects ie. group-prefix? I never
> owned a group on google but i know that it is possible. All my other groups
> have it on too. Makes following threads alot more comfortable.
>
> Thank you for your time.
>
>
>
>
>
>
>  >
>

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



Admin, could you please add a subject prefix for this group?

2006-09-25 Thread Kjell Bublitz
HeyaI just enabled the "mail on new message" for this group. The subjects not always tell if it's about cake, so i feel a little spammed. Could you please add something like  [cake-php] to all subjects ie. group-prefix? I never owned a group on google but i know that it is possible. All my other groups have it on too. Makes following threads alot more comfortable. 
Thank you for your time.

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


i cannot use callback functions in a controller

2006-09-25 Thread codecowboy

Hi,

I am trying to use Pear::Structures_Datagrid and one of its functions
makes use of a callback function:

class blah extends AppController
{
.
.
.

   function doBlah()
   {

$datagrid->addColumn(new Structures_DataGrid_Column('Job Type', null,
null, array('width' => '20%'), null, 'getJobType'));
   }
.
.
.

//---CALLBACK function---

function getJobType($params)
{

extract($params);
$strType = $record['type'];
$strNumericTypeToString = 0;
switch($strType)
{
case 0://regular job
{
$strNumericTypeToString = 'full-time';
}
break;
case 1://internship
{
$strNumericTypeToString = 'internship';
}
break;
case 2://regular job
{
$strNumericTypeToString = 'co-op';
}
break;
}//end switch($strType)


//return $strNumericTypeToString;
return 'two';
}
}


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



Why do plugins use separate sessions?

2006-09-25 Thread [EMAIL PROTECTED]

I have an authentication/authorization plugin that stores a user's id
in the session when they login.  So my plugin's UsersController does
this in its login action:

$this->Session->write('User.id', $user['User']['id']);

In my main app I'd like to access this stored id.  However in any of my
main app's controllers, $this->Session->read('User.id'); returns null.
Only in my plugin's controllers does $this->Session->read('User.id');
return the logged in user's id.

Does anyone know a) why plugins seem to use separate sessions, and b)
how I can access the plugin's session from my main app controllers?


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



Re: Use a plugin's model in main app

2006-09-25 Thread [EMAIL PROTECTED]

I essentially solved this by doing the following:

if (!class_exists('PizzaOrder'))
{
loadPluginModels('pizza');
}

$p = new PizzaOrder();


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



Re: HasMany and recursive FindAll

2006-09-25 Thread Mikee Freedom

sorry, a good tute on bindModel

http://cakebaker.42dh.com/2006/02/22/new-feature-bindmodelunbindmodel/

On 26/09/06, Mikee Freedom <[EMAIL PROTECTED]> wrote:
> I ran across this problem a while ago.
>
> Pretty much you have the following options:
>
> 1. set up your association with the condition
>
> i.e. in your Company hasMany association set the condition
> "Sector.sector_name = 'Biomass'"
>
> 2. bind your models at any point with this condition
>
> at any point in your controller where you only want the companies that
> include the biomass sector use the bindModel method with the condition
> "Sector.sector_name = 'Biomass'"
>
> 3. write your own query
>
> not the best way to do things but sometimes the only way.
>
> --
>
> I would recommend 2. as I'm assuming you don't always want that
> condition to exist but occasionally may need it. you can call the
> bindModel at any point and overwrite all of the parameters set in your
> initial association e.g. conditions.
>
> cheers,
> freedom
>
> On 26/09/06, StinkyTofu <[EMAIL PROTECTED]> wrote:
> >
> > I am having trouble searching a joined table with the FindAll function.
> >
> > I have the following models:
> >
> > Company -> hasMany -> Sector
> > Sector -> belongsTo -> Company
> >
> > The Sector table contains a field called sector_name.  What I am trying
> > to do is search the database and find all companies that contain a
> > sector with the name Biomass'.
> >
> > I have the following code that performs the search:
> >
> > $results = $this->Company->findAll("Sector.sector_name = 'Biomass'",
> > null, 'order by company_name', null, null, 1);
> >
> > However, running this code results in the following SQL:
> >
> > SELECT `Company`.`id`, `Company`.`name` FROM `companies` AS `Company`
> > LEFT JOIN `financials` AS `Financial` ON `Financial`.`company_id` =
> > `Company`.`id` WHERE `Sector`.`sector_name` = 'Biomass' ORDER BY
> > `company_name` ASC;
> >
> > This SQL returns the error:
> >
> > Unknown table 'Sector' in where clause
> >
> > Anyone know what I may be doing wrong?  Am I even taking the right
> > approach here?  Or should I use a custom query for something like this?
> >
> > Appreciate if someone can point me in the right direction.
> >
> > Thanks.
> >
> > Oh, and here is the Model code:
> >
> > class Company extends AppModel
> > {
> >   var $name = 'Company';
> >   var $recursive = 2;
> >
> >   var $uses = array('Util');
> >
> >   var $hasOne = array ('Financial' =>
> > array('className' => 'Financial',
> > 'conditions' => '',
> > 'order' => '',
> > 'dependent' => true,
> > 'foreignKey' => 'company_id'));
> >
> > var $hasMany = array ('Sector' =>
> > array('className' => 'Sector',
> > 'conditions' => '',
> > 'order' => '',
> > 'dependent' => true,
> > 'exclusive' => true,
> > 'finderSql' => '',
> > 'foreignKey' => 'company_id'));
> >
> > }
> >
> >
> > class Sector extends AppModel
> > {
> >   var $name = 'Sector';
> >
> > //var $useTable = false; //Removes DB table link from this object, 
> > so
> > you can now override the findAll methods
> >
> > var $belongsTo = array('Company' =>
> > array('className' => 'Company',
> > 'conditions' => '',
> > 'order'=> '',
> > 'dependent'   => true,
> > 'foreignKey' => 'company_id'));
> >
> > var $validate = array(
> > 'title'  => VALID_NOT_EMPTY,
> > 'body'   => VALID_NOT_EMPTY
> >   );
> >
> > }
> >
> >
> > > >
> >
>

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



Re: HasMany and recursive FindAll

2006-09-25 Thread Mikee Freedom

I ran across this problem a while ago.

Pretty much you have the following options:

1. set up your association with the condition

i.e. in your Company hasMany association set the condition
"Sector.sector_name = 'Biomass'"

2. bind your models at any point with this condition

at any point in your controller where you only want the companies that
include the biomass sector use the bindModel method with the condition
"Sector.sector_name = 'Biomass'"

3. write your own query

not the best way to do things but sometimes the only way.

--

I would recommend 2. as I'm assuming you don't always want that
condition to exist but occasionally may need it. you can call the
bindModel at any point and overwrite all of the parameters set in your
initial association e.g. conditions.

cheers,
freedom

On 26/09/06, StinkyTofu <[EMAIL PROTECTED]> wrote:
>
> I am having trouble searching a joined table with the FindAll function.
>
> I have the following models:
>
> Company -> hasMany -> Sector
> Sector -> belongsTo -> Company
>
> The Sector table contains a field called sector_name.  What I am trying
> to do is search the database and find all companies that contain a
> sector with the name Biomass'.
>
> I have the following code that performs the search:
>
> $results = $this->Company->findAll("Sector.sector_name = 'Biomass'",
> null, 'order by company_name', null, null, 1);
>
> However, running this code results in the following SQL:
>
> SELECT `Company`.`id`, `Company`.`name` FROM `companies` AS `Company`
> LEFT JOIN `financials` AS `Financial` ON `Financial`.`company_id` =
> `Company`.`id` WHERE `Sector`.`sector_name` = 'Biomass' ORDER BY
> `company_name` ASC;
>
> This SQL returns the error:
>
> Unknown table 'Sector' in where clause
>
> Anyone know what I may be doing wrong?  Am I even taking the right
> approach here?  Or should I use a custom query for something like this?
>
> Appreciate if someone can point me in the right direction.
>
> Thanks.
>
> Oh, and here is the Model code:
>
> class Company extends AppModel
> {
>   var $name = 'Company';
>   var $recursive = 2;
>
>   var $uses = array('Util');
>
>   var $hasOne = array ('Financial' =>
> array('className' => 'Financial',
> 'conditions' => '',
> 'order' => '',
> 'dependent' => true,
> 'foreignKey' => 'company_id'));
>
> var $hasMany = array ('Sector' =>
> array('className' => 'Sector',
> 'conditions' => '',
> 'order' => '',
> 'dependent' => true,
> 'exclusive' => true,
> 'finderSql' => '',
> 'foreignKey' => 'company_id'));
>
> }
>
>
> class Sector extends AppModel
> {
>   var $name = 'Sector';
>
> //var $useTable = false; //Removes DB table link from this object, so
> you can now override the findAll methods
>
> var $belongsTo = array('Company' =>
> array('className' => 'Company',
> 'conditions' => '',
> 'order'=> '',
> 'dependent'   => true,
> 'foreignKey' => 'company_id'));
>
> var $validate = array(
> 'title'  => VALID_NOT_EMPTY,
> 'body'   => VALID_NOT_EMPTY
>   );
>
> }
>
>
> >
>

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



Re: Bake Error

2006-09-25 Thread Syl

Figured it out.  I should've added the app_dir on the end of my command
line, which in this case was just app.  So the commands would look like
:

php bake.php -app app

Syl


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



Re: updating to various tables

2006-09-25 Thread Mikee Freedom

hey Michael,

to use data from multiple tables your controller has to have access to
each of these models either via the assocations that exist between
models or your uses var in your controller.

e.g. Images and Albums

In my Image Model I have a belongsTo association telling cake that
each of my Images can belong to only one Album.

In my Album Model I have a hasMany association telling cake that each
of my Albums can have many Images.

Now, via my Images controller I can access my Image model using:

$this->Image;

Which allows me to use all of the methods associated with that model,
specifically in this instance save();

$this->Image->save($this->data);

As long as there is an element in my data array with the key Image
then whatever attributes are held within that subsequent array will be
saved to my Image table.

i.e. $this->data should look like:

array (

'Image' => array (

'id' => 1,
'description' => 'My image',
'location' => 'image.jpg'

)

)

All you need to worry about is making sure you're data array is in
this format and Cake will save correctly. You can do this via the view
by using the Cake input field naming conventions (data[Image][id])
which is done for you if you use the HTML helper or the Form helper.
Or, you can do this at the controller level by processing your data in
whatever fashion you like, as long as the end result (before saving)
looks like the above.

Now, I went on a bit there but, to grab data from different tables all
you need to do is use the same methods you would use for your Image
Model with your Album model. You can access your album in your
ImagesController via:

$this->Image->Album->find($conditions,$etc);

Because the association exists you always have access to the
associated models. Therefore, similarly you could do t this from your
AlbumsController:

$this->Album->Image->find($etc);

If you haven't set up your associations, or choose not to for various
reasons you can always use the $uses var within any controller to gain
access to various Models.

In your controller definition:

var $uses = array (
'Image',
'Album'
);

Then you will always be able to do things like (from your controller):

$this->Album->findAll();
$this->Album->save();
$this->Image->find($conditions);
$this->Image->save($this->data);

In that last example, as I mentioned above, as long as your data array
of your controller is in the right format Cake will save your data.
You could call save via both your Image and your Album within the one
controller on the following array:

array (

'Image' => array (

'id' => 1,
'description' => 'My image',
'location' => 'image.jpg',
'album_id' => 3

),

'Album' => array (

'id' => 10,
'description' => 'My album',

)

)

All you need to do is make sure your Array is in this format.

If you need more help have a good look at the manual and try some of
the tutorials. It truly is the only way to master Cake. I love this
framework, and it is well worth it to spend the time getting to the
know the finer points.

Another good starting point is the '21 things I learnt about Cake' blog.

http://www.avatarfinancial.com/pages/cake/

Hope this helped.

Cheers,
freedom

On 25/09/06, michael234 <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I'm having a bit of trouble working out how to bring in and update data
> from different table. Basically I'm trying to do two things: populate a
> field with the id from one table and then insert it into another table
> and bring in data from two tables, edit it and then save it back to the
> respective tables. Basically the same problem.
>
> Not sure what I should be putting in the controllers, your expertise
> would be much appreciated.
>
> Thanks, Michael.
>
>
> >
>

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



Re: Compound Keys in CakePHP

2006-09-25 Thread John Zimmerman
On 9/25/06, johnvv <[EMAIL PROTECTED]> wrote:
I'm just getting started with CakePHP and would like to know if it canhandle compound keys in a database.For example, if you were to add tags to a blog, the schema wouldroughly betable: article(article_id, article_text, PRIMARY_KEY(article_id));
table: tag (tag_id, tag_word, PRIMARY_KEY(tag_id));Now if you want to associate tags with an article, there would beanother table:article_tag(article_id, tag_id, PRIMARY_KEY(article_id, tag_id));
You can do this with a join table and a "hasAndBelongsToMany" relationship in your models.See the model chapter, section 4 for some details and code examples for setting this up.
http://manual.cakephp.org/chapter/modelsIt is one of the more difficult relationships to get working smoothly so once you try to implement it in you app post back with any problems and someone can help you out with the specifics.


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


Compound Keys in CakePHP

2006-09-25 Thread johnvv

I'm just getting started with CakePHP and would like to know if it can
handle compound keys in a database.
For example, if you were to add tags to a blog, the schema would
roughly be
table: article(article_id, article_text, PRIMARY_KEY(article_id));
table: tag (tag_id, tag_word, PRIMARY_KEY(tag_id));

Now if you want to associate tags with an article, there would be
another table:
article_tag(article_id, tag_id, PRIMARY_KEY(article_id, tag_id));

This seems like valid database design to me (feel free to argue or
present an alternative).  Since I haven't worked with CakePHP yet, I'll
ask: "Would CakePHP be able to work with this type of schema?"
And is it pretty straight forward?
- John


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



Where should I put this?

2006-09-25 Thread hydra12

I'm creating an app for work (a public school district), and I want to
authenticate users against our existing Active Directory so the users
don't have to learn a new username/password.  I also want to be able to
use this code in other apps.  I'm planning to use adLDAP to talk to
Active Directory.

Since I want to reuse this code for other apps, what is the best
approach?  Should I make it a plugin?  Should I build a model, view,
and controller, and just copy it into each new project?  Should I use
adLDAP as a vendor,  or should I try to rewrite it as a component?  Is
42 really the answer to everything, and if so, how does that help me
with user authentication?  (Sorry, too little sleep makes me goofy . .
.)

Thanks in advance for any advice.
hydra12


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



Re: What Editor Do You Use

2006-09-25 Thread HalfBaked

I am moving away from Vi / ViM in favor of gPHPEdit for Cake
programming.
http://www.gphpedit.org/

I also use UltraEdit-32 in Windows and Wine, but this is commercial
software.  Well worth the cost IMO.
http://www.ultraedit.com/

I am afraid that none of these meet your Cross Platform / freeware
criteria though.


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



Where should I put this?

2006-09-25 Thread hydra12

I'm working on a project at work (for a public school district) that
runs on a Windows 2003 network.  I want to create an authentication
system that will integrate with our current Active Directory setup, so
our users don't need another username/password.  I'll probably use
adLDAP, since I'm already familiar with it.  My problem is this - I'll
be making other apps for the district in the future, and I want to
reuse my auth code.  Should I set this up as a plugin?  Should I just
make a controller/model/view for it, and copy it into each new
application?

Any advice would be greatly appreciated.

Thanks in advance!

hydra12


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



Re: What Editor Do You Use

2006-09-25 Thread Brian French

RadRails http://www.radrails.org/  would be nice if it could be 
retrofitted to work with cake seing as how cake is (basically) a rewrite 
of ROR.

BlenderStyle wrote:
> I'm curious to know what text editor everyone's using. I'm all about
> free stuff, so I've been using PSPad. It's pretty good, I guess, but
> I'm looking for something that's available on all Windows and Linux. I
> used EditPad for awhile, but it's not free. Any suggestions? My main
> requirements are tabs, syntax highlighting, and auto-indent.
>
>
> >
>
>   

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



Re: Am I right about models?

2006-09-25 Thread nate

Generally, the division of labor of "business rules" is between the
model and the controller, and there is often some overlap in terms of
the responsibilities of each.  Validation is a good example: it usually
makes sense to do validation in the model, but sometimes you need
external information, i.e. session data, in order to do the validation.
 In this case it would be the responsiblity of the controller.

The rule of thumb is to do what makes sense.  If there is a piece of
logic which makes sense being completely contained within the model,
then it should be.  However, don't try to give the model more data than
it needs.  By default, a model is constrained to accessing it's own
data, and the data of it's related models.  If it requires anything
outside of that, the logic should go in the controller.


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



Re: Stats

2006-09-25 Thread Brian French

Another 'Up to the minute' one is visistat.com but they cost something 
like 100 a year or so. We use them at our job. They are pretty nice and 
have alot of info.

[EMAIL PROTECTED] wrote:
> I LOVE my Google Analytics account.  It is wonderful for me.
>
> But, I just came across this for up to the minute statistics like you
> are wanting.
>
> http://www.curve2.com/trackpro.php
>
>
> >
>
>   

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



Re: What Editor Do You Use

2006-09-25 Thread Matt Adams

clemos wrote:

> about emacs, I've been hearing of its power, and trying it sometimes
> for years now, but without much success. Then I took a month to really
> learn the way it works and the shortcuts and all. Finally, I found
> that the multiple modes (PHP/HTML/JS ...) was weird and that emacs
> wasn't really worth the time investment, at least when it comes to web
> programming...

I pretty much agree with you, clemos.

If you're only interested in web programming Emacs may not be exactly 
what you're looking for.  It really is *extremely* powerful but it 
requires a lifelong commitment to master it.  Mastering it involves 
learning Lisp and learning Lisp will be a profound experience that will 
(hopefully) make you a better engineer for the rest of your life or at 
least change the way you look at programming and language use.

Seriously, though, there is no comparison.  Emacs is about working most 
efficiently and as you see fit.

vi is fine for quick edits or when Emacs isn't available.  There is 
something to admire in vi's simple and elegant editor commands.

Eclipse it's a bloated hog of an application suite that took some good 
ideas from Emacs and then promptly broke them (with a few exceptions). 
The standard Eclipse install on one of my laptops runs about 160MB and 
takes about four times as long as Emacs to start and a whole lot more 
memory to run.  There's really no way you can run it over a slow 
terminal link, either.

But I'm an Emacs nut and you probably shouldn't be listening to me :-)
Emacs probably isn't worth your time if you're looking for a point & 
click, dialog and menu-driven experience.

Please note that I don't intend to slam people who don't use Emacs or 
anything like that.  To each his own.


Cheers,

Matt

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



Re: afterSave() generate email

2006-09-25 Thread Brian French

Maybe i'm wrong, but wouldn't you want the emailing of a user in the 
controller instead of the Model?

data)){
if ($this->Bookmark->save($this->data['Bookmarks']))
{
$this->_sendEmail($address,'Bookmark Saved','Bookmark 
saved to database');
}
}
}
/* maybe this function belongs in the AppController? */
function _sendEmail($email='',$subject='',$msg='')
{
mail($email,$subject,$msg);
return true;
}
}
?>

nate wrote:
> All the data is available inside the model as an array, and can be
> referenced as $this->data.
>
>
> >
>
>   

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



Re: Conventions on many-to-many recursive table?

2006-09-25 Thread Brian French

I did something similar to this. Check out the hasAndBelongsToMany

Sonic Baker wrote:
> You can call your table and foreign keys anything you want as long as 
> you define them in the association arrays. Maybe you already know this 
> though.
>
> Cheers,
>
> Sonic
>
> >

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



Re: Am I right about models?

2006-09-25 Thread Sonic Baker
H.

I do all my data handling in the Model and only use the Controllers to
set view variables or call other actions based on the data returned
from the Model. I used to return the raw data and change it in the
controller. Recently I've switched to this new (and what I thought was
the preferred) way of doing all data handling in the model (including
formatting the data e.g. the correct number format). I've found this to
be a much more elegant way of doing things.
I'm open to suggestion though.

Cheers,

Psychie

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


Re: What Editor Do You Use

2006-09-25 Thread Sonic Baker
For Something lightweight, I use EditPlus2 on windows and Kate on Linux. They're both pretty much identical.

Sonic

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


Re: table relations

2006-09-25 Thread Matt Adams

nate wrote:

> It's always best to have.  It makes for faster indexing, and CakePHP
> does not currently, nor will it ever, support composite primary keys.

Can you expand on why CakePHP will never support composite primary keys?

I'm sure this has been answered before and if it has please feel free to 
point me in the right direction.


Thanks,

Matt

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



Re: Conventions on many-to-many recursive table?

2006-09-25 Thread Sonic Baker
You can call your table and foreign keys anything you want as long as
you define them in the association arrays. Maybe you already know this
though.

Cheers,

Sonic

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


Re: table relations

2006-09-25 Thread nate

It's always best to have.  It makes for faster indexing, and CakePHP
does not currently, nor will it ever, support composite primary keys.


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



Re: New database field

2006-09-25 Thread AD7six

Hi Luis,

Sound like you don´t have write access to your tmp folder.

If you delete the contents of your /app/tmp/cache/models folders (and
make it 777 or otherwise ensure that it is writable along with
everything else under tmp) does that take care of your new field?

HTH, Regards,

AD7six


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



Re: New database field

2006-09-25 Thread luis

The problem must be my bad english, sorry. Let me explain. I add a new
field to an existing table with phpMyAdmin. I want to record also de
user that make a comment, for example. So I added the field 'user_id'
to 'comments' table.

Luis


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



HasMany and recursive FindAll

2006-09-25 Thread StinkyTofu

I am having trouble searching a joined table with the FindAll function.

I have the following models:

Company -> hasMany -> Sector
Sector -> belongsTo -> Company

The Sector table contains a field called sector_name.  What I am trying
to do is search the database and find all companies that contain a
sector with the name Biomass'.

I have the following code that performs the search:

$results = $this->Company->findAll("Sector.sector_name = 'Biomass'",
null, 'order by company_name', null, null, 1);

However, running this code results in the following SQL:

SELECT `Company`.`id`, `Company`.`name` FROM `companies` AS `Company`
LEFT JOIN `financials` AS `Financial` ON `Financial`.`company_id` =
`Company`.`id` WHERE `Sector`.`sector_name` = 'Biomass' ORDER BY
`company_name` ASC;

This SQL returns the error:

Unknown table 'Sector' in where clause

Anyone know what I may be doing wrong?  Am I even taking the right
approach here?  Or should I use a custom query for something like this?

Appreciate if someone can point me in the right direction.

Thanks.

Oh, and here is the Model code:

class Company extends AppModel
{
  var $name = 'Company';
  var $recursive = 2;

  var $uses = array('Util');

  var $hasOne = array ('Financial' =>
array('className' => 'Financial',
'conditions' => '',
'order' => '',
'dependent' => true,
'foreignKey' => 'company_id'));

var $hasMany = array ('Sector' =>
array('className' => 'Sector',
'conditions' => '',
'order' => '',
'dependent' => true,
'exclusive' => true,
'finderSql' => '',
'foreignKey' => 'company_id'));

}


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

//var $useTable = false; //Removes DB table link from this object, so
you can now override the findAll methods

var $belongsTo = array('Company' =>
array('className' => 'Company',
'conditions' => '',
'order'=> '',
'dependent'   => true,
'foreignKey' => 'company_id'));

var $validate = array(
'title'  => VALID_NOT_EMPTY,
'body'   => VALID_NOT_EMPTY
  );

}


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



Re: New database field

2006-09-25 Thread Chris Hartjes

On 9/25/06, luis <[EMAIL PROTECTED]> wrote:
>
> Hi Chris,
> Thanks for replying. This is what I have:
> - CakePhp version: 1.1.7 and debug mode set up to 3 ;)
> I can see is the sql string that cake build, but I don't know where it
> looks to built it. Cake creates a sql query with de fields of my table
> *before* I add a new one.
>

Okay, I'm a little confused here.  How are you adding a new field to
the table?  Cake won't automatically add a field to a table, it has to
actually exist in the table itself.

-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: New database field

2006-09-25 Thread luis

Hi Chris,
Thanks for replying. This is what I have:
- CakePhp version: 1.1.7 and debug mode set up to 3 ;)
I can see is the sql string that cake build, but I don't know where it
looks to built it. Cake creates a sql query with de fields of my table
*before* I add a new one.

Any idea?

Luis


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



Re: New database field

2006-09-25 Thread luis

Hi Chris,
Thanks for replying. This is what I have:
- CakePhp version: 1.1.7 and debug mode set up to 3 ;)
I can see is the sql string that cake build, but I don't know where it
looks to built it. Cake creates a sql query with de fields of my table
*before* I add a new one.

Any idea?

Luis


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



Re: New database field

2006-09-25 Thread luis

Hi Chris,
Thanks for replying. This is what I have:
- CakePhp version: 1.1.7 and debug mode set up to 3 ;)
I can see is the sql string that cake build, but I don't know where it
looks to built it. Cake creates a sql query with de fields of my table
*before* I add a new one.

Any idea?

Luis


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



Re: Am I right about models?

2006-09-25 Thread Chris Hartjes

On 9/25/06, temm <[EMAIL PROTECTED]> wrote:
>
> I do all job in controllers and use models only for something like this
>  class Book extends AppModel
> {
>  var $name = 'Book';
> }
> ?>
> As far as I know model should contain main logic but what does it mean
> in practice?

Hey temm,

Under the MVC model that most people associate with web frameworks
like Cake, all your logic *should* be in the controller and all the
model is doing is providing you with data to manipulate and provide to
your views.  I always try to have my models provide me with the raw
data so I can keep all my logic that alters the data in one place.

When you create an object that extends Model, there is lots of
"business logic" going on in the background to produce the results
sets you get back.  There's no reason why you can't create a model
that does some work on the results before it passes it to the
controller making the call on the model.

There's no *right* way to do MVC, just the concept of separating your
business logic from your presentation logic.  Hope that helps.

-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: New database field

2006-09-25 Thread Chris Hartjes

On 9/25/06, luis <[EMAIL PROTECTED]> wrote:
>
> I've created a new field in a table but Cake does not include this
> field in the INSERT querys. It does in View (findAll) but not for the
> Add (save)
> I've added the field in the View form and debuged that the controller
> is recieving it.
> How can I tell Cake that I have a new field in a table? It is supposed
> to recognise it auto doesn't it?
>

Hi Luis.

As far as I can tell you don't have to tell Cake that you've done
*anything* to a table, but I will give you my now-infamous suggestions
on fixing the problem:

1) what version of CakePHP are you using (please don't say "the
latest", version number is much more helpfull)
2) have you turned on debug mode in app/config/core.php
3) have you deleted any files sitting in app/tmp that may be messing things up

The biggest thing is item #2, in that setting debug to 2 will stop the
DB stuff from caching anything and should give you a much clearer
picture.  You should only ever set debug to 0 when you've got your
application in production mode.

Hope that helps.

-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



New database field

2006-09-25 Thread luis

I've created a new field in a table but Cake does not include this
field in the INSERT querys. It does in View (findAll) but not for the
Add (save)
I've added the field in the View form and debuged that the controller
is recieving it.
How can I tell Cake that I have a new field in a table? It is supposed
to recognise it auto doesn't it?

Thanks for reading ;)

Luis!


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



Am I right about models?

2006-09-25 Thread temm

I do all job in controllers and use models only for something like this

As far as I know model should contain main logic but what does it mean
in practice?


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



Re: CakePHP Under IIS 6 ... the best way ?

2006-09-25 Thread Dom

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



Re: CakePHP Under IIS 6 ... the best way ?

2006-09-25 Thread nate

Hmm, then IIS 6 must be setup a little different, because both of those
last ones work fine for me on IIS 5.  I'll see if I can track down a
copy and get it working.  If you get it working first, post back here
and let me know.


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



Re: CakePHP Under IIS 6 ... the best way ?

2006-09-25 Thread Dom

URL/index.php?/controller/method/id
and URL/index.php/controller/method/id 
don't work ...

Regards
Dom.


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



Re: CakePHP Under IIS 6 ... the best way ?

2006-09-25 Thread Dom

URL/index.php?/controller/method/id
and URL/index.php/controller/method/id 
don't work

Regards
Dom.


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



Re: Database connections with custom classes

2006-09-25 Thread nate

Cake won't do anything to queries you run in custom classes.  One thing
to watch out for with MySQL connections, however, is that if you're
connecting to two different databases on the same server, PHP will try
to use the same connection resource for both, which results in one
connection overwriting the other.

To get around this, you must use mysql_connect (rather than _pconnect)
for both connections, and you must add "persistent" => true in your
database config, and pass true to the $new_link parameter of
mysql_connect in your custom class.


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



Use a plugin's model in main app

2006-09-25 Thread [EMAIL PROTECTED]

Is it possible to use a plugin's model in your main app?  For example,
if I'm using the Pizza plugin example from
http://manual.cakephp.org/chapter/plugins, how would I use the
PizzaOrders model in one of my main app controllers?  I've tried both
of the following:

var $uses = array('PizzaOrders');

and

$p = new PizzaOrder();

but neither approach works: my main app doesn't seem to have access to
the plugin's models.  Does anyone know how to do this?

I realize you can call plugin controller actions using
$this->requestAction('/plugin/controller/action') from the main app but
I'd rather have access to the plugin model directly.


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



Re: Bake Error

2006-09-25 Thread Syl

Thanks for all your responses - I was away and just got back.
Here is my command line :

php bake.php -app

I am running it from this directory :

C:\wamp\www\WebWantAds\cake\scripts>

With the following directory for my cake application.

C:\wamp\www\WebWantAds\app

Looking at the bake code, I can tell it is having trouble finding my
database.php file.  It already exists, so it shouldn't be asking me to
create oneright ?

Thanks in advance folks !

Syl


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



Re: CakePHP Under IIS 6 ... the best way ?

2006-09-25 Thread Dom

URL/index.php?url=/controlleur/method/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
-~--~~~~--~~--~--~---



Re: CakePHP Under IIS 6 ... the best way ?

2006-09-25 Thread Dom


and ... What's the url of scaffold without rewrite ?

Regards.
Dom.


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



Re: CakePHP Under IIS 6 ... the best way ?

2006-09-25 Thread Dom

isapi_rewrite unintalled (rewrite applied to all website )

i try without the rewrite ...

What's the url whithout rewrite ?


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



Re: Redirect() vs Render() Question

2006-09-25 Thread [EMAIL PROTECTED]

What you might be looking for is elements.  If you have shared little
chunks of html that get used you can use elements and pass them data.
$this->renderElement('name', array('value' => $value));

As for not stopping controller logic.  Always just get into the habit
of putting return false after it unless you are sure you want
controller logic to continue on.  Or else one time you will find a
problem with your logic only after banging your head for a couple hours.


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



Re: table relations

2006-09-25 Thread Kjell Bublitz
On comment_post, is the primary key "id" really necessary? Doesn't the unique pairing of both values help cake to figure it out ? .. i mean.. its a pairing of two already unique IDs, so why there should be a need for another unique ID in the JoinTable?
2006/9/25, Daniel Schmitz <[EMAIL PROTECTED]>:
great !tanks !On 9/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:>> HABTM must have an intermediate table that contains the lookup ids of
> the relations.>> Post> id>> Comment> id>> comment_post> id> post_id> comment_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  -~--~~~~--~~--~--~---


Re: table relations

2006-09-25 Thread Daniel Schmitz

great !

tanks !


On 9/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> HABTM must have an intermediate table that contains the lookup ids of
> the relations.
>
> Post
> id
>
> Comment
> id
>
> comment_post
> id
> post_id
> comment_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
-~--~~~~--~~--~--~---



updating to various tables

2006-09-25 Thread michael234

Hi,
I'm having a bit of trouble working out how to bring in and update data
from different table. Basically I'm trying to do two things: populate a
field with the id from one table and then insert it into another table
and bring in data from two tables, edit it and then save it back to the
respective tables. Basically the same problem.

Not sure what I should be putting in the controllers, your expertise
would be much appreciated.

Thanks, Michael.


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



Re: What Editor Do You Use

2006-09-25 Thread [EMAIL PROTECTED]

jEdit does all that and more.  You just need to get some plugins for it
to syntax highlighting, XML browser, etc.  I have my jEdit setup with
the structure browser plugin so it shows a list of functions at the
left that I can click on and quickly jump to.

The plugins I have running:
XML
Sidekick
BufferTabs
ErrorList

Then, you just have to setup in the plugin options whatever you want
them to do and your general options.  Anyway I love it in that I have
it installed all over the place.  It is java so I could just put it on
my thumbdrive if I wanted to.  Hypersearch a directory of files for a
function name, BeanShell for advanced scripting (macros), It even has
an FTP plugin that allows it to automatically download a file, you edit
it, and then when you hit save it reuploads it for you.  Pretty nice
feature there.


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



Re: What Editor Do You Use

2006-09-25 Thread [EMAIL PROTECTED]

jEdit does all that and more.  You just need to get some plugins for it
to syntax highlighting, XML browser, etc.  I have my jEdit setup with
the structure browser plugin so it shows a list of functions at the
left that I can click on and quickly jump to.

The plugins I have running:
XML
Sidekick
BufferTabs
ErrorList

Then, you just have to setup in the plugin options whatever you want
them to do and your general options.  Anyway I love it in that I have
it installed all over the place.  It is java so I could just put it on
my thumbdrive if I wanted to.  Hypersearch a directory of files for a
function name, BeanShell for advanced scripting (macros), It even has
an FTP plugin that allows it to automatically download a file, you edit
it, and then when you hit save it reuploads it for you.  Pretty nice
feature there.


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



Re: CakePHP Under IIS 6 ... the best way ?

2006-09-25 Thread Dom

Hi ,

Isapi_rewrite is intalled but i have some problems
URL/controller/ works (URL/controller/ -> index)
but URL/controller/method/ don't work

edit httpd.ini ?

on my server :

[ISAPI_Rewrite]

RewriteRule (.*?\.php)(\?[^/]*)?/([^/]*)/(.*) $1(?2$2&:\?url=/$3/$4)
RewriteRule ^/(.*)/ /index.php?url=/$1 

Regards
Dom.


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



Re: Help getting started: creating related records

2006-09-25 Thread [EMAIL PROTECTED]

Doing all but HABTM with a multiple selectTag you have to manually
manage the foreignKey's.  What this means is you have to set it.
Usually this means that you create one records, get the last inserted
id, and use that as the foreignKey for the related records if you are
saving them all in the same action.

$this->ModelName1->save($this->data);
$related['ModelName2']['foreignKey'] =
$this->ModelName1->getLastInsertID();
$this->ModelName2->create();
$this->ModelName2->save($related);

Of course there is more code in there, more fields, maybe manipulation
of the $this->data array (if it has both model's information in it).
But that is almost always what you have to use if you don't have the
user setting the foreignKey (like picking the category for the new
option).


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



Re: Help getting started: creating related records

2006-09-25 Thread [EMAIL PROTECTED]

Doing all but HABTM with a multiple selectTag you have to manually
manage the foreignKey's.  What this means is you have to set it.
Usually this means that you create one records, get the last inserted
id, and use that as the foreignKey for the related records if you are
saving them all in the same action.

$this->ModelName1->save($this->data);
$related['ModelName2']['foreignKey'] =
$this->ModelName1->getLastInsertID();
$this->ModelName2->create();
$this->ModelName2->save($related);

Of course there is more code in there, more fields, maybe manipulation
of the $this->data array (if it has both model's information in it).
But that is almost always what you have to use if you don't have the
user setting the foreignKey (like picking the category for the new
option).


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



Re: Help getting started: creating related records

2006-09-25 Thread [EMAIL PROTECTED]

Doing all but HABTM with a multiple selectTag you have to manually
manage the foreignKey's.  What this means is you have to set it.
Usually this means that you create one records, get the last inserted
id, and use that as the foreignKey for the related records if you are
saving them all in the same action.

$this->ModelName1->save($this->data);
$related['ModelName2']['foreignKey'] =
$this->ModelName1->getLastInsertID();
$this->ModelName2->create();
$this->ModelName2->save($related);

Of course there is more code in there, more fields, maybe manipulation
of the $this->data array (if it has both model's information in it).
But that is almost always what you have to use if you don't have the
user setting the foreignKey (like picking the category for the new
option).


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



Re: Stats

2006-09-25 Thread djiize

OMG!
I'm sorry for "spamming"...
I got Server Error from Google groups, so I tried to post several time
:(


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



Re: What Editor Do You Use

2006-09-25 Thread clemos

hi

after trying both Eclipse and Emacs, I finally came back using Scite.

I first went to Eclipse for actionscript programming and swf comiling
without macromedia Flash (see http://osflash.org). but I really find
it too big, I don't need so much features, and I still don't
understand anything to the whole...

about emacs, I've been hearing of its power, and trying it sometimes
for years now, but without much success. Then I took a month to really
learn the way it works and the shortcuts and all. Finally, I found
that the multiple modes (PHP/HTML/JS ...) was weird and that emacs
wasn't really worth the time investment, at least when it comes to web
programming...

Scite is rather cool. it's easy to setup highlighting and all, and you
can customize it a lot.

++
clément

On 9/24/06, BlenderStyle <[EMAIL PROTECTED]> wrote:
>
> I'm curious to know what text editor everyone's using. I'm all about
> free stuff, so I've been using PSPad. It's pretty good, I guess, but
> I'm looking for something that's available on all Windows and Linux. I
> used EditPad for awhile, but it's not free. Any suggestions? My main
> requirements are tabs, syntax highlighting, and auto-indent.
>
>
> >
>

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



Re: What Editor Do You Use

2006-09-25 Thread [EMAIL PROTECTED]

I am sorry for repeated messages... but I was getting an error from
google, that message was not posted... so I retried many times ;)


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



config help!

2006-09-25 Thread [EMAIL PROTECTED]

i have read the tutorial here:

http://groups.google.com/group/cake-php/tree/browse_frm/thread/94625f2803546def/31a623769c72ab66?rnum=1&_done=%2Fgroup%2Fcake-php%2Fbrowse_frm%2Fthread%2F94625f2803546def%2F3396b4b08ffb98ee%3F#doc_31a623769c72ab66

and I must say I'm still quite a bit perplexed on how to make it work.

I want to use cakephp alongside other non cakephp apps, so obviously, I
have to put it in a directory structure like this:

/webroot/
  - /cake
  - /phpmyadmin
  - /misc-non-cake-app

but then, I realized I also want to start building my subsequent apps
using cake so the structure will look like this:

/webroot/
  - /cake
- /apps
  - /app1
  - /app2
  - /phpmyadmin
  - /misc-non-cake-app

Yes I have readt hat but I really can't understand it muchI mean I
tried pasting the


DocumentRoot "/path/to/.0.10.0.1076/app3/webroot"
ServerName app3.example.com 


code in my httpd, but it doesnt run. I changed REPLACE_WITH_IP# to
localhost since that's what I am using, and then the documentroot
thing, i just copied the documentroot stated in the documentroot part
of the thing

as for server name i also used app1.example.com


but like i said, apache gets an error every time it starts. can anyone
help me on this one? like explain it in more easier terms? thanks a
lot!

also when using that kind of configuration, what address should i put
in the address bar to work(noob question)?
http://app1.example.com?(just clearing thigns up)


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



Re: Database connections with custom classes

2006-09-25 Thread leea

Well, i somehow managed to fix this problem. But i dont think its the
right way to do it.

I changed all queries in my models to specify their database.

SELECT * FROM MYTABLE;

is now

SELECT * FROM MYDATABASE.MYTABLE;

It seems as this will bypass any prepends cake does to its DB calls.


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