How to send HTTP POST in non-json and get HTTP response in json?

2014-03-12 Thread Sam


I want to add records to a table using a normal HTTP POST. The payload will 
look something like data[Model][fieldName]. The HTTP Post is done in json 
format.

However, I would like the HTTP Response which contains the data validation 
message to be in json format. Currently, Cakephp will return the HTTP 
response in HTML. How can I change it to return the HTTP response in json?

Thank you.

-- 
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: V3.0 - saving fails...

2014-03-12 Thread José Lorenzo
This could possibly be the most difficult part to understand in 3.0 and may 
be subject to change if it turns out to be too complicated. All properties 
in the entities are protected by default against mass assignment, you need 
to modify your Article entity in order to let CakePHP know what properties 
can be assigned by newEntity:

class Article extends Entity {

  protected $_accessible = ['title' = true, 'body' = true];

}

or if you just don't care (not recommended):

class Article extends Entity {

  protected $_accessible = ['*' = true];

}

The latter can be seen as a Eloquent::unguard();

On Wednesday, March 12, 2014 6:30:45 AM UTC+1, Dr. Tarique Sani wrote:

 Wonder why saving is failing 

 I am doing 

 $article = $this-Articles-newEntity($this-request-data);

 if ($this-Articles-save($article)) {
 $this-Session-setFlash(__('Your article has been 
 saved.'));
 return $this-redirect(['action' = 'index']);
 }

 $this-Session-setFlash(__('Unable to add your article.'));


 debug($this-request-data);

 gives

 [
 'title' = 'Test Title',
 'body' = 'This is the body'
 ]


 but debug($article);

 give

 object(Cake\ORM\Entity) {

 'new' = null,
  'accessible' = [],
 'properties' = [],
 'dirty' = [],
  'virtual' = [],
 'errors' = []

 }

 What can possibly be wrong. I am guessing the title and body should appear 
 as properties of the newly created entity without which the saving will not 
 happen

 I did a composer update just now - so I do have the latest code.

 Cheers
 Tarique

 -- 
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 = 


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


Nested Templating?

2014-03-12 Thread Carlos Moreira
Hello All,

I am wondering if CakePHP has anything similar to what the .Net Framework 
has with nested templates. 

This is what I am trying to do :

I want a specific menu to appear in all my views when I enter a certain 
controller. What I am doing right now is placing the same navigation in all 
my controllers views. So View,Edit,Delete etc... all have a special 
navigation for that controller. But If I want to edit that navigation I 
need to do it for as many views I have for that controller. 


Is there a way to clean this up a bit? Maybe something I dont know about in 
CakePHP,

Thank you

-- 
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: Nested Templating?

2014-03-12 Thread Thomas von Hassel
You should look into elements and view blocks

http://book.cakephp.org/2.0/en/views.html#using-view-blocks

http://book.cakephp.org/2.0/en/views.html#elements


On 12 Mar 2014, at 00:22, Carlos Moreira moreira.carlo...@gmail.com wrote:

 Hello All,
 
 I am wondering if CakePHP has anything similar to what the .Net Framework has 
 with nested templates. 
 
 This is what I am trying to do :
 
 I want a specific menu to appear in all my views when I enter a certain 
 controller. What I am doing right now is placing the same navigation in all 
 my controllers views. So View,Edit,Delete etc... all have a special 
 navigation for that controller. But If I want to edit that navigation I need 
 to do it for as many views I have for that controller. 
 
 
 Is there a way to clean this up a bit? Maybe something I dont know about in 
 CakePHP,
 
 Thank you
 
 -- 
 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.

-- 
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: V3.0 - saving fails...

2014-03-12 Thread Dr. Tarique Sani
Ah ha! Forgot that we now have mass assignment protection and it is turned
on by default

Thanks again

Tarique


On Wed, Mar 12, 2014 at 12:53 PM, José Lorenzo jose@gmail.com wrote:

 This could possibly be the most difficult part to understand in 3.0 and
 may be subject to change if it turns out to be too complicated. All
 properties in the entities are protected by default against mass
 assignment, you need to modify your Article entity in order to let CakePHP
 know what properties can be assigned by newEntity:

 class Article extends Entity {

   protected $_accessible = ['title' = true, 'body' = true];

 }

 or if you just don't care (not recommended):

 class Article extends Entity {

   protected $_accessible = ['*' = true];

 }

 The latter can be seen as a Eloquent::unguard();

 On Wednesday, March 12, 2014 6:30:45 AM UTC+1, Dr. Tarique Sani wrote:

 Wonder why saving is failing

 I am doing

 $article = $this-Articles-newEntity($this-request-data);

 if ($this-Articles-save($article)) {
 $this-Session-setFlash(__('Your article has been
 saved.'));
 return $this-redirect(['action' = 'index']);
 }

 $this-Session-setFlash(__('Unable to add your article.'));


 debug($this-request-data);

 gives

 [
 'title' = 'Test Title',
 'body' = 'This is the body'
 ]


 but debug($article);

 give

 object(Cake\ORM\Entity) {

 'new' = null,
  'accessible' = [],
 'properties' = [],
 'dirty' = [],
  'virtual' = [],
 'errors' = []

 }

 What can possibly be wrong. I am guessing the title and body should
 appear as properties of the newly created entity without which the saving
 will not happen

 I did a composer update just now - so I do have the latest code.

 Cheers
 Tarique

 --
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 =

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




-- 
=
The Conference Schedule Creator : http://shdlr.com

PHP for E-Biz : http://sanisoft.com
=

-- 
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: RESTful (Form) Validation?

2014-03-12 Thread AD7six
I recommend taking a look at https://github.com/friendsofcake/crud, if not 
for the code (but why not =) ) for an example of how to do what you ask 
e.g. http://friendsofcake.com/crud/examples/blog.html#validation_errors

curl -I -X POST http://your-site-domain.com/posts/add.json \
   -d title=My new JSON API blog post

 HTTP/1.1 400 Bad Request
 Server: nginx/1.4.1
 Date: Sun, 16 Jun 2013 12:25:12 GMT
 Content-Type: application/json; charset=UTF-8
 Content-Length: 69
 Connection: keep-alive
 Set-Cookie: CAKEPHP=vevclsl2o6r7h4v7uon9j5tkd1; expires=Sun, 16-Jun-2013 
 16:25:12 GMT; path=/; HttpOnly

 {
   success: false,
   data: {
 body: [This field cannot be left blank]
   }
 }


AD

On Wednesday, 12 March 2014 05:06:00 UTC+1, OJ Tibi - @ojtibi wrote:

 Hi folks,

 I was wondering if there was a way to let the client app know which fields 
 it submitted have validation errors. (As you can see, I placed Form 
 between parentheses because there isn't really an HTML form in a REST API 
 request.) While the Cookbook recommends to use the built-in Exception 
 classes to respond to errors in REST requests, there is no recommended way 
 to include Model::validationErrors in the response.

 Right now, I'm inclined to create my own subclass of HttpException, but 
 after reading the core files, it looks like I might also need to create a 
 custom ErrorHandler and ExceptionRenderer class, if I understand correctly. 
 Essentially, I just want to add a 'validation_errors' key in the 
 '_serialize' array exported by ExceptionRenderer.

 The question is, will I be overdoing it if I did what I outlined above, 
 *or* should I just pass a implode()'d Model::validationErrors as a $message 
 to BadRequestException/InternalErrorException? Also note that 
 Model::validationErrors is a multi-level array with named keys.

 Cheers,
 OJ


-- 
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: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread Борислав Събев Borislav Sabev
Here's an interesting thing:
I am not actively developing in Cake for a year now, however I do continue 
to keep up with changes, have some little projects here and there and most 
importantly to try to help.
However I cannot not agree with Jeremy Burns' comments on the types of 
questions being asked here and over at Stack Overflow. Some people just 
don't take care to read a bit of the book first.
These days I am on ZendFramework and Yii, but I haven't stopped trying to 
help out in the Cake community. This is just because of that community!

I am also very confident with the direction in which v3.0 is taking us. An 
I will continue to prefer Cake where it does it's job great.

On Tuesday, 11 March 2014 09:51:15 UTC+2, advantage+ wrote:

 In no way am I putting Cake down, I love Cake and use it for almost every 
 project. I love it!

 I just see lack of fan fare as you can call it over the years. I see 
 familiar names always answering questions for users. That’s great!

  

 But I seem to notice less and less so I was only wondering if people are 
 jumping ship and moving on to other frameworks.

  

 That’s all.

  

 *From:* cake...@googlegroups.com javascript: [mailto:
 cake...@googlegroups.com javascript:] *On Behalf Of *Thomas von Hassel
 *Sent:* Tuesday, March 11, 2014 4:46 AM
 *To:* cake...@googlegroups.com javascript:
 *Subject:* Re: Is Cake Dead Or Just Catching Up?

  

 If you switch frameworks every 6 months you are doing it wrong.

  

 So far CakePHP does what i need it to do, and i see no reason to shop 
 around. Also, with the things coming in 3.0 I’m very optimistic about the 
 direction the dev. team is taking.

  

 In regards to traffic on the list/google group, i suspect a lot of newbies 
 end up on Stack Overflow, and not here.

  

 /thomas

  

  

 On 11 Mar 2014, at 06:13, Advantage+ movep...@gmail.com javascript: 
 wrote:



 Looking at these stats is Cake dead?

  

 http://www.sitepoint.com/best-php-frameworks-2014/

  

 Can it keep up or catch up?

  

 Over the years I would see 50 Cake messages a day, now it's lucky if you 
 see 2 topics with 1 response in the daily abridged update.

 Very few questions hit the inbox, less and less ever day…..

  

 Don’t get me wrong I love Cake but is heading out to the pasture to call 
 it a day?

 Seems no longer a popular framework as others pop up.

  

 Others are much faster, and have everything Cake has to offer and more.

  

 Everyone has an opinion, let's see if anyone replies or too busy with 
 other frameworks J

  

  

 -- 
 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 javascript:.
 To post to this group, send email to cake-php@googlegroups.comjavascript:
 .
 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+u...@googlegroups.com javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 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: V3.0 - saving fails...

2014-03-12 Thread Dr. Tarique Sani
ok that brings me to the next question.

How do I get $article = $this-Articles-newEntity($this-request-data);
to use the Entity class I have created in  App/Model/ArticleEntity.php ?
Doesn't the controller automagically include it, What is the convention for
Entity classes?

Tarique



On Wed, Mar 12, 2014 at 12:53 PM, José Lorenzo jose@gmail.com wrote:

 This could possibly be the most difficult part to understand in 3.0 and
 may be subject to change if it turns out to be too complicated. All
 properties in the entities are protected by default against mass
 assignment, you need to modify your Article entity in order to let CakePHP
 know what properties can be assigned by newEntity:

 class Article extends Entity {

   protected $_accessible = ['title' = true, 'body' = true];

 }

 or if you just don't care (not recommended):

 class Article extends Entity {

   protected $_accessible = ['*' = true];

 }

 The latter can be seen as a Eloquent::unguard();

 On Wednesday, March 12, 2014 6:30:45 AM UTC+1, Dr. Tarique Sani wrote:

 Wonder why saving is failing

 I am doing

 $article = $this-Articles-newEntity($this-request-data);

 if ($this-Articles-save($article)) {
 $this-Session-setFlash(__('Your article has been
 saved.'));
 return $this-redirect(['action' = 'index']);
 }

 $this-Session-setFlash(__('Unable to add your article.'));


 debug($this-request-data);

 gives

  [
 'title' = 'Test Title',
 'body' = 'This is the body'
 ]


 but debug($article);

 give

 object(Cake\ORM\Entity) {

 'new' = null,
  'accessible' = [],
 'properties' = [],
 'dirty' = [],
  'virtual' = [],
 'errors' = []

 }

 What can possibly be wrong. I am guessing the title and body should
 appear as properties of the newly created entity without which the saving
 will not happen

 I did a composer update just now - so I do have the latest code.

 Cheers
 Tarique

 --
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 =

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




-- 
=
The Conference Schedule Creator : http://shdlr.com

PHP for E-Biz : http://sanisoft.com
=

-- 
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: CakePHP 3.0 error

2014-03-12 Thread Борислав Събев Borislav Sabev
I can bet some money that this could be somehow related to: 
https://groups.google.com/forum/#!topic/cake-php/hhnJEXDSGzU

Good to know you've solved your issue btw.

On Tuesday, 11 March 2014 19:19:01 UTC+2, André Luis wrote:

 Hi people, I am trying to follow the Blog tutorial from cakephp 3.0 
 website, but i am getting an error wich isnt showed up, also its not on the 
 log...

 The problem is whem i try to retrieve the articles with 
 $this-Articles-find('all');, whem have this line the browser says that 
 this page is not avaliable, but if I remove this line, it shows the content 
 (without the articles)

 What i am doing wrong?

 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+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: V3.0 - saving fails...

2014-03-12 Thread José Lorenzo
Entities go in App/Model/Entity/ and they should be the singular of your 
table without suffixes. For example App/Model/Entity/Article.php that way 
cakephp will be able to load it and know it is associated to ArticlesTable.

If you wish to divert from the conventions you can change it in your table 
class:

class ArticlesTable extends Table {

  public function initialize(array $config) {
 $this-entityClass('App\Model\ArticleEntity');
  }
}

In general I would not recommend this as it makes it harder for the 
FormHelper to figure out where stuff is.

On Wednesday, March 12, 2014 10:12:30 AM UTC+1, Dr. Tarique Sani wrote:

 ok that brings me to the next question. 

 How do I get $article = $this-Articles-newEntity($this-request-data); 
 to use the Entity class I have created in  App/Model/ArticleEntity.php ? 
 Doesn't the controller automagically include it, What is the convention for 
 Entity classes?

 Tarique



 On Wed, Mar 12, 2014 at 12:53 PM, José Lorenzo jose...@gmail.comjavascript:
  wrote:

 This could possibly be the most difficult part to understand in 3.0 and 
 may be subject to change if it turns out to be too complicated. All 
 properties in the entities are protected by default against mass 
 assignment, you need to modify your Article entity in order to let CakePHP 
 know what properties can be assigned by newEntity:

 class Article extends Entity {

   protected $_accessible = ['title' = true, 'body' = true];

 }

 or if you just don't care (not recommended):

 class Article extends Entity {

   protected $_accessible = ['*' = true];

 }

 The latter can be seen as a Eloquent::unguard();

 On Wednesday, March 12, 2014 6:30:45 AM UTC+1, Dr. Tarique Sani wrote:

  Wonder why saving is failing 

 I am doing 

 $article = $this-Articles-newEntity($this-request-data);

 if ($this-Articles-save($article)) {
 $this-Session-setFlash(__('Your article has been 
 saved.'));
 return $this-redirect(['action' = 'index']);
 }

 $this-Session-setFlash(__('Unable to add your article.'));


 debug($this-request-data);

 gives

  [
 'title' = 'Test Title',
 'body' = 'This is the body'
 ]


 but debug($article);

 give

 object(Cake\ORM\Entity) {

 'new' = null,
  'accessible' = [],
 'properties' = [],
 'dirty' = [],
  'virtual' = [],
 'errors' = []

 }

 What can possibly be wrong. I am guessing the title and body should 
 appear as properties of the newly created entity without which the saving 
 will not happen

 I did a composer update just now - so I do have the latest code.

 Cheers
 Tarique

 -- 
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 = 

  -- 
 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+u...@googlegroups.com javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 = 


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


What HTTP POST format to use for saving model and associated model data in a single controller function?

2014-03-12 Thread Sam


I am using Cakephp 2.4.5. I have 2 tables with a one-to-many relationship. 
Table B belongs to Table A. Table A has many Table B.

I want a controller in Table A that can save records in Table A and Table 
B. The controller code should be simple and looks like this;

public function add_tableA($id=null){
if ($this-request-is('post')) 
{
$this-layout = null ;
$this-TableA-create();
$this-TableA-saveAll($this-request-data, array('deep' = true));
}}

My problem comes when trying to send the right HTTP POST format to the 
controller.

I tried to HTTP POST the data format below but it fails.

data[TableA][field1] = field1_value
data[TableA][field2] = field2_value
data[TableB][field1] = field1_value
data[TableB][field2] = field2_value

Then, I try to HTTP POST the data format below, at least TableA fields are 
populated.

data[TableA][field1] = field1_value
data[TableA][field2] = field2_value

How should the HTTP POST data format look like if I want to create rows for 
both tables?


-- 
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: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread José Lorenzo
Tarique, as a former Laravel user what do you think can CakePHP 3 to 
improve and appeal those users that think laravel is better?

On Tuesday, March 11, 2014 10:24:44 AM UTC+1, Dr. Tarique Sani wrote:

  But I seem to notice less and less so I was only wondering if people are 
 jumping ship and moving on to other frameworks.


 Then this would be a wrong place to ask ;-) 


 Tarique


 On Tue, Mar 11, 2014 at 1:21 PM, Advantage+ movep...@gmail.comjavascript:
  wrote:

 In no way am I putting Cake down, I love Cake and use it for almost every 
 project. I love it!

 I just see lack of fan fare as you can call it over the years. I see 
 familiar names always answering questions for users. That’s great!

  

 But I seem to notice less and less so I was only wondering if people are 
 jumping ship and moving on to other frameworks.

  

 That’s all.

  

 *From:* cake...@googlegroups.com javascript: [mailto:
 cake...@googlegroups.com javascript:] *On Behalf Of *Thomas von Hassel
 *Sent:* Tuesday, March 11, 2014 4:46 AM
 *To:* cake...@googlegroups.com javascript:
 *Subject:* Re: Is Cake Dead Or Just Catching Up?

  

 If you switch frameworks every 6 months you are doing it wrong.

  

 So far CakePHP does what i need it to do, and i see no reason to shop 
 around. Also, with the things coming in 3.0 I’m very optimistic about the 
 direction the dev. team is taking.

  

 In regards to traffic on the list/google group, i suspect a lot of 
 newbies end up on Stack Overflow, and not here.

  

 /thomas

  

  

 On 11 Mar 2014, at 06:13, Advantage+ movep...@gmail.com javascript: 
 wrote:



 Looking at these stats is Cake dead?

  

 http://www.sitepoint.com/best-php-frameworks-2014/

  

 Can it keep up or catch up?

  

 Over the years I would see 50 Cake messages a day, now it's lucky if you 
 see 2 topics with 1 response in the daily abridged update.

 Very few questions hit the inbox, less and less ever day…..

  

 Don’t get me wrong I love Cake but is heading out to the pasture to call 
 it a day?

 Seems no longer a popular framework as others pop up.

  

 Others are much faster, and have everything Cake has to offer and more.

  

 Everyone has an opinion, let's see if anyone replies or too busy with 
 other frameworks J

  

  

 -- 
 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 javascript:.
 To post to this group, send email to cake-php@googlegroups.comjavascript:
 .
 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+u...@googlegroups.com javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 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+u...@googlegroups.com javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 = 


-- 
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: Is anyone else getting a zend_mm_heap corrupted error with Cake 3 such that pages never finish loading?

2014-03-12 Thread heavyKevy
The issue with trying to update my PHP is that WAMP does not have a newer 
64bit build, and the newer 64 bit builds that I can find are compiled with 
a different version of VC such that they likely won't play nicely.  

Is there any way to verify that it is a PHP bug?

On Wednesday, March 12, 2014 12:35:38 AM UTC+7, José Lorenzo wrote:

 That is usually related to a PHP bug triggered by APC opcode caching. 
 Maybe try to update your PHP version?




-- 
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: What HTTP POST format to use for saving model and associated model data in a single controller function?

2014-03-12 Thread José Lorenzo
If A hasmany B then the format should be: 

data[TableA][field1] = field1_value
data[TableA][field2] = field2_value
data[TableB][0][field1] = field1_value
data[TableB][0][field2] = field2_value

On Wednesday, March 12, 2014 10:38:00 AM UTC+1, Sam wrote:

 I am using Cakephp 2.4.5. I have 2 tables with a one-to-many relationship. 
 Table B belongs to Table A. Table A has many Table B.

 I want a controller in Table A that can save records in Table A and Table 
 B. The controller code should be simple and looks like this;

 public function add_tableA($id=null){
 if ($this-request-is('post')) 
 {
 $this-layout = null ;
 $this-TableA-create();
 $this-TableA-saveAll($this-request-data, array('deep' = true));
 }}

 My problem comes when trying to send the right HTTP POST format to the 
 controller.

 I tried to HTTP POST the data format below but it fails.

 data[TableA][field1] = field1_value
 data[TableA][field2] = field2_value
 data[TableB][field1] = field1_value
 data[TableB][field2] = field2_value

 Then, I try to HTTP POST the data format below, at least TableA fields are 
 populated.

 data[TableA][field1] = field1_value
 data[TableA][field2] = field2_value

 How should the HTTP POST data format look like if I want to create rows 
 for both tables?




-- 
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: What HTTP POST format to use for saving model and associated model data in a single controller function?

2014-03-12 Thread Sam
Thank you. Your answer is correct.

On Wednesday, March 12, 2014 6:03:05 PM UTC+8, José Lorenzo wrote:

 If A hasmany B then the format should be: 

 data[TableA][field1] = field1_value
 data[TableA][field2] = field2_value
 data[TableB][0][field1] = field1_value
 data[TableB][0][field2] = field2_value

 On Wednesday, March 12, 2014 10:38:00 AM UTC+1, Sam wrote:

 I am using Cakephp 2.4.5. I have 2 tables with a one-to-many 
 relationship. Table B belongs to Table A. Table A has many Table B.

 I want a controller in Table A that can save records in Table A and Table 
 B. The controller code should be simple and looks like this;

 public function add_tableA($id=null){
 if ($this-request-is('post')) 
 {
 $this-layout = null ;
 $this-TableA-create();
 $this-TableA-saveAll($this-request-data, array('deep' = true));
 }}

 My problem comes when trying to send the right HTTP POST format to the 
 controller.

 I tried to HTTP POST the data format below but it fails.

 data[TableA][field1] = field1_value
 data[TableA][field2] = field2_value
 data[TableB][field1] = field1_value
 data[TableB][field2] = field2_value

 Then, I try to HTTP POST the data format below, at least TableA fields 
 are populated.

 data[TableA][field1] = field1_value
 data[TableA][field2] = field2_value

 How should the HTTP POST data format look like if I want to create rows 
 for both tables?




-- 
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: V3.0 - saving fails...

2014-03-12 Thread Dr. Tarique Sani
Thanks again. Last question of the day - what to do to get created and
modified fields to work automagically. Created can be defaulted to current
timestamp, what about modified?

Tarique


On Wed, Mar 12, 2014 at 3:01 PM, José Lorenzo jose@gmail.com wrote:

 Entities go in App/Model/Entity/ and they should be the singular of your
 table without suffixes. For example App/Model/Entity/Article.php that way
 cakephp will be able to load it and know it is associated to ArticlesTable.

 If you wish to divert from the conventions you can change it in your table
 class:

 class ArticlesTable extends Table {

   public function initialize(array $config) {
  $this-entityClass('App\Model\ArticleEntity');
   }
 }

 In general I would not recommend this as it makes it harder for the
 FormHelper to figure out where stuff is.


 On Wednesday, March 12, 2014 10:12:30 AM UTC+1, Dr. Tarique Sani wrote:

 ok that brings me to the next question.

 How do I get $article = $this-Articles-newEntity($this-request-data);
 to use the Entity class I have created in  App/Model/ArticleEntity.php ?
 Doesn't the controller automagically include it, What is the convention for
 Entity classes?

 Tarique



 On Wed, Mar 12, 2014 at 12:53 PM, José Lorenzo jose...@gmail.com wrote:

 This could possibly be the most difficult part to understand in 3.0 and
 may be subject to change if it turns out to be too complicated. All
 properties in the entities are protected by default against mass
 assignment, you need to modify your Article entity in order to let CakePHP
 know what properties can be assigned by newEntity:

 class Article extends Entity {

   protected $_accessible = ['title' = true, 'body' = true];

 }

 or if you just don't care (not recommended):

 class Article extends Entity {

   protected $_accessible = ['*' = true];

 }

 The latter can be seen as a Eloquent::unguard();

 On Wednesday, March 12, 2014 6:30:45 AM UTC+1, Dr. Tarique Sani wrote:

  Wonder why saving is failing

 I am doing

 $article = $this-Articles-newEntity($this-request-data);

 if ($this-Articles-save($article)) {
 $this-Session-setFlash(__('Your article has been
 saved.'));
 return $this-redirect(['action' = 'index']);
 }

 $this-Session-setFlash(__('Unable to add your article.'));


 debug($this-request-data);

 gives

  [
 'title' = 'Test Title',
 'body' = 'This is the body'
 ]


 but debug($article);

 give

 object(Cake\ORM\Entity) {

 'new' = null,
  'accessible' = [],
 'properties' = [],
 'dirty' = [],
  'virtual' = [],
 'errors' = []

 }

 What can possibly be wrong. I am guessing the title and body should
 appear as properties of the newly created entity without which the saving
 will not happen

 I did a composer update just now - so I do have the latest code.

 Cheers
 Tarique

 --
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 =

  --
 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+u...@googlegroups.com.
 To post to this group, send email to cake...@googlegroups.com.

 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.




 --
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 =

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




-- 
=
The Conference Schedule Creator : http://shdlr.com

PHP for E-Biz : http://sanisoft.com
=

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

Re: V3.0 - saving fails...

2014-03-12 Thread José Lorenzo
Add the Timestamp behavior to your table:

class ArticlesTable extends Table {

  public function initialize(array $config) {
 $this-addBehavior('Timestamp');
  }
}

http://book.cakephp.org/3.0/en/core-libraries/behaviors/timestamp.html


On Wednesday, March 12, 2014 11:10:05 AM UTC+1, Dr. Tarique Sani wrote:

 Thanks again. Last question of the day - what to do to get created and 
 modified fields to work automagically. Created can be defaulted to current 
 timestamp, what about modified?

 Tarique


 On Wed, Mar 12, 2014 at 3:01 PM, José Lorenzo jose...@gmail.comjavascript:
  wrote:

 Entities go in App/Model/Entity/ and they should be the singular of your 
 table without suffixes. For example App/Model/Entity/Article.php that way 
 cakephp will be able to load it and know it is associated to ArticlesTable.

 If you wish to divert from the conventions you can change it in your 
 table class:

 class ArticlesTable extends Table {

   public function initialize(array $config) {
  $this-entityClass('App\Model\ArticleEntity');
   }
 }

 In general I would not recommend this as it makes it harder for the 
 FormHelper to figure out where stuff is.


 On Wednesday, March 12, 2014 10:12:30 AM UTC+1, Dr. Tarique Sani wrote:

 ok that brings me to the next question. 

 How do I get $article = $this-Articles-newEntity($this-request-data); 
 to use the Entity class I have created in  App/Model/ArticleEntity.php ? 
 Doesn't the controller automagically include it, What is the convention for 
 Entity classes?
  
 Tarique



 On Wed, Mar 12, 2014 at 12:53 PM, José Lorenzo jose...@gmail.comwrote:

 This could possibly be the most difficult part to understand in 3.0 and 
 may be subject to change if it turns out to be too complicated. All 
 properties in the entities are protected by default against mass 
 assignment, you need to modify your Article entity in order to let CakePHP 
 know what properties can be assigned by newEntity:

 class Article extends Entity {

   protected $_accessible = ['title' = true, 'body' = true];

 }

 or if you just don't care (not recommended):

 class Article extends Entity {

   protected $_accessible = ['*' = true];

 }

 The latter can be seen as a Eloquent::unguard();

 On Wednesday, March 12, 2014 6:30:45 AM UTC+1, Dr. Tarique Sani wrote:

  Wonder why saving is failing 

 I am doing 

 $article = $this-Articles-newEntity($this-request-data);

 if ($this-Articles-save($article)) {
 $this-Session-setFlash(__('Your article has been 
 saved.'));
 return $this-redirect(['action' = 'index']);
 }
  
 $this-Session-setFlash(__('Unable to add your article.'));


 debug($this-request-data);

 gives

  [
 'title' = 'Test Title',
 'body' = 'This is the body'
 ]


 but debug($article);

 give

 object(Cake\ORM\Entity) {

 'new' = null,
  'accessible' = [],
 'properties' = [],
 'dirty' = [],
  'virtual' = [],
 'errors' = []

 }

 What can possibly be wrong. I am guessing the title and body should 
 appear as properties of the newly created entity without which the saving 
 will not happen

 I did a composer update just now - so I do have the latest code.

 Cheers
 Tarique

 -- 
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 = 

  -- 
 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+u...@googlegroups.com.
 To post to this group, send email to cake...@googlegroups.com.

 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 = 

  -- 
 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+u...@googlegroups.com javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 =
 The Conference Schedule Creator : http://shdlr.com

 PHP for E-Biz : http://sanisoft.com
 = 


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter 

Re: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread Dr. Tarique Sani
Actually it is almost apples to oranges. The philosophy of CakePHP has been
to be a full stack, highly opinionated framework, I very much prefer this.
This is in stark contrast with Laravel where you can do the complete app in
the Router. This is great for developing concepts but encourages bad
practices. Also there is a lot of confusion in Laravel land as to what goes
where and everyone and their brother have their own perfect App folder
setup.

The coolest thing which I miss is the ViewModel pattern which Laravel does
via View::composer, in cake the best I can do is create a helper and use it
as ViewModel - I used this a lot to create widgets in my applications

Another thing which I liked was http verb prefixing to controller actions,
so for example getAdd and postAdd are separate methods called on
appropriate http methods avoiding the if ($this-request-is('post'))
spaghetti in controllers.

Strong focus on using migrations for database/table creations.

Built in messaging queue system with multiple backends - though they do not
have gearman by default

Validation as a service

There are several such things which made me go - Oh! they have this,
Nice...

That said - here I am back with CakePHP because I just never felt at home
out there :)

Tarique



On Wed, Mar 12, 2014 at 3:27 PM, José Lorenzo jose@gmail.com wrote:

 Tarique, as a former Laravel user what do you think can CakePHP 3 to
 improve and appeal those users that think laravel is better?


 On Tuesday, March 11, 2014 10:24:44 AM UTC+1, Dr. Tarique Sani wrote:

  But I seem to notice less and less so I was only wondering if people
 are jumping ship and moving on to other frameworks.


 Then this would be a wrong place to ask ;-)


 Tarique


 On Tue, Mar 11, 2014 at 1:21 PM, Advantage+ movep...@gmail.com wrote:

 In no way am I putting Cake down, I love Cake and use it for almost
 every project. I love it!

 I just see lack of fan fare as you can call it over the years. I see
 familiar names always answering questions for users. That's great!



 But I seem to notice less and less so I was only wondering if people are
 jumping ship and moving on to other frameworks.



 That's all.



 *From:* cake...@googlegroups.com [mailto:cake...@googlegroups.com] *On
 Behalf Of *Thomas von Hassel

 *Sent:* Tuesday, March 11, 2014 4:46 AM
 *To:* cake...@googlegroups.com

 *Subject:* Re: Is Cake Dead Or Just Catching Up?



 If you switch frameworks every 6 months you are doing it wrong.



 So far CakePHP does what i need it to do, and i see no reason to shop
 around. Also, with the things coming in 3.0 I'm very optimistic about the
 direction the dev. team is taking.



 In regards to traffic on the list/google group, i suspect a lot of
 newbies end up on Stack Overflow, and not here.



 /thomas





 On 11 Mar 2014, at 06:13, Advantage+ movep...@gmail.com wrote:



 Looking at these stats is Cake dead?



 http://www.sitepoint.com/best-php-frameworks-2014/



 Can it keep up or catch up?



 Over the years I would see 50 Cake messages a day, now it's lucky if you
 see 2 topics with 1 response in the daily abridged update.

 Very few questions hit the inbox, less and less ever day.



 Don't get me wrong I love Cake but is heading out to the pasture to call
 it a day?

 Seems no longer a popular framework as others pop up.



 Others are much faster, and have everything Cake has to offer and more.



 Everyone has an opinion, let's see if anyone replies or too busy with
 other frameworks J





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



 --
 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+u...@googlegroups.com.
 To post to this group, send email to cake...@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+u...@googlegroups.com.
 To post to this group, send email to cake...@googlegroups.com.

 Visit this group at http://groups.google.com/group/cake-php.
 For 

Re: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread José Lorenzo
Thanks for the overview, I can respond to some of those missing features

- App in the router: Not going to happen, we have a strong opinion on how 
the framework should help you structure your apps. With that said, he have 
planned a better middleware layer, that is, smaller classes or functions 
that can respond or modify a request without having a controller.
- ViewModel: Although that is badly named in laravel (like Facades) I also 
thing it is a cool feature to borrow from rails (called drappers) and it is 
in my personal plans to add it along with the concept of a partial from 
rails.
- Verb prefixing: Probably not going to happen, I do have planned having 
separate action classes. An action class will need to implement all the 
http verbs it is interested in. Each time I had such spaghetti I realized 
that all that code needed to be in a separate class.
- Migrations: We need big help with this, we have not started with this 
part of the framework yet
- Message queues: There are enough plugins available out there, we will 
most probably endorse one and encourage its use.
- Validation as a service: Already done!

I'm glad to have you back! Is there anything in cake 3 that makes you thing 
he are ahead?

On Wednesday, March 12, 2014 11:31:24 AM UTC+1, Dr. Tarique Sani wrote:

 Actually it is almost apples to oranges. The philosophy of CakePHP has 
 been to be a full stack, highly opinionated framework, I very much prefer 
 this. This is in stark contrast with Laravel where you can do the complete 
 app in the Router. This is great for developing concepts but encourages bad 
 practices. Also there is a lot of confusion in Laravel land as to what goes 
 where and everyone and their brother have their own perfect App folder 
 setup.   

 The coolest thing which I miss is the ViewModel pattern which Laravel does 
 via View::composer, in cake the best I can do is create a helper and use it 
 as ViewModel - I used this a lot to create widgets in my applications

 Another thing which I liked was http verb prefixing to controller actions, 
 so for example getAdd and postAdd are separate methods called on 
 appropriate http methods avoiding the if ($this-request-is('post')) 
 spaghetti in controllers. 

 Strong focus on using migrations for database/table creations.

 Built in messaging queue system with multiple backends - though they do 
 not have gearman by default

 Validation as a service

 There are several such things which made me go - Oh! they have this, 
 Nice... 

 That said - here I am back with CakePHP because I just never felt at home 
 out there :)

 Tarique



 On Wed, Mar 12, 2014 at 3:27 PM, José Lorenzo jose...@gmail.comjavascript:
  wrote:

 Tarique, as a former Laravel user what do you think can CakePHP 3 to 
 improve and appeal those users that think laravel is better?


 On Tuesday, March 11, 2014 10:24:44 AM UTC+1, Dr. Tarique Sani wrote:

  But I seem to notice less and less so I was only wondering if people 
 are jumping ship and moving on to other frameworks.


 Then this would be a wrong place to ask ;-) 


 Tarique


 On Tue, Mar 11, 2014 at 1:21 PM, Advantage+ movep...@gmail.com wrote:

 In no way am I putting Cake down, I love Cake and use it for almost 
 every project. I love it!

 I just see lack of fan fare as you can call it over the years. I see 
 familiar names always answering questions for users. That’s great!

  

 But I seem to notice less and less so I was only wondering if people 
 are jumping ship and moving on to other frameworks.

  

 That’s all.

  

 *From:* cake...@googlegroups.com [mailto:cake...@googlegroups.com] *On 
 Behalf Of *Thomas von Hassel

 *Sent:* Tuesday, March 11, 2014 4:46 AM
 *To:* cake...@googlegroups.com

 *Subject:* Re: Is Cake Dead Or Just Catching Up?

  

 If you switch frameworks every 6 months you are doing it wrong.

  

 So far CakePHP does what i need it to do, and i see no reason to shop 
 around. Also, with the things coming in 3.0 I’m very optimistic about the 
 direction the dev. team is taking.

  

 In regards to traffic on the list/google group, i suspect a lot of 
 newbies end up on Stack Overflow, and not here.

  

 /thomas

  

  

 On 11 Mar 2014, at 06:13, Advantage+ movep...@gmail.com wrote:



 Looking at these stats is Cake dead?

  

 http://www.sitepoint.com/best-php-frameworks-2014/

  

 Can it keep up or catch up?

  

 Over the years I would see 50 Cake messages a day, now it's lucky if 
 you see 2 topics with 1 response in the daily abridged update.

 Very few questions hit the inbox, less and less ever day…..

  

 Don’t get me wrong I love Cake but is heading out to the pasture to 
 call it a day?

 Seems no longer a popular framework as others pop up.

  

 Others are much faster, and have everything Cake has to offer and more.

  

 Everyone has an opinion, let's see if anyone replies or too busy with 
 other frameworks J

  

  

 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter 

Re: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread Dr. Tarique Sani
Great to know all that. Just a minor clarification drappers is in
implementation of the Decorator pattern while View::Composer in Laravel is
an implementation of ViewModel pattern. Subtle differences between the two.
Having decorators for models would be awesome too

It would not be fair to compare a final version with a developer preview
version :)

Tarique


On Wed, Mar 12, 2014 at 4:13 PM, José Lorenzo jose@gmail.com wrote:

 Thanks for the overview, I can respond to some of those missing features

 - App in the router: Not going to happen, we have a strong opinion on how
 the framework should help you structure your apps. With that said, he have
 planned a better middleware layer, that is, smaller classes or functions
 that can respond or modify a request without having a controller.
 - ViewModel: Although that is badly named in laravel (like Facades) I also
 thing it is a cool feature to borrow from rails (called drappers) and it is
 in my personal plans to add it along with the concept of a partial from
 rails.
 - Verb prefixing: Probably not going to happen, I do have planned having
 separate action classes. An action class will need to implement all the
 http verbs it is interested in. Each time I had such spaghetti I realized
 that all that code needed to be in a separate class.
 - Migrations: We need big help with this, we have not started with this
 part of the framework yet
 - Message queues: There are enough plugins available out there, we will
 most probably endorse one and encourage its use.
 - Validation as a service: Already done!

 I'm glad to have you back! Is there anything in cake 3 that makes you
 thing he are ahead?


 On Wednesday, March 12, 2014 11:31:24 AM UTC+1, Dr. Tarique Sani wrote:

 Actually it is almost apples to oranges. The philosophy of CakePHP has
 been to be a full stack, highly opinionated framework, I very much prefer
 this. This is in stark contrast with Laravel where you can do the complete
 app in the Router. This is great for developing concepts but encourages bad
 practices. Also there is a lot of confusion in Laravel land as to what goes
 where and everyone and their brother have their own perfect App folder
 setup.

 The coolest thing which I miss is the ViewModel pattern which Laravel
 does via View::composer, in cake the best I can do is create a helper and
 use it as ViewModel - I used this a lot to create widgets in my applications

 Another thing which I liked was http verb prefixing to controller
 actions, so for example getAdd and postAdd are separate methods called on
 appropriate http methods avoiding the if ($this-request-is('post'))
 spaghetti in controllers.

 Strong focus on using migrations for database/table creations.

 Built in messaging queue system with multiple backends - though they do
 not have gearman by default

 Validation as a service

 There are several such things which made me go - Oh! they have this,
 Nice...

 That said - here I am back with CakePHP because I just never felt at home
 out there :)

 Tarique



 On Wed, Mar 12, 2014 at 3:27 PM, José Lorenzo jose...@gmail.com wrote:

 Tarique, as a former Laravel user what do you think can CakePHP 3 to
 improve and appeal those users that think laravel is better?


 On Tuesday, March 11, 2014 10:24:44 AM UTC+1, Dr. Tarique Sani wrote:

  But I seem to notice less and less so I was only wondering if people
 are jumping ship and moving on to other frameworks.


 Then this would be a wrong place to ask ;-)


 Tarique


 On Tue, Mar 11, 2014 at 1:21 PM, Advantage+ movep...@gmail.com wrote:

 In no way am I putting Cake down, I love Cake and use it for almost
 every project. I love it!

 I just see lack of fan fare as you can call it over the years. I see
 familiar names always answering questions for users. That's great!



 But I seem to notice less and less so I was only wondering if people
 are jumping ship and moving on to other frameworks.



 That's all.



 *From:* cake...@googlegroups.com [mailto:cake...@googlegroups.com] *On
 Behalf Of *Thomas von Hassel

 *Sent:* Tuesday, March 11, 2014 4:46 AM
 *To:* cake...@googlegroups.com

 *Subject:* Re: Is Cake Dead Or Just Catching Up?



 If you switch frameworks every 6 months you are doing it wrong.



 So far CakePHP does what i need it to do, and i see no reason to shop
 around. Also, with the things coming in 3.0 I'm very optimistic about the
 direction the dev. team is taking.



 In regards to traffic on the list/google group, i suspect a lot of
 newbies end up on Stack Overflow, and not here.



 /thomas





 On 11 Mar 2014, at 06:13, Advantage+ movep...@gmail.com wrote:



 Looking at these stats is Cake dead?



 http://www.sitepoint.com/best-php-frameworks-2014/



 Can it keep up or catch up?



 Over the years I would see 50 Cake messages a day, now it's lucky if
 you see 2 topics with 1 response in the daily abridged update.

 Very few questions hit the inbox, less and less ever day.



 Don't get me wrong I 

Re: Jasper reports at Cakephp

2014-03-12 Thread José Lorenzo
You would need to use the Jasper php 
client http://community.jaspersoft.com/wiki/php-client-sample-code

On Wednesday, March 12, 2014 1:52:14 AM UTC+1, YOONG SINJIE wrote:

 HI friend , anyone know how to integrate cakephp with jasper reports ?


 :D


-- 
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: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread kdubya
I'm taking the bait:

Looking at the article and the pie chart I have the following observations:

Given that the bottom 8 frameworks (pear is a framework?) all have a 
response of 1.50% (likely one response each) and the intervals between the 
other groups (Zend 1 and none likely had 2 responses each , etc.) one can 
infer that the sample size of the valid responses to the survey was 67 +/-. 
Hardly a valid sample size. They conveniently left out this fact from their 
article. Any good survey ALWAYS gives the sample size.

What is sitepoint.com and what gives them the brass to say their 
readership mirrors the PHP Community at large?

I have used CakePHP for 5 years and I'm very happy with most aspects. The 
changes from 1.3 to 2.x really were a big improvement. I have not begun 
looking at 3.0 yet. 

I have tired Codeigniter and Symphony 2 briefly but ran back to Cake very 
quickly. It fits my thinking.

Also, judging by participation in the Google CakePHP group is not very 
valid either. StackOverflow seems to be more active now and the questions 
seem to be better.

Ken

-- 
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: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread Jeremy Burns : Class Outfit
I was also surprised to see Zend so far down - any glance over the job boards 
suggests this is one of the most in demand frameworks. I'm not losing any sleep 
over this survey.

On 12 Mar 2014, at 14:50, kdubya kenwin...@winanstech.com wrote:

 I'm taking the bait:
 
 Looking at the article and the pie chart I have the following observations:
 
 Given that the bottom 8 frameworks (pear is a framework?) all have a 
 response of 1.50% (likely one response each) and the intervals between the 
 other groups (Zend 1 and none likely had 2 responses each , etc.) one can 
 infer that the sample size of the valid responses to the survey was 67 +/-. 
 Hardly a valid sample size. They conveniently left out this fact from their 
 article. Any good survey ALWAYS gives the sample size.
 
 What is sitepoint.com and what gives them the brass to say their readership 
 mirrors the PHP Community at large?
 
 I have used CakePHP for 5 years and I'm very happy with most aspects. The 
 changes from 1.3 to 2.x really were a big improvement. I have not begun 
 looking at 3.0 yet. 
 
 I have tired Codeigniter and Symphony 2 briefly but ran back to Cake very 
 quickly. It fits my thinking.
 
 Also, judging by participation in the Google CakePHP group is not very valid 
 either. StackOverflow seems to be more active now and the questions seem to 
 be better.
 
 Ken
 
 -- 
 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.

-- 
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: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread Paul Willis

On 12 Mar 2014, at 14:50, kdubya kenwin...@winanstech.com wrote:

 Also, judging by participation in the Google CakePHP group is not very valid 
 either. StackOverflow seems to be more active now and the questions seem to 
 be better.

I agree, I asked a few questions on the Google group when I first got started 
with CakePHP, now I've more experience my questions are rarer but I often find 
the answers with a search on StackOverflow.

Paul

-- 
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: Is Cake Dead Or Just Catching Up?

2014-03-12 Thread Leandro Machado Pereira
Hi, guys.

I searched in stack overflow for tags cakephp, zend and laravel.

I saw this cake and zend have 2.5~2.6k of answer to today versus laravel
have 680.

Cake have 28 asked today(150 this week) , Zend have 23 asked today(127 this
week) and laravel have 23 asked today(254 this week).

Tags laravel is more hot, but i think this because errors and questions for
new implements, but it is only a suspicion.

I like Cake today and I very enthusiastic for Cake 3.0

Regards


2014-03-12 11:59 GMT-03:00 Paul Willis paul.wil...@me.com:


 On 12 Mar 2014, at 14:50, kdubya kenwin...@winanstech.com wrote:

  Also, judging by participation in the Google CakePHP group is not very
 valid either. StackOverflow seems to be more active now and the questions
 seem to be better.

 I agree, I asked a few questions on the Google group when I first got
 started with CakePHP, now I've more experience my questions are rarer but I
 often find the answers with a search on StackOverflow.

 Paul

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




-- 


http://leandrompereira.com.br

***Se você pretende redirecionar este e-mail, por favor, apague todos os
endereços que aparecem nele. Outra dica de segurança é endereçá-lo no Cco.
Desta forma você estará protegendo a mim, seus amigos e a você mesmo. Eu e
a Campanha Contra o SPAM agradecemos.Não envie correntes.***

-- 
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: CakePHP 2.3.8 and MySQL's YEAR Type

2014-03-12 Thread DJ Far
Will was referring to the data type, not the input type.  Cake handles all 
kinds of data types that are not also input types (decimal, float, etc.). 
 The benefit of Cake is that it has some smarts about creating inputs based 
on the data types in your model, but with the YEAR data type, which I admit 
is a little obscure, bake does indeed translate it into a TEXT data type, 
which the view then renders correctly as an input type=textarea.  The 
problem is in the model: I haven't dug into the bake code to see how it 
handles data types, but I suspect any data type it doesn't have a 
translation for it just goes to the biggest most gigantic catchall datatype 
that makes sense, which is TEXT.
I had the same problem in an insurance form that needed just a year in a 
field.  The year type in MySQL seemed to make sense, but then after the 
behavior that Will and I experienced, I decided to use INT(4), and set 
ranges.  
BTW, another limit to the YEAR data type: to keep the type small (1 byte), 
it's limited to a range of 255 years, which MySQL decided should start at 
1901 and end in 2155 - you have no say in the range, you lowly designer of 
your own database.

On Sunday, August 25, 2013 10:32:48 AM UTC-7, Vanja Dizdarević wrote:

 You should resolve that by using a proper form element in your views. Year 
 is not a recognized input type

 ?php
 $options = array();
 $from = 1990;
 $to = 2030;
 for ($i = $from; $i = $to; $i++) {
   $options[(string)$i] = (string)$i;
 }
 ?
 ?php echo $this-Form-input('year', array( 'type' = 'select', 
 'options' = $options)); ?


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


CakePHP 3.0.0 development preview 2 released

2014-03-12 Thread José Lorenzo


The CakePHP core team is excited to announce the second development preview 
of CakePHP 3.0.0[1]. In the few months since 3.0.0-dev1, we've been hard at 
work incorporating community feedback on the ORM, and building out some of 
the functionality that was missing in the first development preview.
http://bakery.cakephp.org/articles/lorenzo/2014/03/12/cakephp_3_0_0_dev_preview_2_released#new-features-in-300-dev2New
 
features in 3.0.0-dev2
   
   - CakePHP has adopted the PSR-4 autoloader standard. If you are 
   updating, make sure you update composer as well usingcomposer self-update
.
   - The directory structure of both CakePHP and the App skeleton has been 
   simplified a bit thanks to PSR-4.
   - The AclComponent has been removed - It will be returning as a plugin.
   - The TestShell, and webrunner have been removed in favor of only 
   supporting phpunit from the CLI, and VisualPHPUnit.
   - View templates have been moved from View/ to Template/. This was done 
   so the View/ directory would only contain view classes and helpers.
   - The HtmlHelper, FormHelper, and SessionHelper use string templates 
   consistently.
   - ID attributes are now always generated with - instead of CamelCase. 
   This was done to standardize on one convention for CSS selectors.
   - API documentation and the cookbook have had many new sections and 
   improvements.
   - Scaffold has been removed. Improved dynamic scaffolding is now 
   available through the CRUD plugin[2] which is already compatible with 3.0 
   and takes away much of the repetitive tasks done in controllers.
   - The UpgradeShell has been moved into a separate plugin.
   - Better debugging output for some complex objects like Entities, Tables 
   and Queries. Also added a special method to control what data is outputed 
   for objects when using the debug() function
   - Added Collection::insert()

http://bakery.cakephp.org/articles/lorenzo/2014/03/12/cakephp_3_0_0_dev_preview_2_released#formhelper
FormHelper

FormHelper has been re-built from the ground up. It features a new 
extensible widget system. Form widgets allow you to build self contained 
input widgets. This makes it easy to define complex widgets like the 
datetime widget in application or plugin code. Once created, widgets can be 
combined with other FormHelper features like input() .

FormHelper also works with the new ORM now. You can create forms for 
individual entities, or collections of entities:


// Create a form for a single entity  its associations
echo $this-Form-create($article);

// Create a form for multiple entities  their associations.
echo $this-Form-create($articles);

FormHelper also features a pluggable context system that allows you to 
integrate FormHelper with any ORM you may wish to use.
http://bakery.cakephp.org/articles/lorenzo/2014/03/12/cakephp_3_0_0_dev_preview_2_released#translatebehavior
TranslateBehavior

TranslateBehavior has been re-built from the ground up. It features the 
long awaited ability to translate *all* models including associations from 
a find(). The new TranslateTrait makes dealing with multiple translations 
in your entities simple as well.
http://bakery.cakephp.org/articles/lorenzo/2014/03/12/cakephp_3_0_0_dev_preview_2_released#orm-improvementsORM
 
improvements

We've continued to build out capabilities in the ORM. Some notable 
improvements in dev2 were:

   - Composite primary key support - The ORM now supports composite primary 
   keys in all associations.
   - The Model.beforefind event is now triggered for all associations in 
   the same query.
   - Eager loading is now separate from the Query class. This makes 
   implementing custom eager loading much easier.
   - Model/Repository was renamed to Model/Table. Several people found 
   'Repository' to be a confusing and alien term.
   - Interfaces have been extracted to reduce the reliance on concrete 
   implementations.
   - The formatResults() method has been added to provide many of the 
   features that afterFind() used to do.
   - Query::counter() was added to provide support for complex count logic. 
   This makes it easier to override the count in the PaginatorComponent.
   - Table::patchEntity() was added, it enables you to merge requet form 
   data into an existing entity and its associations.

http://bakery.cakephp.org/articles/lorenzo/2014/03/12/cakephp_3_0_0_dev_preview_2_released#up-nextUp
 
next

Our next release will be yet another development preview. In the dev3 
release we are going to focus on updating:

   - Bake and all the related tasks need to be updated to work with the new 
   ORM.
   - Update the i18n extract task to extract validation messages from Table 
   objects
   - Add support for SQLServer. With the database layer reasonably stable 
   adding SQLServer will help developers on windows.

For more details on all the changes in 3.0.0, you can consult the migration 
guide[2]. I'd like to thank everyone who has contributed thoughts, code, 

Re: RESTful (Form) Validation?

2014-03-12 Thread OJ Tibi - @ojtibi
Thanks, AD. I'll be reading the example today.

Cheers,
OJ

On Wednesday, March 12, 2014 12:06:00 PM UTC+8, OJ Tibi - @ojtibi wrote:

 Hi folks,

 I was wondering if there was a way to let the client app know which fields 
 it submitted have validation errors. (As you can see, I placed Form 
 between parentheses because there isn't really an HTML form in a REST API 
 request.) While the Cookbook recommends to use the built-in Exception 
 classes to respond to errors in REST requests, there is no recommended way 
 to include Model::validationErrors in the response.

 Right now, I'm inclined to create my own subclass of HttpException, but 
 after reading the core files, it looks like I might also need to create a 
 custom ErrorHandler and ExceptionRenderer class, if I understand correctly. 
 Essentially, I just want to add a 'validation_errors' key in the 
 '_serialize' array exported by ExceptionRenderer.

 The question is, will I be overdoing it if I did what I outlined above, 
 *or* should I just pass a implode()'d Model::validationErrors as a $message 
 to BadRequestException/InternalErrorException? Also note that 
 Model::validationErrors is a multi-level array with named keys.

 Cheers,
 OJ


-- 
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: RESTful (Form) Validation?

2014-03-12 Thread OJ Tibi - @ojtibi
AD,

I would just want to say that your reply was helpful! I'm now reading the 
details of crud/Error/CrudExceptionRenderer.php  and 
crud/Error/Exception/CrudValidationException and I'll be taking cue from 
these. It also looks like the friendsofcake/crud plugin will be very useful 
to me someday when I start on a new project. For now, I'll just be taking 
bits and pieces from that idea since I'm already in the middle of 
prototyping.

Cheers,
OJ

On Wednesday, March 12, 2014 12:06:00 PM UTC+8, OJ Tibi - @ojtibi wrote:

 Hi folks,

 I was wondering if there was a way to let the client app know which fields 
 it submitted have validation errors. (As you can see, I placed Form 
 between parentheses because there isn't really an HTML form in a REST API 
 request.) While the Cookbook recommends to use the built-in Exception 
 classes to respond to errors in REST requests, there is no recommended way 
 to include Model::validationErrors in the response.

 Right now, I'm inclined to create my own subclass of HttpException, but 
 after reading the core files, it looks like I might also need to create a 
 custom ErrorHandler and ExceptionRenderer class, if I understand correctly. 
 Essentially, I just want to add a 'validation_errors' key in the 
 '_serialize' array exported by ExceptionRenderer.

 The question is, will I be overdoing it if I did what I outlined above, 
 *or* should I just pass a implode()'d Model::validationErrors as a $message 
 to BadRequestException/InternalErrorException? Also note that 
 Model::validationErrors is a multi-level array with named keys.

 Cheers,
 OJ


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


V3.0 Custom validation messages

2014-03-12 Thread Dr. Tarique Sani
My AtriclesTable has


public function validationDefault($validator) {
$validator
-add('title', 'not-Empty', [
'rule' = 'notEmpty',
'message' = 'You need to provide a title',
])
-add('body', 'not-Empty', [
'rule' = 'notEmpty',
'message' = 'A body is required'
]);
return $validator;
}

When I try to save an article entity the validation runs fine but I am only
getting the default in the ArticleEntity

'errors' = [
'title' = [
(int) 0 = 'This field cannot be left empty'
],
'body' = [
(int) 0 = 'This field cannot be left empty'
]
]

Additionally there is a warning

Strict (2048): Declaration of
App\Model\Table\ArticlesTable::validationDefault() should be compatible
with Cake\ORM\Table::validationDefault(Cake\Validation\Validator
$validator) [APP/Model/Table/ArticlesTable.php, line 7]

What additional steps are needed to fix this?

Cheers
Tarique

-- 
=
The Conference Schedule Creator : http://shdlr.com

PHP for E-Biz : http://sanisoft.com
=

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