Slide 1

Slide 1 text

PREPARING FOR DOCTRINE 3 Denis Brumann [email protected]

Slide 2

Slide 2 text

ABOUT ME Denis Brumann [email protected] @dbrumann @dbrumann [email protected] 1

Slide 3

Slide 3 text

@dbrumann [email protected] 2

Slide 4

Slide 4 text

@dbrumann [email protected] 3

Slide 5

Slide 5 text

@dbrumann [email protected] 4

Slide 6

Slide 6 text

@dbrumann [email protected] 5

Slide 7

Slide 7 text

MAPPING UUID GENERATOR NAMED QUERIES NAMESPACE ALIASES CLASS METADATA ENTITY MANAGER SECOND LEVEL CACHE @dbrumann [email protected] 6

Slide 8

Slide 8 text

@dbrumann [email protected] 7

Slide 9

Slide 9 text

MAPPING use Doctrine\ORM\Mapping as ORM; @dbrumann [email protected] 8

Slide 10

Slide 10 text

MAPPING use Doctrine\ORM\Annotation as ORM; @dbrumann [email protected] 9

Slide 11

Slide 11 text

MAPPING UUID GENERATOR NAMED QUERIES NAMESPACE ALIASES CLASS METADATA ENTITY MANAGER SECOND LEVEL CACHE @dbrumann [email protected] 10

Slide 12

Slide 12 text

/** @ORM\Entity */ class Customer { /** * @ORM\Id * @ORM\Column(type="guid") * @ORM\GeneratedValue(strategy="UUID") */ private $id; … @dbrumann [email protected] 11

Slide 13

Slide 13 text

/** @ORM\Entity */ class Customer { /** * @ORM\Id * @ORM\Column(type="guid") * @ORM\GeneratedValue(strategy="UUID") */ private $id; … @dbrumann [email protected] 12

Slide 14

Slide 14 text

UUID GENERATOR composer require ramsey/uuid-doctrine @dbrumann [email protected] 13

Slide 15

Slide 15 text

/** @ORM\Entity */ class Customer { /** * @ORM\Id * @ORM\Column(type="uuid") * @ORM\GeneratedValue(strategy="NONE") */ private $id; public function __construct() { $this->id = Uuid::uuid4(); } public function getId(): string { return (string) $this->id; } @dbrumann [email protected] 14

Slide 16

Slide 16 text

MAPPING UUID GENERATOR NAMED QUERIES NAMESPACE ALIASES CLASS METADATA ENTITY MANAGER SECOND LEVEL CACHE @dbrumann [email protected] 15

Slide 17

Slide 17 text

16

Slide 18

Slide 18 text

Doctrine\ORM\Mapping\ NamedQueries NamedQuery NamedNativeQuery ColumnResult FieldResult EntityResult SqlResultSetMappings SqlResultSetMapping @dbrumann [email protected] 17

Slide 19

Slide 19 text

Doctrine\ORM\EntityManager:: createNamedQuery createNamedNativeQuery @dbrumann [email protected] 18

Slide 20

Slide 20 text

Doctrine\ORM\EntityRepository:: createNamedQuery createNamedNativeQuery @dbrumann [email protected] 19

Slide 21

Slide 21 text

MAPPING UUID GENERATOR NAMED QUERIES NAMESPACE ALIASES CLASS METADATA ENTITY MANAGER SECOND LEVEL CACHE @dbrumann [email protected] 20

Slide 22

Slide 22 text

@dbrumann [email protected] 21 SELECT p FROM AppBundle:Product p WHERE p.price > :price

Slide 23

Slide 23 text

@dbrumann [email protected] 22 SELECT p FROM AppBundle:Product p WHERE p.price > :price

Slide 24

Slide 24 text

@dbrumann [email protected] 23 SELECT p FROM AppBundle\Entity\Product p WHERE p.price > :price

Slide 25

Slide 25 text

@dbrumann [email protected] 24 SELECT p FROM Product::class p WHERE p.price > :price

Slide 26

Slide 26 text

@dbrumann [email protected] 25

Slide 27

Slide 27 text

MAPPING UUID GENERATOR NAMED QUERIES NAMESPACE ALIASES CLASS METADATA ENTITY MANAGER SECOND LEVEL CACHE @dbrumann [email protected] 26

Slide 28

Slide 28 text

Doctrine\ORM\Mapping\ClassMetadata:: getQuotedColumnName getQuotedTableName getQuotedJoinTableName getQuotedIdentifierColumnNames @dbrumann [email protected] 27

Slide 29

Slide 29 text

/** @ORM\Entity */ class Customer { /** * @ORM\Id * @ORM\Column(name="number", type=“integer") */ private $number; … @dbrumann [email protected] 28

Slide 30

Slide 30 text

/** @ORM\Entity */ class Customer { /** * @ORM\Id * @ORM\Column(name="number", type=“integer") */ private $number; … @dbrumann [email protected] 29

Slide 31

Slide 31 text

@dbrumann [email protected] 30

Slide 32

Slide 32 text

@dbrumann [email protected] 31

Slide 33

Slide 33 text

@dbrumann [email protected] 32

Slide 34

Slide 34 text

@dbrumann [email protected] 33

Slide 35

Slide 35 text

@dbrumann [email protected] 34

Slide 36

Slide 36 text

@dbrumann [email protected] 35

Slide 37

Slide 37 text

@dbrumann [email protected] 36

Slide 38

Slide 38 text

@dbrumann [email protected] 37

Slide 39

Slide 39 text

@dbrumann [email protected] 38

Slide 40

Slide 40 text

@dbrumann [email protected] 39

Slide 41

Slide 41 text

MAPPING UUID GENERATOR NAMED QUERIES NAMESPACE ALIASES CLASS METADATA ENTITY MANAGER SECOND LEVEL CACHE @dbrumann [email protected] 40

Slide 42

Slide 42 text

@dbrumann [email protected] 41

Slide 43

Slide 43 text

Doctrine\ORM\EntityManagerInterface:: copy($entity, $deep = false) merge($object) detach($object) @dbrumann [email protected] 42

Slide 44

Slide 44 text

@dbrumann [email protected] 43

Slide 45

Slide 45 text

Doctrine\ORM\EntityManagerInterface:: flush($entity = null) clear($entityName = null) @dbrumann [email protected] 44

Slide 46

Slide 46 text

Doctrine\ORM\EntityManagerInterface:: flush($entity = null) clear($entityName = null) @dbrumann [email protected] 45

Slide 47

Slide 47 text

@dbrumann [email protected] 46

Slide 48

Slide 48 text

@dbrumann [email protected] 47

Slide 49

Slide 49 text

@dbrumann [email protected] 48

Slide 50

Slide 50 text

MAPPING UUID GENERATOR NAMED QUERIES NAMESPACE ALIASES CLASS METADATA ENTITY MANAGER SECOND LEVEL CACHE @dbrumann [email protected] 49

Slide 51

Slide 51 text

@dbrumann [email protected] 50

Slide 52

Slide 52 text

@dbrumann [email protected] 51

Slide 53

Slide 53 text

@dbrumann [email protected] 52 RECAP MAPPING UUID GENERATOR NAMED QUERIES NAMESPACE ALIASES CLASS METADATA ENTITY MANAGER SECOND LEVEL CACHE

Slide 54

Slide 54 text

@dbrumann [email protected] 53

Slide 55

Slide 55 text

@dbrumann [email protected] 54

Slide 56

Slide 56 text

@dbrumann [email protected] 55 Thank You! Have a good evening.