create api platform filter to an attribute that’s no handled by doctrine

I use abstract class to create inheritance .

 * @ORMInheritanceType("JOINED")
 * @ORMDiscriminatorColumn(name="status", type="string")
 * @ORMDiscriminatorMap({
 *     "ContactAcquereur" = "ContactAcquereur",
 *     "ContactNegociateur" = "ContactNegociateur",
 *     "ContactVendeur" = "ContactVendeur",
 * })
 */
abstract class AbstractContact implements InterfaceContact

i create a status params in the parent class and i use this param to get the type of the child.

    const CONTACT_VENDEUR    = 'ContactVendeur';
    const CONTACT_ACQUEREUR = 'ContactAcquereur';
    const CONTACT_NEGOCIATEUR = 'ContactNegociateur';

    /**
     * @Groups({"contact:read", "contact:write"})
     */
    private $status;

I want to create a filter base on the status variable :

 * @ApiFilter(
 *     SearchFilter::class,
 *     properties={"status": "exact"}
 *     )
 *

The filter doesn’t work.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *