Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pehapkari.cz:
Domain-Driven Design - Alternative Relational Database Mapping
Mar 21, 2018 @ 15:37:16

The Pehapkari.cz blog has continued their series covering domain-driven design with the latest post in the series showing some alternative relational database mapping techniques.

Do you think that multilingual text must always be in a separate database table? Than this article is for you!

We will show that not all arrays have to be mapped as database tables. And we will also show the Doctrine implementation.

The article starts with a bit of background on what they're trying to accomplish: adding internationalization functionality to an e-commerce application. In order to make it simpler to work with the multi-language requirements they show the abstraction of its handling out into a LangValue value object that's used to store the product name value for each language. They then use this and some JSON encoded data to store the different language strings in the database directly with the product record rather than a different table. It then shows how to create the matching Doctrine entity for the LangValueType to work with the serialized column data and extract data from it's JSON blob.

tagged: domaindrivendesign series part4 relational database mapping internationalization doctrine

Link: https://pehapkari.cz/blog/2018/03/21/domain-driven-design-alternative-mapping/

Coding Geek:
How does a relational database work
Aug 19, 2015 @ 14:49:41

You may have been using relational databases in your PHP applications for a long time (PHP loves MySQL after all) but you might not have ever dug deep enough to understand how those databases work internally. In this detailed tutorial from Coding Geek they dive way in and cover everything from the basics out to complex sorting, management components and query handling.

When it comes to relational databases, I can’t help thinking that something is missing. They’re used everywhere. [...] you can google by yourself “how does a relational database work” to see how few results there are. [...] Are relational databases too old and too boring to be explained outside of university courses, research papers and books?

As a developer, I HATE using something I don’t understand. And, if databases have been used for 40 years, there must be a reason. [...] Over the years, I’ve spent hundreds of hours to really understand these weird black boxes I use every day. Relational Databases are very interesting because they’re based on useful and reusable concepts. If understanding a database interests you but you’ve never had the time or the will to dig into this wide subject, you should like this article.

He covers a wide range of topics during the post:

  • O(1)) vs O(n2) (or how data sets are handled based on size)
  • Array, Tree and Hash table
  • Global overview (structure of the database system and its pieces)
  • Query manager
  • Statistics (and optimizing storage of the data)
  • Data manager
  • Deadlock
  • Logging

Each of these topics comes with a lot of explanation, examples of how the internals are functioning as well as diagrams to help make a bit more sense. If you've ever really wanted to know how that database you use functions, this is definitely the article to check out.

tagged: relational database indepth concepts lowlevel highlevel query optimization transaction buffer

Link: http://coding-geek.com/how-databases-work/

NetTuts.com:
Relational Databases for Dummies
Mar 14, 2013 @ 15:43:13

If you're relatively new to PHP development or have just meaning to get into using relational databases with your application, you should check out this new post from NetTuts giving a "for dummies" approach to learning about RDBMSes.

Web apps can be split into two major components: a front-end that displays and collects information, and a back-end for storing the information. In this article, I’ll demonstrate what a relational database is, and how to properly design your database to store your app’s information.

They describe the usage of a database in several steps (no code is included, just SQL at the end):

  • Get Some Data
  • Remove Repetitive Data Across Columns
  • Remove Repetitive Data Across Rows
  • Linking Tables with Keys

This is followed by links to a few of the different RDBMSes out there and a brief introduction to what SQL is and what it looks like.

tagged: relational databases introduction tutorial

Link:

Web & PHP Magazine:
Issue #12 - Don't Get in a PECL
Mar 08, 2013 @ 16:23:36

The latest issue of the Web and PHP Magazine has been published - issue #12, "Don't get in a PECL". This latest issue includes articles like:

  • "The Power of PECL" by Simon Holywell
  • "Be 'ready' if you want to be done!" by Steffan Surdek
  • "All Data is Relational" by Cory Isaacson
  • "Fixing PHP Production Problems with APM" by Dan Delany and Chris Kelly
  • "Trust" by Sebastian Bergmann

You can download your copy for free from their site and catch up on back issues.

tagged: webandphpmagazine issue pecl recursion relational data websockets

Link:

DevShed:
Building an ORM in PHP: Domain Modeling
Nov 22, 2011 @ 22:46:10

Continuing on from the first part of their series, DevShed has posted part two of their "Building an ORM in PHP" series. This latest tutorial focuses on domain modeling (and collection handling).

In that first part, I implemented the ORM’s data access and mapping layers. And as you’ll surely recall, the entire implementation process was pretty straightforward and easy to follow. Of course, in its current state the ORM is still far from a fully-functional structure. We need to add some additional components to it, such as a domain model and the classes responsible for handling collections of entities (remember that the ORM relies heavily on the data mapper pattern to do its business properly).

He stays with his "simple blog" example and shows domain models (based on an abstract entity) for Entries, Comments and Authors. His containers extend the Countable, IteratorAggregate and ArrayAccess interfaces to give them some extra abilities.

tagged: tutorial domain model orm database mapping relational

Link:

Developer.com:
Doctrine: Object Relational Mapping for Your PHP Development
Jun 14, 2010 @ 15:22:06

New on Developer.com today there's a new article looking at one of the more powerful ORM tools available for PHP - Doctrine.

Because of the relational database's pivotal role in driving Web applications, a great deal of time and effort has been put into creating tools that not only simplify the task of mapping database tables to a programming language's object-oriented class structure, but also facilitate the management of your data and schemas over the project lifecycle. [...] The PHP community also has a powerful database integration tool at their disposal: a project known as Doctrine.

They help you get started with this powerful tool by showing you how to get it installed, create a sample schema and loading some fixtures (base data). There's also a quick snippet of code showing you how to grab information from a sample user table and display the name of the user.

tagged: doctrine object relational map orm tutorial

Link:

Doctrine Blog:
Doctrine 1.0.8 and 1.1.0-RC2 Released
Mar 03, 2009 @ 16:24:36

Guilherme Blanco passed along a note about the latest releases from the Doctrine project, Doctrine 1.0.8 and 1.1.0-RC2:

Today I am happy to tell you that we have two new versions of Doctrine available for you to use. The first is the monthly maintenance release for Doctrine 1.0 and the second is another release candidate for the newest major version of Doctrine, 1.1. As always you can grab them from the downloads page.

Updates in these two versions include a few backported fixes from 1.1, updates to the Doctrine_Query::count() method for optimization, and several fixes in the Release Candidate in preparation for the next release. You can see the full Changelogs here: 1.0.8 and 1.1.0-RC2.

tagged: doctrine release maintenance orm object relational mapper layer

Link:

Seastian Bergmann's Blog:
Object-Relational Behavioral Patterns
Feb 16, 2009 @ 18:08:47

Seastian Bergmann has added some new features to the Object_Freezer library (you can read more about it here) - some new object-relational behavioral patterns.

The three patterns are from Martin Fowler's Patterns of Enterprise Application Architecture book:

  • Unit of Work - maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.
  • Identity Map - each object gets loaded only once by keeping every loaded object in a map
  • Lazy Load - object that doesn't contain all of the data you need but knows how to get it.
tagged: object freezer object relational patterns martinfowler pattern

Link:

PHPClasses.org:
PHP Object-Relational Mapping: ORM or ROM?
Oct 10, 2008 @ 17:09:37

On the PHPClasses.org blog today Manuel Lemos has posted a look at ORM - what it is and how you can use it to improve your applications.

Object-Relational Mapping, usually referred as ORM, is a software development approach to treat data stored in relational (SQL) database table records as if they were objects. Basically we can create classes with variables that represent fields of a database table. To insert a table record you need to create an object of the class, assign the variable values, and call a function of the class that takes care of inserting the table record

He illustrates what it is (brief code samples) and some of the approaches that developers have taken to implementing it. He suggests, however, that they should truely be called ROM (Relational Object Mapping) libraries rather than ORM due to the fact that they map an object (the database tables) back in to PHP objects. He finishes with a list of a few ORM resources and libraries including the one that helps power the PHPClasses website, Metastorage.

tagged: phpclasses orm object relational mapping database layer

Link:

Developer Tutorials Blog:
Getting Started with ORM in PHP
Jul 16, 2008 @ 14:35:27

A recent post on the Developer Tutorials blog takes a look at a fundamental part of several of the PHP (and other language) frameworks out there - the Object Relational Mapping (ORM) layer for database access.

Instead of direct database access, an ORM layer in a PHP framework can make "objects" stored in a database behave like actual objects from a programming perspective - for example, creating a new "car" stored in the database could involve a call to $car->new(). By abstracting actual database access, web development can be more productive and result in more reliable applications. Here's a quick intro to ORM in PHP.

They talk about ORM's role in how applications interface with data (abstracted out to objects) and some examples of it in current frameworks - CakePHP and Symfony.

tagged: orm object relational mapping cakephp framework symfony

Link:


Trending Topics: