[FLOW3-general] ORM Problems with 1.0

Patrick Sernetz patrickse at googlemail.com
Fri Oct 28 13:16:17 CEST 2011


Ok,

it´s working now. Thank you very much.... :)

Regards,
Patrick

2011/10/28 Stephan Schuler <stephan.schuler at netlogix.de>

> Hi Patrick.
>
>
> The sql error message you qouted talks about a syntax error near "from
> VARCHAR(40)".
>
> This points you to have kind of a naming conflict: Your property
> EmailMessage::$from gets mapped to a column called "from". Because
> doctrine doesn't qoute any column names, the create statement for your
> table is wrong.
>
> "CRATE TABLE `yourTable` (`from` VARCHAR(40) DEFAULT NULL)" would be
> correct, but
> "CRATE TABLE yourTable (from VARCHAR(40) DEFAULT NULL)" is wrong.
> "CRATE TABLE yourTable (fromField VARCHAR(40) DEFAULT NULL)" would be
> correct too, but this doesn't match your model at 100%.
>
>
> One sollution could be to add the "JoinColumn" annotation to your
> model and tell doctrine to use another column name then "from":
> @ORM\JoinColumn(name="from_field")
> This will keep your PHP/FLOW3 property $from but the SQL column will
> be "from_field" instead of "from".
>
> Another sollution could be to rename your property. Since "from" is
> correct in terms of email stuff, I would prefer to name it "sender",
> or "senderEmail" since "sender" would make me expect the senders
> FLOW3/Party object if it's an internal message.
>
>
> Kind regards,
>
> Stephan Schuler
> Web-Entwickler
>
> Telefon: +49 (911) 539909 - 0
> E-Mail: Stephan.Schuler at netlogix.de
> Website: media.netlogix.de
>
>
> --
> netlogix GmbH & Co. KG
> IT-Services | IT-Training | Media
> Andernacher Straße 53 | 90411 Nürnberg
> Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
> E-Mail: info at netlogix.de | Internet: http://www.netlogix.de
>
> netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA
> 13338) Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH
> (HRB 20634)
> Umsatzsteuer-Identifikationsnummer: DE 233472254
> Geschäftsführer: Stefan Buchta, Matthias Schmidt
>
>
>
>
>
>
>
> 2011/10/28 Patrick Sernetz <patrickse at googlemail.com>:
> > Hi Folks,
> >
> > I really have a problem with the doctrine in flow3. I´ve tried to setup a
> > OneToOne Relation within the domain model. According to the doctrine
> > documentation, this should be fine. BUt I am running into a problem when
> > updating the scheme with the flow commandline tool.
> >
> > Here´s my class
> >
> > <?php
> > namespace PS\Test\Domain\Model;
> >
> > /*
>  *
> >  * This script belongs to the FLOW3 package "CSG.Hibernate".
>  *
> >  *
>  *
> >  *
>  */
> >
> > use TYPO3\FLOW3\Annotations as FLOW3;
> > use Doctrine\ORM\Mapping as ORM;
> >
> > /**
> >  * A Email message
> >  *
> >  * @FLOW3\Scope("prototype")
> >  * @FLOW3\Entity
> >  */
> > class EmailMessage {
> >
> > /**
> >  * @var string
> >  */
> > protected $subject;
> >
> > /**
> >  * @var string
> >  */
> > protected $body;
> >
> > /**
> >  * @var PS\Test\Domain\Model\EmailAddress
> >  * @ORM\OneToOne
> >  */
> > protected $from;
> >
> > /**
> >  * @var PS\Test\Domain\Model\EmailAddress
> >  * @ORM\OneToOne
> >  */
> > protected $recipients;
> > }
> > ?>
> >
> > And the error message looks like that...
> >
> > patrick at ps-vm:/var/www/flow3$ ./flow3 doctrine:update
> > Uncaught Exception
> >  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
> error
> >  in your SQL syntax; check the manual that corresponds to your MySQL
> >  server version for the right syntax to use near 'from VARCHAR(40)
> DEFAULT
> >  NULL, recipients VARCHAR(40) DEFAULT NULL, subject VARC' at line 1
> >
> > More Information
> >  Exception code      #42000
> >  File
> >
>  /var/www/FLOW3-1.0.0/Packages/Framework/Doctrine/Classes/DBAL/Connection.php
> >
> > I am pretty sure that I am doing something wrong. Maybe one of you could
> > give me a hint.
> >
> > Thanks in advanced,
> >
> > Patrick
> > _______________________________________________
> > FLOW3-general mailing list
> > FLOW3-general at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>


More information about the FLOW3-general mailing list