Re: query

2011-11-02 Thread AD7six


On Nov 2, 12:09 am, Chris Cinelli
chris.cine...@formativelearning.com wrote:
 To clarify:
 -The login now work fine. Before it was taking 10-15 seconds to load.
 -The outsourcing team was using find on the user with recursive = 2 to
 retrieve some information to store in the session. That query was
 generating hundreds of queries. Not anymore.

Bejeezus, they used keyboards too - everybody throw away your
keyboards! They generate 100s of queries if MISused!

 - Currently the page that is loaded just after the login (we are using Auth
 now) has some information that related with other users. To render it, we
 need a query that require 10+ joins.

I get the feeling your app is using 1 tmp-table query with n joins
instead of 2-n indexable-and-indexed queries just to reduce the number
of queries to the minimum. That's not a good idea if true.

In any case there is _no_ select statement you can't generate using
find, there are times you might choose not to, but I think you/yourapp/
your team bailed early. I'll demonstrate if you show some of your sql.

AD

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

2011-11-02 Thread AD7six


On Oct 30, 9:50 am, SERKAN TURAN serkantu...@gmail.com wrote:
 Hi,
 I have an query and I could not figure it out what is the cakephp form of
 it.

 query:
 ---
 SELECT *
 FROM
   tags`
   INNER JOIN `tags_articles` ON (`tags`.`id` = `tags_articles`.`tag_id`)
   INNER JOIN `articles` ON (`tags_articles`.`article_id` = `articles`.`id`)
 WHERE
   `articles`.`isRead` = 'Not' AND
   `tags`.`id` = 3 AND
   `articles`.`status` = 'New'
 ORDER BY
   `articles`.`name` DESC
 --- 
 ---

Serkan,

Your question is almost the same as the example in the book.

See It's also possible to create an exotic association for the
purpose of creating as many joins as necessary to allow filtering, for
example:
http://book.cakephp.org/view/1044/hasAndBelongsToMany-HABTM

have a go and post a follow up if you do not succeed. Tip: search from
Article, not Tag.

AD

-- 
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: Implementing a search functionality

2011-11-02 Thread WebbedIT
@Yves: People keep recommending paginaton along with CakeDC's
searchable plugin.  If you take their advice and go and read the
associated documentation you should easily be able to figure this out
for yourself.

At present you have still not got your head around the fact that you
only need to run $this-paginate() and it returns BOTH the limited
results you requested AND supply's the paginate helper with all the
info it needs to create pagination links.

Please go back and read the very good documentation because a lot of
people have been trying to support you with this for over 3 weeks now
and you're making very little progress, even though the procedures
involved are relatively simple.

http://book.cakephp.org/view/1231/Pagination
https://github.com/CakeDC/search

HTH, Paul.

On Nov 2, 4:13 am, rchavik rcha...@gmail.com wrote:
 On Wednesday, November 2, 2011 10:29:04 AM UTC+7, Yves S. Garret wrote:

  Where should the processing happen, controller or view?

 Controller.  See:http://book.cakephp.org/view/1232/Controller-Setup

  Also, why is the second provider started with an upper-case letter?

 I assume you're referring to: $this-set('provider', $this-paginate(*
 'Provider'*, $conditions));

 See:http://api13.cakephp.org/class/controller#method-Controllerpaginate

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

2011-11-02 Thread WebbedIT
@Chris: You're openly admitting you have not looked at how CakePHP is
*supposed* to be used at all.  Before you start recommending to others
that they should just bail on major core concepts of the framework,
you should take the time to go through the cookbook.  If you did you
would quickly learn how recursive and containable work and see the
error of your previous developers ways.

What you have is an app developed by someone that did not know what
they were doing with CakePHP and possibly even with databases (pulling
our FAR too much data in one go).  You've then taken that application
over and assumed that person was using the framework correctly.

You should take the time to learn CakePHP, you will find all sorts of
goodness in the framework that you are obviously unaware of.

Good luck, Paul.

On Nov 2, 8:50 am, AD7six andydawso...@gmail.com wrote:
 On Oct 30, 9:50 am, SERKAN TURAN serkantu...@gmail.com wrote:









  Hi,
  I have an query and I could not figure it out what is the cakephp form of
  it.

  query:
  ---
  SELECT *
  FROM
    tags`
    INNER JOIN `tags_articles` ON (`tags`.`id` = `tags_articles`.`tag_id`)
    INNER JOIN `articles` ON (`tags_articles`.`article_id` = `articles`.`id`)
  WHERE
    `articles`.`isRead` = 'Not' AND
    `tags`.`id` = 3 AND
    `articles`.`status` = 'New'
  ORDER BY
    `articles`.`name` DESC
  --- 
  ---

 Serkan,

 Your question is almost the same as the example in the book.

 See It's also possible to create an exotic association for the
 purpose of creating as many joins as necessary to allow filtering, for
 example:http://book.cakephp.org/view/1044/hasAndBelongsToMany-HABTM

 have a go and post a follow up if you do not succeed. Tip: search from
 Article, not Tag.

 AD

-- 
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: ajax with cakephp 1.3

2011-11-02 Thread WebbedIT
Welcome to the group Pedro.

Please Google your question before asking things that have been asked
(many times before):
http://www.google.co.uk/search?q=cakephp+dependant+select+list

Or better still search this very group:
http://groups.google.com/group/cake-php/search?group=cake-phpq=ajax+select+listsqt_g=Search+this+group

Finding an existing answer to your query is much much faster than
posting a new one and waiting for someone to reply.

HTH, Paul.

On Nov 1, 10:17 pm, Yves S. Garret yoursurrogate...@gmail.com
wrote:
 Hi.

    Please paste your code into bin.cakephp.org and post it here.  It would
 make it easier to help you.







 On Tue, Nov 1, 2011 at 6:13 PM, pedro rojo drupal.chmi...@gmail.com wrote:
  Good evening!

  please I just created a Website and I can not understand how programmed
  two linked lists ie when selectionnne an option from a list the other list
  will automatically change to AJAX in CakePHP framework.
  I have not found cherchémais suitable solution: (
  help me if you have a solution!
  thank you for your support
  --
  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: How to get related username in view?

2011-11-02 Thread WebbedIT
@flosky
 Set up the relationships in the posts and users models and set the recursion 
 to 2 when you do the find.

No! Please don't use recursive = 2, it will pull so much unneeded deep
data.  Please take Jeremy's advice and use Containable, it is so easy
and so powerful!

His post above shows how easy it is and Cake only returns the data you
specifically ask for.

-- 
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: Implementing a search functionality

2011-11-02 Thread WebbedIT
And for proof of how easy other people find the CakeDC plugin:
http://groups.google.com/group/cake-php/browse_thread/thread/bdb93d2ec770be06

Question asked and resolved in 4 days!

HTH, Paul.

On Nov 2, 9:23 am, WebbedIT p...@webbedit.co.uk wrote:
 @Yves: People keep recommending paginaton along with CakeDC's
 searchable plugin.  If you take their advice and go and read the
 associated documentation you should easily be able to figure this out
 for yourself.

 At present you have still not got your head around the fact that you
 only need to run $this-paginate() and it returns BOTH the limited
 results you requested AND supply's the paginate helper with all the
 info it needs to create pagination links.

 Please go back and read the very good documentation because a lot of
 people have been trying to support you with this for over 3 weeks now
 and you're making very little progress, even though the procedures
 involved are relatively simple.

 http://book.cakephp.org/view/1231/Paginationhttps://github.com/CakeDC/search

 HTH, Paul.

 On Nov 2, 4:13 am, rchavik rcha...@gmail.com wrote:







  On Wednesday, November 2, 2011 10:29:04 AM UTC+7, Yves S. Garret wrote:

   Where should the processing happen, controller or view?

  Controller.  See:http://book.cakephp.org/view/1232/Controller-Setup

   Also, why is the second provider started with an upper-case letter?

  I assume you're referring to: $this-set('provider', $this-paginate(*
  'Provider'*, $conditions));

  See:http://api13.cakephp.org/class/controller#method-Controllerpaginate

-- 
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 to get related username in view?

2011-11-02 Thread flo.kl...@googlemail.com
Yeah, you are right. I was just giving the 'quick and dirty' solution ;-) 

-flosky



WebbedIT p...@webbedit.co.uk schrieb:

@flosky
 Set up the relationships in the posts and users models and set the recursion 
 to 2 when you do the find.

No! Please don't use recursive = 2, it will pull so much unneeded deep
data. Please take Jeremy's advice and use Containable, it is so easy
and so powerful!

His post above shows how easy it is and Cake only returns the data you
specifically ask for.

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


CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Mattia Manzati
Hi all! Thanks in advance for replys! :P
I have the following model:

class EpisodeRelease extends AppModel{
 public $cacheQueries = true;
 public $name = 'EpisodeRelease';
 public $primaryKey = 'id';
 public $table = 'episode_releases';
 public $hasMany = array(
 'EpisodeReleaseMirror' = array (
 'className' = 'EpisodeReleaseMirror',
 'foreignKey' = 'episode_release_id',
 'conditions' = array('EpisodeReleaseMirror.approved_by ' = 
 0),
 'order' = 'EpisodeReleaseMirror.download_count DESC'
 )
 );
 public $belongsTo = array(
 'User' = array(
 'className' = 'User',
 'foreignKey' = 'user_id'
 ),
 'EpisodeType' = array(
 'className' = 'EpisodeType',
 'foreignKey' = 'episode_type_id'
 ),
 'Anime' = array(
 'className' = 'Anime',
 'foreignKey' = 'anime_id'
 ),
 'Language' = array(
   'className' = 'Language',
   'foreignKey' = 'language_id'
 )
 );
 public $hasAndBelongsToMany = array(
 'Fansub' = array(
 'className' = 'Fansub',
 'joinTable' = 'Fansub2EpisodeRelease',
 'foreignKey' = 'episode_release_id',
 'associationForeignKey' = 'fansub_id',
 'unique' = false
 ),
 'VideoCodec' = array(
 'className' = 'VideoCodec',
 'joinTable' = 'VideoCodec2EpisodeRelease',
 'foreignKey' = 'episode_release_id',
 'associationForeignKey' = 'video_codec_id',
 'order' = 'VideoCodec.order DESC',
 'unique' = false
 )
 );
 }
 ?

 and the following code in the controller...

 function add(){
 if($this-_canAdd()){
 $this-set('animes', 
 $this-EpisodeRelease-Anime-find('list',array('fields'='name')));
 $this-set('languages', 
 $this-EpisodeRelease-Language-find('list',array('fields'='name')));
 $this-set('episodeTypes', 
 $this-EpisodeRelease-EpisodeType-find('list',array('fields'='name')));
 $this-set('fansubs', 
 $this-EpisodeRelease-Fansub-find('list',array('fields'='name','order'='Fansub.name
  
 ASC')));
 $this-set('videoCodecs', 
 $this-EpisodeRelease-VideoCodec-find('list',array('fields'='name','order' 
 = 'VideoCodec.order DESC')));
 
 if($this-request-is('post')){
 $this-request-data['EpisodeRelease']['user_id'] = 
 $this-Auth-User('user_id');
 $this-EpisodeRelease-set($this-request-data);
 if($this-EpisodeRelease-saveAll($this-request-data)){
 $this-Session-setFlash('Release aggiunta con 
 successo. Sarà visualizzabile non appena un amministratore lo avrà 
 approvato.');
 //$this-redirect(array('action'='index'));
 pr($this-request-data);
 }else{
 pr($this-request-data);
 $this-Session-setFlash('ERRORE! Compila tutti i 
 campi!');
 $this-set('similar_releases',array());
 }
 }else{
 $this-set('similar_releases',array());
 }
 }else{
 $this-Session-setFlash('Non hai i permessi necessari per 
 eseguire questa azione.');
 $this-redirect(array('action'='index'));
 }
 } 

When i press Submit the array sent to saveAll is the following:  

 Array
 (
 [EpisodeRelease] = Array
 (
 [language_id] = 1
 [anime_id] = 1
 [episode_type_id] = 1
 [number] = 2
 [name] = episode
 [user_id] = 2
 )

 [Fansub] = Array
 (
 [Fansub] = Array
 (
 [0] = 1
 )

 )

 [VideoCodec] = Array
 (
 [VideoCodec] = Array
 (
 [0] = 8
 )

 )

 )

 But it seems that HABTM relations are'nt saved why?
Thanks again! ^^ 
WebRep
Overall rating
 

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


add.ctp
Description: Binary data


index.ctp
Description: Binary data
attachment: AppController.php
attachment: EpisodeReleasesController.php
attachment: EpisodeRelease.php


Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Werner Petry Moraes
I've had some similar trouble with 2.0

turned out the fields in the DB were not the same type.
id on one table was a bigint and the foreign key on the relationship table
was a regular integer.

atenciosamente,
Werner Petry Moraes
werne...@gmail.com


On Wed, Nov 2, 2011 at 07:52, Mattia Manzati manzat...@gmail.com wrote:

 Hi all! Thanks in advance for replys! :P
 I have the following model:

 class EpisodeRelease extends AppModel{
 public $cacheQueries = true;
 public $name = 'EpisodeRelease';
 public $primaryKey = 'id';
 public $table = 'episode_releases';
 public $hasMany = array(
 'EpisodeReleaseMirror' = array (
 'className' = 'EpisodeReleaseMirror',
 'foreignKey' = 'episode_release_id',
 'conditions' = array('EpisodeReleaseMirror.approved_by ' =
 0),
 'order' = 'EpisodeReleaseMirror.download_count DESC'
 )
 );
 public $belongsTo = array(
 'User' = array(
 'className' = 'User',
 'foreignKey' = 'user_id'
 ),
 'EpisodeType' = array(
 'className' = 'EpisodeType',
 'foreignKey' = 'episode_type_id'
 ),
 'Anime' = array(
 'className' = 'Anime',
 'foreignKey' = 'anime_id'
 ),
 'Language' = array(
   'className' = 'Language',
   'foreignKey' = 'language_id'
 )
 );
 public $hasAndBelongsToMany = array(
 'Fansub' = array(
 'className' = 'Fansub',
 'joinTable' = 'Fansub2EpisodeRelease',
 'foreignKey' = 'episode_release_id',
 'associationForeignKey' = 'fansub_id',
 'unique' = false
 ),
 'VideoCodec' = array(
 'className' = 'VideoCodec',
 'joinTable' = 'VideoCodec2EpisodeRelease',
 'foreignKey' = 'episode_release_id',
 'associationForeignKey' = 'video_codec_id',
 'order' = 'VideoCodec.order DESC',
 'unique' = false
 )
 );
 }
 ?

 and the following code in the controller...

 function add(){
 if($this-_canAdd()){
 $this-set('animes',
 $this-EpisodeRelease-Anime-find('list',array('fields'='name')));
 $this-set('languages',
 $this-EpisodeRelease-Language-find('list',array('fields'='name')));
 $this-set('episodeTypes',
 $this-EpisodeRelease-EpisodeType-find('list',array('fields'='name')));
 $this-set('fansubs',
 $this-EpisodeRelease-Fansub-find('list',array('fields'='name','order'='Fansub.name
 ASC')));
 $this-set('videoCodecs',
 $this-EpisodeRelease-VideoCodec-find('list',array('fields'='name','order'
 = 'VideoCodec.order DESC')));

 if($this-request-is('post')){
 $this-request-data['EpisodeRelease']['user_id'] =
 $this-Auth-User('user_id');
 $this-EpisodeRelease-set($this-request-data);
 if($this-EpisodeRelease-saveAll($this-request-data)){
 $this-Session-setFlash('Release aggiunta con
 successo. Sarà visualizzabile non appena un amministratore lo avrà
 approvato.');
 //$this-redirect(array('action'='index'));
 pr($this-request-data);
 }else{
 pr($this-request-data);
 $this-Session-setFlash('ERRORE! Compila tutti i
 campi!');
 $this-set('similar_releases',array());
 }
 }else{
 $this-set('similar_releases',array());
 }
 }else{
 $this-Session-setFlash('Non hai i permessi necessari per
 eseguire questa azione.');
 $this-redirect(array('action'='index'));
 }
 }

 When i press Submit the array sent to saveAll is the following:

 Array
 (
 [EpisodeRelease] = Array
 (
 [language_id] = 1
 [anime_id] = 1
 [episode_type_id] = 1
 [number] = 2
 [name] = episode
 [user_id] = 2
 )

 [Fansub] = Array
 (
 [Fansub] = Array
 (
 [0] = 1
 )

 )

 [VideoCodec] = Array
 (
 [VideoCodec] = Array
 (
 [0] = 8
 )

 )

 )

 But it seems that HABTM relations are'nt saved why?
 Thanks again! ^^
 WebRep
 Overall rating


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

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Jon Bennett
 I've had some similar trouble with 2.0
 turned out the fields in the DB were not the same type.
 id on one table was a bigint and the foreign key on the relationship table 
 was a regular integer.
 atenciosamente,

With MySQL you can catch these errors at db schema level if you use
foreign key constraints, as you can't connect columns of different
types.

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

2011-11-02 Thread bujanga
I have not tried implementing recurring payments using PayPal but have
done it with other systems. Anyway, that is your search term:

http://www.google.com/search?q=paypal+recurring+payments

-- 
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: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Jeremy Burns
Use InnoDB. As John says, it won't let you create RI between fields with 
different types (and it's very precise) and you get transactions thrwn in for 
good measure.

On 2 Nov 2011, at 16:14, Jon Bennett wrote:

 I've had some similar trouble with 2.0
 turned out the fields in the DB were not the same type.
 id on one table was a bigint and the foreign key on the relationship table 
 was a regular integer.
 atenciosamente,
 
 With MySQL you can catch these errors at db schema level if you use
 foreign key constraints, as you can't connect columns of different
 types.
 
 -- 
 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


Containable get posts with active comments

2011-11-02 Thread nastya
Hello

Could you please help me with a small issue?

There are Posts that are active. Posts can have comments. Comments can
be active or not. How to get only those active Posts that have active
Comments?

$this-Post-find('all', array(
'conditions' = array('Post.active'=1),
'contain' = array(
'Comment' = array('conditions' = array('Comment.active' =
1))
)
));

This query will get all active posts even if they don't have active
comments... How to get only those with active comments?

Thank you.

-- 
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: Containable get posts with active comments

2011-11-02 Thread Jeremy Burns | Class Outfit
You would need to use joins here: 
http://book.cakephp.org/view/1047/Joining-tables

Looks complex at first, but actually isn't. And once you've mastered it you'll 
use it in preference to plain old SQL where normal finds won't cut it.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 2 Nov 2011, at 17:15, nastya wrote:

 Hello
 
 Could you please help me with a small issue?
 
 There are Posts that are active. Posts can have comments. Comments can
 be active or not. How to get only those active Posts that have active
 Comments?
 
 $this-Post-find('all', array(
'conditions' = array('Post.active'=1),
'contain' = array(
'Comment' = array('conditions' = array('Comment.active' =
 1))
)
 ));
 
 This query will get all active posts even if they don't have active
 comments... How to get only those with active comments?
 
 Thank you.
 
 -- 
 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: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Mattia Manzati
I Have already checked, and all table are already well related. Same
column type INT(11) and InnoDB powered. But I still have the
problem... :S
What to do now? The code I am using works if I use cakephp1.3

On 2 Nov, 17:51, Jeremy Burns jeremybu...@me.com wrote:
 Use InnoDB. As John says, it won't let you create RI between fields with 
 different types (and it's very precise) and you get transactions thrwn in for 
 good measure.

 On 2 Nov 2011, at 16:14, Jon Bennett wrote:







  I've had some similar trouble with 2.0
  turned out the fields in the DB were not the same type.
  id on one table was a bigint and the foreign key on the relationship table 
  was a regular integer.
  atenciosamente,

  With MySQL you can catch these errors at db schema level if you use
  foreign key constraints, as you can't connect columns of different
  types.

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://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: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Thiago Belem
Put your code on Github or Gists and send us the link.

Thiago Belem, enviado do meu Android
Em 02/11/2011 15:28, Mattia Manzati manzat...@gmail.com escreveu:

 I Have already checked, and all table are already well related. Same
 column type INT(11) and InnoDB powered. But I still have the
 problem... :S
 What to do now? The code I am using works if I use cakephp1.3

 On 2 Nov, 17:51, Jeremy Burns jeremybu...@me.com wrote:
  Use InnoDB. As John says, it won't let you create RI between fields with
 different types (and it's very precise) and you get transactions thrwn in
 for good measure.
 
  On 2 Nov 2011, at 16:14, Jon Bennett wrote:
 
 
 
 
 
 
 
   I've had some similar trouble with 2.0
   turned out the fields in the DB were not the same type.
   id on one table was a bigint and the foreign key on the relationship
 table was a regular integer.
   atenciosamente,
 
   With MySQL you can catch these errors at db schema level if you use
   foreign key constraints, as you can't connect columns of different
   types.
 
   --
   Our newest site for the community: CakePHP Video Tutorialshttp://
 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


-- 
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: CakepHP 2.0 plugins no longer cache in elements

2011-11-02 Thread Điển vũ
Many element can't cache but repeat in many layouts. 
Only me met trouble about this matter ?...

-- 
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: CakepHP 2.0 plugins no longer cache in elements

2011-11-02 Thread euromark
do you mean that the cache is not working as in 1.3?
did you read the migration guide?
cache is now in the third param

?php echo $this-element('helpbox', array(), array('cache' =
true)); ?

@see
http://book.cakephp.org/2.0/en/views.html?highlight=elements#caching-elements

or do you mean you cannot use nocache?
You cannot use nocache tags in elements. Since there are no callbacks
around elements, they cannot be cached.



On 2 Nov., 19:14, Điển vũ meotimdi...@gmail.com wrote:
 Many element can't cache but repeat in many layouts.
 Only me met trouble about this matter ?...

-- 
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: CakepHP 2.0 plugins no longer cache in elements

2011-11-02 Thread Điển vũ
No, i mean: 
You cannot use nocache tags in elements. Since there are no callbacks 
around elements, they cannot be cached.  (
http://book.cakephp.org/2.0/en/core-libraries/helpers/cache.html)
I can use cake:nocache in elements with cakephp 1.x but not can't use it 
. 
I see it is harder to cache 

-- 
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: CakepHP 2.0 plugins no longer cache in elements

2011-11-02 Thread Điển vũ
No, i mean: 
You cannot use nocache tags in elements. Since there are no callbacks 
around elements, they cannot be cached.  (
http://book.cakephp.org/2.0/en/core-libraries/helpers/cache.html)
I can use cake:nocache in elements with cakephp 1.x but can't with cake 
2.x
I see it is harder to cache 

-- 
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: missing ) after argument list error - how does that make sense?

2011-11-02 Thread Tomfox Wiranata
i had to use backslashes...^^ it works now

thanks for your time guys..appreciate it :)

On 30 Okt., 22:10, flo.kl...@googlemail.com
flo.kl...@googlemail.com wrote:
 I always use “ to encapsulate the string I want to echo. Then you can use ' 
 within and it will be echoed as well.
 A short example:
 echo “div id='myId'“.$array['fieldName'].“/div“;

 -flosky

 Tomfox Wiranata tomfox.wiran...@gmail.com schrieb:

 lets say i wanna go with echo, how do i need to quote or escape the
 current code, that it works?
 cause i have no idea how to implement the value thing..

 thanks..appreciate it

 On 30 Okt., 05:52, Ryan Schmidt google-2...@ryandesign.com wrote:









  On Oct 29, 2011, at 10:56, Tomfox Wiranata wrote:

   echo 'div id=showGoogleMap onclick=showGoogleMap('.$all['id'].','.
   $all['BooksUser']['latitude'].',
   '.$all['BooksUser']['longitude'].','.$all['title'].')
   style=float:right;cursor:pointer;'.$html-image(icons/map.png,
   array(alt = Google Map anzeigen)).'/div';

  [snip]

   now when I hit
   the icon to open the map, firebug says this:
  _

   missing ) after argument list
   showGoogleMap(207,47.378824,8.548737,Tag Heuer Carrera Chronograph)

  As you see from the error message (or by viewing source on the page), your 
  PHP code generated the following HTML code:

  div id=showGoogleMap onclick=showGoogleMap(207,47.378824,8.548737,Tag 
  Heuer Carrera Chronograph) style=float:right;cursor:pointer;.../div

  What got generated inside the onclick attribute is not valid JavaScript 
  code, because the title string is not quoted or escaped properly. You 
  probably want to use JsHelper::value($all['title']) instead of just echoing 
  $all['title'] directly.

 --
 Our newest site for the community: CakePHP Video 
 Tutorialshttp://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


AuthComponent - Multiple Setups

2011-11-02 Thread Thiago Belem
I'm using the *AuthComponent* to control the access to two prefixes:
admin and student.

I'm changing the AuthComponent configuration (model, fields, userScope,
loginAction and even sessionKey) on AppController::beforeFilter() but once
i'm logged with one user Model at admin', AuthComponent says i'm
authenticated to access the other prefix, with another configuration.

You can see my beforeFilter here: https://gist.github.com/1334862

As you can see on my code, there's a commented line on the Student prefix
configuration (called aluno on my code):

$this-Auth-authorize = array('Controller');

This was my ugly workaround to redirect the *Admin* to the *Student* login
screen if I can't find a student with the logged user data (name, email and
etc.)

Mind that I have two user models (not two user roles): User and Student,
with different data and fields.

This used to work back in the 1.3 days...

Thanks,
--
***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

-- 
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: AuthComponent - Multiple Setups

2011-11-02 Thread Điển vũ
Edit: Do you mean : *Admin* to the *Student* login screen if I can't find a 
*Admin *?

-- 
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: AuthComponent - Multiple Setups

2011-11-02 Thread Thiago Belem
No... I have two separated prefixes, one called aluno (model Student) and
other called admin (model User).

I want to create separate authenticatated areas, and a logged user can't
access both.

That's why I created two AuthComponent configurations, using different
models and options.

But at version 2.0 if your're already logged you have access to every
AuthComponent configuration, even if the SessionKey change... Looks like a
bug to me.

Regards,
--
***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


2011/11/2 Điển vũ meotimdi...@gmail.com

 Edit: Do you mean : *Admin* to the *Student* login screen if I can't find
 a *Admin *?

 --
 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: Cakephp 1.3 not logging when debug set to 1 or 2

2011-11-02 Thread José Lorenzo
Just tested it in a clean cakephp 1.3.13 install and works fine.

-- 
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: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Mattia Manzati
Ok, putted code on github. This is the repo: 
https://github.com/ilmattodel93/IMattiDel93-s-Site
Thanks again for your help! ^^

On 2 Nov, 18:47, Thiago Belem cont...@thiagobelem.net wrote:
 Put your code on Github or Gists and send us the link.

 Thiago Belem, enviado do meu Android
 Em 02/11/2011 15:28, Mattia Manzati manzat...@gmail.com escreveu:







  I Have already checked, and all table are already well related. Same
  column type INT(11) and InnoDB powered. But I still have the
  problem... :S
  What to do now? The code I am using works if I use cakephp1.3

  On 2 Nov, 17:51, Jeremy Burns jeremybu...@me.com wrote:
   Use InnoDB. As John says, it won't let you create RI between fields with
  different types (and it's very precise) and you get transactions thrwn in
  for good measure.

   On 2 Nov 2011, at 16:14, Jon Bennett wrote:

I've had some similar trouble with 2.0
turned out the fields in the DB were not the same type.
id on one table was a bigint and the foreign key on the relationship
  table was a regular integer.
atenciosamente,

With MySQL you can catch these errors at db schema level if you use
foreign key constraints, as you can't connect columns of different
types.

--
Our newest site for the community: CakePHP Video Tutorialshttp://
  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: ajax with cakephp 1.3

2011-11-02 Thread thom
On Wed, Nov 2, 2011 at 4:42 PM, WebbedIT p...@webbedit.co.uk wrote:

 Welcome to the group Pedro.

 Please Google your question before asking things that have been asked
 (many times before):
 http://www.google.co.uk/search?q=cakephp+dependant+select+list

 Or better still search this very group:

 http://groups.google.com/group/cake-php/search?group=cake-phpq=ajax+select+listsqt_g=Search+this+group

 Finding an existing answer to your query is much much faster than
 posting a new one and waiting for someone to reply.


Have you try Ajax-Helper? http://www.cakephp.4uk.pl/
make sure, next time you do google search first.

Good luck..

-- 
Regards,,,
thom
http://mynameisthom.blogspot.com

-- 
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: ajax with cakephp 1.3

2011-11-02 Thread pedro rojo
th you for your reponce my friends!
first I want to tell you that I am a newbie in cakephp and PHP.
good as you know:) this is my second bathroom participation in this group I
am a true visitor in this group and my problem is that I rely on myself and
my technical quality.
Secondly I searched google and several forums the solution but I found a method
that answers my problem. if you read my post you will be convinced.
Thirdly I will try because I am a Franco I do not use too many English
language
thank you very much for your response and advice

-- 
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: AuthComponent - Multiple Setups

2011-11-02 Thread Thiago Belem
Looks like i've found the problem: the propety sessionKey of AuthComponent 
is defined as static... So even if i try to change it on my AppController 
it simply doesn't work for the next verifications.

I've submited a ticket on the lighthouse: 
http://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/2207-authcomponentsessionkey-property-cannot-be-changed

-- 
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: missing ) after argument list error - how does that make sense?

2011-11-02 Thread Ryan Schmidt

On Nov 2, 2011, at 15:09, Tomfox Wiranata wrote:

 i had to use backslashes...^^ it works now
 
 thanks for your time guys..appreciate it :)

Yes, well, if you're going to insert data into a page, you need to quote and 
escape that data appropriately. In this context, you're trying to put a string 
into JavaScript code. So you need to quote it (' or  around it), and you need 
to escape any special characters in its content (', , \, newline, carriage 
return). That JavaScript is also inside an HTML attribute, so you need to apply 
HTML escaping rules too.

This seems like a fairly common need -- to escape data for insertion into 
JavaScript code -- so I assumed there would be a method in CakePHP to do that 
for you. My quick search turned up $this-Js-value(). Actually getting that 
embedded into an attribute of an HTML element like you're wanting to do, 
however, seemed to be more difficult.

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


CakePHP 2.0.2 released

2011-11-02 Thread José Lorenzo


The CakePHP core team is proud to announce the immediate availability of 
CakePHP 2.0.2 [1]. We saw the need to release this version after a bug that 
was introduced in the 2.0.1 version regarding the calculation of the 
Content-Length header. This bug can cause unexpected errors in the ouput 
such as failed ajax requests, unclosed html tags, and more. People using 
2.0.1 are highly encouraged to upgrade their apps to use this new version 
as soon as possible. In total, there were 13 commits and 7 issues have been 
resolved for 2.0.2. A complete list of the changes can be viewed in the 
changelogs page [2], but this is a quick summary of changes that made it 
into 2.0.2:

   - Exception messages are shown instead of overridden in debug mode
   - Fixes encoding issues with debug().
   - Fixed typos in default css
   - MimeType audio/ogg added
   - Fixes UUID issue in SQLite
   - Fixes issue in RequestHandlerComponent.
   - Updates generated cache files to include the response object
   - Returns correct byte length instead of number of characters in 
   Content-Length
   - 
   
   Download a packaged release [1]
   
   - View the changelog [2]

Links
   
   - [1] http://github.com/cakephp/cakephp
   - [2] http://cakephp.org/changelogs/2.0.2

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