示例#1
0
 /**
  * Create a field object for the many-to-many relationship matching the
  * supplied name.
  *
  * @param string $name
  * @return \Dewdrop\Db\ManyToMany\Field
  */
 public function instantiate($name)
 {
     $rel = $this->table->getManyToManyRelationship($name);
     $field = new Field($this->table, $name, $rel->getFieldMetadata());
     $field->setManyToManyRelationship($rel);
     return $field;
 }
 public function assembleUserMessage(Row $user)
 {
     $lists = [];
     if ($this->changes->hasAdditions()) {
         $lists[] = $this->addVerb . ' ' . $this->assembleList($this->changes->getAdditions());
     }
     if ($this->changes->hasRemovals()) {
         $lists[] = $this->removeVerb . ' ' . $this->assembleList($this->changes->getRemovals());
     }
     $lists = implode(' and ', $lists);
     return "{$user->shortcode()} {$lists} on {$this->field->getLabel()} for {$this->subject->shortcode()}.";
 }
示例#3
0
 /**
  * Use a ManyToMany field to render the checkbox list.
  *
  * @param Field $field
  * @param array $options
  * @return string
  */
 protected function directField(Field $field, array $options = array())
 {
     $fieldDefaults = array('name' => $field->getControlName(), 'id' => $field->getHtmlId(), 'value' => $field->getValue(), 'options' => $field->getOptionPairs()->fetch());
     return $this->directArray($fieldDefaults + $options);
 }