Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Sport {
- /**
- * Bidirectional - Many facilies are related to one sport
- *
- * @ORMOneToMany(targetEntity="SportsFacility", mappedBy="sport")
- */
- protected $facilities;
- public function getFacilities() {
- return $this->facilities;
- }
- public function setFacilities($facilities) {
- $this->facilities = $facilities;
- return $this;
- }
- }
- class Facility {
- /**
- * Bidirectional - Many sports are related to one facility
- *
- * @ORMOneToMany(targetEntity="SportsFacility", mappedBy="facility")
- */
- protected $sports;
- public function getSports() {
- return $this->sports;
- }
- public function setSports($sportsFacilities) {
- $this->sports = $sportsFacilities;
- return $this;
- }
- public function addSports($sportsFacilities) {
- $this->sports = $sportsFacilities;
- return $this;
- }
- }
- class SportsFacility {
- /**
- * @var integer $sportsFacilityId
- *
- * @ORMColumn(name="sportsFacilityId", type="integer", nullable=false)
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- */
- protected $sportsFacilityId;
- /**
- * Bidirectional - Many Sports are related to one Facility (OWNING SIDE)
- *
- * @ORMManyToOne(targetEntity="Sport", inversedBy="facilities"))
- * @ORMJoinColumn(name="sportId", referencedColumnName="sportId"))
- */
- protected $sport;
- /**
- * Bidirectional - Many Facilities are related to one Sport (OWNING SIDE)
- *
- * @ORMManyToOne(targetEntity="Facility", inversedBy="sports"))
- * @ORMJoinColumn(name="facilityId", referencedColumnName="facilityId"))
- */
- protected $facility;
- public function getSportsFacilityId() {
- return $this->sportsFacilityId;
- }
- public function setSportsFacilityId($sportsFacilityId) {
- $this->sportsFacilityId = $sportsFacilityId;
- return $this;
- }
- public function getSport() {
- return $this->sport;
- }
- public function setSport($sport) {
- $this->sport = $sport;
- return $this;
- }
- public function getFacility() {
- return $this->facility;
- }
- public function setFacility($facility) {
- $this->facility = $facility;
- return $this;
- }
- }
- protected function configureFormFields(FormMapper $formMapper)
- {
- $formMapper
- ->add('name')
- ->with('Sports')
- ->add('sports', 'sonata_type_collection',
- array('by_reference' => false),
- array(
- 'edit' => 'inline',
- 'inline' => 'table',
- ))
- ->end();
- }
Add Comment
Please, Sign In to add comment