Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- house
- +----------------------------------------------+
- | id | title | description |
- +----------------------------------------------+
- | 1 | some title 1 | some description 1 |
- +----------------------------------------------+
- | 2 | some title 2 | some description 2 |
- +----------------------------------------------+
- type
- +----------------+
- | id | name |
- +----------------+
- | 1 | shortstay |
- +----------------+
- | 2 | rent |
- +----------------+
- | 4 | sell |
- +----------------+
- house_types
- +-----------------------------------+
- | id | house_id | type_id | price |
- +-----------------------------------+
- | 1 | 1 | 2 | 1000 |
- +-----------------------------------+
- | 2 | 1 | 3 | 1000000 |
- +-----------------------------------+
- | 3 | 2 | 1 | 100 |
- +-----------------------------------+
- | 4 | 2 | 3 | 200000 |
- +-----------------------------------+
- class House extends EntityBase
- {
- /**
- * @ORMOneToMany(targetEntity="AppBundleEntityHouseHasTypes", mappedBy="houses", cascade={"persist","remove"})
- */
- protected $hasTypes;
- class Type extends EntityBase
- {
- /**
- * @ORMOneToMany(targetEntity="AppBundleEntityHouseHasTypes", mappedBy="types", cascade={"persist","remove"})
- */
- protected $hasHouses;
- class HouseHasTypes extends EntityBase
- {
- /**
- * @ORMManyToOne(targetEntity="AppBundleEntityHouse", cascade={"persist"}, fetch="EAGER")
- * @ORMJoinColumn(name="house_id", referencedColumnName="id", nullable=true)
- */
- protected $houses;
- /**
- * @ORMManyToOne(targetEntity="AppBundleEntityType", cascade={"persist","remove"}, fetch="EAGER" )
- * @ORMJoinColumn(name="type_id", referencedColumnName="id",nullable=true)
- */
- protected $types;
- /**
- * @var int
- *
- * @ORMColumn(name="price", type="integer")
- */
- protected $price;
- $builder
- ...
- ->add('hasTypes', EntityType::class, array(
- 'required' => true,
- 'class' => Type::class,
- 'expanded' => true,
- 'multiple' => true,
- ))
Add Comment
Please, Sign In to add comment