Re: jquery doesn't work

2012-02-05 Thread Tilen Majerle
Your selector for myLink in js is not correct...

Dne nedelja, 05. februar 2012 je pošiljatelj supp...@deep-coding.net 
supp...@deep-coding.net napisal:
 Hey,

 I'm having a problem, again :)
 I want to use some jquery functions in my app, but it doesn't work, so
 I tried it with a simple function (onlick alert something), but it
 also doesn't work.
 In my controller I've added $helpers = array('Js');
 And In my view I've added
 $this-Html-script(array('jquery', 'myFunction'));
 The js files will be included, I checked it in the source code.

 myFunction.js looks like this:
 $(document).ready(function() {
$('myLink').click(function() {
alert(works);
});
 });

 But if I click on the links, nothing happens...
 Can please someone help me?
 I am using Cakephp 2 and Jquery 1.7.1
 Thanks

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


-- 
--
Lep pozdrav, Tilen Majerle
http://majerle.eu

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


My Behavior seems to be not attached to model.... :S

2012-02-05 Thread Mattia Manzati
Hi all! I have a problem when creating my own Behaviors. I have
attached it with actAs, but it seems that it is not attached to my
model because it does'nt trigger neither a print_r() or modify the SQL
Query... My Code: https://gist.github.com/1744216

(default) 2 queries took 0 ms NrQuery   Error   AffectedNum. 
rows   Took
(ms)
1   SELECT `Anime`.`id`, `Anime`.`user_id`, `Anime`.`approved_by`,
`Anime`.`language_id`, `Anime`.`name`, `Anime`.`created`,
`Anime`.`modified`, `Language`.`id`, `Language`.`name`,
`Language`.`flag` FROM `my_im93`.`animes` AS `Anime` LEFT JOIN
`my_im93`.`languages` AS `Language` ON (`Anime`.`language_id` =
`Language`.`id`) WHERE 1 = 1 LIMIT 20   0   0   0
2   SELECT COUNT(*) AS `count` FROM `my_im93`.`animes` AS `Anime` LEFT
JOIN `my_im93`.`languages` AS `Language` ON (`Anime`.`language_id` =
`Language`.`id`) WHERE 1 = 11   1   0
(forum) 0 query took ms Nr  Query   Error   AffectedNum. rows   
Took (ms)

As you can see queries are not modified :S

-- 
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: My Behavior seems to be not attached to model.... :S

2012-02-05 Thread Tilen Majerle
github gist says that behavior is located in
app\Model\Beahvior\OwnableBehavior.php
#https://gist.github.com/1744216#file_app%5Cmodel%5Cbeahvior%5Cownable_behavior.php


You have Be*ah*vior instead of Be*ha*vior :)

--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/5 Mattia Manzati manzat...@gmail.com

 Hi all! I have a problem when creating my own Behaviors. I have
 attached it with actAs, but it seems that it is not attached to my
 model because it does'nt trigger neither a print_r() or modify the SQL
 Query... My Code: https://gist.github.com/1744216

 (default) 2 queries took 0 ms NrQuery   Error   Affected
  Num. rows   Took
 (ms)
 1   SELECT `Anime`.`id`, `Anime`.`user_id`, `Anime`.`approved_by`,
 `Anime`.`language_id`, `Anime`.`name`, `Anime`.`created`,
 `Anime`.`modified`, `Language`.`id`, `Language`.`name`,
 `Language`.`flag` FROM `my_im93`.`animes` AS `Anime` LEFT JOIN
 `my_im93`.`languages` AS `Language` ON (`Anime`.`language_id` =
 `Language`.`id`) WHERE 1 = 1 LIMIT 20   0   0   0
 2   SELECT COUNT(*) AS `count` FROM `my_im93`.`animes` AS `Anime` LEFT
 JOIN `my_im93`.`languages` AS `Language` ON (`Anime`.`language_id` =
 `Language`.`id`) WHERE 1 = 11   1   0
 (forum) 0 query took ms Nr  Query   Error   AffectedNum. rows
   Took (ms)

 As you can see queries are not modified :S

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


-- 
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: My Behavior seems to be not attached to model.... :S

2012-02-05 Thread Mattia Manzati
Sorry, wrong typed in gist, but in my folders it's ok ...but it
stil does'nt load my behavior :S

Matt93.

On 5 Feb, 10:06, Tilen Majerle tilen.maje...@gmail.com wrote:
 github gist says that behavior is located in
 app\Model\Beahvior\OwnableBehavior.php
 #https://gist.github.com/1744216#file_app%5Cmodel%5Cbeahvior%5Cownable...

 You have Be*ah*vior instead of Be*ha*vior :)

 --
 Lep pozdrav, Tilen Majerlehttp://majerle.eu

 2012/2/5 Mattia Manzati manzat...@gmail.com







  Hi all! I have a problem when creating my own Behaviors. I have
  attached it with actAs, but it seems that it is not attached to my
  model because it does'nt trigger neither a print_r() or modify the SQL
  Query... My Code:https://gist.github.com/1744216

  (default) 2 queries took 0 ms Nr        Query   Error   Affected
   Num. rows       Took
  (ms)
  1       SELECT `Anime`.`id`, `Anime`.`user_id`, `Anime`.`approved_by`,
  `Anime`.`language_id`, `Anime`.`name`, `Anime`.`created`,
  `Anime`.`modified`, `Language`.`id`, `Language`.`name`,
  `Language`.`flag` FROM `my_im93`.`animes` AS `Anime` LEFT JOIN
  `my_im93`.`languages` AS `Language` ON (`Anime`.`language_id` =
  `Language`.`id`) WHERE 1 = 1 LIMIT 20           0       0       0
  2       SELECT COUNT(*) AS `count` FROM `my_im93`.`animes` AS `Anime` LEFT
  JOIN `my_im93`.`languages` AS `Language` ON (`Anime`.`language_id` =
  `Language`.`id`) WHERE 1 = 1            1       1       0
  (forum) 0 query took ms Nr      Query   Error   Affected        Num. rows
        Took (ms)

  As you can see queries are not modified :S

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

-- 
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: My Behavior seems to be not attached to model.... :S

2012-02-05 Thread Mattia Manzati
D'oh, my fault. xD
Thanks again for your help and sorry for my noob errors, I was sure
that it was actAs and not actsAs. xD

Thanks again

On 5 Feb, 10:10, Tilen Majerle tilen.maje...@gmail.com wrote:
 emm...look at your model :)
 property for behaviors is act*s*As, not actAs :)
 --
 Lep pozdrav, Tilen Majerlehttp://majerle.eu

 2012/2/5 Mattia Manzati manzat...@gmail.com







  Sorry, wrong typed in gist, but in my folders it's ok ...but it
  stil does'nt load my behavior :S

  Matt93.

  On 5 Feb, 10:06, Tilen Majerle tilen.maje...@gmail.com wrote:
   github gist says that behavior is located in
   app\Model\Beahvior\OwnableBehavior.php
   #
 https://gist.github.com/1744216#file_app%5Cmodel%5Cbeahvior%5Cownable...

   You have Be*ah*vior instead of Be*ha*vior :)

   --
   Lep pozdrav, Tilen Majerlehttp://majerle.eu

   2012/2/5 Mattia Manzati manzat...@gmail.com

Hi all! I have a problem when creating my own Behaviors. I have
attached it with actAs, but it seems that it is not attached to my
model because it does'nt trigger neither a print_r() or modify the SQL
Query... My Code:https://gist.github.com/1744216

(default) 2 queries took 0 ms Nr        Query   Error   Affected
 Num. rows       Took
(ms)
1       SELECT `Anime`.`id`, `Anime`.`user_id`, `Anime`.`approved_by`,
`Anime`.`language_id`, `Anime`.`name`, `Anime`.`created`,
`Anime`.`modified`, `Language`.`id`, `Language`.`name`,
`Language`.`flag` FROM `my_im93`.`animes` AS `Anime` LEFT JOIN
`my_im93`.`languages` AS `Language` ON (`Anime`.`language_id` =
`Language`.`id`) WHERE 1 = 1 LIMIT 20           0       0       0
2       SELECT COUNT(*) AS `count` FROM `my_im93`.`animes` AS `Anime`
  LEFT
JOIN `my_im93`.`languages` AS `Language` ON (`Anime`.`language_id` =
`Language`.`id`) WHERE 1 = 1            1       1       0
(forum) 0 query took ms Nr      Query   Error   Affected        Num.
  rows
      Took (ms)

As you can see queries are not modified :S

--
Our newest site for the community: CakePHP Video Tutorials
   http://tv.cakephp.org
Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
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

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

-- 
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: 2.1 Console: Class 'AppShell' not found

2012-02-05 Thread euromark
@sam
yeah, you are right
the `Shell` still is in Console
but the AppShell has moved to Console/Command

:) ok, now thats sorted out - thx


On 5 Feb., 02:26, Sam Sherlock sam.sherl...@gmail.com wrote:
 remove the copy from the cake lib
 place it in your app
 mine looks like 
 thishttps://github.com/cakephp/cakephp/blob/2.1/app/Console/Command/AppSh...

 notice `App::uses('Shell', 'Console');`

 for me on its working as the book informs
  - S

 On 4 February 2012 20:59, heohni heidi.anselstet...@consultingteam.dewrote:







  sorry:

  error was:  D:\SVN-Homes\PHP\trunk\cake2.1\lib\Cake\Console\Command
  \BakeShell.php on line 36

  and I copied the AppShell.php from
  D:\SVN-Homes\PHP\trunk\cake2.1\app\Console\Command\AppShell.php
  to
  D:\SVN-Homes\PHP\trunk\cake2.1\lib\Cake\Console\Command\AppShell.php

  But I stll get the same error...

  On 4 Feb., 21:45, heohni heidi.anselstet...@consultingteam.de wrote:
   Even with this:
   // app/Console/Command/AppShell.php
   //App::uses('Shell', 'Console');
   App::uses('Shell', 'Console/Command');

   I get still the same error on 'cake bake'

   On 4 Feb., 20:45, euromark dereurom...@googlemail.com wrote:

although the last one (Shell) seems to be wrong in the book!

it is supposed to be now:

App::uses('Shell', 'Console/Command');
class AppShell extends Shell {}

On 4 Feb., 20:44, euromark dereurom...@googlemail.com wrote:

 but that's actually documented:
 http://book.cakephp.org/2.0/en/appendices/2-1-migration-guide.html

 On 4 Feb., 20:43, euromark dereurom...@googlemail.com wrote:

  AppShell as well as AppController, AppModel etc is required to be
  placed in your app now.
  so it must exist there (/APP/Console/Command/AppShell.php) and
  doesnt
  fall back to the core one anymore

  On 4 Feb., 20:38, heohni heidi.anselstet...@consultingteam.de
  wrote:

   Hi,

   after downloading the V2.1 and calling first time the 'cake
  bake' in
   the console I get this error:
   PHP Fatal error:  Class 'AppShell' not found in
  D:\SVN-Homes\PHP\trunk
   \cake2.1\l
   ib\Cake\Console\Command\BakeShell.php on line 36

   If I do the same with the V2.04 all works fine from folder
  /cake2/
   And of course I changed the PATH variable...

   Does anybody discovered the same?

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

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


[no subject]

2012-02-05 Thread Manouchehr Boshaq
hi
first i'm member of group but i cant post to moderator .
second:
i have a table for storing course data. any course has 1 or more
prerequisites of courses.
how can i relate HABTM table with itself.

thanks

-- 
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: 2.1 Console: Class 'AppShell' not found

2012-02-05 Thread heohni
The only place where I have now the AppShell.php is here:
D:\SVN-Homes\PHP\trunk\cake2.1\app\Console\Command\AppShell.php

Like it was before when I downloaded the V2.1 and extracted it.
But I still get the same error on 'cake bake'

So please, what wrong with me?



On 5 Feb., 02:26, Sam Sherlock sam.sherl...@gmail.com wrote:
 remove the copy from the cake lib
 place it in your app
 mine looks like 
 thishttps://github.com/cakephp/cakephp/blob/2.1/app/Console/Command/AppSh...

 notice `App::uses('Shell', 'Console');`

 for me on its working as the book informs
  - S

 On 4 February 2012 20:59, heohni heidi.anselstet...@consultingteam.dewrote:







  sorry:

  error was:  D:\SVN-Homes\PHP\trunk\cake2.1\lib\Cake\Console\Command
  \BakeShell.php on line 36

  and I copied the AppShell.php from
  D:\SVN-Homes\PHP\trunk\cake2.1\app\Console\Command\AppShell.php
  to
  D:\SVN-Homes\PHP\trunk\cake2.1\lib\Cake\Console\Command\AppShell.php

  But I stll get the same error...

  On 4 Feb., 21:45, heohni heidi.anselstet...@consultingteam.de wrote:
   Even with this:
   // app/Console/Command/AppShell.php
   //App::uses('Shell', 'Console');
   App::uses('Shell', 'Console/Command');

   I get still the same error on 'cake bake'

   On 4 Feb., 20:45, euromark dereurom...@googlemail.com wrote:

although the last one (Shell) seems to be wrong in the book!

it is supposed to be now:

App::uses('Shell', 'Console/Command');
class AppShell extends Shell {}

On 4 Feb., 20:44, euromark dereurom...@googlemail.com wrote:

 but that's actually documented:
 http://book.cakephp.org/2.0/en/appendices/2-1-migration-guide.html

 On 4 Feb., 20:43, euromark dereurom...@googlemail.com wrote:

  AppShell as well as AppController, AppModel etc is required to be
  placed in your app now.
  so it must exist there (/APP/Console/Command/AppShell.php) and
  doesnt
  fall back to the core one anymore

  On 4 Feb., 20:38, heohni heidi.anselstet...@consultingteam.de
  wrote:

   Hi,

   after downloading the V2.1 and calling first time the 'cake
  bake' in
   the console I get this error:
   PHP Fatal error:  Class 'AppShell' not found in
  D:\SVN-Homes\PHP\trunk
   \cake2.1\l
   ib\Cake\Console\Command\BakeShell.php on line 36

   If I do the same with the V2.04 all works fine from folder
  /cake2/
   And of course I changed the PATH variable...

   Does anybody discovered the same?

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

-- 
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: 2.1 Console: Class 'AppShell' not found

2012-02-05 Thread euromark
thats a damn good question^^

but besides that - I just had to do the very same thing with a fresh
2.1 and a new app
bake complained about the missing file
I created it in the same location just like you did. and everything
worked. in less than 1 minute.

so it might still be wrong what you put into that file
after all the docs are correct about what to put in it.



On 5 Feb., 16:08, heohni heidi.anselstet...@consultingteam.de wrote:
 The only place where I have now the AppShell.php is here:
 D:\SVN-Homes\PHP\trunk\cake2.1\app\Console\Command\AppShell.php

 Like it was before when I downloaded the V2.1 and extracted it.
 But I still get the same error on 'cake bake'

 So please, what wrong with me?

 On 5 Feb., 02:26, Sam Sherlock sam.sherl...@gmail.com wrote:







  remove the copy from the cake lib
  place it in your app
  mine looks like 
  thishttps://github.com/cakephp/cakephp/blob/2.1/app/Console/Command/AppSh...

  notice `App::uses('Shell', 'Console');`

  for me on its working as the book informs
   - S

  On 4 February 2012 20:59, heohni 
  heidi.anselstet...@consultingteam.dewrote:

   sorry:

   error was:  D:\SVN-Homes\PHP\trunk\cake2.1\lib\Cake\Console\Command
   \BakeShell.php on line 36

   and I copied the AppShell.php from
   D:\SVN-Homes\PHP\trunk\cake2.1\app\Console\Command\AppShell.php
   to
   D:\SVN-Homes\PHP\trunk\cake2.1\lib\Cake\Console\Command\AppShell.php

   But I stll get the same error...

   On 4 Feb., 21:45, heohni heidi.anselstet...@consultingteam.de wrote:
Even with this:
// app/Console/Command/AppShell.php
//App::uses('Shell', 'Console');
App::uses('Shell', 'Console/Command');

I get still the same error on 'cake bake'

On 4 Feb., 20:45, euromark dereurom...@googlemail.com wrote:

 although the last one (Shell) seems to be wrong in the book!

 it is supposed to be now:

 App::uses('Shell', 'Console/Command');
 class AppShell extends Shell {}

 On 4 Feb., 20:44, euromark dereurom...@googlemail.com wrote:

  but that's actually documented:
  http://book.cakephp.org/2.0/en/appendices/2-1-migration-guide.html

  On 4 Feb., 20:43, euromark dereurom...@googlemail.com wrote:

   AppShell as well as AppController, AppModel etc is required to be
   placed in your app now.
   so it must exist there (/APP/Console/Command/AppShell.php) and
   doesnt
   fall back to the core one anymore

   On 4 Feb., 20:38, heohni heidi.anselstet...@consultingteam.de
   wrote:

Hi,

after downloading the V2.1 and calling first time the 'cake
   bake' in
the console I get this error:
PHP Fatal error:  Class 'AppShell' not found in
   D:\SVN-Homes\PHP\trunk
\cake2.1\l
ib\Cake\Console\Command\BakeShell.php on line 36

If I do the same with the V2.04 all works fine from folder
   /cake2/
And of course I changed the PATH variable...

Does anybody discovered the same?

   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
   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

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

2012-02-05 Thread Stephen Speakman

Hi Manouchehr

You should be able to use a HasMany / BelongsTo relationship.

Courses belongsTo CoursePrerequisites
CoursePrerequisites HasMany Courses

This way you can have say 15 Course Prerequisites and 10 courses, some 
courses can share some of the same prerequisites.


On 05/02/2012 14:25, Manouchehr Boshaq wrote:

hi
first i'm member of group but i cant post to moderator .
second:
i have a table for storing course data. any course has 1 or more 
prerequisites of courses.

how can i relate HABTM table with itself.

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


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


Using Join Tables in Cakephp - result in view.ctp

2012-02-05 Thread TheMuller
Hi,

I have looked, search and founded, but not the answer to my questions:
How do I get the result of my join table in my view.ctp? Am I doing
something wrong?

I have followed some guides from bakery and other blogs, and created a
setup like shown below. But why does the error in view.ctp say:
Notice (8): Undefined index:  name

Code:

models/sportsgroup.php
?php
class SportsGroup extends Appmodel {
var $name = 'SportsGroup';
}
?

controllers/sports_groups_controllers.php
?php

class SportsGroupsController extends AppController {
var $helpers = array ('Html', 'Form', 'Js' = array('Jquery'),
'Javascript', 'GoogleMapView');
var $name = 'SportsGroups';

function index() {
  $this-SportsGroup-recursive = 0;
  $this-set('sportsgroups', $this-SportsGroup-find('all',
array('joins' = array(
array(
'table' = 'port_groups_entity',
'alias' = 'GroupsEntity',
'type' = 'inner',
'conditions'= array('SportsGroup.group_id =
GroupsEntity.guid')
)
)
)));
  $this-set('title_for_layout', 'Sportsclubs online');

}
function view($url = null) {
if (!$url) {
$this-Session-setFlash('Invalid id for Post.');
$this-redirect('/sportsclub/');
}
$this-set('post', $this-SportsGroup-findByUrl($url));
}
}

?

view/sportsgroups/index.ctp (or view.ctp)
?php foreach ($sportsgroups as $post): ?
?php echo $post['SportsGroup']['title']? (it catches this one)
?php echo $post['SportsGroup']['name']? (but not this one)
?php endforeach; ?

view/sportsgroups/view.ctp
?php echo $post['SportsGroup']['title']? (it catches this one)
?php echo $post['SportsGroup']['name']? (but not this one)

The database table are like:
sports_groups: id | group_id | title
groups_entity: guid | name

Please help me, I used 2-3 days on this one..

/TheMuller

-- 
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: Using Join Tables in Cakephp - result in view.ctp

2012-02-05 Thread Stephen Speakman

Hi

I may not know the answer to your question but shouldn't your model be 
named:


sport_group.php and SportGroup extends AppModel ?

port_groups_entity table should be named port_group_entities   
PortGroupEntities

I would personally correct all the filenames, class names and $this-Model lines etc 
to represent proper CakePHP conventions, then I would use 
pr($this-SportGroup-findByUrl($url)); etc to view the results retrieved from the 
query...

If name isn't in there maybe it's an error with your MySQL table? Maybe check 
recursive? (Apologies if I missed any info, my thunderbird client isn't 
threading mail list topics =/)

Kind Regards
 Stephen


On 05/02/2012 17:18, TheMuller wrote:

Hi,

I have looked, search and founded, but not the answer to my questions:
How do I get the result of my join table in my view.ctp? Am I doing
something wrong?

I have followed some guides from bakery and other blogs, and created a
setup like shown below. But why does the error in view.ctp say:
Notice (8): Undefined index:  name

Code:

models/sportsgroup.php
?php
class SportsGroup extends Appmodel {
 var $name = 'SportsGroup';
}
?

controllers/sports_groups_controllers.php
?php

class SportsGroupsController extends AppController {
 var $helpers = array ('Html', 'Form', 'Js' =  array('Jquery'),
'Javascript', 'GoogleMapView');
 var $name = 'SportsGroups';

 function index() {
   $this-SportsGroup-recursive = 0;
   $this-set('sportsgroups', $this-SportsGroup-find('all',
array('joins' =  array(
 array(
 'table' =  'port_groups_entity',
 'alias' =  'GroupsEntity',
 'type' =  'inner',
 'conditions'=  array('SportsGroup.group_id =
GroupsEntity.guid')
 )
 )
 )));
   $this-set('title_for_layout', 'Sportsclubs online');

 }
 function view($url = null) {
 if (!$url) {
 $this-Session-setFlash('Invalid id for Post.');
 $this-redirect('/sportsclub/');
 }
 $this-set('post', $this-SportsGroup-findByUrl($url));
 }
}

?

view/sportsgroups/index.ctp (or view.ctp)
?php foreach ($sportsgroups as $post): ?
?php echo $post['SportsGroup']['title']?  (it catches this one)
?php echo $post['SportsGroup']['name']?  (but not this one)
?php endforeach; ?

view/sportsgroups/view.ctp
?php echo $post['SportsGroup']['title']?  (it catches this one)
?php echo $post['SportsGroup']['name']?  (but not this one)

The database table are like:
sports_groups: id | group_id | title
groups_entity: guid | name

Please help me, I used 2-3 days on this one..

/TheMuller



--
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: Using Join Tables in Cakephp - result in view.ctp

2012-02-05 Thread Team Kemster
Hi Stephen,

Thank you for your answer. 

Well I would say you are right, if it wasn't for that I am able to
use both the tables for it's self. But joining them gives the problems.

I also tried to use some examples on binding the tables with a model for both 
tables, but no luck.

Yes, the table has name for a column (tables shown in first mail). 

Is the pull out in the ctp files correct?

/TheMuller

Den 05/02/2012 kl. 18.54 skrev Stephen Speakman 
step...@ninjacodermonkey.co.uk:

 Hi
 
 I may not know the answer to your question but shouldn't your model be named:
 
 sport_group.php and SportGroup extends AppModel ?
 
 port_groups_entity table should be named port_group_entities   
 PortGroupEntities
 
 I would personally correct all the filenames, class names and $this-Model 
 lines etc to represent proper CakePHP conventions, then I would use 
 pr($this-SportGroup-findByUrl($url)); etc to view the results retrieved 
 from the query...
 
 If name isn't in there maybe it's an error with your MySQL table? Maybe check 
 recursive? (Apologies if I missed any info, my thunderbird client isn't 
 threading mail list topics =/)
 
 Kind Regards
 Stephen
 
 
 On 05/02/2012 17:18, TheMuller wrote:
 Hi,
 
 I have looked, search and founded, but not the answer to my questions:
 How do I get the result of my join table in my view.ctp? Am I doing
 something wrong?
 
 I have followed some guides from bakery and other blogs, and created a
 setup like shown below. But why does the error in view.ctp say:
 Notice (8): Undefined index:  name
 
 Code:
 
 models/sportsgroup.php
 ?php
 class SportsGroup extends Appmodel {
 var $name = 'SportsGroup';
 }
 ?
 
 controllers/sports_groups_controllers.php
 ?php
 
 class SportsGroupsController extends AppController {
 var $helpers = array ('Html', 'Form', 'Js' =  array('Jquery'),
 'Javascript', 'GoogleMapView');
 var $name = 'SportsGroups';
 
 function index() {
   $this-SportsGroup-recursive = 0;
   $this-set('sportsgroups', $this-SportsGroup-find('all',
 array('joins' =  array(
 array(
 'table' =  'port_groups_entity',
 'alias' =  'GroupsEntity',
 'type' =  'inner',
 'conditions'=  array('SportsGroup.group_id =
 GroupsEntity.guid')
 )
 )
 )));
   $this-set('title_for_layout', 'Sportsclubs online');
 
 }
 function view($url = null) {
 if (!$url) {
 $this-Session-setFlash('Invalid id for Post.');
 $this-redirect('/sportsclub/');
 }
 $this-set('post', $this-SportsGroup-findByUrl($url));
 }
 }
 
 ?
 
 view/sportsgroups/index.ctp (or view.ctp)
 ?php foreach ($sportsgroups as $post): ?
 ?php echo $post['SportsGroup']['title']?  (it catches this one)
 ?php echo $post['SportsGroup']['name']?  (but not this one)
 ?php endforeach; ?
 
 view/sportsgroups/view.ctp
 ?php echo $post['SportsGroup']['title']?  (it catches this one)
 ?php echo $post['SportsGroup']['name']?  (but not this one)
 
 The database table are like:
 sports_groups: id | group_id | title
 groups_entity: guid | name
 
 Please help me, I used 2-3 days on this one..
 
 /TheMuller
 
 
 -- 
 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

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


Flash message after render not showing

2012-02-05 Thread Tony
In my code (CakePHP v2.0.5) , I am doing the following:

public function invite() {
...
$this-Session-setFlash(__('The invitation has 
been created.'));

$this-set('email',$this-request-data['Invite']['email']);
$this-render('welcome');
...
}

The problem is that when welcome is rendered, the flash message is
not showing up until the user goes to the page following the content
rendered by the invite action.

In other words, the user submits their information and gets the
welcome content, they don't see the flash message. When the user
clicks on a link and goes to the next page, the 'The invitation has
been created.' flash message appears.

Both the welcome content and the page they go to after use the same
layout that uses the echo $this-Session-flash(); code.

Thanks.

-- 
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: Using Join Tables in Cakephp - result in view.ctp

2012-02-05 Thread Justin Edwards
There is a typo here. Do you have a table named port_groups_entity,
sport_groups_entities?  The errors should be followable.
   array(
   'table' = 'port_groups_entity',

You also seem to be  using some odd names on your tables.  I try to always
avoid using two plurals unless that table is a join table (habtm) for two
other tables.   If I do has association through tables, I name that table
logically for the relationship that it has.   Such as students, classrooms,
has a join table enrollments that has extra data based the many to many.

You should debug($var) on all of your variables to see what is actually
there.


On Sun, Feb 5, 2012 at 1:41 PM, Team Kemster
kundeservicekems...@gmail.comwrote:

 Hi Stephen,

 Thank you for your answer.

 Well I would say you are right, if it wasn't for that I am able to
 use both the tables for it's self. But joining them gives the problems.

 I also tried to use some examples on binding the tables with a model for
 both tables, but no luck.

 Yes, the table has name for a column (tables shown in first mail).

 Is the pull out in the ctp files correct?

 /TheMuller

 Den 05/02/2012 kl. 18.54 skrev Stephen Speakman 
 step...@ninjacodermonkey.co.uk:

  Hi
 
  I may not know the answer to your question but shouldn't your model be
 named:
 
  sport_group.php and SportGroup extends AppModel ?
 
  port_groups_entity table should be named port_group_entities  
 PortGroupEntities
 
  I would personally correct all the filenames, class names and
 $this-Model lines etc to represent proper CakePHP conventions, then I
 would use pr($this-SportGroup-findByUrl($url)); etc to view the results
 retrieved from the query...
 
  If name isn't in there maybe it's an error with your MySQL table? Maybe
 check recursive? (Apologies if I missed any info, my thunderbird client
 isn't threading mail list topics =/)
 
  Kind Regards
  Stephen
 
 
  On 05/02/2012 17:18, TheMuller wrote:
  Hi,
 
  I have looked, search and founded, but not the answer to my questions:
  How do I get the result of my join table in my view.ctp? Am I doing
  something wrong?
 
  I have followed some guides from bakery and other blogs, and created a
  setup like shown below. But why does the error in view.ctp say:
  Notice (8): Undefined index:  name
 
  Code:
 
  models/sportsgroup.php
  ?php
  class SportsGroup extends Appmodel {
  var $name = 'SportsGroup';
  }
  ?
 
  controllers/sports_groups_controllers.php
  ?php
 
  class SportsGroupsController extends AppController {
  var $helpers = array ('Html', 'Form', 'Js' =  array('Jquery'),
  'Javascript', 'GoogleMapView');
  var $name = 'SportsGroups';
 
  function index() {
$this-SportsGroup-recursive = 0;
$this-set('sportsgroups', $this-SportsGroup-find('all',
  array('joins' =  array(
  array(
  'table' =  'port_groups_entity',
  'alias' =  'GroupsEntity',
  'type' =  'inner',
  'conditions'=  array('SportsGroup.group_id =
  GroupsEntity.guid')
  )
  )
  )));
$this-set('title_for_layout', 'Sportsclubs online');
 
  }
  function view($url = null) {
  if (!$url) {
  $this-Session-setFlash('Invalid id for Post.');
  $this-redirect('/sportsclub/');
  }
  $this-set('post', $this-SportsGroup-findByUrl($url));
  }
  }
 
  ?
 
  view/sportsgroups/index.ctp (or view.ctp)
  ?php foreach ($sportsgroups as $post): ?
  ?php echo $post['SportsGroup']['title']?  (it catches this one)
  ?php echo $post['SportsGroup']['name']?  (but not this one)
  ?php endforeach; ?
 
  view/sportsgroups/view.ctp
  ?php echo $post['SportsGroup']['title']?  (it catches this one)
  ?php echo $post['SportsGroup']['name']?  (but not this one)
 
  The database table are like:
  sports_groups: id | group_id | title
  groups_entity: guid | name
 
  Please help me, I used 2-3 days on this one..
 
  /TheMuller
 
 
  --
  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

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


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

CakePHP 2.0.6 released

2012-02-05 Thread José Lorenzo


The CakePHP core team is proud to announce the immediate availability of 
CakePHP 2.0.6 [1]. This will hopefully be the last minor version released 
for the 2.0 branch if no important changes are needed to be done before we 
get version 2.1 stable. After this one all bugfixes and security patches 
will be done in the 2.1 branch, which is 100% compatible with this one.

In total, there were over 90 commits and 45 issues have been resolved since 
2.0.5. A complete list of the changes can be viewed on the changelogs page 
[2], but a quick summary of changes that made it into 2.0.6:

   - Updating minimum PHP version requirement to 5.2.8 due to PHP bugs 
   #44251 and #45748
   - Model does not call calculate() and expression() method on the 
   datasource if it does not implements it.
   - SqlServer views can be mapped with models as you can do with normal 
   tables.
   - Fixed issue where session would always be regenerated regardeless of 
   configs set.
   - Not requiring a database connection for Models having $useTable = 
   false when combined with the FormHelper
   - Not throwing errors when instantiating model classes with no 
   constructor using the ClassRegistry
   - Fixing memory leaks in some Database drivers
   - TextHelper::excerpt() now works as documented.
   - Defaulting back to using PHP_SELF to get current url, this solves 
   several issues in shared hosts

We are almost done with the 2.1 release and you can expect a stable release 
within a couple of weeks. 2.1 will be fully backwards compatible with 2.0, 
and add a number of useful features. For a list of what is complete, and 
what is planned for 2.1, see the roadmap [3] and the in-progress 2.1 
migration guide [4]

Thanks once again to the excellent CakePHP community, for all of the 
outstanding work. Without your contributions and love there would be no 
CakePHP.

   - Download 2.0.6 [1] View the changelog [2]

Links
   
   - [1] http://github.com/cakephp/cakephp/zipball/2.0.6
   - [2] http://cakephp.org/changelogs/2.0.6
   - [3] http://cakephp.lighthouseapp.com/projects/42648/development-roadmap
   - [4] 
   
https://github.com/cakephp/docs/blob/2.1/en/appendices/2-1-migration-guide.rst

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


How does $this-request-is('post') works?

2012-02-05 Thread Fernando Nery Filho
Hello everyone!

I'm having some trouble with the $this-request-is('post') object and
hope I can get some answers here...

In my controller I have the following:

public function movie($action = list, $id = ) {
if ($action == single) {
if ($this-request-is('post')) {
// Saves the record
} elseif ($id != ) {
// Load record info
} else {
// Load blank form
}

// Load other informations...

$this-render('movie');
}
}

When i load a blank form at admin/movie/single and try to submit the
form it works just fine and my record is saved.
But, when i load a record using admin/filme/single/1 and try to update
it, $this-request-is('post') returns false, and nothing happens...

What am I doing wrong here?

-- 
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: 2.1 Console: Class 'AppShell' not found

2012-02-05 Thread Sam Sherlock
AppShell back in core
http://cakephp.lighthouseapp.com/projects/42648/tickets/2546-appshellphp-missing-in-cake21

 - S




On 5 February 2012 15:20, euromark dereurom...@googlemail.com wrote:

 thats a damn good question^^

 but besides that - I just had to do the very same thing with a fresh
 2.1 and a new app
 bake complained about the missing file
 I created it in the same location just like you did. and everything
 worked. in less than 1 minute.

 so it might still be wrong what you put into that file
 after all the docs are correct about what to put in it.



 On 5 Feb., 16:08, heohni heidi.anselstet...@consultingteam.de wrote:
  The only place where I have now the AppShell.php is here:
  D:\SVN-Homes\PHP\trunk\cake2.1\app\Console\Command\AppShell.php
 
  Like it was before when I downloaded the V2.1 and extracted it.
  But I still get the same error on 'cake bake'
 
  So please, what wrong with me?
 
  On 5 Feb., 02:26, Sam Sherlock sam.sherl...@gmail.com wrote:
 
 
 
 
 
 
 
   remove the copy from the cake lib
   place it in your app
   mine looks like thishttps://
 github.com/cakephp/cakephp/blob/2.1/app/Console/Command/AppSh...
 
   notice `App::uses('Shell', 'Console');`
 
   for me on its working as the book informs
- S
 
   On 4 February 2012 20:59, heohni heidi.anselstet...@consultingteam.de
 wrote:
 
sorry:
 
error was:  D:\SVN-Homes\PHP\trunk\cake2.1\lib\Cake\Console\Command
\BakeShell.php on line 36
 
and I copied the AppShell.php from
D:\SVN-Homes\PHP\trunk\cake2.1\app\Console\Command\AppShell.php
to
D:\SVN-Homes\PHP\trunk\cake2.1\lib\Cake\Console\Command\AppShell.php
 
But I stll get the same error...
 
On 4 Feb., 21:45, heohni heidi.anselstet...@consultingteam.de
 wrote:
 Even with this:
 // app/Console/Command/AppShell.php
 //App::uses('Shell', 'Console');
 App::uses('Shell', 'Console/Command');
 
 I get still the same error on 'cake bake'
 
 On 4 Feb., 20:45, euromark dereurom...@googlemail.com wrote:
 
  although the last one (Shell) seems to be wrong in the book!
 
  it is supposed to be now:
 
  App::uses('Shell', 'Console/Command');
  class AppShell extends Shell {}
 
  On 4 Feb., 20:44, euromark dereurom...@googlemail.com wrote:
 
   but that's actually documented:
   http://book.cakephp.org/2.0/en/appendices/2-1-migration-guide.html
 
   On 4 Feb., 20:43, euromark dereurom...@googlemail.com wrote:
 
AppShell as well as AppController, AppModel etc is required
 to be
placed in your app now.
so it must exist there (/APP/Console/Command/AppShell.php)
 and
doesnt
fall back to the core one anymore
 
On 4 Feb., 20:38, heohni 
 heidi.anselstet...@consultingteam.de
wrote:
 
 Hi,
 
 after downloading the V2.1 and calling first time the 'cake
bake' in
 the console I get this error:
 PHP Fatal error:  Class 'AppShell' not found in
D:\SVN-Homes\PHP\trunk
 \cake2.1\l
 ib\Cake\Console\Command\BakeShell.php on line 36
 
 If I do the same with the V2.04 all works fine from folder
/cake2/
 And of course I changed the PATH variable...
 
 Does anybody discovered the same?
 
--
Our newest site for the community: CakePHP Video Tutorials
   http://tv.cakephp.org
Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
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

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


-- 
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: How does $this-request-is('post') works?

2012-02-05 Thread dreamingmind
Is that supposed to be isPost() ?

http://book.cakephp.org/1.3/en/view/1293/Request-Type-Detection

Don

On Feb 5, 4:22 pm, Fernando Nery Filho fnfi...@gmail.com wrote:
 Hello everyone!

 I'm having some trouble with the $this-request-is('post') object and
 hope I can get some answers here...

 In my controller I have the following:

 public function movie($action = list, $id = ) {
         if ($action == single) {
                 if ($this-request-is('post')) {
                         // Saves the record
                 } elseif ($id != ) {
                         // Load record info
                 } else {
                         // Load blank form
                 }

                 // Load other informations...

                 $this-render('movie');
         }

 }

 When i load a blank form at admin/movie/single and try to submit the
 form it works just fine and my record is saved.
 But, when i load a record using admin/filme/single/1 and try to update
 it, $this-request-is('post') returns false, and nothing happens...

 What am I doing wrong here?

-- 
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: How does $this-request-is('post') works?

2012-02-05 Thread dreamingmind
Well, I see I'm living in a time warp. Ignore the backward ways of
this coding-hick.
D

On Feb 5, 7:23 pm, dreamingmind dreamingmin...@gmail.com wrote:
 Is that supposed to be isPost() ?

 http://book.cakephp.org/1.3/en/view/1293/Request-Type-Detection

 Don

 On Feb 5, 4:22 pm, Fernando Nery Filho fnfi...@gmail.com wrote:







  Hello everyone!

  I'm having some trouble with the $this-request-is('post') object and
  hope I can get some answers here...

  In my controller I have the following:

  public function movie($action = list, $id = ) {
          if ($action == single) {
                  if ($this-request-is('post')) {
                          // Saves the record
                  } elseif ($id != ) {
                          // Load record info
                  } else {
                          // Load blank form
                  }

                  // Load other informations...

                  $this-render('movie');
          }

  }

  When i load a blank form at admin/movie/single and try to submit the
  form it works just fine and my record is saved.
  But, when i load a record using admin/filme/single/1 and try to update
  it, $this-request-is('post') returns false, and nothing happens...

  What am I doing wrong here?

-- 
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: How does $this-request-is('post') works?

2012-02-05 Thread dreamingmind
The two URLs differ. One calls movie/single the other filme/single.
Are they both actually routing to this same code?
Don

On Feb 5, 4:22 pm, Fernando Nery Filho fnfi...@gmail.com wrote:
 Hello everyone!

 I'm having some trouble with the $this-request-is('post') object and
 hope I can get some answers here...

 In my controller I have the following:

 public function movie($action = list, $id = ) {
         if ($action == single) {
                 if ($this-request-is('post')) {
                         // Saves the record
                 } elseif ($id != ) {
                         // Load record info
                 } else {
                         // Load blank form
                 }

                 // Load other informations...

                 $this-render('movie');
         }

 }

 When i load a blank form at admin/movie/single and try to submit the
 form it works just fine and my record is saved.
 But, when i load a record using admin/filme/single/1 and try to update
 it, $this-request-is('post') returns false, and nothing happens...

 What am I doing wrong here?

-- 
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: How does $this-request-is('post') works?

2012-02-05 Thread Thiago Belem
On CakePHP 1.3 it's

*isPost()*

on 2.0+ is:
*
*
*is('post')*

Cya,
--
***Thiago Belem*
Desenvolvedor
Rio de Janeiro - RJ - Brasil

+55 (21) 8865.9250
thiagobelem.net
cont...@thiagobelem.net

*Skype / gTalk **»* thiago.belem.web
*LinkedIn* *»* br.linkedin.com/in/thiagobelem/pt*
Assando Sites*, curso de CakePHP *»* assando-sites.com.br


2012/2/6 dreamingmind dreamingmin...@gmail.com

 Is that supposed to be isPost() ?

 http://book.cakephp.org/1.3/en/view/1293/Request-Type-Detection

 Don

 On Feb 5, 4:22 pm, Fernando Nery Filho fnfi...@gmail.com wrote:
  Hello everyone!
 
  I'm having some trouble with the $this-request-is('post') object and
  hope I can get some answers here...
 
  In my controller I have the following:
 
  public function movie($action = list, $id = ) {
  if ($action == single) {
  if ($this-request-is('post')) {
  // Saves the record
  } elseif ($id != ) {
  // Load record info
  } else {
  // Load blank form
  }
 
  // Load other informations...
 
  $this-render('movie');
  }
 
  }
 
  When i load a blank form at admin/movie/single and try to submit the
  form it works just fine and my record is saved.
  But, when i load a record using admin/filme/single/1 and try to update
  it, $this-request-is('post') returns false, and nothing happens...
 
  What am I doing wrong here?

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


-- 
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: Using Join Tables in Cakephp - result in view.ctp

2012-02-05 Thread Team Kemster
Well I am joining a script with the table name port_group_entity, so it is 
not possible to change that table.

When I make an error in the table name, the error message shows a totally 
correct join query (except the table name of course). The only thing that is 
bothering me is the end WHERE 1=1. Why is that coming?

/TheMuller

Den 05/02/2012 kl. 23.13 skrev Justin Edwards justinledwa...@gmail.com:

 There is a typo here. Do you have a table named port_groups_entity, 
 sport_groups_entities?  The errors should be followable.
array(
'table' = 'port_groups_entity',
 
 You also seem to be  using some odd names on your tables.  I try to always 
 avoid using two plurals unless that table is a join table (habtm) for two 
 other tables.   If I do has association through tables, I name that table 
 logically for the relationship that it has.   Such as students, classrooms, 
 has a join table enrollments that has extra data based the many to many.  
 
 You should debug($var) on all of your variables to see what is actually 
 there.
 
 
 On Sun, Feb 5, 2012 at 1:41 PM, Team Kemster kundeservicekems...@gmail.com 
 wrote:
 Hi Stephen,
 
 Thank you for your answer.
 
 Well I would say you are right, if it wasn't for that I am able to
 use both the tables for it's self. But joining them gives the problems.
 
 I also tried to use some examples on binding the tables with a model for both 
 tables, but no luck.
 
 Yes, the table has name for a column (tables shown in first mail).
 
 Is the pull out in the ctp files correct?
 
 /TheMuller
 
 Den 05/02/2012 kl. 18.54 skrev Stephen Speakman 
 step...@ninjacodermonkey.co.uk:
 
  Hi
 
  I may not know the answer to your question but shouldn't your model be 
  named:
 
  sport_group.php and SportGroup extends AppModel ?
 
  port_groups_entity table should be named port_group_entities   
  PortGroupEntities
 
  I would personally correct all the filenames, class names and $this-Model 
  lines etc to represent proper CakePHP conventions, then I would use 
  pr($this-SportGroup-findByUrl($url)); etc to view the results retrieved 
  from the query...
 
  If name isn't in there maybe it's an error with your MySQL table? Maybe 
  check recursive? (Apologies if I missed any info, my thunderbird client 
  isn't threading mail list topics =/)
 
  Kind Regards
  Stephen
 
 
  On 05/02/2012 17:18, TheMuller wrote:
  Hi,
 
  I have looked, search and founded, but not the answer to my questions:
  How do I get the result of my join table in my view.ctp? Am I doing
  something wrong?
 
  I have followed some guides from bakery and other blogs, and created a
  setup like shown below. But why does the error in view.ctp say:
  Notice (8): Undefined index:  name
 
  Code:
 
  models/sportsgroup.php
  ?php
  class SportsGroup extends Appmodel {
  var $name = 'SportsGroup';
  }
  ?
 
  controllers/sports_groups_controllers.php
  ?php
 
  class SportsGroupsController extends AppController {
  var $helpers = array ('Html', 'Form', 'Js' =  array('Jquery'),
  'Javascript', 'GoogleMapView');
  var $name = 'SportsGroups';
 
  function index() {
$this-SportsGroup-recursive = 0;
$this-set('sportsgroups', $this-SportsGroup-find('all',
  array('joins' =  array(
  array(
  'table' =  'port_groups_entity',
  'alias' =  'GroupsEntity',
  'type' =  'inner',
  'conditions'=  array('SportsGroup.group_id =
  GroupsEntity.guid')
  )
  )
  )));
$this-set('title_for_layout', 'Sportsclubs online');
 
  }
  function view($url = null) {
  if (!$url) {
  $this-Session-setFlash('Invalid id for Post.');
  $this-redirect('/sportsclub/');
  }
  $this-set('post', $this-SportsGroup-findByUrl($url));
  }
  }
 
  ?
 
  view/sportsgroups/index.ctp (or view.ctp)
  ?php foreach ($sportsgroups as $post): ?
  ?php echo $post['SportsGroup']['title']?  (it catches this one)
  ?php echo $post['SportsGroup']['name']?  (but not this one)
  ?php endforeach; ?
 
  view/sportsgroups/view.ctp
  ?php echo $post['SportsGroup']['title']?  (it catches this one)
  ?php echo $post['SportsGroup']['name']?  (but not this one)
 
  The database table are like:
  sports_groups: id | group_id | title
  groups_entity: guid | name
 
  Please help me, I used 2-3 days on this one..
 
  /TheMuller
 
 
  --
  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
 
 --
 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 

Re: Using Join Tables in Cakephp - result in view.ctp

2012-02-05 Thread Richard Joo
WHERE 1=1 is by default.
You will see that everywhere if you do not provide any 'conditions'

You can change that by adding 'condition' to your query list.

for example:

$subscriberName = $this-Subscriber-find('list', array('conditions'
= array('id' = $mySubscriber), 'fields' = array('name')));

then cake will put out something like SELECT name FROM Subscribers WHERE id=6

If you do this,
$organizationStatusActive   = $this-OrganizationStatus-find('list',
array('conditions' = array('OrganizationStatus.name' = 'Active'),
'fields' = array('OrganizationStatus.id')));

you will get something like

SELECT OrganizationStatus.id FROM Organizations WHERE
OrganizationStatus.name = 'Active'


Sorry if you find any errors from this reply~  had to write real
quick...   and I am not a cake expert either~


On Sun, Feb 5, 2012 at 10:20 PM, Team Kemster
kundeservicekems...@gmail.com wrote:
 Well I am joining a script with the table name port_group_entity, so it is
 not possible to change that table.

 When I make an error in the table name, the error message shows a totally
 correct join query (except the table name of course). The only thing that is
 bothering me is the end WHERE 1=1. Why is that coming?

 /TheMuller

 Den 05/02/2012 kl. 23.13 skrev Justin Edwards justinledwa...@gmail.com:

 There is a typo here. Do you have a table named port_groups_entity,
 sport_groups_entities?  The errors should be followable.
    array(
            'table' = 'port_groups_entity',

 You also seem to be  using some odd names on your tables.  I try to always
 avoid using two plurals unless that table is a join table (habtm) for two
 other tables.   If I do has association through tables, I name that table
 logically for the relationship that it has.   Such as students, classrooms,
 has a join table enrollments that has extra data based the many to many.

 You should debug($var) on all of your variables to see what is actually
 there.


 On Sun, Feb 5, 2012 at 1:41 PM, Team Kemster kundeservicekems...@gmail.com
 wrote:

 Hi Stephen,

 Thank you for your answer.

 Well I would say you are right, if it wasn't for that I am able to
 use both the tables for it's self. But joining them gives the problems.

 I also tried to use some examples on binding the tables with a model for
 both tables, but no luck.

 Yes, the table has name for a column (tables shown in first mail).

 Is the pull out in the ctp files correct?

 /TheMuller

 Den 05/02/2012 kl. 18.54 skrev Stephen Speakman
 step...@ninjacodermonkey.co.uk:

  Hi
 
  I may not know the answer to your question but shouldn't your model be
  named:
 
  sport_group.php and SportGroup extends AppModel ?
 
  port_groups_entity table should be named port_group_entities  
  PortGroupEntities
 
  I would personally correct all the filenames, class names and
  $this-Model lines etc to represent proper CakePHP conventions, then I 
  would
  use pr($this-SportGroup-findByUrl($url)); etc to view the results
  retrieved from the query...
 
  If name isn't in there maybe it's an error with your MySQL table? Maybe
  check recursive? (Apologies if I missed any info, my thunderbird client
  isn't threading mail list topics =/)
 
  Kind Regards
  Stephen
 
 
  On 05/02/2012 17:18, TheMuller wrote:
  Hi,
 
  I have looked, search and founded, but not the answer to my questions:
  How do I get the result of my join table in my view.ctp? Am I doing
  something wrong?
 
  I have followed some guides from bakery and other blogs, and created a
  setup like shown below. But why does the error in view.ctp say:
  Notice (8): Undefined index:  name
 
  Code:
 
  models/sportsgroup.php
  ?php
  class SportsGroup extends Appmodel {
      var $name = 'SportsGroup';
  }
  ?
 
  controllers/sports_groups_controllers.php
  ?php
 
  class SportsGroupsController extends AppController {
      var $helpers = array ('Html', 'Form', 'Js' =  array('Jquery'),
  'Javascript', 'GoogleMapView');
      var $name = 'SportsGroups';
 
      function index() {
        $this-SportsGroup-recursive = 0;
        $this-set('sportsgroups', $this-SportsGroup-find('all',
  array('joins' =  array(
          array(
              'table' =  'port_groups_entity',
              'alias' =  'GroupsEntity',
              'type' =  'inner',
              'conditions'=  array('SportsGroup.group_id =
  GroupsEntity.guid')
              )
          )
          )));
        $this-set('title_for_layout', 'Sportsclubs online');
 
      }
      function view($url = null) {
      if (!$url) {
          $this-Session-setFlash('Invalid id for Post.');
          $this-redirect('/sportsclub/');
      }
      $this-set('post', $this-SportsGroup-findByUrl($url));
      }
  }
 
  ?
 
  view/sportsgroups/index.ctp (or view.ctp)
  ?php foreach ($sportsgroups as $post): ?
  ?php echo $post['SportsGroup']['title']?  (it catches this one)
  ?php echo $post['SportsGroup']['name']?  (but not this one)
  ?php endforeach; ?
 
  view/sportsgroups/view.ctp
  ?php echo