Recupera o store default associado ao controlador.

@return Store

@throws \Exception
511466
protected function getStore()
    {
        if (!$this->store) {
            $this->store = $this->getServiceName();
        }

        $storeService = $this->pack->getPackName().'.store.'.$this->store;

        if (!$this->app[$storeService]) {
            throw new \Exception('O store '.$storeService.' não foi registrado na aplicação!');
        }

        return $this->app[$storeService];
    }
475459
public function getItemStorage()
    {
        // Hack for weird initialization logic
        if (!$this->itemStorage) {
            $this->itemStorage = new CacheItemStorage(
                $this->cacheAdapter ?: $this->getDefaultCacheAdapter(),
                $this->config->getCacheExpirationInSeconds()
            );
        }

        return $this->itemStorage;
    }
204528
public static function getDefault()
    {
        if (self::existsDefault()) {
            $defaultConnectionName = self::$defaultConnectionName;
            return self::$connectionList[$defaultConnectionName];
        } else {
            throw new Exception('Datasource "' . $defaultConnectionName . '" isn\'t defined in DatasourceCollection');
            return false;
        }
    }
731237
protected function canDeleteStore()
    {
        return isset($this->data_store['store_id'])
            && $this->store->canDelete($this->data_store['store_id'])
            && $this->access('store_delete')
            && !$this->isDefaultStore();
    }
177960
public function getStoreId()
    {
        if (!$this->hasData('store_id')) {
            $this->setData('store_id', (int) $this->getRequest()->getParam($this->getStoreVarName()));
        }

        return $this->getData('store_id');
    }
962569
protected function process()
    {

        // initialize the store view code
        $this->getSubject()->prepareStoreViewCode();

        // load the PK
        $pk = $this->getValue($this->getPrimaryKeyColumnName());

        // load the store view - if no store view has been set, we assume the admin
        // store view, which will contain the default (fallback) attribute values
        $storeViewCode = $this->getSubject()->getStoreViewCode(StoreViewCodes::ADMIN);

        // query whether or not the row has already been processed
        if ($this->storeViewHasBeenProcessed($pk, $storeViewCode)) {
            // log a message
            $this->getSystemLogger()->warning(
                $this->getSubject()->appendExceptionSuffix(
                    sprintf(
                        'Attributes for %s "%s" + store view code "%s" has already been processed',
                        $this->getPrimaryKeyColumnName(),
                        $pk,
                        $storeViewCode
                    )
                )
            );

            // return immediately
            return;
        }

        // load the store ID, use the admin store if NO store view code has been set
        $storeId = $this->getSubject()->getRowStoreId(StoreViewCodes::ADMIN);

        // load the image attribute
        $attribute = $this->getEavAttributeByAttributeCode('image');

        // remove the image if one exists
        if ($value = $this->loadVarcharAttribute($pk, $attribute[MemberNames::ATTRIBUTE_ID], $storeId)) {
            $this->deleteVarcharAttribute(array(MemberNames::VALUE_ID => $value[MemberNames::VALUE_ID]));
        }
    }
1367462
public function store()
    {
        try
        {
            $item = $this->repo->create(Input::all());
        } catch (ValidationErrorException $exception)
        {
            return $this->respondNotValid($exception);
        }

        return $this->response->item($item, new $this->transformerClass);
    }
791464
protected function getSolrConfigStore()
    {
        $options = Solr::solr_options();

        if (!isset($options['indexstore']) || !($indexstore = $options['indexstore'])) {
            throw new Exception('No index configuration for Solr provided', E_USER_ERROR);
        }

        // Find the IndexStore handler, which will handle uploading config files to Solr
        $mode = $indexstore['mode'];

        if ($mode === 'file') {
            return new SolrConfigStore_File($indexstore);
        }
        if ($mode === 'webdav') {
            return new SolrConfigStore_WebDAV($indexstore);
        }
        if ($mode === 'post') {
            return new SolrConfigStore_Post($indexstore);
        }
        if (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, SolrConfigStore::class)) {
            return new $mode($indexstore);
        }
        user_error('Unknown Solr index mode ' . $indexstore['mode'], E_USER_ERROR);
    }
852178
private function getOrderStoreReference()
    {
        return \UOL\PagSeguro\Helper\Data::getOrderStoreReference(
            $this->_scopeConfig->getValue('pagseguro/store/reference'),
            $this->_order->getEntityId()
        );
    }
1031622
public function checkout()
    {
        if (!class_exists($this->config()->checkout_class)) {
            return $this->httpError(404);
        }

        $checkout = Injector::inst()
            ->get($this->config()->checkout_class);
        $checkout->setEstimate($this->dataRecord);

        $this->extend("onBeforeCheckout");

        $this->redirect($checkout->Link());
    }
130117
protected function getDefaultCache()
    {
        if (extension_loaded('apcu')) {
            return new ApcuCachePool();
        }

        if (class_exists('\Cache\Adapter\Filesystem\FilesystemCachePool')) {
            $filesystemAdapter = new Local($this->cacheDir);
            $filesystem        = new Filesystem($filesystemAdapter);
            return new FilesystemCachePool($filesystem);
        }

        return null;
    }
927291
public function getContainer(): ?Container
    {
        if (!$this->hasContainer()) {
            $this->setContainer($this->getDefaultContainer());
        }
        return $this->container;
    }
1060161
protected function getListStore()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            return $this->store->getList(array('limit' => $this->getLimit()));
        }

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

        $result = $this->store->get($id);

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

        return array($result);
    }
509583
public function get()
    {
        if ($this->store instanceof StoreInterface) {
            return $this->store;
        }

        $stores = $this
            ->storeRepository
            ->findAll();

        if (empty($stores)) {
            throw new StoreNotFoundException();
        }

        $this->store = reset($stores);

        return $this->store;
    }
585436
public function store()
    {
        /** @var FormRequest $request */
        $request = app($this->getCreateRequestClass());
        $record  = $this->getNewModelInstance();

        $data = $request->only($this->getRelevantFormFieldKeys(true));

        /** @var FormDataStorerInterface $storer */
        $storer = app(FormDataStorerInterface::class);
        $storer->setModelInformation($this->getModelInformation());

        if ( ! $storer->store($record, $data)) {
            // @codeCoverageIgnoreStart
            return redirect()->back()
                ->withInput()
                ->withErrors([
                    static::GENERAL_ERRORS_KEY => [ $this->getGeneralStoreFailureError() ],
                ]);
            // @codeCoverageIgnoreEnd
        }

        $this->storeActiveTab($request->input(static::ACTIVE_TAB_PANE_KEY));

        cms_flash(
            cms_trans(
                'models.store.success-message-create',
                [ 'record' => $this->getSimpleRecordReference($record->getKey(), $record) ]
            ),
            FlashLevel::SUCCESS
        );

        event( new Events\ModelCreatedInCms($record) );

        if ($request->input(static::SAVE_AND_CLOSE_KEY)) {
            return redirect()->route("{$this->routePrefix}.index");
        }

        return redirect()->route("{$this->routePrefix}.edit", [ $record->getKey() ]);
    }
825609
public function create()
    {
        $fs = new Filesystem();

        if (!$this->sourceDir) {
            throw new \Exception('O diretório de código fonte "singular.directory.src" da aplicação não foi definido!');
        }

        $migrationDir = $this->getMigrationDir();

        if (!$fs->exists($migrationDir)) {
            throw new \Exception(sprintf('O diretório de migration não existe!'));
        }

        $template = file_get_contents(
            __DIR__.DIRECTORY_SEPARATOR."templates".DIRECTORY_SEPARATOR."migration.tpl"
        );

        $dt = new \DateTime('now', new \DateTimeZone('UTC'));
        $date = $dt->format('YmdHis');
        $timestamp = time();

        $components = $this->getComponentsToMigration();

        $template = str_replace('$TIMESTAMP',$timestamp, $template);
        $template = str_replace('$COMPONENTS', $this->arrayToString($components, $timestamp) , $template);

        $this->clearMigrations();

        file_put_contents($migrationDir.DIRECTORY_SEPARATOR.$date.'_insere_registros_componentes_'.$timestamp.'.php', $template);

        return count($components);
    }
500433
public function save()
    {
        $this->initScope();

        $sectionId = $this->getSection();
        $groups = $this->getGroups();
        if (empty($groups)) {
            return $this;
        }

        $oldConfig = $this->_getConfig(true);

        $deleteTransaction = $this->_transactionFactory->create();
        $saveTransaction = $this->_transactionFactory->create();

        $extraOldGroups = [];

        foreach ($groups as $groupId => $groupData) {
            $this->_processGroup(
                $groupId,
                $groupData,
                $groups,
                $sectionId,
                $extraOldGroups,
                $oldConfig,
                $saveTransaction,
                $deleteTransaction
            );
        }

        try {
            $deleteTransaction->delete();
            $saveTransaction->save();
            $this->_appConfig->reinit();
            $this->scopePool->clean();
            $this->_eventManager->dispatch(
                "smile_elasticsuite_relevance_config_changed_section_{$this->getSection()}",
                ['container' => $this->getContainer(), 'store' => $this->getStore()]
            );
        } catch (\Exception $e) {
            $this->_appConfig->reinit();
            throw $e;
        }

        return $this;
    }