Jump to ratings and reviews
Rate this book

Persistence in PHP with Doctrine ORM

Rate this book
This book is designed for PHP developers and architects who want to modernize their skills through better understanding of Persistence and ORM. You'll learn through explanations and code samples, all tied to the full development of a web application. Overview In Detail 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 the 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 the 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 the Doctrine ORM is the book you. What you will learn from this book Approach Persistence in PHP with the Doctrine ORM is a concise, fast, and focused guide to build a blog engine with advanced features such as native queries and lifecycle callbacks. Who this book is written for This book is primarily intended for PHP developers and architects who want to increase their skills in the field of Persistence and ORM to map the data they are working on to objects they are using in programming. Basic knowledge of databases and PDO and working knowledge of PHP namespaces is a prerequisite.

114 pages, Paperback

First published January 1, 2013

4 people are currently reading
8 people want to read

About the author

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
2 (11%)
4 stars
7 (38%)
3 stars
7 (38%)
2 stars
1 (5%)
1 star
1 (5%)
Displaying 1 - 4 of 4 reviews
Profile Image for Arthur.
97 reviews6 followers
February 16, 2014
In short, Persistence in PHP with Doctrine ORM is a book about harnessing the power of Doctrine ORM, but also:

Will let you build a working project using Doctrine involving advanced techniques;
Will guard you from doing mistakes early in your getting known Doctrine, and
Will advocate on appropriate technologies to use in addition in case your next creation is going to see the world.
I would recommend this book to a developer who worked with PHP already, but getting ready to embark onto a more intensive data processing endeavor.

The book is not terribly long, yet comprehensive enough to allow a person to become proficient in Doctrine say overnight (yes, my Kindle app estimated my reading speed at ~ 2.5 Hrs, that is without me experimenting with code). Personally, I value concise books because they give me a push and allow a relatively comfortable solo sailing with an occasional exploration of a topic I did not encounter learning but stumbled upon doing real-life work.

As an aside, use of an ORM (not just Doctrine specifically) is typically being perceived as a negative phenomenon by the data people (disclaimer: I am the data person), unsurprisingly Kevin mentions performance implications under the so called Big Data scenario. This has it’s grounds, I agree, as for example tuning DML or data retrieval, so let’s not argue here, but at least one aspect on an ORM not possible to beat – is its ability to allow seamless transition from one database platform to another, relatively uncommon in the past, seems to being picking up nowadays. But do not be overly optimistic, no migration is ever smooth, it just alleviates some of the pains and minimizes the costs of engineering and maintaining your software.

On the not so bright side the author does not cover executing stored procedures/packages, and apparently Doctrine (as most OSS projects) has a long list of defects, yeah, I can hear you, this is a book review, nothing else, ditto.

So one last interesting discovery, the Doctrine community focuses more and more on a NoSQL, Mongo in particular, which is thrilling.

You will find information in the book on how to build your own SQL, implement association, inheritance and even a not so often used many-to-many relationships.

On the odd note, I saw a circular reference created in one of the book examples, while possible it is very dangerous! Also the book covers only one approach: building your app code-first: meaning the database schema is created after a class, which I (you know who am I Smile) don’t endorse, alas I am / was new to Doctrine.

I suggest Kevin adds to ver. 2.0 of this book the following:

Building an application the schema-up way, too, and
Provide an example where Doctrine is using a Mongo database.
I give this book a 5 out of 5 rating because it has achieve its objectives, however it seems that Packt could give it the “Instant” moniker due to its material coverage.
15 reviews
Read
February 23, 2014
This book explain about Doctrine ORM, which is one of ORM libraries in PHP. As another PacktPub’s books, this book is a technical book with some basic concept. It starts from the basic concept of ORM and how to use Doctrine ORM. And then, in the 2nd chapter, you’ll know how to make a simple blog website with ORM. Building entities, generating getters and setters will be covered in this chapter. It starts from a simple entities with no relationship.

In the next chapter, you’ll learn about relationship in ORM. How to relate an object with another like we usually do in database. And the main thing in this book is covered in the 4th chapter, which is query. ORM without query is useless. With the query explained in this chapter, you wouldn’t use SQL in your web applications again. Although, some basic concept in SQL is also used in ORM’s query.

The last chapter talked about advanced features in Doctrine, such as object inheritance, events, and native queries (just in case you need SQL). This book is an example-based book. Which means you’ll find many example code inside the book. And some of them, wouldn’t be used in a real world applications. You have to – at least – modify it to fulfill your needs. Some basic understanding of PHP, web programming, database, and software engineering diagram are needed to easily understand this book. Especially basic object oriented programming in PHP.

Overall, this is a good book. It’s a simple, example-based, technical book. It’s really suitable for a quick start guide to learn Doctrine ORM in PHP. Though it didn’t tell me how to use Doctrine ORM with popular PHP framework like CodeIgniter or Yii.
Profile Image for Michael Sypes.
223 reviews1 follower
May 18, 2017
Good overview of many of the basics, and some exploration of more advanced topics, using an example application. I've been learning about Doctrine from playing with Symfony for a while an this book did help clear up a few confusing things for me.
Profile Image for Logan.
9 reviews
January 4, 2016
There's not much more to this book than what's in the project's documentation. It's presented in a better(quick start) format and will get you up and running in a short amount of time.
Displaying 1 - 4 of 4 reviews

Can't find what you're looking for?

Get help and learn more about the design.