/** * Gets fields which Externalizer or Internalizer should modify. * @return array */ public function getFieldsForMap() { return array('ENTITY_TYPE' => array('IN' => function ($externalValue) { switch ($externalValue) { case 'user': return ProxyType\User::className(); case 'group': return ProxyType\Group::className(); case 'common': return ProxyType\Common::className(); } return null; }, 'OUT' => function ($internalValue) { switch ($internalValue) { case ProxyType\User::className(): return 'user'; case ProxyType\Group::className(): return 'group'; case ProxyType\Common::className(): return 'common'; case ProxyType\RestApp::className(): return 'restapp'; } return null; })); }
/** * Returns storage by app id (using in REST). * * @param string $appId Id of application in REST. * @return null|Storage */ public function getStorageByRestApp($appId) { return Storage::load(array('MODULE_ID' => self::INTERNAL_MODULE_ID, 'ENTITY_TYPE' => ProxyType\RestApp::className(), 'ENTITY_ID' => $appId), array('ROOT_OBJECT')); }