Пример #1
0
 /**
  * This method is intended for be used inside sfActions subclasess so when
  * user access some action from that module, and this method is called, we can
  * get track of some ID for sfActions module to be considered in future calls
  * in other modules. For example if we are working with career and we want to
  * view students registered in that career, we will set carrer id as referrer
  *
  * @param sfActions $action Action from which we are called. Attribute key will
  * be extracted from $action->getModuleName
  * @param <type> $override_route_object if $action->getRoute()->getObject()->getId()
  * is not applicable, then provide which value is to be saved as referrer
  * @param <type> $override_key if getModuleName is not enough, you could use this parameter
  */
 public function setReferenceFor(sfActions $action, $override_route_object = false, $override_key = false)
 {
     $key = $override_key !== false ? $override_key : $action->getModuleName();
     $id = $override_route_object !== false ? $override_route_object : $action->getRoute()->getObject()->getId();
     return $this->setAttribute(sprintf(self::$reference_key, $key), $id);
 }