for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sulu\Bundle\ElasticsearchActivityLogBundle\Document;
use Ferrandini\Urlizer;
use ONGR\ElasticsearchBundle\Annotation\Object;
use ONGR\ElasticsearchBundle\Annotation\Property;
use Sulu\Component\Security\Authentication\UserInterface;
/**
* @Object
*/
class UserObject
{
* @var int
*
* @Property(type="integer")
public $id;
* @var string
* @Property(
* type="string",
* options={
* "fields":{
* "raw":{"type":"string", "index":"not_analyzed"},
* "folded":{"type":"string", "analyzer":"folding"},
* "value":{"type":"string"}
* }
* )
public $username;
* Set data.
* @param UserInterface $user
* @return $this
public function setData(UserInterface $user)
$this->id = $user->getId();
$this->username = $user->getUsername();
return $this;
}
* Return username slug.
* @param string $fallback
* @return string
public function getSlug($fallback = 'user')
return Urlizer::urlize($this->username) ?: $fallback;
* {@inheritdoc}
public function __toString()
return $this->username;