Skip to content

[PropertyInfo] Property case depends on the second character's case #32656

@jdsaphir

Description

@jdsaphir

Symfony version(s) affected: 4.3.2

Description
Using camelCase, with an attribute $aFooBar, naming the getter/setter getAFooBar()/setAFooBar() returns the property name as AFooBar instead of aFooBar.

I'm not sure if this is a bug or intended behavior, but it seems weird that the second character's case dictates the first character case, as:

  • getAFooBar returns the property name as AFooBar (1&2 uppercase => 1&2 uppercase)
  • getAfooBar returns the property name as afooBar (1 uppercase & 2 lowercase => 1&2 lowercase)

Found it out the hard way through api-platform/core#2941

Generating the getter with make:entity from the attribute $aFooBar generates getAFooBar() which in turn gives the property name AFooBar.

How to reproduce
Create an entity such as the one below and get its properties.

// ./src/Entity/UDemandeur.php

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ApiResource()
 * @ORM\Entity(repositoryClass="App\Repository\UDemandeurRepository")
 * @ORM\Table(name="U_DEMANDEUR")
 */
class UDemandeur {
    /**
     * @ApiProperty(identifier=true)
     * @ORM\Id()
     * @ORM\Column(type="string", name="U_DEMANDEURID", unique=true, length=255)
     */
    private $uDemandeurId;

    public function getUDemandeurId(): ?string
    {
        return $this->uDemandeurId;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy