There are several ways to achieve what you want and they are all in the docs. Quoting a few lines from the V3 Book
$allTitles = $articles->find()->extract('title'); //you can add a ->where() to this
$this->User->validates(array('fieldList' => array('email', 'password')))
Yes your controller looks just about right and it is very easy to understand what to expect as I read further.
HTH
T
On Sun, Sep 21, 2014 at 4:23 PM, Dave Edwards <google@bubbletoonz.com> wrote:
Hi,--I am trying to write an app in 3.xx using functionality that I have previously used in 2.xx but despite scouring the docs, I cannot find the answers. Apologies if they are in there, but there seems to be 5x the amount of documentation especially around the new ORM.In 2.xx I could easily find the value of a single field e.g. $this->User->field('temp_key') Is there a 3.xx equivalent ?In 2.xx I could validate a field in a model e.g. $this->User->validates(array('fieldList' => array('email'))) Is there a 3.xx equivalent ?Lastly a general question. The top of my Users controller currently looks like this, and I've not yet finished it...namespace App\Controller;use App\Controller\AppController;use Cake\Network\Exception\ForbiddenException;use Cake\Event\Event;use Cake\ORM\TableRegistry;use Cake\Utility\Security;use Cake\ORM\Entity;class UsersController extends AppController {Does this look right, compared to the simplicity of 2.xx this now looks very unwieldy and complicated?Thanks for any replies.Dave
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.
=============================================================
Hire a CakePHP dev team : http://sanisoft.com
=============================================================
Hire a CakePHP dev team : 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+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.
No comments:
Post a Comment