Class Model
	
	
This class establishes and maintains a connection to a PDO resource, and
provides methods for interacting with that resource
	 
	
	
		Indirect known subclasses
		
			Accounts, 
			ApiKeys, 
			Currencies, 
			EmailGroups, 
			Emails, 
			Encryption, 
			GatewayManager, 
			Invoices, 
			InvoiceTemplateManager, 
			Languages, 
			Logs, 
			Marketplace, 
			CalendarEvents, 
			ModuleClientMeta, 
			ModuleManager, 
			Navigation, 
			PackageGroups, 
			PackageOptionGroups, 
			PackageOptions, 
			Packages, 
			Payments, 
			Permissions, 
			PluginManager, 
			ClientGroups, 
			Pricings, 
			ReportManager, 
			ServiceChanges, 
			Services, 
			Settings, 
			Staff, 
			StaffGroups, 
			States, 
			Taxes, 
			Themes, 
			Clients, 
			Transactions, 
			Users, 
			Companies, 
			Contacts, 
			Countries, 
			Coupons, 
			CronTasks
		
	 
	
		Methods summary
		
		
			| 
				 public 
				
				
				 | 
			#
			__construct( array $db_info = null )
				
Creates a new Model object that establishes a new PDO connection using the
given database info, or the default configured info set in the database config
file if no info is given 
				
Creates a new Model object that establishes a new PDO connection using the
given database info, or the default configured info set in the database config
file if no info is given Parameters
						$db_infoarray$db_info Database information for this connection
 | 
		
			| 
				 public 
				
				
				 | 
			#
			setFetchMode( mixed $fetch_mode )
				
Sets the fetch mode to the given value, returning the old value 
				
Sets the fetch mode to the given value, returning the old value Parameters
						$fetch_modemixed$fetch_mode The PDO:FETCH_* constant (int) to fetch records by, null to use
default setting
 | 
		
			| 
				 public 
				string
				
				 | 
			#
			lastInsertId( string $name = null )
				
Get the last inserted ID Parameters
						$namestring$name The name of the sequence object from which the ID should be returned
Returns
						stringThe last ID inserted, if available
 
 Throws
						ExceptionThrown when no PDO connection has been established
					 | 
		
			| 
				 public 
				
				
				 | 
			#
			setAttribute( long $attribute, integer $value )
				
Sets the given value to the given attribute for this connection 
				
Sets the given value to the given attribute for this connection Parameters
						$attributelong$attribute The attribute to set
$valueinteger$value The value to assign to the attribute
Throws
						ExceptionThrown when no PDO connection has been established
					 | 
		
			| 
				 public 
				PDOStatement | 
			#
			query( string $sql )
				
Query the Database using the given prepared statement and argument list 
				
Query the Database using the given prepared statement and argument list Parameters
						$sqlstring$sql The SQL to execute
Returns
						PDOStatementThe resulting PDOStatement from the execution of this query
					 Throws
						ExceptionThrown when no PDO connection has been established
					 | 
		
			| 
				 public 
				PDOStatement | 
			#
			prepare( string $sql, integer $fetch_mode = null )
				
Prepares an SQL statement to be executed by the PDOStatement::execute()
method. Useful when executing the same query with different bound
parameters. 
				
Prepares an SQL statement to be executed by the PDOStatement::execute()
method. Useful when executing the same query with different bound
parameters. Parameters
						$sqlstring$sql The SQL statement to prepare
$fetch_modeinteger$fetch_mode The PDO::FETCH_* constant, defaults to "Database.fetch_mode" config
setting
Returns
						PDOStatementThe resulting PDOStatement from the preparation of this query
					 See | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			begin( )
				
Begin a transaction Returns
						booleanTrue if the transaction was successfully opened, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			rollBack( )
				
Rolls back and closes the transaction 
				
Rolls back and closes the transaction Returns
						booleanTrue if the transaction was successfully rolled back and closed, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			commit( )
				
Commits a transaction Returns
						booleanTrue if the transaction was successfully commited and closed, false otherwise
 
 | 
		
			| 
				 public 
				PDO | 
			#
			getConnection( )
				
Returns the connection's PDO object if a connection has been established,
null otherwise. 
				
Returns the connection's PDO object if a connection has been established,
null otherwise. Returns
						PDOThe PDO connection object, null if no connection exists
					 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			affectedRows( PDOStatement$statement = null )
				
Get the number of rows affected by the last query 
				
Get the number of rows affected by the last query Parameters
						$statementPDOStatement$statement The statement to count affected rows on, if null the last
Model::query() statement will be used.
Returns
						integerThe number of rows affected by the previous query
 
 Throws
						ExceptionThrown when called prior to Model::query()
					 | 
		
			| 
				 public static
				string
				
				 | 
			#
			makeDSN( array $db )
				
Build a DSN string using the given array of parameters 
				
Build a DSN string using the given array of parameters Parameters
						$dbarray$db An array of parameters
Returns
						stringThe DSN string
 
 Throws
						ExceptionThrown when $db contains invalid parameters
					 | 
		
		Magic methods summary