affected with this error
> message:
>
> UPDATE `files_folders` AS `FilesFolders` LEFT JOIN `course_files` AS
> `CourseFile` ON (`FilesFolders`.`account_id` = `CourseFile`.`id`) SET
> `FilesFolders`.`deleted` = 0 WHERE `FilesFolders`.`instance_id` = ‘8′
>
>
On Wednesday, 12 November 2008 13:27:10 UTC+5:30, Kryptonian wrote:
>
> Hi, I have this problem that if my model uses a var $belongsTo = array
> (), my updateAll() generated statement was affected with this error
> message:
>
> UPDATE `files_folders` AS `FilesFolders` LEFT
Remove the quotes.
suburb1 ='2'"
On Mon, Jul 16, 2012 at 1:00 PM, Ditshwanelo wrote:
> This is my query,i dnt knw wat is wrong it was working nd nw it returns
> null
> $search_query=$this->Suburb->query("SELECT suburbs.*, matchsuburbs.* FROM
This is my query,i dnt knw wat is wrong it was working nd nw it returns null
$search_query=$this->Suburb->query("SELECT suburbs.*, matchsuburbs.* FROM
matchsuburbs LEFT JOIN suburbs ON matchsuburbs.suburb2 = suburbs.id WHERE
matchsuburbs.suburb1 ='2'");
print_r($se
Problem solved
$allleaves = $this->Leavetype->find('all', array(
'joins' => array(
array(
'table' => 'vacations',
'alias' => 'vacationsJoin',
'type' => 'left',
'conditions' => array('vacation
So you're after a list of agents who are not assigned to a branch?
How about using counter_cache_habtm to count how many branches each
agent belongs to and how many agents each branch has?
http://bakery.cakephp.org/articles/view/counter-cache-behavior-for-habtm-relations
Otherwise you are looking
t one)
agents_branches (for joining the two together)
In the model, the HABTM relationship is defined accordingly.
To get a list of agents that are not assigned to any branch, I need
the following code:
SELECT * FROM `agents` LEFT JOIN agents_branches ON
agents_branches.agent_id = agents.id
d hold an array with the users
> addressdetails, calling view.cpt but I'm getting the error:
>
> Notice (8): Undefined property: FullnamesController::$Addresses [APP/
> controllers/fullnames_controller.php, line 10]
> Fatal error: Call to a member function read() on
Notice (8): Undefined property: FullnamesController::$Addresses [APP/
controllers/fullnames_controller.php, line 10]
Fatal error: Call to a member function read() on a non-object in
/controllers/fullnames_controller.php on line 10
Would be grateful for some pointers?
Thanks
Darren
On Sep 11,
Hi,
I'm a bit new to this, I'm trying to do a left join.
I have a db with People table (id:name_id) in it a linking table
(linking name_id to addr_id) and an address table with the index
(addr_id)
the sql command I usually use is:
SELECT persons_address.addr_id FROM addresses
ay('CarTemplate.*', 'COUNT(CarTemplateCategory.id)')));
$aTemplates = $this->CarTemplate->query("SELECT `CarTemplate`.*,
COUNT(CarTemplateCategory.id) FROM `car_templates` AS `CarTemplate` LEFT
JOIN `car_template_categories` AS `CarTemplateCategory` ON
`CarTemplate`.`id` = `
Well, I can't replicate the error, but it was only selecting data from one
table which was surely the case.
Thank you for reminding about counterCache, I used to love it!
Cheers,
Faifas
On Fri, Aug 28, 2009 at 19:53, WebbedIT wrote:
>
> What SQL and error is it generating? Why not run the fi
What SQL and error is it generating? Why not run the find on the
CarTemplateCategory model with CarTemplate.id as a condition or better
still use counterCache automagic to save yourself time and resources.
http://book.cakephp.org/view/816/counterCache-Cache-your-count
--~--~-~--~~---
Take a look at the Containable behavior. You should able to something
as simple as:
http://book.cakephp.org/view/474/Containable
$this->Model->contain('Company', 'Category');
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Hi,
I'm fairly new to CakePHP so if this is a stupid mistake forgive me.
A user will post a complaint against a company, so the complaint table
has company_id. I use a left join to get the company data. Then the
company has a field category_id which is simply the industry of the
co
As per http://book.cakephp.org/view/75/Saving-Your-Data, updateAll() method
needs two arguments and you have provided only one. Also keep in mind that
literal values of fields to save should be quoted
Amit
http://amitrb.wordpress.com/
http://coppermine-gallery.net/
http://cheesecake-photoblog.org
hi ,
when i trie to update a model i get :
Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near '@yahoo.comArray WHERE 1 = 1' at line 1
my model looks like that
class User extends Ap
On Tue, Mar 3, 2009 at 9:35 AM, Henrik Gemal wrote:
>
> Hi
>
> I'm having a little problem with converting an old sql request to use
> cakephp.
>
> The sql is:
> select name, if(module_id is null,0,1) activated from module left join
> active_modules on (id = m
Hi
I'm having a little problem with converting an old sql request to use
cakephp.
The sql is:
select name, if(module_id is null,0,1) activated from module left join
active_modules on (id = module_id and res_id = $id)
I have something like:
var $useTable = "modules&quo
I think this should help
http://teknoid.wordpress.com/2008/08/06/habtm-and-join-trickery-with-cakephp/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-p
I'm trying to do the following query:
$query = 'select Paper.* from papers as Paper
left join volumes as Volume on (Paper.volume_id = Volume.id)
left join users_volumes as UsersVolume on (UsersVolume.volume_id =
Volume.id)
where UsersVolume.user_id = %d
or Paper.us
o = array
> (), my updateAll() generated statement was affected with this error
> message:
>
> UPDATE `files_folders` AS `FilesFolders` LEFT JOIN `course_files` AS
> `CourseFile` ON (`FilesFolders`.`account_id` = `CourseFile`.`id`) SET
> `FilesFolders`.`deleted` = 0 WHERE `FilesFolde
I've had the same problems with updateAll.
I can't remember if setting the recursive to -1 solved the problem.
$this->controller->FilesFolders->recursive = -1;
If that doesn't work you can call unBind.
--~--~-~--~~~---~--~~
You received this message because you a
Hi, I have this problem that if my model uses a var $belongsTo = array
(), my updateAll() generated statement was affected with this error
message:
UPDATE `files_folders` AS `FilesFolders` LEFT JOIN `course_files` AS
`CourseFile` ON (`FilesFolders`.`account_id` = `CourseFile`.`id`) SET
join' => 'INNER JOIN',
),
);
Deon Heunis wrote:
> [EMAIL PROTECTED] wrote:
>
>> Is there anyway to dynamically override cake to use a JOIN instead of
>> LEFT JOIN ?
>>
>>
>
> I added a condition in my model to only r
[EMAIL PROTECTED] wrote:
> Is there anyway to dynamically override cake to use a JOIN instead of
> LEFT JOIN ?
>
I added a condition in my model to only return Job.active, but with the
LEFT JOIN, it will always be return a record, but with the Job empty. So
to exclude the row,
Is there anyway to dynamically override cake to use a JOIN instead of
LEFT JOIN ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegro
model:
var $belongsTo = array (
'Type' => array (
'className' => 'Type',
'foreignKey' => 'type',
)
in you wouldn't use left join explicity. cake will use left join to
query your data.
Your film model belongs to your type model and your type model hasMany
of your film model. So use those associations and you will get hwat
you are looking.. let me know if that works for you
On May 1, 4:
How to make this query below, with one of this association type:
hasOne, hasMany ,belongsTo, hasAndBelongsToMany ? Its just one simple
LEFT JOIN, but i cant figure out how to make it...
function getData() {
$ret = $this->query("SELECT films.id, films.title, films.body,
films
s Mysql3 and development server runs mysql4. I
> know, I know, should upgrade, but can't do that now. Post HABTM Tags The
> problem with the query is that it misses word LEFT just in front of JOIN. If
> I change JOIN to LEFT JOIN it work perfectly. What's th
isses word LEFT just in front
of JOIN. If I change JOIN to LEFT JOIN it work perfectly. What's the
best way to fix this problem or should I just hack cake core?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups &
Production server
runs Mysql3 and development server runs mysql4. I know, I know, should
upgrade, but can't do that now.
Post HABTM Tags
The problem with the query is that it misses word LEFT just in front
of JOIN. If I change JOIN to LEFT JOIN it work perfectly. What's the
best way to
Sorry, that was a typo in the email. Still, it doesn't work, and
setting $recursive to 2 makes cake perform about 12 queries like those
ones:
10 SELECT `Author`.`id`, `Author`.`username`, `Author`.`password`,
`Author`.`email`, `Author`.`created` FROM `users` AS `Author` WHERE
`Author`.`id` =
On 28.05.2007 20:11 RommeDeSerieux wrote:
> That's fine, but a Category also hasMany Downloads, but when i do
> categories/view, it fetches only one table, which results in raw
> values of category_id, author_id and translator_id displayed as
> integers, while i need it to behave like in the firs
A Download belongsTo Categories, Authors and Translators, so when i do
downloads/view, it fetches the data from three tables with a left join
and resolves category_id, author_id and translator_id.
That's fine, but a Category also hasMany Downloads, but when i do
categories/view, it fetches
ening of
course..
Actually it'a an idea that can be used, I mean making a LEFT JOIN for
"special cases", using this (as id is never null) i could have a
condition such as "model2.id IS NOT NULL" ..
Thanks
Franck
--~--~-~--~~~---~--~~
You received th
Okay, I'm like 80% sure I get what you're saying. Besides manually
modifying the association manually at runtime (do
pr($this->Model->hasMany) and you'll see what I'm talking about), you
could do:
$this->Model1->Model2->findCount('user_id != ' . $current_user_id);
--~--~-~--~~-
ied the reverse, meaning seaching by model 2
(since it has a LEFT JOIN to model1) and I can make conditions, that
can work partially by then I have a problem when 2 records model2 exist
referering to the same record model1, the model1 record appear then
twice ...
Not simple, and actually basically I want
you should look at the bindModel stuffcake baker as a little bit about it here http://cakebaker.wordpress.com/2006/02/22/new-feature-bindmodelunbindmodel/
Sam DOn 7/23/06, francky06l <[EMAIL PROTECTED]> wrote:
Thanks,The problem is that the condition changes depending of the user role(in my case),
Thanks,
The problem is that the condition changes depending of the user role
(in my case), so I can't stick it into the model relation. I can do
this using the bindModel on the fly, but even so I can;t succeed.
Basically I will have to write the SQL query ..
I will try to find better way ... but
when specifying your model associations, you can define additional
conditions like so:
class Model1 extends AppModel {
var $hasMany = array('Model2' => array('conditions' => 'Model2.x =
1'));
}
--~--~-~--~~~---~--~~
You received this message because you are s
Sorry, my question is stupid ..probably as I am ..
Left join can be only of a belongTo or HasOne ...not hasMany ..
However what is the best way when having 2 models link by a HasMany and
BelongsTo, and make a query into the first having condition on the
second ??
I know might seems weird bu from
Hello,
Using the debug = 2, I found a very weird stuff .. When I look to the
Select statement, it appears not having the JOIN with 2 models ..
Model1 one hasMany model2, and model2 belongsTo model1, but looking at
the SELECT statement I do not see any LEFT JOIN ON in the query...but
plenty of
44 matches
Mail list logo