<?php

namespace RxConnexionBundle\Repository;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;

class CanvassItemSupplierRepository extends EntityRepository
{
    public function validate($canvassItemSupplier_form) {

        $errors = array();

        $action = $canvassItemSupplier_form['action'];

        // d = delete
        if($action !== 'd') {

            if(empty($canvassItemSupplier_form['supplier_id']))
                $errors[] = 'Please enter supplier.';

            //if(empty($canvassItemSupplier_form['price']))
            //    $errors[] = 'Price should not be blank.';
        }

        return $errors;
    }
}