nyroFwk  0.2
Public Member Functions | Protected Member Functions | Protected Attributes
db_row Class Reference
Inheritance diagram for db_row:
object

Public Member Functions

 loadData (array $data)
 
 reload ($force=true)
 
 getDb ()
 
 getTable ()
 
 getWhere (array $prm=array())
 
 getForm ($showFields=null, array $formParam=array(), $passConfirm=true)
 
 isNew ()
 
 setNew ($new)
 
 insert ()
 
 save ()
 
 saveRelated ()
 
 saveI18n ()
 
 delete ()
 
 getId ()
 
 clear ()
 
 keyExists ($key)
 
 get ($key, $mode='flat')
 
 getI18n ($key, $mode='flat', $lang=null)
 
 getI18nRow ($lang=null)
 
 getI18nRows ()
 
 getValues ($mode='data')
 
 getInValues ($name=null, $mode='flatReal')
 
 set ($key, $value, $force=false)
 
 setI18n (array $values, $force=false, $lg=null)
 
 setValues (array $values, $force=false)
 
 getChanges ($name=null)
 
 getChangesTable ()
 
 getChangesOther ()
 
 getChangesI18n ()
 
 hasChange ($name=null)
 
 getLinked ($field=null, $reload=false)
 
 setLinked ($linked, $field=null)
 
 getRelated ($name)
 
 setRelated ($related, $name=null)
 
 whereClause ()
 
 getAround (array $prm=array())
 
 __call ($name, $prm)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 __get ($name)
 
 __set ($name, $val)
 
 __toString ()
 
 getAttr ($name)
 
 setAttr ($name, $value)
 
 getCfg ()
 

Protected Member Functions

 afterInit ()
 
 beforeInit ()
 

Protected Attributes

 $changes = array()
 
 $new = true
 
 $table
 
 $linked = array()
 
 $related = array()
 
 $i18nRows = array()
 
 $cfg
 

Detailed Description

Interface for db classes

Definition at line 10 of file row.class.php.

Member Function Documentation

◆ __call()

__call (   $name,
  $prm 
)

Definition at line 897 of file row.class.php.

◆ __get()

__get (   $name)

Definition at line 983 of file row.class.php.

◆ __set()

__set (   $name,
  $val 
)

Definition at line 987 of file row.class.php.

◆ __toString()

__toString ( )

Definition at line 991 of file row.class.php.

◆ afterInit()

afterInit ( )
protected

Definition at line 54 of file row.class.php.

◆ beforeInit()

beforeInit ( )
protectedinherited

Call just before the configuration initialisation

Definition at line 35 of file object.class.php.

◆ clear()

clear ( )

Clear all changes

Definition at line 379 of file row.class.php.

◆ delete()

delete ( )

Delete the current row

Returns
bool True if successful

Definition at line 357 of file row.class.php.

◆ get()

get (   $key,
  $mode = 'flat' 
)

Get a value

Parameters
string$keyFieldname
string$modeMode to retrieve the value, only used for related (flat or flatReal)
Returns
mixed The value

Definition at line 399 of file row.class.php.

◆ getAround()

getAround ( array  $prm = array())

Get the value of a field around the row

Parameters
array$prmParameter with key:
  • string field: Fieldname on which the comparison should be done
  • string returnId: True to return id instead of field
  • string where: Where clause to filter results
  • boolean asRow: Indicates if the result should be retrieved as db_row object or simple value. Should be set to true only when using ident
Returns
array With 2 indexes; 0 -> field value of the previous row (or null), 1 for the next one

Definition at line 850 of file row.class.php.

◆ getAttr()

getAttr (   $name)
inherited

Get an attribute

Parameters
string$nameAttribute name
Returns
mixed|null The attribute or null if not set

Definition at line 48 of file object.class.php.

◆ getCfg()

getCfg ( )
inherited

Get the configuration object

Returns
config

Definition at line 67 of file object.class.php.

◆ getChanges()

getChanges (   $name = null)

Get the changes for the table or only one field

Parameters
null | string$nameField Name or null
Returns
array|mixed|null

Definition at line 658 of file row.class.php.

◆ getChangesI18n()

getChangesI18n ( )

Get the i18n changes

Returns
array

Definition at line 690 of file row.class.php.

◆ getChangesOther()

getChangesOther ( )

Get the changes for the related table

Returns
array

Definition at line 681 of file row.class.php.

◆ getChangesTable()

getChangesTable ( )

Get the changes in the table only

Returns
array

Definition at line 672 of file row.class.php.

◆ getDb()

getDb ( )

Return the db object

Returns
db_abstract

Definition at line 121 of file row.class.php.

◆ getForm()

getForm (   $showFields = null,
array  $formParam = array(),
  $passConfirm = true 
)

Get the default form with the field information

Parameters
null | array$showFieldsnull to get every fields or array to select the fields
array$formParamParameter for the form
bool$passConfirmIndicate if the confirmation password should ba automatically added
Returns
form_db

Definition at line 152 of file row.class.php.

◆ getI18n()

getI18n (   $key,
  $mode = 'flat',
  $lang = null 
)

Get a i18n value

Parameters
string$keyFieldname
string$modeMode to retrieve the value, only used for related (flat or flatReal)
Returns
mixed The value

Definition at line 466 of file row.class.php.

◆ getI18nRow()

getI18nRow (   $lang = null)

Get a i18nRow

Parameters
string$langLang needed (if null, the current will be used or a new row will be created)
Returns
db_row

Definition at line 476 of file row.class.php.

◆ getI18nRows()

getI18nRows ( )

Get the instancied i18n rows

Returns
array

Definition at line 497 of file row.class.php.

◆ getId()

getId ( )

Return the current id

Returns
mixed

Definition at line 372 of file row.class.php.

◆ getInValues()

getInValues (   $name = null,
  $mode = 'flatReal' 
)

Get only one value, using the getValues function

Parameters
string$nameFieldname
string$modeMode used to retrieve data
Returns
mixed|null The value found or null
See also
getValues

Definition at line 588 of file row.class.php.

◆ getLinked()

getLinked (   $field = null,
  $reload = false 
)

Get a linked row

Parameters
string$fieldField Name
bool$reloadindicate if the row should be reloaded
Returns
db_row|null

Definition at line 722 of file row.class.php.

◆ getRelated()

getRelated (   $name)

Get the related rows

Parameters
stringRelated Name
Returns
db_rowset

Definition at line 768 of file row.class.php.

◆ getTable()

getTable ( )

Return the table object

Returns
db_table

Definition at line 130 of file row.class.php.

◆ getValues()

getValues (   $mode = 'data')

Get the values in an array

Parameters
string$modeReturn mode (data, flat, flatNoRelated, flatReal, flatRealNoRelated)
Returns
array

Definition at line 507 of file row.class.php.

◆ getWhere()

getWhere ( array  $prm = array())

Get a where object

Parameters
array$prmThe configuration for the where object
Returns
db_where

Definition at line 140 of file row.class.php.

◆ hasChange()

hasChange (   $name = null)

Check if the table has a change or only one field

Parameters
null | string$nameField Name or null
Returns
bool

Definition at line 703 of file row.class.php.

◆ insert()

insert ( )

Create a new row with the current values

Returns
mixed The last inserted id

Definition at line 263 of file row.class.php.

◆ isNew()

isNew ( )

Check if the row is new

Returns
bool

Definition at line 245 of file row.class.php.

◆ keyExists()

keyExists (   $key)

Check if a key exists in the current row

Returns
bool

Definition at line 388 of file row.class.php.

◆ loadData()

loadData ( array  $data)

Load data in the row

Parameters
array$data

Definition at line 78 of file row.class.php.

◆ offsetExists()

offsetExists (   $offset)

Check if an index exists. Required by interface ArrayAccess

Parameters
string$offset
Returns
bool

Definition at line 947 of file row.class.php.

◆ offsetGet()

offsetGet (   $offset)

Get a value. Required by interface ArrayAccess

Parameters
string$offset
Returns
mixed

Definition at line 958 of file row.class.php.

◆ offsetSet()

offsetSet (   $offset,
  $value 
)

Set a value. Required by interface ArrayAccess

Parameters
string$offset
db_row$value

Definition at line 969 of file row.class.php.

◆ offsetUnset()

offsetUnset (   $offset)

Remove an element. Required by interface ArrayAccess

Parameters
string$offset

Definition at line 979 of file row.class.php.

◆ reload()

reload (   $force = true)

Reload the row data against the db

Parameters
bool$forceForce reload or do it only if needed

Definition at line 109 of file row.class.php.

◆ save()

save ( )

Save the row in the database

Returns
bool|mixed True if successful or no changes was done|mixed if new and inserted, will be last insert id

Definition at line 280 of file row.class.php.

◆ saveI18n()

saveI18n ( )

Save the i18n values

Exceptions
nExceptionif is new

Definition at line 338 of file row.class.php.

◆ saveRelated()

saveRelated ( )

Save the related values if need

Exceptions
nExceptionif is new

Definition at line 302 of file row.class.php.

◆ set()

set (   $key,
  $value,
  $force = false 
)

Set a value

Parameters
string$keyFieldname
mixed$valueValue
bool$forceIndicates if the value should be replaced even if it's the same
Exceptions
nExceptionIf the key doesn't exist

Definition at line 603 of file row.class.php.

◆ setAttr()

setAttr (   $name,
  $value 
)
inherited

Set an attribute

Parameters
string$nameAttribute name
mixed$valueAttribute value

Definition at line 58 of file object.class.php.

◆ setI18n()

setI18n ( array  $values,
  $force = false,
  $lg = null 
)

Set i18n values

Parameters
array$valuesValues
bool$forceIndicates if the value should be replaced even if it's the same
string | null$lgLang

Definition at line 631 of file row.class.php.

◆ setLinked()

setLinked (   $linked,
  $field = null 
)

Set new linked values

Parameters
array | db_row$linkedarray of db_row or values of array OR db_row or array of values should be provide $field
string | null$fieldField Name (null if array set)

Definition at line 748 of file row.class.php.

◆ setNew()

setNew (   $new)

Set the new status

Parameters
bool$new

Definition at line 254 of file row.class.php.

◆ setRelated()

setRelated (   $related,
  $name = null 
)

Set new linked values

Parameters
array | db_row$relatedarray of db_row or values of array OR db_row or array of values should be provide $name
string | null$nameTable Name (null if array set)

Definition at line 793 of file row.class.php.

◆ setValues()

setValues ( array  $values,
  $force = false 
)

Set a values array

Parameters
array$values
bool$forceIndicates if the value should be replaced even if it's the same

Definition at line 647 of file row.class.php.

◆ whereClause()

whereClause ( )

Construct Where clause regarding the id

Returns
string

Definition at line 830 of file row.class.php.

Field Documentation

◆ $cfg

$cfg
protectedinherited

Definition at line 17 of file object.class.php.

◆ $changes

$changes = array()
protected

Definition at line 17 of file row.class.php.

◆ $i18nRows

$i18nRows = array()
protected

Definition at line 52 of file row.class.php.

◆ $linked

$linked = array()
protected

Definition at line 38 of file row.class.php.

◆ $new

$new = true
protected

Definition at line 24 of file row.class.php.

◆ $related

$related = array()
protected

Definition at line 45 of file row.class.php.

◆ $table

$table
protected

Definition at line 31 of file row.class.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13