4 * Support functions for RedBeanPHP.
5 * Additional convenience shortcut functions for RedBeanPHP.
7 * @file RedBeanPHP/Functions.php
8 * @author Gabor de Mooij and the RedBeanPHP community
12 * copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
13 * This source file is subject to the BSD/GPLv2 License that is bundled
14 * with this source code in the file license.txt.
18 * Convenience function for ENUM short syntax in queries.
23 * R::find( 'paint', ' color_id = ? ', [ EID('color:yellow') ] );
26 * If a function called EID() already exists you'll have to write this
29 * @param string $enumName enum code as you would pass to R::enum()
33 if (!function_exists('EID')) {
35 function EID($enumName)
37 return \RedBeanPHP\Facade::enum( $enumName )->id;
43 * Prints the result of R::dump() to the screen using
46 * @param mixed $data data to dump
50 if ( !function_exists( 'dmp' ) ) {
54 print_r( \RedBeanPHP\Facade::dump( $list ) );
59 * Function alias for R::genSlots().
61 if ( !function_exists( 'genslots' ) ) {
63 function genslots( $slots, $tpl = NULL )
65 return \RedBeanPHP\Facade::genSlots( $slots, $tpl );
70 * Function alias for R::flat().
72 if ( !function_exists( 'array_flatten' ) ) {
74 function array_flatten( $array )
76 return \RedBeanPHP\Facade::flat( $array );