2013-11-04 17:27:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Propel\PropelBundle\Tests\Fixtures;
|
|
|
|
|
|
|
|
use Propel\Runtime\Util\PropelColumnTypes;
|
|
|
|
|
|
|
|
class Column
|
|
|
|
{
|
|
|
|
private $name;
|
|
|
|
|
|
|
|
private $type;
|
|
|
|
|
|
|
|
public function __construct($name, $type)
|
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
$this->type = $type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getType()
|
|
|
|
{
|
|
|
|
return $this->type;
|
|
|
|
}
|
|
|
|
|
2013-11-04 22:08:41 +01:00
|
|
|
public function isText()
|
2013-11-04 17:27:38 +01:00
|
|
|
{
|
|
|
|
if (!$this->type) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($this->type) {
|
|
|
|
case PropelColumnTypes::CHAR:
|
|
|
|
case PropelColumnTypes::VARCHAR:
|
|
|
|
case PropelColumnTypes::LONGVARCHAR:
|
|
|
|
case PropelColumnTypes::BLOB:
|
|
|
|
case PropelColumnTypes::CLOB:
|
|
|
|
case PropelColumnTypes::CLOB_EMU:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSize()
|
|
|
|
{
|
2013-11-04 22:08:41 +01:00
|
|
|
return $this->isText() ? 255 : 0;
|
2013-11-04 17:27:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function isNotNull()
|
|
|
|
{
|
|
|
|
return ('id' === $this->name);
|
|
|
|
}
|
|
|
|
}
|