[symfony-users] SUM()

2010-05-26 Thread safa boubekri
hello  i create  one module bilan  i want to cretae function wich ive
me the sum  of on otherwidget  which is in other  module

i ut this  code in action



public static function getTotals()
{
  $con = Doctrine::getConnection('Doctrine');
  $sql = SELECT  SUM(Cotisation.Montant) FROM Cotisation ;
  $stmt = $con-createStatement();
  // or FETCHMODE_ASSOC if you wish
  $rs = $stmt-executeQuery($sql, ResultSet::FETCHMODE_NUM);

  return parent::doSelectRS($rs);
}


but  no result


i will be gratefull

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] sum()+backend

2010-05-25 Thread safa boubekri
hello every body

how  can  i  create  method  to have sum()

in the  backend



thank you  a lot

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] sum()+backend

2010-05-25 Thread Tom Haskins-Vaughan
Any more details?

On Tue, May 25, 2010 at 1:34 PM, safa boubekri boubekri.s...@gmail.com wrote:
 hello every body

 how  can  i  create  method  to have sum()

 in the  backend



 thank you  a lot

 --
 If you want to report a vulnerability issue on symfony, please send it to 
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] sum()+backend

2010-05-25 Thread safa boubekri
HELLO

i create module free which  dont have  table in  the database i hope
that it permet  me  to show  the  sum  of   an other

table

the code is:

public static function getTotals()
{
  $con = Doctrine::getConnection('Doctrine');
  $sql = SELECT  SUM(Cotisation.Montant) FROM Cotisation ;
  $stmt = $con-createStatement();
  // or FETCHMODE_ASSOC if you wish
  $rs = $stmt-executeQuery($sql, ResultSet::FETCHMODE_NUM);

  return parent::doSelectRS($rs);
}


but  i dont have  result

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] sum()+backend

2010-05-25 Thread Eno
On Tue, 25 May 2010, safa boubekri wrote:

 the code is:
 
 public static function getTotals()
 {
   $con = Doctrine::getConnection('Doctrine');
   $sql = SELECT  SUM(Cotisation.Montant) FROM Cotisation ;
   $stmt = $con-createStatement();
   // or FETCHMODE_ASSOC if you wish
   $rs = $stmt-executeQuery($sql, ResultSet::FETCHMODE_NUM);
 
   return parent::doSelectRS($rs);
 }
 
 but  i dont have  result

Which version of symfony? Which version of Doctrine? (doSelectRS was 
renamed in symfony 1.2).

Just to be clear: how are you extracting the data from the result set you 
get back?



-- 


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] sum()+backend

2010-05-25 Thread safa boubekri
i have symfony 1.3  but i have problem how can i  use this  method in the form

i declar  one widget  but  how can i  use it


thank you

:)

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Sum-ing in propel

2008-03-25 Thread [EMAIL PROTECTED]

I'm not understanding the most efficient  way to sum a field of
related objects.

I start with
public function getTotalHours( )
{
$hours = 0;
foreach ($this-getActivitys() as $activity) {
$hours = $hours+$activity-getHours();
}
return $hours;
}
which seems to generate multiple selects.

I think I want something like
public function getTotalHours(Criteria $criteria = null )
{
if ($criteria === null) {
$criteria = new Criteria();
}
elseif ($criteria instanceof Criteria)
{
$criteria = clone $criteria;
}

$criteria-clearSelectColumns();
$criteria-addSelectColumn('SUM(' . ActivityPeer::HOURS . ') AS
total');
$criteria-addSelectColumn(ActivityPeer::LOG_ID, 
$this-getId());
$criteria-addGroupByColumn(ActivityPeer::LOG_ID);

$result = ActivityPeer::doSelectOne($criteria);
return $result;
}

but cant figure out the key of the $result to echo.

any pointers?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---