Sunday, October 4, 2015

Which is the right way to check if find() returns any record? cakephp 3.0

hello,

i'm looking for the right way in cakephp 3.0 to check is a find() query returns any record.
By now i'm executing the query with a $result = find()->toArray and checking if $result is empty or not, but the problem is that i can not sent $result to $this->paginate() as paginate needs an object.
There is a way to check if find() returns any row before to iterate over it?

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.

Unmodified 2.7.5 (and 2.7.4) crashes after renaming app/Config/database.php.default

My web server runs PHP 5.3.3, so I can't use Cakephp 3.  2.7.5 seems to work, the landing page comes up and it reacts to things like changing the salt or tmp permissions, but the moment I rename app/Config/database.php.default to just ...database.php, it crashes with this error:

Fatal error: Class declarations may not be nested in <path>/caketest/cakephp-2.7.5/lib/Cake/Error/ExceptionRenderer.php on line 54


Changing database.php to have accurate information does not change this, and this occurs even on an entirely fresh installation of cakephp, with literally no files modified other than database.php.  Cakephp 2.7.4 produces exactly the same symptoms.  I have seen nothing online about this; what could cause it?

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

Friday, October 2, 2015

Re: Query showing all data

Do you still have this issue?

What have you tried to do to solve it?
- try the SQL statement in phpMyAdmin directly using a know value for "eireceiver"!
- try replacing '$matriid' with a known value, ie. that you know is in the database!

Kindly inform us of the result :)
Enjoy, John

On Thursday, 1 October 2015 08:22:07 UTC+3, cakephp-learner wrote:
Hi,
I am fetching a strange problem.
When i am using a custom query like the following one
 $re = $this->Expressinterest->query( "SELECT * FROM expressinterest Where eireceiver = '$matriid' order by id desc limit 0 , 5");
     
It's taking all the data though here is a condition and limit.
Can anyone tell me what's the problem.

Thanks
Zahid

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

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

CakePHP 3: Override Modell::save()

Hello,

I  need to store multiple rows of the same model, in CakePHP 2x we had saveMany() model, but since version 3, the method is omitted. How to save data?

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

How to load SQL views in Fixtures for unit tests in Cakephp 3?

My application has some sql views to perform complex queries in the database and be better able to filter the results based on these values.

One problem I encountered when running the unit tests is that Cake do not import sql views, just tables, breaking the application tests.


- How can I solve this problem?

- Is there any other way to replace the SQL Views within the application?

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

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

CakePHP 3 Auth with two tables (models)

I have two tables in my database, one for admins (named users) and the other one for normal users, (named applicants). Both tables use email and password for authentication, but applicants' table has more fields, that's why I need the separation.

What I want to do, is create two login pages, one for admins and the other for normal user. After logging in, the user is redirected to the page he is supposed to see. But yet, if the user tries attempt a forbidden location. I want be able to stop him (beforeFilter + isAuthorized).


I'm a beginner in Cakephp in general. How can I make all this work ?


Your help would be much appreciated.

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

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Adding a custom CakePHP Route

How can i configure a route connection to handle...

/users/{nameofuser_as_param}/{action}.json?limit_as_param=20&offset_as_param=20&order_as_param=created_at

in the routes.php file such that it calls my controller action like...

/users/{action}/{nameofuser_as_param}/{limit_as_param}/{offset_as_param}/{order_as_param}.json?

Note: Iam using Cakephp 2.X

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