public function isCreate()
    {
        $entity = $this->_context['entity'];
        if (is_array($entity) || $entity instanceof Traversable) {
            foreach ($entity as $e) {
                $entity = $e;
                break;
            }
        }
        if ($entity instanceof EntityInterface) {
            return $entity->isNew() !== false;
        }

        return true;
    }
public function isCreate()
    {
        $entity = $this->_context['entity'];
        if (is_array($entity) || $entity instanceof Traversable) {
            foreach ($entity as $e) {
                $entity = $e;
                break;
            }
        }
        if ($entity instanceof EntityInterface) {
            return $entity->isNew() !== false;
        }

        return true;
    }
public function isCreate ( ) { $ entity = $ this -> _context [ 'entity' ] ; if ( is_array ( $ entity ) || $ entity instanceof Traversable ) { foreach ( $ entity as $ e ) { $ entity = $ e ; break ; } } if ( $ entity instanceof EntityInterface ) { return $ entity -> isNew ( ) !== false ; } return true ; }
Check whether or not this form is a create or update.

If the context is for a single entity, the entity's isNew() method will
be used. If isNew() returns null, a create operation will be assumed.

If the context is for a collection or array the first object in the
collection will be used.

@return bool
Check whether or not this form is a create or update .