propelorm/Propel2

View on GitHub
templates/Behavior/AggregateColumn/objectCompute.php

Summary

Maintainability
A
0 mins
Test Coverage

/**
 * Computes the value of the aggregate column <?=$column->getName()?>
 *
 * @param ConnectionInterface $con A connection object
 *
 * @return mixed The scalar result from the aggregate query
 */
public function compute<?=$column->getPhpName()?>(ConnectionInterface $con)
{
    $stmt = $con->prepare('<?=$sql?>');
<?php foreach ($bindings as $key => $binding):?>
    $stmt->bindValue(':p<?=$key?>', $this->get<?=$binding?>());
<?php endforeach;?>
    $stmt->execute();

    return $stmt->fetchColumn();
}