Re: IIS7 + CakePhp

2012-02-18 Thread Christoph Wagner
Still couldn't get it to work, neither with the webconfig stated in
the cookbook nor with the automatic import function of IIS :(

Any help is appreciated :/

On 23 Jan., 16:51, Suelen Goularte Carvalho
 wrote:
> Hello, it's just a web.config, but you will not need to create it. When you
> import the "Import Rules" IIS7 web.config it will create automatically. Add
> me to talk in GTalk;-)
>
> Hugs!
>
> On Mon, Jan 23, 2012 at 12:36 PM, Christoph Wagner <
>
>
>
>
>
>
>
>
>
> chris.wagne...@googlemail.com> wrote:
> > Hi Suelen,
>
> > thanks for the information! Will try it later tonight!
> > One question: do I have to put the webconfig files for the htaccess in
> > root/app and app/webroot also in these folders or
> > do I need to create something like a "super" webconfig, meaning there
> > is only one webconfig in the cake folder?
>
> > On 23 Jan., 01:24, Suelen Goularte Carvalho
> >  wrote:
> > > One more thing, you must import all three. htaccess file that exist. The
> > > root, root/app and root/app/webroot and order them in the web.config file
> > > is important, I do not remember exactly what order, but basically the
> > more
> > > general rule up and down more specific.
>
> > > On Sun, Jan 22, 2012 at 10:19 PM, Suelen Goularte Carvalho <
>
> > > suelengcarva...@gmail.com> wrote:
> > > > I also spent an afternoon trying to make it work ... almost wrote a
> > post
> > > > about it, now I see I should have written.
>
> > > > On Sun, Jan 22, 2012 at 10:16 PM, Suelen Goularte Carvalho <
> > > > suelengcarva...@gmail.com> wrote:
>
> > > >> Try to import the rules, I did that and it worked, it will
> > automatically
> > > >> create the web.config correctly. For this you need to have enabled URL
> > > >> Rewrite on IIS7. The following print attached, perhaps to help you.
>
> > > >> On Sun, Jan 22, 2012 at 8:44 PM, Christoph Wagner <
> > > >> chris.wagne...@googlemail.com> wrote:
>
> > > >>> Hi Jose,
>
> > > >>> yeah I tried that, but it won't work :/
>
> > > >>> the site ishttp://www.brainsnacks.de/
>
> > > >>> Source shows that its not redirecting corretly to the webroot sources
> > > >>> and to the included elements..
>
> > > >>> Anything else to configure maybe?
>
> > > >>> On 22 Jan., 22:40, José Lorenzo  wrote:
> > > >>> > You need this:
>
> >http://book.cakephp.org/2.0/en/installation/advanced-installation.htm.
> > > >>> ..
>
> > > >>> --
> > > >>> Our newest site for the community: CakePHP Video Tutorials
> > > >>>http://tv.cakephp.org
> > > >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > > >>> help others with their CakePHP related questions.
>
> > > >>> To unsubscribe from this group, send email to
> > > >>> cake-php+unsubscr...@googlegroups.com For more options, visit this
> > > >>> group athttp://groups.google.com/group/cake-php
>
> > > >> --
>
> > > >>  Suelen Goularte Carvalho
> > > >>  Twitter: @suelengc
> > > >>  Celular: +55 (0xx11) 9336-7069
> > > >>  Blog:http://blog.suelengc.com.br/
> > > >>  Estou nas redes sociais: Linkedin, Facebook e Twitter.
>
> > > > --
>
> > > >  Suelen Goularte Carvalho
> > > >  Twitter: @suelengc
> > > >  Celular: +55 (0xx11) 9336-7069
> > > >  Blog:http://blog.suelengc.com.br/
> > > >  Estou nas redes sociais: Linkedin, Facebook e Twitter.
>
> > > --
>
> > >  Suelen Goularte Carvalho
> > >  Twitter: @suelengc
> > >  Celular: +55 (0xx11) 9336-7069
> > >  Blog:http://blog.suelengc.com.br/
> > >  Estou nas redes sociais: Linkedin, Facebook e Twitter.
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
>
>  Suelen Goularte Carvalho
>  Twitter: @suelengc
>  Celular: +55 (0xx11) 9336-7069
>  Blog:http://blog.suelengc.com.br/
>  Estou nas redes sociais: Linkedin, Facebook e Twitter.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: IIS7 + CakePhp

2012-01-23 Thread Christoph Wagner
Hi Suelen,

thanks for the information! Will try it later tonight!
One question: do I have to put the webconfig files for the htaccess in
root/app and app/webroot also in these folders or
do I need to create something like a "super" webconfig, meaning there
is only one webconfig in the cake folder?

On 23 Jan., 01:24, Suelen Goularte Carvalho
 wrote:
> One more thing, you must import all three. htaccess file that exist. The
> root, root/app and root/app/webroot and order them in the web.config file
> is important, I do not remember exactly what order, but basically the more
> general rule up and down more specific.
>
> On Sun, Jan 22, 2012 at 10:19 PM, Suelen Goularte Carvalho <
>
>
>
>
>
>
>
>
>
> suelengcarva...@gmail.com> wrote:
> > I also spent an afternoon trying to make it work ... almost wrote a post
> > about it, now I see I should have written.
>
> > On Sun, Jan 22, 2012 at 10:16 PM, Suelen Goularte Carvalho <
> > suelengcarva...@gmail.com> wrote:
>
> >> Try to import the rules, I did that and it worked, it will automatically
> >> create the web.config correctly. For this you need to have enabled URL
> >> Rewrite on IIS7. The following print attached, perhaps to help you.
>
> >> On Sun, Jan 22, 2012 at 8:44 PM, Christoph Wagner <
> >> chris.wagne...@googlemail.com> wrote:
>
> >>> Hi Jose,
>
> >>> yeah I tried that, but it won't work :/
>
> >>> the site ishttp://www.brainsnacks.de/
>
> >>> Source shows that its not redirecting corretly to the webroot sources
> >>> and to the included elements..
>
> >>> Anything else to configure maybe?
>
> >>> On 22 Jan., 22:40, José Lorenzo  wrote:
> >>> > You need this:
>
> >>> >http://book.cakephp.org/2.0/en/installation/advanced-installation.htm.
> >>> ..
>
> >>> --
> >>> Our newest site for the community: CakePHP Video Tutorials
> >>>http://tv.cakephp.org
> >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> >>> help others with their CakePHP related questions.
>
> >>> To unsubscribe from this group, send email to
> >>> cake-php+unsubscr...@googlegroups.com For more options, visit this
> >>> group athttp://groups.google.com/group/cake-php
>
> >> --
>
> >>  Suelen Goularte Carvalho
> >>  Twitter: @suelengc
> >>  Celular: +55 (0xx11) 9336-7069
> >>  Blog:http://blog.suelengc.com.br/
> >>  Estou nas redes sociais: Linkedin, Facebook e Twitter.
>
> > --
>
> >  Suelen Goularte Carvalho
> >  Twitter: @suelengc
> >  Celular: +55 (0xx11) 9336-7069
> >  Blog:http://blog.suelengc.com.br/
> >  Estou nas redes sociais: Linkedin, Facebook e Twitter.
>
> --
>
>  Suelen Goularte Carvalho
>  Twitter: @suelengc
>  Celular: +55 (0xx11) 9336-7069
>  Blog:http://blog.suelengc.com.br/
>  Estou nas redes sociais: Linkedin, Facebook e Twitter.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: IIS7 + CakePhp

2012-01-22 Thread Christoph Wagner
Hi Jose,

yeah I tried that, but it won't work :/

the site is http://www.brainsnacks.de/

Source shows that its not redirecting corretly to the webroot sources
and to the included elements..

Anything else to configure maybe?


On 22 Jan., 22:40, José Lorenzo  wrote:
> You need this:
>
> http://book.cakephp.org/2.0/en/installation/advanced-installation.htm...

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


IIS7 + CakePhp

2012-01-22 Thread Christoph Wagner
hi guys,

got a big problem.. want to deploy my 2.0.4 cake app on an IIS7 server
but it is not working as I thought it would.
Uploaded the application and inserted the web.config with the one from
the 1.3 cake cookbook.
It shows the initial page, but does not show any other pages,
additionally css and js are missing.
Any suggestions? Server side or cake side hints are welcome :(

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: No form data

2010-06-07 Thread Christoph
Thank guys, now it is working!

On 4 Jun., 17:27, calvin  wrote:
> 1. Controllers are plural. So it would be 'checkouts' not 'checkout'.
> 2. Read the Cookbook; you're not using $form->input() correctly.
>
> On Jun 4, 6:47 am, Christoph  wrote:
>
> > hi,
>
> > i have a little bit trouble because i don't get anyformdatain $this->data. 
> > i only get thedatain $this->params['form']. is there a way to
>
> > change that? that myform:
>
> > print $form->create("Checkout", array(     "url" => array("controller" =>
> > "checkout", "action" => "step2"),
> >                                                                             
> >     "type" => "post"));
>
> > print $form->input   ("select", array      (       "options" => 
> > array("Herr" =>
> > "Herr", "Frau" => "Frau"),
> >                                                                             
> >             "label" => "Anrede:",
> >                                                                             
> >             "name" => "anrede",
> >                                                                             
> >             "id" => "anrede"
> >                                                                             
> >     )
> >                                         );
>
> > print $form->input   ("input", array               (       "label" => 
> > "Name:",
> >                                                                             
> >             "name" => "name",
> >                                                                             
> >             "id" => "name"
> >                                                                             
> >     )
> >                                         );
>
> > print $form->input   ("input", array               (       "label" => 
> > "Vorname:",
> >                                                                             
> >             "name" => "vorname",
> >                                                                             
> >             "id" => "vorname"
> >                                                                             
> >     )
> >                                         );
>
> > print $form->input   ("input", array               (       "label" => 
> > "Straße, Nr:",
> >                                                                             
> >             "name" => "strasse",
> >                                                                             
> >             "id" => "strasse"
> >                                                                             
> >     )
> >                                         );
>
> > print $form->input   ("input", array               (       "label" => 
> > "Postleitzahl:",
> >                                                                             
> >             "name" => "plz",
> >                                                                             
> >             "id" => "plz"
> >                                                                             
> >     )
> >                                         );
>
> > print $form->input   ("input", array               (       "label" => 
> > "Email:",
> >                                                                             
> >             "name" => "email",
> >                                                                             
> >             "id" => "email"
> >                                                                             
> >     )
> >                                         );
>
> > print $form->input   ("input", array               (       "label" => 
> > "Telefon:",
> >                                                                             
> >             "name" => "telefon",
> >                                                                             
> >             "id" => "telefon"
> >                                                                             
> >     )
> >                                         );
>
> > print $form->end("buttons/weiter.png");

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


No form data

2010-06-04 Thread Christoph
hi,

i have a little bit trouble because i don't get any form data in $this-
>data. i only get the data in $this->params['form']. is there a way to
change that? that my form:



print $form->create("Checkout", array(  "url" => array("controller" =>
"checkout", "action" => "step2"),

"type" => "post"));

print $form->input  ("select", array(   "options" => 
array("Herr" =>
"Herr", "Frau" => "Frau"),

"label" => "Anrede:",

"name" => "anrede",

"id" => "anrede"

)
);

print $form->input  ("input", array (   "label" => "Name:",

"name" => "name",

"id" => "name"

)
);

print $form->input  ("input", array (   "label" => "Vorname:",

"name" => "vorname",

"id" => "vorname"

)
);

print $form->input  ("input", array (   "label" => 
"Straße, Nr:",

"name" => "strasse",

"id" => "strasse"

)
);

print $form->input  ("input", array (   "label" => 
"Postleitzahl:",

"name" => "plz",

"id" => "plz"

)
);

print $form->input  ("input", array (   "label" => "Email:",

"name" => "email",

"id" => "email"

)
);

print $form->input  ("input", array (   "label" => "Telefon:",

"name" => "telefon",

"id" => "telefon"

)
);

print $form->end("buttons/weiter.png");

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Keine Daten in $this->data

2010-06-04 Thread Christoph
Hallo,

ich habe ein großes Problem mit meinem Formular. Ich bekomme die Daten
des Formulars in $this->params['form'] übergeben und nicht in $this-
>data.

Hier der Code:

print $form->create("Checkout", array(  "url" => array("controller" =>
"checkout", "action" => "step2"),

"type" => "post"));

print $form->input  ("select", array(   "options" => 
array("Herr" =>
"Herr", "Frau" => "Frau"),

"label" => "Anrede:",

"name" => "anrede",

"id" => "anrede"

)
);

print $form->input  ("input", array (   "label" => "Name:",

"name" => "name",

"id" => "name"

)
);

print $form->input  ("input", array (   "label" => "Vorname:",

"name" => "vorname",

"id" => "vorname"

)
);

print $form->input  ("input", array (   "label" => 
"Straße, Nr:",

"name" => "strasse",

"id" => "strasse"

)
);

print $form->input  ("input", array (   "label" => 
"Postleitzahl:",

"name" => "plz",

"id" => "plz"

)
);

print $form->input  ("input", array (   "label" => "Email:",

"name" => "email",

"id" => "email"

)
);

print $form->input  ("input", array (   "label" => "Telefon:",

"name" => "telefon",

"id" => "telefon"

)
);

print $form->end("buttons/weiter.png");

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problem after upgrade

2007-07-17 Thread Christoph

I just upgraded from revision 1.1.11.4064 to 1.1.16.5421.  In
upgrading, I didn't make any changes in my code.  I just replaced my
existing cake framework directory with the code contained in the zip
archive.  For the most part, everything seems to work.  All my pages
work as they did before, all the forms work, etc.  However, I'm now
getting the following error at the top of every page:

Notice: Undefined property: Set::$table in /path/to/cake_framework/
cake/libs/model/model_php5.php on line 449

Notice: Undefined property: Set::$table in /path/to/cake_framework/
cake/libs/model/model_php5.php on line 450

Notice: Undefined property: Set::$table in /path/to/cake_framework/
cake/libs/model/model_php5.php on line 451

Notice: Undefined property: Set::$table in /path/to/cake_framework/
cake/libs/model/model_php5.php on line 499

Notice: Undefined property: Set::$name in /path/to/cake_framework/cake/
libs/model/model_php5.php on line 500

What's going on?  Why is this happening?  I searched in the group but
didn't find anything regarding this error.  What am I missing?

thnx,
Christoph


--~--~-~--~~~---~--~~
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: AJAX & mini dialogs

2007-05-22 Thread Christoph

> More of a javascript issue than a Cake one.  Google is your friend for
> this.  Take a look at 'mousovers javascript'.
> Hope that helps.

Well, yes, the front end is javascript.  But I am wondering if there
is a tutorial on how to set something like this up in a CakePHP
context.  That is, how would you set up the model and the view
(particularly the model) for something like this.

thnx,
Christoph


--~--~-~--~~~---~--~~
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 & mini dialogs

2007-05-18 Thread Christoph

If you've ever been to and used Netflix, you know that the feature
some really cool functionality (at least, IMO).  When you hover your
mouse over a movie title, a little dialog pops up and displays
information about that movie.  And if you add it to your queue,
another dialog pops up and the rest of the page behind it is all
greyed out.

I'm wondering if anyone has functionality similar to this (or knows of
a tutorial I can take a look at) in the context of CakePHP?  How do
you set up the models and views for functionality like this?

thnx,
Christoph


--~--~-~--~~~---~--~~
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: R: Setting up a model

2007-03-29 Thread Christoph

> Your DB scheme confuses me...  Maybe you could just do a manual query
> from your model?  Several times manual queries have been better/more
> efficient to use than attempting to pull it off with cake.

My only problem with that is the pagination component doesn't really
play well with manual queries.  That having been said, I do see a
reply that shows me how it can be done.  I'll have to try that and see
how it works for me.

It just would be nice if you could tell Cake _how_ you wanted to use
the criteria you provide.  Whether as part of one of the JOINS (and
which one) or as part of the WHERE.

thnx,
Christoph


--~--~-~--~~~---~--~~
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: R: Setting up a model

2007-03-28 Thread Christoph

> Hello christoph
> The error you recieve is for typo.
> Use uppercase model name as aliased in the query
> >>>>>>> $criteria = 'Collection.user_id  = \'' .  $uid . '\'';

Thanks for your response.  But typo aside, the query isn't going to
return the result set I'm expecting.  If there are 0 rows for the user
in the collections table, 0 rows from the game_pieces table are going
to be returns.  Or, only those rows from game_pieces that have a
matching game_piece_id in the collections table.  I want all rows from
game_pieces and also the associated data from collections, where
applicable.  Basically, Cake is creating this query (type aside):

SELECT `GamePiece`.`id`, `GamePiece`.`games_set_id`,
`GamePiece`.`piece_name`, `GamePiece`.`piece_type`,
`GamePiece`.`piece_sub_type`, `GamePiece`.`piece_description`,
`GamePiece`.`piece_flavor_text`, `GamePiece`.`piece_artist`,
`GamePiece`.`piece_rarity`, `GamesSet`.`id`, `GamesSet`.`game_id`,
`GamesSet`.`set_id` FROM `game_pieces` AS `GamePiece` LEFT JOIN
`games_sets` AS `GamesSet` ON `GamePiece`.`games_set_id` =
`GamesSet`.`id` WHERE `Collection`.`user_id` = 'joebob' ORDER BY
`GamePiece`.`id` ASC LIMIT 10

When I need it to create this query:

SELECT `GamePiece`.`id`, `GamePiece`.`games_set_id`,
`GamePiece`.`piece_name`, `GamePiece`.`piece_type`,
`GamePiece`.`piece_sub_type`, `GamePiece`.`piece_description`,
`GamePiece`.`piece_flavor_text`, `GamePiece`.`piece_artist`,
`GamePiece`.`piece_rarity`, `GamesSet`.`id`, `GamesSet`.`game_id`,
`GamesSet`.`set_id` FROM `game_pieces` AS `GamePiece`
LEFT JOIN `games_sets` AS `GamesSet` ON `GamePiece`.`games_set_id` =
`GamesSet`.`id`
LEFT JOIN `collections` ON `collections`.`user_id` = 'joebob' AND
`GamePiece`.id = `collections`.game_piece_id
ORDER BY `GamePiece`.`id` ASC LIMIT 10

See the difference?  It's taking the criteria I specify (user_id) and
is using it as part of the WHERE clause when I need it to use it as
part of the LEFT JOIN that is applicable to that particular model.

thnx,
Christoph


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



Setting up a model

2007-03-27 Thread Christoph
;'
),

  'TradeGamePiece' =>
array('className' => 'TradeGamePiece',
'foreignKey' => 'game_piece_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'dependent' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),

'GamePieceAttribute' =>
array('className' => 'GamePieceAttribute',
'foreignKey' => 'game_piece_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'dependent' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)

);

}
?>

 VALID_NOT_EMPTY,
'user_id' => VALID_NOT_EMPTY,
'game_piece_id' => VALID_NUMBER,
'owned' => VALID_NUMBER,
'created' => VALID_NOT_EMPTY,
'modified' => VALID_NOT_EMPTY,
);

//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $belongsTo = array(
'User' =>
array('className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
),

'GamePiece' =>
array('className' => 'GamePiece',
'foreignKey' => 'game_piece_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'dependent' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),

  'GamePiecesView' =>
array('className' => 'GamePiecesView',
'foreignKey' => 'game_piece_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'dependent' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
  );

}
?>

Here is a snippet of the code I'm trying to use:

$criteria = 'collection.user_id  = \'' .  $uid . '\'';

$this->GamePiece->unbindModel( array( 'hasMany' =>
array( 'DeckPart',
 
'TradeGamePiece',
 
'GamePieceAttribute' )));
$this->set('collections', $this->GamePiece->findAll( $criteria,
NULL, $order, $limit, $page ));

and here are the queries that are generated:

SELECT COUNT(*) AS count FROM `game_pieces` AS `GamePiece` LEFT JOIN
`games_sets` AS `GamesSet` ON `GamePiece`.`games_set_id` =
`GamesSet`.`id` WHERE `collection`.`user_id` = 'joebob'
1054: Unknown column 'collection.user_id' in 'where clause' 
1

SELECT `GamePiece`.`id`, `GamePiece`.`games_set_id`,
`GamePiece`.`piece_name`, `GamePiece`.`piece_type`,
`GamePiece`.`piece_sub_type`, `GamePiece`.`piece_description`,
`GamePiece`.`piece_flavor_text`, `GamePiece`.`piece_artist`,
`GamePiece`.`piece_rarity`, `GamesSet`.`id`, `GamesSet`.`game_id`,
`GamesSet`.`set_id` FROM `game_pieces` AS `GamePiece` LEFT JOIN
`games_sets` AS `GamesSet` ON `GamePiece`.`games_set_id` =
`GamesSet`.`id` WHERE `collection`.`user_id` = 'joebob' ORDER BY
`GamePiece`.`id` ASC LIMIT 10
1054: Unknown column 'collection.user_id' in 'where clause' 
1

How can I set the models (or the criteria) up so that it uses the
criteria I define as part of the JOIN ON instead of as part of the
WHERE?

Thank you for your time and assistance.

thnx,
Christoph


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



How do I set up this relationship?

2007-02-09 Thread Christoph

I need to get it so that a table joins on itself but in such a way
that it's not using the PK <=> FK fields for the join.  Here is what
the query would look like if I ran it manually in MySQL:

SELECT
  game_pieces_view.piece_name,
  CrosstradeCollection.user_id,
  CrosstradeCollection.owned,
  CrosstradeCollection.wanted
FROM
  collections CrosstradeCollection
INNER JOIN
  collections collections
  ON
collections.game_piece_id = CrosstradeCollection.game_piece_id
INNER JOIN
  game_pieces_view
  ON
game_pieces_view.id = CrosstradeCollection.game_piece_id
WHERE
  collections.user_id = 'current_user'
AND
  CrosstradeCollection.user_id != 'current_user'

This works fine and returns the rows I expect.  So now on to the
model...

Here is how I have my model set up:

var $belongsTo = array(
  'GamePiecesView' =>
array('className' => 'GamePiecesView',
'foreignKey' => 'game_piece_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'dependent' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),

  'CrosstradeCollection' =>
array('className' => 'Collection',
'foreignKey' => 'game_piece_id',
'conditions' => 'CrosstradeCollection.user_id !=
Collection.user_id',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'dependent' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
  );

I tried to set up 'CrosstradeCollection' under $hasMany but that
didn't seem to work.  Setting it up under $belongsTo makes it a LEFT
JOIN and not an INNER JOIN, which is what I'm trying to get.  In any
case, below is the query that CakePHP generates using the defined
relationship when I use this ->findAll():

$collections = $this->Collection-
>findAll( 'CrosstradeCollection.user_id = \'current_user\' AND
collections.user_id != \'current_user\'', NULL, NULL, 10 );

SELECT `Collection`.`id`, `Collection`.`user_id`,
`Collection`.`game_piece_id`, `Collection`.`owned`,
`Collection`.`wanted`, `Collection`.`created`,
`Collection`.`modified`, `CrosstradeCollection`.`id`,
`CrosstradeCollection`.`user_id`,
`CrosstradeCollection`.`game_piece_id`,
`CrosstradeCollection`.`owned`, `CrosstradeCollection`.`wanted`,
`CrosstradeCollection`.`created`, `CrosstradeCollection`.`modified` ,
`GamePiecesView`.`id`, `GamePiecesView`.`game_name`,
`GamePiecesView`.`set_name`, `GamePiecesView`.`piece_name`,
`GamePiecesView`.`set_piece_name`, `GamePiecesView`.`piece_type`,
`GamePiecesView`.`piece_sub_type`,
`GamePiecesView`.`piece_description`,
`GamePiecesView`.`piece_flavor_text`, `GamePiecesView`.`piece_artist`,
`GamePiecesView`.`piece_rarity` FROM `collections` AS `Collection`
LEFT JOIN `collections` AS `CrosstradeCollection` ON
`Collection`.`game_piece_id` = `CrosstradeCollection`.`id` LEFT JOIN
`game_pieces_view` AS `GamePiecesView` ON `Collection`.`game_piece_id`
= `GamePiecesView`.`id` WHERE `CrosstradeCollection`.`user_id` =
'current_user' AND `collections`.`user_id` != 'current_user' LIMIT 10

The error I get here is

1054: Unknown column 'collections.user_id' in 'where clause'

Also, it's trying to join the tables doing

`Collection`.`game_piece_id` = `CrosstradeCollection`.`id`

but I need it to be

`Collection`.`game_piece_id` = `CrosstradeCollection`.`game_piece_id`

Is what I am trying to do even possible?  If so, how can it be done?

thnx,
Christoph


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



Pagination component and execute()'d query

2007-02-02 Thread Christoph

Could someone point me to an example (or a page that details) how to
use the pagination component using a manual query that I'm using in
Model::execute()?

thnx,
Christoph


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



Why No Joining for hasMany and HABTM Associations?

2006-12-22 Thread Christoph Neumann

Cake automatically (left) joins over "hasOne" and "belongsTo" relationships,
but does not automatically join over "hasMany" and HABTM relationships. Why
is this?  This was recently discussed in the following thread and a
work-around involving rebinding associations to "hasOne" came out, but this
is a hack. Why not simply enable support for auto-joins for "hasMany" and
HABTM relationships?

http://groups-beta.google.com/group/cake-php/browse_thread/thread/b7bdb9ad670136d4/9d2ea0408d8756a1

At present, associations determine what Cake will splice together when
creating the tree of results, but associations do not determine what is
joined at query time. What would be ideal is being able to specify joins at
query time.  This is useful, for example, when table A needs to join to B
and B needs to join to C and the results of the entire set are filtered
based on fields in A and C.

--~--~-~--~~~---~--~~
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: Ajax, controller and good practice

2006-12-20 Thread Christoph



ajax_index.thml


Ok, I'm retarded.  It would be nice if I named the files correctly...
:p 


Now that I have, it's working as expected.

thnx,
Christoph


--~--~-~--~~~---~--~~
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: Ajax, controller and good practice

2006-12-20 Thread Christoph



in your case:
$this->layout = 'ajax';
$this->render( 'ajax_index' );


Ok, as I said above, I tried this.  When I do, I get a "missing view"
error.


or simply
$this->render( 'ajax_index' , 'ajax' );


I tried this, too.  Same error.


but remember... you must have ajax.thtml layout with only one line 


I have that file in my layouts directory.  I'm not getting a missing
layout error, I'm getting a missing view error.  For whatever reason,
it's not finding my 'ajax_index.thtml' file in my view/users directory.


and another thing... you can't just copy and paste index.thtml into
ajax_index.thtml because when you are updating  in
index.thtml it will update that div with the same view .. so you will
have .. ... ..


I didn't copy and paste the entire contents of index.thtml.  As I said
above, I just copied and pasted the *table* that displays the users.
All of the rest of it, the description of the page, instructions, etc,
are all still in index.thtml.

When the error dumps out, this is (an excerpt of) what I am getting:

   [controller] => Users
   [action] => ajax_index
   [file] => /path/to/webroot/views/users/ajax_index.thtml
   [userTheme] => Vtes
   [userLoggedIn] => No
   [userRole] => anon

And here is the contents of my /views/users directory:

add.thtml
ajax_index.thml
edit.thtml
index.thtml
login.thtml
remindpassword.thtml
view.thtml

thnx,
Christoph


--~--~-~--~~~---~--~~
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: Ajax, controller and good practice

2006-12-19 Thread Christoph


Ok, one thing that I tried is the following... I copied the code from
my index.thtml file that displayed the users and put it into it's own
file: ajax_index.thtml.  In my index action, added the following:

 if( $this->RequestHandler->isAjax()) {
   $this->layout = 'ajax';
   $this->render( NULL, NULL, 'ajax_index' );

 }

but that isn't working.  I'm getting a missing view error.  If instead
I do

 $this->render( 'ajax_action' );

I get a mission action error.  I've looked in the manual and the API.
How can you make it so that an action uses a different view file?  I
could have sworn that the above is correct...?

thnx,
Christoph


--~--~-~--~~~---~--~~
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, controller and good practice

2006-12-19 Thread Christoph

I'm curious about what good/best practice is when setting up an action
that will be utilizing ajax updates.  Let's say we are working with the
users/index controller/action that will be listing out all the users in
the system.  The table of users will be updated via ajax as the user
pages through the list.

Is it best to have 2 actions in the controller?  One that sets up the
whole index page and another (using just the ajax layout) that is doing
the actual querying of the users?  The latter being accessed by the
former via requestAction()

I ask because if only a part of a page is going to be updated, I would
think that it would be best to seperate that part into it's own action.
 That way, I can minimize the amount of data that is coming back from
the server using the ajax layout.  Otherwise, the whole page would be
refreshed.

Or am I thinking about this the wrong way?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Set variable in view for access in layout

2006-12-08 Thread Christoph

> Look at Rossoft's Head Helper:
> http://rossoft.wordpress.com/2006/03/28/register-head-tags-from-helpers-2/

Excellent!  That is exactly what I needed.  Thank you very much!

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Set variable in view for access in layout

2006-12-08 Thread Christoph

> you can just set it from the controller
> vars that you set(), are available in both regular views and layouts

Yes, I know you can do that but I'd rather try to get it done via the
view.  That way, the designers working on the view (who don't
necessarily work on the controller) can add references to CSS files in
the view that will then be set up in the layout.

So my layout would look something like this:


  css( $cssFile ) . "\n";

  }
}
  ?>
  


and in my view, I could do:



That way, the view designers can create css for a specific page w/o
getting the coders involved and w/o having to add alot of superfluous
CSS to the layout page.

thnx,
Christoph


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



Set variable in view for access in layout

2006-12-08 Thread Christoph

>From what I understand, the view is parsed and rendered first then the
layout.  Apart from using the session, is there a way to set a variable
such that it will be available in the layout for me to use there?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: CakePHP 1.1.11.4064, thawed and redelivered better than before.

2006-12-04 Thread Christoph

> I don't know if I've got biased by your comment, but I DID notice a speed
> increase. Nicee :)

As did I.  A significant increase, in fact!  Way to go you guys!
Definitely a great job very well done!

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: General condition to all my finds

2006-12-01 Thread Christoph

>  var $belongsTo = array('User' =>
>array('className'  => 'User',
>  'conditions' => '',
>  'order'  => '',
>  'foreignKey' => 'user_id'
>)
>  );

As an aside, is there a bakery article out there somewhere that better
describes what all the keys do in the association arrays?  finderQuery,
conditions, etc?  I've searched but was unable to find anything.  The
documentation is very vague regarding this.

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Cake is breaking database views. This looks like a bug.

2006-12-01 Thread Christoph

> It seems to me that trying to stuff a view into the CakePHP model
> without taking the time to add in code specifically to handle views
> just isn't going to work, and that you should spend your energy
> creating an object that will run the view in native SQL and return the
> data in the format that you need.

This is a fair point.  All the points you make are fair.  But I think
you are being a little too dismissive of database views.  Yes, you can
do the work yourself in the code.  But why would you when it can be
done so much faster and more elegantly within the database.

> I have never used an SQL view and would love to see a real-world
> example of when a view should be used over, say, the CakePHP model
> combined with associations.

Here is a real world example of what I'm trying to accomplish.  I have
2 models: Users and Collections.  Users hasMany Collections and
Collections belongsTo Users.  This one user has, say, 5000 records in
the Collections table (not uncommon) with each record having having a
variable number in the owned column.  So I can let CakePHP return all
the records and iterate through 5000 of them to get a sum of all the
items owned in the collection or I can just create a view (that looks
like the one I've posted several times in this thread) and have all the
information I need returned using 1 query.  I'm sure you'll admit the
latter is significantly better than the former w/r/t performance.
Whether it's a view or a plain SQL query doesn't matter.  Yes, I could
just do something like $this->MODEL->query( 'SELECT statement used in
creating my view' ), but if I use that database view on various pages
and I needed to change it for whatever reason (add/remove a field,
etc), I have to modify all the pages where it is ues.  Whereas if I set
it up as a view, I can change the view in the database and very likely
I wouldn't have to change the code at all.  For example, let's say I
wanted to break up 'username' into 'firstname' and 'lastname' fields.
I could change my database view to "SELECT CONCAT( firstname, ' ',
lastname ) as username" and not have to change my code at all.

> Is it a bug?  Hard to say.  When you use a piece of code for something
> it wasn't intended to do and it doesn't work, is that a bug?  Or is
> that a constraint of that piece of code?

And yes, I may be using "...a piece of code for something it wasn't
intended to do and it doesn't work.". "Is that a bug?", you ask.  No,
not necessarily.  Admittedly, I don't know enough about the internals
of CakePHP to know if, in fact, it is.  That is why I'm putting the
question to you guys, you who are far more experienced than I, to find
that out.  I don't want to submit a ticket saying "waah! this is broke"
when it could just be my ignorance as to how CakePHP is _expected_ to
function.
 
thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Cake is breaking database views. This looks like a bug.

2006-12-01 Thread Christoph

> Probably not, because CakePHP is ADO. If you run your view query in an
> mysql client it will give  you the same field name as cake was giving
> you, after you gave aliases to every field being returned by your view
> cake is now placing it properly on the Model's array.

No, it isn't the aliases.  It's the function calls.  Here is the view
creation script using just the aliases:

CREATE VIEW users_profile_view AS
SELECT
  users.id AS id,
  users.username AS username,
  DATE( users.last_login ) as last_login,
  users.city AS city,
  users.state AS state,
  users.country AS country,
  users.comments AS comments,
  users.theme AS theme,
  SUM( collections.owned ) as pieces_in_inventory
FROM users
LEFT OUTER JOIN collections ON collections.user_id = users.id
GROUP BY users.id;

Here is the query being run by CakePHP:

SELECT `UsersProfileView`.`id`, `UsersProfileView`.`username`,
`UsersProfileView`.`last_login`, `UsersProfileView`.`city`,
`UsersProfileView`.`state`, `UsersProfileView`.`country`,
`UsersProfileView`.`comments`, `UsersProfileView`.`theme`,
`UsersProfileView`.`pieces_in_inventory` FROM `users_profile_view` AS
`UsersProfileView` WHERE 1 = 1 LIMIT 1

Here is what is being returned on line 555 of dbo_source.php:

Array
(
[0] => Array
(
[users] => Array
(
[id] => bob
[username] => bob
[city] => bob
[state] => bob
[country] => bob
[comments] => bob
[theme] => bob
)

[UsersProfileView] => Array
(
[last_login] => 2002-10-18
[pieces_in_inventory] => 1
)

)
)

As you can see, only those fields that used a function call were
actually placed under the 'UsersProfileView' key.  The aliases didn't
seem to matter one jot to how CakePHP processed the query and/or data.
As soon as I add the function calls back into my database view
creation, it works again as described in my previous post.

In my client, whether it's the GUI app developed by MySQL or the
command line, whenever I query (or DESCribe) the view, it all looks
fine.  Somehow, for some reason, CakePHP is getting, and using
(erroneously in my opinion) the table names from the underlying view
query and not from the view itself.

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Cake is breaking database views. This looks like a bug.

2006-12-01 Thread Christoph

> To a CakePHP noobie eye, it appears that what's happening is that
> CakePHP is getting the key name from the underlying view query or
> something.  Because if you look at the view, 'pieces_in_inventory' is
> using the qualified table name (collections) as are the other fields in
> the users table with the exception of 'last_login'.  I think in that
> case, the function call to DATE() is throwing CakePHP off.  Because it
> can't determine the table name, it defaults to the model name.  This
> could explain why 'pieces_in_inventory' was a value in the
> 'UsersProfileView' array previously.  The SUM() function call threw
> CakePHP off and because it couldn't determine the table name, it just
> defaulted to the model name.

I can confirm that this is what is happening.  I changed my view to be:

CREATE VIEW users_profile_view AS
SELECT
  CONCAT( users.id ) AS id,
  CONCAT( users.username ) AS username,
  DATE( users.last_login ) as last_login,
  CONCAT( users.city ) AS city,
  CONCAT( users.state ) AS state,
  CONCAT( users.country ) AS country,
  CONCAT( users.comments ) AS comments,
  CONCAT( users.theme ) AS theme,
  SUM( collections.owned ) as pieces_in_inventory
FROM users
LEFT OUTER JOIN collections ON collections.user_id = users.id
GROUP BY users.id;

and now the result is coming out as:

Array
(
[0] => Array
(
[UsersProfileView] => Array
(
[id] => bob
[username] => bob
[last_login] => 2002-10-18
[city] => bob
[state] => bob
[country] => bob
[comments] => bob
[theme] => bob
[pieces_in_inventory] => 1
)

)
  )

So it appears that CakePHP is getting they key name from the underlying
database view query when it can determine the qualified table name.  In
general, because of ->query(), I'm not sure that this is really a bug
and/or something that should be fixed.  However, what I do think needs
to be looked at is how it's determining the table name.  Above is the
SQL in creating the query.  Here is the SQL run by cake in querying the
database view:

SELECT `UsersProfileView`.`id`, `UsersProfileView`.`username`,
`UsersProfileView`.`last_login`, `UsersProfileView`.`city`,
`UsersProfileView`.`state`, `UsersProfileView`.`country`,
`UsersProfileView`.`comments`, `UsersProfileView`.`theme`,
`UsersProfileView`.`pieces_in_inventory` FROM `users_profile_view` AS
`UsersProfileView` WHERE 1 = 1 LIMIT 5

Why is CakePHP getting the table name from the underlying view SQL and
not this query here?  If it did that, it would get the correct key
name, 'UsersProfileView', and it would allow views to be modeled
properly w/o having to use the hack illustrated above where function
calls are used for every field.

Is this something I should submit a bug ticket for?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Cake is breaking database views. This looks like a bug.

2006-12-01 Thread Christoph

> Have you checked this issue?
> https://trac.cakephp.org/ticket/845
> Could be related as I see you are using an aggregator function on your SQL
> view.

Hmmm, after looking at it, you would think that these issues may be
related.  However, I just confirmed that they are not.  There is
definitely something weird about how CakePHP handles database views.  I
changed my database view to this:

CREATE VIEW users_profile_view AS
SELECT
  users.id,
  users.username,
  DATE( users.last_login ) as last_login,
  users.city,
  users.state,
  users.country,
  users.comments,
  users.theme,
  collections.game_piece_id as pieces_in_inventory
FROM users
LEFT OUTER JOIN collections ON collections.user_id = users.id
GROUP BY users.id;

N.B., there is only 1 record in the collections table so I figured the
above would be a close approximation of the aggregate.  Again, here is
the query executed by CakePHP:

SELECT `UsersProfileView`.`id`, `UsersProfileView`.`username`,
`UsersProfileView`.`last_login`, `UsersProfileView`.`city`,
`UsersProfileView`.`state`, `UsersProfileView`.`country`,
`UsersProfileView`.`comments`, `UsersProfileView`.`theme`,
`UsersProfileView`.`pieces_in_inventory` FROM `users_profile_view` AS
`UsersProfileView` WHERE 1 = 1 LIMIT 5

Here is what was returned on line 555 of dbo_source.php:

Array
(
[0] => Array
(
[users] => Array
(
[id] => joe
[username] => joe
[city] => joe
[state] => joe
[country] => joe
[comments] => joe
[theme] => joe
)

[UsersProfileView] => Array
(
[last_login] => 2002-10-18
)

[collections] => Array
(
[pieces_in_inventory] => 1
)

)

[1] => Array
(
[users] => Array
(
[id] => bob
[username] => bob
[city] => bob
[state] => bob
[country] => bob
[comments] => bob
[theme] => bob
)

[UsersProfileView] => Array
(
[last_login] => 2001-02-16
)

[collections] => Array
(
[pieces_in_inventory] =>
)

)
)

As you can see, now it's adding a 'collections' key.  It definitely
seems to me that this is a bug but I can't say for sure because I'm not
overly familiar with the internals of CakePHP and how it handles the
models.  I'm wondering if someone who is more familiar could test this
and see if that's the case?  If so, I can enter a bug ticket.

To a CakePHP noobie eye, it appears that what's happening is that
CakePHP is getting the key name from the underlying view query or
something.  Because if you look at the view, 'pieces_in_inventory' is
using the qualified table name (collections) as are the other fields in
the users table with the exception of 'last_login'.  I think in that
case, the function call to DATE() is throwing CakePHP off.  Because it
can't determine the table name, it defaults to the model name.  This
could explain why 'pieces_in_inventory' was a value in the
'UsersProfileView' array previously.  The SUM() function call threw
CakePHP off and because it couldn't determine the table name, it just
defaulted to the model name.

Now, if that's true, I'm curious why CakePHP doesn't just use the model
name in all cases?  But I suppose the answer to that lay in the fact
that it also supports plain jane SQL queries using ->query().  So I'm
wondering if that is the case, where does that leave database views?
It seems like it won't be possible to model them afterall...?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Modeling database views

2006-12-01 Thread Christoph

> It is a known fact amongst developers that source code tends to have as much
> sensitivity as humans do. Some times your loop may be in a good mood, and
> work like a charm; while others it may remember that last time you smashed
> the keyboard... And the code is like: "oh yeah, that's gonna help, it will
> probably make me work SOOO much better... NOT!"
> Sorry, lack of sleep ;)

No, I think you are absolutely dead on and makes absolute sense now
that I think about it. :p

thnx,
Christoph


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



Cake is breaking database views.

2006-11-30 Thread Christoph

I've created a simple database view in MySQL 5.x

CREATE VIEW users_profile_view AS
SELECT
  users.id,
  users.username,
  DATE( users.last_login ) as last_login,
  users.city,
  users.state,
  users.country,
  users.comments,
  users.theme,
  SUM( collections.owned ) as pieces_in_inventory
FROM users
LEFT OUTER JOIN collections ON collections.user_id = users.id
GROUP BY users.id;

and modeled it in cake.  It, too, is very simple.  Here it is:



Simple.  Straightforward.  In my controller, I'm calling the model
thusly:

UsersProfileView->recursive = -1;
$this->set('users',
$this->UsersProfileView->findAll(null,null,null,5,1));

  }
}

Again, simple, straightfroward.  When I set the debugging level high
enough, this is the query that CakePHP executes:

SELECT `UsersProfileView`.`id`, `UsersProfileView`.`username`,
`UsersProfileView`.`last_login`, `UsersProfileView`.`city`,
`UsersProfileView`.`state`, `UsersProfileView`.`country`,
`UsersProfileView`.`comments`, `UsersProfileView`.`theme`,
`UsersProfileView`.`pieces_in_inventory` FROM `users_profile_view` AS
`UsersProfileView` WHERE 1 = 1 LIMIT 5


So far, so good.  However, this is the structure of the result set that
is returned from the fetchAll() method on line 555 of dbo_source.php in
the cake library:

Array
(
[0] => Array
(
[users] => Array
(
[id] => bob
[username] => bob
[city] => bob
[state] => bob
[country] => bob
[comments] => bob
[theme] => bob
)

[UsersProfileView] => Array
(
[last_login] => 2002-10-18
[pieces_in_inventory] => 1
)

)
  )

What's going on here?  If I'm using the UsersProfileView model, why is
there a 'users' key in the result set array?  Perhaps it's because
UsersProfileView is a database view using, in part, the users table?  I
thought that but 'last_login' is also a field in the users table just
as al the other fields that are in the value of the 'users' key in the
array above.  So if there was just some sort of clash where the 2
models had the same fields, then I would have thought that 'last_login'
would be up with the other fields leaving 'pieces_in_inventory' as the
only key in the 'UsersProfileView' array.  But since that didn't
happen, I don't think that this is because of some clash.

So what is causing this?  The 'users' key in the result set is causing
other problems in CakePHP, specifically on line 625 of dbo_source.php.
$classname is resolving to the wrong value.  As a consequence, I'm
getting the following error:

Notice: Undefined property: UsersProfileView::$users in
/cake_framework/cake/libs/model/datasources/dbo_source.php on line 628

Is this just a case where the framework doesn't like to work with
database views?  Has anyone gotten views to work properly?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Modeling database views

2006-11-30 Thread Christoph

> How did you get that to work?  What version of Cake are you using?

I'm used the version downloadable from the CakePHP site

> I've got one view that I am using with an older version of cake
> (0.9.x).  But I'm having fits upgrading cake because the underlying
> mysql_fetch_field() function calls in dbo_source keep trying to tell
> cake that the view has no table name -

The first time I tried to model one of my views (using bake.php), I got
the same error.  However, when I came back to it several hours later,
it seemed to work.  *shrug*  I don't know what happened and why it
worked the second time.

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: what time is the new cakephp version?

2006-11-30 Thread Christoph

> > 
> > Developers are hoping for a Christmas present from the Nutty Santa :P
> > 
> Oh really??
> Were you good this year!?

Uh, no.  Hell no. :p
But shouldn't that be a bonus? :D

thnx,
Christoph


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



XML Component (was CakePHP *native* webservices.)

2006-11-29 Thread Christoph

After reading Chris Hartjes post in my previous thread, I thought I'd
take his empty xml component and add some code.  Below is what I came
up with and I'm wondering what you guys think and whether something
like this fits within the cake paradigm.

enabled || !( strtolower(
$controller->params['webservices'] ) == strtolower( 'xml' ))) {
return true;

  }
  $this->__domDocument = new DOMDocument( $this->version,
$this->encoding );

}

function buildXMLBody( $nodeName, $nodeValue ) {
  $retval = NULL;

  /**
   * Using the 3rd argument because evidently if the needle
argument
   * is a numeric 0, it will find it in the array somehow.  Not
exactly sure
   * why that's happening...
   **/
  if( !( in_array( $nodeName, $this->excludedNodes, TRUE ))) {

if( is_numeric( $nodeName )) {
  // If I don't do this, the DOM throws an exception.
  // Evidently, it doesn't like numbers as node names
  $nodeName = $this->rowNameNode;

}
if( is_array( $nodeValue )) {
  $domElement = $this->__domDocument->createElement( $nodeName
);
  foreach( $nodeValue as $name => $value ) {
if( $node = $this->buildXMLBody( $name, $value )) {
  $domElement->appendChild( $node );

}
  }
} else {
  $domElement = $this->__domDocument->createElement( $nodeName
);
  $domElement->appendChild(
$this->__domDocument->createTextNode( htmlentities( $nodeValue )));

}
$retval = $domElement;

  }
  return $retval;

}

function dataToXML( $dataArray, $rootNodeName = 'root',
$rowNameNode = 'row' ) {

  $retval = NULL;
  $this->rowNameNode = $rowNameNode;

  $rootNode = $this->__domDocument->createElement( $rootNodeName );

  foreach( $dataArray as $nodeName => $nodeValue ) {
if( $domElement = $this->buildXMLBody( $nodeName, $nodeValue ))
{
  $rootNode->appendChild( $domElement );

}
  }
  $this->__domDocument->appendChild( $rootNode );

  $retval = $this->__domDocument->saveXML( NULL, LIBXML_NOEMPTYTAG
);

  return $retval;

}
  }

?>


and here is my controller:

class UsersController extends AppController {

  var $name = 'Users';

  /**
   * I don't need to include Xml here.  It's being including
   * by something else within CakePHP.
   * #shrug#
   * Is that right?  Should it be doing that?  I'm not including
   * it in the $components array in my app_controller.php
   * file...
   **/
  var $components = array();

  function index() {

$this->User->recursive = -1;

if( strtolower( $this->params['webservices'] ) == strtolower( 'xml'
)) {
  $this->Xml->excludedNodes = array_merge(
$this->Xml->excludedNodes, array( 'id', 'password', 'role', 'email' ));
  $this->set('users', $this->Xml->dataToXML(
$this->User->findAll(), 'users' ));

} else {
  // Snip
  // Do regular index-y stuff here
}
  }
}

What do you guys think?  Am I going about this all the wrong way?  I
figured that putting this code in the component would allow any of the
other controllers that want to use the XML webservice a mechanism to
transform it's data into XML.  Should this functionality be moved to
the helper instead?  Is that were it's better suited?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: CakePHP *native* webservices.

2006-11-29 Thread Christoph

> So, looks like I managed to get it working.  I hope this helps people
> out who are trying to figure out how to use CakePHP's built-in web
> services.

This helped me a great deal.  Thank you very much.  I just wonder why
simple information like this is missing from the documentation...  When
I ran my tests, apart from the log entry I got when I added logging
around line 312 of view.php, I didn't get any of those errors.  That I
was missing the component or the helper.  I had my DEBUG set to 3,
which I thought was the max and showed everything.  I guess that's not
the case?

I really appreciate your time and effort in helping me (and many
others, I'm sure) with this issue.

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: CakePHP *native* webservices.

2006-11-29 Thread Christoph

> here are the things I did to get it to work at a bare minimum for a
> REST style service

What's a REST style service?

> That's the basics of what I did, and heck it worked for me.  I started
> on an article in the bakery but I am just swamped with work right now
> and can't seem to finish it.

I'll have to look into and try and implement something similar to what
you did.  See if it works...

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: CakePHP *native* webservices.

2006-11-29 Thread Christoph

> The manual says that there needs to be an "xml layout" for this to
> work.  This brings up several questions: how does the *layout* affect
> the view?  I would think that there needs to be seperate view files for
> XML just as there are for the HTML.  But that doesn't seem to be the
> case because the manual doesn't say anything about that.

Actually, the manual does say something about that.  I just missed in
in the comments.  But the rest of my email remains true.  I just can't
seem to get native webservices working for the life of me and am hoping
someone out there has been able to.

thnx,
Christoph


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

2006-11-29 Thread Christoph

I'm not entirely sure how I did it but I was finally able to get it
working, for which I am very happy.  While I was mucking about in
rdSimpleAuth to try and figure out how it works to try and figure out
what I might be doing wrong, I did find a small bug in the perm()
method.  Where it checks

if( isset( $flipped[$item] ) && $flipped[$item] >=
$flipped[$this->role] ) {

it should actually be

if( isset( $flipped[$item] ) && $flipped[$item] <=
$flipped[$this->role] ) {

It needs to check if the item is less than or equal to the role.
Otherwise you'll get a situation where Anonymous or Regular User beats
Admin.

thnx,
Christoph


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



CakePHP *native* webservices.

2006-11-29 Thread Christoph

Yes, I realize that there are things out there like NuSOAP and/or half
a dozen other third party libraries that you can use to offer RSS/XML
feeds, webservices, etc.  But CakePHP claims to be able to handle this
stuff natively.  It even says so in the manual on
http://manual.cakephp.org/chapter/configuration, about 80% of the way
down.  So if I do as the manual says and access:

www.mydomain.com/xml/users/index

I should get the XML.  I don't.  With DEBUG set to 0, I get a 404.
When I set DEBUG to 3, I get the following error:

No template file for view %s (expected %s), create it first'
Fatal error: in /cake_framework/cake/libs/view/view.php on line 312

I downloaded the latest version from the site using SVN.  Here is the
version particulars:

/**
 * Methods for displaying presentation data in the view.
 *
 *
 * PHP versions 4 and 5
 *
 * CakePHP :  Rapid Development Framework <http://www.cakephp.org/>
 * Copyright (c)2006, Cake Software Foundation, Inc.
 *  1785 E. Sahara 
Avenue, Suite 490-204
 *  Las Vegas, 
Nevada 89104
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright   Copyright (c) 2006, Cake Software Foundation, Inc.
 * @link
http://www.cakefoundation.org/projects/info/cakephp CakePHP
Project
 * @package cake
 * @subpackage  cake.cake.libs.view
 * @since   CakePHP v 0.10.0.1076
 * @version $Revision: 3963 $
 * @modifiedby  $LastChangedBy: phpnut $
 * @lastmodified$Date: 2006-11-25 09:01:03 -0500 (Sat, 25 Nov 2006) $
 * @license 
http://www.opensource.org/licenses/mit-license.php The
MIT License
 */

When I add some logging around that line, I get something about a
missing component?  So ok, I go back to the error.  I'm missing a view.
 But I have no idea what to call it.  The error message isn't any help.
 I create a simple non-functional ("Hello world") view, name it
default.thtml and put it in the /views/layouts directory just like the
manual says.  No such luck.  So I rename it xml.thml and put it in the
/views/users directory.  No such luck.  I also tried copying (and
renaming) it and putting it in the /views/users/xml directory using the
name index.thtml.  No such luck. Thinking about the admin routing and
how it works, I tried copying (and renaming) it and putting it in the
/views/users directory using the name xml_index.thtml.  Again, no such
luck.

The manual says that there needs to be an "xml layout" for this to
work.  This brings up several questions: how does the *layout* affect
the view?  I would think that there needs to be seperate view files for
XML just as there are for the HTML.  But that doesn't seem to be the
case because the manual doesn't say anything about that.  And the fact
that my tests in trying to use it as a seperate view (as well as a
layout) have failed makes me believe that there are other things behind
the sceneds that just aren't apparent, even when looking at the code.

So after all of that, I'm very curious to find out if anyone has gotten
this to work using CakePHP *native* functionality, which it claims
(erroneously I think, based on all my tests and attempts to get it
working) to have.

thnx,
Christoph


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

2006-11-28 Thread Christoph

Unfortunately, that didn't help me too much.  Here is my code:

uses('sanitize');

class AppController extends Controller {

  var $components = array( 'rdSimpleAuth' );

  var $rdAccess = '*'; // this will protect every page except the
loginPage.
  var $Sanitize;

  function __construct() {
$this->rdSimpleAuth->roles = array( 'Admin' => 'admin',
'User'  => 'user',
'Anon'  => 'anon' );

$this->Sanitize = &new Sanitize;

parent::__construct();

  }

  function beforeFilter() {
if( '' == trim( $this->Session->read( 'rdAuth.id' ))) {
  $this->Session->write( 'rdAuth.role', 'anon' );

}
if( eregi( CAKE_ADMIN, $this->action )) {
  $this->rdAccess[$this->action] = array( 'role' => 'admin' );

}
if( !$this->rdSimpleAuth->check( $this->action, $this->rdAccess ))
{
  $this->redirect( '/users/login' );
  exit;

}
  }
}

As an aside, what is

var $rdAccess = '*';

doing anyway?  How is it protecting every page except the loginPage??

class UsersController extends AppController {

  var $name = 'Users';

  var $rdAccess = array( 'index'  => array( 'admin', 'user', 'anon' ),
 'view'   => array( 'admin', 'user', 'anon' ),
 'add'=> array( 'admin' ),
 'edit'   => array( 'admin' ));


  function login() {
//RENDER VIEW IF USER IS LOGGED IN
if( $this->rdSimpleAuth->valid ) {
  if( $redirectPage = $this->Session->read( 'rdAuth.redirect' )) {
$this->Session->del( 'rdAuth.redirect' );
$this->redirect( $redirectPage );

  } else {
$this->redirect( '/' );

  }
}

//RENDER LOGIN FORM AND THEN HANDLE POST
if( empty( $this->data )) {
  $this->render('login');

} else {
  $this->Sanitize->cleanArray( $this->data );

  if( $this->User->validates( $this->data )) {
$this->data['User']['username'] = $this->Sanitize->paranoid(
$this->data['User']['username'], array( '.','_','-' ));
$this->data['User']['password'] = md5(
$this->data['User']['password'] );

$this->data = $this->User->find( array( 'User.username' =>
$this->data['User']['username'],
'User.password' =>
$this->data['User']['password'] ));

if(( 0 < strlen( $this->data['User']['id'] )) &&
   ( trim( $this->Session->read( 'rdAuth.id' )) == trim(
$this->data['User']['id'] ))) {
  //sets up the session vars
  $this->rdSimpleAuth->set( $this->data['User'] );

  /* This was causing problems when 'redirect' was set to
something else.
   * Don't read it from session, instead use the variable from
the component.
   * @author Mandy
   */
  //$this->redirect( $this->Session->read('rdAuth.redirect') );

  $this->redirect( $this->rdSimpleAuth->loginPage );

} else {
  $this->data['User']['password'] = '';
  $this->set('message', 'Invalid login/password');

}
  } else {
$this->data['User']['password'] = '';
$this->set('message', 'Invalid login/password');
$this->validateErrors($this->User);

  }
}
  }
}

If no role has been set, I'm setting it to anon.  By default, anon has
access to both the index() and view() action.  However, everytime I try
to go to either of those pages, I'm redirected to login.

What's going on?  What am I missing?

thnx,
Christoph


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



rdSimpleAuth

2006-11-28 Thread Christoph

I'm having a bit of difficulty fully setting this component up.  I've
seen the wiki, I've seen (what little) documentation on the cakeforge
site and it does a good job of showing the login() action. However,
nothing I've seen describes how to limit access to other actions.  If I
have the roles of, say, 'Admin', 'Moderator', 'User', 'Anon', how can I
make it so that one action is accessable by Anon+ and another
accessable by Moderator+?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Associations and Scaffolding

2006-11-27 Thread Christoph

> So, according to me I have done everything right and I go to:-
> http://www./Addresses and can enter and list addresses.
> Brilliant!
> BUT, if I go to http://www./Customers/edit/, I cannot see the
> association with Addresses which should have been picked up
> automatically by the Foreign Key (address_id)
> All I get is a text box called "Address Id".
> Any ideas what I have done wrong here? I tried adding the following
> association to the Customer model but that did not work either.

You might want to try using the bake.php utility.  It's use was
invaluable to me to get my feet wet and everything up and running
quickly.

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: ajax autoComplete example

2006-11-27 Thread Christoph

> Christoph a scris:
> > Except I tried that.  I've even tried following the bakery article that
> > is based on that.  But nothing I do seems to get it to work.  See my
> > post here:
> > http://groups.google.com/group/cake-php/browse_frm/thread/ea0519608cc51b74/?hl=en#
> > that still hasn't been replied to... :(  Autocomplete seems incredibly
> > difficult to me...

mirceade wrote:
> Ha, ha. I HAVE FOUND IT Christoph (had the same problem). You must
> include the model you are using in the autocompletion in the controller
> code like this:
> var $uses = array('Category');
> where Category is the model you are autocompleting from. The rest is
> like in the tutorial.

Nope, that isn't what's wrong.  At least not for me.  Because the field
I'm trying to set up autocomplete for is a field that is part of the
model for the controller I'm using.

*sigh*

I've tried everything I can possible think of to try to get it to work
but it just won't.  And I know Ajax is working.  I have it working
(finally) with my pagination.  Just not the autocomplete... :(

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Setting up autocomplete

2006-11-18 Thread Christoph

Ok, so I added some logging to the AutocompleteComponent to see what
was going on.  It looks like the Ajax on the front end is working fine.
 It's sending back the value of the field which is then getting used in
findAll().  Here is my log entries:

06-11-18 07:56:41 Debug: Instantiating AutocompleteComponent
06-11-18 07:56:41 Debug: AutocompleteComponent: Finding All using:
UsersController->User->findAll(Array
(
[User.theme] => LIKE %V%
)
).
06-11-18 07:56:42 Debug: Instantiating AutocompleteComponent
06-11-18 07:56:42 Debug: AutocompleteComponent: Finding All using:
UsersController->User->findAll(Array
(
[User.theme] => LIKE %Vt%
)
).
06-11-18 07:56:42 Debug: Instantiating AutocompleteComponent
06-11-18 07:56:42 Debug: AutocompleteComponent: Finding All using:
UsersController->User->findAll(Array
(
[User.theme] => LIKE %Vte%
)
).
06-11-18 07:56:43 Debug: Instantiating AutocompleteComponent
06-11-18 07:56:43 Debug: AutocompleteComponent: Finding All using:
UsersController->User->findAll(Array
(
[User.theme] => LIKE %Vtes%
)
).

Ok, so what isn't working is the back end.  For some reason, it's not
sending the request back to the browser for it to use.  Anywhere.  So
again, what am I missing?  It seems as if everything is set up
correctly, at least so far as how it was described in the article.
What am I missing?

thnx,
Christoph


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



Setting up autocomplete

2006-11-17 Thread Christoph

So I read the following article and implemented everything detailed
within.  I followed the instructions exactly in this article and it's
not working.

The following is in my default layout:



charsetTag('UTF-8');
echo $javascript->link('prototype');
echo $javascript->link('scriptaculous.js');
echo $javascript->link('controls');
?>


Here is what my controller looks like:

var $helpers = array('Html', 'Form' , 'Ajax', 'Javascript' );
var $components = array( 'Pager', 'Autocomplete' );

(I didn't make any other change or add any other code to my controller)

This is what my view looks like:


labelTag('User/theme', 'Autocomplete Theme');?>
autoComplete('User/theme', '', array( 'autocomplete'
=> 'on' ));?>
tagErrorMsg('User/theme', 'Please enter the
Theme.');?>


And here is what gets rendered in my browser (excerpt):

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>

Users





  


  
Autocomplete Theme



new Ajax.Autocompleter('UserTheme',
'UserTheme_autoComplete', '/narthex/users/edit/joebobbriggs', {});

  



  


One thing that I did notice is that 'autocomplete' is set to 'off' in
the input tag.  Is it supposed to be like that?

So what else do I need to do?  I've got to be missing something here...

thnx,
Christohp


--~--~-~--~~~---~--~~
 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: Modeling database views

2006-11-17 Thread Christoph

> I can't see any reason why you wouldn't want to model a view. As far as
> SQL is concerned, views can be treated just like any other table. So
> all of the fancy helper methods should work the same on views as they
> do on tables.

I agree on general principle.  My question is about the wisdom of using
db views within cake because it breaks the relationship model (for the
want of a better term).  And I'm not sure how good or bad that is.

Let me explain.  You have a table.  Say 'users'.  you have a model
called User, a controller called UsersController and views for each
action.  The UsersController "uses", say, the Profile, in addition to
the User, model to allow cake to get associated an profile.  It might
also "use", say, a model called Skill to get a users associated skills.
 This is all well and good.  And when you use, say, findAll(), you are
returned an array of all the related data.  Ok.  So if you wanted to
show an index view of the users in the db, the UsersController would
use it's own model to retrieve all that data.  I hope I'm not being too
convoluted here but I think I am.

In any case, but modeling and using the database view set up to
aggregate all the user information (which may include joined data from
the skills and/or profiles tables), the UsersController is no longer
using it's own model.  It's using a 'virtual' (for the want of a better
word) model that is _based_ on the users table but isn't a direct
representation of the data within that table.

I'm just not sure if this goes outside the theoretical structure that
is MVC.  A model uses a controller (and vice versa) to create a
presentation.  By using a db view, you essentially have X models (the
various db views) using a controller to create a presentation.  And
again, being so new to MVC, I'm not sure if this is straying beyond
those theoretical boundries.

I hope I'm making sense.

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Modeling database views

2006-11-17 Thread Christoph

> I believe that the point of the helper functions is to keep things
> database-agnostic, and building in exceptions for a specific database
> should be kept to a minimum.

I'm not talking about creating helpers or helper functions.  Just using
a DB view's model for things like findAll(), generateList(), etc.
Consider the following:

Table: games
Fields: id, game_name

Table: sets
Fields: id, set_name

Table: game_sets
Fields: id, set_id, game_id

Table: game_pieces
Table: id, game_set_id, piece_name

Using just the game_pieces model, if I use findAll(), generateList(),
et. al., I get only the game_set_id and would have to look elsewhere
(in the array returned by, say, findAll()) to get the set name or even
the game name.  Not in and of itself a bad thing but if you have
thousands and thousands of game pieces, each getting returned with the
related game_sets, games, sets, that's a massively huge array that
you'll be getting back.

Now, lets consider the following view (which will have it's own Cake
model)

CREATE VIEW game_pieces_view AS
SELECT
  game_pieces.id,
  game_pieces.piece_name,
  games.game_name,
  sets.set_name
FROM
  game_pieces
INNER JOIN game_sets ON games_sets.id = game_pieces.game_set_id
INNER JOIN sets ON sets.id = game_sets.set_id
INNER JOIN games ON games.id = game_sets.game_id

so now I can do $this->GamePiecesView->findAll() or
$this->GamePiecesView->generateList() and have easy access to access to
just the data I need.  I'll be doing all of this in the
game_pieces_controller in, for example, the index action method.  This
is a departure since the controller wouldn't be using the corresponding
model but instead a related model (ie, GamePiecesView model and not the
GamePieces model).  I'd still be using the GamePieces model for other
things (for example saving the data from add/edit) but for general
wholesale listing of data (for example, the output from the index
action), I'd be using the GamePiecesView model.

Because of that departure and because I'm so new to MVC in general, I'm
not sure if it's good practice.  This is the reason for my original
question.

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Modeling database views

2006-11-17 Thread Christoph

Any thoughts?

thnx,
Christoph


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



CakePHP mailing list?

2006-11-17 Thread Christoph

Is there a mailing list or other forum for CakePHP?  It seems like this
Google Groups format makes things more difficult.  It seems like the
older posts get overlooked because they are 2 or 3 or more pages back.
Unless you check several times a day, it's very easy to overlook
messages...

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Element vs Helper

2006-11-16 Thread Christoph

> Let me try and put it as simply as possibly
> Element = snippet from a template which you just render in your
> templates an example would be a dynamic menu which can be seen on all
> pages
> Helper = Some thing which helps you write otherwise repetitive but
> somewhat complex HTML  in your templates abstracting away the
> complexities in the call to its methods - the best example is the HTML
> helper and the Form helper.

That was helpful.  Thanks.  :)

What about a component?  How is that different from a helper?

thnx,
Christoph


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



Modeling database views

2006-11-16 Thread Christoph

I'm curious what the general consensus in the CakePHP community is on
modeling database views?  Is it a good idea?  Not?  What about creating
a controller and/or a view for the, uh, view?

I'm not asking about the wisdom of using database views.  In general,
everyone knows they are a good way of aggregating data for
presentation.  I'm asking about the wisdom of using them within the
cake framework.  Should they not be modeled and just be specifically
queried (using query() or execute())?

thnx,
Christoph


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

2006-11-15 Thread Christoph

> I don't have a solution, but I can confirm that I had the exact same
> results as you have. I suspect we need to do more than manual shows us.

Well, at least I'm not the only one.  Hopefully whoever is in charge of
writing the manual gets wind of the oversight that is in that part of
the manual...

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: 2 noobie questions

2006-11-14 Thread Christoph

> " ... you can call this function to render the view at any point in the 
> controller logic"

At first I was like "Huh?  How does that help me.  I'm still using just
one view." then , the light bulb went on. :p  duh. :)

Thanks for pointing that out!

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: generateList()

2006-11-13 Thread Christoph

> but just think about all the functionality you didn't have to write. a
> simple advanced generateList method is nothing in the scheme of things :)

More than a fair point.  It's just that with the number of complex
SELECT boxes I'm going to have on my site, I'm going to have to write
at least 1 advanced generateList() method for the majority of my
models.

Oh, well.  Off to work. :)

thnx,
Christoph


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



Not quite understanding associations

2006-11-13 Thread Christoph

I have the following tables:

users
collections, FK user_id, FK game_piece_id
game_pieces, FK games_set_id
games_sets, FK game_id, FK set_id
games
sets

So, if I understand correctly:

users $hasMany collections
collections $belongsTo users, game_pieces
game_pieces $belongsTo game_sets
games_sets $belongsTo games, sets
games $hasMany games_sets
sets $hasMany games_sets

I would think that collections $hasMany game_pieces (such that many
game pieces make up a collection), but using the relationship between
users and collections as, well, a model, that means since collections
belongs to users, it must also belong to game_pieces.

I suppose collections is a HABTM joining table between users and
game_pieces?  But if I try to define the association that way, I get an
error from cake (using the debug mode 3) showing:

1146: Table 'cake_communal_haven.collections_users' doesn't exist
1146: Table 'cake_communal_haven.collections_game_pieces' doesn't exist

so obviously I can't make it a HABTM association.  So I'm just not
quite getting this...

Any help would be greatly appreciated!

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: generateList()

2006-11-13 Thread Christoph

I took a look at many of those threads and none seemed to address this
specific issue.  When I turn debugging on to level 3, it is showing me
all the SQL executed and the query used to fill my SELECT box for my
game pieces doesn't look anything like it should.  It's not using any
joins whatsoever, even by using variations of franky's suggestion above
(admittedly not likely the proper syntax).

I'm starting to dispair that I won't be able to use generateList() for
anything but the simplist of SELECT boxes.  Anything that may require a
complex join or anything that needs multiple column values to comprise
the SELECTs display value, it's looking like I'm going to need to write
my own functionality... :(

thnx,
Christoph


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



Webservices

2006-11-13 Thread Christoph

I'm fooling around w/cake to try to see what it's capable of.  All of
my MVC parts have all been created by bake.php and I've done very
little modification from there.  I'm still learning.

So I have a users controller with the default index action (as provided
by bake).  The manual (http://manual.cakephp.org/chapter/configuration)
says that if I set WEBSERVICES to 'on' in /app/config/core.php, then I
can access different 'views' of the data.  When I go to

www.mysite.com/users/index

I see the HTML view just fine.  But if I go to

www.mysite.com/xml/users/index

I get the missing component error page.  The exact error text is:

Fatal: Create the Class:

in file : app/controllers/components/xml.php

Why is it looking for XmlComponent? The manual makes no mention of
having to create any component. Is there something else I need to do?
Is there something I'm missing?  I do have the
/app/views/users/xml/index.thtml file as instructed in the manual.  The
odd thing is that if that file is not there, I get a missing controller
error page instead...?  I also get the missing controller error page if
I set WEBSERVICES to off.

thnx,
Christoph


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



2 noobie questions

2006-11-13 Thread Christoph

I'm still trying to figure cake out and I've a few questions, both
about varying degrees of code re-use.  Let me say first that I created
the MVC for all of my database tables using bake.php.  I must say, it
is a *very* handy utility for those just learning.

1) Let's say I have 2 sections of my site.  One is to display the
site's user list and another to display the site's news.  Both sections
are working and has the layout just how I want it.  Yay, go me.  Now I
want to add a 3rd section to my site.  Let's call it "What's New".  On
that page, I want it to show only the last 2 news items and the 5
newest members.  Now, I could create the view for this page by copying
and pasting the code from the view for the other 2 sections (news,
users), but if I make a layout change to one, I have to also make it on
the other.  I'm sure you can see where I'm going with this.  Is it
possible to tell a controller to use multiple views?  It's own and also
any other?

2) When using bake.php, it creates the basic CRUD actions.  Even if you
don't use bake.php, the MVC principle (as it relates to a DB driven
site) encourages that you create your own CRUD actions.  I have a
slight issue with this (in general) and also how bake.php goes about
creating the actions (more specifically).  When implementing the
actions for the "C"reate and "U"pdate actions, it creates 2 separate
methods in the controller.  Why?  They are both essentially performing
the same action.  The only difference is whether or not the form fields
are pre-filled and whether it is an UPDATE or an INSERT query once the
form is posted.  The existence (or not) of the primary key can be used
to control that behavior.  Why have that redundant code; why have 2
methods/actions that look practically identical?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: generateList()

2006-11-13 Thread Christoph

So no one knows how/if something like this can be done?  I was hoping
someone would...

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: generateList()

2006-11-10 Thread Christoph

> First you do not need to use the $uses when the model you want to use
> is into a relation (hasOne, etc..), you can just access it doing
> $this->CurrentModel->AssciateModel ..

I didn't do that.  All the code I pasted was generated using the bake
utility. Blame CakePHP. :)

> Now for the generateList problem, I have never tried this, but since
> you retrieve your data using the parent model, I would tried
> generateList(NULL,NULL,15, '{n}.GamePiece.id',
> '{['GamePiece']n}.Set.set_name ));
> or something like this  since the data wouild be down to the tree ..
> Well maybe worth gice a try, let me know the correct syntax...

That didn't work, unfortunately.  I will, however, keep plugging away
at it to figure out what will work.

Do you know the answer to my first question?  How to generate a label
such that it is made up of the values of 2 separate columns?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Default controller?

2006-11-09 Thread Christoph

> What's the best way to accomplish this?I'd stick that sort of stuff in 
> AppController (/app/
> app_controller.php) as class variables or methods, or in /app/config/
> bootstrap.php.

What's the controller that's using the view

webroot/views/pages/home.thtml

?

There are other models/controllers that I would like to use on my home
page.  News, for example.  Is there any way to do this?  Or am I going
to have to set up my own HomePageController and set up index.php to
redirect to /homepage?

thnx,
Christoph


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



[noobie] generateList()

2006-11-09 Thread Christoph

Ok, so I figured out how to generate a  list using different
fields, other than the id, as the key => value pair.  But I still have
some issues.

* Is it possible to use multiple fields to make up the value of the
select box?  Such that it would come out looking something like

field2value - field3value

?

* I have 4 seperate tables.  sets, games_sets, game_pieces and
collections.  collections has a FK referencing game_pieces which has a
FK referencing games_sets which has a FK referencing sets.  So yay.
The following are the associated models follows by the associates
controllers (only the relevant parts; everything else is cut out):

class Collection extends AppModel {
var $name = 'Collection';
var $hasMany = array(
'GamePiece' =>
array('className' => 'GamePiece',
'foreignKey' => 'game_piece_id' 
));
}

class CollectionsController extends AppController {
var $name = 'Collections';
var $uses = array('Collection', 'User', 'GamePiece');
}

class GamePiece extends AppModel {
var $name = 'GamePiece';
var $belongsTo = array(
'GamesSet' =>
array('className' => 'GamesSet',
'foreignKey' => 'games_set_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
),

'Collection' =>
array('className' => 'Collection',
'foreignKey' => 'id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
));
}

class GamePiecesController extends AppController {
var $name = 'GamePieces';
var $uses = array('GamePiece', 'GamesSet', 'Collection', 'DeckPart',
'TradeGamePiece', 'GamePieceAttribute');
}

class GamesSet extends AppModel {
var $name = 'GamesSet';
var $belongsTo = array(
'Set' =>
array('className' => 'Set',
'foreignKey' => 'set_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
)

);

var $hasMany = array(
'GamePiece' =>
array('className' => 'GamePiece',
'foreignKey' => 
'games_set_id'));

}

class GamesSetsController extends AppController {
var $name = 'GamesSets';
var $uses = array('GamesSet', 'Game', 'Set', 'GamePiece');
}

class Set extends AppModel {
var $name = 'Set';
var $hasMany = array(
'GamesSet' =>
array('className' => 'GamesSet',
'foreignKey' => 'set_id'));

}

class SetsController extends AppController {
var $name = 'Sets';
var $uses = array('Set', 'GamesSet');
}

I'm trying to make it so that the collection controller can, going
through game_pieces, games_sets and finally sets, get the set name that
a game piece belongs to.  I'm trying to do something like:

$this->set('gamePieces',
$this->Collection->GamePiece->generateList(NULL,NULL,15,
'{n}.GamePiece.id', '{n}.Set.set_name ));

but that's not working.  Is something like this possible?  Or am I
going to have to generate the  box manually?

thnx,
Christoph


--~--~-~--~~~---~--~~
 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: Automatic plugin detection

2006-11-02 Thread Christoph Neumann
I was running into this problem too.  I defined some classes within a plugin that I wanted to extend within my main application tree.  I ended up defining a function "plugin" in the spirit of "vendor" and "uses".
You use the function like so:plugin('foo', 'bar');Then any classes defined in "foo" or "bar" plugin trees will be available to use.Note: You need to apply a fix so you don't get duplicate class definition errors.  See 
https://trac.cakephp.org/ticket/1603/** * Will load all the classes related to a plugin. */function plugin() {    $args = func_get_args();    foreach($args as $arg) {
        $plug_ctl_name = $arg . "AppController";        $plug_model_name = $arg . "AppModel";        if ( ! class_exists($plug_ctl_name) ) {            if ( class_exists("AppController") ) {
                loadPluginController($arg, $arg);            }        }        if ( ! class_exists($plug_model_name) ) {            if ( class_exists("AppModel") ) {                loadPluginModels($arg);
            }        }    }}On 10/31/06, Christian Winther <[EMAIL PROTECTED]> wrote:













Hello bakers 

 

I've been thinking about how to cake recognize
my plugins automatic – and adapt my views to the plugins there is active
on the app (Adding menu's / features )

Does anyone have a good idea on how this
could be done ? 

 

My solution (partly) was something like: 

 

plugins/$name/$name_install.php  
  file
for activating the plugin ( setting up database fields )

plugins/$name/$name_information.php     basic
information about the plugin ( version, description, friendly name )

plugins/$name/$name_uninstall.php    file
for deactivating the plugin ( removing tables )

 

and then somehow the plugin should 'publish'
itself to cake what menu options it has, and what features it should add where
and how 

 

Have anything like this been made in Cake
before ? Or perhaps some other framework where it would be possible to get 'inspiration'
?

 

/Jippi












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


loadPluginModels doesn't check for class existence

2006-10-26 Thread Christoph Neumann
The loadPluginModels function doesn't check for class existence.  This is a problem for me because I have to preload some models from a plugin before the cake dispatcher tries to load the rest of the models.  I'm using cake 
1.1.8.3544.I attached a patch.- Christoph

--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---
--- cake/basics.orig.php	2006-10-26 10:58:20.0 -0700
+++ cake/basics.php	2006-10-26 11:00:35.0 -0700
@@ -99,16 +99,15 @@
 			overload($pluginAppModel);
 		}
 		$pluginModelDir = APP . 'plugins' . DS . $plugin . DS . 'models' . DS;
-		$loadedPluginModels = array();
 		foreach(listClasses($pluginModelDir)as $modelFileName) {
-			if (!key_exists($modelFileName, $loadedPluginModels)) {
+			list($name) = explode('.', $modelFileName);
+			$className = Inflector::camelize($name);
+			if (!class_exists($className)) {
 require($pluginModelDir . $modelFileName);
 
 if (phpversion() < 5 && function_exists("overload")) {
-	list($name) = explode('.', $modelFileName);
-	overload(Inflector::camelize($name));
+	overload($className);
 }
-$loadedPluginModels[$modelFileName] = $modelFileName;
 			}
 		}
 	}