Propel API
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 <code>BaseObject</code> 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 <code> $book = new Book(); $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); </code>

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

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

__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.

Details

at line 62
public __construct()

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

at line 71
public boolean isModified()

Returns whether the object has been modified.

Return Value

boolean True if the object has been modified.

at line 82
public boolean isColumnModified(string $col)

Has specified column been modified?

Parameters

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

Return Value

boolean True if $col has been modified.

at line 91
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 103
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 114
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 123
public boolean isDeleted()

Whether this object has been deleted.

Return Value

boolean The deleted state of this object.

at line 133
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 143
public boolean preSave(PropelPDO $con = null)

Code to be run before persisting the object

Parameters

PropelPDO $con

Return Value

boolean

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

Code to be run after persisting the object

Parameters

PropelPDO $con

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

Code to be run before inserting to database

Parameters

PropelPDO $con

Return Value

boolean

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

Code to be run after inserting to database

Parameters

PropelPDO $con

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

Code to be run before updating the object in database

Parameters

PropelPDO $con

Return Value

boolean

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

Code to be run after updating the object in database

Parameters

PropelPDO $con

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

Code to be run before deleting the object in database

Parameters

PropelPDO $con

Return Value

boolean

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

Code to be run after deleting the object in database

Parameters

PropelPDO $con

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

Code to be run after object hydration

Parameters

$row
$startcol
$rehydrate

at line 223
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 242
public Whether equals(obj $obj)

Compares this with another <code>BaseObject</code> instance.

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

Parameters

obj $obj The object to compare to.

Return Value

Whether equal to the object specified.

at line 264
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 280
public array getVirtualColumns()

Get the associative array of the virtual columns in this object

Return Value

array

at line 290
public boolean hasVirtualColumn($name)

Checks the existence of a virtual column in this object

Parameters

$name

Return Value

boolean

at line 302
public mixed getVirtualColumn($name)

Get the value of a virtual column in this object

Parameters

$name

Return Value

mixed

Exceptions

PropelException

at line 319
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 351
public BaseObject importFrom(mixed $parser, string $data)

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

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 372
public string exportTo(mixed $parser, boolean $includeLazyLoadColumns = true)

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

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 385
public __sleep()

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

at line 405
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