/** * Gets the name of the component relationship, for example as defined in a $has_many * relation on a Page * * @boolean $pluralize * @return string */ public function getName($pluralize = true) { if (!$this->get('Name')) { return $pluralize ? SilverSmithUtil::pluralize($this->key) : $this->key; } return $this->get('Name'); }
/** * Gets an array of $belongs_many_many vars for the generated code, in $RelationName => $ClassName pairs * * @return BedrockNode */ public function getBelongsManyManyVars() { $belongs = array(); foreach (SilverSmithProject::get_all_nodes() as $node) { if ($components = $node->getComponents()) { if ($me = $components->get($this->key)) { if ($me->getType() == "manymany") { $belongs[SilverSmithUtil::pluralize($node->getKey())] = $node->getKey(); } } } } return empty($belongs) ? false : new BedrockNode("Root", $belongs, "Root"); }