コード例 #1
0
 /**
  * Recupera um método da business referente a controller em uso.
  *
  * @param Controller $target
  * @return BusinessAbstract
  * @throws BusinessException
  * @deprecated
  * @example ControllerAbstract::getBusiness
  * @code
  * <?php
  * ...
  *
  *  try {
  *      $this->getBusiness('save')
  *           ->setViewType('html')
  *           ->getView('sucess');
  *      } catch (Exception $exp) {
  *          $this->setViewType('html')
  *               ->getView('error');
  *      }
  *
  *  ...
  * ?>
  * @encode
  * */
 public function getBusiness($target = NULL)
 {
     $tmpBusinessTarget = $tmpNSBusiness = NULL;
     $target = $this->toggle($target, $this);
     $tmpArrNS = explode('controller' . self::NAMESPACE_SEPARATOR, $this->getClassName($target));
     $tmpBusinessTarget = $this->erReplace(array('Controller$' => 'Business'), (string) end($tmpArrNS));
     $tmpNSBusiness = $target->getNamespaceFuncionality() . self::NAMESPACE_SEPARATOR . 'mvcb' . self::NAMESPACE_SEPARATOR . 'business' . self::NAMESPACE_SEPARATOR . $tmpBusinessTarget;
     $fileClass = Location::realpathFromNamespace($tmpNSBusiness) . '.php';
     if (!is_file($fileClass)) {
         throw BusinessException::businessNotImplemented($tmpNSBusiness);
     }
     return BusinessAbstract::factory($tmpNSBusiness)->applicationRegister($this->_SIALApplication);
 }