Web developer skills, tools, frameworks, do I really need to know all this stuff?

When I first started in web development I started by learning PHP along with HTML, CSS and Javascript to create the UI of web software system I was building.

After a couple of years I decided to start using a web framework to make my development of web based software less time consuming.

It was around this time period that I was of the opinion that I needed to study whatever skills I was learning to point of mastery.

Of course although most skills where learned in depth learning any skill to point of mastery is ongoing.

Below is a diagram showing my opinion on learning new skills …

It is my belief that the bulk of the learning is done at the very beginning with only minor gains being made after that.

The minor gains would be the ins and out of the skill and the areas of the skill that will not be used on a day to day basis.

Some of the minor areas would include areas of the framework that do not work as expected and you have to spend a little time figuring out how to do it using the framework itself.

Most of the areas of the skill that are going to be used daily are within the “front peak” area of the diagram.

The diagram is ongoing and the right area of the chart is always expanding, this represents the ongoing updates to the skills you would need to learn to say you are “up to date” with the skills.

Although this area would most likely not include the “front peak” again it is still ongoing never-the-less.

So going back to what I was saying I use to believe that I had to take my learning all the way to the end of the chart and going further that I had to have some commercial viable projects that I have built using the said skill.

Only after doing the above could I say that I had the “skill”.

Looking on the job boards today I can see that lots of employers are asking for enormous amounts of different skills.

Why would a company need all of the these skills they are listing from both 1 employee and every employee within the company?

I am not going to harken back to the “good old days” but I am reasonably sure that these skills use to be more spreadout over different employees.

The skills being listed are skills needed in multiple roles meaning each and every employee is wearing many hats rather than 1 employee being this and 1 employee being that.

Some of the skills are totally unrelatable such as needing to know 4 programming languages (core skills) and various frameworks and tools related to each of those 4 languages. Or listing graphic design skills along with UI programming skills.

If you go to University you go there to learn “web development” or “graphic design”. So are these companies telling me I need a degree in “web development” and “graphic design”? How long would you need to learn at University to do that? Around 6 years, 3 years for each course and that is the tip of the iceberg.

This gives the impression that these companies cannot possibly be serious but in some cases you actually find that they are serious.

How can anyone learn this number of skills to the point of mastery or even in depth?

Not all of the skills listed on these job descriptions take an equal amount of time to learn. Some of the skills could take as little as a couple of hours whilst some can take as long as year.

To some of the companies there is no differentiation between these, either you have the skill or you have not got the skill.

I have seen job descriptions listing “plugins” as needed or desired skills. Plugins should not even be listed as skills, plugins are just modules that can be used by the core language or framework.

Most programmers do not even look at plugins as requiring any learning they just import the plugin and get stuck in. The degree of learning for a plugin is so minimal that it is hardly worth mentioning let alone listing as a required or desired skill.

Admittedly because some employers are asking for plugins as a skill I have started listing plugins I have used in my skill set. Last year I was not doing this though.

Here is my experience on how long certain skills should take to learn from scratch, when I say “learn” I mean to get over the big spike on the chart above, of course you can continue learning additional parts after the big spike and the learning can be on going but I am just talking about learning something enough to be useful enough to produce something …

Core skills – Java, PHP, C#, Javascript, SQL etc – 6 months
Frameworks – Laravel, Yii / Yii 2, Symphony – 1 month
Mini frameworks – Express, Lumen, NodeJS, React – 2 weeks
Plugins – anywhere from a couple of hours to a couple of days

As you can see it is only the “Core skills” that in my opinion take a long time to learn, after the “Core skills” the time to learn the other areas such as “Frameworks”, “Mini frameworks”, “Plugins” decreases dramatically.

Potential employees are being rejected on the grounds of them not having the certain skills listed above.

The potential said employee is going to be with the company for years and is being rejected on the grounds of not having a skill that would take 2 weeks to 1 month to come up to speed on?

It is not that the employee even has to take 2 weeks to 1 month to learn the skills on company time, the employee can still be productive whilst learning the skills. An employee can start on the company work and learn the skill as he / she goes along.

No big deal in my opinion.

Sometimes a company will claim they rejected you because they did not think you could “hit the ground running”.

If challenged on why the said companies thinks you will not be able to “hit the ground running” you will get a list of supposed “technical incompetencies”.

This list was most likely not produced at the time but the hiring manager went by his or her “gut feel”. Now that you have challenged it the hiring manager will produce a list of your “technical incompetencies”.

This can seem very daunting but what most people do not realise is that coming up with a list of someone elses “technical incompetencies” is the easiest thing in the world to do.

Everyone has some incompetencies that can be focused on, the problem is you do not get to see the hiring managers or any of the other employees incompetencies within the said company, so it gives the impression that only yourself is incompetent.

What you will also find is that the “technical incompetencies” are of a trivial nature or are not really incompetencies at all.

As an unrelated example, hiring manage preferred the red colour over the blue colour but never specified that in the requirements and will now not hire you because you did it in the blue colour.

Hiring preferred “this” way of coding over “that” coding but never specified that and will not hire you for that reason.

An example could be “Type Hinting”, a number of years ago it was not possible to use “Type Hinting” in PHP so in your “technical test” you may write a method as follows …

Rather than using “Type Hinting” like this …

Some of my personal PHP projects I work on do not use “Type Hinting”, a lot of PHP web software projects have no “Type Hinting” in them.

However this is exactly the sort of area the hiring manager would bring up as a “technical incompetence”.

In my projects where I have used “Type Hinting” it was no big deal to start using it. It did not take me any extra time to start using it and it was not difficult to start using it.

It was not a “technical incompetence” it was something I just did not do out of choice and personal preference.

Like I say to start using it was no big deal and certainly not something that warrants rejecting a potential job applicant on.

Job application test …

Coded a small web app without using Type Hinting – “We do not think you can hit the ground running”

Applicant …

Hears the answer and is disappointed he did not get the job. Decides to implement Type Hinting into the small web app he just made for the interview just to see how long it would take, took him 15 minutes to implement.

15 minutes to implement! This could have been done on his morning break, all it would have required is for someone to tell him to start using Type Hinting. Hardly a deal breaker given that the said applicant would have been at the company at number of years.

Next job potential job.

Employer business …

“Yes we need HTML, CSS, PHP, Laravel, NodeJS, Express”

Applicant …

“Fantastic I have all these skills.”

Employer business …

“Ohh actually we also need React” – “We do not think you can hit the ground running”

Applicant …

Decides to learn React on his own time to see how long it would take. Gets over the learning curve in 2 weeks. Again hardly a deal breaker given that the applicant would have been at the company a number of years.

Of course there will be people out there thinking “Well if you are that bothered, why do you not just learn React and then apply for the said jobs”.

This would be OK provided there was not different combinations of skills that need to be learned, one company wants one thing one company wants another thing.

One company wants Symphony one company wants Laravel, one company wants AngularJS one company wants React.

These types of skills are parallel to each other, if you learn one it is not worth learning the other because they are both designed to accomplish the same goal.

This means you basically have to learn parallel skills just to get a job in a specific type of company.

So lets start putting it to the businesses …

I am an applicant and I have the following skills …

HTML, CSS, JQuery, PHP, MySQL, Laravel.

Everything I need to build a perfect fully function web based software system.

Company does not want these skills but they want something similar to this …

HTML, CSS, MongoDB, NodeJS, Express, AngularJS, PHP

Basically this is about the stack of technologies, give or take, the first set of skills is the traditional LAMP stack of skills the latter is the MEAN stack of skills.

Applicant …

“So employer business what made you decide to use the MEAN stack of technologies over the more traditional LAMP stack of technologies?”

Employer business …

“We decided to use the MEAN stack of technologies because with the emergence of NodeJS we can now compile Javascript and this makes the software system more faster and efficient over the traditional LAMP stack of technologies”

The above is a typical text book answer, the above sentence could have been taken straight from the NodeJS website itself. The real reason is because the MEAN stack is the latest web development fad.

Lets carry on …

Applicant …

“So what types of web based software systems do you build?”

Employer business …

“We build a range of web software systems for our clients such as custom CRMs, Online Stores, Project management tools, Workflow tools”

In other words nothing that would be required to be “ultra” fast and efficient. Nothing that is really scientific and cutting edge. Nothing that would require the latest advancements in processing power. Nothing that could not be built using the traditional LAMP stack and be almost as fast and efficient.

When the term fast and efficient is being used remember it has a context, the gain made will most likely be in the form of milli-seconds.

This may be useful in some areas but for your general business tools such as what businesses need and what most web based software system companies are providing the extra 0.001 milli-second gain per page load is generally not going to matter.

But lets say that all these areas matter, the extra 0.001 milli-second gain per page load matter, lets carry on …

Applicant …

“So you mentioned you aim for speed and efficiency in the web based software systems you use. Why then did you not use Java over NodeJS as Java has been around longer, is tried / tested and is more faster and efficient than NodeJS?”

Most likely you will not get a real answer.

The point is there are tools and languages for the scientific world, there are tools and languages for the speed and efficiency world.

These tools and languages have been around for years and are better at their “niches” than NodeJS. So why was NodeJS chosen if “speed and efficiency” was the goal?

The companies that are really scientific and cutting edge do not expect their “scientists” to “hit the ground running”. It is recognised that the said subject will require research and development.

Breaking into something that is truely scientific and cutting edge is not something a “timescale” can be given to. If nobody has done it before how can anyone know the “timescale”?

Having said all of this I have started to learn new skills such as NodeJS and the rest. I am finding it super enjoyable and it is giving me the same feeling of enjoyment I had when I first started programming.

It is just a bit of a bother that employers are not willing to take a chance on a potential employee and train them up as they go along especially when the employee will be with the company for a large period of time.

So to answer the question of this post, yes it is important to learn as many of these skills as you possibly can even if you do not take all of the skills to the level of mastery.

Some companies will let you learn the skills as you go other companies will expect you to “hit the running”.

Chopping database records

I have been working on a project recently for a client which required the user to insert a record into an existing set of records and to modify those existing records to accomodate the new record.

The above diagrams shows what needed to be accomplished. If you imagine from left to right is time on the diagram, each record has a start date and and end date and the new record is needing to be inserted between those start dates and end dates.

The start and end dates can overlap the start and end dates of the new record and this is where the existing need to be chopped and modified to accomodate the new record.

So how did I go about this?

Firstly I decided to bucket the existing records into categories as follows …

And like …

This gives us four actual categories and a fifth “Ignore” category. The four actual categories are LeftRight, Middle, Left, Right. Some more examples are shown below …

The bucketing of the existing records into categories from a coding perspective is accomplished as follows …

Firstly I selected the existing records, pseudo code shown below …

dateStart = new record start date
dateEnd = new record end date
dbDateStart = existing record start date
dbDateEnd = existing record end date

Other columns could be added to this selection code if needed, in some cases a “user_id” or other foreign key could be potentially needed.

Using the above selection code will select all the existing records that exist within the range of the new record start and end dates. In other words the records that fall into the “Ignore” category will not be selected.

This is why the “Ignore” category is not a real category as the records are never selected and thus do not need to be bucketed.

Now I have selected my records from the database I put the records into a loop. Whilst in this loop I bucket the records into a set of arrays using the following conditions …

LeftRight …

Middle …

Left …

Right …

Now that the records have been bucketed into the arrays I loop through each group and process the groups seperately as follows …

new record = the new record you are wanting to insert into the DB via displacing the current records
original records = the record in the LeftRight bucket that has not been cloned

LeftRight …

I take a clone of the record and I modify the original (none cloned) records date end to be the new record date start -1 day this is then saved. I then take the clone and set the date start to be the newly inserted records date end +1 day this is then saved.

Middle …

Any middle records are deleted.

Left …

I modify the records date end to be the newly inserted records date start -1 day this is then saved.

Right …

I modify the records date start to be the newly inserted records date end +1 day this is then saved.

After all of the bucketed records have been processed there should now be room to insert the new record so I insert / save the new record.

So that concludes how I created a system that would allow a new record to be inserted whilst chopping the existing records to accomodate the new records.

Internal system – Toolkit

I have been using a web based product called ActiveCollab for sometime now …


I have been using ActiveCollab since version 4. When ActiveCollab 5 was introduced it had a complete redesign, less features and a more slick user interface.

More features have been introduced to ActiveCollab 5 though since it was first released.

ActiveCollab is a project management system that also handles Time Tracking and Invoicing plus more.

I will continue using ActiveCollab for projects / task management however for other areas of my business I have created my own internal tool which I have named “Toolkit”.

I built my own system because I wanted a system that would do the following …

Estimate earnings
Fixed fee and retainer projects are entered into the Toolkit. The Toolkit can then estimate monthly and yearly earnings based on the projects entered. The projects also includes a way for me to manage all the projects I am working on.

The Toolkit has an area in which all incomings can be entered. The incomings can then be exported in a format appropriate for my accountant.

The Toolkit has an area in which all outgoings can be entered. The outgoings can then be exported in a format appropriate for my accountant.

The Toolkit has an area in which all mileages can be entered. The mileages can then be exported in a format appropriate for my accountant.

The Toolkit has an area in which leads can be managed. I actually pulled this area out of the Neptune – Lead Tracker – http://www.neptuneleadtracker.com software system.

The Toolkit includes an area in which all the companies and people I have worked for can be managed. ActiveCollab does actually include this feature but the Toolkit version allows more advanced search features and has fields on the create / update forms to match my exact needs.

The Toolkit includes an area in which all time entries can be tracked. ActiveCollab does have this feature.

The Toolkit includes an area in which invoices can be created. Invoices can also be generated from time entries. ActiveCollab does include this feature but the Toolkit version matches my exact needs precisely.

The Toolkit includes an area to keep notes. ActiveCollab does include this feature.

The Toolkit includes an area to upload files. ActiveCollab does include this feature.

ActiveCollab has a more slick, beautiful user interface but in terms of functionality built specifically for myself obviously the Toolkit wins.

The Toolkit is primarily made up of CRUD screens, no fancy UI / Ajax heavy screens here. Just datagrids and buttons.

I am in the process of live testing the Toolkit I have built and will be moving various functions of my business over to the Toolkit.

Yii / Yii2 checking controller params at the access control level

One of the areas I notice in a lot of Yii / Yii 2 web applications is the checking of parameter variables in what I consider the wrong areas.

Here is an example of one of my controller methods for saving a Book …

So what stands out about this method? No load Model method? No checking to see whether the Book has a valid ID? How will we know whether the Book has a valid ID, how will we know whether the Book is suppose to be accessed by the particular user that is logged into the system?

The answer is, the access rules and bizrules of the web software application. All controller methods should be assigned to an access rule. If the controller method contains parameters then the controller method should be assigned to an access rule as well as a bizrule.

For smaller / less complex applications you can actually emulate the bizrule by using “matchCallback” which is spoken about in this article I wrote previously …


You can also read my previous article on what I think of the Yii / Yii2 load Model method …


All controller parameters should be checked and validated in the bizrule, by the time the parameter reaches the controller method there should no need to have any checking in the controller method at all for the controller parameters.

If the Book does not exist or the Book is not accessible by the current logged in user then that will be handled before any controller method code gets executed in the first place.

There is no reason to have this level of checking in the controller method itself. Doing it the way I have described also keeps the controller more clean as extra code is not needed to check the controller parameters.

Solution for using DatePickers on forms in Yii2

Sometimes in web software applications we need to collect dates such as a start date or end date using forms. In this article I will be using the Kartik DatePicker widget which can be found here …


For the purposes of this article a master Model will need to be created. I discussed how to create master Models and Controllers in the following article …

Create a master Model and Controller in Yii2

So based on the master Model now being created the article can continue. Add the field to the form using code similar to this. Include the plugin in the form …

Add the field to the form …

In the master Model 2 methods needed to be created …

And …

These methods can be called to save the “date” data to the database from any of the child Models. The best place to call the methods would be in the “beforeSave” and “afterFind” methods as follows …

And …

Depending on how you have setup the validations for the “date” attribute you may need to run the “saveDateFormat” and “dateFormat” methods in the “beforeValidate” and “afterValidate” methods as well as the “beforeSave” and “afterFind”.

This depends on whether your validations are formatting the date as the date would be saved to the database or validating against the format the date appears on the form.

If your validations validate against the format the date saves to the database then calling “saveDateFormat” and “dateFormat” methods in the “beforeValidate” and “afterValidate” methods will not be needed.

I generally setup my validations so I do not need to run the “saveDateFormat” and “dateFormat” methods in the “beforeValidate” and “afterValidate” methods only through the “beforeSave” and “afterFind” methods.

Using the above code you can implement multiple datepickers on the same form or across different forms. Follow the same logic, add the field or fields to the form and call the “saveDateFormat” and “dateFormat” methods from the child Model.

Yii 2 User Permission using matchCallback

As a web software developer I sometimes need to implement some kind of user permissions in the web applications that I build. The Yii 2 framework which I currently use has a built in system for doing just this however for applications that need a more lightweight user permission system the Yii 2 framework has introduced a method which was not available in the Yii 1 framework that can be used to easily build lightweight user permissions and that method is “matchCallback”.

Both Yii 1 and Yii 2 have a user permissions system named RBAC. In Yii 1 RBAC is implemented by writing code to define the user permissions, this code then populates the database tables with the user permissions. The user permissions are then applied to controller methods via more code known as access rules.

User permissions can also have what is known as a “bizRule”, a “bizRule” is an additional piece of code executed with the user permission that needs to evaluate to true in order for the user permission to be true. This can be used to implement checks to see if the record being displayed on the page is owned by the user trying to access the page as well as various other checks. The “bizRule” code is stored in the database along with the user permission.

One of the differences between the Yii 2 implementation of RBAC and the Yii 1 version is that the Yii 2 “bizRule” code is stored in code files and not the database. This makes more sense to me as the “bizRule” code is kept alongside the other code in the frameworks, models, controllers, views etc.

Infact it makes so much sense that during the later stages of using the Yii 1 framework I actually just stored class / function references in the “bizRule” code and wrote my real “bizRule” alongside the rest of framework code. Essentially implementing my own version of what Yii 2 covers as standard.

As mentioned above Yii 2 now implements a method called “matchCallback”. This means for web applications requiring simple user permissions RBAC is not needed as the “matchCallback” can be used to define the “bizRule” directly in the access rules …

So as shown above for web applications only requiring simple user permissions, the access rules are all that are needed.

array_map plus other possibilities

When building web applications certain patterns appear in our code. A pattern that use to appear in my code quite regularly is shown in the example below …

Essentially we have an array of data and we want to create a new array out of only part of the original data. The above code can be abstracted using the PHP array_map function as shown in the example below …

PHP includes a number of these functions within its library. PHP also gives you the ability to create your own. The above array_map function can be created in PHP as follows …

Using code similar to the above is also the key to implementing iteration functions on collections allowing you to write code as such …

Or filtering …

The possibilities this opens are numerous. If you would like to know more about writing code similar to the above then I can recommend the following book …


Refactoring to Collections – The Definitive Guide to Curing the Common Loop by Adam Wathan

Select2 library solution in Yii2 part 4 – retrieving the data

To continue on from the previous article I wrote about saving the Select2 data …


I will now talk about how to the retrieve the stored Select2 data so that the data can be displayed on the front-end Select2 field. Following on from the Task / Countries example, place the following “loadSelect2Items” method inside the Master model or Task model if you did not create a Master model …

The code above can be explained as follows …

  1. Line 3 – return the array of Select2 data using the “array_map” function
  2. Line 4 – store the related entity models name into a variable, in this case that would be the Country models name. This uses the Country relationship that was created in “Part 2” of this article series
  3. Line 5 – store the IDs of the related relationship entity model in the return data, in this case that would be the IDs of the Country model records
  4. Line 6 – find all the records for the model / model property in the “select2_data” table, in this case that would be the Task model and “countries” property

The next step is use the “loadSelect2Items” in the Task model to the load the Select2 data into the “countries” property, place the following inside the “afterFind” method of the Task model …

So that concludes the Select2 library solution for Yii2. I have covered the creation of the necessary database table and the read / write methods for reading / writing the data.

After the initial methods have been setup this solution will provide you with a way of easily putting a Select2 field on your forms that allows for many to many relationships between models with just a couple of line of code.

Select2 library solution in Yii2 part 3 – saving the data

To continue from the previous article …


Once the database table has been created the code can now be written to display the Select2 field on the form and save the Select2 data to the database table.

In this article I will demonstrate the Select2 functionality as though we are wanting to add “Tags” to a Task model. When I say “Tags” I mean the standard web term for Tags. Essentially these are words that you can tag to an entity for example a WordPress article that categorizes the WordPress article using the tags allowing a user to search by those words.

When I say Task model, this is a fictional model in a Yii2 application that will allow the user to create and update tasks. For the purposes of this article it is assumed you will create your own Task model along with the controller and views. Create a standard CRUD for tasks possibly giving each task a name and a description.

You will need to create a Tag database table to store the Tag data along with its associated model. Create a database table with “id” field for the primary key and a “name” field to store the Tag name. Create a standard Yii2 model for the Tag table, this model does not need any methods inside it, it is a blank Yii2 model that extends ActiveRecord.

After you have created your task CRUD functionality and the Tag database table with associated model the Select2 functionality can be integrated.

First the field is added to the form using the Kartik Select2 plugin. The plugin can be found here …


Add the field to the form using code similar to this. Include the plugin in the form …

Add the field to the form …

Create a “tags” property in the Task model, this will be used to store the tags field data on both saving and retrieving …

Now the field is added to the form and you have a property in which to store the array of data which the Select2 library needs in order to function. Next you need to use the “saveSelect2Items” items method as shown below to save the array data in the “tags” property to the database.

The “saveSelect2Items” method can be placed inside the Task model but it would be better in some kind of global area such as a Master model as is it likely that you will want to use the functionality in more than one model / form. I wrote an article on how to create Master models which can be read here …


The “saveSelect2Items” method is as follows …

The code above can be explained as follows …

  1. Line 3 – get the class name of the model object in this case that would be the Task model and convert it to lowercase characters
  2. Line 4 – get the class name of the store model object in this case that would be the Tag model and convert it to lowercase characters
  3. Line 5 – get the Select2 array data of the model object in this case that would be the “tags” property in the Task model
  4. Line 7 – if the model object Select2 property is not empty, in this case that would be the “tag” property
  5. Line 9 – get the current stored records in relation to the model and model properties we are using. In this case the Task model, Tag model and “tag” property
  6. Line 11 – loop through the currently stored records
  7. Line 13 – if the related model object ID is not in the model object property array data. In this case that is if the Tag ID is not in the “tag” property array data
  8. Line 15 – set the deleted flag to 1, which indicates deleted
  9. Line 16 – save the record
  10. Line 22 – loop through the array data in the model object property, in this case that is the Task model “tags” property
  11. Line 24 – check to see whether a record already exists in relation to the model and model properties we are using. In this case the Task model, Tag model and “tag” property
  12. Line 26 – if no existing record can be found
  13. Line 28 to 33 – create a new Select2 record and set the properties
  14. Line 35 and 36 – save the new Select2 record but if it does not save then return false
  15. Line 42 – the else part of the original if statement, if there is no array data in the “tags” property
  16. Line 44 – delete all the existing records for the model we are dealing with. In this case that is the Task model

As mentioned in the database article the “saveSelect2Items” method soft deletes the unwanted Select2 records with a little adaptation this could be altered to hard delete the records.

Now that the “saveSelect2Items” has been created you can call it in your Task model by placing the following code in the “beforeSave” method of the Task model …

The first parameter of the “saveSelect2Items” is the property used to store the Select2 array data, the second parameter is the original model that uses the Select2 field on the form in this case that is the Task model. The third parameter is the relation model in this case that is the Tag model.

The code up to this point puts a Select2 field on a form and saves the Select2 data when the form is saved. If you go back to the form the Select2 field will not be populated with the saved data yet as that is covered in the next article which talks about retrieving the Select2 data.

Select2 library solution in Yii2 part 2 – database

To continue from the previous article …


I will now talk about the database table needed to get my implementation of the Select2 library working. As mentioned earlier the original design for the database included a table for each set of Select2 relations. So if I wanted a Person to be able to select multiple Countries I would have a Select2 PersonCountries table, 1 table per relation.

The latest design for the database has just 1 table to store all of the Select2 relations used throughout the web software application. I find this easier as I can then use the Select2 like a module, whenever I want Select2 in my web software application I just drop in the code files along with the database table.

The database table I am using is as follows …

I will now run through what the columns in the database table are used for …

  1. id – unique integer for the record
  2. entityModel – the short name of the model class stored in lowercase characters, for example the “Person” model
  3. entityModelField – the name of the model property used on the form to select the related Select2 relations, for example “countries”
  4. entityModelID – the ID of the model, for example the ID of the “Person” model
  5. relationEntityModel – the short name of the related model class in lowercase characters, for example the “Country” model
  6. relationEntityModelID – the ID of the related model, for example the ID of the “Country” model
  7. deleted – a flag to determine if this record is deleted
  8. createdBy – the ID of the user this record was created by
  9. createdDate – the date this record was created
  10. updatedBy – the ID of the user who last updated this record
  11. updatedDate – the date this record was last updated

Please note that “id” is just a standard primary key and is not unique to this article also deleted, createdBy, createdDate, updatedBy and updatedDate are not unique to this article. These are just standard columns that I populate all of my tables with and are not really necessary for the purposes of this article.

The deleted column may be necessary if you are running the code exactly as explained in this article but the record could have just as easily have been hard deleted and hence the deleted column is just personal preference.

To know more about the standard columns I use and to auto populate these columns read the following article …


The above database table is the table I use to power the Select2 library relations in my web software applications. An example use case for this can be described as follows …

You have a update Person form (entityModel) with a countries field (entityModelField) that allows the user to select various Countries that are related to the person (the ID of the Person is the entityModelID). You can select various Countries and save them to the Person. For each country saved a select2_library record will be created, the ID of the Country is the relationEntityModelID and the Country model itself is the relationEntityModel.

At this point a Select2Library model will need to be created for the “select2_library” table. In the example used in this article a relationship will need to be created between the Select2Library model and the Country model. This will need to be created using the “relationEntityModelID” like this …

All of the above will become clearer when actually running the code and seeing the results. The code to get this to run will be described in the follow up articles.