$toolbox
$toolbox : \RedBeanPHP\Util\Toolbox
Diff Utility
The Look Utility class provides an easy way to generate tables and selects (pulldowns) from the database.
__construct(\RedBeanPHP\ToolBox $toolbox)
Constructor.
The MatchUp class requires a toolbox
\RedBeanPHP\ToolBox | $toolbox |
diff(\RedBeanPHP\OODBBean|array $beans, \RedBeanPHP\OODBBean|array $others, array $filters = array('created', 'modified'), string $format = '%s.%s.%s', string|NULL $type = NULL) : array
Calculates a diff between two beans (or arrays of beans).
The result of this method is an array describing the differences of the second bean compared to the first, where the first bean is taken as reference. The array is keyed by type/property, id and property name, where type/property is either the type (in case of the root bean) or the property of the parent bean where the type resides. The diffs are mainly intended for logging, you cannot apply these diffs as patches to other beans. However this functionality might be added in the future.
The keys of the array can be formatted using the $format parameter. A key will be composed of a path (1st), id (2nd) and property (3rd). Using printf-style notation you can determine the exact format of the key. The default format will look like:
'book.1.title' => array(
If you only want a simple diff of one bean and you don't care about ids, you might pass a format like: '%1$s.%3$s' which gives:
'book.1.title' => array(
The filter parameter can be used to set filters, it should be an array of property names that have to be skipped. By default this array is filled with two strings: 'created' and 'modified'.
\RedBeanPHP\OODBBean|array | $beans | reference beans |
\RedBeanPHP\OODBBean|array | $others | beans to compare |
array | $filters | names of properties of all beans to skip |
string | $format | the format of the key, defaults to '%s.%s.%s' |
string|NULL | $type | type/property of bean to use for key generation |