Doctrine 2: Error: Class ".. \ .." does not have a field or association with the name "..."

When searching, I came up with a lot of results for people having similar problems, but they were always associated with association errors. I’m trying to add a simple text box to a table in a database, and throughout my life I can’t understand what makes us different at this time - when I did this without problems many times before.

I added the "record_checksum" field to 4 different objects, but I will use only one to simplify the example. (The same thing happens for all 4).

Here is an example of my Entity \ Cloud.php file, in the field " record_checksum " is added below:

use Doctrine\ORM\Mapping as ORM;

namespace Entity;

/**
 * Entity\Cloud
 *
 * @orm:Table(name="cloud")
 * @orm:Entity
 * @orm:HasLifecycleCallbacks
 */
class Cloud
{
    /**
     * @var integer $id
     *
     * @orm:Column(name="id", type="integer", length="13")
     * @orm:Id
     * @orm:GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var float $position_x
     *
     * @orm:Column(name="position_x", type="float", length=9)
     */
    private $position_x;

    /**
     * @var float $position_y
     *
     * @orm:Column(name="position_y", type="float", length=9)
     */
    private $position_y;

    /**
     * @var string $commit_group
     *
     * @orm:Column(name="commit_group", type="string", length=32, nullable=true)
     */
    private $commit_group;

    /**
     * @var string $commit_key
     *
     * @orm:Column(name="commit_key", type="string", length=13, nullable=true)
     */
    private $commit_key;

    /**
     * @var string $record_checksum
     *
     * @orm:Column(name="record_checksum", type="string", length=32, nullable=true)
     */
    private $record_checksum;

- getter/setter, . Entity, pastebin (http://pastebin.com/9LheZ6A1). "Commit_key", , .

:

$ doctrine orm:schema-tool:update --dump-sql
ALTER TABLE cloud ADD record_checksum VARCHAR(32) DEFAULT NULL;
$ doctrine orm:schema-tool:update --force
Updating database schema...
Database schema updated successfully!

, DB.

, DQL-, :

$dql =  "SELECT c.id AS id, c.commit_key AS key, c.record_checksum AS checksum ".
                "FROM Entity\\Cloud c WHERE c.commit_group = :commit_group";

:

 [Semantical Error] line 0, col 42 near 'record_checksum': Error: Class Entity\Cloud has no field or association named record_checksum, 

- . , - . ! -Nick

+3
2

:

  • , PHP.
  • , .
+4

Entity . - TESTVar, TESTVar , , Entity.

TESTVar TESTVar, .

0

All Articles