FOF30\Model\DataModel::isAssetsTracked PHP Method

isAssetsTracked() public method

Method to check if the record is treated as an ACL asset
public isAssetsTracked ( ) : boolean
return boolean [description]
    public function isAssetsTracked()
    {
        return $this->_trackAssets;
    }

Usage Example

コード例 #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;
 }