public function setRecord(dmDoctrineRecord $record) { if ($record->getDmModule()->getKey() != $this->get('module')) { throw new dmException('Assigning record with wrong module'); } return $this->setCache('record', $record); }
protected function manageInsert(dmDoctrineRecord $record, $actionName, $actionConfig, $app) { $permission = new DmRecordPermission(); $permission->set('secure_module', $record->getDmModule()->getSfName()); $permission->set('secure_action', $actionName); $permission->set('secure_model', get_class($record)); $permission->set('secure_record', $record->get($record->getTable()->getIdentifier())); $permission->set('description', sprintf('Secure access to action %s of module %s for record "%s" of class %s', $actionName, $record->getDmModule()->getKey(), $record->__toString(), get_class($record))); $permission->save(); }
public function findOneByRecordWithI18n(dmDoctrineRecord $record) { $module = $record->getDmModule()->getKey(); if (isset($this->recordPageCache[$module][$record->get('id')])) { return $this->recordPageCache[$module][$record->get('id')]; } return $this->createQuery('p')->where('p.module = ?', $module)->andWhere('p.action = ?', 'show')->andWhere('p.record_id = ?', $record->get('id'))->withI18n(null, null, 'p')->fetchOne(); }