Hello,Iread the documentation to create a simple login form.each time I try
to log in it returns true always;
//UsersController
public function login() {
if ($this-Auth-user()) {
$this-redirect($this-Auth-redirect());
}
if ($this-request-is('post')) {
Try this
public findFlat($query, $options = []) {
return $query-formatResults(function($results, $query) {
return $results-map(function($row) {
if ($row-content) {
$row-set($row-content-toArray(), ['guard' = false]);
$row-unsetProperty('content');
}
return $row;
});
});
}
$row =
ok it works!
To me remain a mistery why using first() the callback in $results-map() is
called twice while not using first is called once.
Could it be a bug?
2014-04-16 13:11 GMT+02:00 José Lorenzo jose@gmail.com:
Try this
public findFlat($query, $options = []) {
return
Business-related DATA-connected logic is best residing in the Model, yes
but there are still other considerations.
What if your logic was somehow VIew-related? For example you had to show
some complex three-like structure and you wanted to pre-process it on the
server?
A model would do of
Paste the full code where you see it being called twice, please. I will
also check with my own code
On Wednesday, April 16, 2014 2:23:54 PM UTC+2, bato wrote:
ok it works!
To me remain a mistery why using first() the callback in $results-map()
is called twice while not using first is
I just tested with this code and checked that the callback is executed only
once:
$table = TableRegistry::get('Articles');
$table
-find()
-formatResults(function($r) {
return $r-map(function($r) {
debug('a');
return $r;
});
})
-first();
On Wednesday, April 16, 2014 2:33:35 PM UTC+2, José
who can send me some video about cakephp?
On Thursday, March 13, 2014 5:35:36 AM UTC+8, José Lorenzo wrote:
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
uhm... I found when it repeats twice.
try
$table = TableRegistry::get('Articles');
$table
-find()
-formatResults(function($r) {
return $r-map(function($r) {
debug('a');
return $r;
});
})
-first();
debug($table-toArray());
I have debug($table-toArray()); after the find chain. I suppose that
I can't.
Am Mittwoch, 16. April 2014 14:34:56 UTC+2 schrieb steven lee:
who can send me some video about cakephp?
On Thursday, March 13, 2014 5:35:36 AM UTC+8, José Lorenzo wrote:
The CakePHP core team is excited to announce the second development
preview of CakePHP 3.0.0[1]. In the few
You are like the 400th person who didnt read that part of the documentation
in 2.x
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in
(red warning box)
if ($this-Auth-login($this-request-data['User'])) {}
always logs this data in
You can build tree based menus using the Tree helper
See www.dereuromark.de/2013/02/17/cakephp-and-tree-structures/
echo $this-Tree-generate($categories);
Am Dienstag, 15. April 2014 19:41:20 UTC+2 schrieb Naresh Kumar:
I am using CakePHP tree to generate my navigation menu . I have
Yeah, it will execute it as many times as you iterate the results. If you
want to cache the results of a set of formatters call compile() on the
resulting collection. This is because it needs to make sure formatters are
applied to all rows.
On Wednesday, April 16, 2014 5:06:38 PM UTC+2, bato
OK, I've got it. I will have a look to compile() method.
Thanks for your help
Il 16/apr/2014 21:06 José Lorenzo jose@gmail.com ha scritto:
Yeah, it will execute it as many times as you iterate the results. If you
want to cache the results of a set of formatters call compile() on the
13 matches
Mail list logo