/** * @param \Spryker\Shared\Kernel\ClassResolver\ClassInfo $callerClassInfo * * @return string */ protected function buildMessage(ClassInfo $callerClassInfo) { $message = 'Spryker Kernel Exception' . PHP_EOL; $message .= sprintf('Can not resolve %1$sDependencyProvider for your bundle "%1$s"', $callerClassInfo->getBundle()) . PHP_EOL; $message .= 'You can fix this by adding the missing DependencyProvider to your bundle.' . PHP_EOL; $message .= sprintf('E.g. %s\\Yves\\%2$s\\%2$sDependencyProvider', Config::getInstance()->get(KernelConstants::PROJECT_NAMESPACE), $callerClassInfo->getBundle()); $message .= PHP_EOL . new Backtrace(); return $message; }
/** * @param \Spryker\Zed\Kernel\ClassResolver\ClassInfo $callerClassInfo * * @return string */ protected function buildMessage(ClassInfo $callerClassInfo) { $message = 'Spryker Kernel Exception' . PHP_EOL; $message .= sprintf('Can not resolve %1$sQueryContainer in persistence layer for your bundle "%1$s"', $callerClassInfo->getBundle()) . PHP_EOL; $message .= 'You can fix this by adding the missing QueryContainer to your bundle.' . PHP_EOL; $message .= sprintf('E.g. %1$s\\Zed\\%2$s\\Persistence\\%2$sQueryContainer', Config::getInstance()->get(KernelConstants::PROJECT_NAMESPACE), $callerClassInfo->getBundle()); $message .= new Backtrace(); return $message; }
/** * @param \Spryker\Zed\Kernel\ClassResolver\ClassInfo $callerClassInfo * * @return string */ protected function buildMessage(ClassInfo $callerClassInfo) { $message = 'Spryker Kernel Exception' . PHP_EOL; $message .= sprintf('Can not resolve $1Facade in Business layer for your bundle "%s"', $callerClassInfo->getBundle()) . PHP_EOL; $message .= 'You can fix this by adding the missing Facade to your bundle.' . PHP_EOL; $message .= sprintf('E.g. %s\\Zed\\%2$s\\Business\\%2$sFacade', Config::getInstance()->get(KernelConstants::PROJECT_NAMESPACE), $callerClassInfo->getBundle()); $message .= new Backtrace(); return $message; }
/** * @return callable */ protected function getFunction() { return function ($path) { $path = ltrim($path, '@'); $bundleName = strstr($path, '/', true); $bundleName = ucfirst($bundleName); $bundlePath = strstr($path, '/'); $projectName = Config::getInstance()->get(ApplicationConstants::PROJECT_NAMESPACE); return sprintf('%s/%s/Zed/%s/Presentation%s', APPLICATION_SOURCE_DIR, $projectName, $bundleName, $bundlePath); }; }
/** * @return callable */ protected function getFunction() { return function ($path, $dataType = 'x-font-woff', $absolutePath = false) { if (!$absolutePath) { $path = ltrim($path, '@'); $bundleName = strstr($path, '/', true); $bundleName = ucfirst($bundleName); $bundlePath = strstr($path, '/'); $projectName = Config::getInstance()->get(ApplicationConstants::PROJECT_NAMESPACE); $fullPath = sprintf('%s/%s/Zed/%s/Presentation%s', APPLICATION_SOURCE_DIR, $projectName, $bundleName, $bundlePath); } else { $fullPath = $path; } $base64Content = base64_encode(file_get_contents($fullPath)); return sprintf('data:application/%s;charset=utf-8;base64,%s', $dataType, $base64Content); }; }
/** * @return \Spryker\Client\ZedRequest\ZedRequestConfig */ protected function getConfig() { return new ZedRequestConfig(Config::getInstance()); }
/** * @todo CD-412 to be rafactored, does to many things and is hard to understand * @todo CD-412 refactor this class to allow unspecified header columns and to add flexibility * * @param \Propel\Runtime\ActiveQuery\ModelCriteria $query * @param \Spryker\Zed\Gui\Communication\Table\TableConfiguration $config * @param bool $returnRawResults * * @return array|\Propel\Runtime\Collection\ObjectCollection */ protected function runQuery(ModelCriteria $query, TableConfiguration $config, $returnRawResults = false) { $limit = $this->getLimit(); $offset = $this->getOffset(); $order = $this->getOrders($config); $orderColumn = $this->getOrderByColumn($query, $config, $order); $this->total = $query->count(); $query->orderBy($orderColumn, $order[0][self::SORT_BY_DIRECTION]); $searchTerm = $this->getSearchTerm(); $isFirst = true; if (mb_strlen($searchTerm[self::PARAMETER_VALUE]) > 0) { $query->setIdentifierQuoting(true); foreach ($config->getSearchable() as $value) { if (!$isFirst) { $query->_or(); } else { $isFirst = false; } $filter = ''; $sqlDriver = Config::getInstance()->get(PropelConstants::ZED_DB_ENGINE); // @todo fix this in CD-412 if ($sqlDriver === 'pgsql') { $filter = '::TEXT'; } $conditionParameter = '%' . mb_strtolower($searchTerm[self::PARAMETER_VALUE]) . '%'; $condition = sprintf('LOWER(%s%s) LIKE %s', $value, $filter, Propel::getConnection()->quote($conditionParameter)); $query->where($condition); } $this->filtered = $query->count(); } else { $this->filtered = $this->total; } if ($this->dataTablesTransfer !== null) { $searchColumns = $config->getSearchable(); $this->addFilteringConditions($query, $searchColumns); } $query->offset($offset)->limit($limit); $data = $query->find(); if ($returnRawResults === true) { return $data; } return $data->toArray(null, false, TableMap::TYPE_COLNAME); }
/** * @return array */ protected function getCoreNamespaces() { return Config::getInstance()->get(KernelConstants::CORE_NAMESPACES); }
/** * @TODO find a better way to get around this. Problem is that when we extend classes and use this class to * extract the needed elements, we will get namespaces like Unit, Functional, ClientUnit etc * * @param array $callerClassParts * * @return array */ private function removeTestNamespace(array $callerClassParts) { $config = Config::getInstance(); $projectNamespaces = $config->get(KernelConstants::PROJECT_NAMESPACES); $coreNamespaces = $config->get(KernelConstants::CORE_NAMESPACES); $namespaces = array_merge($projectNamespaces, $coreNamespaces); if (!in_array($callerClassParts[self::KEY_NAMESPACE], $namespaces)) { array_shift($callerClassParts); } return $callerClassParts; }
/** * @return \Spryker\Shared\Config */ protected function getConfig() { return Config::getInstance(); }
/** * @return void */ public static function getInstance() { parent::getInstance(); }
/** * @return void */ public function testGetInstance() { $this->assertInstanceOf(Config::class, Config::getInstance()); }