symfony - Doctrine: No identifier/primary key specified for -
so have set still get:
no identifier/primary key specified entity "bisna\application\entity\company". every entity must have identifier/primary key.
entity:
<?php namespace bisna\application\entity; use doctrine\orm\mapping orm; /** * company * * @orm\table(name="companies") * @orm\entity */ class company{ /** * @var integer $id * * @orm\id * orm\column(name="id", type="integer", nullable=false) * @orm\generatedvalue(strategy="identity") */ protected $id; /** * @var string $industry * * @orm\manytoone(targetentity="companyindustry", inversedby="company_industry") * @orm\joincolumn(name="industry_id", referencedcolumnname="id", nullable=false) */ protected $industry; /** * @var string $billingaddress * * @orm\manytoone(targetentity="billingaddress", inversedby="billing_addresses") * @orm\joincolumn(name="billing_address_id", referencedcolumnname="id", nullable=false) */ protected $billingaddress; /** * @var string $companyname * * @orm\column(name="companyname", type="string", length=255, nullable=false) */ protected $companyname; /** * @var string $website * * @orm\column(name="website", type="string", length=255, nullable=true) */ protected $website; /** * @var string $address * * @orm\column(name="address", type="string", length=255, nullable=true) */ protected $address; /** * @var string $employeesnumber * * @orm\column(name="employees_number", type="string", length=255, nullable=true) */ protected $employeesnumber; /** * @var string $streetnumber * * @orm\column(name="street_number", type="string", length=255, nullable=true) */ protected $streetnumber; /** * @var string $street * * @orm\column(name="street", type="string", length=255, nullable=true) */ protected $street; /** * @var string $city * * @orm\column(name="city", type="string", length=255, nullable=false) */ protected $city; /** * @var string $cityvarname * * @orm\column(name="city_varname", type="string", length=255, nullable=true) */ protected $cityvarname; /** * @var string $state * * @orm\column(name="state", type="string", length=255, nullable=true) */ protected $state; /** * @var string $statevarname * * @orm\column(name="state_varname", type="string", length=255, nullable=true) */ protected $statevarname; /** * @var string $statecode * * @orm\column(name="state_code", type="string", length=255, nullable=true) */ protected $statecode; /** * @var string $postalcode * * @orm\column(name="postal_code", type="string", length=255, nullable=true) */ protected $postalcode; /** * @var string $country * * @orm\column(name="country", type="string", length=255, nullable=true) */ protected $country; /** * @var string $countryvarname * * @orm\column(name="country_varname", type="string", length=255, nullable=true) */ protected $countryvarname; /** * @var string $countrycode * * @orm\column(name="country_code", type="string", length=255, nullable=true) */ protected $countrycode; /** * @var string $latitude * * @orm\column(name="latitude", type="string", length=255, nullable=true) */ protected $latitude; /** * @var string $longitude * * @orm\column(name="longitude", type="string", length=255, nullable=true) */ protected $longitude; /** * @var string $email * * @orm\column(name="email", type="string", length=255, nullable=true) */ protected $email; /** * @var string $password * * @orm\column(name="password", type="string", length=255, nullable=true) */ protected $password; /** * @var string $firstname * * @orm\column(name="firstname", type="string", length=255, nullable=false) */ protected $firstname; /** * @var string $lastname * * @orm\column(name="lastname", type="string", length=255, nullable=false) */ protected $lastname; /** * @var collection $jobs * * @orm\onetomany(targetentity="companyjob", mappedby="company", cascade={"persist", "remove"}) * @orm\orderby({"created" = "asc"}) */ protected $jobs; /** * @var string $activationcode * * @orm\column(name="activationcode", type="string", length=255, nullable=true) */ protected $activationcode; /** * @var string $resetpasswordcode * * @orm\column(name="resetpasswordcode", type="string", length=255, nullable=true) */ protected $resetpasswordcode; /** * @var string $status ['activation', 'active', 'inactive'] * * @orm\column(name="status", type="string", length=255, nullable=false) */ protected $status; /** * @var datetime $created * * @orm\column(name="created", type="datetime", nullable=false) */ protected $created; /* .... */ }
i haven't made tables yet, still, don't understand why i'm getting error since have everything. ideas?
maybe it's because missed @
before @orm\column
annotation $id
property?
you should consider using yaml doctrine mappings. it's way separate entity database columns definitions. , besides, ide should validate yaml contents whereas doesn't validate php comments php code.
Comments
Post a Comment