开发者

pass data from the action layer to the model

开发者 https://www.devze.com 2023-01-01 11:01 出处:网络
I have an DQL query in LocationTable.class.php For this query i need an id which is passed to the action via the URL ?id=2

I have an DQL query in LocationTable.class.php

For this query i need an id which is passed to the action via the URL ?id=2

In the action i can access this with $request->getParamater('id'), but how can i also make this available to the model where my query resides? i need it for a where clause开发者_JS百科.


When you call the function from the action, pass it the variable:

In action:

Doctrine::getTable('Location')->yourFunction($request->getParameter('id'));

In LocationTable:

public function yourFunction($id)
{
  ...
0

精彩评论

暂无评论...
验证码 换一张
取 消