Skip to content

Commit

Permalink
Ajustando BaseExtension.php
Browse files Browse the repository at this point in the history
  • Loading branch information
gerMdz committed Jan 7, 2025
1 parent d9dfb51 commit d1f457a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SITE_BASE_SCHEME=http
SITE_BASE_HOST=localhost
SITE_BASE_URL=$SITE_BASE_SCHEME://$SITE_BASE_HOST


###< redireccion temporal ###

SITE_TEMPORAL=true
Expand Down
3 changes: 2 additions & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

bind:
autowire: true
$uploadsPath: '%kernel.project_dir%/public/uploads'
$pathTemplate: '%kernel.project_dir%/templates'
$isDebug: '%kernel.debug%'
Expand All @@ -37,7 +38,7 @@ services:
$site_temporal: '%site_temporal%'
$site_podcasts: '%env(resolve:URL_PODCAST)%'
$queue_enable: '%queue_enable%'
$publicDir: '%kernel.project_dir%/public'
string $publicDir: '%kernel.project_dir%/public'

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
Expand Down
10 changes: 4 additions & 6 deletions src/Twig/BaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,20 @@

class BaseExtension extends AbstractExtension implements ServiceSubscriberInterface
{
protected $em;
private $container;
protected EntityManagerInterface $em;
private ContainerInterface $container;
private string $publicDir;

/**
* BaseExtension constructor.
* @param EntityManagerInterface $em
* @param ContainerInterface $container
* @param string $publicDir
*/
public function __construct(
EntityManagerInterface $em, ContainerInterface $container, string $publicDir)
EntityManagerInterface $em, ContainerInterface $container)
{
$this->em = $em;
$this->container = $container;
$this->publicDir = $publicDir;
}

public function getFilters(): array
Expand Down Expand Up @@ -130,7 +128,7 @@ public function getEncoreEntryCssSource(string $entryName): string
$files = $entryPointLookupInterface->getCssFiles($entryName);
$source = '';
foreach ($files as $file) {
$source .= file_get_contents($this->publicDir . $file);
$source .= file_get_contents($this->publicDir . '/' . $file);
}

return $source;
Expand Down

0 comments on commit d1f457a

Please sign in to comment.