Working with doctrine 1 to 1 choose the related entity but for some reason it is empty?

ProductModel
Asu\Models\ProductModel:
 type: entity
 table: product
id:
id:
 type: integer
 length: 10
 column: product_id
generator:
 strategy: AUTO
fields:
priceId:
 type: integer
 length: 10
 column: price_id
oneToOne:
price:
 targetEntity: Asu\Models\PriceModel
joinColumn:
 name: price_id
 referencedColumnName: price_id


PriceModel
Asu\Models\PriceModel:
 type: entity
 table: price 
id:
id:
 type: integer
 length: 10
 column: price_id
generator:
 strategy: AUTO


PHP code
have protectd price; the property and prescribed for him the getter and setter.
public function setPrice($price)
{
 $this->price = $price;
 return $this;
 } 
 public function addPrice($price)
{
$this->setPrice($price);
}
 public function getPrice()
{
 return $this->price;
 }


If sushnosti to use without ties, they work but when not given the result is null.
$product = $productRepo->findOneBy(['code' => 'EN', 'number' => '101', 
 'color' => 'DB']);
 $price = $product->getPrice();

Code not falling, the product is fine but when I try to withdraw the price, it gives just Null. Although entry in the database is.
How to get a related record on a oneToOne
June 5th 19 at 21:40
2 answers
June 5th 19 at 21:42
This extra piece:

fields:
priceId:
 type: integer
 length: 10
 column: price_id


The doctrine itself will create all the necessary fields for communication.
June 5th 19 at 21:44
The problem was that I yuzal __call() it just ties on and broke.
Although normally issued values in normal sample.

public function __call($namefunction, $arguments)
{
 if (strlen($nameFunction) < 4):
return;
endif;
 $prefix = substr($nameFunction, 0, 3);
 $name = lcfirst(substr($nameFunction, 3, strlen($nameFunction) - 3));
 $inFields = array_search($name, self::$fields);
 if ($prefix == 'get'):
 if ($inFields):
 return $this->$name;
endif;
endif;
 if ($prefix == 'set'):
 if ($inFields):
 $value = $arguments[0];
 $this->$name = $value;
endif;
endif;
 }

Find more questions by tags Doctrine ORM