Re: CakePHP 3 + MSSQL = slow query

2016-03-25 Thread heavyKevy
Is there any reason you are not paging it and fetching only 20, or 50 or 100 records at a time? That would significantly speed things up for you... Regards, --Kevin -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But do

CakePHP 3 + MSSQL = slow query

2016-03-24 Thread Enrico Lorenzoni
hello everyone, this is my situation. MSSQL server with query on a single table; timer says 4.47s, SQL Log says 1375 rows in 110ms. Time spent in "controller action" is 3600ms and I further tried to inspect the controller code, printing elapsed microseconds: it seems like the ass

cakephp 3 Insert with Query Builder update Timestamp fields

2015-12-22 Thread Willem
Using the query builder to insert multiple rows of data the timestamp fields are not automatically updated, is this correct? so i changed my code a little to add the fields myself. Not sure if this is the best way or am i missing something $oQuery = $this->query(); > > if (($handl

how to select special fields in query in cakephp 3

2015-12-22 Thread Amir Shabani
Hi chums :] I am very new on cakephp. I've asked this question in stackoverflow <http://stackoverflow.com/questions/34313080/how-to-select-special-fields-in-query-in-cakephp-3> , but nobody could not help. Well, I am here to help me. I need to join 3 tables (movies, comments, u

Re: Can someone please help with the syntax necessary to create the following query in Cake 3

2015-12-11 Thread heavyKevy
27;]] to: join([ 's' => ['table' => $SearchCount, 'type' => 'LEFT', 'conditions'=> ['s.player_id = Players.id']], 'v' => ['table' => $ViewCount, 'type' => 'L

Can someone please help with the syntax necessary to create the following query in Cake 3

2015-12-11 Thread heavyKevy
This is the target query: SELECT Players.id AS `Players__id`, Players.user_id AS `Players__user_id`, Players.opt_out AS `Players__opt_out`, Users.email AS `Users__email`, Users.first_name AS `Users__first_name`, s.searches AS `Players__search_count`, v.views AS `view_count

Cakephp 3 How to update multiple row data in a single query

2015-10-14 Thread Karthik Keyan
Hi all, I have multiple rows in database. I need to collect all the rows based on certain condition and change the value of particular column by removing a word from the column's value. How it could be done with with cakePHP 3? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us

Re: Query showing all data

2015-10-02 Thread John Andersen
t :) 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 > eir

Query showing all data

2015-09-30 Thread Zahidur Rahman
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

Re: Query

2015-07-15 Thread Christian Quispe
Si usas la v2 tendrás que usar este metodo: $this->Customer->query("SELECT * FROM pictures LIMIT 2;"); http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-query Te recomiendo que uses la versión 3. Enviado con MailTrack <https://mailtrack.io/install?sourc

Query

2015-07-15 Thread Hugo Fabricio
Hi, Can anyone help me for this query in cakephp 2 format? *SELECT * FROM `app_customers` AS `Customer` WHERE id IN ( SELECT DISTINCT (customer_id) FROM `app_buildings`)* Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You

Re: multi table query with cross reference table

2015-07-02 Thread rxhector...@gmail.com
OK - NVM I figured it out what I learned - how to create a query / subquery object expression to use > //create subquery > $sub = $query->newExpr('select t.op_team_name from Teams t > where (t.ws_team_name=Matches.team_home OR > t.ws_team_na

Re: multi table query with cross reference table

2015-07-02 Thread rxhector...@gmail.com
OK, i found the right query - now i just need to modify it into cakephp orm SELECT Matches Seasons... OpMatches... FROM matches Matches LEFT JOIN seasons Seasons ON (Seasons.id = (Matches.season_id) AND Seasons.stage_id = (Matches.stage_id)) LEFT JOIN op_matches OpMatches ON

multi table query with cross reference table

2015-07-01 Thread rxhector...@gmail.com
The problem, I have two tables that need to be 'matched up' from data in a third table I am currently using a contains query - but I think the final part should be a subquery - just not sure of how to go about it. I dont need any 'data' from the third table - just using it t

Re: How to write a query | cakephp 3.x

2015-06-05 Thread InYan
_7 = null ;} if(!empty($word_8)){$word_8 = " OR kw LIKE '%{$word_8}%'" ;}else{$word_8 = null ;} if(!empty($word_9)){$word_9 = " OR kw LIKE '%{$word_9}%'" ;}else{$word_9 = null ;} $query = "SELECT * FROM keywords WHERE (({$w

Re: How to write a query | cakephp 3.x

2015-06-03 Thread InYan
=> [['kw LIKE' => $word_7],['kw LIKE' => $word_8 ],['kw LIKE' => $word_9]]] ]); четверг, 4 июня 2015 г., 1:42:04 UTC+5 пользователь José Lorenzo написал: > > What have you tried so far? Did you read the documentation on creating

Re: How to write a query | cakephp 3.x

2015-06-03 Thread José Lorenzo
What have you tried so far? Did you read the documentation on creating queries in cake 3? On Wednesday, June 3, 2015 at 7:58:44 AM UTC+2, InYan wrote: > > in cakephp v.1.3.x I used $this->Model->query($q); > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us

Re: How to write a query | cakephp 3.x

2015-06-02 Thread InYan
in cakephp v.1.3.x I used $this->Model->query($q); -- 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 thi

How to write a query | cakephp 3.x

2015-06-02 Thread InYan
Please help! How to write a query to the database according to the conventions *cakephp 3.x* SELECT * FROM keywords WHERE (kw LIKE %{$word_1}% AND kw LIKE %{$word_2}% AND kw LIKE %{$word_3}%) OR (kw LIKE %{$word_4}% AND kw LIKE %{$word_5}% AND kw LIKE %{$word_6}%) NOT (kw LIKE %{$word_7}% AND

[Cakephp3] Stop the execution of a query !

2015-05-22 Thread Saif Turki
Hi, Sorry for may bad english :( I want *to stop and break the execution of query if there is an error*, let's say that i have two chained "find"(*find('default')->find('first')*) I passed a param to the *find('default')*(exp.: *min=5*) and

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-02-27 Thread Cake Developer
> >> I tried both PlumSearch and Search Plugin in my application and they are >> not working as expected. >> >> They are adding search arguments in existing conditions in query object. >> >> Failing Situation. >> Existing condition has Users.active = 1 an

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-29 Thread Cake Developer
xisting conditions in query object. > > Failing Situation. > Existing condition has Users.active = 1 and If new condition array has > Users.active = 0 so this way merged conditions will have Users.active = 1 > AND Users.active = 0 //No Result > > I believe it is really a issue

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-23 Thread Cake Developer
Hi Josh, I tried both PlumSearch and Search Plugin in my application and they are not working as expected. They are adding search arguments in existing conditions in query object. Failing Situation. Existing condition has Users.active = 1 and If new condition array has Users.active = 0 so

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-23 Thread José Lorenzo
What have you tried so far? On Friday, January 23, 2015 at 9:25:21 AM UTC+1, Cake Developer wrote: > > Hi Experts, > > Can anyone solve my problem please? > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message becau

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-23 Thread Cake Developer
Hi Experts, Can anyone solve my problem please? -- 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 receivin

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-20 Thread Cake Developer
Hi Josh, Thanks for your answer. I tried both PlumSearch and Search Plugin in my application and they are not working as expected. They are adding search argumentsin existing conditions in query object. Failing Situation. Existing condition has Users.active = 1 and If new condition array has

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-19 Thread José Lorenzo
I don't think it is possible in an easy way, I also think you are trying to complicate the problem, given the existence of other clean solutions that already work. There are two methods that clause('where') object has that can be used to traverse the query. They are iterateParts

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-19 Thread God bless
Hi Jose, I gone through both of the plugin links you provided, It seems they are complicated and do not meet my requirements. I am trying to write a generic solution to filter records with less code. Is there any way to get original conditions from query object as an array format. For e.g

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-19 Thread José Lorenzo
Sorry, I forgot to answer... What you are doing sounds similar to what some plugins are doing as well. Please try these: https://github.com/skie/plum_search https://github.com/FriendsOfCake/search As for the second case. I suggest doing as I suggested at the beginning, use the query options

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-19 Thread Cake Developer
Hi Experts, any help? Thanks in advance. On Friday, January 16, 2015 at 12:47:39 AM UTC+5:30, José Lorenzo wrote: > > Even though that is possible you are tying to do it the hard way. The > easiest way you can implement the same is by using the query as a "command"

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-16 Thread Cake Developer
;", Active, Inactive) etc these should be anything based on configuration [Search][Reset] buttons Users data in HTML table Searchable Behaviour FYI- In Search Component I attach a Search behaviour with current model table and pass predefined Search Form Fields(same we displayed in

Re: Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-15 Thread José Lorenzo
Even though that is possible you are tying to do it the hard way. The easiest way you can implement the same is by using the query as a "command" object, thus instructing the custom finders to do stuff based on the passed options. An example $table->find('forUser', [

Cakephp 3.0 Get and Modify Query conditions in beforeFind function

2015-01-15 Thread Cake Developer
Hello, I am trying to get and modify query conditions in beforeFind function of Behaviour. function beforeFind(Event $event, Query $query, $options, $primary) { // here is what I tried so far. $conditions = $query->clause('where'); // this gives me Object of Expression Interface

Re: CakePHP3 testing behavior - how do I mock a query?

2015-01-07 Thread José Lorenzo
This is an example of mocking a query: https://github.com/cakephp/cakephp/blob/3.0/tests/TestCase/ORM/Association/HasManyTest.php#L181 You will probably need to mock the Table's find or query() method to be able to inject your mocked query when the method is called. -- Like Us on Fac

CakePHP3 testing behavior - how do I mock a query?

2015-01-06 Thread badben
ntityData); $Sluggable->beforeSave($this->getMock('Cake\Event\Event', null, [ 'beforeSave']), $entity); } } The function I want to test in the behavior is src\Model\Behavior\SluggableBehavior.php /** * Generates a unique slug for that table. * * @param \

Re: Problem with creating triggers using query() and rawQuery()

2014-11-21 Thread Prashant Shah
Hi, On Fri, Nov 21, 2014 at 6:09 PM, Prashant wrote: > Hi, > > On Friday, October 17, 2014 10:18:34 AM UTC+5:30, Prashant wrote: >> >> Hi, >> >> I have verified it, it works correctly under phpMyAdmin. >> >> Regards. > > > Solved the problem. > > I had used a single script that contained both the

Re: Problem with creating triggers using query() and rawQuery()

2014-11-21 Thread Prashant
Hi, On Friday, October 17, 2014 10:18:34 AM UTC+5:30, Prashant wrote: > > Hi, > > I have verified it, it works correctly under phpMyAdmin. > > Regards. > Solved the problem. I had used a single script that contained both the create tables and triggers statements. If I separate the create trigge

[Question] Acl query error

2014-10-28 Thread Frans filasta pratama
lumn not found: 1054 Unknown column > 'Aro0.foreignKey' in 'where clause' *SQL Query: *SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`, > `Aro`.`foreign_key`, `Aro`.`alias` FROM `dotcore`.`aros` AS `Aro` INNER > JOIN `dotcore`.`aros` AS `Aro0` ON (`Aro`.`lft` &l

Re: Problem with creating triggers using query() and rawQuery()

2014-10-16 Thread Prashant
Hi, On Thursday, October 16, 2014 11:39:37 PM UTC+5:30, John Andersen wrote: > > Please verify that your code will work directly in a console against the > database. > > For examply by using phpMyAdmin and run the code in there. > > Kindly inform us of the result > > Enjoy, John > I have verifie

Re: Problem with creating triggers using query() and rawQuery()

2014-10-16 Thread John Andersen
aller for an application which will setup the > database using query() or rawQuery() methods. > > I am not able to execute the following SQL statements using query() or > rawQuery(). > > DROP TRIGGER IF EXISTS `check_sometable`; > DELIMITER // > CREATE TRIGGER `check_so

Re: Problem with creating triggers using query() and rawQuery()

2014-10-16 Thread Prashant Shah
Hi, On Tue, Oct 14, 2014 at 4:26 PM, Prashant Shah wrote: > Hi, > > I am writing a installer for an application which will setup the > database using query() or rawQuery() methods. > > I am not able to execute the following SQL statements using query() or > rawQuery(). >

Problem with creating triggers using query() and rawQuery()

2014-10-14 Thread Prashant Shah
Hi, I am writing a installer for an application which will setup the database using query() or rawQuery() methods. I am not able to execute the following SQL statements using query() or rawQuery(). DROP TRIGGER IF EXISTS `check_sometable`; DELIMITER // CREATE TRIGGER `check_sometable` BEFORE

how to display query with custom query in cakephp

2014-09-09 Thread Ajeya Shetti
I have a 3-tables 1-> categories = id,category_name 2-> statuses = id,status_name 3-> evnets = id,event_name,category_id,staus_id events is the main table which has the id`s of categories and statuses table I want to display events display where the names of categories and statuses is displayed

Re: CakePHP 3.0 orm query question

2014-08-26 Thread Andras Kende
Hi Jose, I got it working as : $query = $this->find('all', array( 'limit' => 200, 'order' => array( 'distance' => &

Re: CakePHP 3.0 orm query question

2014-08-26 Thread José Lorenzo
$query = $table->find() $query->select(['distance' => $query->newExpr($rawSQL)])->having(['distance <=' => $distance]) On Monday, August 25, 2014 2:59:01 AM UTC+2, Andras Kende wrote: > > Hello, > > Im trying to convert this geolocator query f

CakePHP 3.0 orm query question

2014-08-24 Thread Andras Kende
Hello, Im trying to convert this geolocator query from 2.5 to 3.0 orm but no luck so far. CakePHP 2.5, this works fine: $results = $this->find('all', array( 'limit' => 200, 'order' => array( 'distan

Re: Issue with COUNT() as query field

2014-07-29 Thread Sam Clauw
Sorry, my bad! I forgot to change the virtual field declaration to $model->virtualFields['depth'] = 0; Thanks anyway ;) -- 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 Googl

Re: Issue with COUNT() as query field

2014-07-29 Thread Sam Clauw
That does the trick for me, thx a lot! BUT, I found out that when you use it in a behavior: it won't work at all. The array is shown as when you don't use the virtual fields: array( > (int) 0 => array( > 'CmsPage' => array( > 'id' => '2', > 'name' => 'Pagina's', > 'lft' =>

Re: Issue with COUNT() as query field

2014-07-08 Thread euromark
Always use virtual fields in 2.x when using custom SQL http://book.cakephp.org/2.0/en/models/virtual-fields.html Then it will all work out of the box. mark Am Dienstag, 8. Juli 2014 12:43:53 UTC+2 schrieb Sam Clauw: > > What I'm trying to do is making a self join to get a menu tree structure >

Issue with COUNT() as query field

2014-07-08 Thread Sam Clauw
What I'm trying to do is making a self join to get a menu tree structure out of the database. It almost works with this code: $this->set('cmsPages', $this->CmsPage->find('all', array( 'fields' => array( 'CmsPage.name', 'CmsPage.lft', 'CmsPage.rgt', '(COUNT(CmsP

Re: Cookbook: database query in controller???

2014-07-07 Thread Sam Clauw
Okay, that's very clear to me. Thanks a lot guys!!! -- 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 recei

Re: Cookbook: database query in controller???

2014-07-07 Thread mulianto
Hi, When starting up you will put all query in the controller. Imagine if the actual query is show in specific controller method more than twice. You will just copy paste right, no problem. But id it show in 10 place and you wont remember it any more later on as project grow. Then you need

Re: Cookbook: database query in controller???

2014-07-06 Thread Stephen S
I think you're referring to conventions, and I agree it's best to keep things DRY and place methods to fetch results in the model or app model rather than writing directly in the controller in most instances. Personally I would say this is more to do with the MVC pattern rather than CakePHP direct

Re: Cookbook: database query in controller???

2014-07-06 Thread Jeremy Burns : Class Outfit
It is using the model. It's calling the 'find' method of the Post model with the 'all' parameter. The Post model is then using the core Model functions to do the database extraction. On 6 Jul 2014, at 11:59, Sam Clauw wrote: > I've a question about the MVC in CakePHP. Normally, the model shoul

Cookbook: database query in controller???

2014-07-06 Thread Sam Clauw
I've a question about the MVC in CakePHP. Normally, the model should take responsability for all the database queries. However, in the cookbook documentation, it seems this isn't respected. See the following link: http://book.cakephp.org/2.0/en/getting-started.html#create-a-posts-controller As

using ->query to update

2014-03-20 Thread AugustoA
Hi guys, I`m trying to do a update using a SQL query directly. I`m having a strange behavior here, I use a similar query in another part of the code and it is updating normally. When I use in the second part the update is updating the value as null. I log the generated query and execute it

Debugging a SQL query that is causing the page to timeout

2013-11-08 Thread ngd
Hi, I have the following query that is causing the page to timeout: $this->QuestionnaireQuestionnaire->contain(array( > 'QuestionnaireAssignment' => array( > 'QuestionnaireAssignmentName' => array( >

Re: mysql join query gives too much results, twice.

2013-10-16 Thread Benjamin Chéré
uct.id'=>$pid), 'contain' => array('Category.name') )); sorry if I have not answered the question, hope this helps BenJ Le mardi 15 octobre 2013 11:48:40 UTC+2, UltraMarkus a écrit : > > Hi, > > As im new to this group, i first want to apologize for my

Re: mysql join query gives too much results, twice.

2013-10-15 Thread Reuben
Hi, > > As im new to this group, i first want to apologize for my bad english. > Just starded to use cakePHP 2 weeks ago, and i must say, great work!!! I > managed to get my things to be done and Im gratefull for excistence of it. > > But hey, now im stuck with my query, an

mysql join query gives too much results, twice.

2013-10-15 Thread UltraMarkus
Hi, As im new to this group, i first want to apologize for my bad english. Just starded to use cakePHP 2 weeks ago, and i must say, great work!!! I managed to get my things to be done and Im gratefull for excistence of it. But hey, now im stuck with my query, and believe me, i searched a lot

custom query pagination without using custom paginate

2013-09-30 Thread NikNik
Hello I have a model whose controller serves many pages using normal paginate. Now I need to use a custom query and cannot use the normal find method (or I am not able to) But I do not know how to paginate. The query is something as follows: http://pastebin.com/p0bux1ig The cookbook

Re: Warning: Fixture creation for xxx failed - Query was empty

2013-09-02 Thread Anja Liebermann
that somehow it isn't able to fill my mysql table > with the baked fixture: > "Warning: Fixture creation for "_cycles" failed "SQLSTATE[42000]: Syntax > error or access violation: 1065 Query was empty" > > > Here comes the complete output, at the bo

Warning: Fixture creation for xxx failed - Query was empty

2013-09-01 Thread Anja Liebermann
als($expected, $result); I get a huge load of errors. What I can make of it that somehow it isn't able to fill my mysql table with the baked fixture: "Warning: Fixture creation for "_cycles" failed "SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty" H

Complex query not possible using Cakephp?

2013-08-08 Thread Pablito Pablito
Hello everyone, I have a complex query for summarizing data that looks like: $sql = 'SELECT severity, SUM( IF( c.name = "ABC", 1, 0 ) ) AS "ABC", SUM( IF( c.name =

Re: Help in simple query!

2013-05-31 Thread gonzela2006
;Student'; On Thursday, May 30, 2013 8:26:28 AM UTC+2, Dakota wrote: > > That would be the expected result for that query. You aren't including the > 'SudentAttendance' model in your query. Looking how to use Containable, or > custom join. You don't say wha

Re: Help in simple query!

2013-05-31 Thread gonzela2006
@Dr. Drijk @resting Model names must be singular. -- 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 receivi

Re: Help in simple query!

2013-05-29 Thread Dakota
That would be the expected result for that query. You aren't including the 'SudentAttendance' model in your query. Looking how to use Containable, or custom join. You don't say what kind of relation there is between StudentAttendance and Student. CakePHP can't guess w

Re: Help in simple query!

2013-05-29 Thread resting
Have to agree with Dr. Drijk to check on typos. Is it StudentAttendances.date instead? On Thursday, 30 May 2013 07:46:53 UTC+8, gonzela2006 wrote: > > Hello, > > I used the following code in "StudentAttendances" controller: > > $students = $this ->StudentAttendance->Student-> find('all', array( >

Re: Help in simple query!

2013-05-29 Thread gonzela2006
Hello, I used the following code in "StudentAttendances" controller: $students = $this ->StudentAttendance->Student-> find('all', array( 'conditions' => array( 'NOT' => array('StudentAttendance.date' => array($year.'-'.$month.'-'.$day)) ), 'fields' => array('Student.id', 'Student.name'), 'order'

Re: Help in simple query!

2013-05-29 Thread Dr. Drijk
1.jpg> > I want to display students that didn't attendance on date 2013-03-01 so > the result should be as the following: > *id name* > 2 Marta Simon > 4 Rex Maxwell > 6 Vivian Ellis > > I know this is simple query but I got this error > Error: SQLSTATE[42S22]: Column

Re: Help in simple query!

2013-05-28 Thread resting
600/Presentation1.jpg> > I want to display students that didn't attendance on date 2013-03-01 so > the result should be as the following: > *id name* > 2 Marta Simon > 4 Rex Maxwell > 6 Vivian Ellis > > I know this is simple query but I got this error > Error

Help in simple query!

2013-05-28 Thread gonzela2006
Simon 4 Rex Maxwell 6 Vivian Ellis I know this is simple query but I got this error Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'StudentAttendance.date' in 'where clause' Thanks, -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http:

Re: How to use Cache Helper and execute UPDATE query on every URL request?

2013-05-17 Thread Salines
$this->viewClass = 'Media'; > render a 1x1px image. > } > > hth, > > AD > > On Friday, 17 May 2013 00:33:24 UTC+2, Salines wrote: >> >> Hi, >> I use the Cache Helper, to cache my views, but now I need to implement a >>

Re: How to use Cache Helper and execute UPDATE query on every URL request?

2013-05-17 Thread AD7six
> Hi, > I use the Cache Helper, to cache my views, but now I need to implement a > simple UPDATE query in my view() action. > > When I use the cached views, CakePHP skip actions in the the controller? > I want to record the number of hits on each article! > > Can s

How to use Cache Helper and execute UPDATE query on every URL request?

2013-05-16 Thread Salines
Hi, I use the Cache Helper, to cache my views, but now I need to implement a simple UPDATE query in my view() action. When I use the cached views, CakePHP skip actions in the the controller? I want to record the number of hits on each article! Can someone point me in the right direction

sql to cakephp query conversion

2013-04-10 Thread Homer Favenir
Hi, I need to convert it to cakephp sql approach rather than sql query. This is very complex for cakephp basic query. SELECT SUM(payment - ( payment - gross_amount)) as 'Payment' FROM sales_orders s WHERE DATE_FORMAT(`date`,'%Y-%m-%d') = CURDATE(); thanks in advance --

Re: HABTM round trip query

2013-02-10 Thread lowpass
I forgot the Language model to get the *other* langs the artist uses. public function getArtistsForLang($lang) { return $this->find( 'all', array( 'conditions' => array( $this->alias.'.code' => $lang

Re: HABTM round trip query

2013-02-10 Thread lowpass
Try this. I'm assuming your languages table has a 'code' column and the request passes a 2-letter string for the code for the desired language. That's probably how I'd do it but you may need to modify for your own setup. (This would be in the Language model.) public function getArtistsForLang($la

HABTM round trip query

2013-02-10 Thread crouch...@googlemail.com
Hi all, If this topic is covered, sorry, but I don't really know what to search under and all my searches resulted in nothing. Background: Developing a site for a voice over company. Requirement: Voice artists can have several different languages and languages can have several different voice

Re: Plugin Query / Find Fails

2013-02-09 Thread lowpass
Remove the "$id =" from the call to findUser() On Fri, Feb 8, 2013 at 8:27 PM, Advantage+ wrote: > I am having problems pulling User data in my plugin and cannot figure out > why. If I run the same code in the controller it returns the data, but if I > try to access it thru the model find method

Plugin Query / Find Fails

2013-02-08 Thread Advantage+
I am having problems pulling User data in my plugin and cannot figure out why. If I run the same code in the controller it returns the data, but if I try to access it thru the model find method it fails. In the UserController: $model_find = $this->User->findUser($id = '510324ea-f78c-4ff6-a5

Re: Sql Controller query

2013-01-18 Thread PlanoCoder
; $sponID > ) > ); > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 18 Jan 2013, at 13:15:54, PlanoCoder > > wrote: > > Good morning all. I need to make this sql query in my controller. > "SELECT id FROM users WHERE username

Re: Sql Controller query

2013-01-18 Thread Jeremy Burns | Class Outfit
4, PlanoCoder wrote: > Good morning all. I need to make this sql query in my controller. "SELECT > id FROM users WHERE username = $sponID". How do i need to write this in the > UsersController? > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Fi

Sql Controller query

2013-01-18 Thread PlanoCoder
Good morning all. I need to make this sql query in my controller. "SELECT id FROM users WHERE username = $sponID". How do i need to write this in the UsersController? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- Yo

Re: very slow response from CakePHP when performing a simple query

2013-01-16 Thread lowpass
To begin with, you're doing a few things wrong here. Your say_hello action doesn't belong in AppController. And the query method is not the best approach, either. Also, if you're testing Cake for speed, ensure that debug is set to 0 and you've implemented caching. On Tue, Jan

very slow response from CakePHP when performing a simple query

2013-01-16 Thread Quoc Lam
Hi there, I am new to CakePHP and is trying to setup my first "Hello World" project. When working on that, I experienced a very slow response from CakePHP when performing a simple query to the DB. Here are the steps that I have done: 1. Download the CakePHP framework (2.3.0

Re: Trouble with model associations and query.

2012-12-10 Thread MDay
I seem to have resolved this, but I don't think it's the most efficient query: public function getStudents(){ $userId = $this->Auth->user('id'); $endusers = $this->RoleUser->findAllByuser_id($userId, array('RoleUser.enduserid','RoleUser.user_id

Re: Conditional Model Query

2012-12-10 Thread MDay
Thanks for the response. You are correct - the enduserid field is in the RoleUser join table. On Sunday, December 9, 2012 5:54:26 PM UTC-5, cricket wrote: > > You shouldn't need to use loadModel() if the associations are set up > correctly. > > When you call $this->Auth->user() with no params

Re: Conditional Model Query

2012-12-09 Thread lowpass
You shouldn't need to use loadModel() if the associations are set up correctly. When you call $this->Auth->user() with no params you get an array with all data. I don't recall how deeply that goes. Try this in your login() action, or some other action that requires authentication: die(debug($this

Re: Trouble with model associations and query.

2012-12-09 Thread lowpass
On Sun, Dec 9, 2012 at 2:30 PM, Md wrote: > > array ('RoleUser.id = ' => $userId))); //this is the current logged in user RolesUser -- 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 t

Conditional Model Query

2012-12-09 Thread Md
Hi there, I have a small application that has three tables. users, roles, and role_users. The role_users table is a join table as a user can have multiple roles. In my UsersController class I am trying to get a count for the number of roles the current user has where there is a enduserid =

Trouble with model associations and query.

2012-12-09 Thread Md
I am having trouble returning a query. I have the following setup Users - users class of all users in the system. Roles - roles class with a set of available roles. E.g. teacher, student, tutor RoleUsers - a mapping table between users and roles as a single user can have multiple roles. My

Re: Model-query not working with virtualFields

2012-12-07 Thread Mathias R
Problem solved: there was 2 errors: in virtualfield: the fields cityLng and cityLat are virtualfields too, but in query i got a "no column"-error, dont know why. i changed this to original "City.lat" and "City.lng". in conditions: $conditions = array("d

Re: Model-query not working with virtualFields

2012-12-07 Thread Mathias R
y be fine > > b) there might be. but you dont need to display the sql statement prior to > the query > either > - it is wrong and results in an exception (and will be displayed right > away for you to see!) > - it is correct and will end up in your sql debug queries at the b

Re: Model-query not working with virtualFields

2012-12-07 Thread euromark
a) did you read me remark about your faulty isset()? that is most likely the source of your issues. fix it and you will probably be fine b) there might be. but you dont need to display the sql statement prior to the query either - it is wrong and results in an exception (and will be displayed

Re: Model-query not working with virtualFields

2012-12-07 Thread Mathias R
How i wrote: there's only one dump, and this dump shows the query by $this->findByZipcode(); the other one has no dump and no output. with your method same problem. no output, no error. sry, i have to repeat myself: is there a way to display a sql-statement before cake send this

Re: Model-query not working with virtualFields

2012-12-07 Thread euromark
uot;working" > distance query to use as virtual field > try to compare that to yours > > you should be able to get results if you comment out the conditions! > because then its just a normal query + a mathematical virtual field > if you still get nothing you have some other issue

Re: Model-query not working with virtualFields

2012-12-07 Thread euromark
this is not google code ;) the method I showed you merely has a "working" distance query to use as virtual field try to compare that to yours you should be able to get results if you comment out the conditions! because then its just a normal query + a mathematical virtual field if you

Re: Model-query not working with virtualFields

2012-12-07 Thread Mathias R
Hi, sry, but i dont want to use google code. I need to build my own opengeodb-plugin for this app. All vars are filled and cake displays no errors and no log-messages. debug($this->Zipcode->listZipcodesNearBy("19370")); has no output. Cake dumps only first query ($this->fin

Re: Model-query not working with virtualFields

2012-12-07 Thread euromark
no errors? just an empty resultset? what is the query you result in? Until very recently I got a bug in my distance query, as well. Maybe thats what happens here? might be just some () missing or $lng instead of $lng somewhere To confirm that you could try using my (now correctly working

  1   2   3   4   5   6   7   8   9   10   >