load() 공개 메소드

Method to load a row from the database by primary key. Used for JTableInterface compatibility.
부터: 3.2
public load ( mixed $keys = null, boolean $reset = true ) : boolean
$keys mixed An optional primary key value to load the row by, or an array of fields to match. If not set the instance property value is used.
$reset boolean True to reset the default values before loading the new row.
리턴 boolean True if successful. False if row not found.
예제 #1
0
파일: Assets.php 프로젝트: Joal01/fof
 public function onBeforeDelete(DataModel &$model, $oid)
 {
     if (!$model->isAssetsTracked()) {
         return true;
     }
     $k = $model->getKeyName();
     // If the table is not loaded, let's try to load it with the id
     if (!$model->{$k}) {
         $model->load($oid);
     }
     // If I have an invalid assetName I have to stop
     $name = $model->getAssetName();
     // Do NOT touch JTable here -- we are loading the core asset table which is a JTable, not a FOF Table
     $asset = \JTable::getInstance('Asset');
     if ($asset->loadByName($name)) {
         // Since we are using JTable, there is no way to mock it and test for failures :(
         // @codeCoverageIgnoreStart
         if (!$asset->delete()) {
             throw new \Exception($asset->getError());
         }
         // @codeCoverageIgnoreEnd
     }
     return true;
 }