Permalink
Browse files

moved BaseAbstractType Model\Form to Form

  • Loading branch information...
1 parent 1bae813 commit accb888e8aed8e6aa8ca4828a59b78b41e2e48de @redexp redexp committed Nov 10, 2012
Showing with 61 additions and 0 deletions.
  1. +61 −0 Form/BaseAbstractType.php
View
@@ -0,0 +1,61 @@
+<?php
+
+namespace Propel\PropelBundle\Form;
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
+
+abstract class BaseAbstractType extends AbstractType
+{
+ protected $options = array(
+ 'name' => '',
+ );
+
+ function __construct($mergeOptions = null)
+ {
+ if ($mergeOptions) {
+ $this->mergeOptions($mergeOptions);
+ }
+ }
+
+ public function setOption($name, $value)
+ {
+ $this->options[$name] = $value;
+ }
+
+ public function getOption($name)
+ {
+ return $this->options[$name];
+ }
+
+ public function setOptions($options)
+ {
+ $this->options = $options;
+ }
+
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ public function mergeOptions($options)
+ {
+ $this->options = array_merge($this->options, $options);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setDefaultOptions(OptionsResolverInterface $resolver)
+ {
+ $resolver->setDefaults($this->options);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getName()
+ {
+ return $this->getOption('name');
+ }
+}

0 comments on commit accb888

Please sign in to comment.