├── .gitignore
├── .idea
├── codeStyles
│ └── codeStyleConfig.xml
├── modules.xml
├── movies.iml
├── php.xml
├── vcs.xml
└── workspace.xml
├── README.md
├── assets
├── app.js
├── bootstrap.js
├── controllers.json
├── controllers
│ └── hello_controller.js
├── images
│ └── image1.jpg
├── javascript
│ ├── method1.js
│ └── method2.js
└── styles
│ └── app.css
├── bin
└── console
├── composer.json
├── composer.lock
├── config
├── bundles.php
├── packages
│ ├── assets.yaml
│ ├── cache.yaml
│ ├── doctrine.yaml
│ ├── doctrine_migrations.yaml
│ ├── framework.yaml
│ ├── prod
│ │ ├── doctrine.yaml
│ │ └── webpack_encore.yaml
│ ├── routing.yaml
│ ├── sensio_framework_extra.yaml
│ ├── test
│ │ ├── doctrine.yaml
│ │ └── webpack_encore.yaml
│ ├── twig.yaml
│ └── webpack_encore.yaml
├── preload.php
├── routes.yaml
├── routes
│ ├── annotations.yaml
│ └── framework.yaml
└── services.yaml
├── docker-compose.override.yml
├── docker-compose.yml
├── migrations
├── .gitignore
└── Version20211204111619.php
├── package-lock.json
├── package.json
├── postcss.config.js
├── public
└── index.php
├── src
├── Controller
│ ├── .gitignore
│ └── MoviesController.php
├── DataFixtures
│ ├── ActorFixtures.php
│ └── MovieFixtures.php
├── Entity
│ ├── .gitignore
│ ├── Actor.php
│ └── Movie.php
├── Form
│ ├── MovieFormType.php
│ └── RegistrationFormType.php
├── Kernel.php
└── Repository
│ ├── .gitignore
│ ├── ActorRepository.php
│ └── MovieRepository.php
├── symfony.lock
├── tailwind.config.js
├── templates
├── base.html.twig
├── login.html.twig
├── movies
│ ├── create.html.twig
│ ├── edit.html.twig
│ ├── index.html.twig
│ └── show.html.twig
└── register.html.twig
└── webpack.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | ###> symfony/framework-bundle ###
2 | /.env.local
3 | /.env.local.php
4 | /.env.*.local
5 | /config/secrets/prod/prod.decrypt.private.php
6 | /public/bundles/
7 | /var/
8 | /vendor/
9 | ###< symfony/framework-bundle ###
10 |
11 | ###> symfony/webpack-encore-bundle ###
12 | /node_modules/
13 | /public/build/
14 | npm-debug.log
15 | yarn-error.log
16 | ###< symfony/webpack-encore-bundle ###
17 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
23 |
28 |
29 |
30 |
31 |
32 |
6 | • Twitter: [@codewithdary](https://twitter.com/codewithdary)
7 | • Instagram: [@codewithdary](https://www.instagram.com/codewithdary/)
8 |
--------------------------------------------------------------------------------
/assets/app.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Welcome to your app's main JavaScript file!
3 | *
4 | * We recommend including the built version of this JavaScript file
5 | * (and its CSS file) in your base layout (base.html.twig).
6 | */
7 |
8 | // any CSS you import will output into a single css file (app.css in this case)
9 | import './styles/app.css';
10 |
11 | //Compile new JavaScript file
12 | import './javascript/method1.js';
13 |
14 | // start the Stimulus application
15 | import './bootstrap';
16 |
--------------------------------------------------------------------------------
/assets/bootstrap.js:
--------------------------------------------------------------------------------
1 | import { startStimulusApp } from '@symfony/stimulus-bridge';
2 |
3 | // Registers Stimulus controllers from controllers.json and in the controllers/ directory
4 | export const app = startStimulusApp(require.context(
5 | '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
6 | true,
7 | /\.(j|t)sx?$/
8 | ));
9 |
10 | // register any custom, 3rd party controllers here
11 | // app.register('some_controller_name', SomeImportedController);
12 |
--------------------------------------------------------------------------------
/assets/controllers.json:
--------------------------------------------------------------------------------
1 | {
2 | "controllers": [],
3 | "entrypoints": []
4 | }
5 |
--------------------------------------------------------------------------------
/assets/controllers/hello_controller.js:
--------------------------------------------------------------------------------
1 | import { Controller } from '@hotwired/stimulus';
2 |
3 | /*
4 | * This is an example Stimulus controller!
5 | *
6 | * Any element with a data-controller="hello" attribute will cause
7 | * this controller to be executed. The name "hello" comes from the filename:
8 | * hello_controller.js -> "hello"
9 | *
10 | * Delete this file or adapt it for your use!
11 | */
12 | export default class extends Controller {
13 | connect() {
14 | this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/assets/images/image1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codewithdary/symfony6-static-movies/8b02fcdbd07d067b21e80a862a344d52e1a73bc8/assets/images/image1.jpg
--------------------------------------------------------------------------------
/assets/javascript/method1.js:
--------------------------------------------------------------------------------
1 | console.log('12345')
--------------------------------------------------------------------------------
/assets/javascript/method2.js:
--------------------------------------------------------------------------------
1 | alert('12345')
--------------------------------------------------------------------------------
/assets/styles/app.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 |
3 | @tailwind components;
4 |
5 | @tailwind utilities;
--------------------------------------------------------------------------------
/bin/console:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | =8.0.2",
8 | "ext-ctype": "*",
9 | "ext-iconv": "*",
10 | "composer/package-versions-deprecated": "1.11.99.4",
11 | "doctrine/doctrine-bundle": "^2.5",
12 | "doctrine/doctrine-migrations-bundle": "^3.2",
13 | "doctrine/orm": "^2.10",
14 | "laminas/laminas-code": "~4.5.0@dev",
15 | "sensio/framework-extra-bundle": "^6.2",
16 | "symfony/asset": "6.0.*",
17 | "symfony/console": "6.0.*",
18 | "symfony/dotenv": "6.0.*",
19 | "symfony/flex": "^2",
20 | "symfony/framework-bundle": "6.0.*",
21 | "symfony/maker-bundle": "^1.36",
22 | "symfony/proxy-manager-bridge": "6.0.*",
23 | "symfony/runtime": "6.0.*",
24 | "symfony/twig-bundle": "6.0.*",
25 | "symfony/webpack-encore-bundle": "^1.13",
26 | "symfony/yaml": "6.0.*",
27 | "twig/extra-bundle": "^2.12|^3.0",
28 | "twig/twig": "^2.12|^3.0"
29 | },
30 | "config": {
31 | "optimize-autoloader": true,
32 | "preferred-install": {
33 | "*": "dist"
34 | },
35 | "sort-packages": true
36 | },
37 | "autoload": {
38 | "psr-4": {
39 | "App\\": "src/"
40 | }
41 | },
42 | "autoload-dev": {
43 | "psr-4": {
44 | "App\\Tests\\": "tests/"
45 | }
46 | },
47 | "replace": {
48 | "symfony/polyfill-ctype": "*",
49 | "symfony/polyfill-iconv": "*",
50 | "symfony/polyfill-php72": "*",
51 | "symfony/polyfill-php73": "*",
52 | "symfony/polyfill-php74": "*",
53 | "symfony/polyfill-php80": "*"
54 | },
55 | "scripts": {
56 | "auto-scripts": {
57 | "cache:clear": "symfony-cmd",
58 | "assets:install %PUBLIC_DIR%": "symfony-cmd"
59 | },
60 | "post-install-cmd": [
61 | "@auto-scripts"
62 | ],
63 | "post-update-cmd": [
64 | "@auto-scripts"
65 | ]
66 | },
67 | "conflict": {
68 | "symfony/symfony": "*"
69 | },
70 | "extra": {
71 | "symfony": {
72 | "allow-contrib": false,
73 | "require": "6.0.*"
74 | }
75 | },
76 | "require-dev": {
77 | "doctrine/doctrine-fixtures-bundle": "^3.4"
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/config/bundles.php:
--------------------------------------------------------------------------------
1 | ['all' => true],
5 | Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
6 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
7 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
8 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
9 | Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
10 | Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
11 | Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
12 | Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
13 | ];
14 |
--------------------------------------------------------------------------------
/config/packages/assets.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | assets:
3 | json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
4 |
--------------------------------------------------------------------------------
/config/packages/cache.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | cache:
3 | # Unique name of your app: used to compute stable namespaces for cache keys.
4 | #prefix_seed: your_vendor_name/app_name
5 |
6 | # The "app" cache stores to the filesystem by default.
7 | # The data in this cache should persist between deploys.
8 | # Other options include:
9 |
10 | # Redis
11 | #app: cache.adapter.redis
12 | #default_redis_provider: redis://localhost
13 |
14 | # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
15 | #app: cache.adapter.apcu
16 |
17 | # Namespaced pools use the above "app" backend by default
18 | #pools:
19 | #my.dedicated.cache: null
20 |
--------------------------------------------------------------------------------
/config/packages/doctrine.yaml:
--------------------------------------------------------------------------------
1 | doctrine:
2 | dbal:
3 | url: '%env(resolve:DATABASE_URL)%'
4 |
5 | # IMPORTANT: You MUST configure your server version,
6 | # either here or in the DATABASE_URL env var (see .env file)
7 | #server_version: '13'
8 | orm:
9 | auto_generate_proxy_classes: true
10 | naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
11 | auto_mapping: true
12 | mappings:
13 | App:
14 | is_bundle: false
15 | type: annotation
16 | dir: '%kernel.project_dir%/src/Entity'
17 | prefix: 'App\Entity'
18 | alias: App
19 |
--------------------------------------------------------------------------------
/config/packages/doctrine_migrations.yaml:
--------------------------------------------------------------------------------
1 | doctrine_migrations:
2 | migrations_paths:
3 | # namespace is arbitrary but should be different from App\Migrations
4 | # as migrations classes should NOT be autoloaded
5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations'
6 | enable_profiler: '%kernel.debug%'
7 |
--------------------------------------------------------------------------------
/config/packages/framework.yaml:
--------------------------------------------------------------------------------
1 | # see https://symfony.com/doc/current/reference/configuration/framework.html
2 | framework:
3 | secret: '%env(APP_SECRET)%'
4 | #csrf_protection: true
5 | http_method_override: false
6 |
7 | # Enables session support. Note that the session will ONLY be started if you read or write from it.
8 | # Remove or comment this section to explicitly disable session support.
9 | session:
10 | handler_id: null
11 | cookie_secure: auto
12 | cookie_samesite: lax
13 | storage_factory_id: session.storage.factory.native
14 |
15 | #esi: true
16 | #fragments: true
17 | php_errors:
18 | log: true
19 |
20 | when@test:
21 | framework:
22 | test: true
23 | session:
24 | storage_factory_id: session.storage.factory.mock_file
25 |
--------------------------------------------------------------------------------
/config/packages/prod/doctrine.yaml:
--------------------------------------------------------------------------------
1 | doctrine:
2 | orm:
3 | auto_generate_proxy_classes: false
4 | query_cache_driver:
5 | type: pool
6 | pool: doctrine.system_cache_pool
7 | result_cache_driver:
8 | type: pool
9 | pool: doctrine.result_cache_pool
10 |
11 | framework:
12 | cache:
13 | pools:
14 | doctrine.result_cache_pool:
15 | adapter: cache.app
16 | doctrine.system_cache_pool:
17 | adapter: cache.system
18 |
--------------------------------------------------------------------------------
/config/packages/prod/webpack_encore.yaml:
--------------------------------------------------------------------------------
1 | #webpack_encore:
2 | # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
3 | # Available in version 1.2
4 | #cache: true
5 |
--------------------------------------------------------------------------------
/config/packages/routing.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | router:
3 | utf8: true
4 |
5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
7 | #default_uri: http://localhost
8 |
9 | when@prod:
10 | framework:
11 | router:
12 | strict_requirements: null
13 |
--------------------------------------------------------------------------------
/config/packages/sensio_framework_extra.yaml:
--------------------------------------------------------------------------------
1 | sensio_framework_extra:
2 | router:
3 | annotations: false
4 |
--------------------------------------------------------------------------------
/config/packages/test/doctrine.yaml:
--------------------------------------------------------------------------------
1 | doctrine:
2 | dbal:
3 | # "TEST_TOKEN" is typically set by ParaTest
4 | dbname_suffix: '_test%env(default::TEST_TOKEN)%'
5 |
--------------------------------------------------------------------------------
/config/packages/test/webpack_encore.yaml:
--------------------------------------------------------------------------------
1 | #webpack_encore:
2 | # strict_mode: false
3 |
--------------------------------------------------------------------------------
/config/packages/twig.yaml:
--------------------------------------------------------------------------------
1 | twig:
2 | default_path: '%kernel.project_dir%/templates'
3 | globals:
4 | author: Code With Dary
5 |
6 | when@test:
7 | twig:
8 | strict_variables: true
9 |
--------------------------------------------------------------------------------
/config/packages/webpack_encore.yaml:
--------------------------------------------------------------------------------
1 | webpack_encore:
2 | # The path where Encore is building the assets - i.e. Encore.setOutputPath()
3 | output_path: '%kernel.project_dir%/public/build'
4 | # If multiple builds are defined (as shown below), you can disable the default build:
5 | # output_path: false
6 |
7 | # Set attributes that will be rendered on all script and link tags
8 | script_attributes:
9 | defer: true
10 | # Uncomment (also under link_attributes) if using Turbo Drive
11 | # https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
12 | # 'data-turbo-track': reload
13 | # link_attributes:
14 | # Uncomment if using Turbo Drive
15 | # 'data-turbo-track': reload
16 |
17 | # If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
18 | # crossorigin: 'anonymous'
19 |
20 | # Preload all rendered script and link tags automatically via the HTTP/2 Link header
21 | # preload: true
22 |
23 | # Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
24 | # strict_mode: false
25 |
26 | # If you have multiple builds:
27 | # builds:
28 | # pass "frontend" as the 3rg arg to the Twig functions
29 | # {{ encore_entry_script_tags('entry1', null, 'frontend') }}
30 |
31 | # frontend: '%kernel.project_dir%/public/frontend/build'
32 |
33 | # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
34 | # Put in config/packages/prod/webpack_encore.yaml
35 | # cache: true
36 |
--------------------------------------------------------------------------------
/config/preload.php:
--------------------------------------------------------------------------------
1 | doctrine/doctrine-bundle ###
5 | database:
6 | ports:
7 | - "5432"
8 | ###< doctrine/doctrine-bundle ###
9 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | ###> doctrine/doctrine-bundle ###
5 | database:
6 | image: postgres:${POSTGRES_VERSION:-13}-alpine
7 | environment:
8 | POSTGRES_DB: ${POSTGRES_DB:-app}
9 | # You should definitely change the password in production
10 | POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}
11 | POSTGRES_USER: ${POSTGRES_USER:-symfony}
12 | volumes:
13 | - db-data:/var/lib/postgresql/data:rw
14 | # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
15 | # - ./docker/db/data:/var/lib/postgresql/data:rw
16 | ###< doctrine/doctrine-bundle ###
17 |
18 | volumes:
19 | ###> doctrine/doctrine-bundle ###
20 | db-data:
21 | ###< doctrine/doctrine-bundle ###
22 |
--------------------------------------------------------------------------------
/migrations/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codewithdary/symfony6-static-movies/8b02fcdbd07d067b21e80a862a344d52e1a73bc8/migrations/.gitignore
--------------------------------------------------------------------------------
/migrations/Version20211204111619.php:
--------------------------------------------------------------------------------
1 | addSql('CREATE TABLE actor (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
24 | $this->addSql('CREATE TABLE movie (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, release_year INT NOT NULL, description VARCHAR(255) DEFAULT NULL, image_path VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
25 | $this->addSql('CREATE TABLE movie_actor (movie_id INT NOT NULL, actor_id INT NOT NULL, INDEX IDX_3A374C658F93B6FC (movie_id), INDEX IDX_3A374C6510DAF24A (actor_id), PRIMARY KEY(movie_id, actor_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
26 | $this->addSql('ALTER TABLE movie_actor ADD CONSTRAINT FK_3A374C658F93B6FC FOREIGN KEY (movie_id) REFERENCES movie (id) ON DELETE CASCADE');
27 | $this->addSql('ALTER TABLE movie_actor ADD CONSTRAINT FK_3A374C6510DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE');
28 | }
29 |
30 | public function down(Schema $schema): void
31 | {
32 | // this down() migration is auto-generated, please modify it to your needs
33 | $this->addSql('ALTER TABLE movie_actor DROP FOREIGN KEY FK_3A374C6510DAF24A');
34 | $this->addSql('ALTER TABLE movie_actor DROP FOREIGN KEY FK_3A374C658F93B6FC');
35 | $this->addSql('DROP TABLE actor');
36 | $this->addSql('DROP TABLE movie');
37 | $this->addSql('DROP TABLE movie_actor');
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "devDependencies": {
3 | "@hotwired/stimulus": "^3.0.0",
4 | "@symfony/stimulus-bridge": "^3.0.0",
5 | "@symfony/webpack-encore": "^1.7.0",
6 | "core-js": "^3.0.0",
7 | "file-loader": "^6.2.0",
8 | "glob-all": "^3.2.1",
9 | "path": "^0.12.7",
10 | "postcss-loader": "^6.2.1",
11 | "purgecss-webpack-plugin": "^4.1.3",
12 | "regenerator-runtime": "^0.13.2",
13 | "tailwindcss": "^3.0.15",
14 | "webpack-notifier": "^1.15.0"
15 | },
16 | "license": "UNLICENSED",
17 | "private": true,
18 | "scripts": {
19 | "dev-server": "encore dev-server",
20 | "dev": "encore dev",
21 | "watch": "encore dev --watch",
22 | "build": "encore production --progress"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | let tailwindcss = require("tailwindcss")
2 |
3 | module.exports = {
4 | plugins: [
5 | tailwindcss('./tailwind.config.js'),
6 | require('postcss-import'),
7 | require('autoprefixer')
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 | em = $em;
18 | }
19 |
20 | #[Route('/movies', name: 'movies')]
21 | public function index(): Response
22 | {
23 | return $this->render('movies/index.html.twig');
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/DataFixtures/ActorFixtures.php:
--------------------------------------------------------------------------------
1 | setName('Christian Bale');
15 | $manager->persist($actor);
16 |
17 | $actor2 = new Actor();
18 | $actor2->setName('Heath Ledger');
19 | $manager->persist($actor2);
20 |
21 | $actor3 = new Actor();
22 | $actor3->setName('Robert Downey Jr');
23 | $manager->persist($actor3);
24 |
25 | $actor4 = new Actor();
26 | $actor4->setName('Chris Evans');
27 | $manager->persist($actor4);
28 |
29 | $manager->flush();
30 |
31 | $this->addReference('actor_1', $actor);
32 | $this->addReference('actor_2', $actor2);
33 | $this->addReference('actor_3', $actor3);
34 | $this->addReference('actor_4', $actor4);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/DataFixtures/MovieFixtures.php:
--------------------------------------------------------------------------------
1 | setTitle('The Dark Knight');
15 | $movie->setReleaseYear(2008);
16 | $movie->setDescription('This is the description of the Dark Knight');
17 | $movie->setImagePath('https://cdn.pixabay.com/photo/2021/06/18/11/22/batman-6345897_960_720.jpg');
18 |
19 | //Add Data To Pivot Table
20 | $movie->addActor($this->getReference('actor_1'));
21 | $movie->addActor($this->getReference('actor_2'));
22 |
23 | $manager->persist($movie);
24 |
25 | $movie2 = new Movie();
26 | $movie2->setTitle('Avengers: Endgame');
27 | $movie2->setReleaseYear(2019);
28 | $movie2->setDescription('This is the description of Avengers: Endgame');
29 | $movie2->setImagePath('https://cdn.pixabay.com/photo/2020/07/02/19/36/marvel-5364165_960_720.jpg');
30 |
31 | //Add Data To Pivot Table
32 | $movie2->addActor($this->getReference('actor_3'));
33 | $movie2->addActor($this->getReference('actor_4'));
34 |
35 | $manager->persist($movie2);
36 |
37 | $manager->flush();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Entity/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codewithdary/symfony6-static-movies/8b02fcdbd07d067b21e80a862a344d52e1a73bc8/src/Entity/.gitignore
--------------------------------------------------------------------------------
/src/Entity/Actor.php:
--------------------------------------------------------------------------------
1 | movies = new ArrayCollection();
35 | }
36 |
37 | public function getId(): ?int
38 | {
39 | return $this->id;
40 | }
41 |
42 | public function getName(): ?string
43 | {
44 | return $this->name;
45 | }
46 |
47 | public function setName(string $name): self
48 | {
49 | $this->name = $name;
50 |
51 | return $this;
52 | }
53 |
54 | /**
55 | * @return Collection|Movie[]
56 | */
57 | public function getMovies(): Collection
58 | {
59 | return $this->movies;
60 | }
61 |
62 | public function addMovie(Movie $movie): self
63 | {
64 | if (!$this->movies->contains($movie)) {
65 | $this->movies[] = $movie;
66 | $movie->addActor($this);
67 | }
68 |
69 | return $this;
70 | }
71 |
72 | public function removeMovie(Movie $movie): self
73 | {
74 | if ($this->movies->removeElement($movie)) {
75 | $movie->removeActor($this);
76 | }
77 |
78 | return $this;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/Entity/Movie.php:
--------------------------------------------------------------------------------
1 | actors = new ArrayCollection();
50 | }
51 |
52 | public function getId(): ?int
53 | {
54 | return $this->id;
55 | }
56 |
57 | public function getTitle(): ?string
58 | {
59 | return $this->title;
60 | }
61 |
62 | public function setTitle(string $title): self
63 | {
64 | $this->title = $title;
65 |
66 | return $this;
67 | }
68 |
69 | public function getReleaseYear(): ?int
70 | {
71 | return $this->releaseYear;
72 | }
73 |
74 | public function setReleaseYear(int $releaseYear): self
75 | {
76 | $this->releaseYear = $releaseYear;
77 |
78 | return $this;
79 | }
80 |
81 | public function getDescription(): ?string
82 | {
83 | return $this->description;
84 | }
85 |
86 | public function setDescription(?string $description): self
87 | {
88 | $this->description = $description;
89 |
90 | return $this;
91 | }
92 |
93 | public function getImagePath(): ?string
94 | {
95 | return $this->imagePath;
96 | }
97 |
98 | public function setImagePath(string $imagePath): self
99 | {
100 | $this->imagePath = $imagePath;
101 |
102 | return $this;
103 | }
104 |
105 | /**
106 | * @return Collection|Actor[]
107 | */
108 | public function getActors(): Collection
109 | {
110 | return $this->actors;
111 | }
112 |
113 | public function addActor(Actor $actor): self
114 | {
115 | if (!$this->actors->contains($actor)) {
116 | $this->actors[] = $actor;
117 | }
118 |
119 | return $this;
120 | }
121 |
122 | public function removeActor(Actor $actor): self
123 | {
124 | $this->actors->removeElement($actor);
125 |
126 | return $this;
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/src/Form/MovieFormType.php:
--------------------------------------------------------------------------------
1 | add('title', TextType::class, [
20 | 'attr' => array(
21 | 'class' => 'bg-transparent block border-b-2 w-full h-20 text-6xl outline-none',
22 | 'placeholder' => 'Enter title...',
23 | ),
24 | 'label' => false,
25 | 'required' => false
26 | ])
27 | ->add('releaseYear', IntegerType::class, [
28 | 'attr' => array(
29 | 'class' => 'bg-transparent block mt-10 border-b-2 w-full h-20 text-6xl outline-none',
30 | 'placeholder' => 'Enter Release Year...'
31 | ),
32 | 'label' => false,
33 | 'required' => false
34 | ])
35 | ->add('description', TextareaType::class, [
36 | 'attr' => array(
37 | 'class' => 'bg-transparent block mt-10 border-b-2 w-full h-60 text-6xl outline-none',
38 | 'placeholder' => 'Enter Description...'
39 | ),
40 | 'label' => false,
41 | 'required' => false,
42 | ])
43 | ->add('imagePath', FileType::class, array(
44 | 'required' => false,
45 | 'mapped' => false
46 | ))
47 | // ->add('actors')
48 | ;
49 | }
50 |
51 | public function configureOptions(OptionsResolver $resolver): void
52 | {
53 | $resolver->setDefaults([
54 | 'data_class' => Movie::class,
55 | ]);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Form/RegistrationFormType.php:
--------------------------------------------------------------------------------
1 | add('email', TextType::class, [
22 | 'label' => false,
23 | 'attr' => [
24 | 'autocomplete' => 'email',
25 | 'class' => 'bg-transparent block mt-10 mx-auto border-b-2 w-1/5 h-20 text-2xl outline-none',
26 | 'placeholder' => 'Email'
27 | ],
28 | ])
29 | ->add('agreeTerms', CheckboxType::class, [
30 | 'mapped' => false,
31 | 'constraints' => [
32 | new IsTrue([
33 | 'message' => 'You should agree to our terms.',
34 | ]),
35 | ],
36 | ])
37 | ->add('plainPassword', PasswordType::class, [
38 | // instead of being set onto the object directly,
39 | // this is read and encoded in the controller
40 | 'label' => false,
41 | 'mapped' => false,
42 | 'attr' => [
43 | 'autocomplete' => 'new-password',
44 | 'class' => 'bg-transparent block mt-10 mx-auto border-b-2 w-1/5 h-20 text-2xl outline-none',
45 | 'placeholder' => 'Password'
46 | ],
47 | 'constraints' => [
48 | new NotBlank([
49 | 'message' => 'Please enter a password',
50 | ]),
51 | new Length([
52 | 'min' => 6,
53 | 'minMessage' => 'Your password should be at least {{ limit }} characters',
54 | // max length allowed by Symfony for security reasons
55 | 'max' => 4096,
56 | ]),
57 | ],
58 | ])
59 | ;
60 | }
61 |
62 | public function configureOptions(OptionsResolver $resolver): void
63 | {
64 | $resolver->setDefaults([
65 | 'data_class' => Admin::class,
66 | ]);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/Kernel.php:
--------------------------------------------------------------------------------
1 | createQueryBuilder('a')
29 | ->andWhere('a.exampleField = :val')
30 | ->setParameter('val', $value)
31 | ->orderBy('a.id', 'ASC')
32 | ->setMaxResults(10)
33 | ->getQuery()
34 | ->getResult()
35 | ;
36 | }
37 | */
38 |
39 | /*
40 | public function findOneBySomeField($value): ?Actor
41 | {
42 | return $this->createQueryBuilder('a')
43 | ->andWhere('a.exampleField = :val')
44 | ->setParameter('val', $value)
45 | ->getQuery()
46 | ->getOneOrNullResult()
47 | ;
48 | }
49 | */
50 | }
51 |
--------------------------------------------------------------------------------
/src/Repository/MovieRepository.php:
--------------------------------------------------------------------------------
1 | createQueryBuilder('m')
29 | ->andWhere('m.exampleField = :val')
30 | ->setParameter('val', $value)
31 | ->orderBy('m.id', 'ASC')
32 | ->setMaxResults(10)
33 | ->getQuery()
34 | ->getResult()
35 | ;
36 | }
37 | */
38 |
39 | /*
40 | public function findOneBySomeField($value): ?Movie
41 | {
42 | return $this->createQueryBuilder('m')
43 | ->andWhere('m.exampleField = :val')
44 | ->setParameter('val', $value)
45 | ->getQuery()
46 | ->getOneOrNullResult()
47 | ;
48 | }
49 | */
50 | }
51 |
--------------------------------------------------------------------------------
/symfony.lock:
--------------------------------------------------------------------------------
1 | {
2 | "composer/package-versions-deprecated": {
3 | "version": "1.11.99.4"
4 | },
5 | "doctrine/annotations": {
6 | "version": "1.13",
7 | "recipe": {
8 | "repo": "github.com/symfony/recipes",
9 | "branch": "master",
10 | "version": "1.0",
11 | "ref": "a2759dd6123694c8d901d0ec80006e044c2e6457"
12 | },
13 | "files": [
14 | "config/routes/annotations.yaml"
15 | ]
16 | },
17 | "doctrine/cache": {
18 | "version": "2.1.1"
19 | },
20 | "doctrine/collections": {
21 | "version": "1.6.8"
22 | },
23 | "doctrine/common": {
24 | "version": "3.2.0"
25 | },
26 | "doctrine/data-fixtures": {
27 | "version": "1.5.1"
28 | },
29 | "doctrine/dbal": {
30 | "version": "3.2.0"
31 | },
32 | "doctrine/deprecations": {
33 | "version": "v0.5.3"
34 | },
35 | "doctrine/doctrine-bundle": {
36 | "version": "2.5",
37 | "recipe": {
38 | "repo": "github.com/symfony/recipes",
39 | "branch": "master",
40 | "version": "2.4",
41 | "ref": "032f52ed50a27762b78ca6a2aaf432958c473553"
42 | },
43 | "files": [
44 | "config/packages/doctrine.yaml",
45 | "config/packages/prod/doctrine.yaml",
46 | "config/packages/test/doctrine.yaml",
47 | "src/Entity/.gitignore",
48 | "src/Repository/.gitignore"
49 | ]
50 | },
51 | "doctrine/doctrine-fixtures-bundle": {
52 | "version": "3.4",
53 | "recipe": {
54 | "repo": "github.com/symfony/recipes",
55 | "branch": "master",
56 | "version": "3.0",
57 | "ref": "1f5514cfa15b947298df4d771e694e578d4c204d"
58 | },
59 | "files": [
60 | "src/DataFixtures/AppFixtures.php"
61 | ]
62 | },
63 | "doctrine/doctrine-migrations-bundle": {
64 | "version": "3.2",
65 | "recipe": {
66 | "repo": "github.com/symfony/recipes",
67 | "branch": "master",
68 | "version": "3.1",
69 | "ref": "ee609429c9ee23e22d6fa5728211768f51ed2818"
70 | },
71 | "files": [
72 | "config/packages/doctrine_migrations.yaml",
73 | "migrations/.gitignore"
74 | ]
75 | },
76 | "doctrine/event-manager": {
77 | "version": "1.1.1"
78 | },
79 | "doctrine/inflector": {
80 | "version": "2.0.4"
81 | },
82 | "doctrine/instantiator": {
83 | "version": "1.4.0"
84 | },
85 | "doctrine/lexer": {
86 | "version": "1.2.1"
87 | },
88 | "doctrine/migrations": {
89 | "version": "3.3.2"
90 | },
91 | "doctrine/orm": {
92 | "version": "2.10.2"
93 | },
94 | "doctrine/persistence": {
95 | "version": "2.2.3"
96 | },
97 | "doctrine/sql-formatter": {
98 | "version": "1.1.2"
99 | },
100 | "friendsofphp/proxy-manager-lts": {
101 | "version": "v1.0.5"
102 | },
103 | "laminas/laminas-code": {
104 | "version": "2.6.2"
105 | },
106 | "nikic/php-parser": {
107 | "version": "v4.13.2"
108 | },
109 | "psr/cache": {
110 | "version": "3.0.0"
111 | },
112 | "psr/container": {
113 | "version": "2.0.2"
114 | },
115 | "psr/event-dispatcher": {
116 | "version": "1.0.0"
117 | },
118 | "psr/log": {
119 | "version": "3.0.0"
120 | },
121 | "sensio/framework-extra-bundle": {
122 | "version": "6.2",
123 | "recipe": {
124 | "repo": "github.com/symfony/recipes",
125 | "branch": "master",
126 | "version": "5.2",
127 | "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
128 | },
129 | "files": [
130 | "config/packages/sensio_framework_extra.yaml"
131 | ]
132 | },
133 | "symfony/asset": {
134 | "version": "v6.0.0"
135 | },
136 | "symfony/cache": {
137 | "version": "v6.0.0"
138 | },
139 | "symfony/cache-contracts": {
140 | "version": "v3.0.0"
141 | },
142 | "symfony/config": {
143 | "version": "v6.0.0"
144 | },
145 | "symfony/console": {
146 | "version": "6.0",
147 | "recipe": {
148 | "repo": "github.com/symfony/recipes",
149 | "branch": "master",
150 | "version": "5.3",
151 | "ref": "da0c8be8157600ad34f10ff0c9cc91232522e047"
152 | },
153 | "files": [
154 | "bin/console"
155 | ]
156 | },
157 | "symfony/dependency-injection": {
158 | "version": "v6.0.0"
159 | },
160 | "symfony/deprecation-contracts": {
161 | "version": "v3.0.0"
162 | },
163 | "symfony/doctrine-bridge": {
164 | "version": "v6.0.0"
165 | },
166 | "symfony/dotenv": {
167 | "version": "v6.0.0"
168 | },
169 | "symfony/error-handler": {
170 | "version": "v6.0.0"
171 | },
172 | "symfony/event-dispatcher": {
173 | "version": "v6.0.0"
174 | },
175 | "symfony/event-dispatcher-contracts": {
176 | "version": "v3.0.0"
177 | },
178 | "symfony/filesystem": {
179 | "version": "v6.0.0"
180 | },
181 | "symfony/finder": {
182 | "version": "v6.0.0"
183 | },
184 | "symfony/flex": {
185 | "version": "2.0",
186 | "recipe": {
187 | "repo": "github.com/symfony/recipes",
188 | "branch": "master",
189 | "version": "1.0",
190 | "ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e"
191 | },
192 | "files": [
193 | ".env"
194 | ]
195 | },
196 | "symfony/framework-bundle": {
197 | "version": "6.0",
198 | "recipe": {
199 | "repo": "github.com/symfony/recipes",
200 | "branch": "master",
201 | "version": "5.4",
202 | "ref": "d4131812e20853626928e73d3effef44014944c0"
203 | },
204 | "files": [
205 | "config/packages/cache.yaml",
206 | "config/packages/framework.yaml",
207 | "config/preload.php",
208 | "config/routes/framework.yaml",
209 | "config/services.yaml",
210 | "public/index.php",
211 | "src/Controller/.gitignore",
212 | "src/Kernel.php"
213 | ]
214 | },
215 | "symfony/http-foundation": {
216 | "version": "v6.0.0"
217 | },
218 | "symfony/http-kernel": {
219 | "version": "v6.0.0"
220 | },
221 | "symfony/maker-bundle": {
222 | "version": "1.36",
223 | "recipe": {
224 | "repo": "github.com/symfony/recipes",
225 | "branch": "master",
226 | "version": "1.0",
227 | "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
228 | }
229 | },
230 | "symfony/polyfill-intl-grapheme": {
231 | "version": "v1.23.1"
232 | },
233 | "symfony/polyfill-intl-normalizer": {
234 | "version": "v1.23.0"
235 | },
236 | "symfony/polyfill-mbstring": {
237 | "version": "v1.23.1"
238 | },
239 | "symfony/polyfill-php81": {
240 | "version": "v1.23.0"
241 | },
242 | "symfony/proxy-manager-bridge": {
243 | "version": "v6.0.0"
244 | },
245 | "symfony/routing": {
246 | "version": "6.0",
247 | "recipe": {
248 | "repo": "github.com/symfony/recipes",
249 | "branch": "master",
250 | "version": "6.0",
251 | "ref": "ab9ad892b7bba7ac584f6dc2ccdb659d358c63c5"
252 | },
253 | "files": [
254 | "config/packages/routing.yaml",
255 | "config/routes.yaml"
256 | ]
257 | },
258 | "symfony/runtime": {
259 | "version": "v6.0.0"
260 | },
261 | "symfony/service-contracts": {
262 | "version": "v3.0.0"
263 | },
264 | "symfony/stopwatch": {
265 | "version": "v6.0.0"
266 | },
267 | "symfony/string": {
268 | "version": "v6.0.0"
269 | },
270 | "symfony/translation-contracts": {
271 | "version": "v3.0.0"
272 | },
273 | "symfony/twig-bridge": {
274 | "version": "v6.0.0"
275 | },
276 | "symfony/twig-bundle": {
277 | "version": "6.0",
278 | "recipe": {
279 | "repo": "github.com/symfony/recipes",
280 | "branch": "master",
281 | "version": "5.4",
282 | "ref": "bffbb8f1a849736e64006735afae730cb428b6ff"
283 | },
284 | "files": [
285 | "config/packages/twig.yaml",
286 | "templates/base.html.twig"
287 | ]
288 | },
289 | "symfony/var-dumper": {
290 | "version": "v6.0.0"
291 | },
292 | "symfony/var-exporter": {
293 | "version": "v6.0.0"
294 | },
295 | "symfony/webpack-encore-bundle": {
296 | "version": "1.13",
297 | "recipe": {
298 | "repo": "github.com/symfony/recipes",
299 | "branch": "master",
300 | "version": "1.9",
301 | "ref": "d2d1e09675fff3fa4193aa9950a7c39934524a25"
302 | },
303 | "files": [
304 | "assets/app.js",
305 | "assets/bootstrap.js",
306 | "assets/controllers.json",
307 | "assets/controllers/hello_controller.js",
308 | "assets/styles/app.css",
309 | "config/packages/assets.yaml",
310 | "config/packages/prod/webpack_encore.yaml",
311 | "config/packages/test/webpack_encore.yaml",
312 | "config/packages/webpack_encore.yaml",
313 | "package.json",
314 | "webpack.config.js"
315 | ]
316 | },
317 | "symfony/yaml": {
318 | "version": "v6.0.0"
319 | },
320 | "twig/extra-bundle": {
321 | "version": "v3.3.4"
322 | },
323 | "twig/twig": {
324 | "version": "v3.3.4"
325 | }
326 | }
327 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | content: [
3 | "./assets/**/*.{vue,js,ts,jsx,tsx}",
4 | "./templates/**/*.{html,twig}"
5 | ],
6 | theme: {
7 | extend: {},
8 | },
9 | plugins: [],
10 | }
11 |
--------------------------------------------------------------------------------
/templates/base.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |