예제 #1
0
 protected function createDataStructure()
 {
     $structure = \Mesour\Editable\Structures\DataStructure::fromSource($this->createSource());
     $groupsElement = $structure->getElement('groups');
     $groupsElement->addText('name', 'Name');
     $groupsElement->addText('type', 'Type');
     $groupsElement->addDate('date', 'Date')->setFormat('Y-m-d H:i:s');
     $groupsElement->addNumber('members', 'Members')->setUnit('EUR')->setDecimals(2)->setDecimalPoint(',')->setThousandSeparator('.');
     $addressesElement = $structure->getElement('user_addresses');
     $addressesElement->addText('street', 'Street')->setTextarea();
     $addressesElement->addText('city', 'City');
     $addressesElement->addText('zip', 'Zip');
     $addressesElement->addText('country', 'Country');
     $companiesElement = $structure->getElement('companies');
     $companiesElement->addText('name', 'Name');
     $companiesElement->addText('reg_num', 'Reg. number');
     $companiesElement->addBool('verified', 'Verified');
     $walletElement = $structure->getElement('wallets');
     $walletElement->addNumber('amount', 'Amount')->setDecimalPoint(',')->setThousandSeparator('.')->setDecimals(2);
     $walletElement->addEnum('currency', 'Currency');
     return $structure;
 }
예제 #2
0
파일: index.php 프로젝트: mesour/editable
$dataStructure->renameColumn('user_addresses', 'addresses');
$dataStructure->renameColumn('wallets', 'wallet');
/** @var \Mesour\Sources\Structures\Columns\ManyToOneColumnStructure $groupColumn */
$groupColumn = $dataStructure->getColumn('group');
$groupColumn->setPattern('{name} ({members})');
/** @var \Mesour\Sources\Structures\Columns\OneToManyColumnStructure $addressColumn */
$addressColumn = $dataStructure->getColumn('addresses');
$addressColumn->setPattern('{street}, {zip} {city}, {country}');
/** @var \Mesour\Sources\Structures\Columns\ManyToManyColumnStructure $companiesColumn */
$companiesColumn = $dataStructure->getColumn('companies');
$companiesColumn->setPattern('{name}');
/** @var \Mesour\Sources\Structures\Columns\OneToOneColumnStructure $walletColumn */
$walletColumn = $dataStructure->getColumn('wallet');
$walletColumn->setPattern('{amount}');
// EDITABLE STRUCTURE
$structure = \Mesour\Editable\Structures\DataStructure::fromSource($source);
$groupsElement = $structure->getElement('groups');
$groupsElement->addText('name', 'Name');
$groupsElement->addText('type', 'Type');
$groupsElement->addDate('date', 'Date')->setFormat('Y-m-d H:i:s');
$groupsElement->addNumber('members', 'Members')->setUnit('EUR')->setDecimals(2)->setDecimalPoint(',')->setThousandSeparator('.');
$addressesElement = $structure->getElement('user_addresses');
$addressesElement->addText('street', 'Street')->setTextarea();
$addressesElement->addText('city', 'City');
$addressesElement->addText('zip', 'Zip');
$addressesElement->addText('country', 'Country');
$companiesElement = $structure->getElement('companies');
$companiesElement->addText('name', 'Name');
$companiesElement->addText('reg_num', 'Reg. number');
$companiesElement->addBool('verified', 'Verified');
$walletElement = $structure->getElement('wallets');