I've been trying to get a relatively complex find query to work (I'll
post it below) but when I am trying to test it (in both methods) I get
"Server unexpectedly dropped the connection". There is nothing in the
cake error logs. The only thing I get from apache is something like
"[notice] child pid 4303 exit signal Segmentation fault (11)" three
times over.
Here are the two methods I've tried:
$dbo = $this->Field->getDataSource();
$subQuery = $dbo->buildStatement(array(
"field" => array('"Field2"."id"'),
"table" => $dbo->fullTableName($this->Field),
"alias" => "Field2",
"conditions" => array(
'"Field2"."name"' => $this->params["named"]["field"]
)),
$this->Field
);
$subQuery = ' "Field"."parent" IN (' . $subQuery . ') ';
$subQueryExpression = $dbo->expression($subQuery);
$conditions[] = $subQueryExpression;
$this->set("fields", $this->Field->find("all",
compact("conditions")));
and method #2:
$this->set("fields", $this->Field->find("all", array(
"joins" => array(
array(
"table" => "fields",
"alias" => "ParentField",
"type" => "inner",
"foreignKey" => false,
"conditions" => array("ParentField.name LIKE \"" . $this-
>params["named"]["field"] . "\"")
),
array(
"table" => "fields",
"alias" => "Field",
"type" => "inner",
"foreignKey" => false,
"conditions" => array("Field.parent = ParentField.id")
)
)
)));
I am new to CakePHP so I'm not even sure that they will do what I
want. Here is the low-down:
Each field has a column called "parent" in which a a constraint links
this to another field of the same id as "parent". Therefore I have the
name of the "parent" field and want to get its ID after which I want
to get all fields with that id as their "parent" attribute.
Any help would be much appreciated.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment