Tuesday, February 3, 2015

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.zap@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, 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 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+unsubscribe@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+unsubscribe@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.

Virtual Host Installing

I'd like to install CakePHP on my xampp server by each project.
root/cakephp/project1
root/cakephp/project2

and I'd like to access this by localhost/project1, localhost/project2.
Project1 would be my test site, the other one going to be publishing.
and here is an error message "project1Controller could not be found"

Thank you

    <VirtualHost *:80>
       ServerName localhost
       ServerAlias localhost/project1
       ServerAdmin admin@yahoo.com
       DocumentRoot "C:/root/cakephp/project1/app/webroot"
       <Directory />
       Options FollowSymLinks
       AllowOverride FileInfo
       Require all granted
       </Directory>
    </VirtualHost>

    <VirtualHost *:80>
       ServerName localhost
       ServerAlias localhost/project2
       ServerAdmin admin@yahoo.com
       DocumentRoot "C:/root/cakephp/project2/app/webroot"
       <Directory />
       Options FollowSymLinks
       AllowOverride FileInfo
       Require all granted
       </Directory>
    </VirtualHost>


--
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+unsubscribe@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.

Monday, February 2, 2015

Re: Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

Because i have some tables with the same name (eg. "orders"), in different plugins.

Il giorno lunedì 2 febbraio 2015 23:14:47 UTC+1, José Lorenzo ha scritto:
Why do you need to know if something is in a plugin, btw?

On Monday, February 2, 2015 at 10:12:34 AM UTC-4:30, Ernesto wrote:
that "probably" gives me chills :P

what do you think about this solution?

//in my table class
public function plugin()
{
foreach (Configure::read('App.paths.plugins') as $pluginPath) {
if (is_numeric(strpos(strtolower(__FILE__), strtolower($pluginPath)))) {
return string_between(strtolower(__FILE__), strtolower($pluginPath), DS);
}
}
}

//somewhere
function string_between($string, $start, $end)
{
$string = " " . $string;
$ini = strpos($string, $start);
if ($ini == 0) {
return "";
} else {
$ini += strlen($start);
return substr($string, $ini, strpos($string, $end, $ini) - $ini);
}
}

Il giorno venerdì 30 gennaio 2015 23:16:11 UTC+1, José Lorenzo ha scritto:
Check the namespace of the class:

list($namespace, $class) = namespaceSplit(get_class($table));

if ($namespace !== 'App\Model\Table')  // Probably a plugin :)

On Friday, January 30, 2015 at 4:10:31 PM UTC+1, Ernesto wrote:
Hi all

is there a convenient way to retrieve if the current Table/Behavior is part of a plugin or not?

in Controllers and Helpers i can inspect the request object and get it done.

--
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+unsubscribe@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: Soft delete plugin for cakephp 3

Thanks mark for the suggestion. I'll do that!


Le lundi 2 février 2015 07:48:20 UTC-8, euromark a écrit :
Feel free to add it to https://github.com/FriendsOfCake/awesome-cakephp/tree/cake3
Thats the list people would look for plugins and alike :)

mark


Am Sonntag, 1. Februar 2015 03:40:21 UTC+1 schrieb Pgbi:
Hi guys,

For one of my projects, I developed a plugin to nicely handle soft deletion for some of my models. I thought I might share it with the community (hope this is the right place to do it).

Any remarks about it will be appreciated!

--
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+unsubscribe@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.

CakePHP 3.0 howto disable DebugKit on some actions

Hello,

I would like to disable DebugKit Toolbar on some area on my test website using CakePHP 3.0

config/app.php
$config = [
'debug' => true
,

Tried adding to to AppController as:

use Cake\Core\Configure;
…

public function beforeFilter(Event $event) {
Configure::write('debug', false);
}


Thanks for any help,

Andras

--
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+unsubscribe@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

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, 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+unsubscribe@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

I would do a raw query, as Cake 2 does not support using derived table queries. You can use Cake 3, though.

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, 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+unsubscribe@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.