Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Persistence in PHP with Doctrine ORM
  • Table Of Contents Toc
Persistence in PHP with Doctrine ORM

Persistence in PHP with Doctrine ORM

By : Kevin Dunglas
5 (5)
close
close
Persistence in PHP with Doctrine ORM

Persistence in PHP with Doctrine ORM

5 (5)
By: Kevin Dunglas

Overview of this book

Doctrine 2 has become the most popular modern persistence system for PHP. It can either be used as a standalone system or can be distributed with Symfony 2, and it also integrates very well with popular frameworks. It allows you to easily retrieve PHP object graphs, provides a powerful object-oriented query language called DQL, a database schema generator tool, and supports database migration. It is efficient, abstracts popular DBMS, and supports PHP 5.3 features. Doctrine is a must-have for modern PHP applications. Persistence in PHP with Doctrine ORM is a practical, hands-on guide that describes the full creation process of a web application powered by Doctrine. Core features of the ORM are explained in depth and illustrated by useful, explicit, and reusable code samples. Persistence in PHP with Doctrine ORM explains everything you need to know to get started with Doctrine in a clear and detailed manner. From installing the ORM through Composer to mastering advanced features such as native queries, this book is a full overview of the power of Doctrine. You will also learn a bunch of mapping annotations, create associations, and generate database schemas from PHP classes. You will also see how to write data fixtures, create custom entity repositories, and issue advanced DQL queries. Finally it will teach you to play with inheritance, write native queries, and use built-in lifecycle events. If you want to use a powerful persistence system for your PHP application, Persistence in PHP with Doctrine ORM is the book you.
Table of Contents (12 chapters)
close
close

Chapter 2. Entities and Mapping Information

In the previous chapter, we discovered the concepts behind Doctrine, we learned how to use Composer to install it, we set up the Doctrine Command Line Tools and we dived into the Entity Manager.

In this chapter, we will cover the following topics:

  • Creating our first entity class

  • Mapping it to its related database table and columns with annotations

  • Using a command helper provided by Doctrine to automatically generate the database schema

  • Creating some fixtures data and dealing with the Entity Manager to display our data in a web user interface

Because we are building a blog, our main entity class will be called Post, as shown in the following figure:

Our Post entity class has the following four properties:

  • id: The unique identifier of the post across the database table (and the blog)

  • title: The post's title

  • body: The post's body

  • publicationDate: The date of publication of the post

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Persistence in PHP with Doctrine ORM
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon