Search Results

Search found 1 results on 1 pages for 'grafoki'.

Page 1/1 | 1 

  • symfony 2 verify type of data stored in a single column

    - by GRafoKI
    In my DB I have a column 'own_product' that contains 2 values ( quantity and name) In my Edit form I want to check if the first field (quantity) is string and positive or not. I added a new column 'type-prod' (int , string) this is my controller : $request = $this->container->get('request'); if ($request->getMethod() == 'POST') { $formel = $request->query->get('edit_formal'); $type_value = $formel['own_product']; //case int $type_int= $this ->getDoctrine() ->getEntityManager() ->getRepository('DHG\WelcomeBundle\Entity\type-prod') ->findOneBy(array('type' => 'int')); //case string $type_string = $this ->getDoctrine() ->getEntityManager() ->getRepository('DHG\WelcomeBundle\Entity\type-prod') ->findOneBy(array('type' => 'string')); if (isset($type_value) && $type_int && $type_value > 0 && is_int($type_value)) { echo 'Success'; } else echo 'error' ; } Thank you !

    Read the article

1