[英]How to return OUT parameters from stored procedure in Symfony 1.4 using Doctrine
[英]How to return a value using Doctrine in symfony 1.4?
我想使用以下函數返回特定日期的雇員的休假類型
public static function getLeaveTypeInDate($date, $empId) {
$leaveType = Doctrine_Query::create()
->select('leave_type')
->from('EmployeeLeave')
->where('employee_id = ?', $empId)
->andWhere('applied_from = ?', $date)
->execute();
return $leaveType[0];
但是它返回的雇員姓名沒有直接存儲在“ employee_leave”表中。
此時,您通過執行->execute()
返回整個EmployeeLeave對象,然后return $leaveType[0]
我的建議是通過將->execute()
替換為->fetchOne()
來更改您的查詢語句
然后,不用執行return $leaveType[0]
,而只需return $leaveType->getLeaveType()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.