setLabelField() 공개 메소드

public setLabelField ( string $labelField )
$labelField string
예제 #1
0
    public function testObjectBrowserColumns()
    {
        $xml = '<object id="View">
  <label>Template View</label>
  <desc>Template views</desc>
  <storageService>\\Admin\\ObjectView</storageService>
  <labelField>name</labelField>
  <nested>true</nested>
  <fields>
    <field id="path" type="text" primaryKey="true">
      <label>Path</label>
    </field>
    <field id="name" type="text">
      <label>File name</label>
    </field>
  </fields>
  <browserColumns>
    <field id="path" type="text">
      <label>Path</label>
    </field>
    <field id="name" type="text">
      <label>File name</label>
    </field>
  </browserColumns>
</object>';
        $object = new Object(null, $this->getJarves());
        $object->setId('View');
        $object->setLabel('Template View');
        $object->setDesc('Template views');
        $object->setLabelField('name');
        $object->setNested(true);
        $object->setStorageService('\\Admin\\ObjectView');
        $field1 = new Field(null, $this->getJarves());
        $field1->setId('path');
        $field1->setPrimaryKey(true);
        $field1->setLabel('Path');
        $field1->setType('text');
        $field2 = new Field(null, $this->getJarves());
        $field2->setId('name');
        $field2->setLabel('File name');
        $field2->setType('text');
        $object->setFields(array($field1, $field2));
        $field1 = new Field(null, $this->getJarves());
        $field1->setId('path');
        $field1->setLabel('Path');
        $field1->setType('text');
        $field2 = new Field(null, $this->getJarves());
        $field2->setId('name');
        $field2->setLabel('File name');
        $field2->setType('text');
        $object->setBrowserColumns(array($field1, $field2));
        $reverse = new Object($xml, $this->getJarves());
        $this->assertEquals($xml, $object->toXml());
        $this->assertEquals($xml, $reverse->toXml());
    }