Creating the Recipe entity WIP
This commit is contained in:
parent
1264a886ef
commit
881a50f96d
108
src/Entity/Recipe.php
Normal file
108
src/Entity/Recipe.php
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Entity(repositoryClass="App\Repository\RecipeRepository")
|
||||||
|
*/
|
||||||
|
class Recipe
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Id()
|
||||||
|
* @ORM\GeneratedValue()
|
||||||
|
* @ORM\Column(type="integer")
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=20, nullable=true)
|
||||||
|
*/
|
||||||
|
private $cookTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=100, nullable=true)
|
||||||
|
*/
|
||||||
|
private $cookingMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=25)
|
||||||
|
*/
|
||||||
|
private $recipeCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
|
*/
|
||||||
|
private $recipeCuisine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="json_array")
|
||||||
|
*/
|
||||||
|
private $recipeIngredient;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCookTime(): ?string
|
||||||
|
{
|
||||||
|
return $this->cookTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCookTime(?string $cookTime): self
|
||||||
|
{
|
||||||
|
$this->cookTime = $cookTime;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCookingMethod(): ?string
|
||||||
|
{
|
||||||
|
return $this->cookingMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCookingMethod(?string $cookingMethod): self
|
||||||
|
{
|
||||||
|
$this->cookingMethod = $cookingMethod;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecipeCategory(): ?string
|
||||||
|
{
|
||||||
|
return $this->recipeCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRecipeCategory(string $recipeCategory): self
|
||||||
|
{
|
||||||
|
$this->recipeCategory = $recipeCategory;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecipeCuisine(): ?string
|
||||||
|
{
|
||||||
|
return $this->recipeCuisine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRecipeCuisine(?string $recipeCuisine): self
|
||||||
|
{
|
||||||
|
$this->recipeCuisine = $recipeCuisine;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecipeIngredient()
|
||||||
|
{
|
||||||
|
return $this->recipeIngredient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRecipeIngredient($recipeIngredient): self
|
||||||
|
{
|
||||||
|
$this->recipeIngredient = $recipeIngredient;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/Repository/RecipeRepository.php
Normal file
50
src/Repository/RecipeRepository.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Recipe;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Symfony\Bridge\Doctrine\RegistryInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method Recipe|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method Recipe|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method Recipe[] findAll()
|
||||||
|
* @method Recipe[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class RecipeRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(RegistryInterface $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Recipe::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return Recipe[] Returns an array of Recipe objects
|
||||||
|
// */
|
||||||
|
/*
|
||||||
|
public function findByExampleField($value)
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('r')
|
||||||
|
->andWhere('r.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->orderBy('r.id', 'ASC')
|
||||||
|
->setMaxResults(10)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function findOneBySomeField($value): ?Recipe
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('r')
|
||||||
|
->andWhere('r.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->getQuery()
|
||||||
|
->getOneOrNullResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user