Skip to content

Instantly share code, notes, and snippets.

@webdevilopers
Last active October 2, 2020 10:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdevilopers/e071d40d6d0a573f8ef8ac8e78975dc9 to your computer and use it in GitHub Desktop.
Save webdevilopers/e071d40d6d0a573f8ef8ac8e78975dc9 to your computer and use it in GitHub Desktop.
Symfony Assert Annotations using external Class constants
<?php
namespace Sps\Bundle\PriceQuoteBundle\Entity;
abstract class AbstractDormerPriceQuote
extends PriceQuoteRequest
{
const MIN_ROOF_PITCH = 10;
const MAX_ROOF_PITCH = 55;
}
<?php
namespace Sps\PriceQuote\Application\Command;
use Sps\Bundle\PriceQuoteBundle\Entity\AbstractDormerPriceQuote;
class AbstractRequestPriceQuoteCommand
{
/**
* @var $roofPitch
* @Assert\Range(min=AbstractDormerPriceQuote::MIN_ROOF_PITCH, max="55", groups={
* "flow_dormerRequest_step4", "glasDormerRequest"
* })
*/
public $roofPitch;
@webdevilopers
Copy link
Author

@webdevilopers
Copy link
Author

Fixed:

    /**
     * @var $roofPitch
     * @Assert\Range(min=AbstractDormerPriceQuote::MIN_ROOF_PITCH, max="55", groups={
     *  "flow_dormerRequest_step4", "glasDormerRequest"
     * })
     */
    public $roofPitch;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment