I have a simple many-to-one entity:
class Property
{
/**
* @Id
* @Column(type="integer", nullable=false)
* @GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Column(name="pkey", type="string", nullable=false)
*/
protected $key;
/**
* @Column(type="text", nullable=false)
*/
protected $value;
/**
* @ManyToOne(targetEntity="Entity", inversedBy="properties")
*/
protected $entity;
}
which creates:
CREATE TABLE `properties` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`entity_id` int(11) DEFAULT NULL,
`pkey` varchar(255) NOT NULL,
`value` longtext NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `property_unique` (`entity_id`,`pkey`),
KEY `IDX_87C331C781257D5D` (`entity_id`),
CONSTRAINT `FK_87C331C781257D5D` FOREIGN KEY (`entity_id`) REFERENCES `entities` (`id`)
)
Adding nullable=false to the @ManyToOne is currently not possible:
[Creation Error] The annotation @ManyToOne declared on property Volkszaehler\Model\Property::$entity does not have a property named "nullable".
Available properties: targetEntity, cascade, fetch, inversedBy
As entity is a foreign key it would be nice, if it could be made not nullable.
I have a simple many-to-one entity:
which creates:
Adding
nullable=falseto the@ManyToOneis currently not possible:As entity is a foreign key it would be nice, if it could be made not nullable.