jDaoFactoryBase

base class for all factory classes generated by the dao compiler.

package

jelix

subpackage

dao

Methods

__construct

__construct(\jDbConnection $conn) 

Arguments

$conn

\jDbConnection

the database connection

a callback function for some array_map call in generated methods.

_callbackBool(mixed $value) 

Arguments

$value

mixed

a callback function for some array_map call in generated methods.

_callbackQuote(mixed $value) 
since 1.2

Arguments

$value

mixed

a callback function for some array_map call in generated methods.

_callbackQuoteBin(mixed $value) 
since 1.2

Arguments

$value

mixed

create a WHERE clause with conditions on primary keys with given value. This method should be used for DELETE and UPDATE queries.

_getPkWhereClauseForNonSelect(array $pk) : string
abstract

Arguments

$pk

array

associated array : keys = primary key name, values : value of a primary key

Response

string

a 'where' clause (WHERE mypk = 'myvalue' ...)

create a WHERE clause with conditions on primary keys with given value. This method should be used for SELECT queries. You haven't to escape values.

_getPkWhereClauseForSelect(array $pk) : string
abstract

Arguments

$pk

array

associated array : keys = primary key name, values : value of a primary key

Response

string

a 'where' clause (WHERE mypk = 'myvalue' ...)

prepare the value ready to be used in a dynamic evaluation.

_prepareValue(mixed $value, mixed $fieldType, mixed $notNull = false) 
final

Arguments

$value

mixed

$fieldType

mixed

$notNull

mixed

return the number of all records.

countAll() : integer

Response

integer

the count

return the number of records corresponding to the conditions stored into the jDaoConditions object.

countBy(\jDaoConditions $searchcond, null|mixed $distinct = null) : integer
final
author

Loic Mathaud

contributor

Steven Jehannet

copyright

2007 Loic Mathaud

since 1.0b2

Arguments

$searchcond

\jDaoConditions

$distinct

null|mixed

Response

integer

the count

creates a record object for the dao.

createRecord() : \jDaoRecordBase

Response

\jDaoRecordBase

delete all record corresponding to the conditions stored into the jDaoConditions object.

deleteBy(\jDaoConditions $searchcond) : \number
final
since 1.0beta3

Arguments

$searchcond

\jDaoConditions

Response

\number

of deleted rows

return all records.

findAll() : \jDbResultSet

Response

\jDbResultSet

return all record corresponding to the conditions stored into the jDaoConditions object.

findBy(\jDaoConditions $searchcond, integer $limitOffset, integer $limitCount = null) : \jDbResultSet
final

you can limit the number of results by given an offset and a count.

Arguments

$searchcond

\jDaoConditions

$limitOffset

integer

$limitCount

integer

Response

\jDbResultSet

finish to initialise a record set. Could be redefined in child class to do additionnal processes.

finishInitResultSet(\jDbResultSet $rs) 

Arguments

$rs

\jDbResultSet

the record set

list of id of primary properties.

getPrimaryKeyNames() : array
since 1.0beta3

Response

array

list of properties name which contains primary keys

getPrimaryTable

getPrimaryTable() : string
since 1.3.2

Response

string

the id (alias or realname) of the primary table

informations on all properties.

getProperties() : array

keys are property name, and values are an array like that :

 array (
 'name' => 'name of property',
 'fieldName' => 'name of fieldname',
 'regExp' => NULL, // or the regular expression to test the value
 'required' => true/false,
 'isPK' => true/false, //says if it is a primary key
 'isFK' => true/false, //says if it is a foreign key
 'datatype' => '', // type of data : string
 'unifiedType'=> '' // the corresponding unified type
 'table' => 'grp', // alias of the table the property is attached to
 'updatePattern' => '%s',
 'insertPattern' => '%s',
 'selectPattern' => '%s',
 'sequenceName' => '', // name of the sequence when field is autoincrement
 'maxlength' => NULL, // or a number
 'minlength' => NULL, // or a number
 'ofPrimaryTable' => true/false
 'autoIncrement'=> true/false
) 
since 1.0beta3

Response

array

informations on all properties

getTables

getTables() : array
since 1.3.2
see \jDaoFactoryBase::$_tables

Response

array

informations on tables

save a new record into the database if the dao record has an autoincrement key, its corresponding property is updated.

insert(\jDaoRecordBase $record) : integer
abstract

Arguments

$record

\jDaoRecordBase

the record to save

Response

integer

1 if success (the number of affected rows). False if the query has failed.

save a modified record into the database.

update(\jDaoRecordBase $record) : integer
abstract

Arguments

$record

\jDaoRecordBase

the record to save

Response

integer

1 if success (the number of affected rows). False if the query has failed.

Properties

informations on tables.

_tables : array

Keys of elements are the alias of the table. values are arrays like that :

 array (
  'name' => ' the table alias',
  'realname' => 'the real name of the table',
  'pk' => array ( list of primary keys name ),
  'fields' => array ( list of property name attached to this table )
)
var

Type(s)

array

the id of the primary table.

_primaryTable : string
var

Type(s)

string

the database connector.

_conn : \jDbConnection
var

Type(s)

\jDbConnection

the select clause you can reuse for a specific SELECT query.

_selectClause : string
var

Type(s)

string

the from clause you can reuse for a specific SELECT query.

_fromClause : string
var

Type(s)

string

the where clause you can reuse for a specific SELECT query.

_whereClause : string
var

Type(s)

string

the class name of a dao record for this dao factory.

_DaoRecordClassName : string
var

Type(s)

string

the selector of the dao, to be sent with events.

_daoSelector : string
var

Type(s)

string

_deleteBeforeEvent

_deleteBeforeEvent : 
since

Type(s)

_deleteAfterEvent

_deleteAfterEvent : 
since

Type(s)

_deleteByBeforeEvent

_deleteByBeforeEvent : 
since

Type(s)

_deleteByAfterEvent

_deleteByAfterEvent : 
since

Type(s)

trueValue

trueValue : 
since

Type(s)

falseValue

falseValue : 
since

Type(s)