<?php

/*
 * This file is part of the Doctrine Behavioral Extensions package.
 * (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Gedmo\Blameable\Traits;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * Trait for blamable objects.
 *
 * This implementation provides a mapping configuration for the Doctrine ORM.
 *
 * @author David Buchmann <mail@davidbu.ch>
 */
trait BlameableEntity
{
    /**
     * @var string
     *
     * @Gedmo\Blameable(on="create")
     *
     * @ORM\Column(nullable=true)
     */
    #[ORM\Column(nullable: true)]
    #[Gedmo\Blameable(on: 'create')]
    protected $createdBy;

    /**
     * @var string
     *
     * @Gedmo\Blameable(on="update")
     *
     * @ORM\Column(nullable=true)
     */
    #[ORM\Column(nullable: true)]
    #[Gedmo\Blameable(on: 'update')]
    protected $updatedBy;

    /**
     * Sets createdBy.
     *
     * @param string $createdBy
     *
     * @return $this
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

    /**
     * Returns createdBy.
     *
     * @return string
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * Sets updatedBy.
     *
     * @param string $updatedBy
     *
     * @return $this
     */
    public function setUpdatedBy($updatedBy)
    {
        $this->updatedBy = $updatedBy;

        return $this;
    }

    /**
     * Returns updatedBy.
     *
     * @return string
     */
    public function getUpdatedBy()
    {
        return $this->updatedBy;
    }
}
