Class

BaseObject

abstract class BaseObject

This class contains attributes and methods that are used by all business objects within the system.

Methods

__construct()

Empty constructor (this allows people with their own BaseObject implementation to use its constructor)

boolean isModified()

Returns whether the object has been modified.

boolean isColumnModified(string $col)

Has specified column been modified?

array getModifiedColumns()

Get the columns that have been modified in this object.

true, isNew()

Returns whether the object has ever been saved.

setNew(boolean $b)

Setter for the isNew attribute.

boolean isDeleted()

Whether this object has been deleted.

void setDeleted(boolean $b)

Specify whether this object has been deleted.

boolean preSave(PropelPDO $con = null)

Code to be run before persisting the object

postSave(PropelPDO $con = null)

Code to be run after persisting the object

boolean preInsert(PropelPDO $con = null)

Code to be run before inserting to database

postInsert(PropelPDO $con = null)

Code to be run after inserting to database

boolean preUpdate(PropelPDO $con = null)

Code to be run before updating the object in database

postUpdate(PropelPDO $con = null)

Code to be run after updating the object in database

boolean preDelete(PropelPDO $con = null)

Code to be run before deleting the object in database

postDelete(PropelPDO $con = null)

Code to be run after deleting the object in database

postHydrate($row, $startcol, $rehydrate = false)

Code to be run after object hydration

void resetModified(string $col = null)

Sets the modified state for the object to be false.

Whether equals(obj $obj)

Compares this with another BaseObject instance.

int hashCode()

If the primary key is not null, return the hashcode of the primary key.

array getVirtualColumns()

Get the associative array of the virtual columns in this object

boolean hasVirtualColumn($name)

Checks the existence of a virtual column in this object

mixed getVirtualColumn($name)

Get the value of a virtual column in this object

BaseObject setVirtualColumn(string $name, mixed $value)

Set the value of a virtual column in this object

BaseObject importFrom(mixed $parser, string $data)

Populate the current object from a string, using a given parser format $book = new Book(); $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');

string exportTo(mixed $parser, boolean $includeLazyLoadColumns = true)

Export the current object properties to a string, using a given parser format $book = BookQuery::create()->findPk(9012); echo $book->exportTo('JSON'); => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');

__sleep()

Clean up internal collections prior to serializing Avoids recursive loops that turn into segmentation faults when serializing

array|string __call(string $name, mixed $params)

Catches calls to undefined methods.

BaseObject fromXML(string $data)

Populate the object from an XML string

BaseObject fromYAML(string $data)

Populate the object from a YAML string

BaseObject fromJSON(string $data)

Populate the object from a JSON string

BaseObject fromCSV(string $data)

Populate the object from a CSV string

string toXML(boolean $includeLazyLoadColumns)

Export the object to an XML string

string toYAML(boolean $includeLazyLoadColumns)

Export the object to a YAML string

string toJSON(boolean $includeLazyLoadColumns)

Export the object to a JSON string

string toCSV(boolean $includeLazyLoadColumns)

Export the object to a CSV string

Details

at line 66
public __construct()

Empty constructor (this allows people with their own BaseObject implementation to use its constructor)

at line 75
public boolean isModified()

Returns whether the object has been modified.

Return Value

boolean True if the object has been modified.

at line 87
public boolean isColumnModified(string $col)

Has specified column been modified?

Parameters

string $col column fully qualified name (BasePeer::TYPECOLNAME), e.g. Book::AUTHORID

Return Value

boolean True if $col has been modified.

at line 97
public array getModifiedColumns()

Get the columns that have been modified in this object.

Return Value

array A unique list of the modified column names for this object.

at line 109
public true, isNew()

Returns whether the object has ever been saved.

This will be false, if the object was retrieved from storage or was created and then saved.

Return Value

true, if the object has never been persisted.

at line 120
public setNew(boolean $b)

Setter for the isNew attribute.

This method will be called by Propel-generated children and Peers.

Parameters

boolean $b the state of the object.

at line 130
public boolean isDeleted()

Whether this object has been deleted.

Return Value

boolean The deleted state of this object.

at line 142
public void setDeleted(boolean $b)

Specify whether this object has been deleted.

Parameters

boolean $b The deleted state of this object.

Return Value

void

at line 154
public boolean preSave(PropelPDO $con = null)

Code to be run before persisting the object

Parameters

PropelPDO $con

Return Value

boolean

at line 164
public postSave(PropelPDO $con = null)

Code to be run after persisting the object

Parameters

PropelPDO $con

at line 175
public boolean preInsert(PropelPDO $con = null)

Code to be run before inserting to database

Parameters

PropelPDO $con

Return Value

boolean

at line 185
public postInsert(PropelPDO $con = null)

Code to be run after inserting to database

Parameters

PropelPDO $con

at line 196
public boolean preUpdate(PropelPDO $con = null)

Code to be run before updating the object in database

Parameters

PropelPDO $con

Return Value

boolean

at line 206
public postUpdate(PropelPDO $con = null)

Code to be run after updating the object in database

Parameters

PropelPDO $con

at line 217
public boolean preDelete(PropelPDO $con = null)

Code to be run before deleting the object in database

Parameters

PropelPDO $con

Return Value

boolean

at line 227
public postDelete(PropelPDO $con = null)

Code to be run after deleting the object in database

Parameters

PropelPDO $con

at line 236
public postHydrate($row, $startcol, $rehydrate = false)

Code to be run after object hydration

Parameters

$row
$startcol
$rehydrate

at line 247
public void resetModified(string $col = null)

Sets the modified state for the object to be false.

Parameters

string $col If supplied, only the specified column is reset.

Return Value

void

at line 267
public Whether equals(obj $obj)

Compares this with another BaseObject instance.

If obj is an instance of BaseObject, delegates to equals(BaseObject). Otherwise, returns false.

Parameters

obj $obj The object to compare to.

Return Value

Whether equal to the object specified.

at line 289
public int hashCode()

If the primary key is not null, return the hashcode of the primary key.

Otherwise, return the hash code of the object.

Return Value

int Hashcode

at line 305
public array getVirtualColumns()

Get the associative array of the virtual columns in this object

Return Value

array

at line 315
public boolean hasVirtualColumn($name)

Checks the existence of a virtual column in this object

Parameters

$name

Return Value

boolean

at line 327
public mixed getVirtualColumn($name)

Get the value of a virtual column in this object

Parameters

$name

Return Value

mixed

Exceptions

PropelException

at line 344
public BaseObject setVirtualColumn(string $name, mixed $value)

Set the value of a virtual column in this object

Parameters

string $name The virtual column name
mixed $value The value to give to the virtual column

Return Value

BaseObject The current object, for fluid interface

at line 377
public BaseObject importFrom(mixed $parser, string $data)

Populate the current object from a string, using a given parser format $book = new Book(); $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');

Parameters

mixed $parser A PropelParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
string $data The source data to import from

Return Value

BaseObject The current object, for fluid interface

at line 399
public string exportTo(mixed $parser, boolean $includeLazyLoadColumns = true)

Export the current object properties to a string, using a given parser format $book = BookQuery::create()->findPk(9012); echo $book->exportTo('JSON'); => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');

Parameters

mixed $parser A PropelParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.

Return Value

string The exported data

at line 412
public __sleep()

Clean up internal collections prior to serializing Avoids recursive loops that turn into segmentation faults when serializing

at line 432
public array|string __call(string $name, mixed $params)

Catches calls to undefined methods.

Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). Allows to define default __call() behavior if you use a custom BaseObject

Parameters

string $name
mixed $params

Return Value

array|string

Exceptions

PropelException

at line 30
BaseObject fromXML(string $data)

Populate the object from an XML string

Parameters

string $data

Return Value

BaseObject

at line 30
BaseObject fromYAML(string $data)

Populate the object from a YAML string

Parameters

string $data

Return Value

BaseObject

at line 30
BaseObject fromJSON(string $data)

Populate the object from a JSON string

Parameters

string $data

Return Value

BaseObject

at line 30
BaseObject fromCSV(string $data)

Populate the object from a CSV string

Parameters

string $data

Return Value

BaseObject

at line 30
string toXML(boolean $includeLazyLoadColumns)

Export the object to an XML string

Parameters

boolean $includeLazyLoadColumns

Return Value

string

at line 30
string toYAML(boolean $includeLazyLoadColumns)

Export the object to a YAML string

Parameters

boolean $includeLazyLoadColumns

Return Value

string

at line 30
string toJSON(boolean $includeLazyLoadColumns)

Export the object to a JSON string

Parameters

boolean $includeLazyLoadColumns

Return Value

string

at line 30
string toCSV(boolean $includeLazyLoadColumns)

Export the object to a CSV string

Parameters

boolean $includeLazyLoadColumns

Return Value

string