camna / codeigniter-doctrine Goto Github PK
View Code? Open in Web Editor NEWCodeIgniter Wrapper for the Doctrine ORM
CodeIgniter Wrapper for the Doctrine ORM
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.