i try make onetoone relation from example - http://docs.doctrine-project.org/en/latest/tutorials/composite-primary-keys.html#use-case-2-simple-derived-identity
this is second try , first is here symfony 2 doctrine relation onetoone
Adres
<?php
/**
* Created by PhpStorm.
* User: grek
* Date: 18.12.13
* Time: 16:33
*/
namespace Miejsce\ObiektyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class Adres {
/**
* @var integer
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
public $street;
/**
* @ORM\OneToOne(targetEntity="Miejsce\ObiektyBundle\Entity\User") */
private $user;
}
User
<?php
/**
* Created by PhpStorm.
* User: grek
* Date: 18.12.13
* Time: 16:33
*/
namespace Miejsce\ObiektyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class User {
/**
* @var integer
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
public $name;
/**
* @ORM\OneToOne(targetEntity="Miejsce\ObiektyBundle\Entity\Adres")
*/
private $adres;
}
and have : php app/console doctrine:schema:update --force
php app/console doctrine:schema:update --force
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Doctrine\ORM\Mapping" in property Miejsce\ObiektyBundle\Entity\Adres::$user does not e
xist, or could not be auto-loaded.
So where i can have error ?
- error was in syntax - i have @ORM/OneToOne but need @ORM\OneToOne now work fine ! :)