Thursday, February 5, 2015

CakePHP 2.6 Controllers with New Folder Structure

Hi,

I am using CakePHP 2.6 and want to make two sub-folders, Products and Customers in app/Controller , Model and View folders. So that I can categories my product and customer controllers for proper understanding. To implement and access the same I done some changes in bootstrap as follow:

App::build(array(
      'Model'                     => array('/Model/', '/Model/Products/'),
     
      'Controller'                => array('/Controller/', '/Controller/Products/'),
     
      'View'                      => array('/View/', '/View/Products/'),
  
  ));

It worked well.

But when i tried to add the entries for Customers controllers also it will get overwritten by the other one: 

App::build(array(
      'Model'                     => array('/Model/', '/Model/Customers/'),
      'Model'                     => array('/Model/', '/Model/Products/'),
      'Controller'                => array('/Controller/', '/Controller/Customers/'),
      'Controller'                => array('/Controller/', '/Controller/Products/'),
      'View'                      => array('/View/', '/View/Customers/'),
      'View'                      => array('/View/', '/View/Products/'),
  
  ));

It's not working proper. Only Products section is working fine not Customers one because keys are same and it's getting overwritten. How I can fix this problem?

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

3.0 change order by a weight column

Are there any built in behaviors to deal with reordering entries by a weight column?

Lets say I want to move an entry from 5 to 3.
3 should update to a weight key of 4 and 4 should update to a weight key of 5

In addition, how do you set the default field to witch results should be sorted by.

Scanned through the docs and could not find anything relating to this.
Any links to relevant documentation on this matter would be greatly helpful.


Thanks.

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

Wednesday, February 4, 2015

Cake v2.x -- Looking to return rendered view to the Controller

For various reasons I had decided to use a 3rd party email library within my current CakePHP project. I thought that it might be nice to use CakePHP's Views to create templating for my emails and take advantage of layouts too. Unfortunately I'm stumped on just how to retrieve the rendered output of a view back to the Controller method.

I've tried the following:

    public function test() {
        $this
->layout = false;
       
#$this->view = '/Emails/html/test.ctp';
        $var
= $this->render('/Emails/html/test', false);
        pr
($var->_body); die();
   
}

$var->_body is protected (as denoted by the underscore). I saw no other property within the $var variable that contained the "body" code within my (template) view.

Are there any ways to do this that I'm just not seeing? If so, can I safely presume that layouts would be handled in a similar fashion?

Thank you for any possible help...

--
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: Cakephp 3.0 upgrade from 1.3 where to begin??

Migrate your 1.3 into a 2.x first, using the migration guides, that you can find in the CakePHP book 2.x under appendices.
http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html - as a starting point.

When you are there, you can checkout the migration guide for CakePHP 3.x
http://book.cakephp.org/3.0/en/appendices/3-0-migration-guide.html

Anyone else have some other suggestions?
Enjoy, John

On Wednesday, 4 February 2015 05:09:12 UTC+2, Robert Gravel wrote:
Hi all,
I want to migrate my application currently in cakephp 1.3 to 3.0 .  I just do not know where to begin and what the process would be.
Can someone point me to some resources or outline the steps?

Thank you
Robert Gravel 

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

Great info!

Thank you again.

2015-02-04 14:09 GMT-02:00 José Lorenzo <jose.zap@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.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 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.

Re: SQL Cartesian Product with CakePHP find

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

Tuesday, February 3, 2015

Cakephp 3.0 upgrade from 1.3 where to begin??

Hi all,
I want to migrate my application currently in cakephp 1.3 to 3.0 .  I just do not know where to begin and what the process would be.
Can someone point me to some resources or outline the steps?

Thank you
Robert Gravel 

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