user2839159
user2839159

Reputation: 463

Doctrine - Database type sysname

When a database type not recognised by Doctrine (sysname in my case), how i can force Doctrine at accepted that ? Type sysname is an equivalent at varchar type but Doctrine doesnt supported ... and i can't change type of my table.

Maybe a solution with install a driver or maybe like that ?

For information, my database is an SQL Server 2005 and command for generate ORM is :

php app/console doctrine:mapping:import MyBundle yml

And when i trying --filter="TableName" it don't work.

Thanks a lot.

Upvotes: 0

Views: 224

Answers (1)

Satyam Saxena
Satyam Saxena

Reputation: 571

In Doctrine, if it is varcahr type simply do like below in your model class:

Assuming table fieldname is FirstName

/**
 * @var string $firstName
 * @Column(name="FirstName", type="string", length=60, nullable=false)
 */
protected $firstName;


/**
 * Set the first name
 *
 * @param $firstName
 * @return string
 */
public function setFirstName($firstName)
{
    $this->firstName = $firstName;
    return $this;
}

/**
 * Get the first name
 *
 * @return string
 */
public function getFirstName()
{
    return $this->firstName;
}

Upvotes: 0

Related Questions