for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* YAWIK
*
* @filesource
* @license MIT
* @copyright 2013 - 2016 Cross Solution <http://cross-solution.de>
*/
/** */
namespace Core\Entity;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
* Implementation of \Core\Entity\MetaDataProviderInterface
* @author Mathias Gelhausen <[email protected]>
* @since 0.27
trait MetaDataProviderTrait
{
* The meta data array.
* @ODM\Field(type="hash")
* @var array
private $metaData = [];
public function setMetaData($key, $value)
$this->metaData[$key] = $value;
return $this;
}
* Get meta data.
* Returns the whole meta data array, if no <i>$key</i> is provided.
* Returns <i>$default</i>, if there is no meta data for the provided <i>$key</i>.
* @param null|string $key
* @param null|mixed $default
* @return array|mixed|null
public function getMetaData($key = null, $default = null)
if (null === $key) {
return $this->metaData;
return $this->hasMetaData($key) ? $this->metaData[$key] : $default;
public function hasMetaData($key)
return array_key_exists($key, $this->metaData);