Class jDaoFactoryBase

Description

base class for all factory classes generated by the dao compiler

  • abstract:

Located in /dao/jDaoFactoryBase.class.php (line 30)


	
			
Variable Summary
Method Summary
jDaoFactoryBase __construct (jDbConnection $conn)
int countAll ()
int countBy (jDaoConditions $searchcond, [ $distinct = null])
int delete (string 0)
number deleteBy (jDaoConditions $searchcond)
jDbResultSet findBy (jDaoConditions $searchcond, [int $limitOffset = 0], [int $limitCount = null])
jDaoRecordBase get (string 0)
array getProperties ()
void insert (jDaoRecordBase $record)
void update (jDaoRecordBase $record)
void _createConditionsClause ( $daocond, [ $forSelect = true])
void _createGroupClause ( $daocond)
void _createOrderClause ( $daocond)
void _generateCondition ( $condition,  &$fields,  $forSelect, [ $principal = true])
string _getPkWhereClauseForNonSelect (array $pk)
string _getPkWhereClauseForSelect (array $pk)
void _prepareValue ( $value,  $fieldType, [ $notNull = false])
Variables
mixed $falseValue = 0 (line 106)
  • since: 1.0
  • access: protected
mixed $trueValue = 1 (line 102)
  • since: 1.0
  • access: protected
jDbConnection $_conn (line 54)

the database connector

  • access: protected
string $_DaoRecordClassName (line 74)

the class name of a dao record for this dao factory

  • access: protected
string $_daoSelector (line 80)

the selector of the dao, to be sent with events

  • access: protected
mixed $_deleteAfterEvent = false (line 89)
  • since: 1.0
  • access: protected
mixed $_deleteBeforeEvent = false (line 85)
  • since: 1.0
  • access: protected
mixed $_deleteByAfterEvent = false (line 97)
  • since: 1.0
  • access: protected
mixed $_deleteByBeforeEvent = false (line 93)
  • since: 1.0
  • access: protected
string $_fromClause (line 64)

the from clause you can reuse for a specific SELECT query

  • access: protected
string $_primaryTable (line 49)

the id of the primary table

  • access: protected
string $_selectClause (line 59)

the select clause you can reuse for a specific SELECT query

  • access: protected
array $_tables (line 44)

informations on tables

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 )
 )

  • access: protected
string $_whereClause (line 69)

the where clause you can reuse for a specific SELECT query

  • access: protected
Methods
Constructor __construct (line 110)
jDaoFactoryBase __construct (jDbConnection $conn)
countAll (line 168)

return the number of all records

  • return: the count
  • access: public
int countAll ()
countBy (line 277)

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

  • return: the count
  • author: Loic Mathaud
  • copyright: 2007 Loic Mathaud
  • since: 1.0b2
  • access: public
int countBy (jDaoConditions $searchcond, [ $distinct = null])
delete (line 205)

delete a record corresponding to the given key

  • return: the number of deleted record
  • access: public
int delete (string 0)
  • string 0: one or more primary key
deleteBy (line 302)

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

  • return: of deleted rows
  • since: 1.0beta3
  • access: public
number deleteBy (jDaoConditions $searchcond)
findAll (line 158)

return all records

  • access: public
jDbResultSet findAll ()
findBy (line 249)

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

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

  • access: public
jDbResultSet findBy (jDaoConditions $searchcond, int $limitOffset, [int $limitCount = null])
finishInitResultSet (line 517)

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

to do additionnal processes

  • access: protected
void finishInitResultSet (jDbResultSet $rs)
get (line 180)

return the record corresponding to the given key

  • access: public
jDaoRecordBase get (string 0)
  • string 0: one or more primary key
getPrimaryKeyNames (line 152)

list of id of primary properties

  • return: list of properties name which contains primary keys
  • abstract:
  • since: 1.0beta3
  • access: public
array getPrimaryKeyNames ()
getProperties (line 145)

informations on all properties

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
  'table' => 'grp', // alias of the table the property is attached to
  'updatePattern' => '%s',
  'insertPattern' => '%s',
  'selectPattern' => '%s',
  'sequenceName' => '', // name of the sequence when type is autoincrement
  'maxlength' => NULL, // or a number
  'minlength' => NULL, // or a number
  'ofPrimaryTable' => true/false,
  'needsQuotes' => tree/false, // says if the value need to enclosed between quotes
 )

  • return: informations on all properties
  • abstract:
  • since: 1.0beta3
  • access: public
array getProperties ()
insert (line 232)

save a new record into the database

if the dao record has an autoincrement key, its corresponding property is updated

  • abstract:
  • access: public
void insert (jDaoRecordBase $record)
update (line 238)

save a modified record into the database

  • abstract:
  • access: public
void update (jDaoRecordBase $record)
_createConditionsClause (line 340)
  • access: protected
void _createConditionsClause ( $daocond, [ $forSelect = true])
  • $daocond
  • $forSelect
_createGroupClause (line 365)
  • access: protected
void _createGroupClause ( $daocond)
  • $daocond
_createOrderClause (line 348)
  • access: protected
void _createOrderClause ( $daocond)
  • $daocond
_generateCondition (line 383)
  • access: protected
void _generateCondition ( $condition,  &$fields,  $forSelect, [ $principal = true])
  • $condition
  • &$fields
  • $forSelect
  • $principal
_getPkWhereClauseForNonSelect (line 335)

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

  • return: a 'where' clause (WHERE mypk = 'myvalue' ...)
  • abstract:
  • access: protected
string _getPkWhereClauseForNonSelect (array $pk)
  • array $pk: associated array : keys = primary key name, values : value of a primary key
_getPkWhereClauseForSelect (line 327)

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.

  • return: a 'where' clause (WHERE mypk = 'myvalue' ...)
  • abstract:
  • access: protected
string _getPkWhereClauseForSelect (array $pk)
  • array $pk: associated array : keys = primary key name, values : value of a primary key
_prepareValue (line 475)

prepare the value ready to be used in a dynamic evaluation

  • access: protected
void _prepareValue ( $value,  $fieldType, [ $notNull = false])
  • $value
  • $fieldType
  • $notNull

Documentation generated on Thu, 22 Mar 2012 22:14:40 +0100 by phpDocumentor 1.4.3