How to create an Active Record style PHP SDK Part 6

Over the last couple of weeks we’ve looked at setting up the foundation of creating an Active Record style PHP SDK. One of the beautiful things about the Active Record pattern is the very intuitive and easy to use interface that is presented to the developer. The Active Record pattern presents entities and their storage […]

Continue reading...

Working with Doctrine 2 Filters

A common requirement you will hear from a business owner or a client is the ability to “filter” results in some sort of way. For example, you probably never want to show spam comments on blogs posts, or you might want to mark certain users as “deleted” without actually having to delete them from the […]

Continue reading...

How to create an Active Record style PHP SDK Part 5

I think it goes without saying that validation is an extremely important aspect of writing high quality applications. Validation enables us to protect the sanity of the data that is allowed across the boundary from the user to the application. Whilst we can all agree that validation is important, where it actually happens is still […]

Continue reading...

Understanding Doctrine 2 Lifecycle Events

A common requirement when building applications is the notion that something must be triggered as a consequence of something else happening within the system. This could be as simply as keeping an updated_at field up-to-date whenever a record in the database is changed, or perhaps sending an email whenever a new user registers for your […]

Continue reading...

How to create an Active Record style PHP SDK Part 4

Last week we started looking at building out the abstract model that will form the foundation of this Active Record style PHP SDK. The models are one of the most important components of the Active Record pattern due to the fact that they hold so much responsibility of the entity you are working with, as […]

Continue reading...

Using Doctrine Query Language

Over the last couple of weeks we’ve looked at Doctrine 2 and how to use it in your PHP projects. Doctrine 2 is an implementation of the Data Mapper pattern and so it allows you to make a clean separation of your application’s business rules from the persistence layer of the database. In this week’s […]

Continue reading...

How to create an Active Record style PHP SDK Part 3

Models are one of the most important aspects of implementing the Active Record pattern. Models in the Active Record pattern inherit the ability to read, create, update and delete from the persistence storage and they also give you access to the properties and relationships of the record you are working with. Models in the Active […]

Continue reading...

Working with relationships in Doctrine 2

Last week we looked at setting up the User entity in Doctrine 2. Entities in Doctrine 2 are different to those in Eloquent in a number of ways. Firstly, they are just plain PHP objects and so they don’t have any responsibility when it comes to how they are stored. Secondly they have annotations that […]

Continue reading...

How to create an Active Record style PHP SDK Part 2

One of the most important characteristics of the Active Record pattern is how the persistence is tightly coupled to the entity. This tight coupling allows you to very easily, create, read, update and delete from the object you are working with. When working with an ORM such as Laravel’s Eloquent, the persistence layer would be […]

Continue reading...

Working with Entities in Doctrine 2

Entities are one of the most important building blocks when building a web application. Entities are objects that have an identity within our applications. So for example a User would be an entity, or a Post would be an entity. In previous tutorials we would create an Eloquent model to represent an entity. An Active […]

Continue reading...

Supported by