prepareManufacturerData example

/** * @throws ValidationException * * @return ManufacturerModel */
    public function create(array $params)
    {
        $this->checkPrivilege('create');

        $manufacturer = new ManufacturerModel();

        $params = $this->prepareManufacturerData($params);
        $params = $this->prepareMediaData($params$manufacturer);

        $manufacturer->fromArray($params);

        if (isset($params['id'])) {
            $metaData = $this->getManager()->getMetadataFactory()->getMetadataFor(ManufacturerModel::class);
            $metaData->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
            $manufacturer->setPrimaryIdentifier($params['id']);
        }

        $violations = $this->getManager()->validate($manufacturer);
        
Home | Imprint | This part of the site doesn't use cookies.