public function setRelationship_only() { parent::setRelationship_only(); $this->one_to_many->setRelationship_only(); }
function __construct($definition) { parent::__construct($definition); }
function addFromPost() { $definition = array(); require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php'; foreach (AbstractRelationship::$definitionKeys as $key) { if (!empty($_REQUEST[$key])) { $definition[$key] = $key == 'relationship_type' ? AbstractRelationship::parseRelationshipType($_REQUEST[$key]) : $_REQUEST[$key]; } } // if this is a change to an existing relationship, and it is not readonly, then delete the old one if (!empty($_REQUEST['relationship_name'])) { if ($relationship = $this->get($_REQUEST['relationship_name'])) { unset($definition['relationship_name']); // in case the related modules have changed; this name is probably no longer appropriate if (!$relationship->readonly()) { $this->delete($_REQUEST['relationship_name']); } } } $newRelationship = RelationshipFactory::newRelationship($definition); // TODO: error handling in case we get a badly formed definition and hence relationship $this->add($newRelationship); return $newRelationship; }
public function __construct($options = array()) { parent::__construct($options); if (!$this->class_name) { $this->set_inferred_class_name(); } //infer from class_name if (!$this->foreign_key) { $this->foreign_key = array($this->keyify($this->class_name)); } $this->primary_key = array(Table::load($this->class_name)->pk[0]); }
/** * @param AbstractRelationship $relationship * @return void */ private function removeAppLangStrings($relationship) { $def = $relationship->getDefinition(); if (strtolower($def['rhs_module']) == 'activities' && !empty($_REQUEST['view_package']) && !empty($_REQUEST['view_module'])) { $mb = new ModuleBuilder(); $module = $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']); $appStrings = $module->getAppListStrings(); foreach (array('parent_type_display', 'record_type_display', 'record_type_display_notes') as $key) { if (isset($appStrings[$key][$module->key_name])) { unset($appStrings[$key][$module->key_name]); } } $module->setAppListStrings('en_us', $appStrings); $module->save(); } }
public function __construct($options = array()) { parent::__construct($options); if (!$this->class_name) { $this->set_inferred_class_name(); } //infer from class_name if (!$this->foreign_key) { $this->foreign_key = array(Inflector::instance()->keyify($this->class_name)); } }
public function getLinkFieldDefinition($sourceModule, $relationshipName) { return parent::getLinkFieldDefinition($sourceModule, $relationshipName); }
public function __construct($options = array()) { parent::__construct($options); if (!$this->className) { $this->setInferredClassName(); } //infer from class_name if (!$this->foreignKey) { $this->foreignKey = array(Inflector::instance()->keyify($this->className)); } $this->primaryKey = array(Table::load($this->className)->pk[0]); }