Skip to content

Instantly share code, notes, and snippets.

@basz
Created November 21, 2012 15:14
Show Gist options
  • Select an option

  • Save basz/4125353 to your computer and use it in GitHub Desktop.

Select an option

Save basz/4125353 to your computer and use it in GitHub Desktop.
<?php
namespace SndAdmin\Entity;
use Doctrine\ORM\Mapping as ORM;
use ZfcUser\Entity\UserInterface;
/**
* @ORM\Entity
* @ORM\Table(name="users")
*/
class User extends \ZfcUserDoctrineORM\Entity\User
{
/**
* @ORM\Column(type="string",length=50,nullable=false);
*/
protected $privilege;
/**
* Get privilege.
*
* @param string $privilege
* @return string
*/
public function getPrivilege()
{
return $this->privilege;
}
/**
* Set privilege.
*
* @param string $privilege
* @return UserInterface
*/
public function setPrivilege($privilege)
{
$this->privilege = $privilege;
return $this;
}
}
Rattletrap:sandalinos.nl bas$ vendor/bin/doctrine-module orm:info
Found 7 mapped entities:
[OK] Application\Entity\Testimonial
[OK] SndAdmin\Entity\User
[OK] SndSpecialistLocator\Entity\Marker
[OK] SndCompositionTool\Entity\Composition
[OK] SndCompositionTool\Entity\PreOrder
[OK] ZfcUser\Entity\User
[OK] ZfcUserDoctrineORM\Entity\User
Rattletrap:sandalinos.nl bas$ vendor/bin/doctrine-module orm:schema-tool:update --dump-sql
CREATE TABLE users (user_id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, display_name VARCHAR(50) DEFAULT NULL, password VARCHAR(128) NOT NULL, privilege VARCHAR(50) NOT NULL, UNIQUE INDEX UNIQ_1483A5E9F85E0677 (username), UNIQUE INDEX UNIQ_1483A5E9E7927C74 (email), PRIMARY KEY(user_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE user (user_id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, display_name VARCHAR(50) DEFAULT NULL, password VARCHAR(128) NOT NULL, UNIQUE INDEX UNIQ_8D93D649F85E0677 (username), UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(user_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB
not what i want... so i change my SndAdmin\Entity\User to use the same column (remove Table annotation)
Rattletrap:sandalinos.nl bas$ vendor/bin/doctrine-module orm:info
Found 7 mapped entities:
[OK] Application\Entity\Testimonial
[OK] SndAdmin\Entity\User
[OK] SndSpecialistLocator\Entity\Marker
[OK] SndCompositionTool\Entity\Composition
[OK] SndCompositionTool\Entity\PreOrder
[OK] ZfcUser\Entity\User
[OK] ZfcUserDoctrineORM\Entity\User
Rattletrap:sandalinos.nl bas$ vendor/bin/doctrine-module orm:schema-tool:update --dump-sql
[Doctrine\DBAL\Schema\SchemaException]
The table with name 'sandalinos.user' already exists.
orm:schema-tool:update [--complete] [--dump-sql] [--force]
Rattletrap:sandalinos.nl bas$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment