Ah good call, Thanks, this is the solution! On Jan 28, 6:40 am, Eugene Leonovich <[email protected]> wrote: > This change can solve the first problem: > > -private $id; > +protected $id; > > On Jan 28, 2:47 am, DisTurBinG <[email protected]> wrote: > > > > > > > > > Hello All, > > > I'm new and having a problem with inheritance. > > > I have two things I want to solve > > > First: > > > Input: [b]console doctrine:generate:entities [/b] > > Error: [b]No identifier/primary key specified for Entity 'Bundle > > \RegisterBundle\Entity\Member'. Every Entity must have an identifier/ > > primary key. [/b] > > > The Primary key is not being inherited for some reason. How could I > > use ORM to allow the parent to have a primary key? > > > NOTE: [b]I know that the orm works because if I put the ID into both > > Member.php and AbstractMember.php, It works fine and creates the > > tables.[/b] > > > Code: > > // AbstractMember.php > > [code] > > /** > > * @orm:Entity > > * @orm:InheritanceType("SINGLE_TABLE") > > * @orm:DiscriminatorColumn(name="discr", type="string") > > * @orm:DiscriminatorMap({"member" = "AbstractMember", "cookon_member" > > = "CookonMember"}) > > * @orm:Table(name="member") > > * > > * Abstract member class > > * > > * @author Disturbing > > */ > > abstract class AbstractMember > > { > > /** > > * @orm:id > > * @orm:Column(type="integer") > > * @orm:GeneratedValue(strategy="IDENTITY") > > */ > > private $id; > > > /** > > * @orm:email > > * @orm:Column(type="string", length="32") > > * > > * @validation:NotBlank(message="You must enter your email > > address.") > > * @validation:Email(checkMX=true) > > * @validation:MaxLength(32) > > */ > > private $email; > > > /** > > * @orm:password > > * @orm:Column(type="string", length="32") > > * > > * @validation:NotBlank(message="You must enter a password.") > > * @validation:MinLength(6) > > * @validation:MaxLength(32) > > */ > > private $password; > > > public function getEmail() > > { > > return $this->email; > > } > > > public function setEmail($email) > > { > > $this->email = $email; > > } > > > public function getPassword() > > { > > return $this->email; > > } > > > public function setPassword($password) > > { > > $this->password = $password; > > }} > > > [/code] > > Code: > > // Member.php > > [code] > > <?php > > > namespace Bundle\RegisterBundle\Entity; > > > /** > > * @orm:Entity > > * @orm:inheritance(type="simple", extends="AbstractMember") > > * > > * Unique Member Class > > * > > * @author Disturbing > > * > > */ > > class Member extends AbstractMember > > { > > /** > > * @orm:first_name > > * @orm:email > > * @orm:Column(type="string", length="16") > > * > > * @validation:NotBlank(message="You must enter a first name.") > > * @validation:MinLength(2) > > * @validation:MaxLength(16) > > * @validation:Regex(pattern="{^[A-Za-z]+$}", message="Last name > > must only container letters.") > > */ > > private $firstName; > > /** > > * @orm:last_name > > * @orm:Column(type="string", length="16") > > * > > * @validation:NotBlank(message="You must enter a last name.") > > * @validation:MinLength(2) > > * @validation:MaxLength(16) > > * @validation:Regex(pattern="{^[A-Za-z]+$}", message="Last name > > must only container letters.") > > */ > > private $lastName; > > > /** > > * @orm:zip_code > > * @orm:Column(type="integer") > > * > > * @validation:NotBlank(message="You must enter your zip code.") > > * @validation:AssertType(type="numeric", message="You entered an > > invalid zip code.") > > * @validation:MaxLength(5) > > */ > > private $zipCode; > > > public function getFirstName() > > { > > return $this->firstName; > > } > > > public function setFirstName($firstName) > > { > > $this->firstName = $firstName; > > } > > > public function getLastName() > > { > > return $this->lastName; > > } > > > public function setLastName($lastName) > > { > > $this->lastName = $lastName; > > } > > > public function getZipCode() > > { > > return $this->zipCode; > > } > > > public function setZipCode($zipCode) > > { > > $this->zipCode = $zipCode; > > }} > > > [/code] > > > Second Problem: > > > With Inheritance, why do I need @orm:DiscriminatorColumn(name="discr", > > type="string"). > > I want to be inheriting with a SINGLE_TABLE and no references. Maybe > > the discriminator key needs to be unique id? Please explain on this > > if any. > > > I've looked all over google and can't find a solution, it seems just > > basic: * @orm:inheritance(type="simple", extends="AbstractMember") > > with YML configuration works fine from what people say, but it isn't > > here. > > > Best Regards, Thanks in Advance and Thanks for the wonderful > > Framework. > > > ~DisTurBinG
-- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
