To limit the number of uploadable photos to 6 at most:
// lib/form/doctrine/ProductForm.class.php
public function configure()
{
static $maxUploadablePhotos = 6;
static $maxUploadablePhotosAtOnce = 2;
$form = new ProductPhotoCollectionForm(null, array(
'product' => $this->getObject(),
'size' => min($maxUploadablePhotosAtOnce, max(0,
$maxUploadablePhotos - count($this->getObject()->getPhotos()))),
));
$this->embedForm('newPhotos', $form);
}
This solution may allow more than two photos to be uploaded at once,
but I guess you can adapt this easily to your desired behaviour.
----
If you don't want the user to edit the already uploaded photos, you
can simply use the unset($this['Photos']) call. most typically in the
configure() method of the form. An alternative (but with equal
effect): unset($this->widgetSchema['Photos'], $this-
>validatorSchema['Photos']);
-RAPHAEL
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en