Permalink
Browse files

[Form] Added a layer of 2.0 BC methods to FormView and updated UPGRAD…

…E and CHANGELOG
  • Loading branch information...
1 parent db9cf27 commit bb06878d9b7ac558818721957dbef564eac03891 @webmozart webmozart committed Jul 21, 2012
Showing with 104 additions and 2 deletions.
  1. +1 −2 CHANGELOG.md
  2. +103 −0 FormView.php
View
3 CHANGELOG.md
@@ -134,8 +134,6 @@ CHANGELOG
FormEvents::BIND_NORM_DATA
* [BC BREAK] reversed the order of the first two arguments to `createNamed`
and `createNamedBuilder` in `FormFactoryInterface`
- * [BC BREAK] adapted methods of FormView to match the naming used in
- FormInterface and FormBuilder
* deprecated `getChildren` in Form and FormBuilder in favor of `all`
* deprecated `hasChildren` in Form and FormBuilder in favor of `count`
* FormBuilder now implements \IteratorAggregate
@@ -179,3 +177,4 @@ CHANGELOG
* `isChoiceGroup`
* `isChoiceSelected`
* added method `block` to FormHelper and deprecated `renderBlock` instead
+ * made FormView properties public and deprecated their accessor methods
View
103 FormView.php
@@ -68,6 +68,64 @@ public function getName()
}
/**
+ * @param string $name
+ * @param mixed $value
+ *
+ * @return FormView The current view
+ *
+ * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
+ * the public property {@link vars} instead.
+ */
+ public function set($name, $value)
+ {
+ $this->vars[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * @param $name
+ *
+ * @return Boolean
+ *
+ * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
+ * the public property {@link vars} instead.
+ */
+ public function has($name)
+ {
+ return array_key_exists($name, $this->vars);
+ }
+
+ /**
+ * @param $name
+ * @param $default
+ *
+ * @return mixed
+ *
+ * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
+ * the public property {@link vars} instead.
+ */
+ public function get($name, $default = null)
+ {
+ if (false === $this->has($name)) {
+ return $default;
+ }
+
+ return $this->vars[$name];
+ }
+
+ /**
+ * @return array
+ *
+ * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
+ * the public property {@link vars} instead.
+ */
+ public function all()
+ {
+ return $this->vars;
+ }
+
+ /**
* Returns the values of all view variables.
*
* @return array The values of all variables.
@@ -181,6 +239,51 @@ public function hasParent()
}
/**
+ * Sets the children view.
+ *
+ * @param array $children The children as instances of FormView
+ *
+ * @return FormView The current view
+ *
+ * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
+ * the public property {@link children} instead.
+ */
+ public function setChildren(array $children)
+ {
+ $this->children = $children;
+
+ return $this;
+ }
+
+ /**
+ * Returns the children.
+ *
+ * @return array The children as instances of FormView
+ *
+ * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
+ * the public property {@link children} instead.
+ */
+ public function getChildren()
+ {
+ return $this->children;
+ }
+
+ /**
+ * Returns a given child.
+ *
+ * @param string $name The name of the child
+ *
+ * @return FormView The child view
+ *
+ * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
+ * the public property {@link children} instead.
+ */
+ public function getChild($name)
+ {
+ return $this->children[$name];
+ }
+
+ /**
* Returns whether this view has any children.
*
* @return Boolean Whether the view has children.

0 comments on commit bb06878

Please sign in to comment.