Skip to content

Commit

Permalink
Base resource operations
Browse files Browse the repository at this point in the history
  • Loading branch information
lchrusciel committed Dec 4, 2024
1 parent d3bb656 commit 8d1777d
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
6 changes: 0 additions & 6 deletions .docker/frankenphp/xdebug.ini

This file was deleted.

3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ FROM dunglas/frankenphp:alpine AS frankenphp

ADD .docker/frankenphp/Caddyfile /etc/caddy/
ADD .docker/frankenphp/php.ini "$PHP_INI_DIR/"
ADD .docker/frankenphp/xdebug.ini "$PHP_INI_DIR/conf.d/"

RUN install-php-extensions ast exif gd intl pdo pdo_mysql pdo_pgsql soap zip xdebug xsl ftp redis
RUN install-php-extensions ast exif gd intl pdo pdo_mysql pdo_pgsql soap zip xsl ftp redis

ENV COMPOSER_ALLOW_SUPERUSER=1
ENV COMPOSER_MEMORY_LIMIT=-1
Expand Down
5 changes: 5 additions & 0 deletions config/packages/twig_hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sylius_twig_hooks:
hooks:
'sylius_admin.packing.show':
show:
template: 'admin/packing/show.html.twig'
19 changes: 17 additions & 2 deletions src/Entity/Packing.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,26 @@
use App\Repository\PackingRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Table;
use Sylius\Resource\Metadata\AsResource;
use Sylius\Resource\Metadata as Metadata;
use Sylius\Resource\Model\ResourceInterface;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\Unique;

#[ORM\Entity(repositoryClass: PackingRepository::class)]
#[Table(name: 'app_packing')]
#[AsResource()]
#[Metadata\AsResource(
section: 'admin',
routePrefix: 'admin',
templatesDir: '@SyliusAdmin/shared/crud',
operations: [
new Metadata\Index(),
new Metadata\Create(),
new Metadata\Show(),
new Metadata\Update(),
new Metadata\Delete(),
new Metadata\BulkDelete(),
]
)]
class Packing implements ResourceInterface
{
#[ORM\Id]
Expand All @@ -19,6 +33,7 @@ class Packing implements ResourceInterface
private ?int $id = null;

#[ORM\Column(length: 255)]
#[Length(min: 5)]
private ?string $name = null;

#[ORM\Column(length: 255)]
Expand Down
12 changes: 12 additions & 0 deletions templates/admin/packing/show.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{#{% extends '@SyliusAdmin/shared/crud/show.html.twig' %}#}

{#{% block body %}#}
{# {% hook 'show' with { _prefixes: prefixes, resource, metadata, configuration } %}#}
{#{% endblock %}#}
<div class="page-body">
<div class="container-xl">
<div class="row">
{{ dump() }}
</div>
</div>
</div>
4 changes: 4 additions & 0 deletions translations/messages.en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
app:
ui:
packing: Packing
packings: Packings

0 comments on commit 8d1777d

Please sign in to comment.