Hi,
i have a entity with a auto-increment and prefix. ()
where use this kind of field, like invoiceNumber.
prefix = 2 letter of year
number = 0001 (with padding)
wonderfull.
But what i don't understand, prefix is in entityDefs.json and the next number is on database (entity = NextNumber).
My question is why Prefix is not in Database ?
So second question, is possible to change just the prefix ? with metadata, fileManager ? or we need to read all content of json ?
I this sample, it's a job who run annually on 1/1 .. so prefix will be 2 letter of year. so next prefix on 1/1 is 24
i have a entity with a auto-increment and prefix. ()
where use this kind of field, like invoiceNumber.
prefix = 2 letter of year
number = 0001 (with padding)
wonderfull.
But what i don't understand, prefix is in entityDefs.json and the next number is on database (entity = NextNumber).
My question is why Prefix is not in Database ?
So second question, is possible to change just the prefix ? with metadata, fileManager ? or we need to read all content of json ?
I this sample, it's a job who run annually on 1/1 .. so prefix will be 2 letter of year. so next prefix on 1/1 is 24
PHP Code:
"number": {
"type": "number",
"len": 36,
"notNull": false,
"unique": false,
"nextNumber": 1,
"padLength": 4,
"prefix": "23",
"inlineEditDisabled": true,
"isCustom": true
}
PHP Code:
$nextNumber = $this->em->getRDBRepository('NextNumber')
->where([
'entityType' => 'Facture',
'fieldName' => 'number'
])
->findOne();
$nextNumber->set([
'value' => 1,
]);
$this->em->saveEntity($nextNumber);
$fieldNumber = $this->metadata->getObjects(['entityDefs', 'Facture', 'fields', 'number'], null);
$fieldNumber->prefix = '34';
$this->log->error( json_encode($fieldNumber ) );
Comment