From e990ddbc2555c6bcc04da853124b88ebf375b843 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 29 Dec 2021 00:16:57 +0100 Subject: [PATCH] Create product entity --- src/Entity/.gitignore | 0 src/Entity/Helpers/EnabledTrait.php | 24 +++++++++++++ src/Entity/Product.php | 53 ++++++++++++++++++++++++++++ src/Repository/.gitignore | 0 src/Repository/ProductRepository.php | 50 ++++++++++++++++++++++++++ 5 files changed, 127 insertions(+) delete mode 100644 src/Entity/.gitignore create mode 100644 src/Entity/Helpers/EnabledTrait.php create mode 100644 src/Entity/Product.php delete mode 100644 src/Repository/.gitignore create mode 100644 src/Repository/ProductRepository.php diff --git a/src/Entity/.gitignore b/src/Entity/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/src/Entity/Helpers/EnabledTrait.php b/src/Entity/Helpers/EnabledTrait.php new file mode 100644 index 0000000..089579f --- /dev/null +++ b/src/Entity/Helpers/EnabledTrait.php @@ -0,0 +1,24 @@ +enabled; + } + + public function setEnabled(bool $enabled) + { + $this->enabled = $enabled; + return $this; + } +} \ No newline at end of file diff --git a/src/Entity/Product.php b/src/Entity/Product.php new file mode 100644 index 0000000..5daba94 --- /dev/null +++ b/src/Entity/Product.php @@ -0,0 +1,53 @@ +id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + public function getDescription(): ?string + { + return $this->Description; + } + + public function setDescription(?string $Description): self + { + $this->Description = $Description; + + return $this; + } +} diff --git a/src/Repository/.gitignore b/src/Repository/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/src/Repository/ProductRepository.php b/src/Repository/ProductRepository.php new file mode 100644 index 0000000..c34bb70 --- /dev/null +++ b/src/Repository/ProductRepository.php @@ -0,0 +1,50 @@ +createQueryBuilder('p') + ->andWhere('p.exampleField = :val') + ->setParameter('val', $value) + ->orderBy('p.id', 'ASC') + ->setMaxResults(10) + ->getQuery() + ->getResult() + ; + } + */ + + /* + public function findOneBySomeField($value): ?Product + { + return $this->createQueryBuilder('p') + ->andWhere('p.exampleField = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } + */ +}