Symfony2.8 PropertyPathIterator错误

时间:2018-02-06 00:23:16

标签: forms symfony

无法弄清楚我的Symfony2表单在提交时失败的原因。它显示很好。 但它在以下几行失败:

if ($request->getMethod() == 'POST') {
  $req = $request->request->get("material");
  $form->handleRequest($request); //fails here
  ...
}

表单处理大约12,600个查询,并在3500ms后超时。

我也得到以下错误,但我认为这是无关紧要的。我已经设置了php.ini memory_limit = -1,我仍然得到这个超时。

[1] Symfony\Component\Debug\Exception\FatalErrorException: Error: Maximum execution time of 60 seconds exceeded
    at n/a
        in /Users/ns7637/Desktop/nflrc-master/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php line 39

此类的表单数据定义:

/**
 * @ORM\Table(name="materials")
 * @ORM\Entity(repositoryClass="AppBundle\Entity\MaterialRepository")
 */
class Material
{
    /**
     * @var integer
     *
     * @ORM\Column(name="materialID", type="integer", nullable=true)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $materialID;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="lrcID", type="integer", nullable=true)
     */
    private $lrcID;

    /**
     * @var string
     *
     * @Assert\Type("\string")
     * @Assert\Length(max=255)
     * @ORM\Column(name="title", type="string", length=255, nullable=false)
     */
    private $title;

    /**
     * @var string
     *
     * @Assert\Type("\string")
     * @ORM\Column(name="description", type="text", nullable=false)
     */
    private $description;

    /**
     * @var string
     *
     * @Assert\Type("\string")
     * @Assert\Length(max=255)
     * @ORM\Column(name="author", type="string", length=255, nullable=true)
     */
    private $author;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="year", type="integer", nullable=true)
     */
    private $year;

    /**
     * @var File
     *
     * @Assert\File(
     *     maxSize = "10M",
     *     mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/tiff"},
     *     maxSizeMessage = "The maxmimum allowed file size is 10MB.",
     *     mimeTypesMessage = "Please, upload the imag as a jpge, gif, png, or tiff file."
     * )
     * @ORM\Column(name="image", type="string", length=100, nullable=true)
     */
    private $image;

    /**
     * @var \DateTime
     *
     * @Assert\NotBlank()
     * @Assert\Type("\DateTime")
     * @ORM\Column(name="dateModified", type="datetime", nullable=true)
     */
    private $dateModified;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="isActive", type="integer", nullable=true)
     */
    private $isActive;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="isFree", type="integer", nullable=true)
     */
    private $isFree;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="sizevalue", type="integer", nullable=true)
     */
    private $sizevalue;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="sizeunit", type="integer", nullable=true)
     */
    private $sizeunit;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="isComplete", type="integer", nullable=true)
     */
    private $isComplete;

    /**
     *
     * @Assert\Url(
     *    checkDNS = true,
     *    message = "The url '{{ value }}' is not a valid url",
     *    dnsMessage = "The host '{{ value }}' could not be resolved.",
     * )
     * @Assert\Length(max=255)
     * @ORM\Column(name="url", type="string", length=255, nullable=false)
     */
    private $url;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialLanguage")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialLanguage", inversedBy="material")
     * @ORM\JoinTable(name="materials_language_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="languageID", referencedColumnName="languageID", nullable=false)})
     */
    public $materiallanguage;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialType")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialType", inversedBy="material")
     * @ORM\JoinTable(name="materials_type_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="typeID", referencedColumnName="typeID", nullable=false)})
     */
    public $materialtype;


    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialAudience")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialAudience", inversedBy="material")
     * @ORM\JoinTable(name="materials_audience_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="audienceID", referencedColumnName="audienceID", nullable=false)})
     */
    public $materialaudience;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialLevel")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialLevel", inversedBy="material")
     * @ORM\JoinTable(name="materials_level_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="levelID", referencedColumnName="levelID", nullable=false)})
     */
    public $materiallevel;


    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialFormat")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialFormat")
     * @ORM\JoinTable(name="materials_format_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="formatid", referencedColumnName="formatid", nullable=false)})
     */
    public $materialformat;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialSpecificMedium")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialSpecificMedium")
     * @ORM\JoinTable(name="materials_specificmedium_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="specificmediumID", referencedColumnName="specificmediumid", nullable=false)})
     */
    public $materialspecificmedium;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialSizeUnits")
     * @Assert\Valid()
     * @ORM\ManyToOne(targetEntity="MaterialSizeUnits", inversedBy="material")
     * @ORM\JoinColumn(name="sizeunit", referencedColumnName="id", nullable=true)
     */
    public $materialsizeunits;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialCategory")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialCategory")
     * @ORM\JoinTable(name="materials_category_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="categoryID", referencedColumnName="categoryID", nullable=false)})
     */
    public $materialcategory;


    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialKeyword")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialKeyword", inversedBy="material")
     * @ORM\JoinTable(name="materials_keyword_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="keywordID", referencedColumnName="id", nullable=false)})
     */
    public $materialkeyword;


    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialYear")
     * @Assert\Valid()
     * @ORM\ManyToOne(targetEntity="MaterialYear")
     * @ORM\JoinColumn(name="year", referencedColumnName="yearID")
     */
    public $materialyear;


    /**
     * @Assert\Type(type="AppBundle\Entity\Lrc")
     * @Assert\Valid()
     * @ORM\ManyToOne(targetEntity="Lrc", inversedBy="material")
     * @ORM\JoinColumn(name="lrcID", referencedColumnName="id")
     */
    public $lrc;


    /**
    * Constructor
    */
    public function __construct()
    {
        $this->MaterialLanguage = new ArrayCollection();
        $this->MaterialType = new ArrayCollection();
        $this->MaterialLevel = new ArrayCollection();
        $this->MaterialAudience = new ArrayCollection();
        $this->MaterialFormat = new ArrayCollection();
        $this->MaterialSpecificMedium = new ArrayCollection();
        $this->MaterialSizeUnits = new ArrayCollection();
        $this->MaterialCategory = new ArrayCollection();
        $this->MaterialKeyword = new ArrayCollection();
        $this->MaterialYear = new ArrayCollection();
        $this->Lrc = new ArrayCollection();
    }




    /**
     * Set materiallanguage
     *
     * @param array $materiallanguage
     *
     */
    public function setMateriallanguage(MaterialLanguage $materiallanguage=null)
    {
        $this->materiallanguage = $materiallanguage;
    }

    /**
     * Get materiallanguage
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMateriallanguage()
    {
        return $this->materiallanguage;
    }

    /**
     * Set materialtype
     *
     * @param array $materialtype
     *
     */
    public function setMaterialtype(MaterialType $materialtype=null)
    {
        $this->materialtype = $materialtype;
    }

    /**
     * Get materialtype
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialtype()
    {
        return $this->materialtype;
    }


    /**
     * Set materialaudience
     *
     * @param array $materialaudience
     *
     */
    public function setMaterialaudience(MaterialAudience $materialaudience=null)
    {
        $this->materialaudience = $materialaudience;
    }

    /**
     * Get materialaudience
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialaudience()
    {
        return $this->materialaudience;
    }

    /**
     * Set materialformat
     *
     * @param array $materialformat
     *
     */
    public function setMaterialformat(MaterialFormat $materialformat=null)
    {
        $this->materialformat = $materialformat;
    }

    /**
     * Get materialformat
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialformat()
    {
        return $this->materialformat;
    }



    /**
     * Set materialspecificmedium
     *
     * @param array $materialspecificmedium
     *
     */
    public function setMaterialspecificmedium(MaterialSpecificMedium $materialspecificmedium=null)
    {
        $this->materialspecificmedium = $materialspecificmedium;
    }

    /**
     * Get materialspecificmedium
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialspecificmedium()
    {
        return $this->materialspecificmedium;
    }


    /**
     * Set materiallevel
     *
     * @param array $materiallevel
     *
     */
    public function setMateriallevel(MaterialLevel $materiallevel=null)
    {
        $this->materiallevel = $materiallevel;
    }

    /**
     * Get materiallevel
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMateriallevel()
    {
        return $this->materiallevel;
    }


    /**
     * Set materialsizeunits
     *
     * @param array $materialsizeunits
     *
     */
    public function setMaterialsizeunits(MaterialSizeUnits $materialsizeunits=null)
    {
        $this->materialsizeunits = $materialsizeunits;
    }

    /**
     * Get materialsizeunits
     *
     * @return array
     */
    public function getMaterialsizeunits()
    {
        return $this->materialsizeunits;
    }

    /**
     * Set materialcategory
     *
     * @param array $materialcategory
     *
     */
    public function setMaterialcategory(MaterialCategory $materialcategory=null)
    {
        $this->materialcategory = $materialcategory;
    }

    /**
     * Get materialcategory
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialcategory()
    {
        return $this->materialcategory;
    }


    /**
     * Set materialkeyword
     *
     * @param array $materialkeyword
     *
     */
    public function setMaterialkeyword(MaterialKeyword $materialkeyword=null)
    {
        $this->materialkeyword = $materialkeyword;
    }

    /**
     * Get materialkeyword
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialkeyword()
    {
        return $this->materialkeyword;
    }


    /**
     * Set materialyear
     *
     * @param array $materialyear
     *
     */
    public function setMaterialyear(MaterialYear $materialyear=null)
    {
        $this->materialyear = $materialyear;
    }

    /**
     * Get materiallamaterialyear
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialyear()
    {
        return $this->materialyear;
    }




    /**
     * Set lrc
     *
     * @param array $lrc
     *
     */
    public function setLrc(Lrc $lrc=null)
    {
        $this->lrc = $lrc;
    }

    /**
     * Get lrc
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getLrc()
    {
        return $this->lrc;
    }


    /**
     * Set materialID
     *
     * @param integer $materialID
     *
     * @return Material
     */
    public function setMaterialID($materialID)
    {
        $this->materialID = $materialID;

        return $this;
    }

    /**
     * Get materialID
     *
     * @return integer
     */
    public function getMaterialID()
    {
        return $this->materialID;
    }

    /**
     * Set lrcID
     *
     * @param integer $lrcID
     *
     * @return Material
     */
    public function setLrcID($lrcID)
    {
        $this->lrcID = $lrcID;

        return $this;
    }

    /**
     * Get lrcID
     *
     * @return integer
     */
    public function getLrcID()
    {
        return $this->lrcID;
    }

    /**
     * Set title
     *
     * @param string $title
     *
     * @return Material
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }

    /**
     * Get title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set description
     *
     * @param string $description
     *
     * @return Material
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set author
     *
     * @param string $author
     *
     * @return Material
     */
    public function setAuthor($author)
    {
        $this->author = $author;

        return $this;
    }

    /**
     * Get author
     *
     * @return string
     */
    public function getAuthor()
    {
        return $this->author;
    }

    /**
     * Set year
     *
     * @param integer $year
     *
     * @return Material
     */
    public function setYear($year)
    {
        $this->year = $year;

        return $this;
    }

    /**
     * Get year
     *
     * @return integer
     */
    public function getYear()
    {
        return $this->year;
    }

    /**
     * Set image
     *
     * @param string $image
     *
     * @return Material
     */
    public function setImage($image)
    {
        $this->image = $image;

        return $this;
    }

    /**
     * Get image
     *
     * @return string
     */
    public function getImage()
    {
        return $this->image;
    }


    /**
     * Set dateModified
     *
     * @param \DateTime $dateModified
     *
     * @return Material
     */
    public function setDateModified($dateModified)
    {
        $this->dateModified = $dateModified;

        return $this;
    }

    /**
     * Get dateModified
     *
     * @return \DateTime
     */
    public function getDateModified()
    {
        return $this->dateModified;
    }

    /**
     * Set isActive
     *
     * @param integer $isActive
     *
     * @return Material
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;

        return $this;
    }

    /**
     * Get isActive
     *
     * @return integer
     */
    public function getIsActive()
    {
        return $this->isActive;
    }

    /**
     * Set isFree
     *
     * @param integer $isFree
     *
     * @return Material
     */
    public function setIsFree($isFree)
    {
        $this->isFree = $isFree;

        return $this;
    }

    /**
     * Get isFree
     *
     * @return integer
     */
    public function getIsFree()
    {
        return $this->isFree;
    }

    /**
     * Set sizevalue
     *
     * @param integer $sizevalue
     *
     */
    public function setSizevalue($sizevalue)
    {
        $this->sizevalue = $sizevalue;

    }

    /**
     * Get sizevalue
     *
     * @return integer
     */
    public function getSizevalue()
    {
        return $this->sizevalue;
    }

    /**
     * Set sizeunit
     *
     * @param integer $sizeunit
     *
     * @return Material
     */
    public function setSizeunit($sizeunit)
    {
        $this->sizeunit = $sizeunit;

        return $this;
    }

    /**
     * Get sizeunit
     *
     * @return integer
     */
    public function getSizeunit()
    {
        return $this->sizeunit;
    }

    /**
     * Set isComplete
     *
     * @param integer $isComplete
     *
     * @return Material
     */
    public function setIsComplete($isComplete)
    {
        $this->isComplete = $isComplete;

        return $this;
    }

    /**
     * Get isComplete
     *
     * @return integer
     */
    public function getIsComplete()
    {
        return $this->isComplete;
    }

    /**
     * Set url
     *
     * @param string $url
     *
     * @return Material
     */
    public function setUrl($url)
    {
        $this->url = $url;

        return $this;
    }

    /**
     * Get url
     *
     * @return string
     */
    public function getUrl()
    {
        return $this->url;
    }


}

我的表格:

class MaterialForm extends AbstractType
{

    public function buildForm(FormBuilderInterface $builder, array $options) {


        $builder
            ->add('title', TextType::class, array(
                'attr' => array('style' => 'width:500px;'),
                'required'   => true,
            ))
            /*->add('datemodified', null, array(
                'attr'=>array('style'=>'display:none;'),
                //'mapped' => false,
                'required'   => false,
                'empty_data' => date("Y-m-d 00:00:00", time()),
            ))*/
            ->add('description', TextareaType::class, array(
                'attr' => array('cols' => '100', 'rows' => '15'),
                'required'   => true,
            ))

            ->add('url', UrlType::class, array(
                'attr' => array('style' => 'width:500px;'),
                'required'   => true,
            ))
            ->add('author', TextType::class, array(
                'attr' => array('style' => 'width:500px;'),
                'required'   => false,
            ))
           ->add('materiallanguage', EntityType::class, array(
                'class' => 'AppBundle:MaterialLanguage',
                'label' => 'Language(s)',
                'choice_label' => 'language',
                'multiple' => true,
                'attr' => array(
                    'style' => 'height: 300px',
                ),
                'expanded' => false,
                'multiple' => true, 
                'required' => true,
            ))
           ->add('materialtype', EntityType::class, array(
                'class' => 'AppBundle:MaterialType',
                'label' => 'Skills',
                'choice_label' => 'type',
                'expanded' => true,
                'multiple' => true, 
                'required' => true,
            ))
           ->add('materiallevel', EntityType::class, array(
                'class' => 'AppBundle:MaterialLevel',
                'label' => 'Level',
                'choice_label' => 'level',
                'expanded' => true,
                'multiple' => true, 
                'required' => true,
            ))
           ->add('materialaudience', EntityType::class, array(
                'class' => 'AppBundle:MaterialAudience',
                'label' => 'Audience',
                'choice_label' => function($choice){
                return $choice->audience;
                },
                'expanded' => true,
                'multiple' => true, 
                'required' => true,
            ))        
           ->add('materialformat', EntityType::class, array(
                'class' => 'AppBundle:MaterialFormat',
                'label' => 'Format',
                'choice_label' => 'formatname',
                'expanded' => false,
                'multiple' => true, 
                'required' => true,
            ))
           ->add('materialspecificmedium', EntityType::class, array(
                'class' => 'AppBundle:MaterialSpecificMedium',
                'label' => 'Specific Medium',
                'choice_label' => 'specificmediumname',
                'group_by' => 'formatid',
                'attr' => array('style' => 'height: 300px'),
                'expanded' => false,
                'multiple' => true, 
                'required'   => false,
            ))
           ->add('materialcategory', EntityType::class, array(
                'class' => 'AppBundle:MaterialCategory',
                'label' => 'Category',
                'label_attr' => array(
                    'class' => 'checkbox-block'
                ),
                'choice_label' => 'category',
                'expanded' => true,
                'multiple' => true, 
            ))
            ->add('sizevalue', TextType::class, array(
                'attr' => array('style' => 'width:50px;'),
                'label' => 'Length',
                'required'   => false,
                'empty_data' => 0,
            ))
           ->add('materialsizeunits', EntityType::class, array(
                'class' => 'AppBundle:MaterialSizeUnits',
                'empty_value' => 'Select size unit',
                'label' => 'Unit',
                'choice_label' => 'name',
                'expanded' => false,
                'multiple' => false,
                'required' => false,
            ))

           ->add('materialyear', EntityType::class, array(
                'class' => 'AppBundle:MaterialYear',
                'label' => 'Published',
                'choice_label' => 'year',
                'expanded' => false,
                'multiple' => false,    
                'required' => false,
            ))

           ->add('isfree', ChoiceType::class, array(
                'attr' => array('style' => 'width:68px;'),
                'expanded' => false,
                'multiple' => false,
                'choices' => array(0 =>'Not Free', 1 => 'Free') ,
                'label' => 'Price',
                'required'   => false,
            ))


           // ->add('update', 'submit')
            ->add('update', SubmitType::class, array('label' => 'Update'))
            ->add('cancel', SubmitType::class, array('label' => 'Cancel'));

    }

    public function getDefaultOptions(array $options)
    {
        return array(
            'data_class' => 'AppBundle:Material'
        );
    }

     /**
     * @return string
     */
    public function getName()
    {
        return 'material';
    }


}

1 个答案:

答案 0 :(得分:0)

我发现了问题。 Assert语句必须无效。一旦我更改了它们,表单就会在handleRequest停止放缓。

这是我更新的Material类,带有固定的Assert语句:

/**
 * @ORM\Table(name="materials")
 * @ORM\Entity(repositoryClass="AppBundle\Entity\MaterialRepository")
 */
class Material
{
    /**
     * @var integer
     *
     * @ORM\Column(name="materialID", type="integer", nullable=true)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $materialID;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="lrcID", type="integer", nullable=true)
     */
    private $lrcID;

    /**
     * @var string
     *
     * @Assert\Type("\string")
     * @Assert\Length(max=255)
     * @ORM\Column(name="title", type="string", length=255, nullable=false)
     */
    private $title;

    /**
     * @var string
     *
     * @Assert\Type("\string")
     * @ORM\Column(name="description", type="text", nullable=false)
     */
    private $description;

    /**
     * @var string
     *
     * @Assert\Type("\string")
     * @Assert\Length(max=255)
     * @ORM\Column(name="author", type="string", length=255, nullable=true)
     */
    private $author;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="year", type="integer", nullable=true)
     */
    private $year;

    /**
     * @var File
     *
     * @Assert\File(
     *     maxSize = "10M",
     *     mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/tiff"},
     *     maxSizeMessage = "The maxmimum allowed file size is 10MB.",
     *     mimeTypesMessage = "Please, upload the imag as a jpge, gif, png, or tiff file."
     * )
     * @ORM\Column(name="image", type="string", length=100, nullable=true)
     */
    private $image;

    /**
     * @var \DateTime
     *
     * @Assert\NotBlank()
     * @Assert\Type("\DateTime")
     * @ORM\Column(name="dateModified", type="datetime", nullable=true)
     */
    private $dateModified;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="isActive", type="integer", nullable=true)
     */
    private $isActive;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="isFree", type="integer", nullable=true)
     */
    private $isFree;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="sizevalue", type="integer", nullable=true)
     */
    private $sizevalue;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="sizeunit", type="integer", nullable=true)
     */
    private $sizeunit;

    /**
     * @var integer
     *
     * @Assert\Type("\integer")
     * @ORM\Column(name="isComplete", type="integer", nullable=true)
     */
    private $isComplete;

    /**
     *
     * @Assert\Url(
     *    checkDNS = true,
     *    message = "The url '{{ value }}' is not a valid url",
     *    dnsMessage = "The host '{{ value }}' could not be resolved.",
     * )
     * @Assert\Length(max=255)
     * @ORM\Column(name="url", type="string", length=255, nullable=false)
     */
    private $url;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialLanguage")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialLanguage", inversedBy="material")
     * @ORM\JoinTable(name="materials_language_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="languageID", referencedColumnName="languageID", nullable=false)})
     */
    public $materiallanguage;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialType")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialType", inversedBy="material")
     * @ORM\JoinTable(name="materials_type_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="typeID", referencedColumnName="typeID", nullable=false)})
     */
    public $materialtype;


    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialAudience")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialAudience", inversedBy="material")
     * @ORM\JoinTable(name="materials_audience_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="audienceID", referencedColumnName="audienceID", nullable=false)})
     */
    public $materialaudience;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialLevel")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialLevel", inversedBy="material")
     * @ORM\JoinTable(name="materials_level_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="levelID", referencedColumnName="levelID", nullable=false)})
     */
    public $materiallevel;


    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialFormat")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialFormat")
     * @ORM\JoinTable(name="materials_format_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="formatid", referencedColumnName="formatid", nullable=false)})
     */
    public $materialformat;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialSpecificMedium")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialSpecificMedium")
     * @ORM\JoinTable(name="materials_specificmedium_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="specificmediumID", referencedColumnName="specificmediumid", nullable=false)})
     */
    public $materialspecificmedium;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialSizeUnits")
     * @Assert\Valid()
     * @ORM\ManyToOne(targetEntity="MaterialSizeUnits", inversedBy="material")
     * @ORM\JoinColumn(name="sizeunit", referencedColumnName="id", nullable=true)
     */
    public $materialsizeunits;

    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialCategory")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialCategory")
     * @ORM\JoinTable(name="materials_category_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="categoryID", referencedColumnName="categoryID", nullable=false)})
     */
    public $materialcategory;


    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialKeyword")
     * @Assert\Valid()
     * @ORM\ManyToMany(targetEntity="MaterialKeyword", inversedBy="material")
     * @ORM\JoinTable(name="materials_keyword_map",
     *      joinColumns={@ORM\JoinColumn(name="materialID", referencedColumnName="materialID", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="keywordID", referencedColumnName="id", nullable=false)})
     */
    public $materialkeyword;


    /**
     * @Assert\Type(type="AppBundle\Entity\MaterialYear")
     * @Assert\Valid()
     * @ORM\ManyToOne(targetEntity="MaterialYear")
     * @ORM\JoinColumn(name="year", referencedColumnName="yearID")
     */
    public $materialyear;


    /**
     * @Assert\Type(type="AppBundle\Entity\Lrc")
     * @Assert\Valid()
     * @ORM\ManyToOne(targetEntity="Lrc", inversedBy="material")
     * @ORM\JoinColumn(name="lrcID", referencedColumnName="id")
     */
    public $lrc;


    /**
    * Constructor
    */
    public function __construct()
    {
        $this->MaterialLanguage = new ArrayCollection();
        $this->MaterialType = new ArrayCollection();
        $this->MaterialLevel = new ArrayCollection();
        $this->MaterialAudience = new ArrayCollection();
        $this->MaterialFormat = new ArrayCollection();
        $this->MaterialSpecificMedium = new ArrayCollection();
        $this->MaterialSizeUnits = new ArrayCollection();
        $this->MaterialCategory = new ArrayCollection();
        $this->MaterialKeyword = new ArrayCollection();
        $this->MaterialYear = new ArrayCollection();
        $this->Lrc = new ArrayCollection();
    }




    /**
     * Set materiallanguage
     *
     * @param array $materiallanguage
     *
     */
    public function setMateriallanguage(ArrayCollection $materiallanguage)
    {
        $this->materiallanguage = $materiallanguage;
    }

    /**
     * Get materiallanguage
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMateriallanguage()
    {
        return $this->materiallanguage;
    }

    /**
     * Set materialtype
     *
     * @param array $materialtype
     *
     */
    public function setMaterialtype(ArrayCollection $materialtype)
    {
        $this->materialtype = $materialtype;
    }

    /**
     * Get materialtype
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialtype()
    {
        return $this->materialtype;
    }


    /**
     * Set materialaudience
     *
     * @param array $materialaudience
     *
     */
    public function setMaterialaudience(ArrayCollection $materialaudience)
    {
        $this->materialaudience = $materialaudience;
    }

    /**
     * Get materialaudience
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialaudience()
    {
        return $this->materialaudience;
    }

    /**
     * Set materialformat
     *
     * @param array $materialformat
     *
     */
    public function setMaterialformat(ArrayCollection $materialformat)
    {
        $this->materialformat = $materialformat;
    }

    /**
     * Get materialformat
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialformat()
    {
        return $this->materialformat;
    }



    /**
     * Set materialspecificmedium
     *
     * @param array $materialspecificmedium
     *
     */
    public function setMaterialspecificmedium(ArrayCollection $materialspecificmedium)
    {
        $this->materialspecificmedium = $materialspecificmedium;
    }

    /**
     * Get materialspecificmedium
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialspecificmedium()
    {
        return $this->materialspecificmedium;
    }


    /**
     * Set materiallevel
     *
     * @param array $materiallevel
     *
     */
    public function setMateriallevel(ArrayCollection $materiallevel)
    {
        $this->materiallevel = $materiallevel;
    }

    /**
     * Get materiallevel
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMateriallevel()
    {
        return $this->materiallevel;
    }


    /**
     * Set materialsizeunits
     *
     * @param array $materialsizeunits
     *
     */
    public function setMaterialsizeunits(MaterialSizeUnits $materialsizeunits)
    {
        $this->materialsizeunits = $materialsizeunits;
    }

    /**
     * Get materialsizeunits
     *
     * @return array
     */
    public function getMaterialsizeunits()
    {
        return $this->materialsizeunits;
    }

    /**
     * Set materialcategory
     *
     * @param array $materialcategory
     *
     */
    public function setMaterialcategory(ArrayCollection $materialcategory)
    {
        $this->materialcategory = $materialcategory;
    }

    /**
     * Get materialcategory
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialcategory()
    {
        return $this->materialcategory;
    }


    /**
     * Set materialkeyword
     *
     * @param array $materialkeyword
     *
     */
    public function setMaterialkeyword(MaterialKeyword $materialkeyword)
    {
        $this->materialkeyword = $materialkeyword;
    }

    /**
     * Get materialkeyword
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialkeyword()
    {
        return $this->materialkeyword;
    }


    /**
     * Set materialyear
     *
     * @param array $materialyear
     *
     */
    public function setMaterialyear(MaterialYear $materialyear)
    {
        $this->materialyear = $materialyear;
    }

    /**
     * Get materiallamaterialyear
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getMaterialyear()
    {
        return $this->materialyear;
    }




    /**
     * Set lrc
     *
     * @param array $lrc
     *
     */
    public function setLrc(Lrc $lrc=null)
    {
        $this->lrc = $lrc;
    }

    /**
     * Get lrc
     *
     * @Assert\Type("\array")
     * @return array
     */
    public function getLrc()
    {
        return $this->lrc;
    }


    /**
     * Set materialID
     *
     * @param integer $materialID
     *
     * @return Material
     */
    public function setMaterialID($materialID)
    {
        $this->materialID = $materialID;

        return $this;
    }

    /**
     * Get materialID
     *
     * @return integer
     */
    public function getMaterialID()
    {
        return $this->materialID;
    }

    /**
     * Set lrcID
     *
     * @param integer $lrcID
     *
     * @return Material
     */
    public function setLrcID($lrcID)
    {
        $this->lrcID = $lrcID;

        return $this;
    }

    /**
     * Get lrcID
     *
     * @return integer
     */
    public function getLrcID()
    {
        return $this->lrcID;
    }

    /**
     * Set title
     *
     * @param string $title
     *
     * @return Material
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }

    /**
     * Get title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set description
     *
     * @param string $description
     *
     * @return Material
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set author
     *
     * @param string $author
     *
     * @return Material
     */
    public function setAuthor($author)
    {
        $this->author = $author;

        return $this;
    }

    /**
     * Get author
     *
     * @return string
     */
    public function getAuthor()
    {
        return $this->author;
    }

    /**
     * Set year
     *
     * @param integer $year
     *
     * @return Material
     */
    public function setYear($year)
    {
        $this->year = $year;

        return $this;
    }

    /**
     * Get year
     *
     * @return integer
     */
    public function getYear()
    {
        return $this->year;
    }

    /**
     * Set image
     *
     * @param string $image
     *
     * @return Material
     */
    public function setImage($image)
    {
        $this->image = $image;

        return $this;
    }

    /**
     * Get image
     *
     * @return string
     */
    public function getImage()
    {
        return $this->image;
    }


    /**
     * Set dateModified
     *
     * @param \DateTime $dateModified
     *
     * @return Material
     */
    public function setDateModified(\DateTime $dateModified)
    {
        $this->dateModified = $dateModified;

        return $this;
    }

    /**
     * Get dateModified
     *
     * @return \DateTime
     */
    public function getDateModified()
    {
        return $this->dateModified;
    }

    /**
     * Set isActive
     *
     * @param integer $isActive
     *
     * @return Material
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;

        return $this;
    }

    /**
     * Get isActive
     *
     * @return integer
     */
    public function getIsActive()
    {
        return $this->isActive;
    }

    /**
     * Set isFree
     *
     * @param integer $isFree
     *
     * @return Material
     */
    public function setIsFree($isFree)
    {
        $this->isFree = $isFree;

        return $this;
    }

    /**
     * Get isFree
     *
     * @return integer
     */
    public function getIsFree()
    {
        return $this->isFree;
    }

    /**
     * Set sizevalue
     *
     * @param integer $sizevalue
     *
     */
    public function setSizevalue($sizevalue)
    {
        $this->sizevalue = $sizevalue;

    }

    /**
     * Get sizevalue
     *
     * @return integer
     */
    public function getSizevalue()
    {
        return $this->sizevalue;
    }

    /**
     * Set sizeunit
     *
     * @param integer $sizeunit
     *
     * @return Material
     */
    public function setSizeunit($sizeunit)
    {
        $this->sizeunit = $sizeunit;

        return $this;
    }

    /**
     * Get sizeunit
     *
     * @return integer
     */
    public function getSizeunit()
    {
        return $this->sizeunit;
    }

    /**
     * Set isComplete
     *
     * @param integer $isComplete
     *
     * @return Material
     */
    public function setIsComplete($isComplete)
    {
        $this->isComplete = $isComplete;

        return $this;
    }

    /**
     * Get isComplete
     *
     * @return integer
     */
    public function getIsComplete()
    {
        return $this->isComplete;
    }

    /**
     * Set url
     *
     * @param string $url
     *
     * @return Material
     */
    public function setUrl($url)
    {
        $this->url = $url;

        return $this;
    }

    /**
     * Get url
     *
     * @return string
     */
    public function getUrl()
    {
        return $this->url;
    }


}