Re: SQL Cartesian Product with CakePHP find
Great info! Thank you again. 2015-02-04 14:09 GMT-02:00 José Lorenzo jose@gmail.com: Yes, you can use union in cake 3, paginating union queries is tricky as the different databases will interpret the ORDER BY and LIMIT differently. Waht you need to to in that case is passing a select * form (all union queries) to the paginator and it will work. On Tuesday, February 3, 2015 at 5:57:43 AM UTC-4:30, Gildonei Mendes Anacleto Junior wrote: Left join won't bring me the same results, as I said this isn't a join, I am forcing the query to bring me the prdoduct between t1 and t2 and in this case I will always have all the possible combination among this tables. Using left join, I can have null on right table (t2) if a record doesn't exists. I guess only with CakePHP 3 I will be able to do something like this. By the way, in the new ORM in CakePHP 3.x am I be able to use union statement or a bit more complex select and use paginator component without need of customize it? Thanks again, Junior -- 2015-02-02 21:22 GMT-02:00 José Lorenzo jose@gmail.com: You can do a LEFT join, and get the sae results On Monday, February 2, 2015 at 6:26:56 AM UTC-4:30, Gildonei Mendes Anacleto Junior wrote: Hi, How could I do a cartesian product with 2 different tables in CakePHP 2.x ? EX: *SELECT t1.id http://t1.id, t1.field, t2.id http://t2.id, td.field* *FROM table1 AS t1,* *(SELECT t2.id http://t2.id, t2.field FROM table2) AS t2* *WHERE t1.id http://t1.id = 10* note this isn't a join, I need these cartesian product to apply another filter conditions. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to a topic in the Google Groups CakePHP group. To unsubscribe from this topic, visit https://groups.google.com/d/ topic/cake-php/jg8ZwGJ0wYU/unsubscribe. To unsubscribe from this group and all its topics, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to a topic in the Google Groups CakePHP group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/jg8ZwGJ0wYU/unsubscribe. To unsubscribe from this group and all its topics, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: SQL Cartesian Product with CakePHP find
Left join won't bring me the same results, as I said this isn't a join, I am forcing the query to bring me the prdoduct between t1 and t2 and in this case I will always have all the possible combination among this tables. Using left join, I can have null on right table (t2) if a record doesn't exists. I guess only with CakePHP 3 I will be able to do something like this. By the way, in the new ORM in CakePHP 3.x am I be able to use union statement or a bit more complex select and use paginator component without need of customize it? Thanks again, Junior -- 2015-02-02 21:22 GMT-02:00 José Lorenzo jose@gmail.com: You can do a LEFT join, and get the sae results On Monday, February 2, 2015 at 6:26:56 AM UTC-4:30, Gildonei Mendes Anacleto Junior wrote: Hi, How could I do a cartesian product with 2 different tables in CakePHP 2.x ? EX: *SELECT t1.id http://t1.id, t1.field, t2.id http://t2.id, td.field* *FROM table1 AS t1,* *(SELECT t2.id http://t2.id, t2.field FROM table2) AS t2* *WHERE t1.id http://t1.id = 10* note this isn't a join, I need these cartesian product to apply another filter conditions. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to a topic in the Google Groups CakePHP group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/jg8ZwGJ0wYU/unsubscribe. To unsubscribe from this group and all its topics, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
SQL Cartesian Product with CakePHP find
Hi, How could I do a cartesian product with 2 different tables in CakePHP 2.x ? EX: *SELECT t1.id, t1.field, t2.id, td.field* *FROM table1 AS t1,* *(SELECT t2.id, t2.field FROM table2) AS t2* *WHERE t1.id = 10* note this isn't a join, I need these cartesian product to apply another filter conditions. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Best load model performance
Hello all, I'd like to know wich of this options give me the best performance when loading models to find data. 1. The use of use propertie on controller - public $uses = array('Model1', 'Model2', ...); 2. The use of loadModel method inside specific method - $this-loadModel('Model1'); $this-loadModel('Model2'); 3. The chain model - $this-Model1-Model2-find - $this-Model1-Model2-Model3 I did some tests using DebugKit to compare memory usage and request time but I didn't find anything conclusive. Cheers -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: saveAll does'nt work
I'm also have some problems with saveAll. This are the content of this data and the relations of my model. # $this-data Array ( [Usuario] = Array ( [PK_usuario] = [flPf] = 1 [strNome] = Gildonei Mendes Anacleto Junior [strLogin] = root [strSenha] = af47g5t [strEmail] = jun...@sitecomarte.com.br [intTelefone] = [intCelular] = (48)8413-4280 [flSexoMasc] = 1 [tpUsuario] = 2 [flAtivo] = 1 ) [UsuarioPf] = Array ( [strRg] = 3879169 [intCpf] = 034.306.469-36 ) [Endereco] = Array ( [0] = Array ( [FK_estado] = 24 [FK_cidade] = 10 [strBairro] = Capoeiras [strEndereco] = Srv. Alzira Ventura Vieira [intNumero] = 40 [intCep] = 88090175 [strComplemento] = Bloco 04 Apto 301 ) ) ) # Model Usuario class Usuario extends AppModel { public $name = 'Usuario'; public $useTable = 'usuarios'; public $primaryKey = 'PK_usuario'; public $hasOne = array( 'UsuarioPf' = array( 'className' = 'UsuarioPf', 'foreignKey' = 'PK_usuario', 'type' = 'LEFT' ), 'UsuarioPj' = array( 'className' = 'UsuarioPj', 'foreignKey' = 'PK_usuario', 'type' = 'LEFT' ) ); #Model UsuarioPf class UsuarioPf extends AppModel { public $name = 'UsuarioPf'; public $useTable = 'usuario_pfs'; public $primaryKey = 'PK_usuario'; public $displayField = 'intCpf'; public $belongsTo = array( 'Usuario' = array( 'className' = 'Usuario', 'foreignKey' = 'PK_usuario', 'type' = 'INNER' ) ); # Model Endereco class Endereco extends AppModel { public $name = 'Endereco'; public $useTable = 'enderecos'; public $primaryKey = 'PK_endereco'; public $belongsTo = array( 'Cidade' = array( 'className' = 'Cidade', 'foreignKey' = 'FK_cidade', 'type' = 'INNER' ), 'Usuario' = array( 'className' = 'Usuario', 'foreignKey' = 'FK_usuario', 'type' = 'INNER' ) ); # SQL CallBacks 1 DESCRIBE `usuarios` 10 10 3 2 DESCRIBE `usuario_pfs` 3 3 4 3 DESCRIBE `usuario_pjs` 4 4 4 4 DESCRIBE `enderecos`7 7 4 5 DESCRIBE `cidades` 3 3 4 6 DESCRIBE `estados` 3 3 3 7 DESCRIBE `pagamentos` 4 4 4 8 DESCRIBE `setores` 5 5 4 9 DESCRIBE `imagens` 9 9 4 10 SELECT `Usuario`.`PK_usuario` FROM `usuarios` AS `Usuario` LEFT JOIN `usuario_pfs` AS `UsuarioPf` ON (`UsuarioPf`.`PK_usuario` = `Usuario`.`PK_usuario`) LEFT JOIN `usuario_pjs` AS `UsuarioPj` ON (`UsuarioPj`.`PK_usuario` = `Usuario`.`PK_usuario`) WHERE `strLogin` = 'root' AND `Usuario`.`PK_usuario` LIMIT 1 0 0 1 11 START TRANSACTION 0 1 12 ROLLBACK0 1 13 SELECT `Estado`.`PK_estado`, `Estado`.`strNome` FROM `estados` AS `Estado` WHERE 1 = 127 27 1 14 SELECT `Setor`.`PK_setor`, `Setor`.`strNome`, `Setor`.`strDescricao`, `Setor`.`strController`, `Setor`.`flMenu` FROM `setores` AS `Setor` WHERE `flMenu` = 1 10 10 1 15 SELECT `Imagem`.`PK_imagem`, `Imagem`.`FK_setor`, `Imagem`.`FK_registro`, `Imagem`.`strNome`, `Imagem`.`strNomeDisco`, `Imagem`.`strMime`, `Imagem`.`intSize`, `Imagem`.`intWidth`, `Imagem`.`intHeight` FROM `imagens` AS `Imagem` WHERE `Imagem`.`FK_setor` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 0 0 0 Does anyone can help us? Ty. On 30 jul, 04:04, Vijay Kumbhar k.vidn...@gmail.com wrote: It is not working while saving the data while adding the data or while editing the existing data? I have the same problem with cakephp 1.3 but while editing the associated model data using saveAll. If it is not saving the data while editing then in cakephp 1.3 you have to specify the related model primary key with the edited record. You have to take the profile id field in you form. So that you can get it after posting the form. $this-User-UserProfile-id = $this-data['UserProfile']['id']; If you
SQL don't appears
Hi, I'm starting with CakePHP, and I'm using the latest version of cakePHP (1.3.3), I configured my core.php with debug, 2, but the SQL statements doesn't apper on the window. A sample of the project is hosted at http://www.sitecomarte.com.br/nutriaqua. Some links aren't functional, I already try to find a solution for this, but I coudn't find anything. Does anyone can give a help? TY a lot, Junior PS: Sorry the bad english. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: SQL don't appears
Thank you men. It works. =) On 30 jul, 12:50, Vijay Kumbhar k.vidn...@gmail.com wrote: Hello Gildonie, You have to add the following line in you layout, ?php echo $this-element('sql_dump'); ? cake 1.3 doesn't directly displays the sql statements as like cake 1.2 if your debug mode is 2. On Fri, Jul 30, 2010 at 5:18 PM, Gildonei Mendes A. (Junior) anjol...@gmail.com wrote: Hi, I'm starting with CakePHP, and I'm using the latest version of cakePHP (1.3.3), I configured my core.php with debug, 2, but the SQL statements doesn't apper on the window. A sample of the project is hosted at http://www.sitecomarte.com.br/nutriaqua. Some links aren't functional, I already try to find a solution for this, but I coudn't find anything. Does anyone can give a help? TY a lot, Junior PS: Sorry the bad english. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Thanks Regards, Vijayk. You Bring the Dreams, We'll Bring the Means Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Problems with print_r
Hello, I'm using cake to develop a great LMS tool. When I try to use print_r($this) , I don't receive any response, only a blank page. Somebody knows if it's a PHP Problem or a Cake Problem ? Thank's a lot --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---