Skip to content

Instantly share code, notes, and snippets.

@darnel
Created January 23, 2014 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darnel/8588030 to your computer and use it in GitHub Desktop.
Save darnel/8588030 to your computer and use it in GitHub Desktop.
Application.php - fragment of entity using grid
<?php
namespace Cvut\Fit\Pririz\BaseBundle\Entity;
use Cvut\Fit\Pririz\BaseBundle\Entity\Codebook\Disability;
use Cvut\Fit\Pririz\BaseBundle\Entity\Address\PermanentAddress;
use Cvut\Fit\Pririz\BaseBundle\Entity\Address\CorrespondenceAddress;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\OneToOne;
use Symfony\Component\Validator\Constraints as Assert;
use APY\DataGridBundle\Grid\Mapping as GRID;
/**
* Třída reprezentuje jednu přihlášku uchazeče a obsahuje
* všechny základní údaje přihlášky. Hodnota atributů
* * emailAddress
* * personalIdentificationNumber
* * identificationCardNumber
* je automaticky při změně synchronizována jednak s objektem
* Applicant, jednak s dalšími přihláškami stejného uchazeče.
*
* @author kadleto2
*
* @Entity(repositoryClass="ApplicationRepository")
* @GRID\Source(groupBy={"id"})
*/
class Application {
/**
* Kód přihlášky - unikátní identifikátor v rámci ČVUT
*
* @var number
* @Id()
* @Column(type="bigint")
* @GRID\Column(title="application.id", operators={"eq","neq"}, defaultOperator="eq")
*/
protected $id;
/**
* Číslo přihlášky - unikátní identifikátor v rámci fakulty
* Jedná se o pořadí přijetí přihlášky na fakultu.
*
* @var number
* @Column(type="integer")
* @Assert\NotNull()
* @GRID\Column(title="application.number", operators={"eq","neq"}, defaultOperator="eq")
*/
protected $number;
/**
* Vazba na uchazeče, který spojuje přihlášky jednoho
* uchazeče.
*
* @var Applicant
* @ManyToOne(targetEntity="Applicant", inversedBy="applications")
* @Assert\Type(type="Cvut\Fit\Pririz\BaseBundle\Entity\Applicant")
* @GRID\Column(type="blank", visible=false)
*/
protected $applicant;
/**
* Příjmení uchazeče
*
* @var unknown
* @Column(type="string")
* @Assert\NotBlank()
* @GRID\Column(title="application.lastName")
*/
protected $lastName;
/**
* Jméno uchazeče
*
* @var string
* @Column(type="string")
* @Assert\NotBlank()
* @GRID\Column(title="application.firstName")
*/
protected $firstName;
/**
* Tituly pred
*
* @var unknown
* @Column(type="string", nullable=true)
* @GRID\Column(type="blank", visible=false)
*/
protected $titlesPrefix;
/**
* Tituly za
*
* @var unknown
* @Column(type="string", nullable=true)
* @GRID\Column(type="blank", visible=false)
*/
protected $titlesSuffix;
/**
* @Column(type="string")
* @var string
* @GRID\Column(title="application.sex", visible=false, filter="select", selectFrom="values", defaultOperator="eq", operatorsVisible=false, values={"M":"M","Z":"Z"})
*/
protected $sex;
/**
* Rodné číslo
*
* @var string
* @Column(type="string")
* @Assert\NotBlank()
* @GRID\Column(title="application.personalIdentificationNumber", defaultOperator="eq", operatorsVisible=false)
*/
protected $personalIdentificationNumber;
/**
* Číslo dokladu
*
* @var string
* @Column(type="string", nullable=true)
* @GRID\Column(type="blank", visible=false)
*/
protected $identificationCardNumber;
/**
* Trvalá adresa
*
* TODO validace datového typu
*
* @var PermanentAddress
* @OneToOne(targetEntity="\Cvut\Fit\Pririz\BaseBundle\Entity\Address\PermanentAddress", mappedBy="id")
*/
protected $permanentAddress;
/**
* Kontaktní adresa
*
* TODO validace null nebo validace datového typu
*
* @var CorrespondenceAddress
* @OneToOne(targetEntity="\Cvut\Fit\Pririz\BaseBundle\Entity\Address\CorrespondenceAddress", mappedBy="id")
*/
protected $contactAddress;
/**
* Státní příslušnost
*
* @var Nationality
* @ManyToOne(targetEntity="Cvut\Fit\Pririz\BaseBundle\Entity\Codebook\Country")
* @JoinColumn(referencedColumnName="code")
* @Assert\NotNull()
* @GRID\Column(title="application.nationality", field="nationality.isoCode", defaultOperator="like", operatorsVisible=false, filter="select", selectFrom="source", selectMulti=true)
*/
protected $nationality;
/**
* @ManyToOne(targetEntity="\Cvut\Fit\Pririz\BaseBundle\Entity\Codebook\Disability")
* @JoinColumn(referencedColumnName="code")
* @GRID\Column(type="blank", visible=false)
* @var Disability
*/
protected $disability;
/**
* @Column(type="text", nullable=true)
* @var string
* @GRID\Column(type="blank", visible=false)
*/
protected $disabilityDescription;
/**
* Stav prihlasky v prijimacim rizeni
* @ManyToOne(targetEntity="ProcessState")
* @GRID\Column(title="application.state", field="state.name", filter="select", selectFrom="values", defaultOperator="eq", operatorsVisible=false)
*/
protected $state;
/**
* Financovani studia
* @Column(type="string", nullable=true)
* @GRID\Column(title="application.funding", filter="select", selectFrom="values", defaultOperator="eq", operatorsVisible=false, values={"1","6"}, visible=false)
* @var string
*/
protected $funding;
/**
* @ManyToOne(targetEntity="StudyProgram", inversedBy="applications")
* @GRID\Column(title="application.program", field="program.code", filter="select", selectFrom="source", defaultOperator="eq", operatorsVisible=false)
* @GRID\Column(title="application.form", field="program.form", filter="select", selectFrom="source", defaultOperator="eq", operatorsVisible=false)
* @var Program
*/
protected $program;
/**
* Obory, na ktere se uchazec hlasi
* @ManyToMany(targetEntity="StudyBranch", inversedBy="applications")
* @GRID\Column(title="application.branches_short", field="branches.kosCode", filter="select", selectFrom="source", defaultOperator="eq", operatorsVisible=false)
* @var ArrayCollection
*/
protected $branches;
/**
* Poradi oboru, na ktere se uchazec hlasi
* @OneToOne(targetEntity="StudyBranchPriority", mappedBy="id", cascade="PERSIST")
* @GRID\Column(type="blank", visible=false)
* @var StudyBranchPriority
*/
protected $branchesPriority;
/**
* Obor, na ktery je uchazec prijat
* @ManyToOne(targetEntity="StudyBranch", inversedBy="acceptedApplications")
* @GRID\Column(type="blank", visible=false)
* @var StudyBranch
*/
protected $branchAccepted;
/**
* Registrace prihlasky na ruzne akce
* @OneToMany(targetEntity="ActionRegistration", mappedBy="application")
* @GRID\Column(title="Akce",field="actionRegistrations.action.id", visible=false, filterable=true, defaultOperator="eq", operatorsVisible=false, filter="select", selectFrom="values")
* @var ArrayCollection
*/
protected $actionRegistrations;
/**
* @OneToMany(targetEntity="ActionExcuse", mappedBy="application")
* @GRID\Column(type="blank", visible=false)
* @var ArrayCollection
*/
protected $excuses;
/**
* @OneToMany(targetEntity="Document", mappedBy="application")
* @GRID\Column(field="documents.date", visible=false, filterable=true, operators={"eq", "lte", "gte", "btwe", "isNull","isNotNull"}, defaultOperator="eq", type="datetime", format="j.n.Y H:i.s")
* @GRID\Column(field="documents.printed", visible=false, filterable=true, operators={"eq", "lte", "gte", "btwe", "isNull","isNotNull"}, defaultOperator="eq", type="datetime", format="j.n.Y H:i.s")
* @GRID\Column(field="documents.document.title", visible=false, filterable=true, defaultOperator="like", operatorsVisible=false, filter="select", selectFrom="values", selectMulti=true)
* @var ArrayCollection
*/
protected $documents;
/**
* slozky v nichz jsou nejake dokumenty souvisejici s prihlaskou
* @ManyToMany(targetEntity="DocumentFolder", mappedBy="applications")
* @GRID\Column(title="application.documentFolder", field="documentFolders.name", visible=false, filter="select", selectFrom="source", defaultOperator="eq", operatorsVisible=false)
* @var ArrayCollection
*/
protected $documentFolders;
/**
* @OneToOne(targetEntity="Score", mappedBy="id")
* @GRID\Column(field="score.h1")
* @GRID\Column(field="score.h2",type="number")
* @GRID\Column(field="score.h3")
* @GRID\Column(field="score.h4")
* @GRID\Column(field="score.h5")
* @GRID\Column(field="score.h6")
* @GRID\Column(field="score.h7",type="number")
* @GRID\Column(field="score.h8",type="number")
* @GRID\Column(field="score.h9")
* @GRID\Column(field="score.h10")
* @var Score
*/
protected $score;
/**
* Informace o přijetí/nepřijetí uchazeče (hodnota z číselníku)
* nebo null pokud nebylo ještě rozhodnuto
* @OneToMany(targetEntity="Decision", mappedBy="application")
* @GRID\Column(type="blank", visible=false)
* @var ArrayCollection
*/
protected $decisions;
/**
* Datum přijetí, null pokud uchazeč nebyl přijat
* @Column(type="datetime", nullable=true)
* @GRID\Column(type="blank", visible=false)
* @var \DateTime
*/
protected $accepted;
/**
* Datum zapsání uchazeče do studia nebo null, pokud se uchazeč
* nezapsal
* @Column(type="datetime", nullable=true)
* @GRID\Column(title="application.enrolled", field="enrolled", visible=false, filterable=true, operators={"eq", "lte", "gte", "btwe", "isNull","isNotNull"}, defaultOperator="eq", type="datetime", format="j.n.Y H:i.s")
* @var DateTime
*/
protected $enrolled = null;
/**
* Datum a čas importu přihlášky z KOSu. Před tímto datem není
* možné s přihláškou pracovat. Změny z KOSu v pozdější době
* budou ignorovány.
*
* @var \DateTime
* @Column(type="datetime")
* @GRID\Column(type="blank", visible=false)
*/
protected $kosImported;
/**
* Datum a čas zpětného exportu přihlášky do KOSu. Výchozí hodnota
* je null. Po nastavení hodnoty (tj. po exportu do KOSu) není možné
* s přihláškou v aplikaci pracovat.
*
* @var DateTime
* @Column(type="datetime", nullable=true)
* @GRID\Column(type="blank", visible=false)
*/
protected $kosExported;
/**
* @OneToMany(targetEntity="ApplicationJournal", mappedBy="application")
* @var ArrayCollection
*/
protected $journals;
/* ... */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment