Code Monkey home page Code Monkey logo

codeigniter-doctrine's People

Contributors

davidbarratt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

amrsoliman

codeigniter-doctrine's Issues

How to call Repository Function from Controller in CI

Hi, I am using your library. Really its awesome.
But i am stuck in somewhere, Where i need to run some custom query.
Here is my Entity code :-
use Doctrine\ORM\Mapping as ORM; /** * Entity\PdContact * @ORM\Entity(repositoryClass="models\\Repositories\\PdContactRepository") * @ORM\Table(name="pd_contact") * @ORM\Entity */ class PdContact { /** * @var int * * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; }

And here is Controller Code :-
`<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once(APPPATH . "models/Entities/PdContact.php");
#use \PdContact;

         class Welcome extends CI_Controller {
                     public $em;

                 function __construct() {
                        parent::__construct();

                   // Not required if you autoload the library
                     $this->load->library('doctrine');
                    $this->em = $this->doctrine->em;
                  }
              function getRecord() {
                 $user = $this->em->getRepository('PdContact')->getAllContactsUsers();
                 #$user = $this->em->find('Mode\Entities\PdContact', 1);
                  echo "<pre>";
                print_r($user);
                 exit;
           }
  }

`

and here is my Repository code which is located in application/models/Repositories
<?php namespace Repositories; use Doctrine\ORM\EntityRepository; class PdContactRepository extends EntityRepository { public function getAllContactsUsers() { return $this->_em->createQuery('SELECT u FROM PdContact u WHERE u.message = "message"') ->getResult() } }

But when i trying to access repository function i am getting this error :-

An uncaught Exception was encountered

Type: BadMethodCallException
Message: Undefined method 'getAllContactsUsers'. The method name must start with either findBy or findOneBy!

Filename: D:\xampp\htdocs\ci_demo\vendor\doctrine\orm\lib\Doctrine\ORM\EntityRepository.php

Line Number: 225

Please provide me needful solution.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.