Persistence in PHP with Doctrine ORM
eBook - ePub

Persistence in PHP with Doctrine ORM

  1. 117 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Persistence in PHP with Doctrine ORM

Book details
Book preview
Table of contents
Citations

About This Book

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 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.

Approach

Persistence in PHP with 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 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.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Persistence in PHP with Doctrine ORM by Kevin Dunglas in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in PHP. We have over one million books available in our catalogue for you to explore.

Information

Year
2013
ISBN
9781782164104
Edition
1

Persistence in PHP with Doctrine ORM


Table of Contents

Persistence in PHP with Doctrine ORM
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Doctrine 2
Prerequisites
Understanding the concepts behind Doctrine
Creating a project structure
Installing Composer
Installing Doctrine
Bootstrapping the app
Using Doctrine's Entity Manager
Configuring Doctrine command-line tools
Summary
2. Entities and Mapping Information
Creating the Entity class
Generating getters and setters
Mapping with Doctrine annotations
Knowing about the @Entity annotation
Understanding the @Table, @Index, and @UniqueConstraint annotations
Diving into the @Column annotation
Knowing about the @Id and @GeneratedValue annotations
Using other annotations
Understanding Doctrine Mapping Types
Creating the database schema
Installing Data fixtures
Creating a simple UI
Listing posts
Creating and editing posts
Deleting posts
Summary
3. Associations
Getting started with the Doctrine associations
Understanding the @ManyToOne and @OneToMany annotations with the comment system
Creating the Comment entity class (owning side)
Adding the inverse side to the Post entity class
Updating the database schema
Adding fixtures for the comments
Listing and creating comments
Updating the index
Understanding the @ManyToMany annotation with tags
Creating the Tag entity class (inverse side)
Updating the Post entity class (owning side)
Updating the schema again
Creating tag fixtures
Managing the tags of a post
Summary
4. Building Queries
Understanding DQL
Using the entity repositories
Creating custom entity repositories
Getting started with Query Builder
Filtering by tag
Counting comments
Summary
5. Going Further
Implementing inheritance
Using Mapped Superclasses
Using Single Table Inheritance
Using Class Table Inheritance
Getting started with events
Lifecycle callbacks
Knowing about event listeners and event subscribers
Writing native queries
The NativeQuery class
Doctrine DBAL
Summary
Index

Persistence in PHP with Doctrine ORM

Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2013
Production Reference: 1111213
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78216-410-4
www.packtpub.com
Cover Image by Gagandeep Sharma ()

Credits

Author
KĂ©vin Dunglas
Reviewers
Kirill Chebunin
Stefan Kleff
Adam Prager
Chris Woodford
Acquisition Editor
Harsha Bharwani
Lead Technical Editor
Vaibhav Pawar
Technical Editors
Nadeem N. Bagban
Venu Manthena
Sebastian Rodrigues
Copy Editors
Alisha Aranha
Sarang Chari
Deepa Nambiar
Gladson Monteiro
Shambhavi Pai
Kirti Pai
Project Coordinator
Ankita Goenka
Proofreader
Bernadette Watkins
Indexer
Tejal Daruwale
Graphics
Sheetal Aute
Abhinash Sahu
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta

About the Author

Kévin Dunglas is the co-founder and CEO of La Coopérative des Tilleuls, a French IT company specializing in e-commerce, owned and managed by its workers themselves. He is also a software architect who works for a lot of companies, including Ubisoft and SensioLabs (creator of Symfony), as an external contractor. He contributes to open source software (especially Symfony, JavaScript, and Ubuntu ecosystems) and has been writing a technical blog for more than 10 years.

About the Reviewers

Kirill Chebunin is a software engineer specializing in server-side web development. His main interests lie in the field of systems with complex background logic. He has been working as the head of a PHP development department, building different enterprises, and billing and analytics systems for the last two years. But his real passion is for open source projects and their communities. Kirill's talks can be found in Russian and Ukrainian PHP conferences, and his commits are presented in Composer, Doctrine, and Symfony projects. You can always see his current interests at Github (https://github.com/chebba) and SlideShare (http://www.slideshare.net/chebba).
Stefan Kleff has been developing web applications for over 12 years at various positions in various companies. He holds degrees from the University of Appli...

Table of contents

  1. Persistence in PHP with Doctrine ORM