Cell phone Coding practice Consumption assertion cost efficacy costs saving Departed material distributor ecommerce economic terrorism economics Entity machinery environmental sustainability EU goods Exposed fraud Franchise gaming gdm Insurgency block irregularities micro web app NATO infringements orm OS defaults PayPal fraud Presentation awesomeness Rendered secure separation of concerns Shipping delivery stock market supply chain tbsm TLS demand TUring test turnover Wifi durability

PSR standards and Doctrine ORM clashes

A Doctrine ORM entity, imported from database annotations base is a plain old text of camel case variables, which isn't necessarily PSR (PHP standardization efforts) compliant. It has to be rearranged to benefit from fraudless QA signal interpretations.

Entity for consideration:

<?php

namespace PBG\SOLID;

use App\Domain\SOLID\Note as SOLIDNote;
use App\SOLID\Note;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\UuidInterface;

/**
 * VoiceMemo
 *
 * @ORM\Table(name="voice_memo", indexes={@ORM\Index(name="note", columns={"note"})})
 * @ORM\Entity
 */
class VoiceMemo
{
    /**
     * @var \Ramsey\Uuid\UuidInterface
     *
     * @ORM\Column(name="id", type="uuid", unique=true)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="CUSTOM")
     * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
     */
    private $_id;

    /**
     * @var string
     *
     * @ORM\Column(name="record", type="blob", length=65535, nullable=false)
     */
    private $_record;

    /**
     * @var \PBG\SOLID\Note
     *
     * @ORM\ManyToOne(targetEntity="App\Domain\SOLID\Note")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="note", referencedColumnName="id")
     * })
     */
    private $_note;

    /**
     * UUID getter
     *
     * @return UuidInterface
     */
    public function getId()
    {
        return $this->_id;
    }

    /**
     * Record setter
     *
     * @param string $record record
     * 
     * @return self
     */
    public function setRecord(string $record)
    {
        $this->_record = $record;

        return $this;
    }

    /**
     * Record getter
     *
     * @return string
     */
    public function getRecord()
    {
        return $this->_record;
    }

    /**
     * Note setter
     *
     * @param PBG\SOLID\Note $note note
     * 
     * @return self
     */
    public function setNote(SOLIDNote $note)
    {
        $this->_note = $note;

        return $this;
    }

    /**
     * Note getter
     *
     * @return Note
     */
    public function getNote()
    {
        return $this->_note;
    }


}

PSR requires it to be private variables underscore prefixed, so it has additional step (process management) to apply this directive to a code, because Doctrine ORM imported from database annotation based references are plain old camel case scenarios oriented.

Not big fuss, but it is compulsory, if wanted to distance from so called ‘enterprise practices’ and focus on benefits of non-infringing screen QA signals.

%d bloggers like this: