Despite it’s short-comings, Parse.com is a very good cloud database solution for light-weight applications and even prototyping. Parse.com makes it easily for you to reference data from other table using Pointers (similar to joining in SQL) and lets you secure data using ACL on a row-by-row basis. One of the most common question I get with Parse is how to use Pointers and ACL – this tutorial answers both.
Pointers and DataTypes in PHP
If you’re using the Parse.com PHP SDK, using pointers is easy thanks to the
dataType function. The
dataType provides support for the various data-types supported by Parse, including date, pointers, bytes and geopoint. Creating a pointer to another table can be achieved like this:
The above example also include how to set ACL permissions. In the above code, we only allow read access to the User it belongs to. Public read access is disabled, and no one is allowed to write data.
PHP DataType Examples
Here is an example of the various dataTypes the PHP SDK supports (note that there are a few more dataTypes that are supported):
PHP ACL Examples
You can give read / write access to public (logged or anonymous) users, as well as specific users. There are several functions available to set read / write access, as shown in the code below:
Have any questions, or stuck with data types or ACL? Tell us in the comments section below.