I was right.

It was sosimple as to be imbecilic.

I looked at the examples (again, again) and then noticed in my code

<code>
     * @ORM\Column()
 </code>

Before the many to one declaration.

Oops.  Mistake.

so now I'm flying again.

Sorry to disturb the peace.

Barry

On Tuesday, 29 April 2014 15:38:17 UTC+10, Barry Steele wrote:
>
> Hi,
>
> I have an entity
>
> Room
>
> with (among lots of other columns ) I have set upthe following
>
>  
> <code>
>     
>     /**
>      *
>      * @ORM\Column()
>      * @ORM\ManyToOne (targetEntity= "Building",fetch="EAGER")
>      * @ORM\JoinTable(name="building",{@ORM\JoinColumn(name="building_id", 
> referencedColumnName="id")})
>      */
>     protected $building;
>
> <.code>
>
> My room tablelooks like
>
> <DDL>
> CREATE TABLE room ( 
>
> id int NOT NULL,
>         building_id int NOT NULL,
> level  int NOT NULL,
>  ... lots more coliumns );
>
> ALTER TABLE [room]  WITH CHECK ADD  CONSTRAINT [FK_room_asset_regisiter] 
> FOREIGN KEY([id])
> REFERENCES [asset_register] ([id])
>
> ALTER TABLE [room]  WITH CHECK ADD  CONSTRAINT [FK_room_building] FOREIGN 
> KEY([building_id])
> REFERENCES [building] ([id])
>
> CREATE TABLE [building](
> [id] [int] NOT NULL,
> [site_id] [int] NOT NULL,
>
> etc
>
> </DDL>
>
>
> When I query rooms I get an SQL error :
>
> <output>
>
> An exception occurred while executing 'SELECT t0.id AS id1, t0.building AS 
> building2, blah
>
> SQLSTATE [42S22, 207]: [Microsoft][SQL Server Native Client 11.0][SQL 
> Server]Invalid column name 'building'.
>
> </output>
>
> I've obviously missed something here.  
>
> Originally I had the attribute as room->building_id with the annotations 
> above and the query works but I don't get any building info.
>
> I know this must be a really dumb thing, but I'm out of ideas.
>
> Stay well
> Barry
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to