idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
35,000 | public function getPlatformClass ( $ domainClass ) { $ relative = ( strpos ( $ domainClass , '\\' ) !== 0 ) ; $ exploded = explode ( '\\' , ltrim ( $ domainClass , '\\' ) ) ; $ slice = array_slice ( $ exploded , - 1 ) ; $ class = $ slice [ 0 ] ; $ namespace = implode ( '\\' , array_slice ( $ exploded , 0 , - 1 ) ) ; if... | Get the platform class name of the specified domain class . |
35,001 | public function getTransport ( ) { if ( $ this -> transport === null || ! $ this -> transport instanceof xPDOTransport ) { $ transportClass = $ this -> xpdo -> getOption ( 'xPDOTransport.class' , null , 'xPDOTransport' ) ; $ this -> transport = new $ transportClass ( $ this ) ; if ( $ this -> transport === null || ! $ ... | Gets a data transport mechanism for this xPDOManager instance . |
35,002 | public function getCacheKey ( $ key , $ options = array ( ) ) { $ prefix = $ this -> getOption ( 'cache_prefix' , $ options ) ; if ( ! empty ( $ prefix ) ) $ key = $ prefix . $ key ; $ key = str_replace ( '\\' , '/' , $ key ) ; return $ this -> key . '/' . $ key ; } | Get the actual cache key the implementation will use . |
35,003 | public function register ( & $ transport ) { $ vPackage = isset ( $ this -> payload [ 'vehicle_package' ] ) ? $ this -> payload [ 'vehicle_package' ] : '' ; $ vClass = isset ( $ this -> payload [ 'vehicle_class' ] ) ? $ this -> payload [ 'vehicle_class' ] : $ this -> class ; $ class = isset ( $ this -> payload [ 'class... | Build a manifest entry to be registered in a transport for this vehicle . |
35,004 | public function get ( & $ transport , $ options = array ( ) , $ element = null ) { $ artifact = null ; if ( $ element === null ) $ element = $ this -> payload ; $ artifact = array_merge ( $ options , $ element ) ; return $ artifact ; } | Retrieve an artifact represented in this vehicle . |
35,005 | public function validate ( & $ transport , & $ object , $ options = array ( ) ) { $ validated = true ; if ( isset ( $ this -> payload [ 'validate' ] ) ) { foreach ( $ this -> payload [ 'validate' ] as $ rKey => $ r ) { $ type = $ r [ 'type' ] ; $ body = $ r [ 'body' ] ; switch ( $ type ) { case 'php' : $ fileMeta = $ t... | Validate any dependencies for the object represented in this vehicle . |
35,006 | public function store ( & $ transport ) { $ stored = false ; $ cacheManager = $ transport -> xpdo -> getCacheManager ( ) ; if ( $ cacheManager && ! empty ( $ this -> payload ) ) { $ this -> _compilePayload ( $ transport ) ; $ content = '<?php return ' ; $ content .= var_export ( $ this -> payload , true ) ; $ content .... | Store this xPDOVehicle instance into an xPDOTransport . |
35,007 | public static function getInstance ( $ id = null , $ config = null , $ forceNew = false ) { $ instances = & self :: $ instances ; if ( is_null ( $ id ) ) { if ( ! is_null ( $ config ) || $ forceNew || empty ( $ instances ) ) { $ id = uniqid ( __CLASS__ ) ; } else { $ id = key ( $ instances ) ; } } if ( $ forceNew || ! ... | Create retrieve or update specific xPDO instances . |
35,008 | protected function initConfig ( $ data ) { if ( $ data instanceof ContainerInterface ) { $ this -> services = $ data ; if ( $ this -> services -> has ( 'config' ) ) { $ data = $ this -> services -> get ( 'config' ) ; } } if ( ! is_array ( $ data ) ) { $ data = array ( xPDO :: OPT_TABLE_PREFIX => '' ) ; } return $ data ... | Initialize an xPDO config array . |
35,009 | public function addConnection ( $ dsn , $ username = '' , $ password = '' , array $ options = array ( ) , $ driverOptions = null ) { $ added = false ; $ connection = new xPDOConnection ( $ this , $ dsn , $ username , $ password , $ options , $ driverOptions ) ; if ( $ connection instanceof xPDOConnection ) { $ this -> ... | Add an xPDOConnection instance to the xPDO connection pool . |
35,010 | public function getConnection ( array $ options = array ( ) ) { $ conn = & $ this -> connection ; $ mutable = $ this -> getOption ( xPDO :: OPT_CONN_MUTABLE , $ options , null ) ; if ( ! ( $ conn instanceof xPDOConnection ) || ( $ mutable !== null && ( ( $ mutable == true && ! $ conn -> isMutable ( ) ) || ( $ mutable =... | Get an xPDOConnection from the xPDO connection pool . |
35,011 | public function connect ( $ driverOptions = array ( ) , array $ options = array ( ) ) { $ connected = false ; $ this -> getConnection ( $ options ) ; if ( $ this -> connection instanceof xPDOConnection ) { $ connected = $ this -> connection -> connect ( $ driverOptions ) ; if ( $ connected ) { $ this -> pdo = & $ this ... | Get or create a PDO connection to a database specified in the configuration . |
35,012 | public function setPackage ( $ pkg = '' , $ path = '' , $ prefix = null ) { if ( empty ( $ path ) && isset ( $ this -> packages [ $ pkg ] ) ) { $ path = $ this -> packages [ $ pkg ] [ 'path' ] ; $ prefix = ! is_string ( $ prefix ) && array_key_exists ( 'prefix' , $ this -> packages [ $ pkg ] ) ? $ this -> packages [ $ ... | Sets a specific model package to use when looking up classes . |
35,013 | public function getDescendants ( $ className ) { $ descendants = array ( ) ; if ( isset ( $ this -> classMap [ $ className ] ) ) { $ descendants = $ this -> classMap [ $ className ] ; if ( $ descendants ) { foreach ( $ descendants as $ descendant ) { $ descendants = array_merge ( $ descendants , $ this -> getDescendant... | Gets a list of derivative classes for the specified className . |
35,014 | public function getOption ( $ key , $ options = null , $ default = null , $ skipEmpty = false ) { $ option = null ; if ( is_string ( $ key ) && ! empty ( $ key ) ) { $ found = false ; if ( isset ( $ options [ $ key ] ) ) { $ found = true ; $ option = $ options [ $ key ] ; } if ( ( ! $ found || ( $ skipEmpty && $ option... | Get an xPDO configuration option value by key . |
35,015 | public function call ( $ class , $ method , array $ args = array ( ) , $ transient = false ) { $ return = null ; $ callback = '' ; if ( $ transient ) { $ className = $ this -> loadClass ( $ class , '' , false , true ) ; if ( $ className ) { $ callback = array ( $ className , $ method ) ; } } else { $ className = $ this... | Call a static method from a valid package class with arguments . |
35,016 | public function newObject ( $ className , $ fields = array ( ) ) { $ instance = null ; if ( $ className = $ this -> loadClass ( $ className ) ) { $ className = self :: getPlatformClass ( $ className ) ; if ( $ instance = new $ className ( $ this ) ) { if ( is_array ( $ fields ) && ! empty ( $ fields ) ) { $ instance ->... | Creates a new instance of a specified class . |
35,017 | public function getObject ( $ className , $ criteria = null , $ cacheFlag = true ) { $ instance = null ; $ this -> sanitizePKCriteria ( $ className , $ criteria ) ; if ( $ criteria !== null ) { $ instance = $ this -> call ( $ className , 'load' , array ( & $ this , $ className , $ criteria , $ cacheFlag ) ) ; } return ... | Retrieves a single object instance by the specified criteria . |
35,018 | public function getCollection ( $ className , $ criteria = null , $ cacheFlag = true ) { return $ this -> call ( $ className , 'loadCollection' , array ( & $ this , $ className , $ criteria , $ cacheFlag ) ) ; } | Retrieves a collection of xPDOObjects by the specified xPDOCriteria . |
35,019 | public function getIterator ( $ className , $ criteria = null , $ cacheFlag = true ) { return new xPDOIterator ( $ this , array ( 'class' => $ className , 'criteria' => $ criteria , 'cacheFlag' => $ cacheFlag ) ) ; } | Retrieves an iterable representation of a collection of xPDOObjects . |
35,020 | public function updateCollection ( $ className , array $ set , $ criteria = null ) { $ affected = false ; if ( $ this -> getConnection ( array ( xPDO :: OPT_CONN_MUTABLE => true ) ) ) { $ query = $ this -> newQuery ( $ className ) ; if ( $ query && ! empty ( $ set ) ) { $ query -> command ( 'UPDATE' ) ; $ query -> set ... | Update field values across a collection of xPDOObjects . |
35,021 | public function removeObject ( $ className , $ criteria ) { $ removed = false ; if ( $ this -> getConnection ( array ( xPDO :: OPT_CONN_MUTABLE => true ) ) ) { if ( $ this -> getCount ( $ className , $ criteria ) === 1 ) { if ( $ query = $ this -> newQuery ( $ className ) ) { $ query -> command ( 'DELETE' ) ; $ query -... | Remove an instance of the specified className by a supplied criteria . |
35,022 | public function getCount ( $ className , $ criteria = null ) { $ count = 0 ; if ( $ query = $ this -> newQuery ( $ className , $ criteria ) ) { $ stmt = null ; $ expr = '*' ; if ( $ pk = $ this -> getPK ( $ className ) ) { if ( ! is_array ( $ pk ) ) { $ pk = array ( $ pk ) ; } $ expr = $ this -> getSelectColumns ( $ cl... | Retrieves a count of xPDOObjects by the specified xPDOCriteria . |
35,023 | public function getObjectGraph ( $ className , $ graph , $ criteria = null , $ cacheFlag = true ) { $ object = null ; if ( $ collection = $ this -> getCollectionGraph ( $ className , $ graph , $ criteria , $ cacheFlag ) ) { if ( ! count ( $ collection ) === 1 ) { $ this -> log ( xPDO :: LOG_LEVEL_WARN , 'getObjectGraph... | Retrieves an xPDOObject instance with specified related objects . |
35,024 | public function getCollectionGraph ( $ className , $ graph , $ criteria = null , $ cacheFlag = true ) { return $ this -> call ( $ className , 'loadCollectionGraph' , array ( & $ this , $ className , $ graph , $ criteria , $ cacheFlag ) ) ; } | Retrieves a collection of xPDOObject instances with related objects . |
35,025 | public function getValue ( $ stmt , $ column = null ) { $ value = null ; if ( is_object ( $ stmt ) && $ stmt instanceof \ PDOStatement ) { $ tstart = microtime ( true ) ; if ( $ stmt -> execute ( ) ) { $ this -> queryTime += microtime ( true ) - $ tstart ; $ this -> executedQueries ++ ; $ value = $ stmt -> fetchColumn ... | Execute a PDOStatement and get a single column value from the first row of the result set . |
35,026 | public function getCriteria ( $ className , $ type = null , $ cacheFlag = true ) { return $ this -> newQuery ( $ className , $ type , $ cacheFlag ) ; } | Convert any valid criteria into an xPDOQuery instance . |
35,027 | public function getCriteriaType ( $ criteria ) { $ type = gettype ( $ criteria ) ; if ( $ type === 'object' ) { $ type = get_class ( $ criteria ) ; if ( ! $ criteria instanceof Om \ xPDOCriteria ) { $ this -> log ( xPDO :: LOG_LEVEL_WARN , "Invalid criteria object of class {$type} encountered." , '' , __METHOD__ , __FI... | Validate and return the type of a specified criteria variable . |
35,028 | public function addDerivativeCriteria ( $ className , $ criteria ) { if ( $ criteria instanceof Om \ xPDOQuery && ( $ className = $ this -> loadClass ( $ className ) ) && ! isset ( $ this -> map [ $ className ] [ 'table' ] ) ) { if ( isset ( $ this -> map [ $ className ] [ 'fields' ] [ 'class_key' ] ) && ! empty ( $ th... | Add criteria when requesting a derivative class row automatically . |
35,029 | public function getPackage ( $ className ) { $ package = '' ; if ( $ className = $ this -> loadClass ( $ className ) ) { if ( isset ( $ this -> map [ $ className ] [ 'package' ] ) ) { $ package = $ this -> map [ $ className ] [ 'package' ] ; } if ( ! $ package && $ ancestry = $ this -> getAncestry ( $ className , false... | Gets the package name from a specified class name . |
35,030 | public function getService ( $ name , $ class = '' , $ path = '' , $ params = array ( ) ) { $ service = null ; if ( ! $ this -> services -> has ( $ name ) || ! is_object ( $ this -> services -> get ( $ name ) ) ) { if ( empty ( $ class ) && isset ( $ this -> config [ $ name . '.class' ] ) ) { $ class = $ this -> config... | Load and return a named service class instance . |
35,031 | public function getTableName ( $ className , $ includeDb = false ) { $ table = null ; if ( $ className = $ this -> loadClass ( $ className ) ) { if ( isset ( $ this -> map [ $ className ] [ 'table' ] ) ) { $ table = $ this -> map [ $ className ] [ 'table' ] ; if ( isset ( $ this -> map [ $ className ] [ 'package' ] ) &... | Gets the actual run - time table name from a specified class name . |
35,032 | public function getTableClass ( $ className ) { $ tableClass = null ; if ( $ className = $ this -> loadClass ( $ className ) ) { if ( isset ( $ this -> map [ $ className ] [ 'table' ] ) ) { $ tableClass = $ className ; } if ( ! $ tableClass && $ ancestry = $ this -> getAncestry ( $ className , false ) ) { foreach ( $ a... | Get the class which defines the table for a specified className . |
35,033 | public function getTableMeta ( $ className ) { $ tableMeta = null ; if ( $ className = $ this -> loadClass ( $ className ) ) { if ( isset ( $ this -> map [ $ className ] [ 'tableMeta' ] ) ) { $ tableMeta = $ this -> map [ $ className ] [ 'tableMeta' ] ; } if ( ! $ tableMeta && $ ancestry = $ this -> getAncestry ( $ cla... | Gets the actual run - time table metadata from a specified class name . |
35,034 | public function getInherit ( $ className ) { $ inherit = false ; if ( $ className = $ this -> loadClass ( $ className ) ) { if ( isset ( $ this -> map [ $ className ] [ 'inherit' ] ) ) { $ inherit = $ this -> map [ $ className ] [ 'inherit' ] ; } if ( ! $ inherit && $ ancestry = $ this -> getAncestry ( $ className , fa... | Indicates the inheritance model for the xPDOObject class specified . |
35,035 | public function getFieldAliases ( $ className ) { $ fieldAliases = array ( ) ; if ( $ className = $ this -> loadClass ( $ className ) ) { if ( $ ancestry = $ this -> getAncestry ( $ className ) ) { for ( $ i = count ( $ ancestry ) - 1 ; $ i >= 0 ; $ i -- ) { if ( isset ( $ this -> map [ $ ancestry [ $ i ] ] [ 'fieldAli... | Gets a collection of field aliases for an object by class name . |
35,036 | public function getValidationRules ( $ className ) { $ rules = array ( ) ; if ( $ className = $ this -> loadClass ( $ className ) ) { if ( $ ancestry = $ this -> getAncestry ( $ className ) ) { for ( $ i = count ( $ ancestry ) - 1 ; $ i >= 0 ; $ i -- ) { if ( isset ( $ this -> map [ $ ancestry [ $ i ] ] [ 'validation' ... | Gets a set of validation rules defined for an object by class name . |
35,037 | public function getPKType ( $ className , $ pk = false ) { $ pktype = null ; if ( $ actualClassName = $ this -> loadClass ( $ className ) ) { if ( ! $ pk ) $ pk = $ this -> getPK ( $ actualClassName ) ; if ( ! is_array ( $ pk ) ) $ pk = array ( $ pk ) ; $ ancestry = $ this -> getAncestry ( $ actualClassName , true ) ; ... | Gets the type of primary key field for a class . |
35,038 | public function getGraph ( $ className , $ depth = 3 , & $ parents = array ( ) , & $ visited = array ( ) ) { $ graph = array ( ) ; $ className = $ this -> loadClass ( $ className ) ; if ( $ className && $ depth > 0 ) { $ depth -- ; $ parents = array_merge ( $ parents , $ this -> getAncestry ( $ className ) ) ; $ parent... | Get a complete relation graph for an xPDOObject class . |
35,039 | public function getAncestry ( $ className , $ includeSelf = true ) { $ ancestry = array ( ) ; if ( $ actualClassName = $ this -> loadClass ( $ className ) ) { $ ancestor = $ actualClassName ; if ( $ includeSelf ) { $ ancestry [ ] = $ actualClassName ; } while ( $ ancestor = get_parent_class ( $ ancestor ) ) { $ ancestr... | Retrieves the complete ancestry for a class . |
35,040 | public function getSelectColumns ( $ className , $ tableAlias = '' , $ columnPrefix = '' , $ columns = array ( ) , $ exclude = false ) { return $ this -> call ( $ className , 'getSelectColumns' , array ( & $ this , $ className , $ tableAlias , $ columnPrefix , $ columns , $ exclude ) ) ; } | Gets select columns from a specific class for building a query . |
35,041 | function getFKDefinition ( $ parentClass , $ alias ) { $ def = null ; $ parentClass = $ this -> loadClass ( $ parentClass ) ; if ( $ parentClass && $ alias ) { if ( $ aggregates = $ this -> getAggregates ( $ parentClass ) ) { if ( isset ( $ aggregates [ $ alias ] ) ) { $ def = $ aggregates [ $ alias ] ; $ def [ 'type' ... | Gets an aggregate or composite relation definition from a class . |
35,042 | public function getModelVersion ( $ className ) { $ version = '1.0' ; $ className = $ this -> loadClass ( $ className ) ; if ( $ className && isset ( $ this -> map [ $ className ] [ 'version' ] ) ) { $ version = $ this -> map [ $ className ] [ 'version' ] ; } return $ version ; } | Gets the version string of the schema the specified class was generated from . |
35,043 | public function getManager ( ) { if ( $ this -> manager === null || ! $ this -> manager instanceof Om \ xPDOManager ) { $ managerClass = '\\xPDO\\Om\\' . $ this -> config [ 'dbtype' ] . '\\xPDOManager' ; $ this -> manager = new $ managerClass ( $ this ) ; if ( ! $ this -> manager ) { $ this -> log ( xPDO :: LOG_LEVEL_E... | Gets the manager class for this xPDO connection . |
35,044 | public function getDriver ( ) { if ( $ this -> driver === null || ! $ this -> driver instanceof Om \ xPDODriver ) { $ driverClass = '\\xPDO\\Om\\' . $ this -> config [ 'dbtype' ] . '\\xPDODriver' ; $ this -> driver = new $ driverClass ( $ this ) ; if ( ! $ this -> driver ) { $ this -> log ( xPDO :: LOG_LEVEL_ERROR , "C... | Gets the driver class for this xPDO connection . |
35,045 | public function getCachePath ( ) { if ( ! $ this -> cachePath ) { if ( $ this -> getCacheManager ( ) ) { $ this -> cachePath = $ this -> cacheManager -> getCachePath ( ) ; } } return $ this -> cachePath ; } | Gets the absolute path to the cache directory . |
35,046 | public function getCacheManager ( $ class = 'xPDO\\Cache\\xPDOCacheManager' , $ options = array ( 'path' => XPDO_CORE_PATH , 'ignorePkg' => true ) ) { if ( $ this -> cacheManager === null || ! is_object ( $ this -> cacheManager ) || ! ( $ this -> cacheManager instanceof $ class ) ) { if ( $ this -> cacheManager = new $... | Gets an xPDOCacheManager instance . |
35,047 | public function setLogLevel ( $ level = xPDO :: LOG_LEVEL_FATAL ) { $ oldLevel = $ this -> logLevel ; $ this -> logLevel = intval ( $ level ) ; return $ oldLevel ; } | Sets the logging level state for the xPDO instance . |
35,048 | public function log ( $ level , $ msg , $ target = '' , $ def = '' , $ file = '' , $ line = '' ) { $ this -> _log ( $ level , $ msg , $ target , $ def , $ file , $ line ) ; } | Log a message with details about where and when an event occurs . |
35,049 | public function getDebugBacktrace ( ) { $ backtrace = array ( ) ; foreach ( debug_backtrace ( ) as $ levelKey => $ levelElement ) { foreach ( $ levelElement as $ traceKey => $ traceElement ) { if ( $ traceKey == 'object' && $ traceElement instanceof Om \ xPDOObject ) { $ backtrace [ $ levelKey ] [ $ traceKey ] = $ trac... | Returns an abbreviated backtrace of debugging information . |
35,050 | protected function _getLogLevel ( $ level ) { switch ( $ level ) { case xPDO :: LOG_LEVEL_DEBUG : $ levelText = 'DEBUG' ; break ; case xPDO :: LOG_LEVEL_INFO : $ levelText = 'INFO' ; break ; case xPDO :: LOG_LEVEL_WARN : $ levelText = 'WARN' ; break ; case xPDO :: LOG_LEVEL_ERROR : $ levelText = 'ERROR' ; break ; defau... | Gets a logging level as a string representation . |
35,051 | public function escape ( $ string ) { $ string = trim ( $ string , $ this -> _escapeCharOpen . $ this -> _escapeCharClose ) ; return $ this -> _escapeCharOpen . $ string . $ this -> _escapeCharClose ; } | Escapes the provided string using the platform - specific escape character . |
35,052 | public function literal ( $ string ) { $ string = trim ( $ string , $ this -> _escapeCharOpen . $ this -> _escapeCharClose . $ this -> _quoteChar ) ; return $ string ; } | Use to insert a literal string into a SQL query without escaping or quoting . |
35,053 | private function _getFullTableName ( $ baseTableName , $ includeDb = false ) { $ fqn = '' ; if ( ! empty ( $ baseTableName ) ) { if ( $ includeDb ) { $ fqn .= $ this -> escape ( $ this -> config [ 'dbname' ] ) . '.' ; } $ fqn .= $ this -> escape ( $ baseTableName ) ; } return $ fqn ; } | Adds the table prefix and optionally database name to a given table . |
35,054 | public static function parseDSN ( $ string ) { $ result = array ( ) ; $ pos = strpos ( $ string , ':' ) ; $ result [ 'dbtype' ] = strtolower ( substr ( $ string , 0 , $ pos ) ) ; $ parameters = explode ( ';' , substr ( $ string , ( $ pos + 1 ) ) ) ; for ( $ a = 0 , $ b = count ( $ parameters ) ; $ a < $ b ; $ a ++ ) { ... | Parses a DSN and returns an array of the connection details . |
35,055 | public function fromJSON ( $ src , $ asArray = true ) { $ decoded = '' ; if ( $ src ) { if ( ! function_exists ( 'json_decode' ) ) { throw new xPDOException ( ) ; } else { $ decoded = json_decode ( $ src , $ asArray ) ; } } return $ decoded ; } | Converts a JSON source string into an equivalent PHP representation . |
35,056 | public function newQuery ( $ class , $ criteria = null , $ cacheFlag = true ) { $ xpdoQueryClass = '\\xPDO\\Om\\' . $ this -> config [ 'dbtype' ] . '\\xPDOQuery' ; if ( $ query = new $ xpdoQueryClass ( $ this , $ class , $ criteria ) ) { $ query -> cacheFlag = $ cacheFlag ; } return $ query ; } | Creates an new xPDOQuery for a specified xPDOObject class . |
35,057 | public static function escSplit ( $ char , $ str , $ escToken = '`' , $ limit = 0 ) { $ split = array ( ) ; $ charPos = strpos ( $ str , $ char ) ; if ( $ charPos !== false ) { if ( $ charPos === 0 ) { $ searchPos = 1 ; $ startPos = 1 ; } else { $ searchPos = 0 ; $ startPos = 0 ; } $ escOpen = false ; $ strlen = strlen... | Splits a string on a specified character ignoring escaped content . |
35,058 | public function parseBindings ( $ sql , $ bindings ) { if ( ! empty ( $ sql ) && ! empty ( $ bindings ) ) { $ bound = array ( ) ; foreach ( $ bindings as $ k => $ param ) { if ( ! is_array ( $ param ) ) { $ v = $ param ; $ type = $ this -> getPDOType ( $ param ) ; $ bindings [ $ k ] = array ( 'value' => $ v , 'type' =>... | Parses parameter bindings in SQL prepared statements . |
35,059 | protected function sanitizePKCriteria ( $ className , & $ criteria ) { if ( is_scalar ( $ criteria ) ) { $ pkType = $ this -> getPKType ( $ className ) ; if ( is_string ( $ pkType ) ) { if ( is_string ( $ criteria ) && ! xPDOQuery :: isValidClause ( $ criteria ) ) { $ criteria = null ; } else { switch ( $ pkType ) { ca... | Sanitize criteria expected to represent primary key values . |
35,060 | public function getSource ( $ element = null , $ start = null , $ end = false , $ includeComment = true ) { $ source = false ; if ( $ element === null ) $ element = & $ this ; if ( $ element instanceof \ ReflectionClass || $ element instanceof \ ReflectionFunctionAbstract ) { if ( is_readable ( $ element -> getFileName... | Get the reconstructed source of the Class . |
35,061 | public function getCacheProvider ( $ key = '' , $ options = array ( ) ) { $ objCache = null ; if ( empty ( $ key ) ) { $ key = $ this -> getOption ( xPDO :: OPT_CACHE_KEY , $ options , 'default' ) ; } $ objCacheClass = 'xPDO\\Cache\\xPDOFileCache' ; if ( ! isset ( $ this -> caches [ $ key ] ) || ! is_object ( $ this ->... | Get an instance of a provider which implements the xPDOCache interface . |
35,062 | public function getCachePath ( ) { $ cachePath = false ; if ( ! isset ( $ this -> xpdo -> config [ 'cache_path' ] ) ) { while ( true ) { if ( ! empty ( $ _ENV [ 'TMP' ] ) ) { if ( $ cachePath = strtr ( $ _ENV [ 'TMP' ] , '\\' , '/' ) ) break ; } if ( ! empty ( $ _ENV [ 'TMPDIR' ] ) ) { if ( $ cachePath = strtr ( $ _ENV... | Get the absolute path to a writable directory for storing files . |
35,063 | public function writeFile ( $ filename , $ content , $ mode = 'wb' , $ options = array ( ) ) { $ written = false ; if ( ! is_array ( $ options ) ) { $ options = is_scalar ( $ options ) && ! is_bool ( $ options ) ? array ( 'new_folder_permissions' => $ options ) : array ( ) ; } $ dirname = dirname ( $ filename ) ; if ( ... | Writes a file to the filesystem . |
35,064 | public function lockFile ( $ file , array $ options = array ( ) ) { $ locked = false ; $ lockDir = $ this -> getOption ( 'lock_dir' , $ options , $ this -> getCachePath ( ) . 'locks' . DIRECTORY_SEPARATOR ) ; if ( $ this -> writeTree ( $ lockDir , $ options ) ) { $ lockFile = $ this -> lockFileName ( $ file , $ options... | Add an exclusive lock to a file for atomic write operations in multi - threaded environments . |
35,065 | protected function lockFileName ( $ file , array $ options = array ( ) ) { $ lockDir = $ this -> getOption ( 'lock_dir' , $ options , $ this -> getCachePath ( ) . 'locks' . DIRECTORY_SEPARATOR ) ; return $ lockDir . preg_replace ( '/\W/' , '_' , $ file ) . $ this -> getOption ( xPDO :: OPT_LOCKFILE_EXTENSION , $ option... | Get an absolute path to a lock file for a specified file path . |
35,066 | public function writeTree ( $ dirname , $ options = array ( ) ) { $ written = false ; if ( ! empty ( $ dirname ) ) { if ( ! is_array ( $ options ) ) $ options = is_scalar ( $ options ) && ! is_bool ( $ options ) ? array ( 'new_folder_permissions' => $ options ) : array ( ) ; $ mode = $ this -> getOption ( 'new_folder_p... | Recursively writes a directory tree of files to the filesystem |
35,067 | public function copyFile ( $ source , $ target , $ options = array ( ) ) { $ copied = false ; if ( ! is_array ( $ options ) ) $ options = is_scalar ( $ options ) && ! is_bool ( $ options ) ? array ( 'new_file_permissions' => $ options ) : array ( ) ; if ( func_num_args ( ) === 4 ) $ options [ 'new_folder_permissions' ]... | Copies a file from a source file to a target directory . |
35,068 | public function endsWith ( $ string , $ pattern ) { $ matched = false ; if ( is_string ( $ string ) && ( $ stringLen = strlen ( $ string ) ) ) { if ( is_array ( $ pattern ) ) { foreach ( $ pattern as $ subPattern ) { if ( is_string ( $ subPattern ) && $ this -> endsWith ( $ string , $ subPattern ) ) { $ matched = true ... | Sees if a string ends with a specific pattern or set of patterns . |
35,069 | public function matches ( $ string , $ pattern ) { $ matched = false ; if ( is_string ( $ string ) && ( $ stringLen = strlen ( $ string ) ) ) { if ( is_array ( $ pattern ) ) { foreach ( $ pattern as $ subPattern ) { if ( is_string ( $ subPattern ) && $ this -> matches ( $ string , $ subPattern ) ) { $ matched = true ; ... | Sees if a string matches a specific pattern or set of patterns . |
35,070 | public function generateObject ( $ obj , $ objName , $ generateObjVars = false , $ generateRelated = false , $ objRef = 'this->xpdo' , $ format = xPDOCacheManager :: CACHE_PHP ) { $ source = false ; if ( is_object ( $ obj ) && $ obj instanceof \ xPDO \ Om \ xPDOObject ) { $ className = $ obj -> _class ; $ source = "\${... | Generate a PHP executable representation of an xPDOObject . |
35,071 | public function add ( $ key , & $ var , $ lifetime = 0 , $ options = array ( ) ) { $ return = false ; if ( $ cache = $ this -> getCacheProvider ( $ this -> getOption ( xPDO :: OPT_CACHE_KEY , $ options ) ) ) { $ value = null ; if ( is_object ( $ var ) && $ var instanceof \ xPDO \ Om \ xPDOObject ) { $ value = $ var -> ... | Add a key - value pair to a cache provider if it does not already exist . |
35,072 | public function set ( $ key , & $ var , $ lifetime = 0 , $ options = array ( ) ) { $ return = false ; if ( $ cache = $ this -> getCacheProvider ( $ this -> getOption ( xPDO :: OPT_CACHE_KEY , $ options ) , $ options ) ) { $ value = null ; if ( is_object ( $ var ) && $ var instanceof \ xPDO \ Om \ xPDOObject ) { $ value... | Set a key - value pair in a cache provider . |
35,073 | public function delete ( $ key , $ options = array ( ) ) { $ return = false ; if ( $ cache = $ this -> getCacheProvider ( $ this -> getOption ( xPDO :: OPT_CACHE_KEY , $ options ) , $ options ) ) { $ return = $ cache -> delete ( $ key , $ options ) ; } return $ return ; } | Delete a key - value pair from a cache provider . |
35,074 | public function clean ( $ options = array ( ) ) { $ return = false ; if ( $ cache = $ this -> getCacheProvider ( $ this -> getOption ( xPDO :: OPT_CACHE_KEY , $ options ) , $ options ) ) { $ return = $ cache -> flush ( $ options ) ; } return $ return ; } | Flush the contents of a cache provider . |
35,075 | public function refresh ( array $ providers = array ( ) , array & $ results = array ( ) ) { if ( empty ( $ providers ) ) { foreach ( $ this -> caches as $ cacheKey => $ cache ) { $ providers [ $ cacheKey ] = array ( ) ; } } foreach ( $ providers as $ key => $ options ) { if ( array_key_exists ( $ key , $ this -> caches... | Refresh specific or all cache providers . |
35,076 | public static function _loadCollectionInstance ( xPDO & $ xpdo , array & $ objCollection , $ className , $ criteria , $ row , $ fromCache , $ cacheFlag = true ) { $ loaded = false ; if ( $ obj = xPDOObject :: _loadInstance ( $ xpdo , $ className , $ criteria , $ row ) ) { if ( ( $ cacheKey = $ obj -> getPrimaryKey ( ) ... | Responsible for loading an instance into a collection . |
35,077 | public static function load ( xPDO & $ xpdo , $ className , $ criteria , $ cacheFlag = true ) { $ instance = null ; $ fromCache = false ; if ( $ className = $ xpdo -> loadClass ( $ className ) ) { if ( ! is_object ( $ criteria ) ) { $ criteria = $ xpdo -> getCriteria ( $ className , $ criteria , $ cacheFlag ) ; } if ( ... | Load an instance of an xPDOObject or derivative class . |
35,078 | public static function loadCollection ( xPDO & $ xpdo , $ className , $ criteria = null , $ cacheFlag = true ) { $ objCollection = array ( ) ; $ fromCache = false ; if ( ! $ className = $ xpdo -> loadClass ( $ className ) ) return $ objCollection ; $ rows = false ; $ fromCache = false ; $ collectionCaching = ( integer ... | Load a collection of xPDOObject instances . |
35,079 | public static function loadCollectionGraph ( xPDO & $ xpdo , $ className , $ graph , $ criteria , $ cacheFlag ) { $ objCollection = array ( ) ; if ( $ query = $ xpdo -> newQuery ( $ className , $ criteria , $ cacheFlag ) ) { $ query = $ xpdo -> addDerivativeCriteria ( $ className , $ query ) ; $ query -> bindGraph ( $ ... | Load a collection of xPDOObject instances and a graph of related objects . |
35,080 | public static function getSelectColumns ( xPDO & $ xpdo , $ className , $ tableAlias = '' , $ columnPrefix = '' , $ columns = array ( ) , $ exclude = false ) { $ columnarray = array ( ) ; $ aColumns = $ xpdo -> getFields ( $ className ) ; if ( $ aColumns ) { if ( ! empty ( $ tableAlias ) ) { $ tableAlias = $ xpdo -> es... | Get a set of column names from an xPDOObject for use in SQL queries . |
35,081 | public function addFieldAlias ( $ field , $ alias ) { $ added = false ; if ( array_key_exists ( $ field , $ this -> _fields ) ) { if ( ! array_key_exists ( $ alias , $ this -> _fields ) ) { $ this -> _fields [ $ alias ] = & $ this -> _fields [ $ field ] ; if ( ! array_key_exists ( $ alias , $ this -> _fieldAliases ) ) ... | Add an alias as a reference to an actual field of the object . |
35,082 | public function getOption ( $ key , $ options = null , $ default = null ) { if ( is_array ( $ options ) && array_key_exists ( $ key , $ options ) ) { $ value = $ options [ $ key ] ; } elseif ( array_key_exists ( $ key , $ this -> _options ) ) { $ value = $ this -> _options [ $ key ] ; } else { $ value = $ this -> xpdo ... | Get an option value for this instance . |
35,083 | public function getOne ( $ alias , $ criteria = null , $ cacheFlag = true ) { $ object = null ; if ( $ fkdef = $ this -> getFKDefinition ( $ alias ) ) { $ k = $ fkdef [ 'local' ] ; $ fk = $ fkdef [ 'foreign' ] ; if ( isset ( $ this -> _relatedObjects [ $ alias ] ) ) { if ( is_object ( $ this -> _relatedObjects [ $ alia... | Gets an object related to this instance by a foreign key relationship . |
35,084 | public function getMany ( $ alias , $ criteria = null , $ cacheFlag = true ) { $ collection = $ this -> _getRelatedObjectsByFK ( $ alias , $ criteria , $ cacheFlag ) ; return $ collection ; } | Gets a collection of objects related by aggregate or composite relations . |
35,085 | public function getIterator ( $ alias , $ criteria = null , $ cacheFlag = true ) { $ iterator = false ; $ fkMeta = $ this -> getFKDefinition ( $ alias ) ; if ( $ fkMeta ) { $ fkCriteria = isset ( $ fkMeta [ 'criteria' ] ) && isset ( $ fkMeta [ 'criteria' ] [ 'foreign' ] ) ? $ fkMeta [ 'criteria' ] [ 'foreign' ] : null ... | Get an xPDOIterator for a collection of objects related by aggregate or composite relations . |
35,086 | public function addMany ( & $ obj , $ alias = '' ) { $ added = false ; if ( ! is_array ( $ obj ) ) { if ( is_object ( $ obj ) ) { if ( empty ( $ alias ) ) { if ( $ obj -> _alias == $ obj -> _class ) { $ aliases = $ this -> _getAliases ( $ obj -> _class , 1 ) ; if ( ! empty ( $ aliases ) ) { $ obj -> _alias = reset ( $ ... | Adds an object or collection of objects related to this class . |
35,087 | protected function _saveRelatedObjects ( ) { $ saved = 0 ; if ( ! empty ( $ this -> _relatedObjects ) ) { foreach ( $ this -> _relatedObjects as $ alias => $ ro ) { $ objects = array ( ) ; if ( is_object ( $ ro ) ) { $ primaryKey = $ ro -> _new ? '__new' : $ ro -> getPrimaryKey ( ) ; if ( is_array ( $ primaryKey ) ) $ ... | Searches for any related objects with pending changes to save . |
35,088 | protected function _saveRelatedObject ( & $ obj , $ fkMeta ) { $ saved = false ; $ local = $ fkMeta [ 'local' ] ; $ foreign = $ fkMeta [ 'foreign' ] ; $ cardinality = $ fkMeta [ 'cardinality' ] ; $ owner = isset ( $ fkMeta [ 'owner' ] ) ? $ fkMeta [ 'owner' ] : '' ; if ( ! $ owner ) { $ owner = $ cardinality === 'many'... | Save a related object with pending changes . |
35,089 | public function getPKType ( ) { if ( $ this -> _pktype === null ) { if ( $ this -> _pk === null ) { $ this -> getPK ( ) ; } $ this -> _pktype = $ this -> xpdo -> getPKType ( $ this -> _class ) ; } return $ this -> _pktype ; } | Gets the type of the primary key field for the object . |
35,090 | public function getFKClass ( $ k ) { $ fkclass = null ; $ k = $ this -> getField ( $ k , true ) ; if ( is_string ( $ k ) ) { if ( ! empty ( $ this -> _aggregates ) ) { foreach ( $ this -> _aggregates as $ aggregateAlias => $ aggregate ) { if ( $ aggregate [ 'local' ] === $ k ) { $ fkclass = $ aggregate [ 'class' ] ; br... | Get the name of a class related by foreign key to a specified field key . |
35,091 | public function getFieldName ( $ k , $ alias = null ) { if ( $ this -> fieldNames === null ) { $ this -> _initFields ( ) ; } $ name = null ; $ k = $ this -> getField ( $ k , true ) ; if ( is_string ( $ k ) && isset ( $ this -> fieldNames [ $ k ] ) ) { $ name = $ this -> fieldNames [ $ k ] ; } if ( $ name !== null && $ ... | Gets a field name as represented in the database container . |
35,092 | public function getField ( $ key , $ validate = false ) { $ field = $ key ; if ( ! array_key_exists ( $ key , $ this -> _fieldMeta ) ) { if ( array_key_exists ( $ key , $ this -> _fieldAliases ) ) { $ field = $ this -> _fieldAliases [ $ key ] ; } elseif ( $ validate === true ) { $ field = false ; } } return $ field ; } | Get a field name looking up any by alias if not an actual field . |
35,093 | public function getGraph ( $ graph = true , $ criteria = null , $ cacheFlag = true ) { if ( $ graph === true ) { $ graph = $ this -> xpdo -> getGraph ( $ this -> _class ) ; } if ( is_int ( $ graph ) ) { $ graph = $ this -> xpdo -> getGraph ( $ this -> _class , $ graph ) ; } if ( is_string ( $ graph ) ) { $ graph = $ th... | Load a graph of related objects to the current object . |
35,094 | public function toArray ( $ keyPrefix = '' , $ rawValues = false , $ excludeLazy = false , $ includeRelated = false ) { $ objArray = null ; if ( is_array ( $ this -> _fields ) ) { $ keys = array_keys ( $ this -> _fields ) ; if ( ! $ excludeLazy && $ this -> isLazy ( ) ) { $ this -> _loadFieldData ( $ this -> _lazy ) ; ... | Copies the object fields and corresponding values to an associative array . |
35,095 | public function fromArray ( $ fldarray , $ keyPrefix = '' , $ setPrimaryKeys = false , $ rawValues = false , $ adhocValues = false ) { if ( is_array ( $ fldarray ) ) { $ pkSet = false ; $ generatedKey = false ; foreach ( $ fldarray as $ key => $ val ) { if ( ! empty ( $ keyPrefix ) ) { $ prefixPos = strpos ( $ key , $ ... | Sets object fields from an associative array of key = > value pairs . |
35,096 | public function addValidationRule ( $ field , $ name , $ type , $ rule , array $ parameters = array ( ) ) { $ field = $ this -> getField ( $ field ) ; if ( is_string ( $ field ) ) { if ( ! $ this -> _validationLoaded ) $ this -> _loadValidation ( ) ; if ( ! isset ( $ this -> _validationRules [ $ field ] ) ) $ this -> _... | Add a validation rule to an object field for this instance . |
35,097 | public function removeValidationRules ( $ field = null , array $ rules = array ( ) ) { if ( ! $ this -> _validationLoaded ) $ this -> _loadValidation ( ) ; if ( empty ( $ rules ) && is_string ( $ field ) ) { unset ( $ this -> _validationRules [ $ this -> getField ( $ field ) ] ) ; } elseif ( empty ( $ rules ) && is_nul... | Remove one or more validation rules from this instance . |
35,098 | public function getValidator ( ) { if ( ! $ this -> _validator instanceof xPDOValidator ) { $ validatorClass = $ this -> getOption ( xPDO :: OPT_VALIDATOR_CLASS , null , 'xPDO\\Validation\\xPDOValidator' ) ; if ( $ validatorClass = $ this -> xpdo -> loadClass ( $ validatorClass , '' , false , true ) ) { $ this -> _vali... | Get the xPDOValidator class configured for this instance . |
35,099 | public function _loadValidation ( $ reload = false ) { if ( ! $ this -> _validationLoaded || $ reload == true ) { $ validation = $ this -> xpdo -> getValidationRules ( $ this -> _class ) ; $ this -> _validationLoaded = true ; foreach ( $ validation as $ column => $ rules ) { foreach ( $ rules as $ name => $ rule ) { $ ... | Used to load validation from the object map . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.