{@inheritDoc}

Exemplo de classe:
produtos => ProdutosController
produtos-estoque => ProdutosEstoqueController
meusprodutos => MeusprodutosController
183346
public function uriToClassName(string $uri): string 
    {
        $string_parts = explode("-", $uri);
        $string = array_map('ucfirst', $string_parts);
        $string = implode("", $string) . "Controller"; 
        return preg_replace("/[^a-zA-Z0-9\-]/", "", $string);
    }
1276096
public function cmdDeleteProductClass()
    {
        $id = $this->getParam(0);

        $result = null;

        if (isset($id)) {

            if (empty($id) || !is_numeric($id)) {
                $this->errorAndExit($this->text('Invalid argument'));
            }

            $result = $this->product_class->delete($id);

        } else if ($this->getParam('all')) {

            $deleted = $count = 0;
            foreach ($this->product_class->getList() as $item) {
                $count++;
                $deleted += (int) $this->product_class->delete($item['product_class_id']);
            }

            $result = $count && $count == $deleted;

        } else {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
525505
public function onProductShow(ResourceControllerEvent $event): void
    {
        $product = $event->getSubject();
        if (!$product instanceof ProductInterface) {
            return;
        }

        $currentRequest = $this->requestStack->getCurrentRequest();
        if ($currentRequest instanceof Request) {
            $currentRequest->attributes->set('nglayouts_sylius_product', $product);
            // We set context here instead in a ContextProvider, since sylius.product.show
            // event happens too late, after onKernelRequest event has already been executed
            $this->context->set('sylius_product_id', (int) $product->getId());
        }
    }
61262
static function alter($obj)
    {
        $tabela            = strtolower(FuncoesReflections::pegaNomeClasseObjeto($obj));
        $atributosTabela   = FuncoesReflections::pegaAtributosDoObjeto($obj);
        $annotationsTabela = Annotations::getAnnotation($obj);
        $arrFormatado      = [];
        $arrFinal          = [];
        $stringAlterTable  = "";
        for ($i = 0; $i < count($atributosTabela); $i++) {
            for ($j = 0; $j < count($annotationsTabela[$atributosTabela[$i]]); $j++) {
                $arrAtual = explode("=", $annotationsTabela[$atributosTabela[$i]][$j]);
                for ($k = 0; $k < count($arrAtual) - 1; $k++) {
                    $arrFormatado[FuncoesString::substituiOcorrenciasDeUmaString($arrAtual[$k], "@_", "")] = $arrAtual[$k + 1];
                }
            }

            $arrFinal[$i] = $arrFormatado;
        }

        $stringAlterTable .= "ALTER TABLE $tabela \n";
        $primKey = false;
        $columnPrimaryKey = "";

        $columnsTabela = self::columns($tabela);

        $arrayCamposTabela = [];
        for ($i = 0; $i < count($columnsTabela); $i++) {
            array_push($arrayCamposTabela, $columnsTabela[$i]['Field']);
        }

        $arrayDiff = array_diff($atributosTabela, $arrayCamposTabela);
        $arrayDiff = array_values($arrayDiff);

        $stringSql = $stringAlterTable;
        for ($j = 0; $j < count($arrayDiff); $j++) {
            if ($j != count($arrayDiff) - 1) {
                $stringSql .= "ADD " . $arrayDiff[$j];
            } else {
                $stringSql .= "ADD " . $arrayDiff[$j];
            }
            if (array_key_exists('type', $arrFormatado)) {

                $stringSql .= " " . $arrFormatado['type'] . "";

            } else {
                $stringSql .= "";
            }

            if (array_key_exists('size', $arrFormatado)) {

                $stringSql .= "(" . $arrFormatado['size'] . ") ";

            } else {
                $stringSql .= "";
            }

            /**
             * @todo NOT NULL AQUI
            */

            if (array_key_exists('notNull', $arrFormatado)) {
                if ($arrFormatado['notNull'] === "true") {
                    $stringSql .= " NOT NULL ";
                } else {
                    $stringSql .= "";
                };
            } else {
                $stringSql .= "";
            }

            if (array_key_exists('primaryKey', $arrFormatado)) {
                if ($arrFormatado['primaryKey'] === "true") {
                    $stringSql .= " PRIMARY KEY ";
                } else {
                    $stringSql .= "";
                };
            } else {
                $stringSql .= "";
            }

            if (array_key_exists('autoIncrement', $arrFormatado)) {
                if ($arrFormatado['autoIncrement'] === "true") {
                    $stringSql .= " AUTO_INCREMENT ";
                } else {
                    $stringSql .= "";
                };
            } else {
                $stringSql .= "";
            }

            $fileContent = JsonReader::read(BASE_DIR."/phiber_config.json")->phiber->code_sync == 1 ? true : false;
            if ($fileContent) {
                $pdo = self::getConnection()->prepare($stringSql);
                $pdo->execute();
            }
        }

        $columnsTabela = self::columns($tabela);
        for ($i = 0; $i < count($arrFinal); $i++) {
            if ($columnsTabela[$i]['Field'] != $atributosTabela[$i]) {
                $stringAlterTable .= "CHANGE `" . $columnsTabela[$i]['Field'] . "` `$atributosTabela[$i]` ";
                $stringAlterTable .= strtoupper($arrFinal[$i]['type']) . "(" . $arrFinal[$i]['size'] . ")\n";

                if ($arrFinal[$i])

                    if ($i != count($arrFinal) - 1) {
                        $stringAlterTable .= ", \n";
                    }
            } else {
                $stringAlterTable .= "CHANGE  `$atributosTabela[$i]` `$atributosTabela[$i]` ";

                $stringAlterTable .= strtoupper($arrFinal[$i]['type']) . "(" . $arrFinal[$i]['size'] . ")";

                $respIfNotNull = $columnsTabela[$i]['Null'] == 'NO' ? 'false' : 'true';

                if ($arrFinal[$i]['notNull'] == $respIfNotNull) {
                    $stringAlterTable .= " NOT NULL ";
                } else {
                    $stringAlterTable .= " NULL ";
                }

                if (array_key_exists('default', $arrFinal[$i]) && $arrFinal[$i]['default'] != "none") {
                    $stringAlterTable .= "DEFAULT '" . $arrFinal[$i]['default'] . "'";
                }

                if (array_key_exists('autoIncrement', $arrFinal[$i]) && $arrFinal[$i]['autoIncrement'] != "false") {
                    $stringAlterTable .= " AUTO_INCREMENT ";
                }

                $stringAlterTable .= ", \n";

                if ($arrFinal[$i]['primaryKey'] == "true" and $primKey != true) {
                    $primKey = true;
                    $columnPrimaryKey = $atributosTabela[$i];
                }
                if ($i == count($arrFinal) - 1) {
                    if ($primKey) {
                        $stringAlterTable .= " DROP PRIMARY KEY, ADD PRIMARY KEY(`$columnPrimaryKey`);";
                    } else {
                        $stringAlterTable .= " DROP PRIMARY KEY";
                    }
                }
            }
        }

        $jsonFile = JsonReader::read(BASE_DIR."/phiber_config.json")->phiber->code_sync == 1 ? true : false;
        if ($jsonFile) {
            $pdo = self::getConnection()->prepare($stringAlterTable);
            if ($pdo->execute()) {
                return true;
            };
        } else {
            return $stringAlterTable;
        }
        return false;
    }
1128510
protected function addProductClass()
    {
        if (!$this->isError()) {
            $id = $this->product_class->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
105459
public function bindToController()
    {
        if ($this->controller->widget === null) {
            $this->controller->widget = new stdClass;
        }

        $this->controller->widget->{$this->alias} = $this;
    }
426843
public function insertProductUom($e)
    {
        $dbResult = $e->getParam('result');
        if (!count($dbResult)) {
            return; //no rows affected
        }

        $productId      = is_array($e->getParam('data'))
                        ? $e->getParam('data')['product_id']
                        : $e->getParam('data')->getProductId();
        $productService = $e->getTarget()->getProductService();
        $find           = array('product_id' => $productId);
        $product        = $productService->find($find, array('uoms'));

        $enabled = $this->canProductBeEnabled($product);

        $productService->setEnabledProduct($productId, $enabled);
    }
966145
protected function generateCrudControllerClass() {
        $dir = $this->bundle->getPath();

        $parts = explode('\\', $this->entity);
        $entityClass = array_pop($parts);
        $entityNamespace = implode('\\', $parts);

        $target = sprintf(
                '%s/Controller/%s/%sController.php', $dir, str_replace('\\', '/', $entityNamespace), $entityClass
        );

        if (!$this->config->getOverwrite() && file_exists($target)) {
            throw new \RuntimeException('Unable to generate the controller as it already exists.');
        }

        $this->renderFile('crud/controller.php.twig', $target, array(
            'actions' => $this->actions,
            'route_prefix' => $this->config->getRoutePrefix(),
            'route_name_prefix' => $this->routeNamePrefix,
            'bundle' => $this->bundle->getName(),
            'entity' => $this->entity,
            'entity_singularized' => $this->entitySingularized,
            'entity_pluralized' => $this->entityPluralized,
            'entity_class' => $entityClass,
            'namespace' => $this->bundle->getNamespace(),
            'entity_namespace' => $entityNamespace,
            'format' => $this->config->getFormat(),
            'bundle_views' => $this->config->getBundleViews(),
            'filter_type' => $this->config->getFilterTYpe(),
            'without_sorting' => $this->config->getWithoutSorting(),
            'without_page_size' => $this->config->getWithoutPageSize(),
            'identifier' => $this->metadata->identifier[0],

        ));
    }
1069825
public function setProduct(ChildProduct $v = null)
    {
        if ($v === null) {
            $this->setProductId(NULL);
        } else {
            $this->setProductId($v->getId());
        }

        $this->aProduct = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the ChildProduct object, it will not be re-added.
        if ($v !== null) {
            $v->addDealerProduct($this);
        }


        return $this;
    }
79431
public function build(): SetProduceCompilationCacheRequest
	{
		$instance = new SetProduceCompilationCacheRequest();
		if ($this->enabled === null) {
			throw new BuilderException('Property [enabled] is required.');
		}
		$instance->enabled = $this->enabled;
		return $instance;
	}
378529
public function getCompareItemsCnt()
    {
        $compare = oxNew(\OxidEsales\Eshop\Application\Controller\CompareController::class);

        return $compare->getCompareItemsCnt();
    }
1364465
protected function buildControllerContext()
    {
        /** @var $controllerContext \ApacheSolrForTypo3\Solr\Mvc\Controller\SolrControllerContext */
        $controllerContext = $this->objectManager->get(SolrControllerContext::class);
        $controllerContext->setRequest($this->request);
        $controllerContext->setResponse($this->response);
        if ($this->arguments !== null) {
            $controllerContext->setArguments($this->arguments);
        }
        $controllerContext->setUriBuilder($this->uriBuilder);
        $typoScriptConfiguration = $this->solrConfigurationManager->getTypoScriptConfiguration();
        $controllerContext->setTypoScriptConfiguration($typoScriptConfiguration);

        $this->setActiveSearchResultSet($controllerContext);

        return $controllerContext;
    }
131089
private function generateBasicController()
    {
        $controllerClass = $this->applicationDir.DS.'Controllers'.DS.$this->controller.'Controller'.EXT;

        if (file_exists($controllerClass)) {
            throw new \Exception("$controllerClass already exists!!");
        }

        /*write operation ->*/
        $filePointer = fopen($controllerClass, 'w') or die('Unable to generate controller');

        $controllerContent = $this->getControllerTemplate();
        $content = $this->getIndexStub();
        $content = $this->replaceTemplate('{%methods%}', $content, $controllerContent);

        return $this->writeContentToClass($filePointer, $content);
    }
747752
public function getControllerClasses()
    {
        $moduleName = $this->getVarValue('moduleName', false);
    
        return (empty($moduleName) || !Yii::$app->hasModule($moduleName)) ? [] : Yii::$app->getModule($moduleName)->getControllerFiles();
    }
312044
protected function compileControllerStub()
    {
        $stub = $this->files->get(__DIR__ . '/../stubs/controller.stub');

        $this->replaceClassName($stub, "controller")
            ->replaceModelPath($stub)
            ->replaceModelName($stub)
            ->replaceSchema($stub, 'controller');


        return $stub;
    }
931098
public function setController(){
		
		//explode the metaData into controller and method
		$routeMetaDataArray = ArrayHelper::parts($this->pattern, $this->routeMetaData)->clean()->trim()->get();

		//check if  a controller is defined for this route
		try{

			if ( ! (int)ArrayHelper::KeyExists(0, $routeMetaDataArray)->get() || empty($routeMetaDataArray[0])) {

				throw new RouteException(get_class(new RouteException) ." : There is no controller associated with this route! -> " . $this->routeName);
				
			}

			//set the controller for this route
			$this->controller = $routeMetaDataArray[0];

			//set the method meta data
			$this->methodMetaData = (count($routeMetaDataArray) > 1) ? $routeMetaDataArray[1] : null;

			//return this object instance
			return $this;

		}
		catch(RouteException $RouteExceptionObjectInstance){

			//display the error message
			$RouteExceptionObjectInstance->errorShow();

		}

	}
792316
public function getController()
    {
        if ($this->controller) {
            return $this->controller;
        }

        $controllerClass = null;
        foreach (array_reverse(ClassInfo::ancestry($this->getClassName())) as $sliceClass) {
            $controllerClass = "{$sliceClass}_Controller";
            if (class_exists($controllerClass)) {
                break;
            }

            $controllerClass = "{$sliceClass}Controller";
            if (class_exists($controllerClass)) {
                break;
            }
        }

        if (!class_exists($controllerClass)) {
            throw new Exception("Could not find controller class for {$this->getClassName()}");
        }

        $this->controller = Injector::inst()->create($controllerClass, $this);

        return $this->controller;
    }