Quick search:


How to make instances of a class persistent

  • Make the class a direct or indirect subclass of PntDbObject,
  • Make a getTableName method that returns the name of the database table the objects are stored in and retrieved from,
  • Create a table in the database with the name returned by the getTableName method and column whose names match the names of the persistent fieldProperties,
  • create a method getLabelSort that returns an instance of PntSqlSort that defines how a list of peanuts should be sorted.
This is enough for the framework to store objects, retrieve them and search for them in the default MySql database that is configured in classes/scriptMakeSettings.php. See example 1.

This uses standard persistency support. For specialization and overriding see other how to documentation in this category.