B.3. Methods

When reasonable, methods in Solar classes conform to these names when they perform these related functions:

Table B.1. Conventional Method Names
Method Name Usage Examples
delete deletes data from storage (instead of remove/destroy) $table->delete($where)
fetch or fetchOne returns one entry from storage (instead of get/find/retrieve) $cache->fetch($id)
fetchBy or fetchOneBy returns one entry from storage, using alternative or additional criteria named in the method (instead of fetchWith/fetchFor) $table->fetchByName($name)
fetchAll returns multiple entries from storage $table->fetchAll()
fetchAllBy returns multiple entries from storage, using alternative or additional criteria named in the method $table->fetchAllByName($name)
fix modifies a config value, parameter, or property to conform to a standard format or structure $fetch->fixParams()
get gets the value of a property $obj->getProperty()
has or exists checks to see if a value or property exists, returns boolean true or false $session->hasFlash()
insert inserts new data in storage (instead of add/new/save) $table->insert($data)
is the method returns boolean true/false $cache->isActive()
load loads property values from an external source $role->load($handle)
sanitize forces a value to match a known format $filter->sanitizeFloat($value)
save updates existing data or inserts new data in storage (instead of replace) $cache->save($id, $data)
set sets the value of a property $obj->setProperty($value)
update updates existing data in storage (instead of save/change) $table->update($data, $where)
validate checks that a value matches a known format, returns boolean true/false $filter->validateFloat($value)

These names are not set in stone, but are used when reasonable.



Local