PathExpression.php 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the LGPL. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\ORM\Query\AST;
  20. /**
  21. * AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression
  22. * SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression
  23. * StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression
  24. * SingleValuedAssociationPathExpression ::= IdentificationVariable "." SingleValuedAssociationField
  25. * CollectionValuedPathExpression ::= IdentificationVariable "." CollectionValuedAssociationField
  26. * StateField ::= {EmbeddedClassStateField "."}* SimpleStateField
  27. * SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField
  28. *
  29. * @since 2.0
  30. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  31. * @author Jonathan Wage <jonwage@gmail.com>
  32. * @author Roman Borschel <roman@code-factory.org>
  33. */
  34. class PathExpression extends Node
  35. {
  36. const TYPE_COLLECTION_VALUED_ASSOCIATION = 2;
  37. const TYPE_SINGLE_VALUED_ASSOCIATION = 4;
  38. const TYPE_STATE_FIELD = 8;
  39. public $type;
  40. public $expectedType;
  41. public $identificationVariable;
  42. public $field;
  43. public function __construct($expectedType, $identificationVariable, $field = null)
  44. {
  45. $this->expectedType = $expectedType;
  46. $this->identificationVariable = $identificationVariable;
  47. $this->field = $field;
  48. }
  49. public function dispatch($walker)
  50. {
  51. return $walker->walkPathExpression($this);
  52. }
  53. }