daily pastebin goal
35%
SHARE
TWEET

Untitled

a guest May 16th, 2018 172 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. house
  2. +----------------------------------------------+
  3. | id |     title    |       description        |
  4. +----------------------------------------------+
  5. | 1  | some title 1 |    some description 1    |
  6. +----------------------------------------------+
  7. | 2  | some title 2 |    some description 2    |
  8. +----------------------------------------------+
  9.  
  10.        type
  11. +----------------+
  12. | id |   name    |
  13. +----------------+
  14. | 1  | shortstay |
  15. +----------------+
  16. | 2  | rent      |
  17. +----------------+
  18. | 4  | sell      |
  19. +----------------+
  20.  
  21.                   house_types
  22. +-----------------------------------+
  23. | id | house_id | type_id |  price  |
  24. +-----------------------------------+
  25. | 1  |    1     |   2     | 1000    |
  26. +-----------------------------------+
  27. | 2  |    1     |   3     | 1000000 |
  28. +-----------------------------------+
  29. | 3  |    2     |   1     | 100     |
  30. +-----------------------------------+
  31. | 4  |    2     |   3     | 200000  |
  32. +-----------------------------------+
  33.    
  34. class House extends EntityBase
  35. {
  36.     /**
  37.      * @ORMOneToMany(targetEntity="AppBundleEntityHouseHasTypes", mappedBy="houses", cascade={"persist","remove"})
  38.      */
  39.     protected $hasTypes;
  40.    
  41. class Type extends EntityBase
  42. {
  43.     /**
  44.      * @ORMOneToMany(targetEntity="AppBundleEntityHouseHasTypes", mappedBy="types", cascade={"persist","remove"})
  45.      */
  46.     protected $hasHouses;
  47.    
  48. class HouseHasTypes extends EntityBase
  49. {
  50.     /**
  51.      * @ORMManyToOne(targetEntity="AppBundleEntityHouse", cascade={"persist"}, fetch="EAGER")
  52.      * @ORMJoinColumn(name="house_id", referencedColumnName="id", nullable=true)
  53.      */
  54.     protected $houses;
  55.     /**
  56.      * @ORMManyToOne(targetEntity="AppBundleEntityType", cascade={"persist","remove"}, fetch="EAGER" )
  57.      * @ORMJoinColumn(name="type_id", referencedColumnName="id",nullable=true)
  58.      */
  59.     protected $types;
  60.     /**
  61.      * @var int
  62.      *
  63.      * @ORMColumn(name="price", type="integer")
  64.      */
  65.     protected $price;
  66.    
  67. $builder
  68. ...
  69. ->add('hasTypes', EntityType::class, array(
  70.                 'required' => true,
  71.                 'class' => Type::class,
  72.                 'expanded' => true,
  73.                 'multiple' => true,
  74.             ))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top