Rename Nosource tag into NoSource. Add fieldName property

This commit is contained in:
Benoît Burnichon
2016-03-09 15:51:00 +01:00
parent 4c9ad1f056
commit e52273480b
4 changed files with 24 additions and 24 deletions

View File

@@ -1,9 +1,8 @@
<?php
/*
/**
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -13,29 +12,30 @@ namespace Alchemy\Phrasea\Metadata\Tag;
use PHPExiftool\Driver\AbstractTag;
class Nosource extends AbstractTag
class NoSource extends AbstractTag
{
protected $Id = '';
protected $Name = '';
protected $FullName = '';
protected $GroupName = '';
protected $g0 = '';
protected $Id = 'no-source';
protected $Name = 'no-source';
protected $FullName = 'Phraseanet::no-source';
protected $GroupName = 'Phraseanet';
protected $g0 = 'Phraseanet';
protected $g1 = '';
protected $g2 = '';
protected $Type = '';
protected $Writable = false;
protected $Description = 'An empty source';
private $fieldName;
/**
* @param string $name
*/
public function __construct($name = '')
public function __construct($fieldName = '')
{
$this->Name = $name;
$this->fieldName = $fieldName;
}
public function getTagname()
public function getFieldName()
{
return $this->Name;
return $this->fieldName;
}
}

View File

@@ -17,7 +17,7 @@ use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvents;
use Alchemy\Phrasea\Metadata\TagFactory;
use Alchemy\Phrasea\Vocabulary;
use Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface;
use Alchemy\Phrasea\Metadata\Tag\Nosource;
use Alchemy\Phrasea\Metadata\Tag\NoSource;
use Doctrine\DBAL\Driver\Connection;
use PHPExiftool\Exception\TagUnknown;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
@@ -143,8 +143,8 @@ class databox_field implements cache_cacheableInterface
}
$this->name = $row['name'];
if ($this->tag instanceof Nosource) {
$this->tag = new Nosource($this->name);
if ($this->tag instanceof NoSource) {
$this->tag = new NoSource($this->name);
}
$this->indexable = (bool)$row['indexable'];
$this->readonly = (bool)$row['readonly'];
@@ -467,7 +467,7 @@ class databox_field implements cache_cacheableInterface
$tagName = str_ireplace('/rdf:rdf/rdf:description/', '', $tagName);
if ('' === trim($tagName)) {
return new Nosource();
return new NoSource();
}
try {
@@ -478,7 +478,7 @@ class databox_field implements cache_cacheableInterface
}
}
return new Nosource($tagName);
return new NoSource($tagName);
}
/**
@@ -488,7 +488,7 @@ class databox_field implements cache_cacheableInterface
public function set_tag($tag = null)
{
if ($tag === null) {
$tag = new Nosource();
$tag = new NoSource();
}
$this->tag = $tag;

View File

@@ -2,13 +2,13 @@
namespace Alchemy\Tests\Phrasea\Metadata\Tag;
use Alchemy\Phrasea\Metadata\Tag\Nosource;
use Alchemy\Phrasea\Metadata\Tag\NoSource;
class NosourceTest extends \PHPUnit_Framework_TestCase
class NoSourceTest extends \PHPUnit_Framework_TestCase
{
public function testObject()
{
$object = new Nosource;
$object = new NoSource;
$this->assertInstanceOf('\\PHPExiftool\\Driver\\TagInterface', $object);
$this->assertInternalType('string', $object->getDescription());

View File

@@ -148,8 +148,8 @@ class databox_fieldTest extends \PhraseanetTestCase
$this->object_mono->set_tag(null);
$this->object_multi->set_tag(null);
$this->assertEquals(new \Alchemy\Phrasea\Metadata\Tag\Nosource(), $this->object_mono->get_tag());
$this->assertEquals(new \Alchemy\Phrasea\Metadata\Tag\Nosource(), $this->object_multi->get_tag());
$this->assertEquals(new \Alchemy\Phrasea\Metadata\Tag\NoSource(), $this->object_mono->get_tag());
$this->assertEquals(new \Alchemy\Phrasea\Metadata\Tag\NoSource(), $this->object_multi->get_tag());
}
public function testGet_tag()