[Flow] How to implement OneToMany Relation with constrain

Carsten Bleicker carsten at bleicker.de
Thu Jun 19 16:18:21 CEST 2014


class School{
	/**
	* @var Collection<Student> 
	* @ORM\OneToMany(mappedBy="school") 
	*/ 
	protected $students;
}


class Student{
	/**
	* @var School
	* @ORM\ManyToOne
	* @ORM\JoinColumn(onDelete="SET NULL") This one you need of a school gets deleted the student stays.
	* @ORM\Column(nullable=true) Nullable because of the SET NULL on delete of a school
	*/ 
	protected $school;
}

----------------------

Carsten Bleicker
Wülfingstraße 1
42477 Radevormwald

E-Mail:	carsten at bleicker.de
Web:	www.bleicker.de
Twitter:	@carstenbleicker
Jabber:	cbleicker at jabber.ccc.de
Telefon:	+49 (0)171-2690845

Am 19.06.2014 um 15:17 schrieb Rocky <rockysynergy at gmail.com>:

> Hi,
> 
> School and Student have ManyToMany relation. To simplify the association, One Student can attend One school only and one school can have many students at certain time. Thus the association between Student and School become OneToMany. Any idea how can I implement this with TYPO3 Flow please?
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow



More information about the Flow mailing list