Problems iterating PersistentCollection

I'm new to Doctrine and I'm having an issue iterating over a PersistentCollection, I have some basic entities set up with a ManyToMany relationship:

 class File {

     /**
      * @ManyToMany(targetEntity="Row", mappedBy="file")
      **/
     protected $rows;

     public function __construct()
     {
         $this->rows = new ArrayCollection();
     }

     public function getRows()
     {
         return $this->rows; //this seems to return a persistantCollection
     } 
}

class Row {

    /**
     * @ManyToOne(targetEntity="File", inversedBy="rows")
     **/
    protected $file;
}

The error log reports the following, but I can't understand what is being reported.

[02-May-2013 09:07:29 UTC] PHP Notice:  Undefined index: id in /Applications/MAMP/htdocs/NiCE/datatable.php on line 9

[02-May-2013 09:07:29 UTC] PHP Notice:  Undefined index: joinTable in /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php on line 90

[02-May-2013 09:07:29 UTC] PHP Notice:  Undefined index: joinTable in /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php on line 969

[02-May-2013 09:07:29 UTC] PHP Warning:  Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php on line 969

[02-May-2013 09:07:29 UTC] PHP Notice:  Undefined index: joinTable in /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php on line 90

[02-May-2013 09:07:29 UTC] PHP Notice:  Undefined index: joinTable in /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php on line 1249

[02-May-2013 09:07:29 UTC] PHP Warning:  Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php on line 1251

[02-May-2013 09:07:29 UTC] PHP Fatal error:  Uncaught exception 'PDOException' with message '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 'ON' at line 1' in /Applications/MAMP/htdocs/NiCE/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:646

Stack trace:

#0 /Applications/MAMP/htdocs/NiCE/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(646): PDO->query('SELECT t0.id AS...')

#1 /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(997): Doctrine\DBAL\Connection->executeQuery('SELECT t0.id AS...', Array, Array)

#2 /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(928): Doctrine\ORM\Persisters\BasicEntityPersister->getManyToManyStatement(Array, Object(File))

#3 /Applications/MAMP/htdocs/NiCE/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(2694): Doctrine\ORM\Persisters\BasicEntityPersister->loadMany in /Applications/MAMP/htdocs/NiCE/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php on line 47

Answers


Problem was that I had the relationships confused, the File.rows is a OneToMany, and Row.file is ManyToOne.


Need Your Help

How would you convert this to valid VB.NET?

c# asp.net-mvc vb.net

I found an article on removing whitespace from my markup in ASP.NET MVC, however, when I use the code converter, the "function" is not properly converted

File Upload error using phone gap and php

cordova jquery-mobile phonegap-plugins

I'm trying to Upload a image from android Emulator, using phonegap, while transferring the file from emulator to php file in server i'm getting File Transfer error. Can any one please suggest how to

Error converting data type varchar to numeric when casting varchar(max) to decimal

tsql stored-procedures sql-server-2008-r2 varchar

I'm trying to sum values from two strings. In order to do that I'm casting the strings in to decimals, add them up and then cast it back to string for the output. Also using max to avoid duplication