Skip to content

Commit

Permalink
make fluent
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 30, 2014
1 parent cfd9b5c commit 581eb82
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 7 deletions.
4 changes: 3 additions & 1 deletion Doctrine/Phpcr/AbstractMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function setParentDocument($parent)
if ($parent instanceof Directory) {
$parent->addChild($this);
}

return $this;
}

/**
Expand All @@ -52,7 +54,7 @@ public function getParentDocument()
*/
public function setParent($parent)
{
$this->setParentDocument($parent);
return $this->setParentDocument($parent);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion Doctrine/Phpcr/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function getName()
public function setName($name)
{
$this->nodename = $name;

return $this;
}

/**
Expand All @@ -58,14 +60,16 @@ public function setParentDocument($parent)
if ($parent instanceof Directory) {
$parent->addChild($this);
}

return $this;
}

/**
* {@inheritdoc}
*/
public function setParent($parent)
{
$this->setParentDocument($parent);
return $this->setParentDocument($parent);
}

/**
Expand Down
34 changes: 29 additions & 5 deletions Doctrine/Phpcr/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
class File extends DoctrineOdmFile implements FileInterface, BinaryInterface
{
/**
* @var string $description
* @var string
*/
protected $description;

/**
* @var string $copyright
* @var string Copyright text
*/
protected $copyright;

/**
* @var string $authorName
* @var string
*/
protected $authorName;

/**
* @var array $metadata
* @var array
*/
protected $metadata;

Expand All @@ -57,6 +57,8 @@ public function getName()
public function setName($name)
{
$this->nodename = $name;

return $this;
}

/**
Expand All @@ -69,14 +71,16 @@ public function setParentDocument($parent)
if ($parent instanceof Directory) {
$parent->addChild($this);
}

return $this;
}

/**
* {@inheritdoc}
*/
public function setParent($parent)
{
$this->setParentDocument($parent);
return $this->setParentDocument($parent);
}

/**
Expand All @@ -85,6 +89,8 @@ public function setParent($parent)
public function setDescription($description)
{
$this->description = $description;

return $this;
}

/**
Expand All @@ -101,6 +107,8 @@ public function getDescription()
public function setCopyright($copyright)
{
$this->copyright = $copyright;

return $this;
}

/**
Expand All @@ -117,6 +125,8 @@ public function getCopyright()
public function setAuthorName($authorName)
{
$this->authorName = $authorName;

return $this;
}

/**
Expand All @@ -133,6 +143,8 @@ public function getAuthorName()
public function setMetadata(array $metadata)
{
$this->metadata = $metadata;

return $this;
}

/**
Expand All @@ -157,6 +169,8 @@ public function getMetadataValue($name, $default = null)
public function setMetadataValue($name, $value)
{
$this->metadata[$name] = $value;

return $this;
}

/**
Expand All @@ -165,6 +179,8 @@ public function setMetadataValue($name, $value)
public function unsetMetadataValue($name)
{
unset($this->metadata[$name]);

return $this;
}

/**
Expand Down Expand Up @@ -197,6 +213,8 @@ public function setContentFromString($content)
}

$this->setContentFromStream($stream);

return $this;
}

/**
Expand All @@ -219,6 +237,8 @@ public function copyContentFromFile($file)
$type
));
}

return $this;
}

/**
Expand All @@ -245,6 +265,8 @@ public function setContentFromStream($stream)
}

$this->getContent()->setData($stream);

return $this;
}

/**
Expand All @@ -268,6 +290,8 @@ public function getSize()
public function setContentType($contentType)
{
$this->getContent()->setMimeType($contentType);

return $this;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions Doctrine/Phpcr/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class Image extends File implements ImageInterface
public function setWidth($width)
{
$this->width = $width;

return $this;
}

/**
Expand All @@ -50,6 +52,8 @@ public function getWidth()
public function setHeight($height)
{
$this->height = $height;

return $this;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions Doctrine/Phpcr/MediaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
use Symfony\Cmf\Bundle\MediaBundle\MediaInterface;
use Symfony\Cmf\Bundle\MediaBundle\MediaManagerInterface;

/**
* A media manager suitable for doctrine phpcr-odm.
*
* @author Roel Sint
*/
class MediaManager implements MediaManagerInterface
{
protected $managerRegistry;
Expand Down

0 comments on commit 581eb82

Please sign in to comment.