Partner example

public function savePartnerAction()
    {
        $params = $this->Request()->getParams();

        $id = $this->Request()->getParam('id');

        if (!empty($id)) {
            // Edit Data             $partnerModel = $this->get('models')->getRepository(Partner::class)->find($id);
        } else {
            // New Data             $partnerModel = new Partner();
            $partnerModel->setDate('now');
        }
        unset($params['date']);
        $partnerModel->fromArray($params);

        try {
            $this->get('models')->persist($partnerModel);
            $this->get('models')->flush();

            $repository = $this->get('models')->getRepository(Partner::class);

            
Home | Imprint | This part of the site doesn't use cookies.