/** * @param Set $linkedSet * @returns $this */ public function link(Set $linkedSet) { $bean = $this->getBean(); if ($bean === null) { $bean = $this->newBean(); } $bean->{$this->_('linkedSetId')} = $linkedSet->getBean()->getID(); R::store($bean); return $this; }
public function addTo(Set $set) { $setBean = $set->getBean(); $recordBean = $this->newBean(); foreach ($this->directives as $directive) { $recordBean->{$directive->field->cleanName} = $directive->value; } $setBean->{'own' . ucfirst($this->cleanName) . 'List'}[] = $recordBean; R::storeAll([$recordBean, $setBean]); return $this; }
public function addToSet(Set $set) { $setBean = $set->getBean(); if (R::count('skemafield', ' name = ? and skemaset_id = ? ', [$this->name, $setBean->getID()]) > 0) { if (Set::$strict) { throw new \Exception('Already exists on set'); } return $this; } $fieldBean = $this->newBean(); $set->fields[$this->cleanName] = $this; $this->set = $set; $setBean->ownSkemafieldList[] = $fieldBean; R::storeAll([$fieldBean, $setBean]); return $this; }