Add base entities
This commit is contained in:
0
src/Entity/.gitignore
vendored
Normal file
0
src/Entity/.gitignore
vendored
Normal file
110
src/Entity/Post.php
Normal file
110
src/Entity/Post.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\PostRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: PostRepository::class)]
|
||||
class Post
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?\DateTimeImmutable $foundDate = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?\DateTimeImmutable $publicationDate = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?float $latitude = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?float $longitude = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?float $altitude = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $commentary = null;
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getFoundDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->foundDate;
|
||||
}
|
||||
|
||||
public function setFoundDate(\DateTimeImmutable $foundDate): static
|
||||
{
|
||||
$this->foundDate = $foundDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPublicationDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->publicationDate;
|
||||
}
|
||||
|
||||
public function setPublicationDate(\DateTimeImmutable $publicationDate): static
|
||||
{
|
||||
$this->publicationDate = $publicationDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLatitude(): ?float
|
||||
{
|
||||
return $this->latitude;
|
||||
}
|
||||
|
||||
public function setLatitude(?float $latitude): static
|
||||
{
|
||||
$this->latitude = $latitude;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLongitude(): ?float
|
||||
{
|
||||
return $this->longitude;
|
||||
}
|
||||
|
||||
public function setLongitude(?float $longitude): static
|
||||
{
|
||||
$this->longitude = $longitude;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAltitude(): ?float
|
||||
{
|
||||
return $this->altitude;
|
||||
}
|
||||
|
||||
public function setAltitude(?float $altitude): static
|
||||
{
|
||||
$this->altitude = $altitude;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCommentary(): ?string
|
||||
{
|
||||
return $this->commentary;
|
||||
}
|
||||
|
||||
public function setCommentary(string $commentary): static
|
||||
{
|
||||
$this->commentary = $commentary;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
65
src/Entity/Species.php
Normal file
65
src/Entity/Species.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SpeciesRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: SpeciesRepository::class)]
|
||||
class Species
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $scientific_name = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $vernacular_name = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $region = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getScientificName(): ?string
|
||||
{
|
||||
return $this->scientific_name;
|
||||
}
|
||||
|
||||
public function setScientificName(string $scientific_name): static
|
||||
{
|
||||
$this->scientific_name = $scientific_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getVernacularName(): ?string
|
||||
{
|
||||
return $this->vernacular_name;
|
||||
}
|
||||
|
||||
public function setVernacularName(string $vernacular_name): static
|
||||
{
|
||||
$this->vernacular_name = $vernacular_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRegion(): ?string
|
||||
{
|
||||
return $this->region;
|
||||
}
|
||||
|
||||
public function setRegion(string $region): static
|
||||
{
|
||||
$this->region = $region;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
0
src/Repository/.gitignore
vendored
Normal file
0
src/Repository/.gitignore
vendored
Normal file
43
src/Repository/PostRepository.php
Normal file
43
src/Repository/PostRepository.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Post;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Post>
|
||||
*/
|
||||
class PostRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Post::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Post[] Returns an array of Post objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('p.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Post
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/SpeciesRepository.php
Normal file
43
src/Repository/SpeciesRepository.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Species;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Species>
|
||||
*/
|
||||
class SpeciesRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Species::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Species[] Returns an array of Species objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('s.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Species
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
Reference in New Issue
Block a user