propelorm/Propel2

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

Summary

Maintainability
A
0 mins
Test Coverage

/**
 * Update the aggregate column in the related <?=$relationName?> object
 *
 * @param ConnectionInterface $con A connection object
 */
protected function updateRelated<?=$relationName.$aggregateName?>(ConnectionInterface $con)
{
    if ($<?=$variableName?> = $this->get<?=$relationName?>()) {
        $<?=$variableName?>-><?=$updateMethodName?>($con);
    }
    if ($this->old<?=$relationName.$aggregateName?>) {
        $this->old<?=$relationName.$aggregateName?>-><?=$updateMethodName?>($con);
        $this->old<?=$relationName.$aggregateName?> = null;
    }
}