[FLOW3-general] Flow and validation when deleting

David Sporer david.sporer at gmail.com
Tue Feb 5 16:13:12 CET 2013


Hi Stephan,

I'm not sure if this works on relationships. You'll also get into trouble
when using your Package on a blank database because the default id won't
exist.
It's not suggested for sure but you could add the default values on database
level - but don't know if that one works either ;-)

Best regards
David

-- 
If you're interested in my work you can follow me or my current project
@sporerd and @PasscreatorDe

-----Ursprüngliche Nachricht-----
Von: flow3-general-bounces at lists.typo3.org
[mailto:flow3-general-bounces at lists.typo3.org] Im Auftrag von Stephan Vidar
Gesendet: Dienstag, 5. Februar 2013 16:03
An: flow3-general at lists.typo3.org
Betreff: Re: [FLOW3-general] Flow and validation when deleting

Am 04.02.2013 15:24, schrieb David Sporer:
> Hi,
>
> another option is to specify default values.
>
>          /**         * The label color         * @var string         *
> @FLOW3\Validate(type="StringLength", options={"minimum"=6, "maximum"=6
> })         * @ORM\Column(options={"default" = "000000"})         */
>      protected $labelColor = '000000';
>
>
> Best Regards
>
> David


Hi David,

this is a nice option but is not documented anywhere!

http://docs.doctrine-project.org/en/2.0.x/reference/annotations-reference.ht
ml#annref-column

I have read everywhere that doctrine doesn't support database default
values... but this works fine if I add this new property to model:

/**
  * The country
  * @var string
  * @Flow\Validate(type="NotEmpty")
  * @ORM\Column(options={"default" = "Spain"})
  */
protected $country = 'Spain';

After doctrine update, there is the new column 'country' and the data sets
have the default value 'Spain'.


But the following example doesn't work, if I add this new property with 
ManyToOne relation to a existing label object:

/**
  * The label
  * @var \App\Test\Domain\Model\Label
  * @ORM\ManyToOne
  * @Flow\Validate(type="NotEmpty")
  * @ORM\Column(options={"default" = 
"87afd5ac-fdd3-4b35-b9dc-85f8fbf38950"})
  */
protected $label = '87afd5ac-fdd3-4b35-b9dc-85f8fbf38950';

After doctrine update, the data sets have value NULL.

Hmm... any idea, because that would be a nice feature!

Greets, Stephan

_______________________________________________
FLOW3-general mailing list
FLOW3-general at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general



More information about the FLOW3-general mailing list