Skip to content
Snippets Groups Projects
Select Git revision
  • fe73457ff55cacee88588d15db28bc9fba9d52f3
  • develop default protected
  • ZERO-162-changes
  • 1.3 protected
  • 1.1
  • 1.2 protected
  • 1.0
  • 13-export-cli-command
  • 1.5.0
  • 1.4.3
  • 1.4.2
  • 1.4.1
  • 1.4.0
  • 1.3.7
  • 1.3.6
  • 1.3.5
  • 1.3.4
  • 1.3.3
  • 1.3.2
  • 1.3.1
  • 1.3.0
  • 1.1.4
  • 1.2.5
  • 1.2.4
  • 1.2.3
  • 1.0.6
  • 1.1.3
  • 1.2.2
28 results

CmsBlockRepository.php

Blame
  • CmsBlockRepository.php 1.46 KiB
    <?php
    declare(strict_types=1);
    
    /**
     * Copyright (c) 2025 TechDivision GmbH
     * All rights reserved
     *
     * This product includes proprietary software developed at TechDivision GmbH, Germany
     * For more information see https://www.techdivision.com/
     *
     * To obtain a valid license for using this software please contact us at
     * license@techdivision.com
     *
     * @copyright  Copyright (c) 2025 TechDivision GmbH (https://www.techdivision.com)
     * @author     TechDivision Team Zero <zero@techdivision.com>
     * @link       https://www.techdivision.com/
     */
    
    namespace Firegento\ContentProvisioning\Model\Repository;
    
    use Firegento\ContentProvisioning\Api\CmsBlockRepositoryInterface;
    use Magento\Framework\App\ResourceConnection;
    
    class CmsBlockRepository implements CmsBlockRepositoryInterface
    {
        public const CMS_BLOCK_TABLE_NAME = 'cms_block';
    
        /**
         * @var ResourceConnection
         */
        private ResourceConnection $resource;
    
        /**
         * @param ResourceConnection $resource
         */
        public function __construct(
            ResourceConnection $resource
        ) {
            $this->resource = $resource;
        }
    
        /**
         * Get CMS Block data by its title.
         *
         * @param string $title
         * @return array
         */
        public function getByTitle(string $title): array
        {
            $connection = $this->resource->getConnection();
            $select = $connection->select()->from(self::CMS_BLOCK_TABLE_NAME)->where('title = :', $title);
    
            return $connection->fetchRow($select);
        }
    }