Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace ApwBlackbullBundleForm;
- use ApwBlackbullBundleEntityProductsDescription;
- use SymfonyComponentFormAbstractType;
- use SymfonyComponentFormFormBuilderInterface;
- use SymfonyComponentOptionsResolverOptionsResolverInterface;
- class ProductsType extends AbstractType
- {
- /**
- * @param FormBuilderInterface $builder
- * @param array $options
- */
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $builder
- ->add('productsDescription', 'collection',
- array(
- 'type' => new ProductsDescriptionType(),
- 'options' => array('data_class' => 'ApwBlackbullBundleEntityProductsDescription'),
- 'label' => 'Nome prodotto:'
- ))
- ->add('productsQuantity')
- ->add('productsModel')
- ->add('productsImage')
- ->add('productsPrice')
- ->add('productsDateAvailable', 'date', array(
- 'input' => 'datetime',
- 'widget' => 'single_text',))
- ->add('productsWeight')
- ->add('productsStatus')
- ->add('categories', 'entity', array(
- 'class' => 'ApwBlackbullBundle:CategoriesDescription',
- 'property' => 'categoriesName',
- 'empty_value' => 'Scegliere una categoria',
- 'required' => false,
- 'label' => 'Crea in:'))
- ->add('productsDescription', 'collection', array(
- 'type' => new ProductsDescriptionType(),
- 'options' => array('data_class' => 'ApwBlackbullBundleEntityProductsDescription'),
- 'label' => 'Descrizione prodotto:'))
- ->add('salva','submit')
- ->add('azzera','reset')
- ;
- }
- /**
- * @param OptionsResolverInterface $resolver
- */
- public function setDefaultOptions(OptionsResolverInterface $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => 'ApwBlackbullBundleEntityProducts'
- ));
- }
- /**
- * @return string
- */
- public function getName()
- {
- return 'apw_blackbullbundle_products';
- }
- }
- <?php
- namespace ApwBlackbullBundleForm;
- use DoctrineORMEntityRepository;
- use SymfonyComponentFormAbstractType;
- use SymfonyComponentFormFormBuilderInterface;
- use SymfonyComponentOptionsResolverOptionsResolverInterface;
- class CategoriesType extends AbstractType
- {
- /**
- * @param FormBuilderInterface $builder
- * @param array $options
- */
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $builder
- ->add('categoryDescription', 'collection',
- array(
- 'type' => new CategoriesDescriptionType(),
- 'allow_add' => true,
- 'options' => array('data_class' => 'ApwBlackbullBundleEntityCategoriesDescription'),
- 'by_reference' => false,
- ))
- //->add('categoriesImage', null, array('label'=>'Foto:'))
- ->add('categoriesStatus', null, array('label'=>'Stato:'))
- ->add('parentId', 'entity', array(
- 'class' => 'ApwBlackbullBundle:CategoriesDescription',
- 'property' => 'categoriesName',
- 'empty_value' => 'Scegliere una categoria',
- 'required' => false,
- 'label' => 'Crea in:'))
- ->add('salva','submit')
- ->add('azzera','reset')
- ;
- }
- /**
- * @param OptionsResolverInterface $resolver
- */
- public function setDefaultOptions(OptionsResolverInterface $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => 'ApwBlackbullBundleEntityCategories',
- ));
- }
- /**
- * @return string
- */
- public function getName()
- {
- return 'categories';
- }
- }
- <?php
- namespace ApwBlackbullBundleEntity;
- use DoctrineCommonCollectionsArrayCollection;
- use DoctrineORMMapping as ORM;
- /**
- * Products
- *
- * @ORMTable()
- * @ORMEntity(repositoryClass="ApwBlackbullBundleEntityProductsRepository")
- * @ORMHasLifecycleCallbacks()
- */
- class Products
- {
- /**
- * @var integer
- *
- * @ORMColumn(name="id", type="integer")
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var integer
- *
- * @ORMColumn(name="products_quantity", type="integer", nullable = true)
- */
- private $productsQuantity;
- /**
- * @var string
- *
- * @ORMColumn(name="products_model", type="string", length=12, nullable = true)
- */
- private $productsModel;
- /**
- * @var string
- *
- * @ORMColumn(name="products_image", type="string", length=64, nullable = true)
- */
- private $productsImage;
- /**
- * @var string
- *
- * @ORMColumn(name="products_price", type="decimal", nullable = true)
- */
- private $productsPrice;
- /**
- * @var DateTime
- *
- * @ORMColumn(name="products_date_added", type="datetime", nullable = true)
- */
- private $productsDateAdded;
- /**
- * @var DateTime
- *
- * @ORMColumn(name="products_last_modified", type="datetime", nullable = true)
- */
- private $productsLastModified;
- /**
- * @var DateTime
- *
- * @ORMColumn(name="products_date_available", type="datetime", nullable = true)
- */
- private $productsDateAvailable;
- /**
- * @var string
- *
- * @ORMColumn(name="products_weight", type="decimal", nullable = true)
- */
- private $productsWeight;
- /**
- * @var boolean
- *
- * @ORMColumn(name="products_status", type="boolean", nullable = true)
- */
- private $productsStatus;
- /**
- * @var integer
- *
- * @ORMColumn(name="products_ordered", type="integer", nullable = true)
- */
- private $productsOrdered;
- /**
- * @ORMOneToMany(targetEntity="ProductsDescription", mappedBy="product")
- */
- private $productsDescription;
- /**
- * @ORMManyToMany(targetEntity="Categories", inversedBy="products")
- * @ORMJoinTable(name="productstocategories")
- */
- private $categories;
- /**
- * @ORMOneToOne(targetEntity="Manufacturers", inversedBy="products")
- * @ORMJoinColumn(name="manufacturers_id", referencedColumnName="id")
- **/
- private $manufacturers;
- /**
- * @ORMOneToMany(targetEntity="ProductsImages", mappedBy="products")
- */
- private $productsImages;
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set productsQuantity
- *
- * @param integer $productsQuantity
- * @return Products
- */
- public function setProductsQuantity($productsQuantity)
- {
- $this->productsQuantity = $productsQuantity;
- return $this;
- }
- /**
- * Get productsQuantity
- *
- * @return integer
- */
- public function getProductsQuantity()
- {
- return $this->productsQuantity;
- }
- /**
- * Set productsModel
- *
- * @param string $productsModel
- * @return Products
- */
- public function setProductsModel($productsModel)
- {
- $this->productsModel = $productsModel;
- return $this;
- }
- /**
- * Get productsModel
- *
- * @return string
- */
- public function getProductsModel()
- {
- return $this->productsModel;
- }
- /**
- * Set productsImage
- *
- * @param string $productsImage
- * @return Products
- */
- public function setProductsImage($productsImage)
- {
- $this->productsImage = $productsImage;
- return $this;
- }
- /**
- * Get productsImage
- *
- * @return string
- */
- public function getProductsImage()
- {
- return $this->productsImage;
- }
- /**
- * Set productsPrice
- *
- * @param string $productsPrice
- * @return Products
- */
- public function setProductsPrice($productsPrice)
- {
- $this->productsPrice = $productsPrice;
- return $this;
- }
- /**
- * Get productsPrice
- *
- * @return string
- */
- public function getProductsPrice()
- {
- return $this->productsPrice;
- }
- /**
- * Set productsDateAdded
- *
- * @param DateTime $productsDateAdded
- * @return Products
- */
- public function setProductsDateAdded($productsDateAdded)
- {
- $this->productsDateAdded = $productsDateAdded;
- return $this;
- }
- /**
- * Get productsDateAdded
- *
- * @return DateTime
- */
- public function getProductsDateAdded()
- {
- return $this->productsDateAdded;
- }
- /**
- * Set productsLastModified
- *
- * @param DateTime $productsLastModified
- * @return Products
- */
- public function setProductsLastModified($productsLastModified)
- {
- $this->productsLastModified = $productsLastModified;
- return $this;
- }
- /**
- * Get productsLastModified
- *
- * @return DateTime
- */
- public function getProductsLastModified()
- {
- return $this->productsLastModified;
- }
- /**
- * Set productsDateAvailable
- *
- * @param DateTime $productsDateAvailable
- * @return Products
- */
- public function setProductsDateAvailable($productsDateAvailable)
- {
- $this->productsDateAvailable = $productsDateAvailable;
- return $this;
- }
- /**
- * Get productsDateAvailable
- *
- * @return DateTime
- */
- public function getProductsDateAvailable()
- {
- return $this->productsDateAvailable;
- }
- /**
- * Set productsWeight
- *
- * @param string $productsWeight
- * @return Products
- */
- public function setProductsWeight($productsWeight)
- {
- $this->productsWeight = $productsWeight;
- return $this;
- }
- /**
- * Get productsWeight
- *
- * @return string
- */
- public function getProductsWeight()
- {
- return $this->productsWeight;
- }
- /**
- * Set productsStatus
- *
- * @param boolean $productsStatus
- * @return Products
- */
- public function setProductsStatus($productsStatus)
- {
- $this->productsStatus = $productsStatus;
- return $this;
- }
- /**
- * Get productsStatus
- *
- * @return boolean
- */
- public function getProductsStatus()
- {
- return $this->productsStatus;
- }
- /**
- * Set productsOrdered
- *
- * @param integer $productsOrdered
- * @return Products
- */
- public function setProductsOrdered($productsOrdered)
- {
- $this->productsOrdered = $productsOrdered;
- return $this;
- }
- /**
- * Get productsOrdered
- *
- * @return integer
- */
- public function getProductsOrdered()
- {
- return $this->productsOrdered;
- }
- /**
- * Set manufacturers
- *
- * @param ApwBlackbullBundleEntityManufacturers $manufacturers
- * @return Products
- */
- public function setManufacturers(ApwBlackbullBundleEntityManufacturers $manufacturers = null)
- {
- $this->manufacturers = $manufacturers;
- return $this;
- }
- /**
- * Get manufacturers
- *
- * @return ApwBlackbullBundleEntityManufacturers
- */
- public function getManufacturers()
- {
- return $this->manufacturers;
- }
- /**
- * @ORMPrePersist
- */
- public function setCreatedAtValue()
- {
- $date = new DateTime();
- $this->productsDateAdded = new DateTime($date->format('d-m-Y H:i:s'));
- }
- /**
- * Add productsImages
- *
- * @param ApwBlackbullBundleEntityProductsImages $productsImages
- * @return Products
- */
- public function addProductsImage(ApwBlackbullBundleEntityProductsImages $productsImages)
- {
- $this->productsImages[] = $productsImages;
- return $this;
- }
- /**
- * Remove productsImages
- *
- * @param ApwBlackbullBundleEntityProductsImages $productsImages
- */
- public function removeProductsImage(ApwBlackbullBundleEntityProductsImages $productsImages)
- {
- $this->productsImages->removeElement($productsImages);
- }
- /**
- * Get productsImages
- *
- * @return DoctrineCommonCollectionsCollection
- */
- public function getProductsImages()
- {
- return $this->productsImages;
- }
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->categories = new ArrayCollection();
- $this->productsImages = new ArrayCollection();
- $this->productsDescription = new ArrayCollection();
- }
- /**
- * Add categories
- *
- * @param ApwBlackbullBundleEntityCategories $categories
- * @return Products
- */
- public function addCategory(ApwBlackbullBundleEntityCategories $categories)
- {
- $this->categories[] = $categories;
- return $this;
- }
- /**
- * Remove categories
- *
- * @param ApwBlackbullBundleEntityCategories $categories
- */
- public function removeCategory(ApwBlackbullBundleEntityCategories $categories)
- {
- $this->categories->removeElement($categories);
- }
- /**
- * Get categories
- *
- * @return DoctrineCommonCollectionsCollection
- */
- public function getCategories()
- {
- return $this->categories;
- }
- /**
- * Add productsDescription
- *
- * @param ApwBlackbullBundleEntityProductsDescription $productsDescription
- * @return Products
- */
- public function addProductsDescription(ApwBlackbullBundleEntityProductsDescription $productsDescription)
- {
- $this->productsDescription[] = $productsDescription;
- return $this;
- }
- /**
- * Remove productsDescription
- *
- * @param ApwBlackbullBundleEntityProductsDescription $productsDescription
- */
- public function removeProductsDescription(ApwBlackbullBundleEntityProductsDescription $productsDescription)
- {
- $this->productsDescription->removeElement($productsDescription);
- }
- /**
- * Get productsDescription
- *
- * @return DoctrineCommonCollectionsCollection
- */
- public function getProductsDescription()
- {
- return $this->productsDescription;
- }
- }
- <?php
- namespace ApwBlackbullBundleEntity;
- use DoctrineCommonCollectionsArrayCollection;
- use DoctrineORMMapping as ORM;
- /**
- * Categories
- *
- * @ORMTable()
- * @ORMEntity(repositoryClass="ApwBlackbullBundleEntityCategoriesRepository")
- */
- class Categories
- {
- /**
- * @var integer
- *
- * @ORMColumn(name="id", type="integer")
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORMColumn(name="categories_image", type="string", length=64, nullable = true)
- */
- private $categoriesImage;
- /**
- * @var integer
- *
- * @ORMColumn(name="parent_id", type="integer", nullable = true, options={"default":0})
- */
- private $parentId;
- /**
- * @var integer
- *
- * @ORMColumn(name="sort_order", type="integer", nullable = true, options={"default":0})
- */
- private $sortOrder;
- /**
- * @var DateTime
- *
- * @ORMColumn(name="date_added", type="datetime", nullable = true)
- */
- private $dateAdded;
- /**
- * @var DateTime
- *
- * @ORMColumn(name="last_modified", type="datetime", nullable = true)
- */
- private $lastModified;
- /**
- * @var boolean
- *
- * @ORMColumn(name="categories_status", type="boolean", nullable = true, options={"default" = 1})
- */
- private $categoriesStatus;
- /**
- * @ORMOneToMany(targetEntity="CategoriesDescription", mappedBy="category")
- */
- private $categoryDescription;
- /**
- * @ORMManyToMany(targetEntity="Products", mappedBy="categories")
- **/
- private $products;
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set categoriesImage
- *
- * @param string $categoriesImage
- * @return Categories
- */
- public function setCategoriesImage($categoriesImage)
- {
- $this->categoriesImage = $categoriesImage;
- return $this;
- }
- /**
- * Get categoriesImage
- *
- * @return string
- */
- public function getCategoriesImage()
- {
- return $this->categoriesImage;
- }
- /**
- * Set parentId
- *
- * @param integer $parentId
- * @return Categories
- */
- public function setParentId($parentId)
- {
- $this->parentId = $parentId;
- return $this;
- }
- /**
- * Get parentId
- *
- * @return integer
- */
- public function getParentId()
- {
- return $this->parentId;
- }
- /**
- * Set sortOrder
- *
- * @param string $sortOrder
- * @return Categories
- */
- public function setSortOrder($sortOrder)
- {
- $this->sortOrder = $sortOrder;
- return $this;
- }
- /**
- * Get sortOrder
- *
- * @return string
- */
- public function getSortOrder()
- {
- return $this->sortOrder;
- }
- /**
- * Set dateAdded
- *
- * @param DateTime $dateAdded
- * @return Categories
- */
- public function setDateAdded($dateAdded)
- {
- $this->dateAdded = $dateAdded;
- return $this;
- }
- /**
- * Get dateAdded
- *
- * @return DateTime
- */
- public function getDateAdded()
- {
- return $this->dateAdded;
- }
- /**
- * Set lastModified
- *
- * @param DateTime $lastModified
- * @return Categories
- */
- public function setLastModified($lastModified)
- {
- $this->lastModified = $lastModified;
- return $this;
- }
- /**
- * Get lastModified
- *
- * @return DateTime
- */
- public function getLastModified()
- {
- return $this->lastModified;
- }
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->categoryDescription = new DoctrineCommonCollectionsArrayCollection();
- $this->products = new DoctrineCommonCollectionsArrayCollection();
- }
- /**
- * Add categoryDescription
- *
- * @param ApwBlackbullBundleEntityCategoriesDescription $categoryDescription
- * @return Categories
- */
- public function addCategoryDescription(ApwBlackbullBundleEntityCategoriesDescription $categoryDescription)
- {
- $this->categoryDescription[] = $categoryDescription;
- return $this;
- }
- /**
- * Remove categoryDescription
- *
- * @param ApwBlackbullBundleEntityCategoriesDescription $categoryDescription
- */
- public function removeCategoryDescription(ApwBlackbullBundleEntityCategoriesDescription $categoryDescription)
- {
- $this->categoryDescription->removeElement($categoryDescription);
- }
- /**
- * Get categoryDescription
- *
- * @return DoctrineCommonCollectionsCollection
- */
- public function getCategoryDescription()
- {
- return $this->categoryDescription;
- }
- /**
- * Add products
- *
- * @param ApwBlackbullBundleEntityProducts $products
- * @return Categories
- */
- public function addProduct(ApwBlackbullBundleEntityProducts $products)
- {
- $products->addCategory($this);
- $this->products[] = $products;
- return $this;
- }
- /**
- * Remove products
- *
- * @param ApwBlackbullBundleEntityProducts $products
- */
- public function removeProduct(ApwBlackbullBundleEntityProducts $products)
- {
- $this->products->removeElement($products);
- }
- /**
- * Get products
- *
- * @return DoctrineCommonCollectionsCollection
- */
- public function getProducts()
- {
- return $this->products;
- }
- /**
- * Set categoriesStatus
- *
- * @param boolean $categoriesStatus
- * @return Categories
- */
- public function setCategoriesStatus($categoriesStatus)
- {
- $this->categoriesStatus = $categoriesStatus;
- return $this;
- }
- /**
- * Get categoriesStatus
- *
- * @return boolean
- */
- public function getCategoriesStatus()
- {
- return $this->categoriesStatus;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement