merged 2.0
This commit is contained in:
commit
03d4b0264f
@ -48,9 +48,9 @@ class Controller extends ContainerAware
|
||||
/**
|
||||
* Forwards the request to another controller.
|
||||
*
|
||||
* @param string $controller The controller name (a string like BlogBundle:Post:index)
|
||||
* @param array $path An array of path parameters
|
||||
* @param array $query An array of query parameters
|
||||
* @param string $controller The controller name (a string like BlogBundle:Post:index)
|
||||
* @param array $path An array of path parameters
|
||||
* @param array $query An array of query parameters
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
@ -62,7 +62,7 @@ class Controller extends ContainerAware
|
||||
/**
|
||||
* Returns a RedirectResponse to the given URL.
|
||||
*
|
||||
* @param string $url The URL to redirect to
|
||||
* @param string $url The URL to redirect to
|
||||
* @param integer $status The status code to use for the Response
|
||||
*
|
||||
* @return RedirectResponse
|
||||
@ -88,9 +88,9 @@ class Controller extends ContainerAware
|
||||
/**
|
||||
* Renders a view.
|
||||
*
|
||||
* @param string $view The view name
|
||||
* @param string $view The view name
|
||||
* @param array $parameters An array of parameters to pass to the view
|
||||
* @param Response $response A response instance
|
||||
* @param Response $response A response instance
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
@ -132,6 +132,9 @@ class Controller extends ContainerAware
|
||||
*
|
||||
* throw $this->createNotFoundException('Page not found!');
|
||||
*
|
||||
* @param string $message A message
|
||||
* @param Exception $previous The previous exception
|
||||
*
|
||||
* @return NotFoundHttpException
|
||||
*/
|
||||
public function createNotFoundException($message = 'Not Found', \Exception $previous = null)
|
||||
@ -143,8 +146,8 @@ class Controller extends ContainerAware
|
||||
* Creates and returns a Form instance from the type of the form.
|
||||
*
|
||||
* @param string|FormTypeInterface $type The built type of the form
|
||||
* @param mixed $data The initial data for the form
|
||||
* @param array $options Options for the form
|
||||
* @param mixed $data The initial data for the form
|
||||
* @param array $options Options for the form
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
@ -156,8 +159,8 @@ class Controller extends ContainerAware
|
||||
/**
|
||||
* Creates and returns a form builder instance
|
||||
*
|
||||
* @param mixed $data The initial data for the form
|
||||
* @param array $options Options for the form
|
||||
* @param mixed $data The initial data for the form
|
||||
* @param array $options Options for the form
|
||||
*
|
||||
* @return FormBuilder
|
||||
*/
|
||||
@ -221,7 +224,7 @@ class Controller extends ContainerAware
|
||||
/**
|
||||
* Returns true if the service id is defined.
|
||||
*
|
||||
* @param string $id The service id
|
||||
* @param string $id The service id
|
||||
*
|
||||
* @return Boolean true if the service id is defined, false otherwise
|
||||
*/
|
||||
@ -233,7 +236,7 @@ class Controller extends ContainerAware
|
||||
/**
|
||||
* Gets a service by id.
|
||||
*
|
||||
* @param string $id The service id
|
||||
* @param string $id The service id
|
||||
*
|
||||
* @return object The service
|
||||
*/
|
||||
|
@ -153,6 +153,11 @@ class CssSelector
|
||||
} elseif (in_array($peek, array('+', '>', '~'))) {
|
||||
// A combinator
|
||||
$combinator = (string) $stream->next();
|
||||
|
||||
// Ignore optional whitespace after a combinator
|
||||
while (' ' == $stream->peek()) {
|
||||
$stream->next();
|
||||
}
|
||||
} else {
|
||||
$combinator = ' ';
|
||||
}
|
||||
|
@ -250,11 +250,6 @@ class FunctionNode implements NodeInterface
|
||||
return array(0, 0);
|
||||
}
|
||||
|
||||
if (is_string($s)) {
|
||||
// Happens when you just get a number
|
||||
return array(0, $s);
|
||||
}
|
||||
|
||||
if ('odd' == $s) {
|
||||
return array(2, 1);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ Resources
|
||||
This component is a port of the Python lxml library, which is copyright Infrae
|
||||
and distributed under the BSD license.
|
||||
|
||||
Current code is a port of http://codespeak.net/svn/lxml/trunk/src/lxml/cssselect.py@71545
|
||||
Current code is a port of https://github.com/SimonSapin/cssselect@fd2e70
|
||||
|
||||
You can run the unit tests with the following command:
|
||||
|
||||
|
@ -64,6 +64,8 @@ class CssSelectorTest extends \PHPUnit_Framework_TestCase
|
||||
array('h1 .foo', "h1/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
|
||||
array('h1 #foo', "h1/descendant::*[@id = 'foo']"),
|
||||
array('h1 [class*=foo]', "h1/descendant::*[contains(@class, 'foo')]"),
|
||||
array('div>.foo', "div/*[contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
|
||||
array('div > .foo', "div/*[contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,11 @@ class FunctionNodeTest extends \PHPUnit_Framework_TestCase
|
||||
$function = new FunctionNode($element, ':', 'nth-child', $element2);
|
||||
$this->assertEquals("*/*[name() = 'h1' and (position() >= 1)]", (string) $function->toXpath(), '->toXpath() returns the xpath representation of the node');
|
||||
|
||||
// h1:nth-child(1)
|
||||
$element2 = new ElementNode('*', new Token('Symbol', '2', -1));
|
||||
$function = new FunctionNode($element, ':', 'nth-child', $element2);
|
||||
$this->assertEquals("*/*[name() = 'h1' and (position() = 2)]", (string) $function->toXpath(), '->toXpath() returns the xpath representation of the node');
|
||||
|
||||
// h1:nth-child(2n)
|
||||
$element2 = new ElementNode('*', new Token('Symbol', '2n', -1));
|
||||
$function = new FunctionNode($element, ':', 'nth-child', $element2);
|
||||
|
@ -320,7 +320,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
|
||||
static public function addVCSPattern($pattern)
|
||||
{
|
||||
static::$vcsPatterns[] = $pattern;
|
||||
self::$vcsPatterns[] = $pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -591,7 +591,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
|
||||
$this->exclude = array_merge($this->exclude, static::$vcsPatterns);
|
||||
$this->exclude = array_merge($this->exclude, self::$vcsPatterns);
|
||||
}
|
||||
|
||||
if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
|
||||
|
@ -87,7 +87,7 @@ class PropertyPathMapper implements DataMapperInterface
|
||||
{
|
||||
$propertyPath = $form->getAttribute('property_path');
|
||||
|
||||
if (null !== $propertyPath && $form->isSynchronized()) {
|
||||
if (null !== $propertyPath && $form->isSynchronized() && !$form->isReadOnly()) {
|
||||
// If the data is identical to the value in $data, we are
|
||||
// dealing with a reference
|
||||
$isReference = $form->getData() === $propertyPath->getValue($data);
|
||||
|
@ -29,7 +29,7 @@ class UrlGenerator implements UrlGeneratorInterface
|
||||
{
|
||||
protected $context;
|
||||
protected $decodedChars = array(
|
||||
// %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitely allowed it)
|
||||
// %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitly allowed it)
|
||||
'%2F' => '/',
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user