/** * Get an array of AssetIndexDataModel for all created transforms for a file. * * @param AssetFileModel $file * * @return array */ public function getAllCreatedTransformsForFile(AssetFileModel $file) { $records = craft()->db->createCommand()->select('*')->from('assettransformindex')->where('fileId = :fileId', array(':fileId' => $file->id))->queryAll(); return AssetTransformIndexModel::populateModels($records); }
/** * Store a transform index data by it's model. * * @param AssetTransformIndexModel $data * @return AssetTransformIndexModel */ public function storeTransformIndexData(AssetTransformIndexModel $data) { if (!empty($data->id)) { $id = $data->id; craft()->db->createCommand()->update('assettransformindex', $data->getAttributes(null, true), 'id = :id', array(':id' => $id)); } else { craft()->db->createCommand()->insert('assettransformindex', $data->getAttributes(null, true)); $data->id = craft()->db->getLastInsertID(); } return $data; }