Re: Having a couple of problems using recursive = 1

2009-10-16 Thread KyleKai
Maybe you just need http://book.cakephp.org/view/474/Containable 

On 10月17日, 上午11時08分, "gimperdan...@gmail.com" 
wrote:
> Ok this is what I have set up:
>
> Artist -> hasMany Album
> Album -> belongsTo Artist
> Album -> belongsTo Label
> Album-> hasMany Track
> Label-> hasMany Album
> Track-> belongsTo Album
>
> so fa so good
>
> I provide the name of the Artist and the name of the Album and want to
> get results from each table:
>
> $this->Album->find('all', array('conditions' => array('Album.slug'=>
> $thisAlbum, 'Artist.slug'=>$thisArtist), 'fields'=>array('Album.name',
> 'Artist.name', 'Label.name'), 'recursive'=>1));
>
> This the array I get:
>
> Array
> (
>     [0] => Array
>         (
>             [Album] => Array
>                 (
>                     [name] => The Art Of Breaking
>                     [id] => 1
>                 )
>
>             [Artist] => Array
>                 (
>                     [name] => Thousand Foot Krutch
>                 )
>
>             [Label] => Array
>                 (
>                     [name] => Tooth & Nail
>                 )
>
>             [Track] => Array
>                 (
>                     [0] => Array
>                         (
>                             [id] => 1
>                             [album_id] => 1
>                             [name] => Hand Granade
>                             [lyrics] =>
>                             [slug] => handgranade
>                             [created] => 2009-10-16 22:09:19
>                             [modified] => -00-00 00:00:00
>                         )
>
>                     [1] => Array
>                         (
>                             [id] => 2
>                             [album_id] => 1
>                             [name] => Breathe
>                             [lyrics] =>
>                             [slug] => breathe
>                             [created] => 2009-10-16 22:55:16
>                             [modified] => -00-00 00:00:00
>                         )
>
>                 )
>
>         )
>
> )
>
> Which is what I want.. except that I cannot specify what fields I want
> to select in the table Tracks, because it's a separate query.
>
> Look at the queries:
>
> First:
>
> SELECT `Album`.`name`, `Artist`.`name`, `Label`.`name`, `Album`.`id`
> FROM `albums` AS `Album` LEFT JOIN `artists` AS `Artist` ON
> (`Album`.`artist_id` = `Artist`.`id`) LEFT JOIN `labels` AS `Label` ON
> (`Album`.`label_id` = `Label`.`id`) WHERE `Album`.`slug` =
> 'theartofbreaking' AND `Artist`.`slug` = 'thousandfootkrutch'
>
> Second:
> SELECT `Track`.`id`, `Track`.`album_id`, `Track`.`name`,
> `Track`.`lyrics`, `Track`.`slug`, `Track`.`created`,
> `Track`.`modified` FROM `tracks` AS `Track` WHERE `Track`.`album_id` =
> (1)
>
> Is there a way to tell find() what fields in Track to select? Do I
> have to do another find()?
> The only thing I can think of is to do recursive = 0 and run another
> find() for Track.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: install CakePHP on a Virtual Hosts's subDirectory

2008-06-03 Thread KyleKai

http://book.cakephp.org/view/32/installation

try add RewriteBase /cakephp/

On 6月4日, 上午11時46分, Ryan <[EMAIL PROTECTED]> wrote:
> hi,
>
> I'm currently trying to setup a cake site on a virtual host, my
> document/folder structure on the host is as follows:
>
> /var/www/pub_html//
>
> I want  install the cakephp to a folder ,like cakephp, not in the root
> folder.
>
> i upload the files to cakephp, and uses the URL  http://domain.com/cakephp/
> , I can not open the index page .
>
> What I'm I doing wrong?
>
> thx!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Slave Servers?

2007-11-21 Thread KyleKai

sorry forget say...
   if you have many slave_database , you can try this.

On 11月22日, 上午10時05分, KyleKai <[EMAIL PROTECTED]> wrote:
> Try
>  $slave_db_list = array('1','2','3');
> $slave_db_host = $slave_db_list[rand(0,count($slave_db_list))-1];
> class DATABASE_CONFIG {
>var $default = array(
>  'driver'=> 'mysql',
>  'host'  => $slave_db_host,
>  'login' => '',
>  'password'  => '.',
>  'database'  => 'my_db'
>  );}
>
> ?>
> On 11月22日, 上午8時40分, Mike Lewis <[EMAIL PROTECTED]> wrote:
>
> > So what your saying is put the load balancer IP Address for the
> > slave.host.ip ?
>
> > var $default = array(
> > 'driver'=> 'mysql',
> > 'host'  => 'slave.host.ip',
> > 'login' => '',
> > 'password'  => '.',
> > 'database'  => 'my_db'
> > );
>
> > -
> > Mike
>
> > On Nov 21, 3:39 pm, SeanW <[EMAIL PROTECTED]> wrote:> Most of those 
> > protocols are balanced at layer 4 (IP and port), the
> > > load balancer has no knowledge of the underlying protocol.  Just
> > > balance port 3306 across your slaves, it'll work just fine.
>
> > > Sean
>
> > > On Nov 21, 12:18 pm, Mike Lewis <[EMAIL PROTECTED]> wrote:
>
> > > > I realize that but as far as I know Load Balancers only these
> > > > protocols:
>
> > > > HTTP
> > > > HTTPS
> > > > FTP
> > > > POP3
> > > > SMTP
> > > > IMAPv4
> > > > DNS
> > > > Telnet
> > > > LDAP
>
> > > > I'm not to sure if connecting to a DB is anywhere in there.
>
> > > > So from a application standpoint is there anyway to do some rotation
> > > > and/or random act to using multiple slave servers.
>
> > > > -
> > > > Mike
>
> > > > On Nov 21, 9:08 am, SeanW <[EMAIL PROTECTED]> wrote:
>
> > > > > For multiple slave servers I'd look at a load balancer, either
> > > > > hardware or ipvs + heartbeat.  There's more than just "which server do
> > > > > I send it to?", there's also making sure the server is alive and not
> > > > > too lagged.
>
> > > > > Sean
>
> > > > > On Nov 20, 8:24 pm, Mike Lewis <[EMAIL PROTECTED]> wrote:
>
> > > > > > I saw a post about setting up one slave server (http://
> > > > > > groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
> > > > > > df64d493b24d5a67?lnk=gst&q=master+slave+mysql&rnum=1), but I'm
> > > > > > assuming thats not how you set up multiple slave servers. Quoting 
> > > > > > fromhttp://www.alertra.com/article446.php:
>
> > > > > > "If necessary, set up multiple slave servers all replicating from 
> > > > > > the
> > > > > > same master. Design your application to distribute SELECT queries
> > > > > > across all available slaves in some type of rotating or random
> > > > > > fashion. Once this basic infrastructure is in place, you can simply
> > > > > > add more slaves as query volume increases."
>
> > > > > > Is there a simple way of doing this in CakePHP?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Slave Servers?

2007-11-21 Thread KyleKai

Try
 'mysql',
 'host'  => $slave_db_host,
 'login' => '',
 'password'  => '.',
 'database'  => 'my_db'
 );
}
?>
On 11月22日, 上午8時40分, Mike Lewis <[EMAIL PROTECTED]> wrote:
> So what your saying is put the load balancer IP Address for the
> slave.host.ip ?
>
> var $default = array(
> 'driver'=> 'mysql',
> 'host'  => 'slave.host.ip',
> 'login' => '',
> 'password'  => '.',
> 'database'  => 'my_db'
> );
>
> -
> Mike
>
> On Nov 21, 3:39 pm, SeanW <[EMAIL PROTECTED]> wrote:> Most of those protocols 
> are balanced at layer 4 (IP and port), the
> > load balancer has no knowledge of the underlying protocol.  Just
> > balance port 3306 across your slaves, it'll work just fine.
>
> > Sean
>
> > On Nov 21, 12:18 pm, Mike Lewis <[EMAIL PROTECTED]> wrote:
>
> > > I realize that but as far as I know Load Balancers only these
> > > protocols:
>
> > > HTTP
> > > HTTPS
> > > FTP
> > > POP3
> > > SMTP
> > > IMAPv4
> > > DNS
> > > Telnet
> > > LDAP
>
> > > I'm not to sure if connecting to a DB is anywhere in there.
>
> > > So from a application standpoint is there anyway to do some rotation
> > > and/or random act to using multiple slave servers.
>
> > > -
> > > Mike
>
> > > On Nov 21, 9:08 am, SeanW <[EMAIL PROTECTED]> wrote:
>
> > > > For multiple slave servers I'd look at a load balancer, either
> > > > hardware or ipvs + heartbeat.  There's more than just "which server do
> > > > I send it to?", there's also making sure the server is alive and not
> > > > too lagged.
>
> > > > Sean
>
> > > > On Nov 20, 8:24 pm, Mike Lewis <[EMAIL PROTECTED]> wrote:
>
> > > > > I saw a post about setting up one slave server (http://
> > > > > groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
> > > > > df64d493b24d5a67?lnk=gst&q=master+slave+mysql&rnum=1), but I'm
> > > > > assuming thats not how you set up multiple slave servers. Quoting 
> > > > > fromhttp://www.alertra.com/article446.php:
>
> > > > > "If necessary, set up multiple slave servers all replicating from the
> > > > > same master. Design your application to distribute SELECT queries
> > > > > across all available slaves in some type of rotating or random
> > > > > fashion. Once this basic infrastructure is in place, you can simply
> > > > > add more slaves as query volume increases."
>
> > > > > Is there a simple way of doing this in CakePHP?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



how to save debug message into logs/debug.log

2007-04-10 Thread KyleKai

I edit core.php , DEBUG into 3 .

but all debug message is output in my view ...

I want save all Debug message into my logs , like logs/debug.log .

how can i do ?


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



The model practice tool of the raw recruit

2006-10-23 Thread KyleKai

I composed a simple small tool, letting me practice by myself and the
usage of the test model with examine back to spread.

controller:
data)){
$command_str = '$model = new
'.$this->data['Test']['model'].";\n";
$command_str .= '$result =
$model->'.$this->data['Test']['Command'].';';
eval($command_str);
$this->set('command_str',$command_str);
$this->set('result',$result);
}
}
}
?>

view:

Model Name
input('Test/model',array('size'=> '40'))?>
Function
input('Test/Command',array('size'=> '40'))?>
submit();?>


Code



Result



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